summaryrefslogtreecommitdiffhomepage
path: root/src/ubus.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ubus.c')
-rw-r--r--src/ubus.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ubus.c b/src/ubus.c
index 317a9c1..dbb43a6 100644
--- a/src/ubus.c
+++ b/src/ubus.c
@@ -364,13 +364,13 @@ static const struct blobmsg_policy addr_attrs[ADDR_ATTR_MAX] = {
[ADDR_ATTR_CLASS] = { .name = "class", .type = BLOBMSG_TYPE_STRING },
};
-uint16_t ubus_get_class(const char *ifname, const struct in6_addr *addr)
+bool ubus_get_class(const char *ifname, const struct in6_addr *addr, uint16_t *pclass)
{
struct blob_attr *c, *cur;
unsigned rem;
if (!dump)
- return 0;
+ return false;
blobmsg_for_each_attr(c, dump, rem) {
struct blob_attr *tb[IFACE_ATTR_MAX];
@@ -401,15 +401,17 @@ uint16_t ubus_get_class(const char *ifname, const struct in6_addr *addr)
struct in6_addr ip6addr;
inet_pton(AF_INET6, addrs, &ip6addr);
- if (IN6_ARE_ADDR_EQUAL(&ip6addr, addr))
- return atoi(class);
+ if (IN6_ARE_ADDR_EQUAL(&ip6addr, addr)) {
+ *pclass = atoi(class);
+ return true;
+ }
}
}
- return 0;
+ return false;
}
- return 0;
+ return false;
}