+static void
+interface_ip_dump_address_list(struct interface_ip_settings *ip)
+{
+ struct device_addr *addr;
+ static char *buf;
+ 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;
+
+ buf = blobmsg_alloc_string_buffer(&b, NULL, buflen);
+ inet_ntop(af, &addr->addr, buf, buflen - 5);
+ buf += strlen(buf);
+ sprintf(buf, "/%d", addr->mask);
+ blobmsg_add_string_buffer(&b);
+ }
+}
+
+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 - 5);
+ buf += strlen(buf);
+ sprintf(buf, "/%d", route->mask);
+ blobmsg_add_string_buffer(&b);
+
+ 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);
+ }
+}
+