+ struct interface *iface = state->proto.iface;
+ struct blob_attr *cur;
+ struct device *dev;
+ const char *devname;
+ int dev_create = 1;
+ bool addr_ext = false;
+ bool keep = false;
+ bool up;
+
+ if (!tb[NOTIFY_LINK_UP])
+ return UBUS_STATUS_INVALID_ARGUMENT;
+
+ up = blobmsg_get_bool(tb[NOTIFY_LINK_UP]);
+ if (!up) {
+ state->proto.proto_event(&state->proto, IFPEV_LINK_LOST);
+ return 0;
+ }
+
+ if ((cur = tb[NOTIFY_KEEP]) != NULL)
+ keep = blobmsg_get_bool(cur);
+
+ if ((cur = tb[NOTIFY_ADDR_EXT]) != NULL) {
+ addr_ext = blobmsg_get_bool(cur);
+ if (addr_ext)
+ dev_create = 2;
+ }
+
+ if (!tb[NOTIFY_IFNAME]) {
+ if (!iface->main_dev.dev)
+ return UBUS_STATUS_INVALID_ARGUMENT;
+ } else if (!keep || iface->state != IFS_UP) {
+ 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 {
+ 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 (!keep)
+ interface_update_start(iface);
+
+ proto_apply_ip_settings(iface, data, addr_ext);
+
+ if ((cur = tb[NOTIFY_ROUTES]) != NULL)
+ proto_shell_parse_route_list(state->proto.iface, cur, false);
+
+ if ((cur = tb[NOTIFY_ROUTES6]) != NULL)
+ proto_shell_parse_route_list(state->proto.iface, cur, true);
+
+ if ((cur = tb[NOTIFY_DNS]))
+ interface_add_dns_server_list(&iface->proto_ip, cur);
+
+ if ((cur = tb[NOTIFY_DNS_SEARCH]))
+ interface_add_dns_search_list(&iface->proto_ip, cur);
+
+ interface_update_complete(state->proto.iface);
+
+ if (!keep)
+ state->proto.proto_event(&state->proto, IFPEV_UP);
+ state->sm = S_IDLE;
+
+ if ((cur = tb[NOTIFY_DATA]))
+ proto_shell_parse_data(state->proto.iface, cur);
+
+ return 0;