]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Always create the ARP state when binding .... when adding the address only search...
authorRoy Marples <roy@marples.name>
Fri, 14 Oct 2016 09:19:29 +0000 (09:19 +0000)
committerRoy Marples <roy@marples.name>
Fri, 14 Oct 2016 09:19:29 +0000 (09:19 +0000)
dhcp.c
ipv4.c

diff --git a/dhcp.c b/dhcp.c
index f6e1d163229322fc64dd5f8cfea9b02e75566252..e6775c5851d26de190d13ae82f682a07c5252a5c 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -2317,13 +2317,13 @@ dhcp_arp_address(struct interface *ifp)
        /* If the interface already has the address configured
         * then we can't ARP for duplicate detection. */
        ia = ipv4_findaddr(ifp->ctx, &addr);
+       if ((astate = arp_new(ifp, &addr)) == NULL)
+               return -1;
+       astate->probed_cb = dhcp_arp_probed;
+       astate->conflicted_cb = dhcp_arp_conflicted;
 
 #ifdef IN_IFF_TENTATIVE
        if (ia == NULL || ia->addr_flags & IN_IFF_NOTUSEABLE) {
-               if ((astate = arp_new(ifp, &addr)) != NULL) {
-                       astate->probed_cb = dhcp_arp_probed;
-                       astate->conflicted_cb = dhcp_arp_conflicted;
-               }
                if (ia == NULL) {
                        struct dhcp_lease l;
 
@@ -2342,12 +2342,8 @@ dhcp_arp_address(struct interface *ifp)
                get_lease(ifp, &l, state->offer, state->offer_len);
                logger(ifp->ctx, LOG_INFO, "%s: probing address %s/%d",
                    ifp->name, inet_ntoa(l.addr), inet_ntocidr(l.mask));
-               if ((astate = arp_new(ifp, &addr)) != NULL) {
-                       astate->probed_cb = dhcp_arp_probed;
-                       astate->conflicted_cb = dhcp_arp_conflicted;
-                       /* We need to handle DAD. */
-                       arp_probe(astate);
-               }
+               /* We need to handle DAD. */
+               arp_probe(astate);
                return 0;
        }
 #endif
diff --git a/ipv4.c b/ipv4.c
index 837fb8864377f9b578cc08fc09d6d984e98ceb86..67e9f46641b50c787b15805e94c6f4fd99dc95df 100644 (file)
--- a/ipv4.c
+++ b/ipv4.c
@@ -1260,7 +1260,7 @@ ipv4_applyaddr(void *arg)
        if (ifo->options & DHCPCD_ARP) {
                struct arp_state *astate;
 
-               if ((astate = arp_new(ifp, &state->addr->addr)) != NULL)
+               if ((astate = arp_find(ifp, &state->addr->addr)) != NULL)
                        arp_announce(astate);
        }
        if (state->state == DHS_BOUND) {