ubus: Use device_find to find a device when displaying device info
authorHans Dedecker <dedeckeh@gmail.com>
Mon, 21 Nov 2016 14:05:07 +0000 (15:05 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 22 Nov 2016 09:44:59 +0000 (10:44 +0100)
Replace device_get by device_find in netifd_dev_status as device_get
will fail to find the device if it's created via config as an aliased
vlan device in dotted notation (eg @iface.200).
In such case get_vlan_device_chain will figure out the layer3 device
but get_vlan_device will not find the vlan device in the dependency
list of the layer 3 device as it has been created as a dependency of
the aliased device.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
ubus.c

diff --git a/ubus.c b/ubus.c
index 4d43b5756f337821245b14def18f3f4a305c46f9..8ba43c0f27c8a26ec5a168ffe0cddad500cbbe53 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -204,7 +204,7 @@ netifd_dev_status(struct ubus_context *ctx, struct ubus_object *obj,
        blobmsg_parse(dev_policy, __DEV_MAX, tb, blob_data(msg), blob_len(msg));
 
        if (tb[DEV_NAME]) {
-               dev = device_get(blobmsg_data(tb[DEV_NAME]), false);
+               dev = device_find(blobmsg_data(tb[DEV_NAME]));
                if (!dev)
                        return UBUS_STATUS_INVALID_ARGUMENT;
        }