From: Roy Marples Date: Fri, 10 Mar 2017 08:36:26 +0000 (+0000) Subject: bpf: only interested in direct conflict (sender) or ARP probes. X-Git-Tag: v7.0.0-beta1~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f5c2afc4ccca438f815f87ae9133ec7195ef22d;p=thirdparty%2Fdhcpcd.git bpf: only interested in direct conflict (sender) or ARP probes. --- diff --git a/bpf.c b/bpf.c index c3e2ff58..73e83e28 100644 --- a/bpf.c +++ b/bpf.c @@ -417,7 +417,7 @@ static const struct bpf_insn bpf_arp_filter [] = { BPF_STMT(BPF_RET + BPF_K, 0), }; #define bpf_arp_filter_len __arraycount(bpf_arp_filter) -#define bpf_arp_extra ((ARP_ADDRS_MAX * 2) * 2) + 2 +#define bpf_arp_extra (((ARP_ADDRS_MAX + 1) * 2) * 2) + 2 int bpf_arp(struct interface *ifp, int fd) @@ -473,6 +473,13 @@ bpf_arp(struct interface *ifp, int fd) bp++; } + /* If we didn't match sender, then we're only interested in + * ARP probes to us, so check the null host sender. */ + BPF_SET_JUMP(bp, BPF_JMP + BPF_JEQ + BPF_K, INADDR_ANY, 1, 0); + bp++; + BPF_SET_STMT(bp, BPF_RET + BPF_K, 0); + bp++; + /* Match target protocol address */ BPF_SET_STMT(bp, BPF_LD + BPF_W + BPF_IND, (sizeof(struct arphdr)