]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCP: Defend already configured static addresses
authorRoy Marples <roy@marples.name>
Wed, 22 Jan 2020 17:15:30 +0000 (17:15 +0000)
committerRoy Marples <roy@marples.name>
Wed, 22 Jan 2020 17:15:30 +0000 (17:15 +0000)
src/dhcp.c

index 0319301b0ea5b02b1ef853dfdab184a7e441ddf6..1ae1a5a26623e21478b8f4722cc482346d00d32a 100644 (file)
@@ -2454,23 +2454,25 @@ dhcp_arp_address(struct interface *ifp)
        }
 #else
        if (!(ifp->flags & IFF_NOARP) &&
-           ifp->options->options & DHCPCD_ARP &&
-           ia == NULL)
+           ifp->options->options & DHCPCD_ARP)
        {
                struct arp_state *astate;
                struct dhcp_lease l;
 
+               /* Even if the address exists, we need to defend it. */
                astate = dhcp_arp_new(ifp, &addr);
                if (astate == NULL)
                        return -1;
 
-               state->state = DHS_PROBE;
-               get_lease(ifp, &l, state->offer, state->offer_len);
-               loginfox("%s: probing address %s/%d",
-                   ifp->name, inet_ntoa(l.addr), inet_ntocidr(l.mask));
-               /* We need to handle DAD. */
-               arp_probe(astate);
-               return 0;
+               if (ia == NULL) {
+                       state->state = DHS_PROBE;
+                       get_lease(ifp, &l, state->offer, state->offer_len);
+                       loginfox("%s: probing address %s/%d",
+                           ifp->name, inet_ntoa(l.addr), inet_ntocidr(l.mask));
+                       /* We need to handle DAD. */
+                       arp_probe(astate);
+                       return 0;
+               }
        }
 #endif