[PATCH nft 10/14] tests/shell: skip test cases involving osf match if kernel lacks support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Florian Westphal <fw@xxxxxxxxx>

Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
Signed-off-by: Thomas Haller <thaller@xxxxxxxxxx>
---
 tests/shell/features/osf.nft             |  7 +++++++
 tests/shell/testcases/maps/typeof_maps_0 | 19 +++++++++++++++----
 tests/shell/testcases/sets/typeof_sets_0 | 23 +++++++++++++++++------
 3 files changed, 39 insertions(+), 10 deletions(-)
 create mode 100644 tests/shell/features/osf.nft

diff --git a/tests/shell/features/osf.nft b/tests/shell/features/osf.nft
new file mode 100644
index 000000000000..dbb6b4c333e2
--- /dev/null
+++ b/tests/shell/features/osf.nft
@@ -0,0 +1,7 @@
+# b96af92d6eaf ("netfilter: nf_tables: implement Passive OS fingerprint module in nft_osf")
+# v4.19-rc1~140^2~135^2~15
+table t {
+	chain c {
+		osf name "Linux"
+	}
+}
diff --git a/tests/shell/testcases/maps/typeof_maps_0 b/tests/shell/testcases/maps/typeof_maps_0
index 5cf5dddeb1d6..263390d51a5d 100755
--- a/tests/shell/testcases/maps/typeof_maps_0
+++ b/tests/shell/testcases/maps/typeof_maps_0
@@ -4,11 +4,18 @@
 # without typeof, this is 'type string' and 'type integer',
 # but neither could be used because it lacks size information.
 
-EXPECTED="table inet t {
-	map m1 {
+OSFMAP=""
+OSFRULE=""
+if [ "$NFT_TEST_HAVE_osf" != n ] ; then
+	OSFMAP="map m1 {
 		typeof osf name : ct mark
 		elements = { "Linux" : 0x00000001 }
-	}
+	}"
+	OSFRULE="ct mark set osf name map @m1"
+fi
+
+EXPECTED="table inet t {
+	$OSFMAP
 
 	map m2 {
 		typeof vlan id : mark
@@ -33,7 +40,7 @@ EXPECTED="table inet t {
 	}
 
 	chain c {
-		ct mark set osf name map @m1
+		$OSFRULE
 		ether type vlan meta mark set vlan id map @m2
 		meta mark set ip saddr . ip daddr map @m3
 		iifname . ip protocol . th dport vmap @m4
@@ -45,3 +52,7 @@ EXPECTED="table inet t {
 set -e
 $NFT -f - <<< $EXPECTED
 
+if [ "$NFT_TEST_HAVE_osf" = n ] ; then
+	echo "Partial test due to NFT_TEST_HAVE_osf=n. Skip"
+	exit 77
+fi
diff --git a/tests/shell/testcases/sets/typeof_sets_0 b/tests/shell/testcases/sets/typeof_sets_0
index 9f777a8c90bc..6ed0c354bc25 100755
--- a/tests/shell/testcases/sets/typeof_sets_0
+++ b/tests/shell/testcases/sets/typeof_sets_0
@@ -4,11 +4,20 @@
 # s1 and s2 are identical, they just use different
 # ways for declaration.
 
-EXPECTED="table inet t {
-	set s1 {
+OSFSET=""
+OSFCHAIN=""
+if [ "$NFT_TEST_HAVE_osf" != n ] ; then
+	OSFSET="set s1 {
 		typeof osf name
 		elements = { \"Linux\" }
-	}
+	}"
+	OSFCHAIN="chain c1 {
+		osf name @s1 accept
+	}"
+fi
+
+EXPECTED="table inet t {
+	$OSFSET
 
 	set s2 {
 		typeof vlan id
@@ -60,9 +69,7 @@ EXPECTED="table inet t {
 		elements = { 3567 . 1.2.3.4 }
 	}
 
-	chain c1 {
-		osf name @s1 accept
-	}
+	$OSFCHAIN
 
 	chain c2 {
 		ether type vlan vlan id @s2 accept
@@ -104,3 +111,7 @@ EXPECTED="table inet t {
 set -e
 $NFT -f - <<< $EXPECTED
 
+if [ "$NFT_TEST_HAVE_osf" = n ] ; then
+	echo "Partial test due to NFT_TEST_HAVE_osf=n. Skip"
+	exit 77
+fi
-- 
2.41.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux