]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ipadress: fix display of IPv6 peer address
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Tue, 16 Jul 2013 20:52:48 +0000 (22:52 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 26 Jul 2013 21:27:19 +0000 (14:27 -0700)
Because only IPv4 was supported, the size was static. Now, IPv6 also supports
peer address.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
ip/ipaddress.c

index d2524e89dd32b0db087ebdfb4a69f63fdf537450..013b4cbd151684cee09d27839f9f238f287098f6 100644 (file)
@@ -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 ",