]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Linux does not change netmask/broadcast addresses when re-adding an address.
authorRoy Marples <roy@marples.name>
Mon, 25 Apr 2016 19:00:55 +0000 (19:00 +0000)
committerRoy Marples <roy@marples.name>
Mon, 25 Apr 2016 19:00:55 +0000 (19:00 +0000)
ipv4.c

diff --git a/ipv4.c b/ipv4.c
index 1ccdaa97e1f86d47710e7f88ad5d4c068a7da5d3..dcfedb0d951f4b31519fd07164f7711ac9df0682 100644 (file)
--- a/ipv4.c
+++ b/ipv4.c
@@ -1172,6 +1172,13 @@ ipv4_applyaddr(void *arg)
                    ifp->name, inet_ntoa(lease->addr),
                    inet_ntocidr(lease->net));
        else {
+#if __linux__
+               /* Linux does not change netmask/broadcast address
+                * for re-added addresses, so we need to delete the old one
+                * first. */
+               if (ap != NULL)
+                       ipv4_deladdr(ifp, &ap->addr, &ap->net, 0);
+#endif
                r = ipv4_daddaddr(ifp, lease);
                if (r == -1 && errno != EEXIST)
                        return;