Commit fa10855a authored by Sami Kerola's avatar Sami Kerola Committed by Stephen Hemminger

ip: make -resolve addr to print names rather than addresses

As a system admin I occasionally want to be able to check that all
interfaces has a name in DNS or /etc/hosts file.
Signed-off-by: default avatarSami Kerola <kerolasa@iki.fi>
parent f26ef6ec
...@@ -636,7 +636,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, ...@@ -636,7 +636,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
fprintf(fp, " family %d ", ifa->ifa_family); fprintf(fp, " family %d ", ifa->ifa_family);
if (rta_tb[IFA_LOCAL]) { if (rta_tb[IFA_LOCAL]) {
fprintf(fp, "%s", rt_addr_n2a(ifa->ifa_family, fprintf(fp, "%s", format_host(ifa->ifa_family,
RTA_PAYLOAD(rta_tb[IFA_LOCAL]), RTA_PAYLOAD(rta_tb[IFA_LOCAL]),
RTA_DATA(rta_tb[IFA_LOCAL]), RTA_DATA(rta_tb[IFA_LOCAL]),
abuf, sizeof(abuf))); abuf, sizeof(abuf)));
...@@ -647,7 +647,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, ...@@ -647,7 +647,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
fprintf(fp, "/%d ", ifa->ifa_prefixlen); fprintf(fp, "/%d ", ifa->ifa_prefixlen);
} else { } else {
fprintf(fp, " peer %s/%d ", fprintf(fp, " peer %s/%d ",
rt_addr_n2a(ifa->ifa_family, format_host(ifa->ifa_family,
RTA_PAYLOAD(rta_tb[IFA_ADDRESS]), RTA_PAYLOAD(rta_tb[IFA_ADDRESS]),
RTA_DATA(rta_tb[IFA_ADDRESS]), RTA_DATA(rta_tb[IFA_ADDRESS]),
abuf, sizeof(abuf)), abuf, sizeof(abuf)),
...@@ -657,14 +657,14 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, ...@@ -657,14 +657,14 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
if (rta_tb[IFA_BROADCAST]) { if (rta_tb[IFA_BROADCAST]) {
fprintf(fp, "brd %s ", fprintf(fp, "brd %s ",
rt_addr_n2a(ifa->ifa_family, format_host(ifa->ifa_family,
RTA_PAYLOAD(rta_tb[IFA_BROADCAST]), RTA_PAYLOAD(rta_tb[IFA_BROADCAST]),
RTA_DATA(rta_tb[IFA_BROADCAST]), RTA_DATA(rta_tb[IFA_BROADCAST]),
abuf, sizeof(abuf))); abuf, sizeof(abuf)));
} }
if (rta_tb[IFA_ANYCAST]) { if (rta_tb[IFA_ANYCAST]) {
fprintf(fp, "any %s ", fprintf(fp, "any %s ",
rt_addr_n2a(ifa->ifa_family, format_host(ifa->ifa_family,
RTA_PAYLOAD(rta_tb[IFA_ANYCAST]), RTA_PAYLOAD(rta_tb[IFA_ANYCAST]),
RTA_DATA(rta_tb[IFA_ANYCAST]), RTA_DATA(rta_tb[IFA_ANYCAST]),
abuf, sizeof(abuf))); abuf, sizeof(abuf)));
......
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