]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: add 'awkward' prefix match expression
authorFlorian Westphal <fw@strlen.de>
Fri, 7 Aug 2015 19:33:25 +0000 (21:33 +0200)
committerFlorian Westphal <fw@strlen.de>
Sun, 23 Aug 2015 21:22:02 +0000 (23:22 +0200)
Its just a more complicated way of saying 'ip saddr 255.255.0.0/16'.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/regression/ip/ip.t
tests/regression/ip/ip.t.payload
tests/regression/ip/ip.t.payload.inet

index 11a959817f1059f290aa6ecda71cf704451f5828..6e29ffb9ad3f004f3d8a168fb69ccace611d151a 100644 (file)
@@ -108,3 +108,6 @@ ip daddr 192.168.0.2 log;ok
 
 ip saddr \& 0xff == 1;ok;ip saddr & 0.0.0.255 == 0.0.0.1
 ip saddr \& 0.0.0.255 \< 0.0.0.127;ok;ip saddr & 0.0.0.255 < 0.0.0.127
+
+ip saddr \& 0xffff0000 == 0xffff0000;ok;ip saddr 255.255.0.0/16
+
index ec4897e801c3e697fe488bafc017c60b7bc8b445..7a77dc4098fbdd8329bd00306d14f05944316a9a 100644 (file)
@@ -347,3 +347,9 @@ ip test-ip4 input
   [ bitwise reg 1 = (reg=1 & 0xff000000 ) ^ 0x00000000 ]
   [ cmp lt reg 1 0x7f000000 ]
 
+# ip saddr \& 0xffff0000 == 0xffff0000
+ip test-ip4 input
+  [ payload load 4b @ network header + 12 => reg 1 ]
+  [ bitwise reg 1 = (reg=1 & 0x0000ffff ) ^ 0x00000000 ]
+  [ cmp eq reg 1 0x0000ffff ]
+
index 1a2b1b5cc726cdcbb9e212014f1e25f8c177954b..dbc7852b11a7d46a324a50d0dd6a4d1510daa169 100644 (file)
@@ -457,3 +457,11 @@ inet test-inet input
   [ bitwise reg 1 = (reg=1 & 0xff000000 ) ^ 0x00000000 ]
   [ cmp lt reg 1 0x7f000000 ]
 
+# ip saddr \& 0xffff0000 == 0xffff0000
+inet test-inet input
+  [ meta load nfproto => reg 1 ]
+  [ cmp eq reg 1 0x00000002 ]
+  [ payload load 4b @ network header + 12 => reg 1 ]
+  [ bitwise reg 1 = (reg=1 & 0x0000ffff ) ^ 0x00000000 ]
+  [ cmp eq reg 1 0x0000ffff ]
+