]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Report the first non requested address.
authorRoy Marples <roy@marples.name>
Wed, 25 May 2016 19:54:07 +0000 (19:54 +0000)
committerRoy Marples <roy@marples.name>
Wed, 25 May 2016 19:54:07 +0000 (19:54 +0000)
dhcp6.c

diff --git a/dhcp6.c b/dhcp6.c
index 90f70edec9ec459d48427305a5c513443f8db8b0..70c00dab8dd7d48b6fa3bd162f80e4799d72686e 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -2948,9 +2948,14 @@ dhcp6_handledata(void *arg)
        case DHCP6_ADVERTISE:
                if (state->state == DH6S_REQUEST) /* rapid commit */
                        break;
-               ap = TAILQ_FIRST(&state->addrs);
-               logger(ifp->ctx, LOG_INFO, "%s: ADV %s from %s",
-                   ifp->name, ap->saddr, ctx->sfrom);
+               TAILQ_FOREACH(ap, &state->addrs, next) {
+                       if (!(ap->flags & IPV6_AF_REQUEST))
+                               break;
+               }
+               if (ap == NULL)
+                       ap = TAILQ_FIRST(&state->addrs);
+               logger(ifp->ctx, LOG_INFO, "%s: ADV %p %s from %s",
+                   ifp->name, ap, ap->saddr, ctx->sfrom);
                if (ifp->ctx->options & DHCPCD_TEST)
                        break;
                dhcp6_startrequest(ifp);