From patchwork Tue Jun 22 15:05:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Ricardo Leitner X-Patchwork-Id: 12337771 X-Patchwork-Delegate: kuba@kernel.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 X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DB56C48BE5 for ; Tue, 22 Jun 2021 15:05:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E5B36113D for ; Tue, 22 Jun 2021 15:05:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232072AbhFVPHi (ORCPT ); Tue, 22 Jun 2021 11:07:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231936AbhFVPHc (ORCPT ); Tue, 22 Jun 2021 11:07:32 -0400 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C2CAC061756 for ; Tue, 22 Jun 2021 08:05:15 -0700 (PDT) Received: by mail-qv1-xf2e.google.com with SMTP id f5so9367814qvu.8 for ; Tue, 22 Jun 2021 08:05:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5KwXJCz6ZDJvvMYUBRHhUw9tz+yXYvHIljPpXhAYsJY=; b=dfvcVNWpee72gjGlkhxt/ifCTRTb/7rogfp3bEokpWyHlQQGpsfqQfECpnk1MxRzRM LXbJn/F35CvK8Uu0CWV64mbAxqYjs17Kl6JQjfPIjY+porEt0Z8Vo47UiWmSmKDWoR9U aOpoAOM5sPOtaVDm7Y2h0nb1yuWHk/3oMxS/8C5pi5gV0j9g8dMbjYm4NV7m+Haigg1a FOuj/P3KT63EIVd8h2fki4/klFdmYREvpgtoWFYRi14GP7Hk8UPc8bZ5l87kSjX0S8aR XhBiq2UUI2wQ/GrRoXcVKmz42f32WhSuo7VsrndvlpVJn9Rfajp6jcwgXo2p+S9pi1gV Ot3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5KwXJCz6ZDJvvMYUBRHhUw9tz+yXYvHIljPpXhAYsJY=; b=FNPZsvem21qSaFlRqL8UAXDtc3t+aSkcVjiyiDQA5bla2zTGcAqbxj+XkEKztOvjtm +yOzep5b0jWHKc9sbkTsUF7CvLlKaTa7TpA7ypAHZgWOb3ernmNstJF/TD8FzRj8/R09 o643/E6N3g9/kuwi239r/hfwqOvb5Hi2130cJxYdnPwFw/f6HMICdDSqjZOQ3ZZxI0Mn I7lbbHDn/Tux3HQX4kQAxFoklM6IDefn5B2hoTMu/nUQB912O4Zd58QmowQ69fCDi8R+ K/kfYsx0Ob+ABs6EiQ+X9zhoOk7Gw/J7Fjr95o1hGd+5218BvaKiwRJXK4GfGKEtctuJ Icew== X-Gm-Message-State: AOAM532vRz85R74S1drDCNFhcfSKbjMpTHuWB2TYSAZcPY4Pi7qdJdad GPbfcI7dRnBggx2YmupOjDE= X-Google-Smtp-Source: ABdhPJwFmsexor+kVrrxqrfEqpDj9KbkJ82xvefQFZ/34W0XUhXdi4nTt7vDeVrTEUJ/E6ycRYhTXA== X-Received: by 2002:a0c:e481:: with SMTP id n1mr22049660qvl.49.1624374313488; Tue, 22 Jun 2021 08:05:13 -0700 (PDT) Received: from horizon.localdomain ([2001:1284:f016:6106:596a:c2e4:c4f2:9f1e]) by smtp.gmail.com with ESMTPSA id g11sm1791973qto.91.2021.06.22.08.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 08:05:13 -0700 (PDT) Received: by horizon.localdomain (Postfix, from userid 1000) id DBF16C0780; Tue, 22 Jun 2021 12:05:10 -0300 (-03) From: Marcelo Ricardo Leitner To: netdev@vger.kernel.org Cc: dcaratti@redhat.com, Jamal Hadi Salim Subject: [PATCH net-next 1/3] tc-testing: fix list handling Date: Tue, 22 Jun 2021 12:05:00 -0300 Message-Id: <2ba12684b1e79d0ab8214d1198441cf1fa6bd31f.1624373870.git.marcelo.leitner@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org python lists don't have an 'add' method, but 'append'. Fixes: 14e5175e9e04 ("tc-testing: introduce scapyPlugin for basic traffic") Signed-off-by: Marcelo Ricardo Leitner --- tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py index 229ee185b27e198dd1a1ec7a4408751e54428d60..a7b21658af9b463cef8c9b3d4023f222426f239b 100644 --- a/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py +++ b/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py @@ -36,7 +36,7 @@ class SubPlugin(TdcPlugin): for k in scapy_keys: if k not in scapyinfo: keyfail = True - missing_keys.add(k) + missing_keys.append(k) if keyfail: print('{}: Scapy block present in the test, but is missing info:' .format(self.sub_class)) From patchwork Tue Jun 22 15:05:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Ricardo Leitner X-Patchwork-Id: 12337767 X-Patchwork-Delegate: kuba@kernel.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 X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2FFAC2B9F4 for ; Tue, 22 Jun 2021 15:05:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97E4F6113D for ; Tue, 22 Jun 2021 15:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231680AbhFVPHa (ORCPT ); Tue, 22 Jun 2021 11:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbhFVPHa (ORCPT ); Tue, 22 Jun 2021 11:07:30 -0400 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 839BBC061574 for ; Tue, 22 Jun 2021 08:05:14 -0700 (PDT) Received: by mail-qk1-x72b.google.com with SMTP id i68so40334618qke.3 for ; Tue, 22 Jun 2021 08:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9fDL54lwCB9RTh6TzPKvCE7egP/3LnL3gPQhZIXYHX4=; b=Dx7JDfUCgW89nUboN0SLChwcEc2ctvJDRkV1xCv4nfOB3uJfzp2Kkat/oBv79Z1jBC nhLMg/2wXMYVreODtjEZ2e8XDSXumdIWtsm44nFgi/KxDatf8sTaZZROXpyOgiU2TQhl Uk77bb8L+i/RzjrnIWUvLK+JYunqshQ6IqzG+nBRLzq1VJV7HnyeUP4d0/dvpcypz8CD BCRyLvuWAhWuGeTKVEMchauJtbO3jttGz8HXAxTa9uPTbO2Uuot8AvMfxYy5K0Qpvh+W oUBhfIjyUw9uSLBImArO34S/yaF5blMSqDnZPUj0YgsDJDvSUz/O2a6Jxy5CR5lISxE4 RNhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9fDL54lwCB9RTh6TzPKvCE7egP/3LnL3gPQhZIXYHX4=; b=caVngjLcWmNcbYjLLWmu6ErDTJAaK4ggWlZHed+5/hIErdwIv2ZYjfSxBDaepcUmEl IQhVV0B+AmIc8LNJ9YR5hB0AJPQv/VF1Dt7Yg2vzqA8iUJNYKD6/CUQrBXrYrA6xRnRf gLzeWPsoaCJNkOBh8As61/jOS6rhEeeKuimGAIXD70Q3+BlpEXG7AsdTqke4WBpsEtsh 1SZQzEJMruaaOGVkYcbKSfNgf/wfpdwFh5UaMiDfqoose1MTbdFzTLlSYvzv3nPDjIXh Xz/i6Bc6iHwhPsU2rK+yoet2EwD+gSXJIDmUYe9Mdb9wBd0XVr0nGQ3xsvbHUQ6H6IgI Isdw== X-Gm-Message-State: AOAM531SwVb4TQPF4tAz8upTwc1uMEQHHvLW3qLK93Oec0GL86xAlSty rTcAfeEPSb1BwW+XOJ1fxKg= X-Google-Smtp-Source: ABdhPJxLj2Q5eElkykH3ZuwCgN2XjpN+63JMcknXsH3wZApHK+aJtChzPpZs/PJ6UW2LSCMZvTQSRw== X-Received: by 2002:a37:aec2:: with SMTP id x185mr4759767qke.294.1624374313727; Tue, 22 Jun 2021 08:05:13 -0700 (PDT) Received: from horizon.localdomain ([177.220.172.71]) by smtp.gmail.com with ESMTPSA id e24sm1729021qtp.97.2021.06.22.08.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 08:05:13 -0700 (PDT) Received: by horizon.localdomain (Postfix, from userid 1000) id DF797C13E2; Tue, 22 Jun 2021 12:05:10 -0300 (-03) From: Marcelo Ricardo Leitner To: netdev@vger.kernel.org Cc: dcaratti@redhat.com, Jamal Hadi Salim Subject: [PATCH net-next 2/3] tc-testing: add support for sending various scapy packets Date: Tue, 22 Jun 2021 12:05:01 -0300 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org It can be worth sending different scapy packets on a given test, as in the last patch of this series. For that, lets listify the scapy attribute and simply iterate over it. Signed-off-by: Marcelo Ricardo Leitner --- .../tc-testing/plugin-lib/scapyPlugin.py | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py index a7b21658af9b463cef8c9b3d4023f222426f239b..254136e3da5ac401adb5bf91b92b3a6ae3cda042 100644 --- a/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py +++ b/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py @@ -29,22 +29,26 @@ class SubPlugin(TdcPlugin): return # Check for required fields - scapyinfo = self.args.caseinfo['scapy'] - scapy_keys = ['iface', 'count', 'packet'] - missing_keys = [] - keyfail = False - for k in scapy_keys: - if k not in scapyinfo: - keyfail = True - missing_keys.append(k) - if keyfail: - print('{}: Scapy block present in the test, but is missing info:' - .format(self.sub_class)) - print('{}'.format(missing_keys)) - - pkt = eval(scapyinfo['packet']) - if '$' in scapyinfo['iface']: - tpl = Template(scapyinfo['iface']) - scapyinfo['iface'] = tpl.safe_substitute(NAMES) - for count in range(scapyinfo['count']): - sendp(pkt, iface=scapyinfo['iface']) + lscapyinfo = self.args.caseinfo['scapy'] + if type(lscapyinfo) != list: + lscapyinfo = [ lscapyinfo, ] + + for scapyinfo in lscapyinfo: + scapy_keys = ['iface', 'count', 'packet'] + missing_keys = [] + keyfail = False + for k in scapy_keys: + if k not in scapyinfo: + keyfail = True + missing_keys.append(k) + if keyfail: + print('{}: Scapy block present in the test, but is missing info:' + .format(self.sub_class)) + print('{}'.format(missing_keys)) + + pkt = eval(scapyinfo['packet']) + if '$' in scapyinfo['iface']: + tpl = Template(scapyinfo['iface']) + scapyinfo['iface'] = tpl.safe_substitute(NAMES) + for count in range(scapyinfo['count']): + sendp(pkt, iface=scapyinfo['iface']) From patchwork Tue Jun 22 15:05:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Ricardo Leitner X-Patchwork-Id: 12337773 X-Patchwork-Delegate: kuba@kernel.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 X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CB3BC2B9F4 for ; Tue, 22 Jun 2021 15:05:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49ADA6113D for ; Tue, 22 Jun 2021 15:05:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232089AbhFVPHl (ORCPT ); Tue, 22 Jun 2021 11:07:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231994AbhFVPHc (ORCPT ); Tue, 22 Jun 2021 11:07:32 -0400 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15950C06175F for ; Tue, 22 Jun 2021 08:05:16 -0700 (PDT) Received: by mail-qk1-x72d.google.com with SMTP id bj15so38504883qkb.11 for ; Tue, 22 Jun 2021 08:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tIZQm+sStQKdHI1E+mp1ZW+5jKcKVfLb3zXzQiBk2Oc=; b=lCKYFoOydkyVZQnHeBb8cdsDgFYUYacfsLAeGmQsfvi2oe2PnynibIFc9qjx7oPoLp 1rs8M4oxaFGADtcsyYBDde7J+2zdHO+v6UfkEHOhfFwuRk209ABnC9j8bgfs+OZRYGK8 6XBUvuLURtD738kCKzqFh7MY39vYchdJKI+KlprAIKWPnGyW1VYPqqKU56ULmi0IW+Hp WVL8ys7k1lhle7gN01s2APzCt7VK9XnnsQqMiJUrQULlg9++oNt358le5cX1bmbOoV7F t8jWkmnTfixLYA9GymGIdi54VSSAXchn8FQ7xetHZnTd9dtIKKiFYWsX/Z8J84GTaf2U ei3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tIZQm+sStQKdHI1E+mp1ZW+5jKcKVfLb3zXzQiBk2Oc=; b=oTWXnlbITeu1k0jBSjDho1ADO6SaTWAy9cV0LWgSEShRSq4SdF3EStAC1GAEpsh7y4 F30UHkN+4k4fQ8DllSKkrNdZcfYdYr0HqP9C3HD/jB+B7SSjyGs87k7MH47Qb0/J+oMW tQ6E9yMXDWweWUHlakXSU66vhw0iduNWG5vXLn2Tehq9um6a8nt5Y3ODOZ/BNK/KE9oQ csPi9zw3ms28VluAzpWhxexavLq8s0C5+ulcZcz0snMEzr72m1uvljPj5LsORsH5s2kE CZ2Z1c2R/LeCNsgvGlnPFYB0laQKMfUeq1odSWGri6Ij7Qi0bc5vJjXWOwXQgMnqfL1Q +1JQ== X-Gm-Message-State: AOAM531MOiOhCWvjKxEnhI3C6e2T4H+n3YDolAtM4V3IUoyhPuO1NbwI qM8Op6iQKoeoBBQJwTSHfgo= X-Google-Smtp-Source: ABdhPJzIiaHv4HgYLZQtYI7SgfXAM+xXnPcoCTiyvENWBK7+fox/9zyXSzzBv9QtaWEBhxPyKb0vBA== X-Received: by 2002:a37:9f51:: with SMTP id i78mr4850871qke.345.1624374313592; Tue, 22 Jun 2021 08:05:13 -0700 (PDT) Received: from horizon.localdomain ([2001:1284:f016:6106:596a:c2e4:c4f2:9f1e]) by smtp.gmail.com with ESMTPSA id t15sm1783106qtr.35.2021.06.22.08.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 08:05:13 -0700 (PDT) Received: by horizon.localdomain (Postfix, from userid 1000) id E3E1FC13E5; Tue, 22 Jun 2021 12:05:10 -0300 (-03) From: Marcelo Ricardo Leitner To: netdev@vger.kernel.org Cc: dcaratti@redhat.com, Jamal Hadi Salim Subject: [PATCH net-next 3/3] tc-testing: add test for ct DNAT tuple collision Date: Tue, 22 Jun 2021 12:05:02 -0300 Message-Id: <7b045b1a5e62916af135748e629d03e759627655.1624373870.git.marcelo.leitner@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When this test fails, /proc/net/nf_conntrack gets only 1 entry: ipv4 2 tcp 6 119 SYN_SENT src=10.0.0.10 dst=10.0.0.10 sport=5000 dport=10 [UNREPLIED] src=20.0.0.1 dst=10.0.0.10 sport=10 dport=5000 mark=0 secctx=system_u:object_r:unlabeled_t:s0 zone=0 use=2 When it works, it gets 2 entries: ipv4 2 tcp 6 119 SYN_SENT src=10.0.0.10 dst=10.0.0.20 sport=5000 dport=10 [UNREPLIED] src=20.0.0.1 dst=10.0.0.10 sport=10 dport=58203 mark=0 secctx=system_u:object_r:unlabeled_t:s0 zone=0 use=2 ipv4 2 tcp 6 119 SYN_SENT src=10.0.0.10 dst=10.0.0.10 sport=5000 dport=10 [UNREPLIED] src=20.0.0.1 dst=10.0.0.10 sport=10 dport=5000 mark=0 secctx=system_u:object_r:unlabeled_t:s0 zone=0 use=2 The missing entry is because the 2nd packet hits a tuple collusion and the conntrack entry doesn't get allocated. Signed-off-by: Marcelo Ricardo Leitner --- .../tc-testing/tc-tests/actions/ct.json | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/ct.json b/tools/testing/selftests/tc-testing/tc-tests/actions/ct.json index 4202e95e27b99536491cd8b94e92b07851551616..bd843ab00a58a44af14182fd30d7a4f74b1c63cd 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/actions/ct.json +++ b/tools/testing/selftests/tc-testing/tc-tests/actions/ct.json @@ -406,5 +406,50 @@ "teardown": [ "$TC actions flush action ct" ] + }, + { + "id": "3992", + "name": "Add ct action triggering DNAT tuple conflict", + "category": [ + "actions", + "ct", + "scapy" + ], + "plugins": { + "requires": [ + "nsPlugin", + "scapyPlugin" + ] + }, + "setup": [ + [ + "$TC qdisc del dev $DEV1 ingress", + 0, + 1, + 2, + 255 + ], + "$TC qdisc add dev $DEV1 ingress" + ], + "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ip prio 1 flower ct_state -trk action ct commit nat dst addr 20.0.0.1 port 10 pipe action drop", + "scapy": [ + { + "iface": "$DEV0", + "count": 1, + "packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.10')/TCP(sport=5000,dport=10)" + }, + { + "iface": "$DEV0", + "count": 1, + "packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)" + } + ], + "expExitCode": "0", + "verifyCmd": "cat /proc/net/nf_conntrack", + "matchPattern": "dst=10.0.0.20", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $DEV1 ingress" + ] } ]