From: Roy Marples Date: Wed, 20 May 2020 15:43:44 +0000 (+0000) Subject: ARP: A few minor fixes for prior X-Git-Tag: v9.1.0~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aaa5b2fcd1855a4d054f100b55927e97609c5bd7;p=thirdparty%2Fdhcpcd.git ARP: A few minor fixes for prior --- diff --git a/src/arp.c b/src/arp.c index ee06a057..7f08a17b 100644 --- a/src/arp.c +++ b/src/arp.c @@ -443,7 +443,7 @@ skip_request: astate); } -void +static void arp_announce(struct arp_state *astate) { struct iarp_state *state; @@ -483,7 +483,7 @@ arp_ifannounceaddr(struct interface *ifp, const struct in_addr *ia) { 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 --git a/src/arp.h b/src/arp.h index 602317ca..beacfec6 100644 --- a/src/arp.h +++ b/src/arp.h @@ -96,7 +96,6 @@ struct iarp_state { 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 --git a/src/dhcp.c b/src/dhcp.c index 744d672b..4b0b26a2 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -2010,6 +2010,8 @@ dhcp_finish_dad(struct interface *ifp, struct in_addr *ia) 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_bind(struct interface *ifp) 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 @@ dhcp_abort(struct interface *ifp) 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 --git a/src/ipv4.c b/src/ipv4.c index c6a76ea3..a259c87c 100644 --- a/src/ipv4.c +++ b/src/ipv4.c @@ -747,6 +747,8 @@ ipv4_applyaddr(void *arg) /* 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 @@ ipv4_applyaddr(void *arg) #ifdef ARP arp_announceaddr(ifp->ctx, &state->addr->addr); + if (ifp->ctx->options & DHCPCD_FORKED) + return; #endif if (state->state == DHS_BOUND) {