config: Prioritize ifname resolving via ubus over ifname/networkid attributes
authorHans Dedecker <dedeckeh@gmail.com>
Fri, 27 Nov 2015 12:34:01 +0000 (13:34 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Fri, 27 Nov 2015 13:45:46 +0000 (14:45 +0100)
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/config.c

index 4fc8bc7e738ad54fb147f870ac0515c790c28449..74ab3dd67e5a7ab834650c2ba69803aea0313f32 100644 (file)
@@ -300,11 +300,6 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
        }
 
        const char *ifname = NULL;
-#ifdef WITH_UBUS
-       if (overwrite || !iface->ifname[0])
-               ifname = ubus_get_ifname(name);
-#endif
-
        if (overwrite) {
                if ((c = tb[IFACE_ATTR_IFNAME]))
                        ifname = blobmsg_get_string(c);
@@ -312,6 +307,11 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
                        ifname = blobmsg_get_string(c);
        }
 
+#ifdef WITH_UBUS
+       if (overwrite || !iface->ifname[0])
+               ifname = ubus_get_ifname(name);
+#endif
+
        if (!iface->ifname[0] && !ifname)
                goto err;