diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-11-07 11:30:32 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-11-11 10:05:26 +0100 |
commit | a3b6a92de6fa05802e90a70be0a287a90fb1a657 (patch) | |
tree | 570e05c2674c898d125803b9368b830f4e9a48ee /tests/shell/testcases/sets | |
parent | 02d041cbd1a0d0dd96d23dcc88cb0ba45e7ce0e9 (diff) |
tests: shell: skip if kernel does not support bitshift
A few tests are missing bitshift checks that has been added to
885845468408 ("tests/shell: skip bitshift tests if kernel lacks
support").
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases/sets')
-rwxr-xr-x | tests/shell/testcases/sets/typeof_sets_0 | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/tests/shell/testcases/sets/typeof_sets_0 b/tests/shell/testcases/sets/typeof_sets_0 index 35c572c1..92555a1f 100755 --- a/tests/shell/testcases/sets/typeof_sets_0 +++ b/tests/shell/testcases/sets/typeof_sets_0 @@ -17,22 +17,53 @@ INPUT_OSF_SET=" elements = { \"Linux\" } } " + +INPUT_FRAG_SET=" + set s4 { + typeof frag frag-off + elements = { 1, 1024 } + } +" + +INPUT_VERSION_SET=" + set s8 { + typeof ip version + elements = { 4, 6 } + } +" + INPUT_OSF_CHAIN=" chain c1 { osf name @s1 accept } " +INPUT_FRAG_CHAIN=" + chain c4 { + frag frag-off @s4 accept + } +" + INPUT_SCTP_CHAIN=" chain c7 { sctp chunk init num-inbound-streams @s7 accept } " +INPUT_VERSION_CHAIN=" + chain c8 { + ip version @s8 accept + } +" if [ "$NFT_TEST_HAVE_sctp_chunks" = n ] ; then INPUT_SCTP_CHAIN= fi +if [ "$NFT_TEST_HAVE_bitshift" = n ] ; then + INPUT_FRAG_CHAIN= + INPUT_VERSION_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. @@ -51,12 +82,7 @@ INPUT="table inet t {$INPUT_OSF_SET set s3 { typeof meta ibrpvid elements = { 2, 3, 103 } - } - - set s4 { - typeof frag frag-off - elements = { 1, 1024 } - } + }$INPUT_FRAG_SET set s5 { typeof ip option ra value @@ -71,12 +97,7 @@ INPUT="table inet t {$INPUT_OSF_SET set s7 { typeof sctp chunk init num-inbound-streams elements = { 1, 4 } - } - - set s8 { - typeof ip version - elements = { 4, 6 } - } + }$INPUT_VERSION_SET set s9 { typeof ip hdrlength @@ -96,11 +117,7 @@ $INPUT_OSF_CHAIN chain c2 { ether type vlan vlan id @s2 accept } - - chain c4 { - frag frag-off @s4 accept - } - +$INPUT_FRAG_CHAIN chain c5 { ip option ra value @s5 accept } @@ -109,10 +126,7 @@ $INPUT_OSF_CHAIN tcp option maxseg size @s6 accept } $INPUT_SCTP_CHAIN - chain c8 { - ip version @s8 accept - } - +$INPUT_VERSION_CHAIN chain c9 { ip hdrlength @s9 accept } @@ -136,12 +150,7 @@ EXPECTED="table inet t {$INPUT_OSF_SET typeof meta ibrpvid elements = { 2, 3, 103 } } - - set s4 { - typeof frag frag-off - elements = { 1, 1024 } - } - +$INPUT_FRAG_SET set s5 { typeof ip option ra value elements = { 1, 1024 } @@ -156,12 +165,7 @@ EXPECTED="table inet t {$INPUT_OSF_SET typeof sctp chunk init num-inbound-streams elements = { 1, 4 } } - - set s8 { - typeof ip version - elements = { 4, 6 } - } - +$INPUT_VERSION_SET set s9 { typeof ip hdrlength elements = { 0, 1, 2, 3, 4, @@ -181,11 +185,7 @@ $INPUT_OSF_CHAIN chain c2 { vlan id @s2 accept } - - chain c4 { - frag frag-off @s4 accept - } - +$INPUT_FRAG_CHAIN chain c5 { ip option ra value @s5 accept } @@ -193,11 +193,7 @@ $INPUT_OSF_CHAIN chain c6 { tcp option maxseg size @s6 accept } -$INPUT_SCTP_CHAIN - chain c8 { - ip version @s8 accept - } - +$INPUT_SCTP_CHAIN$INPUT_VERSION_CHAIN chain c9 { ip hdrlength @s9 accept } @@ -216,6 +212,10 @@ $NFT -f - <<< "$INPUT" || die $'nft command failed to process input:\n'">$INPUT< $DIFF -u <($NFT list ruleset) - <<<"$EXPECTED" || die $'diff failed between ruleset and expected data.\nExpected:\n'">$EXPECTED<" +if [ "$NFT_TEST_HAVE_bitshift" = n ] ; then + echo "Partial test due to NFT_TEST_HAVE_bitshift=n. Skip" + exit 77 +fi if [ "$NFT_TEST_HAVE_osf" = n ] ; then echo "Partial test due to NFT_TEST_HAVE_osf=n. Skip" exit 77 |