X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=proto-shell.c;h=a22c0e3b57f5a578b86484980365f16347a72e97;hp=9ad28ac3bde7ac83008f45850c8f4b418091704e;hb=fb0e4138070d7c2ce723af5780e763af3a1353d8;hpb=cd6ff76cf1ae89d1148c3399b725103a144aca3e diff --git a/proto-shell.c b/proto-shell.c index 9ad28ac..a22c0e3 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -242,6 +242,7 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr **tb) { struct interface_ip_settings *ip; struct blob_attr *cur; + int dev_create = 1; bool addr_ext = false; bool up; @@ -254,6 +255,12 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr **tb) return 0; } + if ((cur = tb[NOTIFY_ADDR_EXT]) != NULL) { + addr_ext = blobmsg_get_bool(cur); + if (addr_ext) + dev_create = 2; + } + if (!tb[NOTIFY_IFNAME]) { if (!state->proto.iface->main_dev.dev) return UBUS_STATUS_INVALID_ARGUMENT; @@ -262,7 +269,7 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr **tb) device_remove_user(&state->l3_dev); device_add_user(&state->l3_dev, - device_get(blobmsg_data(tb[NOTIFY_IFNAME]), true)); + device_get(blobmsg_data(tb[NOTIFY_IFNAME]), dev_create)); state->proto.iface->l3_dev = &state->l3_dev; device_claim(&state->l3_dev); } @@ -270,9 +277,6 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr **tb) ip = &state->proto.iface->proto_ip; interface_update_start(state->proto.iface); - if ((cur = tb[NOTIFY_ADDR_EXT]) != NULL) - addr_ext = blobmsg_get_bool(cur); - if ((cur = tb[NOTIFY_IPADDR]) != NULL) proto_shell_parse_addr_list(ip, cur, false, addr_ext);