From: Roy Marples Date: Fri, 8 Apr 2016 09:38:53 +0000 (+0000) Subject: Log RA's only when it's a new router unless debugging is enabled. X-Git-Tag: v6.10.2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19e75b953a98aa7990f2abb6c12e21ba9c10cea6;p=thirdparty%2Fdhcpcd.git Log RA's only when it's a new router unless debugging is enabled. This is because some routers decrease the preferred and valid times in accordance to their own prefixes and we don't want to needlessly spam the log. Fixed [01f7cbd3b1]. --- diff --git a/ipv6nd.c b/ipv6nd.c index 482899bd..716283a3 100644 --- a/ipv6nd.c +++ b/ipv6nd.c @@ -806,10 +806,6 @@ ipv6nd_handlera(struct dhcpcd_ctx *dctx, struct interface *ifp, new_data = 1; } else new_data = 0; - if (new_data || ifp->options->options & DHCPCD_DEBUG) - logger(ifp->ctx, LOG_INFO, "%s: Router Advertisement from %s", - ifp->name, ctx->sfrom); - if (rap == NULL) { rap = calloc(1, sizeof(*rap)); if (rap == NULL) { @@ -835,6 +831,14 @@ ipv6nd_handlera(struct dhcpcd_ctx *dctx, struct interface *ifp, rap->data_len = len; } + /* We could change the debug level based on new_data, but some + * routers like to decrease the advertised valid and preferred times + * in accordance with the own prefix times which would result in too + * much needless log spam. */ + logger(ifp->ctx, new_rap ? LOG_INFO : LOG_DEBUG, + "%s: Router Advertisement from %s", + ifp->name, ctx->sfrom); + clock_gettime(CLOCK_MONOTONIC, &rap->acquired); rap->flags = nd_ra->nd_ra_flags_reserved; rap->lifetime = ntohs(nd_ra->nd_ra_router_lifetime); diff --git a/ipv6nd.h b/ipv6nd.h index 35d7acd4..c6fd2bb1 100644 --- a/ipv6nd.h +++ b/ipv6nd.h @@ -39,7 +39,7 @@ struct ra { struct interface *iface; struct in6_addr from; char sfrom[INET6_ADDRSTRLEN]; - unsigned char *data; + uint8_t *data; size_t data_len; struct timespec acquired; unsigned char flags;