proto-shell: only set the l3 dev if it is not already set
authorFelix Fietkau <nbd@openwrt.org>
Sun, 11 Sep 2011 20:47:32 +0000 (22:47 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 11 Sep 2011 20:47:32 +0000 (22:47 +0200)
proto-shell.c

index 25cd57b89de13fec6727f9cac1c5ff5de7c6616e..73a241c5bd98b6cfc077568c378ba5a38b149325 100644 (file)
@@ -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);