[LEDE-DEV] [PATCH netifd 1/2] ubus: Use device_find to find a device when displaying device info

Hans Dedecker dedeckeh at gmail.com
Mon Nov 21 06:05:07 PST 2016


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 at gmail.com>
---
 ubus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ubus.c b/ubus.c
index 4d43b57..8ba43c0 100644
--- 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;
 	}
-- 
1.9.1




More information about the Lede-dev mailing list