From patchwork Mon Feb 27 18:45:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13154109 X-Patchwork-Delegate: stephen@networkplumber.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C481DC7EE2E for ; Mon, 27 Feb 2023 18:45:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230111AbjB0Sp2 (ORCPT ); Mon, 27 Feb 2023 13:45:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229953AbjB0Sp0 (ORCPT ); Mon, 27 Feb 2023 13:45:26 -0500 Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A00F206A7 for ; Mon, 27 Feb 2023 10:45:22 -0800 (PST) Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-172afa7bee2so8397286fac.6 for ; Mon, 27 Feb 2023 10:45:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V79hfPVv5aggVgmCvEzVUBRka2O7KgaVtYeBcbClcE8=; b=uwuL3gsVDjDKDlmLFbBk5GOV//ITDZU+d1l8I4FQ+nNdEBedXI2HlQq/amy5L02WOC zHC4b2HcxdLF8ApgfBzgXZma7laFJoxWHGEK4ilXo6UUg4sNHSKr1xoc5AwekWL1Hvn6 Ew/RPbo802Oy25SXUHZJEqa8va3rU1gLGUYtmFViaJ3aLD17eIPxkoX0rr6ieaRYuUfS l8c9rv6gxYPYVDYbvmhAOoG7RDaTqDU6ue3NYCYG5b+GnHno/Pcutu1Cc2AzDOyZ0EQx d7vxzuJ5lPW3SIXV0XRcMxiH534h9TfRxr0HcS4UB+TP6OlhU2gyqOwj74xdNGkFgYsi C1tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V79hfPVv5aggVgmCvEzVUBRka2O7KgaVtYeBcbClcE8=; b=P8gtIGYG625Ub74mQwMU/MFqDCpi2uaoHTpdNKP13FhopCxtNGIcMYSXvYYEFvawt7 a/06SBEvxQ7IAZyNChMGZkdTagP8qPqAGL/Qe1eHN1zzYyLNClpsxUs9MEk44Cx6lYjj 3esGUCT3MFKxiDvzfCfrDhdTS6EpWirZV8fU51yFsE5YSecXLBws+SpqmSpqny+rMdPv ENr8QhiL0Bl8Vt3+5CV2VrCD3D/VdqgZi8dbIO1sc3to/8tLfI6hBeO3eCkyKi6WLADE pfHL0flodiicfrxGQIEkKNZKBGHY5SdrsEMonwQyZ6OnEf79qkYd79yVfaMar+PldidI 4JBQ== X-Gm-Message-State: AO0yUKX9zJzux8yps91CMOwuZozB93HGABL4HzS95nM4pHK9PJ4rJWES 6Qv7DcTZux/rI77ILOcSZz7if/ZqaPztaPDG X-Google-Smtp-Source: AK7set9iwYma6aRS20ZwKys1KA/PFBVnRXUFl/cupQ9pAZM2OhxlOZSXtu6MdRe0B47QQE1zCVZvhg== X-Received: by 2002:a05:6870:391e:b0:16e:862:6085 with SMTP id b30-20020a056870391e00b0016e08626085mr21315325oap.16.1677523521675; Mon, 27 Feb 2023 10:45:21 -0800 (PST) Received: from localhost.localdomain ([2804:14d:5c5e:4698:4174:ef7a:c9ab:ab62]) by smtp.gmail.com with ESMTPSA id b5-20020a05687061c500b001435fe636f2sm2492061oah.53.2023.02.27.10.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 10:45:21 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, stephen@networkplumber.org, Pedro Tammela Subject: [PATCH iproute2 v2 1/3] tc: m_csum: parse index argument correctly Date: Mon, 27 Feb 2023 15:45:08 -0300 Message-Id: <20230227184510.277561-2-pctammela@mojatatu.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230227184510.277561-1-pctammela@mojatatu.com> References: <20230227184510.277561-1-pctammela@mojatatu.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com 'action csum index 1' is a valid cli according to TC's architecture. Fix the grammar parsing to accept it. tdc tests: 1..24 ok 1 6d84 - Add csum iph action ok 2 1862 - Add csum ip4h action ok 3 15c6 - Add csum ipv4h action ok 4 bf47 - Add csum icmp action ok 5 cc1d - Add csum igmp action ok 6 bccc - Add csum foobar action ok 7 3bb4 - Add csum tcp action ok 8 759c - Add csum udp action ok 9 bdb6 - Add csum udp xor iph action ok 10 c220 - Add csum udplite action ok 11 8993 - Add csum sctp action ok 12 b138 - Add csum ip & icmp action ok 13 eeda - Add csum ip & sctp action ok 14 0017 - Add csum udp or tcp action ok 15 b10b - Add all 7 csum actions ok 16 ce92 - Add csum udp action with cookie ok 17 912f - Add csum icmp action with large cookie ok 18 879b - Add batch of 32 csum tcp actions ok 19 b4e9 - Delete batch of 32 csum actions ok 20 0015 - Add batch of 32 csum tcp actions with large cookies ok 21 989e - Delete batch of 32 csum actions with large cookies ok 22 d128 - Replace csum action with invalid goto chain control ok 23 eaf0 - Add csum iph action with no_percpu flag ok 24 c619 - Reference csum action object in filter Fixes: 3822cc98 ("tc: add ACT_CSUM action support (csum)") Reviewed-by: Jamal Hadi Salim Signed-off-by: Pedro Tammela --- tc/m_csum.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tc/m_csum.c b/tc/m_csum.c index ba1e3e33..f5fe8f55 100644 --- a/tc/m_csum.c +++ b/tc/m_csum.c @@ -94,7 +94,9 @@ parse_csum(struct action_util *a, int *argc_p, while (argc > 0) { if (matches(*argv, "csum") == 0) { NEXT_ARG(); - if (parse_csum_args(&argc, &argv, &sel)) { + if (strcmp(*argv, "index") == 0) { + goto skip_args; + } else if (parse_csum_args(&argc, &argv, &sel)) { fprintf(stderr, "Illegal csum construct (%s)\n", *argv); explain(); @@ -123,6 +125,7 @@ parse_csum(struct action_util *a, int *argc_p, if (argc) { if (matches(*argv, "index") == 0) { +skip_args: NEXT_ARG(); if (get_u32(&sel.index, *argv, 10)) { fprintf(stderr, "Illegal \"index\" (%s) \n", From patchwork Mon Feb 27 18:45:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13154110 X-Patchwork-Delegate: stephen@networkplumber.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 174B1C64ED6 for ; Mon, 27 Feb 2023 18:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230132AbjB0Spe (ORCPT ); Mon, 27 Feb 2023 13:45:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230110AbjB0Sp1 (ORCPT ); Mon, 27 Feb 2023 13:45:27 -0500 Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 636B12069E for ; Mon, 27 Feb 2023 10:45:24 -0800 (PST) Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-172094e10e3so8365534fac.10 for ; Mon, 27 Feb 2023 10:45:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wtYJ2MCh/ppAzJWASnnLNzcB0YAvF1JP6FGWcFlD5YU=; b=0ARp6h3/PEEVoYLcfCbd5WtIulNM+as9eDWujQprs5xXovT5oQ7HY0O3LrF1f5lUxc 5xLbsLiCpMvnIwk78j5+P7DMdGiBBcTf60vLZJxBU/j16/PPC2FMu+khjpnFBlJLMmyb 4SrNhX1GpYMcSN3vpkT9QOrNKAtL9StdwBFQkIUqHyYPQ8cAI4nWCXjQ51Yx77Pip00w CRCrbQST+/WuapmVHlZcBTgERxvFovo42L6b6Au4XmgXFj3bJd20eMLhQrGyB9T7fC6G 72ThkaMcVa7Ym1gn+TEhPwHX2qmo+Ncta9tXaK+mScJSlu7lEz/EuGQ3A7VhcGwiXV8w 6rMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wtYJ2MCh/ppAzJWASnnLNzcB0YAvF1JP6FGWcFlD5YU=; b=Vo84HZtolHBYIjLpUhD+eN6KbyOHkOvW0/tvH4dAtFrbOA+V7Q0+a45bhAQwCzC2t5 XhMEnICSXOiq6pn5YuKv+VCqFiJTsdCYhXhZeZAqgmyjhekPJo1rDGN2n8+8pj1PxCgM Uvflq5UGrSv6LTtPZny/Iz7EsHWxd1gOJbhRF6dcbXT+edxtDOEhWc2BAX2Iz062TnXs S5dOj3olOpssCZiy1fIs5VgEkAIV+utsiMv3qVfOZ1bg3Eqb7WqunLFa93F+pb915dHX AnS4D01JREwwuV7t6PiB9SQUJ+S8aSZx1+tpa74P8sKxcxQqN+MUPe9dmHcWIGc+Ss34 BGQA== X-Gm-Message-State: AO0yUKUIHdow5o5PAXGR2k/7hHvu4s0RspdnknFPtfQ9lOWaIAlq4/7l OrIbVJgilAGaS0ElpNuOwXWiJexp5bAKnU3Q X-Google-Smtp-Source: AK7set9Lkf0Ym64q4rSEw4XYgjJhCdhfgAkSiJGdt8NSNVxj5hE2NHjF0lbqzhfGUWjivXw1/87f6Q== X-Received: by 2002:a05:6870:2184:b0:16a:a328:639c with SMTP id l4-20020a056870218400b0016aa328639cmr18613192oae.39.1677523523594; Mon, 27 Feb 2023 10:45:23 -0800 (PST) Received: from localhost.localdomain ([2804:14d:5c5e:4698:4174:ef7a:c9ab:ab62]) by smtp.gmail.com with ESMTPSA id b5-20020a05687061c500b001435fe636f2sm2492061oah.53.2023.02.27.10.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 10:45:23 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, stephen@networkplumber.org, Pedro Tammela Subject: [PATCH iproute2 v2 2/3] tc: m_mpls: parse index argument correctly Date: Mon, 27 Feb 2023 15:45:09 -0300 Message-Id: <20230227184510.277561-3-pctammela@mojatatu.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230227184510.277561-1-pctammela@mojatatu.com> References: <20230227184510.277561-1-pctammela@mojatatu.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com 'action mpls index 1' is a valid cli according to TC's architecture. Fix the grammar parsing to accept it. tdc tests: 1..54 ok 1 a933 - Add MPLS dec_ttl action with pipe opcode ok 2 08d1 - Add mpls dec_ttl action with pass opcode ok 3 d786 - Add mpls dec_ttl action with drop opcode ok 4 f334 - Add mpls dec_ttl action with reclassify opcode ok 5 29bd - Add mpls dec_ttl action with continue opcode ok 6 48df - Add mpls dec_ttl action with jump opcode ok 7 62eb - Add mpls dec_ttl action with trap opcode ok 8 09d2 - Add mpls dec_ttl action with opcode and cookie ok 9 c170 - Add mpls dec_ttl action with opcode and cookie of max length ok 10 9118 - Add mpls dec_ttl action with invalid opcode ok 11 6ce1 - Add mpls dec_ttl action with label (invalid) ok 12 352f - Add mpls dec_ttl action with tc (invalid) ok 13 fa1c - Add mpls dec_ttl action with ttl (invalid) ok 14 6b79 - Add mpls dec_ttl action with bos (invalid) ok 15 d4c4 - Add mpls pop action with ip proto ok 16 91fb - Add mpls pop action with ip proto and cookie ok 17 92fe - Add mpls pop action with mpls proto ok 18 7e23 - Add mpls pop action with no protocol (invalid) ok 19 6182 - Add mpls pop action with label (invalid) ok 20 6475 - Add mpls pop action with tc (invalid) ok 21 067b - Add mpls pop action with ttl (invalid) ok 22 7316 - Add mpls pop action with bos (invalid) ok 23 38cc - Add mpls push action with label ok 24 c281 - Add mpls push action with mpls_mc protocol ok 25 5db4 - Add mpls push action with label, tc and ttl ok 26 7c34 - Add mpls push action with label, tc ttl and cookie of max length ok 27 16eb - Add mpls push action with label and bos ok 28 d69d - Add mpls push action with no label (invalid) ok 29 e8e4 - Add mpls push action with ipv4 protocol (invalid) ok 30 ecd0 - Add mpls push action with out of range label (invalid) ok 31 d303 - Add mpls push action with out of range tc (invalid) ok 32 fd6e - Add mpls push action with ttl of 0 (invalid) ok 33 19e9 - Add mpls mod action with mpls label ok 34 1fde - Add mpls mod action with max mpls label ok 35 0c50 - Add mpls mod action with mpls label exceeding max (invalid) ok 36 10b6 - Add mpls mod action with mpls label of MPLS_LABEL_IMPLNULL (invalid) ok 37 57c9 - Add mpls mod action with mpls min tc ok 38 6872 - Add mpls mod action with mpls max tc ok 39 a70a - Add mpls mod action with mpls tc exceeding max (invalid) ok 40 6ed5 - Add mpls mod action with mpls ttl ok 41 77c1 - Add mpls mod action with mpls ttl and cookie ok 42 b80f - Add mpls mod action with mpls max ttl ok 43 8864 - Add mpls mod action with mpls min ttl ok 44 6c06 - Add mpls mod action with mpls ttl of 0 (invalid) ok 45 b5d8 - Add mpls mod action with mpls ttl exceeding max (invalid) ok 46 451f - Add mpls mod action with mpls max bos ok 47 a1ed - Add mpls mod action with mpls min bos ok 48 3dcf - Add mpls mod action with mpls bos exceeding max (invalid) ok 49 db7c - Add mpls mod action with protocol (invalid) ok 50 b070 - Replace existing mpls push action with new ID ok 51 95a9 - Replace existing mpls push action with new label, tc, ttl and cookie ok 52 6cce - Delete mpls pop action ok 53 d138 - Flush mpls actions ok 54 7a70 - Reference mpls action object in filter Fixes: fb57b092 ("tc: add mpls actions") Reviewed-by: Jamal Hadi Salim Signed-off-by: Pedro Tammela --- tc/m_mpls.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tc/m_mpls.c b/tc/m_mpls.c index 9b39d853..dda46805 100644 --- a/tc/m_mpls.c +++ b/tc/m_mpls.c @@ -91,6 +91,9 @@ static int parse_mpls(struct action_util *a, int *argc_p, char ***argv_p, NEXT_ARG(); + if (strcmp(*argv, "index") == 0) + goto skip_args; + while (argc > 0) { if (matches(*argv, "pop") == 0) { if (check_double_action(action, *argv)) @@ -164,6 +167,7 @@ static int parse_mpls(struct action_util *a, int *argc_p, char ***argv_p, if (argc) { if (matches(*argv, "index") == 0) { +skip_args: NEXT_ARG(); if (get_u32(&parm.index, *argv, 10)) invarg("illegal index", *argv); From patchwork Mon Feb 27 18:45:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13154111 X-Patchwork-Delegate: stephen@networkplumber.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35499C64ED8 for ; Mon, 27 Feb 2023 18:45:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230100AbjB0Spf (ORCPT ); Mon, 27 Feb 2023 13:45:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbjB0Spd (ORCPT ); Mon, 27 Feb 2023 13:45:33 -0500 Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 622B51EBC0 for ; Mon, 27 Feb 2023 10:45:26 -0800 (PST) Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-1729bdcca99so8357789fac.12 for ; Mon, 27 Feb 2023 10:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BbOduyy9UFioZZzQFr3TgrNDEm6j0qB8Gmzagal905k=; b=PBM3RXYCRjETfL7TaDU6JB0VYg954v5xDZstMUretEnL5qBf7fQNgICMPLHH2e7zgN imnlOwZrPKz5pogP9e292wU4MhfpcKfW6fsQ2emInG5XN7RmY6fwhsJCAiWCMbM1FCEC cgBtT6BP89xJprjG+TB+vX/6kO+w9DSb20WvXqJJdJDBt5zE0+WOmlyHkaAqltJUjLvN fH1sy+dNytNBGT8lW5ps1f1i73JAdkO37/VO1eShcLlAHG0sENcPVh70t7u0FVs2kiBj J2PzOMugV+bX0GiZu7Syo7vAyYMdrEU7Sla4+5aEjR0izrsKsifT9H3SPlvFoG0vPFf/ /7DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BbOduyy9UFioZZzQFr3TgrNDEm6j0qB8Gmzagal905k=; b=rsTGk2SjUnpHAjRzjtJLuZybAb/SpgpVO7WiJECzQP8subbv95HUt5fUIKqROLFIty MrPBOPShBx36dQXQUDBMu1ni0/TlQ7KJXgTPHgjKQaflQNgJXvXefdNhPlG4x3ZZfDwn Mp5oow8FhKCAvHUtXYE8nZEuJwuvWIiQ1nNx5bWGQGSIC+NXvqVBPe8OITt8CUEbI+SV zBHK28Ppx6R/Qvuh8fgIH3NFdjfMUL7O43MazKnVZqtoM2L+vb6PG2fNP9VyWOU5579b gt9m97egp+WlSkn8qRx2IuIFq0KLZCdvTb9Q5FWTbt51LYIeLgHVJMeRB65TvLXpDRlk FLNQ== X-Gm-Message-State: AO0yUKUoRJ3J7XIFhtIAo2DoRgOxEROYPunQ1boGuukytBwKTfqMEW1g 0oZR3EYYtlt5XY7Ee34PDsmydoA2UeuCQEvD X-Google-Smtp-Source: AK7set9HNN9WkQDwq5ooVhnr2sp+QcDMbDE8QKrkWvKZgViOXJC2oWlAwz30FCW3K2LFApv1JsMp+Q== X-Received: by 2002:a05:6870:524a:b0:171:9702:8ec with SMTP id o10-20020a056870524a00b00171970208ecmr19629533oai.32.1677523525647; Mon, 27 Feb 2023 10:45:25 -0800 (PST) Received: from localhost.localdomain ([2804:14d:5c5e:4698:4174:ef7a:c9ab:ab62]) by smtp.gmail.com with ESMTPSA id b5-20020a05687061c500b001435fe636f2sm2492061oah.53.2023.02.27.10.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 10:45:25 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, stephen@networkplumber.org, Pedro Tammela Subject: [PATCH iproute2 v2 3/3] tc: m_nat: parse index argument correctly Date: Mon, 27 Feb 2023 15:45:10 -0300 Message-Id: <20230227184510.277561-4-pctammela@mojatatu.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230227184510.277561-1-pctammela@mojatatu.com> References: <20230227184510.277561-1-pctammela@mojatatu.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com 'action nat index 1' is a valid cli according to TC's architecture. Fix the grammar parsing to accept it. tdc tests: 1..28 ok 1 7565 - Add nat action on ingress with default control action ok 2 fd79 - Add nat action on ingress with pipe control action ok 3 eab9 - Add nat action on ingress with continue control action ok 4 c53a - Add nat action on ingress with reclassify control action ok 5 76c9 - Add nat action on ingress with jump control action ok 6 24c6 - Add nat action on ingress with drop control action ok 7 2120 - Add nat action on ingress with maximum index value ok 8 3e9d - Add nat action on ingress with invalid index value ok 9 f6c9 - Add nat action on ingress with invalid IP address ok 10 be25 - Add nat action on ingress with invalid argument ok 11 a7bd - Add nat action on ingress with DEFAULT IP address ok 12 ee1e - Add nat action on ingress with ANY IP address ok 13 1de8 - Add nat action on ingress with ALL IP address ok 14 8dba - Add nat action on egress with default control action ok 15 19a7 - Add nat action on egress with pipe control action ok 16 f1d9 - Add nat action on egress with continue control action ok 17 6d4a - Add nat action on egress with reclassify control action ok 18 b313 - Add nat action on egress with jump control action ok 19 d9fc - Add nat action on egress with drop control action ok 20 a895 - Add nat action on egress with DEFAULT IP address ok 21 2572 - Add nat action on egress with ANY IP address ok 22 37f3 - Add nat action on egress with ALL IP address ok 23 6054 - Add nat action on egress with cookie ok 24 79d6 - Add nat action on ingress with cookie ok 25 4b12 - Replace nat action with invalid goto chain control ok 26 b811 - Delete nat action with valid index ok 27 a521 - Delete nat action with invalid index ok 28 2c81 - Reference nat action object in filter Fixes: fc2d0206 ("Add NAT action") Reviewed-by: Jamal Hadi Salim Signed-off-by: Pedro Tammela --- tc/m_nat.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tc/m_nat.c b/tc/m_nat.c index 58315125..95b35584 100644 --- a/tc/m_nat.c +++ b/tc/m_nat.c @@ -88,7 +88,9 @@ parse_nat(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct while (argc > 0) { if (matches(*argv, "nat") == 0) { NEXT_ARG(); - if (parse_nat_args(&argc, &argv, &sel)) { + if (strcmp(*argv, "index") == 0) { + goto skip_args; + } else if (parse_nat_args(&argc, &argv, &sel)) { fprintf(stderr, "Illegal nat construct (%s)\n", *argv); explain(); @@ -113,6 +115,7 @@ parse_nat(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct if (argc) { if (matches(*argv, "index") == 0) { +skip_args: NEXT_ARG(); if (get_u32(&sel.index, *argv, 10)) { fprintf(stderr, "Nat: Illegal \"index\"\n");