]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Log RA's only when it's a new router unless debugging is enabled.
authorRoy Marples <roy@marples.name>
Fri, 8 Apr 2016 09:38:53 +0000 (09:38 +0000)
committerRoy Marples <roy@marples.name>
Fri, 8 Apr 2016 09:38:53 +0000 (09:38 +0000)
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].

ipv6nd.c
ipv6nd.h

index 482899bd9fa9e49bba7553a63053377a397c05a4..716283a3fa4c3bca82ff2e4930c3ac2a2e7497aa 100644 (file)
--- 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);
index 35d7acd4227238c039fabcd32f32abba677caea3..c6fd2bb17099075ed81854a17309156d7d4e213d 100644 (file)
--- 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;