ubus: fix fw3_ubus_address()
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 10 Jul 2014 09:15:03 +0000 (11:15 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 10 Jul 2014 10:06:33 +0000 (12:06 +0200)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
ubus.c

diff --git a/ubus.c b/ubus.c
index 8e5e60e1818fe5249075a6a44e260362886b02ed..5161922144fb90287b7d453f84effd584b111938 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -105,16 +105,15 @@ parse_subnet(enum fw3_family family, struct blob_attr *dict, int rem)
 
 static void
 parse_subnets(struct list_head *head, enum fw3_family family,
-              struct blob_attr *list)
+              struct blob_attr *list, int rem)
 {
        struct blob_attr *cur;
        struct fw3_address *addr;
-       int rem;
 
        if (!list)
                return;
 
-       blob_for_each_attr(cur, list, rem)
+       __blob_for_each_attr(cur, list, rem)
        {
                addr = parse_subnet(family, blobmsg_data(cur), blobmsg_data_len(cur));
 
@@ -206,9 +205,9 @@ fw3_ubus_address(struct list_head *list, const char *net)
                    strcmp(blobmsg_data(tb[ADDR_INTERFACE]), net) != 0)
                        continue;
 
-               parse_subnets(list, FW3_FAMILY_V4, tb[ADDR_IPV4]);
-               parse_subnets(list, FW3_FAMILY_V6, tb[ADDR_IPV6]);
-               parse_subnets(list, FW3_FAMILY_V6, tb[ADDR_IPV6_PREFIX]);
+               parse_subnets(list, FW3_FAMILY_V4, blobmsg_data(tb[ADDR_IPV4]), blobmsg_data_len(tb[ADDR_IPV4]));
+               parse_subnets(list, FW3_FAMILY_V6, blobmsg_data(tb[ADDR_IPV6]), blobmsg_data_len(tb[ADDR_IPV6]));
+               parse_subnets(list, FW3_FAMILY_V6, blobmsg_data(tb[ADDR_IPV6_PREFIX]), blobmsg_data_len(tb[ADDR_IPV6_PREFIX]));
        }
 }