]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Rework prior again so we log the address in debug.
authorRoy Marples <roy@marples.name>
Sun, 28 Jul 2019 14:56:41 +0000 (15:56 +0100)
committerRoy Marples <roy@marples.name>
Sun, 28 Jul 2019 14:56:41 +0000 (15:56 +0100)
src/ipv4.c

index 86e6584bd0d60c430f557187cb6ac1ac9ec14921..c3cb0bfb5bc4744230069c28a077485b83003b4b 100644 (file)
@@ -756,14 +756,23 @@ ipv4_applyaddr(void *arg)
         * If IP addresses do not have lifetimes, there is a very real chance
         * that re-adding them will scrub the subnet route temporarily
         * which is a bad thing, so avoid it. */
-       if (ia == NULL &&
-           (ia->mask.s_addr != lease->mask.s_addr ||
-           ia->brd.s_addr != lease->brd.s_addr))
+       if (ia != NULL &&
+           ia->mask.s_addr == lease->mask.s_addr &&
+           ia->brd.s_addr == lease->brd.s_addr)
        {
+#ifndef IP_LIFETIME
+               logdebugx("%s: IP address %s already exists",
+                   ifp->name, ia->saddr);
+#endif
+       } else {
 #ifdef __linux__
+               /* Linux does not change netmask/broadcast address
+                * for re-added addresses, so we need to delete the old one
+                * first. */
                if (ia != NULL)
                        ipv4_deladdr(ia, 0);
-#elif !defined(IP_LIFETIME)
+#endif
+#ifndef IP_LIFETIME
                if (ipv4_daddaddr(ifp, lease) == -1 && errno != EEXIST)
                        return;
 #endif