From: Serhey Popovych Date: Wed, 20 Dec 2017 07:57:09 +0000 (+0200) Subject: utils: ll_addr: Handle ARPHRD_IP6GRE in ll_addr_n2a() X-Git-Tag: v4.15.0~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ed8a5ca87c3dc913b3fa438ac2248edd9140616;p=thirdparty%2Fiproute2.git utils: ll_addr: Handle ARPHRD_IP6GRE in ll_addr_n2a() 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 --- diff --git a/lib/ll_addr.c b/lib/ll_addr.c index c03523d56..84de64e2e 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]);