From patchwork Thu Jan 10 13:03:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adi Nissim X-Patchwork-Id: 1022901 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43b5mK64tFz9sMM for ; Fri, 11 Jan 2019 00:04:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728703AbfAJNEA (ORCPT ); Thu, 10 Jan 2019 08:04:00 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:33606 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726560AbfAJND7 (ORCPT ); Thu, 10 Jan 2019 08:03:59 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from adin@mellanox.com) with ESMTPS (AES256-SHA encrypted); 10 Jan 2019 15:03:57 +0200 Received: from r-vnc04.mtr.labs.mlnx (r-vnc04.mtr.labs.mlnx [10.208.0.116]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x0AD3uuU010126; Thu, 10 Jan 2019 15:03:56 +0200 From: Adi Nissim To: dsahern@gmail.com Cc: netdev@vger.kernel.org, Adi Nissim Subject: [PATCH iproute-next] tc: m_tunnel_key: Allow key-less tunnels Date: Thu, 10 Jan 2019 15:03:50 +0200 Message-Id: <1547125430-4251-1-git-send-email-adin@mellanox.com> X-Mailer: git-send-email 1.8.2.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Change the id parameter of the tunnel_key set action from mandatory to optional. Some tunneling protocols (e.g. GRE) specify the id as an optional field. Signed-off-by: Adi Nissim --- man/man8/tc-tunnel_key.8 | 4 ++-- tc/m_tunnel_key.c | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) -- 1.8.3.1 diff --git a/man/man8/tc-tunnel_key.8 b/man/man8/tc-tunnel_key.8 index dc8421b..2145eb6 100644 --- a/man/man8/tc-tunnel_key.8 +++ b/man/man8/tc-tunnel_key.8 @@ -59,12 +59,12 @@ above). .TP .B set Set tunnel metadata to be used by the IP tunnel device. Requires -.B id -, .B src_ip and .B dst_ip options. +.B id +, .B dst_port and .B geneve_opts diff --git a/tc/m_tunnel_key.c b/tc/m_tunnel_key.c index e9e71e4..9449287 100644 --- a/tc/m_tunnel_key.c +++ b/tc/m_tunnel_key.c @@ -25,7 +25,7 @@ static void explain(void) fprintf(stderr, " tunnel_key set \n"); fprintf(stderr, "Where TUNNEL_KEY is a combination of:\n" - "id (mandatory)\n" + "id \n" "src_ip (mandatory)\n" "dst_ip (mandatory)\n" "dst_port \n" @@ -217,7 +217,6 @@ static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p, int ret; int has_src_ip = 0; int has_dst_ip = 0; - int has_key_id = 0; int csum = 1; if (matches(*argv, "tunnel_key") != 0) @@ -273,7 +272,6 @@ static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p, fprintf(stderr, "Illegal \"id\"\n"); return -1; } - has_key_id = 1; } else if (matches(*argv, "dst_port") == 0) { NEXT_ARG(); ret = tunnel_key_parse_dst_port(*argv, @@ -335,7 +333,7 @@ static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p, } if (action == TCA_TUNNEL_KEY_ACT_SET && - (!has_src_ip || !has_dst_ip || !has_key_id)) { + (!has_src_ip || !has_dst_ip)) { fprintf(stderr, "set needs tunnel_key parameters\n"); explain(); return -1;