summaryrefslogtreecommitdiff
path: root/ip/ipaddress.c
diff options
context:
space:
mode:
Diffstat (limited to 'ip/ipaddress.c')
-rw-r--r--ip/ipaddress.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index bc8f5ba1..b72eb7a1 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -879,7 +879,7 @@ int print_linkinfo(struct nlmsghdr *n, void *arg)
if (filter.up && !(ifi->ifi_flags&IFF_UP))
return -1;
- parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
+ parse_rtattr_flags(tb, IFLA_MAX, IFLA_RTA(ifi), len, NLA_F_NESTED);
name = get_ifname_rta(ifi->ifi_index, tb[IFLA_IFNAME]);
if (!name)
@@ -1139,7 +1139,23 @@ int print_linkinfo(struct nlmsghdr *n, void *arg)
close_json_array(PRINT_JSON, NULL);
}
- print_string(PRINT_FP, NULL, "%s", "\n");
+ if (tb[IFLA_PROP_LIST]) {
+ struct rtattr *i, *proplist = tb[IFLA_PROP_LIST];
+ int rem = RTA_PAYLOAD(proplist);
+
+ open_json_array(PRINT_JSON, "altnames");
+ for (i = RTA_DATA(proplist); RTA_OK(i, rem);
+ i = RTA_NEXT(i, rem)) {
+ if (i->rta_type != IFLA_ALT_IFNAME)
+ continue;
+ print_string(PRINT_FP, NULL, "%s altname ", _SL_);
+ print_string(PRINT_ANY, NULL,
+ "%s", rta_getattr_str(i));
+ }
+ close_json_array(PRINT_JSON, NULL);
+ }
+
+ print_string(PRINT_FP, NULL, "%s", _SL_);
fflush(fp);
return 1;
}