proto-shell: add debug msg for calling handlers
[project/netifd.git] / proto-shell.c
index c4039ed..7e9cbcf 100644 (file)
@@ -187,6 +187,7 @@ proto_shell_handler(struct interface_proto_state *proto,
                uloop_timeout_set(&state->teardown_timeout, 5000);
        }
 
+       D(INTERFACE, "run %s for interface '%s'\n", action, proto->iface->name);
        config = blobmsg_format_json(state->config, true);
        if (!config)
                return -1;
@@ -463,7 +464,9 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr *data,
                        return UBUS_STATUS_INVALID_ARGUMENT;
 
                interface_set_l3_dev(iface, dev);
-               device_claim(&iface->l3_dev);
+               if (device_claim(&iface->l3_dev) < 0)
+                       return UBUS_STATUS_UNKNOWN_ERROR;
+
                device_set_present(dev, true);
 
                interface_update_start(iface);