[LEDE-DEV] [PATCH netifd] ubus: Display the IPv6 prefix assigned address

Hans Dedecker dedeckeh at gmail.com
Fri Dec 9 00:19:51 PST 2016


Display the IPv6 address obtained from a prefix assignment
as local-address element in the ubus ipv6-prefix-assignment
list so it's explicitly clear which IPv6 address from the
delegated prefix is assigned to the interface.

Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 ubus.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/ubus.c b/ubus.c
index 8ba43c0..29924c1 100644
--- a/ubus.c
+++ b/ubus.c
@@ -600,12 +600,21 @@ interface_ip_dump_prefix_assignment_list(struct interface *iface)
 			if (prefix->valid_until)
 				blobmsg_add_u32(&b, "valid", prefix->valid_until - now);
 
+			void *c = blobmsg_open_table(&b, "local-address");
+			if (assign->enabled) {
+				buf = blobmsg_alloc_string_buffer(&b, "address", buflen);
+				inet_ntop(AF_INET6, &assign->addr, buf, buflen);
+				blobmsg_add_string_buffer(&b);
+
+				blobmsg_add_u32(&b, "mask", assign->length < 64 ? 64 : assign->length);
+			}
+			blobmsg_close_table(&b, c);
+
 			blobmsg_close_table(&b, a);
 		}
 	}
 }
 
-
 static void
 interface_ip_dump_dns_server_list(struct interface_ip_settings *ip,
                                   bool enabled)
-- 
1.9.1




More information about the Lede-dev mailing list