From: Nicolas Dichtel Date: Tue, 16 Jul 2013 20:52:48 +0000 (+0200) Subject: ipadress: fix display of IPv6 peer address X-Git-Tag: v3.11.0~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=973eb50b1832cdbb9517bf08e322fbf6b3c212be;p=thirdparty%2Fiproute2.git 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 --- diff --git a/ip/ipaddress.c b/ip/ipaddress.c index d2524e89d..013b4cbd1 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 ",