diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-20 19:20:43 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-20 19:20:43 +0200 |
commit | fb0e4138070d7c2ce723af5780e763af3a1353d8 (patch) | |
tree | 4458bc84043b3ea181a33ce2028bd058abb57abb /proto-shell.c | |
parent | cd6ff76cf1ae89d1148c3399b725103a144aca3e (diff) |
do not clear device state for devices created by proto-up with address-external set
Diffstat (limited to 'proto-shell.c')
-rw-r--r-- | proto-shell.c | 12 |
1 files changed, 8 insertions, 4 deletions
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); |