From: Roy Marples Date: Fri, 21 Feb 2014 14:48:58 +0000 (+0000) Subject: When removing an interface we need to remove it's routes even if X-Git-Tag: v6.3.0~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4197f1c3a3280f56ff41baafe41f923177761c5;p=thirdparty%2Fdhcpcd.git When removing an interface we need to remove it's routes even if we're not deleting them. --- diff --git a/ipv4.c b/ipv4.c index cffb043f..2f81b1f3 100644 --- a/ipv4.c +++ b/ipv4.c @@ -543,7 +543,10 @@ ipv4_buildroutes(struct dhcpcd_ctx *ctx) /* Remove old routes we used to manage */ TAILQ_FOREACH(rt, ctx->ipv4_routes, next) { - if (find_route(nrs, rt, NULL) == NULL) + if (find_route(nrs, rt, NULL) == NULL && + (rt->iface->options->options & + (DHCPCD_EXITING | DHCPCD_PERSISTENT)) != + (DHCPCD_EXITING | DHCPCD_PERSISTENT)) d_route(rt); } ipv4_freeroutes(ctx->ipv4_routes); @@ -638,10 +641,10 @@ ipv4_applyaddr(void *arg) lease = &state->lease; if (dhcp == NULL) { + ipv4_buildroutes(ifp->ctx); if ((ifo->options & (DHCPCD_EXITING | DHCPCD_PERSISTENT)) != (DHCPCD_EXITING | DHCPCD_PERSISTENT)) { - ipv4_buildroutes(ifp->ctx); if (state->addr.s_addr != 0) delete_address(ifp); script_runreason(ifp, state->reason);