Commit ee0067a9 authored by Jiri Pirko's avatar Jiri Pirko Committed by Stephen Hemminger

iplink: print out addrgenmode attribute

addrgenmode is currently write only by ip. So display this information
if provided by kernel as well.
Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
parent 9db7bf15
...@@ -255,6 +255,29 @@ static void print_linktype(FILE *fp, struct rtattr *tb) ...@@ -255,6 +255,29 @@ static void print_linktype(FILE *fp, struct rtattr *tb)
} }
} }
static void print_af_spec(FILE *fp, struct rtattr *af_spec_attr)
{
struct rtattr *inet6_attr;
struct rtattr *tb[IFLA_INET6_MAX + 1];
inet6_attr = parse_rtattr_one_nested(AF_INET6, af_spec_attr);
if (!inet6_attr)
return;
parse_rtattr_nested(tb, IFLA_INET6_MAX, inet6_attr);
if (tb[IFLA_INET6_ADDR_GEN_MODE]) {
switch (rta_getattr_u8(tb[IFLA_INET6_ADDR_GEN_MODE])) {
case IN6_ADDR_GEN_MODE_EUI64:
fprintf(fp, "addrgenmode eui64 ");
break;
case IN6_ADDR_GEN_MODE_NONE:
fprintf(fp, "addrgenmode none ");
break;
}
}
}
static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
{ {
struct ifla_vf_mac *vf_mac; struct ifla_vf_mac *vf_mac;
...@@ -658,6 +681,9 @@ int print_linkinfo(const struct sockaddr_nl *who, ...@@ -658,6 +681,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
if (tb[IFLA_LINKINFO] && show_details) if (tb[IFLA_LINKINFO] && show_details)
print_linktype(fp, tb[IFLA_LINKINFO]); print_linktype(fp, tb[IFLA_LINKINFO]);
if (do_link && tb[IFLA_AF_SPEC] && show_details)
print_af_spec(fp, tb[IFLA_AF_SPEC]);
if ((do_link || show_details) && tb[IFLA_IFALIAS]) { if ((do_link || show_details) && tb[IFLA_IFALIAS]) {
fprintf(fp, "%s alias %s", _SL_, fprintf(fp, "%s alias %s", _SL_,
rta_getattr_str(tb[IFLA_IFALIAS])); rta_getattr_str(tb[IFLA_IFALIAS]));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment