summaryrefslogtreecommitdiffhomepage
path: root/src/ubus.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2013-10-15 20:56:26 +0200
committerSteven Barth <steven@midlink.org>2013-10-15 20:56:26 +0200
commit3d5e419ca3214b9e9f1e183b64be049f139a8235 (patch)
tree86406b4ac1b02728aa7bd7445bad38d214583a9c /src/ubus.c
parent0fa1231d1296d82d8ee75dbe024c9a4509e784fe (diff)
improve matching api
Diffstat (limited to 'src/ubus.c')
-rw-r--r--src/ubus.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/ubus.c b/src/ubus.c
index 9116dd8..bf1d072 100644
--- a/src/ubus.c
+++ b/src/ubus.c
@@ -238,18 +238,25 @@ void ubus_apply_network(void)
const char *ifname = (tb[IFACE_ATTR_IFNAME]) ?
blobmsg_get_string(tb[IFACE_ATTR_IFNAME]) : "";
+ bool matched = false;
struct interface *c;
list_for_each_entry(c, &interfaces, head) {
char *f = memmem(c->upstream, c->upstream_len,
interface, strlen(interface) + 1);
- if (strcmp(interface, c->name) && strcmp(ifname, c->ifname) &&
- (!f || (f != c->upstream && f[-1] != 0)))
+ bool cmatched = !strcmp(interface, c->name) || !strcmp(ifname, c->ifname);
+ matched |= cmatched;
+
+ if (!cmatched && (!f || (f != c->upstream && f[-1] != 0)))
continue;
- if (!c || !c->ignore)
+ if (!c->ignore)
config_parse_interface(blobmsg_data(tb[IFACE_ATTR_DATA]),
- blobmsg_data_len(tb[IFACE_ATTR_DATA]), interface, false);
+ blobmsg_data_len(tb[IFACE_ATTR_DATA]), c->name, false);
}
+
+ if (!matched)
+ config_parse_interface(blobmsg_data(tb[IFACE_ATTR_DATA]),
+ blobmsg_data_len(tb[IFACE_ATTR_DATA]), interface, false);
}
}