netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [nft PATCH] tests: shell: Fix sets/reset_command_0 for current kernels
Date: Thu,  2 Nov 2023 16:03:42 +0100	[thread overview]
Message-ID: <20231102150342.3543-1-phil@nwl.cc> (raw)

Kernel behaviour changed regarding element reset in sets with timeouts,
disable the offending pieces.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 tests/shell/testcases/sets/reset_command_0 | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/tests/shell/testcases/sets/reset_command_0 b/tests/shell/testcases/sets/reset_command_0
index e663dac831f8c..02d88d291bcf0 100755
--- a/tests/shell/testcases/sets/reset_command_0
+++ b/tests/shell/testcases/sets/reset_command_0
@@ -2,6 +2,10 @@
 
 # NFT_TEST_REQUIRES(NFT_TEST_HAVE_reset_set)
 
+# Note: Element expiry is no longer reset since kernel commit 4c90bba60c26
+# ("netfilter: nf_tables: do not refresh timeout when resetting element"),
+# the respective parts of the test have therefore been commented out.
+
 set -e
 
 trap '[[ $? -eq 0 ]] || echo FAIL' EXIT
@@ -44,10 +48,11 @@ elem='element t s { 1.0.0.1 . udp . 53 }'
 	grep 'elements = ' | drop_seconds | uniq | wc -l) == 1 ]]
 echo OK
 
-echo -n "counters and expiry are reset: "
+#echo -n "counters and expiry are reset: "
+echo -n "counters are reset: "
 NEW=$($NFT "get $elem")
 grep -q 'counter packets 0 bytes 0' <<< "$NEW"
-[[ $(expires_minutes <<< "$NEW") -gt 20 ]]
+#[[ $(expires_minutes <<< "$NEW") -gt 20 ]]
 echo OK
 
 echo -n "get map elem matches reset map elem: "
@@ -80,11 +85,11 @@ OUT=$($NFT reset map t m)
 $DIFF -u <(echo "$EXP") <(echo "$OUT")
 echo OK
 
-echo -n "reset command respects per-element timeout: "
-VAL=$($NFT get element t s '{ 2.0.0.2 . tcp . 22 }' | expires_minutes)
-[[ $VAL -lt 15 ]]	# custom timeout applies
-[[ $VAL -gt 10 ]]	# expires was reset
-echo OK
+#echo -n "reset command respects per-element timeout: "
+#VAL=$($NFT get element t s '{ 2.0.0.2 . tcp . 22 }' | expires_minutes)
+#[[ $VAL -lt 15 ]]	# custom timeout applies
+#[[ $VAL -gt 10 ]]	# expires was reset
+#echo OK
 
 echo -n "remaining elements are reset: "
 OUT=$($NFT list ruleset)
-- 
2.41.0


             reply	other threads:[~2023-11-02 15:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 15:03 Phil Sutter [this message]
2023-11-02 15:29 ` [nft PATCH] tests: shell: Fix sets/reset_command_0 for current kernels Thomas Haller
2023-11-02 17:06   ` Phil Sutter
2023-11-02 20:32     ` Pablo Neira Ayuso
2023-11-05 18:35       ` Pablo Neira Ayuso
2023-11-07 10:38       ` Phil Sutter
2023-11-22 11:30         ` Pablo Neira Ayuso
2023-11-22 13:35           ` Phil Sutter
2023-11-22 17:50             ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231102150342.3543-1-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).