summaryrefslogtreecommitdiffhomepage
path: root/proto-shell.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-03-23 14:41:53 +0200
committerFelix Fietkau <nbd@openwrt.org>2012-03-23 14:41:53 +0200
commitb7d1c27b752df3e6c5dfe6a5b789d6cb0c87d0f6 (patch)
treee64c47acf58a4a9eb29d20ef21537db55174df1b /proto-shell.c
parentc7a52ed70eaae0207d7f7e6c4a31035f5ec3757e (diff)
move l3 device tracking to interface core to enforce proper order of address/route removal on device or interface state changes
Diffstat (limited to 'proto-shell.c')
-rw-r--r--proto-shell.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/proto-shell.c b/proto-shell.c
index 8238c0d..b5d436a 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -41,8 +41,6 @@ struct proto_shell_state {
struct proto_shell_handler *handler;
struct blob_attr *config;
- struct device_user l3_dev;
-
struct uloop_timeout teardown_timeout;
struct netifd_process script_task;
@@ -79,9 +77,6 @@ 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);
@@ -204,8 +199,6 @@ 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);
@@ -305,9 +298,6 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr *data,
if (!iface->main_dev.dev)
return UBUS_STATUS_INVALID_ARGUMENT;
} else {
- if (state->l3_dev.dev)
- device_remove_user(&state->l3_dev);
-
devname = blobmsg_data(tb[NOTIFY_IFNAME]);
if (tb[NOTIFY_TUNNEL]) {
dev = proto_shell_create_tunnel(devname,
@@ -320,9 +310,8 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr *data,
return UBUS_STATUS_NOT_FOUND;
}
- device_add_user(&state->l3_dev, dev);
- iface->l3_dev = &state->l3_dev;
- device_claim(&state->l3_dev);
+ interface_set_l3_dev(iface, dev);
+ device_claim(&iface->l3_dev);
}
interface_update_start(iface);