]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Remove unreachable routers on Linux unless all routers are unreachable.
authorRoy Marples <roy@marples.name>
Wed, 22 May 2013 08:11:13 +0000 (08:11 +0000)
committerRoy Marples <roy@marples.name>
Wed, 22 May 2013 08:11:13 +0000 (08:11 +0000)
This is due to route metrics.

ipv6.c

diff --git a/ipv6.c b/ipv6.c
index c633cffe9e24d3710f35b8744255e439343c3777..bf1f33959ac5153fb98d86cb9ec25fb59950e5ec 100644 (file)
--- 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 */