]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Only log the once we have logged the delegated prefix.
authorRoy Marples <roy@marples.name>
Fri, 10 Jun 2016 08:56:00 +0000 (08:56 +0000)
committerRoy Marples <roy@marples.name>
Fri, 10 Jun 2016 08:56:00 +0000 (08:56 +0000)
dhcp6.c
ipv6.h

diff --git a/dhcp6.c b/dhcp6.c
index ef91c13d2e58ca9fb64b012f76b508cbb8b9bf81..d89946134531430274235c77a99324b30de97186 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -1866,6 +1866,9 @@ dhcp6_findpd(struct interface *ifp, const uint8_t *iaid,
                        continue;
                }
 
+               pltime = 20;
+               vltime = 30;
+
                TAILQ_FOREACH(a, &state->addrs, next) {
                        if (IN6_ARE_ADDR_EQUAL(&a->prefix, &pdp->prefix))
                                break;
@@ -2476,6 +2479,11 @@ dhcp6_delegate_prefix(struct interface *ifp)
        ifo = ifp->options;
        state = D6_STATE(ifp);
 
+       /* Clear the logged flag. */
+       TAILQ_FOREACH(ap, &state->addrs, next) {
+               ap->flags &= ~IPV6_AF_DELEGATEDLOG;
+       }
+
        TAILQ_FOREACH(ifd, ifp->ctx->ifaces, next) {
                if (!ifd->active)
                        continue;
@@ -2484,11 +2492,16 @@ dhcp6_delegate_prefix(struct interface *ifp)
                TAILQ_FOREACH(ap, &state->addrs, next) {
                        if (!(ap->flags & IPV6_AF_DELEGATEDPFX))
                                continue;
-                       logger(ifp->ctx,
-                           ap->flags & IPV6_AF_NEW ? LOG_INFO : LOG_DEBUG,
-                           "%s: delegated prefix %s",
-                           ifp->name, ap->saddr);
-                       ap->flags &= ~IPV6_AF_NEW;
+                       if (!(ap->flags & IPV6_AF_DELEGATEDLOG)) {
+                               /* We only want to log this the once as we loop
+                                * through many interfaces first. */
+                               ap->flags |= IPV6_AF_DELEGATEDLOG;
+                               logger(ifp->ctx,
+                                   ap->flags & IPV6_AF_NEW ?LOG_INFO:LOG_DEBUG,
+                                   "%s: delegated prefix %s",
+                                   ifp->name, ap->saddr);
+                               ap->flags &= ~IPV6_AF_NEW;
+                       }
                        for (i = 0; i < ifo->ia_len; i++) {
                                ia = &ifo->ia[i];
                                if (memcmp(ia->iaid, ap->iaid,
diff --git a/ipv6.h b/ipv6.h
index 125d1ff0829154454bcf2da623f3fce9e00615f8..68568a3811e4db5eb409baef3ba86a1bff9cfbd6 100644 (file)
--- a/ipv6.h
+++ b/ipv6.h
@@ -181,8 +181,9 @@ struct ipv6_addr {
 #define        IPV6_AF_NOREJECT        0x0200
 #define        IPV6_AF_REQUEST         0x0400
 #define        IPV6_AF_STATIC          0x0800
+#define IPV6_AF_DELEGATEDLOG   0x1000
 #ifdef IPV6_MANAGETEMPADDR
-#define        IPV6_AF_TEMPORARY       0X1000
+#define        IPV6_AF_TEMPORARY       0X2000
 #endif
 
 struct rt6 {