From patchwork Tue Jan 2 15:29:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhey Popovych X-Patchwork-Id: 854589 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uUZcIH1M"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3z9yfd5d19z9sRW for ; Wed, 3 Jan 2018 02:29:45 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751528AbeABP3n (ORCPT ); Tue, 2 Jan 2018 10:29:43 -0500 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=+oo7ux/gC/HxO0CoK/76dek2ChMptYuF+53AobhZbIk=; b=uUZcIH1Mr5n0h3kriNZHJdxe2J5TqZNxhtaTm3SqPb9UtuM1Uvip9HPrr+Aj0RV7KS SBi7Z66c5QSttp4+ngKvMlgThCfp7cdCv23hO1PxsWTfVuCF4iDok2VH0Ad4yRXtPTnZ AR95OrLWfTM7Ydki8OkvbOzTK+kvjRYsSDyGAnQ+lgYZ6QQPfIonvIeOyHkYyCAVFT2j JCnaMwHP3J7w18PTJhazNrQ8Jh7GFDWUJgNpQcwW3PoO/WFUJ/2fxf7bvm28Cp0FoyH3 Ne0h4HljAlWlh3XiNh7HNmCQqwJfoE0p9s7uYvSocAc+Z+fn+nQs5gcqkUoRdE/egOet 7MAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=+oo7ux/gC/HxO0CoK/76dek2ChMptYuF+53AobhZbIk=; b=VWPb+zhZfM9OMbh3vnmR3yeM7BcntdzGvItUn5wtcJ5QTTxklaHrc1P6Aslq8JxZYJ 9btv4IfyilRMfqittUSaa2TMFmwI1q5dwoZVWdvjKZ7I6O2waxwhlqRAmaeVKp1drG5j ijnSKe+cmQqFSmQXlzbrABhp3a7IUFNOPTS4jj9myH6LabcWI9n0c2mzHHVhJ2LhjC+5 WEM/DU052nZhyMmx1ztZcMvcc/PhbNEYcyOKt1vL91YbIKq4Sr6ix5vZ8HuaW9ypN5Wh c3Eo7rJ0qmFy0ZwFgGH4vbcL07LCMJaCWnGCeTcLC/+U0XAEREUZy5Q28s/NY83Uo9n0 lzTw== X-Gm-Message-State: AKGB3mJZheME2ygwPiaOYi2X9Qr9MYBm0tbpUwmqcnaMt6C7qVaeWUj9 2lqO9iXAesj2mYpuG/OdcLvtd3MF4JA= X-Google-Smtp-Source: ACJfBov3nKIfvNpwkCbQiviLWLiXtJw7tgZDIp39vZPpKg9ZBEDXaBEbBOCYgMoFxkVRUfELBe5jHg== X-Received: by 10.46.80.76 with SMTP id v12mr27064345ljd.101.1514906971372; Tue, 02 Jan 2018 07:29:31 -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) From: Serhey Popovych To: netdev@vger.kernel.org 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> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1514906959-9719-1-git-send-email-serhe.popovych@gmail.com> References: <1514906959-9719-1-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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]);