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;