X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=proto-shell.c;h=415eb74c0d126bf486aba42287b458f3a4b85e3d;hp=f197c62a89d1dafdd7670b7209ff515adece59e5;hb=8e1b0ca9e75668a9663196520af4422b837aa4a6;hpb=f3074dda01b5316d3743d76998d428c25c143469 diff --git a/proto-shell.c b/proto-shell.c index f197c62..415eb74 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -318,11 +318,14 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr **tb) if (!tb[NOTIFY_IFNAME]) { if (!state->proto.iface->main_dev.dev) return UBUS_STATUS_INVALID_ARGUMENT; - } else if (!state->l3_dev.dev) { + } else { + if (state->l3_dev.dev) + device_remove_user(&state->l3_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; + device_claim(&state->l3_dev); } interface_ip_update_start(state->proto.iface);