]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
When deleting an old route and it doesn't have an interface then use
authorRoy Marples <roy@marples.name>
Tue, 8 Sep 2015 16:29:02 +0000 (16:29 +0000)
committerRoy Marples <roy@marples.name>
Tue, 8 Sep 2015 16:29:02 +0000 (16:29 +0000)
the interface of the new route for context.

ipv4.c
ipv6.c

diff --git a/ipv4.c b/ipv4.c
index e0b29761454cfa36a4f1819765c8997bf4b8b5fb..949ef8e58c365f9218a97292b426d907ef429a5a 100644 (file)
--- a/ipv4.c
+++ b/ipv4.c
@@ -440,6 +440,11 @@ nc_route(struct rt *ort, struct rt *nrt)
                        logger(nrt->iface->ctx, LOG_ERR, "if_route (CHG): %m");
        }
 
+       /* If the old route does not have an interface, give it the
+        * interface of the new route for context. */
+       if (ort && ort->iface == NULL)
+               ort->iface = nrt->iface;
+
 #ifdef HAVE_ROUTE_METRIC
        /* With route metrics, we can safely add the new route before
         * deleting the old route. */
diff --git a/ipv6.c b/ipv6.c
index 9fded405a5188152d559039ea3e1bd724322f269..216b8a6c2e253fdf22c9f1f5e9da8cec53b30ccf 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -1901,6 +1901,11 @@ nc_route(struct rt6 *ort, struct rt6 *nrt)
                        logger(nrt->iface->ctx, LOG_ERR, "if_route6 (CHG): %m");
        }
 
+       /* If the old route does not have an interface, give it the
+        * interface of the new route for context. */
+       if (ort->iface == NULL)
+               ort->iface = nrt->iface;
+
 #ifdef HAVE_ROUTE_METRIC
        /* With route metrics, we can safely add the new route before
         * deleting the old route. */