]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
BPF filter size is unsigned int
authorRoy Marples <roy@marples.name>
Mon, 31 Mar 2014 20:00:06 +0000 (20:00 +0000)
committerRoy Marples <roy@marples.name>
Mon, 31 Mar 2014 20:00:06 +0000 (20:00 +0000)
bpf-filter.h
lpf.c

index 9bd15d8d68bc3ca2ac36930a6e2975f67dacd21a..469db0eca686f698e5e34a0aae1d24470616a3e3 100644 (file)
@@ -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 2501ed0b344eaf977a427dc2ae18d6660ad44ea8..a3b1b62bfd7c68531833fd7f0f58947f15667294 100644 (file)
--- 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;