summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-05-21 15:04:11 +0200
committerJo-Philipp Wich <jow@openwrt.org>2015-05-21 15:06:50 +0200
commit74b8ac78d879375f18755904ff0deab6c060d905 (patch)
tree640525908a4153f19135d12bad49cd8502b50293
parent1d0bd45db042c9dd916f15a5f4e3e5a2f63d0616 (diff)
downloadfirewall3-74b8ac78d879375f18755904ff0deab6c060d905.tar.gz
ubus: allow proto handlers to override device in announced rules
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r--ubus.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ubus.c b/ubus.c
index ef2c530..9e034c8 100644
--- a/ubus.c
+++ b/ubus.c
@@ -281,10 +281,12 @@ fw3_ubus_rules(struct blob_buf *b)
snprintf(comment, sizeof(comment), "ubus:%s[%s] rule %d",
iface_name, iface_proto, n++);
- blobmsg_for_each_attr(ropt, rule, orem)
- if (strcmp(blobmsg_name(ropt), "name") &&
- strcmp(blobmsg_name(ropt), "device"))
+ blobmsg_for_each_attr(ropt, rule, orem) {
+ if (!strcmp(blobmsg_name(ropt), "device"))
+ l3_device = blobmsg_get_string(ropt);
+ else if (strcmp(blobmsg_name(ropt), "name"))
blobmsg_add_blob(b, ropt);
+ }
blobmsg_add_string(b, "name", comment);
blobmsg_add_string(b, "device", l3_device);