From mboxrd@z Thu Jan 1 00:00:00 1970 From: Serhey Popovych Subject: [PATCH iproute2 2/3] link_iptnl: Print tunnel mode Date: Tue, 2 Jan 2018 17:29:18 +0200 Message-ID: <1514906959-9719-3-git-send-email-serhe.popovych@gmail.com> References: <1514906959-9719-1-git-send-email-serhe.popovych@gmail.com> To: netdev@vger.kernel.org Return-path: Received: from mail-lf0-f66.google.com ([209.85.215.66]:45858 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751263AbeABP3c (ORCPT ); Tue, 2 Jan 2018 10:29:32 -0500 Received: by mail-lf0-f66.google.com with SMTP id y71so4974070lfd.12 for ; Tue, 02 Jan 2018 07:29:32 -0800 (PST) Received: from tuxracer.localdomain (netdev-gw1.skif.com.ua. [195.20.96.53]) by smtp.gmail.com with ESMTPSA id q25sm8444069ljc.73.2018.01.02.07.29.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jan 2018 07:29:30 -0800 (PST) In-Reply-To: <1514906959-9719-1-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: Tunnel mode does not appear in parameters print for iptnl supported tunnels like ipip and sit, while printed for ip6tnl. Print tunnel mode with "proto" field for JSON and without any name when printing to cli to follow ip6tnl behaviour. Signed-off-by: Serhey Popovych --- ip/link_iptnl.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ip/link_iptnl.c b/ip/link_iptnl.c index d4d935b..afd1696 100644 --- a/ip/link_iptnl.c +++ b/ip/link_iptnl.c @@ -372,6 +372,23 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[ if (tb[IFLA_IPTUN_COLLECT_METADATA]) print_bool(PRINT_ANY, "external", "external ", true); + if (tb[IFLA_IPTUN_PROTO]) { + switch (rta_getattr_u8(tb[IFLA_IPTUN_PROTO])) { + case IPPROTO_IPIP: + print_string(PRINT_ANY, "proto", "%s ", "ip4ip4"); + break; + case IPPROTO_IPV6: + print_string(PRINT_ANY, "proto", "%s ", "ip6ip"); + break; + case IPPROTO_MPLS: + print_string(PRINT_ANY, "proto", "%s ", "mplsip"); + break; + case 0: + print_string(PRINT_ANY, "proto", "%s ", "any"); + break; + } + } + if (tb[IFLA_IPTUN_REMOTE]) { unsigned int addr = rta_getattr_u32(tb[IFLA_IPTUN_REMOTE]); -- 1.7.10.4