mirror of
https://github.com/rsmarples/dhcpcd.git
synced 2024-11-30 21:44:52 +08:00
BPF filter size is unsigned int
This commit is contained in:
parent
f751cdf6d3
commit
1eb3fab10e
@ -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]);
|
||||
|
4
lpf.c
4
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;
|
||||
|
Loading…
Reference in New Issue
Block a user