# HG changeset patch # User Roy Marples # Date 1589989424 0 # Node ID 989bcc6c8e70880a598ff065367a2f8b956ad34f # Parent 0281af78918f4228e784876cd74e03779eb74686 ARP: A few minor fixes for prior diff -r 0281af78918f -r 989bcc6c8e70 src/arp.c --- a/src/arp.c Wed May 20 14:15:30 2020 +0100 +++ b/src/arp.c Wed May 20 15:43:44 2020 +0000 @@ -443,7 +443,7 @@ astate); } -void +static void arp_announce(struct arp_state *astate) { struct iarp_state *state; @@ -483,7 +483,7 @@ { struct arp_state *astate; - if (ifp->flags & IFF_NOARP) + if (ifp->flags & IFF_NOARP || !(ifp->options->options & DHCPCD_ARP)) return NULL; astate = arp_find(ifp, ia); diff -r 0281af78918f -r 989bcc6c8e70 src/arp.h --- a/src/arp.h Wed May 20 14:15:30 2020 +0100 +++ b/src/arp.h Wed May 20 15:43:44 2020 +0000 @@ -96,7 +96,6 @@ void arp_packet(struct interface *, uint8_t *, size_t, unsigned int); struct arp_state *arp_new(struct interface *, const struct in_addr *); void arp_probe(struct arp_state *); -void arp_announce(struct arp_state *); struct arp_state *arp_announceaddr(struct dhcpcd_ctx *, const struct in_addr *); struct arp_state *arp_ifannounceaddr(struct interface *, const struct in_addr *); void arp_cancel(struct arp_state *); diff -r 0281af78918f -r 989bcc6c8e70 src/dhcp.c --- a/src/dhcp.c Wed May 20 14:15:30 2020 +0100 +++ b/src/dhcp.c Wed May 20 15:43:44 2020 +0000 @@ -2010,6 +2010,8 @@ state->new_len = state->offer_len; get_lease(ifp, &state->lease, state->new, state->new_len); ipv4_applyaddr(ifp); + if (ifp->ctx->options & DHCPCD_FORKED) + return; state->new = bootp; state->new_len = len; } @@ -2339,6 +2341,8 @@ dhcp_close(ifp); ipv4_applyaddr(ifp); + if (ifp->ctx->options & DHCPCD_FORKED) + return; /* If not in master mode, open an address specific socket. */ if (ctx->options & DHCPCD_MASTER || @@ -4107,7 +4111,8 @@ if (state != NULL && state->added) { rt_build(ifp->ctx, AF_INET); #ifdef ARP - arp_announceaddr(ifp->ctx, &state->addr->addr); + if (ifp->options->options & DHCPCD_ARP) + arp_announceaddr(ifp->ctx, &state->addr->addr); #endif } } diff -r 0281af78918f -r 989bcc6c8e70 src/ipv4.c --- a/src/ipv4.c Wed May 20 14:15:30 2020 +0100 +++ b/src/ipv4.c Wed May 20 15:43:44 2020 +0000 @@ -747,6 +747,8 @@ /* Announce the preferred address to * kick ARP caches. */ arp_announceaddr(ifp->ctx,&lease->addr); + if (ifp->ctx->options & DHCPCD_FORKED) + return; #endif } script_runreason(ifp, state->reason); @@ -809,6 +811,8 @@ #ifdef ARP arp_announceaddr(ifp->ctx, &state->addr->addr); + if (ifp->ctx->options & DHCPCD_FORKED) + return; #endif if (state->state == DHS_BOUND) {