]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
When removing an interface we need to remove it's routes even if
authorRoy Marples <roy@marples.name>
Fri, 21 Feb 2014 14:48:58 +0000 (14:48 +0000)
committerRoy Marples <roy@marples.name>
Fri, 21 Feb 2014 14:48:58 +0000 (14:48 +0000)
we're not deleting them.

ipv4.c

diff --git a/ipv4.c b/ipv4.c
index cffb043fc4de262535d5e7a78102449923144954..2f81b1f33659f7029e43b05ece96aec5f414da27 100644 (file)
--- 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);