From: Roy Marples Date: Mon, 31 Mar 2014 20:00:06 +0000 (+0000) Subject: BPF filter size is unsigned int X-Git-Tag: v6.4.0~121 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1eb3fab10e4dbf32d8b45c9b87bdf5a3c45790fd;p=thirdparty%2Fdhcpcd.git BPF filter size is unsigned int --- diff --git a/bpf-filter.h b/bpf-filter.h index 9bd15d8d..469db0ec 100644 --- a/bpf-filter.h +++ b/bpf-filter.h @@ -47,7 +47,7 @@ static const struct bpf_insn arp_bpf_filter [] = { /* Otherwise, drop it. */ BPF_STMT(BPF_RET + BPF_K, 0), }; -static const size_t arp_bpf_filter_len = +static const unsigned int arp_bpf_filter_len = sizeof(arp_bpf_filter) / sizeof(arp_bpf_filter[0]); @@ -97,5 +97,5 @@ static const struct bpf_insn dhcp_bpf_filter [] = { /* Otherwise, drop it. */ BPF_STMT(BPF_RET + BPF_K, 0), }; -static const size_t dhcp_bpf_filter_len = +static const unsigned int dhcp_bpf_filter_len = sizeof(dhcp_bpf_filter) / sizeof(dhcp_bpf_filter[0]); diff --git a/lpf.c b/lpf.c index 2501ed0b..a3b1b62b 100644 --- a/lpf.c +++ b/lpf.c @@ -92,10 +92,10 @@ ipv4_opensocket(struct interface *ifp, int protocol) memset(&pf, 0, sizeof(pf)); if (protocol == ETHERTYPE_ARP) { pf.filter = UNCONST(arp_bpf_filter); - pf.len = (unsigned int)arp_bpf_filter_len; + pf.len = arp_bpf_filter_len; } else { pf.filter = UNCONST(dhcp_bpf_filter); - pf.len = (unsigned int)dhcp_bpf_filter_len; + pf.len = dhcp_bpf_filter_len; } if (setsockopt(s, SOL_SOCKET, SO_ATTACH_FILTER, &pf, sizeof(pf)) != 0) goto eexit;