From: Roy Marples Date: Sun, 9 Apr 2017 19:07:38 +0000 (+0100) Subject: Log bpf_arp and bpf_bootp failures. X-Git-Tag: v7.0.0-beta3~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e1c4c6e7fc5df8d40283ee0884d0840b55b9523;p=thirdparty%2Fdhcpcd.git Log bpf_arp and bpf_bootp failures. --- diff --git a/src/arp.c b/src/arp.c index 02047bfe..74f6f6d6 100644 --- a/src/arp.c +++ b/src/arp.c @@ -274,7 +274,8 @@ arp_probe(struct arp_state *astate) } else { const struct iarp_state *state = ARP_CSTATE(astate->iface); - bpf_arp(astate->iface, state->fd); + if (bpf_arp(astate->iface, state->fd) == -1) + logerr(__func__); } astate->probes = 0; logdebug("%s: probing for %s", @@ -406,7 +407,8 @@ arp_new(struct interface *ifp, const struct in_addr *addr) state = ARP_STATE(ifp); TAILQ_INSERT_TAIL(&state->arp_states, astate, next); - bpf_arp(ifp, state->fd); + if (bpf_arp(ifp, state->fd) == -1) + logerr(__func__); /* try and continue */ return astate; } @@ -441,7 +443,8 @@ arp_free(struct arp_state *astate) free(state); ifp->if_data[IF_DATA_ARP] = NULL; } else - bpf_arp(ifp, state->fd); + if (bpf_arp(ifp, state->fd) == -1) + logerr(__func__); } static void diff --git a/src/dhcp.c b/src/dhcp.c index 7073ebd6..2105f1f3 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -1528,8 +1528,10 @@ dhcp_new_xid(struct interface *ifp) state->xid = arc4random(); /* As the XID changes, re-apply the filter. */ - if (state->bpf_fd != -1) - bpf_bootp(ifp, state->bpf_fd); + if (state->bpf_fd != -1) { + if (bpf_bootp(ifp, state->bpf_fd) == -1) + logerr(__func__); /* try to continue */ + } } void @@ -2267,7 +2269,8 @@ dhcp_bind(struct interface *ifp) } state->state = DHS_BOUND; /* Re-apply the filter because we need to accept any XID anymore. */ - bpf_bootp(ifp, state->bpf_fd); + if (bpf_bootp(ifp, state->bpf_fd) == -1) + logerr(__func__); /* try to continue */ if (!state->lease.frominfo && !(ifo->options & (DHCPCD_INFORM | DHCPCD_STATIC))) if (write_lease(ifp, state->new, state->new_len) == -1)