diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-05-21 15:04:11 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-05-21 15:06:50 +0200 |
commit | 74b8ac78d879375f18755904ff0deab6c060d905 (patch) | |
tree | 640525908a4153f19135d12bad49cd8502b50293 | |
parent | 1d0bd45db042c9dd916f15a5f4e3e5a2f63d0616 (diff) | |
download | firewall3-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.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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); |