From: Roy Marples Date: Wed, 22 May 2013 08:11:13 +0000 (+0000) Subject: Remove unreachable routers on Linux unless all routers are unreachable. X-Git-Tag: v5.99.7~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c8b9dd2dc49878f3d0b4d598072fad7b5a4ec614;p=thirdparty%2Fdhcpcd.git Remove unreachable routers on Linux unless all routers are unreachable. This is due to route metrics. --- diff --git a/ipv6.c b/ipv6.c index c633cffe..bf1f3395 100644 --- a/ipv6.c +++ b/ipv6.c @@ -684,6 +684,9 @@ ipv6_buildroutes(void) /* First add reachable routers and their prefixes */ ipv6_buildroutes1(&dnr, 0); +#ifdef HAVE_ROUTE_METRIC + have_default = (TAILQ_FIRST(&dnr) != NULL); +#endif /* We have no way of knowing if prefixes added by DHCP are reachable * or not, so we have to assume they are */ @@ -703,6 +706,13 @@ ipv6_buildroutes(void) } } +#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 */