summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-04-10 13:30:54 +0200
committerFelix Fietkau <nbd@openwrt.org>2014-04-10 13:30:56 +0200
commitd5452cb41927b580df46f3ac81ed9e77a7c83a51 (patch)
tree6f257de07b3a69f1d5622fdf24cf76a48308754f
parent5df59a6cf9fd307378bd5cbea809a22f6de9f33d (diff)
proto-shell: fix a regression with handling multiple proto updates for the same interface
Preserve the device when keep == true Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r--proto-shell.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/proto-shell.c b/proto-shell.c
index 45717bf..c4039ed 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -445,28 +445,29 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr *data,
dev_create = 2;
}
- if (iface->state != IFS_UP)
+ if (iface->state != IFS_UP || !iface->l3_dev.dev)
keep = false;
- dev = iface->main_dev.dev;
- if (tb[NOTIFY_IFNAME] && !keep) {
- keep = false;
- devname = blobmsg_data(tb[NOTIFY_IFNAME]);
- if (tb[NOTIFY_TUNNEL])
- dev = proto_shell_create_tunnel(devname, tb[NOTIFY_TUNNEL]);
- else
- dev = device_get(devname, dev_create);
- }
+ if (!keep) {
+ dev = iface->main_dev.dev;
+ if (tb[NOTIFY_IFNAME]) {
+ keep = false;
+ devname = blobmsg_data(tb[NOTIFY_IFNAME]);
+ if (tb[NOTIFY_TUNNEL])
+ dev = proto_shell_create_tunnel(devname, tb[NOTIFY_TUNNEL]);
+ else
+ dev = device_get(devname, dev_create);
+ }
- if (!dev)
- return UBUS_STATUS_INVALID_ARGUMENT;
+ if (!dev)
+ return UBUS_STATUS_INVALID_ARGUMENT;
- interface_set_l3_dev(iface, dev);
- device_claim(&iface->l3_dev);
- device_set_present(dev, true);
+ interface_set_l3_dev(iface, dev);
+ device_claim(&iface->l3_dev);
+ device_set_present(dev, true);
- if (!keep)
interface_update_start(iface);
+ }
proto_apply_ip_settings(iface, data, addr_ext);