summaryrefslogtreecommitdiffhomepage
path: root/src/config.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2015-11-29 12:51:28 +0100
committerSteven Barth <steven@midlink.org>2015-11-29 12:51:28 +0100
commitc5cb11650a1f7ff321b4ac190c8be7f533cf9636 (patch)
tree387e68fe4207c920d30c295fb5cb620b9ea95154 /src/config.c
parent01d3f9d64486ac1daa144848944e877e7f0cb762 (diff)
parent045a6202903084c7053924f2cb40a95669fb139c (diff)
Merge pull request #67 from dedeckeh/bugfixes
Fix interface ifname overwrite in case UCI dhcp section contains ifname or networkid parameter
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/config.c b/src/config.c
index 7d870f1..74ab3dd 100644
--- a/src/config.c
+++ b/src/config.c
@@ -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,14 +307,19 @@ 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)
- return -1;
+ goto err;
if (ifname)
strncpy(iface->ifname, ifname, sizeof(iface->ifname) - 1);
if ((iface->ifindex = if_nametoindex(iface->ifname)) <= 0)
- return -1;
+ goto err;
iface->inuse = true;