]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Don't drop DHCPv6 if we have a delegated address on router expiry.
authorRoy Marples <roy@marples.name>
Thu, 26 May 2016 08:54:45 +0000 (08:54 +0000)
committerRoy Marples <roy@marples.name>
Thu, 26 May 2016 08:54:45 +0000 (08:54 +0000)
dhcp6.c
dhcp6.h
ipv6nd.c

diff --git a/dhcp6.c b/dhcp6.c
index 6beb7d86d66da8b1ab484c9074e12794ff5d5e62..aa6d3ce400a63a1fdfc50034e32c3c512869da5d 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -2520,7 +2520,7 @@ dhcp6_delegate_prefix(struct interface *ifp)
                if (k && !carrier_warned) {
                        ifd_state = D6_STATE(ifd);
                        ipv6_addaddrs(&ifd_state->addrs);
-                       if_initrt(ifd->ctx);
+                       if_initrt6(ifd->ctx);
                        ipv6_buildroutes(ifd->ctx);
                        dhcp6_script_try_run(ifd, 1);
                }
@@ -3424,6 +3424,20 @@ dhcp6_free(struct interface *ifp)
        dhcp6_freedrop(ifp, 0, NULL);
 }
 
+void dhcp6_dropnondelegates(struct interface *ifp)
+{
+       struct dhcp6_state *state;
+       struct ipv6_addr *ia;
+
+       if ((state = D6_STATE(ifp)) == NULL)
+               return;
+       TAILQ_FOREACH(ia, &state->addrs, next) {
+               if (ia->flags & (IPV6_AF_DELEGATED | IPV6_AF_DELEGATEDPFX))
+                       return;
+       }
+       dhcp6_drop(ifp, "EXPIRE6");
+}
+
 void
 dhcp6_handleifa(struct dhcpcd_ctx *ctx, int cmd, const char *ifname,
     const struct in6_addr *addr, int flags)
diff --git a/dhcp6.h b/dhcp6.h
index 3d4b8b7bdfaf9088aecabd304be7a5210229db43..3287bbaf7193bd160a21a580738cda82d23d8453 100644 (file)
--- a/dhcp6.h
+++ b/dhcp6.h
@@ -248,6 +248,7 @@ void dhcp6_handleifa(struct dhcpcd_ctx *, int, const char *,
     const struct in6_addr *addr, int);
 int dhcp6_dadcompleted(const struct interface *);
 void dhcp6_drop(struct interface *, const char *);
+void dhcp6_dropnondelegates(struct interface *ifp);
 int dhcp6_dump(struct interface *);
 #else
 #define dhcp6_find_delegates(a) {}
index 597be951efeba824123871f08ce71c9efa71d3f6..b0b65629abb075d1b831cc995f06b13c4018d439 100644 (file)
--- a/ipv6nd.c
+++ b/ipv6nd.c
@@ -255,15 +255,6 @@ ipv6nd_makersprobe(struct interface *ifp)
        return 0;
 }
 
-static void ipv6nd_dropdhcp6(struct interface *ifp)
-{
-       const struct dhcp6_state *d6;
-
-       /* Don't drop DHCP6 if the interface is delegated to. */
-       if ((d6 = D6_CSTATE(ifp)) != NULL && d6->state != DH6S_DELEGATED)
-               dhcp6_drop(ifp, "EXPIRE6");
-}
-
 static void
 ipv6nd_sendrsprobe(void *arg)
 {
@@ -327,7 +318,7 @@ ipv6nd_sendrsprobe(void *arg)
                logger(ifp->ctx, LOG_WARNING,
                    "%s: no IPv6 Routers available", ifp->name);
                ipv6nd_drop(ifp);
-               ipv6nd_dropdhcp6(ifp);
+               dhcp6_dropnondelegates(ifp);
        }
 }
 
@@ -1392,7 +1383,7 @@ ipv6nd_expirera(void *arg)
 
        /* No valid routers? Kill any DHCPv6. */
        if (!validone)
-               ipv6nd_dropdhcp6(ifp);
+               dhcp6_dropnondelegates(ifp);
 }
 
 void