From: Felix Fietkau Date: Sun, 11 Sep 2011 20:47:32 +0000 (+0200) Subject: proto-shell: only set the l3 dev if it is not already set X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bc29adfbf508293317a51c8176013fe1eb6bc132;p=oweals%2Fnetifd.git proto-shell: only set the l3 dev if it is not already set --- 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);