From: Roy Marples Date: Fri, 10 Jun 2016 08:56:00 +0000 (+0000) Subject: Only log the once we have logged the delegated prefix. X-Git-Tag: v6.11.1~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=432554af2ee051801949bb423de2a70502255c41;p=thirdparty%2Fdhcpcd.git Only log the once we have logged the delegated prefix. --- diff --git a/dhcp6.c b/dhcp6.c index ef91c13d..d8994613 100644 --- 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 125d1ff0..68568a38 100644 --- 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 {