From 74b8ac78d879375f18755904ff0deab6c060d905 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 21 May 2015 15:04:11 +0200 Subject: [PATCH] ubus: allow proto handlers to override device in announced rules Signed-off-by: Jo-Philipp Wich --- ubus.c | 8 +++++--- 1 file 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); -- 2.11.0