From: Jo-Philipp Wich Date: Thu, 21 May 2015 13:04:11 +0000 (+0200) Subject: ubus: allow proto handlers to override device in announced rules X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=74b8ac78d879375f18755904ff0deab6c060d905;p=oweals%2Ffirewall3.git ubus: allow proto handlers to override device in announced rules Signed-off-by: Jo-Philipp Wich --- 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);