From 75baeca6f817b161f522a9961bfe5c3718397189 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 19 Mar 2012 22:04:03 +0100 Subject: [PATCH] properly flush routes and l3 devices when tearing down interfaces --- interface.c | 2 ++ proto-shell.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/interface.c b/interface.c index 4d9aa8a..4ad89f5 100644 --- a/interface.c +++ b/interface.c @@ -120,6 +120,8 @@ __interface_set_down(struct interface *iface, bool force) if (iface->state == IFS_UP) interface_event(iface, IFEV_DOWN); iface->state = IFS_TEARDOWN; + interface_ip_flush(&iface->config_ip); + interface_ip_flush(&iface->proto_ip); interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, force); if (force) interface_flush_state(iface); diff --git a/proto-shell.c b/proto-shell.c index 2239b49..8238c0d 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -79,6 +79,9 @@ proto_shell_handler(struct interface_proto_state *proto, if (state->sm == S_TEARDOWN) return 0; + if (state->l3_dev.dev) + device_remove_user(&state->l3_dev); + if (state->script_task.uloop.pending) { if (state->sm != S_SETUP_ABORT) { uloop_timeout_set(&state->teardown_timeout, 1000); @@ -201,6 +204,8 @@ proto_shell_free(struct interface_proto_state *proto) struct proto_shell_state *state; state = container_of(proto, struct proto_shell_state, proto); + if (state->l3_dev.dev) + device_remove_user(&state->l3_dev); netifd_kill_process(&state->script_task); netifd_kill_process(&state->proto_task); free(state->config); -- 2.25.1