From mboxrd@z Thu Jan 1 00:00:00 1970 From: Serhey Popovych Subject: [PATCH iproute2 1/2] utils: ll_addr: Handle ARPHRD_IP6GRE in ll_addr_n2a() Date: Wed, 20 Dec 2017 09:57:09 +0200 Message-ID: <1513756630-14639-2-git-send-email-serhe.popovych@gmail.com> References: <1513756630-14639-1-git-send-email-serhe.popovych@gmail.com> To: netdev@vger.kernel.org Return-path: Received: from mail-lf0-f68.google.com ([209.85.215.68]:42578 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753252AbdLTH5Q (ORCPT ); Wed, 20 Dec 2017 02:57:16 -0500 Received: by mail-lf0-f68.google.com with SMTP id e30so6066785lfb.9 for ; Tue, 19 Dec 2017 23:57:15 -0800 (PST) Received: from tuxracer.localdomain ([2a01:6d80::195:20:96:53]) by smtp.gmail.com with ESMTPSA id a7sm1210048lfh.10.2017.12.19.23.57.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Dec 2017 23:57:14 -0800 (PST) In-Reply-To: <1513756630-14639-1-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: ll_addr_n2a() correctly prints tunnel endpoints for gre, ipip, sit and ip6tnl, but not for ip6gre. Fix this by adding ARPHRD_IP6GRE to IPv6 tunnel endpoing address conversion. Before: ------- $ ip link show ... 18: ip6tnl0: mtu 1452 qdisc noop state DOWN mode DEFAULT group default link/tunnel6 :: brd :: 19: ip6gre0: mtu 1456 qdisc noop state DOWN mode DEFAULT group default link/gre6 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 brd \ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 After: ------ $ ip link show ... 18: ip6tnl0: mtu 1452 qdisc noop state DOWN mode DEFAULT group default link/tunnel6 :: brd :: 19: ip6gre0: mtu 1456 qdisc noop state DOWN mode DEFAULT group default link/gre6 :: brd :: Signed-off-by: Serhey Popovych --- lib/ll_addr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ll_addr.c b/lib/ll_addr.c index c03523d..84de64e 100644 --- a/lib/ll_addr.c +++ b/lib/ll_addr.c @@ -36,7 +36,8 @@ const char *ll_addr_n2a(const unsigned char *addr, int alen, int type, char *buf (type == ARPHRD_TUNNEL || type == ARPHRD_SIT || type == ARPHRD_IPGRE)) { return inet_ntop(AF_INET, addr, buf, blen); } - if (alen == 16 && type == ARPHRD_TUNNEL6) { + if (alen == 16 && + (type == ARPHRD_TUNNEL6 || type == ARPHRD_IP6GRE)) { return inet_ntop(AF_INET6, addr, buf, blen); } snprintf(buf, blen, "%02x", addr[0]); -- 1.7.10.4