+static void
+interface_ip_dump_address_list(struct interface_ip_settings *ip)
+{
+ struct device_addr *addr;
+ char *buf;
+ void *a;
+ int buflen = 128;
+ int af;
+
+ vlist_for_each_element(&ip->addr, addr, node) {
+ if ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET4)
+ af = AF_INET;
+ else
+ af = AF_INET6;
+
+ a = blobmsg_open_table(&b, NULL);
+
+ buf = blobmsg_alloc_string_buffer(&b, "address", buflen);
+ inet_ntop(af, &addr->addr, buf, buflen);
+ blobmsg_add_string_buffer(&b);
+
+ blobmsg_add_u32(&b, "mask", addr->mask);
+
+ blobmsg_close_table(&b, a);
+ }
+}
+
+static void
+interface_ip_dump_route_list(struct interface_ip_settings *ip)
+{
+ struct device_route *route;
+ static char *buf;
+ int buflen = 128;
+ void *r;
+ int af;
+
+ vlist_for_each_element(&ip->route, route, node) {
+ if ((route->flags & DEVADDR_FAMILY) == DEVADDR_INET4)
+ af = AF_INET;
+ else
+ af = AF_INET6;
+
+ r = blobmsg_open_table(&b, NULL);
+
+ buf = blobmsg_alloc_string_buffer(&b, "target", buflen);
+ inet_ntop(af, &route->addr, buf, buflen);
+ blobmsg_add_string_buffer(&b);
+
+ blobmsg_add_u32(&b, "mask", route->mask);
+
+ buf = blobmsg_alloc_string_buffer(&b, "nexthop", buflen);
+ inet_ntop(af, &route->nexthop, buf, buflen);
+ blobmsg_add_string_buffer(&b);
+
+ blobmsg_close_table(&b, r);
+ }
+}
+