From: Roy Marples Date: Tue, 8 Sep 2015 16:29:02 +0000 (+0000) Subject: When deleting an old route and it doesn't have an interface then use X-Git-Tag: v6.9.4~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aceb692d4f47dc2c8f28554fcf5d17a103199c20;p=thirdparty%2Fdhcpcd.git When deleting an old route and it doesn't have an interface then use the interface of the new route for context. --- diff --git a/ipv4.c b/ipv4.c index e0b29761..949ef8e5 100644 --- 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 9fded405..216b8a6c 100644 --- 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. */