]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Log bpf_arp and bpf_bootp failures.
authorRoy Marples <roy@marples.name>
Sun, 9 Apr 2017 19:07:38 +0000 (20:07 +0100)
committerRoy Marples <roy@marples.name>
Sun, 9 Apr 2017 19:07:38 +0000 (20:07 +0100)
src/arp.c
src/dhcp.c

index 02047bfed76297687bbf2517d2a52c5fa0ea9608..74f6f6d6bde230cfe76a43746ccbc75fd843e419 100644 (file)
--- 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
index 7073ebd6cd2fde20f0fe83e57910c6c552c5147a..2105f1f3c3ef1738a9190ce2e07719644e256d4a 100644 (file)
@@ -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)