]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
ARP: A few minor fixes for prior
authorRoy Marples <roy@marples.name>
Wed, 20 May 2020 15:43:44 +0000 (15:43 +0000)
committerRoy Marples <roy@marples.name>
Wed, 20 May 2020 15:43:44 +0000 (15:43 +0000)
src/arp.c
src/arp.h
src/dhcp.c
src/ipv4.c

index ee06a057d43656881cdf98900ce2dbaac97ddb7c..7f08a17bbd8339e32063caf2ac8528617b2df236 100644 (file)
--- 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);
index 602317ca151794ffd3f8cdf51377aa26ca43b06b..beacfec6511a68c56e9e29d0dec168e39350370b 100644 (file)
--- 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 *);
index 744d672b7bbba681c7659170b2ca821805877706..4b0b26a2d35ae39b5ca86d397be0515616b1836e 100644 (file)
@@ -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
        }
 }
index c6a76ea3367d590cac8f149f0f09aa247f59775d..a259c87c6e55ec79a7a881ae4ed352885ae4003a 100644 (file)
@@ -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) {