diff mbox

[iproute2] ipadress: fix display of IPv6 peer address

Message ID 1374007968-11287-1-git-send-email-nicolas.dichtel@6wind.com
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Nicolas Dichtel July 16, 2013, 8:52 p.m. UTC
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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stephen Hemminger July 26, 2013, 9:27 p.m. UTC | #1
On Tue, 16 Jul 2013 22:52:48 +0200
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:

> Because only IPv4 was supported, the size was static. Now, IPv6 also supports
> peer address.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 5b9a43854514..2b3707af8be4 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -613,7 +613,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 ",