]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
For some reason, Linux likes to re-add the IPv6 network route even if
authorRoy Marples <roy@marples.name>
Tue, 7 Aug 2012 07:03:13 +0000 (07:03 +0000)
committerRoy Marples <roy@marples.name>
Tue, 7 Aug 2012 07:03:13 +0000 (07:03 +0000)
it exists on a different metric than the default.

ipv6.c

diff --git a/ipv6.c b/ipv6.c
index 8a0ae0483a19d313d3ffaf619aff6d1141efe146..f542d54a5edf0aade808c03b5337410d1a19b38d 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -327,6 +327,9 @@ int
 ipv6_remove_subnet(struct ra *rap, struct ipv6_addr *addr)
 {
        struct rt6 *rt;
+#if HAVE_ROUTE_METRIC
+       struct rt6 *ort;
+#endif
        int r;
 
        /* We need to delete the subnet route to have our metric or
@@ -340,7 +343,15 @@ ipv6_remove_subnet(struct ra *rap, struct ipv6_addr *addr)
 #else
                rt->metric = 0;
 #endif
+#if HAVE_ROUTE_METRIC
+               /* For some reason, Linux likes to re-add the subnet
+                  route under the original metric.
+                  I would love to find a way of stopping this! */
+               if ((ort = find_route6(routes, rt)) == NULL ||
+                   ort->metric != rt->metric)
+#else
                if (!find_route6(routes, rt))
+#endif
                        r = del_route6(rt);
                free(rt);
        }