]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: add shift+and typeof test cases
authorFlorian Westphal <fw@strlen.de>
Fri, 3 Dec 2021 16:12:17 +0000 (17:12 +0100)
committerFlorian Westphal <fw@strlen.de>
Thu, 9 Dec 2021 10:12:32 +0000 (11:12 +0100)
These tests work, but I omitted a few lines that do not:

in: frag frag-off @s4 accept
in: ip version @s8

out: (frag unknown & 0xfff8 [invalid type]) >> 3 == @s4
out:  (ip l4proto & pfsync) >> 4 == @s8

Next patches resolve this.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/testcases/sets/dumps/typeof_sets_0.nft
tests/shell/testcases/sets/typeof_sets_0

index 8f11b110552c0fa2220f53503badee5d70381942..ad442713f6dc89aeac795ae7b4a35f648c8472ed 100644 (file)
@@ -34,6 +34,17 @@ table inet t {
                elements = { 1, 4 }
        }
 
+       set s8 {
+               typeof ip version
+               elements = { 4, 6 }
+       }
+
+       set s9 {
+               typeof ip hdrlength
+               elements = { 0, 1, 2, 3, 4,
+                            15 }
+       }
+
        chain c1 {
                osf name @s1 accept
        }
@@ -53,4 +64,8 @@ table inet t {
        chain c7 {
                sctp chunk init num-inbound-streams @s7 accept
        }
+
+       chain c9 {
+               ip hdrlength @s9 accept
+       }
 }
index 1e99e298773357f59a8743105437aea6d628063e..2102789e104345bd8e4c77408a1ba3bcd55eacb1 100755 (executable)
@@ -40,6 +40,16 @@ EXPECTED="table inet t {
                elements = { 1, 4 }
        }
 
+       set s8 {
+               typeof ip version
+               elements = { 4, 6 }
+       }
+
+       set s9 {
+               typeof ip hdrlength
+               elements = { 0, 1, 2, 3, 4, 15 }
+       }
+
        chain c1 {
                osf name @s1 accept
        }
@@ -59,6 +69,10 @@ EXPECTED="table inet t {
        chain c7 {
                sctp chunk init num-inbound-streams @s7 accept
        }
+
+       chain c9 {
+               ip hdrlength @s9 accept
+       }
 }"
 
 set -e