udhcpc: fix BPF filter. Hopefully fixes the root cause of 4598 and 6746
Use a *signed* large positive value in BPF filter to indicate success. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
50e4cc29f5
commit
ffc3a93d0d
@ -711,7 +711,7 @@ static int d6_raw_socket(int ifindex)
|
|||||||
/* jump to L3 if udp dport is CLIENT_PORT6, else to L4 */
|
/* jump to L3 if udp dport is CLIENT_PORT6, else to L4 */
|
||||||
BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, 68, 0, 1),
|
BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, 68, 0, 1),
|
||||||
/* L3: accept packet */
|
/* L3: accept packet */
|
||||||
BPF_STMT(BPF_RET|BPF_K, 0xffffffff),
|
BPF_STMT(BPF_RET|BPF_K, 0x7fffffff),
|
||||||
/* L4: discard packet */
|
/* L4: discard packet */
|
||||||
BPF_STMT(BPF_RET|BPF_K, 0),
|
BPF_STMT(BPF_RET|BPF_K, 0),
|
||||||
};
|
};
|
||||||
|
@ -1025,9 +1025,10 @@ static int udhcp_raw_socket(int ifindex)
|
|||||||
BPF_STMT(BPF_LD|BPF_H|BPF_IND, 2),
|
BPF_STMT(BPF_LD|BPF_H|BPF_IND, 2),
|
||||||
/* jump to L3 if udp dport is CLIENT_PORT, else to L4 */
|
/* jump to L3 if udp dport is CLIENT_PORT, else to L4 */
|
||||||
BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, 68, 0, 1),
|
BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, 68, 0, 1),
|
||||||
/* L3: accept packet */
|
/* L3: accept packet ("accept 0x7fffffff bytes") */
|
||||||
BPF_STMT(BPF_RET|BPF_K, 0xffffffff),
|
/* Accepting 0xffffffff works too but kernel 2.6.19 is buggy */
|
||||||
/* L4: discard packet */
|
BPF_STMT(BPF_RET|BPF_K, 0x7fffffff),
|
||||||
|
/* L4: discard packet ("accept zero bytes") */
|
||||||
BPF_STMT(BPF_RET|BPF_K, 0),
|
BPF_STMT(BPF_RET|BPF_K, 0),
|
||||||
};
|
};
|
||||||
static const struct sock_fprog filter_prog = {
|
static const struct sock_fprog filter_prog = {
|
||||||
|
Loading…
Reference in New Issue
Block a user