]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix DAD for delegated addresses.
authorRoy Marples <roy@marples.name>
Wed, 29 May 2013 12:59:47 +0000 (12:59 +0000)
committerRoy Marples <roy@marples.name>
Wed, 29 May 2013 12:59:47 +0000 (12:59 +0000)
dhcp6.c
ipv6.c

diff --git a/dhcp6.c b/dhcp6.c
index 7a017bca4b16de13eab2dd32f1f11525491f3b76..951ea7f92638cd80bd2dc2135ab476b1da01a785 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -1069,15 +1069,17 @@ dhcp6_dadcallback(void *arg)
                 * We should decline the address */
                syslog(LOG_WARNING, "%s: DAD detected %s",
                    ap->iface->name, ap->saddr);
-       else
 #ifdef IPV6_SEND_DAD
+       else
                ipv6_addaddr(ap);
 #endif
 
        if (!wascompleted) {
                ifp = ap->iface;
                state = D6_STATE(ifp);
-               if (state->state == DH6S_BOUND) {
+               if (state->state == DH6S_BOUND ||
+                   state->state == DH6S_DELEGATED)
+               {
                        TAILQ_FOREACH(ap, &state->addrs, next) {
                                if (!ap->dadcompleted) {
                                        wascompleted = 1;
@@ -1492,6 +1494,7 @@ dhcp6_delegate_addr(struct interface *ifp, const struct ipv6_addr *prefix,
 
                TAILQ_INIT(&state->addrs);
                state->state = DH6S_DELEGATED;
+               state->reason = "DELEGATED6";
        }
 
        a = calloc(1, sizeof(*a));
@@ -1901,7 +1904,7 @@ recv:
                len = 1;
                /* If all addresses have completed DAD run the script */
                TAILQ_FOREACH(ap, &state->addrs, next) {
-                       if (ap->dadcompleted == 0) {
+                       if (ap->onlink && ap->dadcompleted == 0) {
                                len = 0;
                                break;
                        }
diff --git a/ipv6.c b/ipv6.c
index 57b475d402bdd3532df5f06ca584f2793b1df90c..781783f15fdc2b70372ae80cda1a57bcfed1f079 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -296,6 +296,14 @@ ipv6_handleifa(int cmd, struct if_head *ifs, const char *ifname,
        struct ll_addr *ap;
        struct ll_callback *cb;
 
+#if 0
+       char buf[INET6_ADDRSTRLEN];
+       inet_ntop(AF_INET6, &addr->s6_addr,
+           buf, INET6_ADDRSTRLEN);
+       syslog(LOG_DEBUG, "%s: cmd %d addr %s flags %d",
+           ifname, cmd, buf, flags);
+#endif
+
        /* Safety - ignore tentative announcements */
        if (cmd == RTM_NEWADDR && flags & IN6_IFF_TENTATIVE)
                return;
@@ -448,6 +456,7 @@ ipv6_handleifa_addrs(int cmd,
                                 * dadcallback function checks it */
                                ap->dadcompleted = 1;
                        }
+                       break;
                }
        }