From patchwork Fri Feb 24 18:11:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13151653 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 979BAC7EE23 for ; Fri, 24 Feb 2023 18:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229772AbjBXSLs (ORCPT ); Fri, 24 Feb 2023 13:11:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbjBXSLq (ORCPT ); Fri, 24 Feb 2023 13:11:46 -0500 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 402926C188 for ; Fri, 24 Feb 2023 10:11:45 -0800 (PST) Received: by mail-ot1-x333.google.com with SMTP id f19-20020a9d5f13000000b00693ce5a2f3eso93026oti.8 for ; Fri, 24 Feb 2023 10:11:45 -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=kcVj+e3MEbv+Xd09KUM3tB8THbz9IQcXtyiz+MIZb9M=; b=Szo1Yg8HdB7u+kAz8CLVjcHAauqjqsw0qrW8+r3fODRVXpwybxwDeIsVWrnenPS7TG iwPK1HuQLzM4mHbZ4meW0G7mYRQ8evxG9GijuqIUSYrJzhUHOIFGhiHqsHfAwqSPv8PG BypceFpy1dkJX+UUiwGBSEyXrHwRknIAhU89X9CXdeuWiRLdH2J9EwcYQ8J449evRfE/ V0sglPAVJPpRwh2KYGA4/8X0za0EmiE+UHfQZBEnGY038IvVUN61TuJenAqn7g/dNaE+ LPnKyfSmnd4ZoV3H5PfSvR3iS7mwLjQ//1fr6Rg3HaxXyTxBJ7330f3urpOJDKE4hvir PO0g== 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=kcVj+e3MEbv+Xd09KUM3tB8THbz9IQcXtyiz+MIZb9M=; b=CQCLlZIah80v1tVm9LzGdVLYrfafdPdYl5HZZOIlTswHipBURTTUtyr3Niz7CBzUBa 9fbMthWvgq0vbZf53vlLN9oBca5ng5hy1xBDHjR4b/PROydUpyw4f/lvYz+C+EBxBeBY JrM7l4cRsK4LHpK+2egC/3aIJ9mkhjvSIWqXuTuXmljksovZOoP4wkpR62ss/ujVEW6X sR6yxZsfZLLnU0FMYc0d0ZuVD9/iU+OuEoKrmbOZRxj6vvm6ajrNYoUDuwTuxClNZpby sgFZbamzb0+ADec+wfiDvE+jYRYCXdy+nKfIQPk8nGURtsW3mPOmrVGDXjsylRFrBjlw qIIw== X-Gm-Message-State: AO0yUKUgIt7AmWWUAaqhyFebUVPK48OjF0X2yXnJsWXxRXU3HRgQz4dC EQI1Gh7KJDFvzP1PpFEK+MXHjb0xbENDrEjX X-Google-Smtp-Source: AK7set9Gu+yl2p3ZY/mlcK/YvGqXYsKY465pcS/SXjCLpo4NGOpP5YbqkJOcYsS1k2EAgRn+BB/crQ== X-Received: by 2002:a05:6830:698d:b0:690:eb17:89f4 with SMTP id cy13-20020a056830698d00b00690eb1789f4mr268657otb.3.1677262304492; Fri, 24 Feb 2023 10:11:44 -0800 (PST) Received: from localhost.localdomain ([2804:14d:5c5e:4698:aecd:86a3:8e0c:a9df]) by smtp.gmail.com with ESMTPSA id y7-20020a9d5187000000b0068bb7bd2668sm4040827otg.73.2023.02.24.10.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 10:11:44 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: Pedro Tammela , Jamal Hadi Salim Subject: [PATCH iproute2 1/3] tc: m_csum: parse index argument correctly Date: Fri, 24 Feb 2023 15:11:28 -0300 Message-Id: <20230224181130.187328-2-pctammela@mojatatu.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230224181130.187328-1-pctammela@mojatatu.com> References: <20230224181130.187328-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..ca74427a 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 (matches(*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 Fri Feb 24 18:11:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13151654 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 B81BAC7EE2D for ; Fri, 24 Feb 2023 18:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229781AbjBXSLt (ORCPT ); Fri, 24 Feb 2023 13:11:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbjBXSLs (ORCPT ); Fri, 24 Feb 2023 13:11:48 -0500 Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E28A46695E for ; Fri, 24 Feb 2023 10:11:46 -0800 (PST) Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1720600a5f0so349634fac.11 for ; Fri, 24 Feb 2023 10:11:46 -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=7BJqW6AMdL39TWiQEW5SFi4gWGGlM0+xAnx9lZTSkds=; b=trVV2u3Xew1BZAdI6ahsgu8bopseE1fZuq7kNJye6a64JgvWttRRCGZrVPiDf+/XHh C4ltYLVzuqKPB8kPvNWux9cj7VkaSzYnMiqMUaH+x49L2hFEHdV66G882qnJcCIgYGAc 01zJANScvsQH8ueN29LjZu2H2eF1xFJOKk+AiB8Pi1hg8tbrhZsAPy7AIwTRLd5C6vlV Y8svWdDjyjshJzXU29lbM752OWVz18r3e2zMjouQqXu0tMHcDEnY75cTRuTnpxVHTFUk BLrl25n3LVkRcLu5RW0T5p5fK1znbO736GtjUwWr1WJF2xWhoaKqxzijPRNEYL5fQ3+0 Fong== 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=7BJqW6AMdL39TWiQEW5SFi4gWGGlM0+xAnx9lZTSkds=; b=QWJjmapqSjPO7+KGecEZZzM8Dhe4izxIjNRA/Yg/qQupp/X/OqBVXTvqY/DKmjUwOa EzJEqfx6XQahEgggyiIx8bSd7h9S+BTTaS4+s10HUrL4DCxrAoqNa4vQrRwHAQVicSqx AQioHmyDDo098M4B+uVJzhzCRxBpEn4WTWrEiH/bqYkzQUUhg1N8jIeR/lBKocM2sDZM RjMd7AF8eknaM0CxHiSAflR/M888cZi7E2/F2XsFIvAmZSt9l8zQhtn8w8ELcHe0Usnd grLn+4/v1WWm6uKM3K5nGRlfDAuZFcpjvdMdObpi77QEv93xBZrilBJY/N+YVwYr6GBw k89w== X-Gm-Message-State: AO0yUKUzqPEcnitilSOKcVod6IgrX/xoqLPOcI0WLS5RYzBgZfh73xRj 9P2npIRueSEglGePe8eC0bbEaOf/n0Y0AJ81 X-Google-Smtp-Source: AK7set/IWwt8h/qIH5IWE3I+/Z0gTEZjqsh9T7x+Drn+EZVOrVh6rb4fi+mWAzPq2uRZUiR+tJp0Tg== X-Received: by 2002:a05:6870:9720:b0:16e:49fb:f78a with SMTP id n32-20020a056870972000b0016e49fbf78amr14690707oaq.39.1677262306086; Fri, 24 Feb 2023 10:11:46 -0800 (PST) Received: from localhost.localdomain ([2804:14d:5c5e:4698:aecd:86a3:8e0c:a9df]) by smtp.gmail.com with ESMTPSA id y7-20020a9d5187000000b0068bb7bd2668sm4040827otg.73.2023.02.24.10.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 10:11:45 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: Pedro Tammela , Jamal Hadi Salim Subject: [PATCH iproute2 2/3] tc: m_mpls: parse index argument correctly Date: Fri, 24 Feb 2023 15:11:29 -0300 Message-Id: <20230224181130.187328-3-pctammela@mojatatu.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230224181130.187328-1-pctammela@mojatatu.com> References: <20230224181130.187328-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..10a75885 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 (matches(*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 Fri Feb 24 18:11:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13151655 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 D3838C7EE23 for ; Fri, 24 Feb 2023 18:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229787AbjBXSL5 (ORCPT ); Fri, 24 Feb 2023 13:11:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbjBXSLx (ORCPT ); Fri, 24 Feb 2023 13:11:53 -0500 Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A19767980 for ; Fri, 24 Feb 2023 10:11:48 -0800 (PST) Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-1729bdcca99so344087fac.12 for ; Fri, 24 Feb 2023 10:11:48 -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=0wHrLAVhse45kRLq3ikoHh9ZeIZ/I2OA8vMLZ/L3UKA=; b=xVyGwpCjYQvrHiFTK0BiN59D2vhoEU5ijqMWZJ8V9loXLgRLPyZU99lE21MTymHCBZ a6cS+jPFRO6oEoV+4X2zyjeHCk/4Z0uEfd0LPK2PM4l+OmPp9VzxxIW/KHGgljZurps9 pzPm3MTdIHGDeR5Toq+BXUFpvLskpcBLTftOjlCz7PbWlAdgYMGwc+hD19TEsVe2tH1v ab/7hxK3SG5guUORgK4m8g7/pqaqkU9BJv4ZpYxC0R/N4PagfOdxsVgCGEoQzxz9Eo0t Urc9AOX059bVEQ33kDb/FBSDw61kobXaA+FyXiHG2dU93QAmU6Mzmr0qJzqtqenxkQ84 htdA== 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=0wHrLAVhse45kRLq3ikoHh9ZeIZ/I2OA8vMLZ/L3UKA=; b=1oimqXNYA2FAenipGBjQF4h1yj2l2c3GDzHQz7KLT2Y3ZkAjEFBd9qrrKlgeX4iGkI /f+icHvXTJZBML03VWiM8R9lCtk2ul7/MCOCvSzzv7NRJEpROlR4hlfw/FtlG/ZNxbEl 1SQr7XCEmKYFdFmjdBAkBiEGQ6nndZ7i4nCB12VzY0Aof8IABH1JRyQh11DZxzYhm0Ki XZ1GKxrcTqalDjoYiM1I5qKR+MH/kOb4lO3R06THAzYd7DeLk+BbfZ8tMo8QClJrg/iM bnHTPxM+Q8/U9t9pL+xy2sog9GdQFpzla6lZOnQBOIv6qO2tlxZnGjkieMFRPwo26gu7 LCBw== X-Gm-Message-State: AO0yUKW8QNlVNK2ALYoMFeZ0nzJAUSzEMuy+HZN+APS4BJ82flu3zVms /fDn0ARGF67uqp3cQgOrainM9E/RMGA1zMWY X-Google-Smtp-Source: AK7set+1uFoctGDv8ylIXefwy5ZqXZcDA58WPhZxz71PrWCFu8yIcv5cQTssDuqrxdgO6jikbR5frA== X-Received: by 2002:a05:6870:61cc:b0:15b:8c60:52de with SMTP id b12-20020a05687061cc00b0015b8c6052demr15209968oah.42.1677262307653; Fri, 24 Feb 2023 10:11:47 -0800 (PST) Received: from localhost.localdomain ([2804:14d:5c5e:4698:aecd:86a3:8e0c:a9df]) by smtp.gmail.com with ESMTPSA id y7-20020a9d5187000000b0068bb7bd2668sm4040827otg.73.2023.02.24.10.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 10:11:47 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: Pedro Tammela , Jamal Hadi Salim Subject: [PATCH iproute2 3/3] tc: m_nat: parse index argument correctly Date: Fri, 24 Feb 2023 15:11:30 -0300 Message-Id: <20230224181130.187328-4-pctammela@mojatatu.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230224181130.187328-1-pctammela@mojatatu.com> References: <20230224181130.187328-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..722575c7 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 (matches(*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");