diff options
| author | Roy Marples <roy@marples.name> | 2008-07-10 11:55:10 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-07-10 11:55:10 +0000 |
| commit | 3459b19014ee166ae9a8bb945ffbe9ac3454edb5 (patch) | |
| tree | d5959426847ed9cb4c73a9f261e567cf52e32067 /bpf-filter.h | |
| parent | f5f8e223833e1d13d157d465d3626ea6a4bba67c (diff) | |
| download | dhcpcd-3459b19014ee166ae9a8bb945ffbe9ac3454edb5.tar.xz | |
Allow ARP_REQUESTS through the filter as well so we work with conflicting IPV4LL probes. This requires the timeout to work of a time instead of a timeout.
Diffstat (limited to 'bpf-filter.h')
| -rw-r--r-- | bpf-filter.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/bpf-filter.h b/bpf-filter.h index adcc8bbb..881f678e 100644 --- a/bpf-filter.h +++ b/bpf-filter.h @@ -36,14 +36,14 @@ static const struct bpf_insn const arp_bpf_filter [] = { BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 12), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETHERTYPE_ARP, 0, 3), #endif - - /* Make sure this is an ARP REPLY... */ + /* Make sure this is an ARP REQUEST... */ + BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20 + BPF_ETHCOOK), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ARPOP_REQUEST, 2, 0), + /* or ARP REPLY... */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20 + BPF_ETHCOOK), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ARPOP_REPLY, 0, 1), - /* If we passed all the tests, ask for the whole packet. */ BPF_STMT(BPF_RET + BPF_K, BPF_WHOLEPACKET), - /* Otherwise, drop it. */ BPF_STMT(BPF_RET + BPF_K, 0), }; @@ -81,25 +81,19 @@ static const struct bpf_insn const dhcp_bpf_filter [] = { BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 12), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETHERTYPE_IP, 0, 8), #endif - /* Make sure it's a UDP packet... */ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 23 + BPF_ETHCOOK), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6), - /* Make sure this isn't a fragment... */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20 + BPF_ETHCOOK), BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0), - /* Get the IP header length... */ BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 14 + BPF_ETHCOOK), - /* Make sure it's to the right port... */ BPF_STMT(BPF_LD + BPF_H + BPF_IND, 16 + BPF_ETHCOOK), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, DHCP_CLIENT_PORT, 0, 1), - /* If we passed all the tests, ask for the whole packet. */ BPF_STMT(BPF_RET + BPF_K, BPF_WHOLEPACKET), - /* Otherwise, drop it. */ BPF_STMT(BPF_RET + BPF_K, 0), }; |
