From: Roy Marples Date: Wed, 2 May 2018 21:01:18 +0000 (+0100) Subject: ipv6nd: warn if router lifetime is set to zero X-Git-Tag: v7.0.4~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c15437c10472402bbf5b42f020d51b6539be480f;p=thirdparty%2Fdhcpcd.git ipv6nd: warn if router lifetime is set to zero --- diff --git a/src/ipv6nd.c b/src/ipv6nd.c index 36a945d8..6b6fac94 100644 --- a/src/ipv6nd.c +++ b/src/ipv6nd.c @@ -750,6 +750,7 @@ ipv6nd_handlera(struct dhcpcd_ctx *ctx, struct interface *ifp, struct ipv6_addr *ap; struct dhcp_opt *dho; uint8_t new_rap, new_data; + uint32_t old_lifetime; __printflike(1, 2) void (*logfunc)(const char *, ...); #ifdef IPV6_MANAGETEMPADDR uint8_t new_ap; @@ -858,7 +859,11 @@ ipv6nd_handlera(struct dhcpcd_ctx *ctx, struct interface *ifp, clock_gettime(CLOCK_MONOTONIC, &rap->acquired); rap->flags = nd_ra->nd_ra_flags_reserved; + old_lifetime = rap->lifetime; rap->lifetime = ntohs(nd_ra->nd_ra_router_lifetime); + if (!new_rap && rap->lifetime == 0 && old_lifetime != 0) + logwarnx("%s: %s: no longer a default router", + ifp->name, rap->sfrom); if (nd_ra->nd_ra_reachable) { rap->reachable = ntohl(nd_ra->nd_ra_reachable); if (rap->reachable > MAX_REACHABLE_TIME)