[LEDE-DEV] [PATCH netifd] ubus: remove superfluous error check in netifd_add_dynamic

Hans Dedecker dedeckeh at gmail.com
Tue Jun 13 04:33:56 PDT 2017


Check for main device and main device having default config for a dynamic
interface was orginally added in commit 266d92dd83bd5bfe520f3e2838794bf9bb827c07
with as purpose to set the device config. The latter was later removed in
commit 4bf89afc22b43d5bd155d32d3998348a77179c1a which makes the device checks
superfluous.

Also not all interfaces have a main device (eg tunnel interfaces) resulting
into netifd_add_dynamic returning an error code when such interfaces are added.
As an example 6rd interfaces dynamically added by the DHCP script the log
messages are cluttered with the trace 'wan (7803): Command failed: Unknown error'
after each DHCP renew.

Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 ubus.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/ubus.c b/ubus.c
index 6f7c3e1..bf72672 100644
--- a/ubus.c
+++ b/ubus.c
@@ -129,7 +129,6 @@ netifd_add_dynamic(struct ubus_context *ctx, struct ubus_object *obj,
 	struct blob_attr *tb[__DI_MAX];
 	struct interface *iface;
 	struct blob_attr *config;
-	struct device *dev;
 
 	blobmsg_parse(dynamic_policy, __DI_MAX, tb, blob_data(msg), blob_len(msg));
 
@@ -157,10 +156,6 @@ netifd_add_dynamic(struct ubus_context *ctx, struct ubus_object *obj,
 	// Set interface as dynamic
 	interface_set_dynamic(iface);
 
-	dev = iface->main_dev.dev;
-	if (!dev || !dev->default_config)
-		return UBUS_STATUS_UNKNOWN_ERROR;
-
 	return UBUS_STATUS_OK;
 
 error:
-- 
1.9.1




More information about the Lede-dev mailing list