From bc29adfbf508293317a51c8176013fe1eb6bc132 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 11 Sep 2011 22:47:32 +0200 Subject: [PATCH] proto-shell: only set the l3 dev if it is not already set --- proto-shell.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/proto-shell.c b/proto-shell.c index 25cd57b..73a241c 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -180,10 +180,12 @@ proto_shell_notify(struct interface_proto_state *proto, struct blob_attr *attr) if (!tb[NOTIFY_IFNAME]) return UBUS_STATUS_INVALID_ARGUMENT; - device_add_user(&state->l3_dev, - device_get(blobmsg_data(tb[NOTIFY_IFNAME]), true)); - device_claim(&state->l3_dev); - state->proto.iface->l3_dev = &state->l3_dev; + if (!state->l3_dev.dev) { + device_add_user(&state->l3_dev, + device_get(blobmsg_data(tb[NOTIFY_IFNAME]), true)); + device_claim(&state->l3_dev); + state->proto.iface->l3_dev = &state->l3_dev; + } state->proto.proto_event(&state->proto, IFPEV_UP); } else { state->proto.proto_event(&state->proto, IFPEV_LINK_LOST); -- 2.30.2