summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2018-05-02 22:01:18 +0100
committerRoy Marples <roy@marples.name>2018-05-02 22:01:18 +0100
commitc15437c10472402bbf5b42f020d51b6539be480f (patch)
tree1e35a5ad3cfc66c8012d21e8eb4843562c2a75f6
parentbd1d84215cbc5b70f78838956660deb1c3fe9ba0 (diff)
downloaddhcpcd-c15437c10472402bbf5b42f020d51b6539be480f.tar.xz
ipv6nd: warn if router lifetime is set to zero
-rw-r--r--src/ipv6nd.c5
1 files changed, 5 insertions, 0 deletions
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)