summaryrefslogtreecommitdiffstats
path: root/src/ipv6.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-06-14 13:53:51 +0100
committerRoy Marples <roy@marples.name>2019-06-14 13:53:51 +0100
commitb743f1401fe7420e6a8a9b8866d64a237c257127 (patch)
tree6690e2821fb28b6731cd85ef9e97e87866a6f9ce /src/ipv6.c
parent271775fb2370dc9eb8774f90abbba7cb30c5efbf (diff)
downloaddhcpcd-b743f1401fe7420e6a8a9b8866d64a237c257127.tar.xz
RA: expire RDNSS and DNSSL entries
This allows us to remember N fully expired RA's which works around an obscure issue where a received RA has no lifetime or any prefixes with lifetimes but does have an instruction to start DHCP6. It was harmless but filled the log with spam and now there is no log spam!
Diffstat (limited to 'src/ipv6.c')
-rw-r--r--src/ipv6.c41
1 files changed, 10 insertions, 31 deletions
diff --git a/src/ipv6.c b/src/ipv6.c
index de8570f0..e9e6dc25 100644
--- a/src/ipv6.c
+++ b/src/ipv6.c
@@ -2240,15 +2240,14 @@ inet6_staticroutes(struct rt_head *routes, struct dhcpcd_ctx *ctx)
}
static int
-inet6_raroutes(struct rt_head *routes, struct dhcpcd_ctx *ctx, int expired,
- bool *have_default)
+inet6_raroutes(struct rt_head *routes, struct dhcpcd_ctx *ctx)
{
struct rt *rt;
struct ra *rap;
const struct ipv6_addr *addr;
TAILQ_FOREACH(rap, ctx->ra_routers, next) {
- if (rap->expired != expired)
+ if (rap->expired)
continue;
TAILQ_FOREACH(addr, &rap->addrs, next) {
if (addr->prefix_vltime == 0)
@@ -2259,15 +2258,13 @@ inet6_raroutes(struct rt_head *routes, struct dhcpcd_ctx *ctx, int expired,
TAILQ_INSERT_TAIL(routes, rt, rt_next);
}
}
- if (rap->lifetime) {
- rt = inet6_makerouter(rap);
- if (rt) {
- rt->rt_dflags |= RTDF_RA;
- TAILQ_INSERT_TAIL(routes, rt, rt_next);
- if (have_default)
- *have_default = true;
- }
- }
+ if (rap->lifetime == 0)
+ continue;
+ rt = inet6_makerouter(rap);
+ if (rt == NULL)
+ continue;
+ rt->rt_dflags |= RTDF_RA;
+ TAILQ_INSERT_TAIL(routes, rt, rt_next);
}
return 0;
}
@@ -2301,15 +2298,13 @@ inet6_dhcproutes(struct rt_head *routes, struct dhcpcd_ctx *ctx,
bool
inet6_getroutes(struct dhcpcd_ctx *ctx, struct rt_head *routes)
{
- bool have_default;
/* Should static take priority? */
if (inet6_staticroutes(routes, ctx) == -1)
return false;
/* First add reachable routers and their prefixes */
- have_default = false;
- if (inet6_raroutes(routes, ctx, 0, &have_default) == -1)
+ if (inet6_raroutes(routes, ctx) == -1)
return false;
#ifdef DHCP6
@@ -2322,21 +2317,5 @@ inet6_getroutes(struct dhcpcd_ctx *ctx, struct rt_head *routes)
return false;
#endif
-#ifdef HAVE_ROUTE_METRIC
- /* If we have an unreachable router, we really do need to remove the
- * route to it beause it could be a lower metric than a reachable
- * router. Of course, we should at least have some routers if all
- * are unreachable. */
- if (!have_default) {
-#endif
- /* Add our non-reachable routers and prefixes
- * Unsure if this is needed, but it's a close match to kernel
- * behaviour */
- if (inet6_raroutes(routes, ctx, 1, NULL) == -1)
- return false;
-#ifdef HAVE_ROUTE_METRIC
- }
-#endif
-
return true;
}