]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Don't delete dhcpcd assigned IPv6 link-local addresses when releasing
authorRoy Marples <roy@marples.name>
Fri, 14 Aug 2015 22:10:58 +0000 (22:10 +0000)
committerRoy Marples <roy@marples.name>
Fri, 14 Aug 2015 22:10:58 +0000 (22:10 +0000)
leases.
Fixes [cc55ecae33].

ipv6.c

diff --git a/ipv6.c b/ipv6.c
index c160c847f285fd5a5fadf7fae00618a03da3d4b4..8d65420d6cd6913577e94e348ebede0d31999aed 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -880,17 +880,22 @@ ipv6_freedrop_addrs(struct ipv6_addrhead *addrs, int drop,
                {
                        if (drop == 2)
                                TAILQ_REMOVE(addrs, ap, next);
-                       /* Find the same address somewhere else */
-                       apf = ipv6_findaddr(ap->iface->ctx, &ap->addr, 0);
-                       if (apf == NULL ||
-                           (apf->iface != ap->iface))
-                               ipv6_deleteaddr(ap);
-                       if (!(ap->iface->options->options &
-                           DHCPCD_EXITING) && apf)
-                       {
-                               if (!timespecisset(&now))
-                                       clock_gettime(CLOCK_MONOTONIC, &now);
-                               ipv6_addaddr(apf, &now);
+                       /* Don't drop link-local addresses. */
+                       if (!IN6_IS_ADDR_LINKLOCAL(&ap->addr)) {
+                               /* Find the same address somewhere else */
+                               apf = ipv6_findaddr(ap->iface->ctx, &ap->addr,
+                                   0);
+                               if ((apf == NULL ||
+                                   (apf->iface != ap->iface)))
+                                       ipv6_deleteaddr(ap);
+                               if (!(ap->iface->options->options &
+                                   DHCPCD_EXITING) && apf)
+                               {
+                                       if (!timespecisset(&now))
+                                               clock_gettime(CLOCK_MONOTONIC,
+                                                   &now);
+                                       ipv6_addaddr(apf, &now);
+                               }
                        }
                        if (drop == 2)
                                ipv6_freeaddr(ap);