diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2013-07-16 22:52:48 +0200 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2013-07-26 14:27:19 -0700 |
commit | 973eb50b1832cdbb9517bf08e322fbf6b3c212be (patch) | |
tree | 2e35b399242ee72e0c595f20de3e867efbda71ba | |
parent | 7cfa3802ca3e9078cd8f6c9638a0c25a63f5ddd8 (diff) |
ipadress: fix display of IPv6 peer address
Because only IPv4 was supported, the size was static. Now, IPv6 also supports
peer address.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
-rw-r--r-- | ip/ipaddress.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ip/ipaddress.c b/ip/ipaddress.c index d2524e89..013b4cbd 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -636,7 +636,8 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, abuf, sizeof(abuf))); if (rta_tb[IFA_ADDRESS] == NULL || - memcmp(RTA_DATA(rta_tb[IFA_ADDRESS]), RTA_DATA(rta_tb[IFA_LOCAL]), 4) == 0) { + memcmp(RTA_DATA(rta_tb[IFA_ADDRESS]), RTA_DATA(rta_tb[IFA_LOCAL]), + ifa->ifa_family == AF_INET ? 4 : 16) == 0) { fprintf(fp, "/%d ", ifa->ifa_prefixlen); } else { fprintf(fp, " peer %s/%d ", |