dev_create = 2;
}
- if (!tb[NOTIFY_IFNAME]) {
- if (!iface->main_dev.dev)
- return UBUS_STATUS_INVALID_ARGUMENT;
- } else if (!keep || iface->state != IFS_UP) {
+ if (iface->state != IFS_UP)
+ 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]);
- if (!dev)
- return UBUS_STATUS_INVALID_ARGUMENT;
- } else {
+ 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_NOT_FOUND;
- }
-
- interface_set_l3_dev(iface, dev);
- device_claim(&iface->l3_dev);
- device_set_present(dev, true);
}
+ if (!dev)
+ return UBUS_STATUS_INVALID_ARGUMENT;
+
+ interface_set_l3_dev(iface, dev);
+ device_claim(&iface->l3_dev);
+ device_set_present(dev, true);
+
if (!keep)
interface_update_start(iface);