From: Roy Marples Date: Wed, 29 May 2013 12:59:47 +0000 (+0000) Subject: Fix DAD for delegated addresses. X-Git-Tag: v5.99.7~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=28bae8ce393d0add16b9dd344595de6bb8b6e3b0;p=thirdparty%2Fdhcpcd.git Fix DAD for delegated addresses. --- diff --git a/dhcp6.c b/dhcp6.c index 7a017bca..951ea7f9 100644 --- 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 57b475d4..781783f1 100644 --- 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; } }