netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH 3/3] tests: shell: add feature probe for sctp chunk matching
Date: Thu, 21 Sep 2023 10:48:46 +0200	[thread overview]
Message-ID: <20230921084849.634-4-fw@strlen.de> (raw)
In-Reply-To: <20230921084849.634-1-fw@strlen.de>

Skip the relavant parts of the test if nft_exthdr lacks sctp support.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 tests/shell/features/sctp_chunks.nft     |  7 +++++++
 tests/shell/testcases/sets/typeof_sets_0 | 26 +++++++++++++++---------
 2 files changed, 23 insertions(+), 10 deletions(-)
 create mode 100644 tests/shell/features/sctp_chunks.nft

diff --git a/tests/shell/features/sctp_chunks.nft b/tests/shell/features/sctp_chunks.nft
new file mode 100644
index 000000000000..520afd64bd2e
--- /dev/null
+++ b/tests/shell/features/sctp_chunks.nft
@@ -0,0 +1,7 @@
+# 133dc203d77d ("netfilter: nft_exthdr: Support SCTP chunks")
+# v5.14-rc1~119^2~373^2~15
+table ip t {
+	chain c {
+		sctp chunk init 0
+	}
+}
diff --git a/tests/shell/testcases/sets/typeof_sets_0 b/tests/shell/testcases/sets/typeof_sets_0
index c1c0f51f399c..35c572c1e537 100755
--- a/tests/shell/testcases/sets/typeof_sets_0
+++ b/tests/shell/testcases/sets/typeof_sets_0
@@ -23,6 +23,16 @@ INPUT_OSF_CHAIN="
 	}
 "
 
+INPUT_SCTP_CHAIN="
+	chain c7 {
+		sctp chunk init num-inbound-streams @s7 accept
+	}
+"
+
+if [ "$NFT_TEST_HAVE_sctp_chunks" = n ] ; then
+	INPUT_SCTP_CHAIN=
+fi
+
 if [ "$NFT_TEST_HAVE_osf" = n ] ; then
 	if [ "$((RANDOM % 2))" -eq 1 ] ; then
 		# Regardless of $NFT_TEST_HAVE_osf, we can define the set.
@@ -98,11 +108,7 @@ $INPUT_OSF_CHAIN
 	chain c6 {
 		tcp option maxseg size @s6 accept
 	}
-
-	chain c7 {
-		sctp chunk init num-inbound-streams @s7 accept
-	}
-
+$INPUT_SCTP_CHAIN
 	chain c8 {
 		ip version @s8 accept
 	}
@@ -187,11 +193,7 @@ $INPUT_OSF_CHAIN
 	chain c6 {
 		tcp option maxseg size @s6 accept
 	}
-
-	chain c7 {
-		sctp chunk init num-inbound-streams @s7 accept
-	}
-
+$INPUT_SCTP_CHAIN
 	chain c8 {
 		ip version @s8 accept
 	}
@@ -218,3 +220,7 @@ if [ "$NFT_TEST_HAVE_osf" = n ] ; then
 	echo "Partial test due to NFT_TEST_HAVE_osf=n. Skip"
 	exit 77
 fi
+if [ "$NFT_TEST_HAVE_sctp_chunks" = n ] ; then
+	echo "Partial test due to NFT_TEST_HAVE_sctp_chunks=n. Skip"
+	exit 77
+fi
-- 
2.41.0


      parent reply	other threads:[~2023-09-21 17:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21  8:48 [PATCH 0/3] nftables: add feature probes for sctp and multistmt set support Florian Westphal
2023-09-21  8:48 ` [PATCH 1/3] tests: shell: skip adding catchall elements if unuspported Florian Westphal
2023-09-21  8:48 ` [PATCH 2/3] tests: shell: add feature probe for sets with more than one element Florian Westphal
2023-09-21  8:48 ` Florian Westphal [this message]

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=20230921084849.634-4-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.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).