ubus: use dhcpv6 ia assignment flag
authorHans Dedecker <dedeckeh@gmail.com>
Sat, 14 Mar 2020 20:03:11 +0000 (21:03 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Sat, 14 Mar 2020 20:06:21 +0000 (21:06 +0100)
Further align the code to use DHCPv6 assignment flags to distinguish
between prefix delegation and non temporary address assignments

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/dhcpv6-ia.c
src/ubus.c

index 836c111a90143b3ba48768ea0573995d2ff4b278..1a139458a4c45a6756f559aa1f0bb9262d90a1ea 100644 (file)
@@ -234,7 +234,7 @@ void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c,
                addr = addrs[i].addr.in6;
                pref = addrs[i].preferred;
                valid = addrs[i].valid;
-               if (prefix == 128) {
+               if (c->flags & OAF_DHCPV6_NA) {
                        if (!ADDR_ENTRY_VALID_IA_ADDR(iface, i, m, addrs))
                                continue;
 
index e9c5b6fb542813fe860d3fe171d0adf423ee6385..72d47c42536fee15b9f7152d7059916dd88db5be 100644 (file)
@@ -155,7 +155,7 @@ static int handle_dhcpv6_leases(_unused struct ubus_context *ctx, _unused struct
                                blobmsg_add_string(&b, NULL, "static");
                        blobmsg_close_array(&b, m);
 
-                       m = blobmsg_open_array(&b, a->length == 128 ? "ipv6-addr": "ipv6-prefix");
+                       m = blobmsg_open_array(&b, a->flags & OAF_DHCPV6_NA ? "ipv6-addr": "ipv6-prefix");
                        dhcpv6_ia_enum_addrs(iface, a, now, dhcpv6_blobmsg_ia_addr, NULL);
                        blobmsg_close_table(&b, m);