]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: meta: icmp, icmpv6: don't kill required dependencies
authorFlorian Westphal <fw@strlen.de>
Tue, 27 Mar 2018 10:11:04 +0000 (12:11 +0200)
committerFlorian Westphal <fw@strlen.de>
Tue, 27 Mar 2018 10:11:41 +0000 (12:11 +0200)
when explicitly filtering icmp-in-ipv6 and icmp6-in-ip don't remove the
required l3 protocol dependency, else "nft list ruleset" can't be read
via nft -f anymore.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/any/meta.t
tests/py/any/meta.t.payload
tests/py/ip/meta.t [new file with mode: 0644]
tests/py/ip/meta.t.payload [new file with mode: 0644]
tests/py/ip6/meta.t [new file with mode: 0644]

index 9da20d03cafdec2a3e38413d23bca8d3c67f0374..3165ef2cd0b9051672d262d467ed6794e3ab7426 100644 (file)
@@ -33,7 +33,6 @@ meta l4proto { 33, 55, 67, 88};ok;meta l4proto { 33, 55, 67, 88}
 meta l4proto != { 33, 55, 67, 88};ok
 meta l4proto { 33-55};ok
 meta l4proto != { 33-55};ok
-meta l4proto ipv6-icmp icmpv6 type nd-router-advert;ok;icmpv6 type nd-router-advert
 
 meta priority root;ok
 meta priority none;ok
index 48eae4a9de3770f86d90a42cdd49de7ec42dd9d0..21c6cdd37e9c079f3615a7ad47b54d7df4758c74 100644 (file)
@@ -161,13 +161,6 @@ ip test-ip4 input
   [ byteorder reg 1 = hton(reg 1, 2, 1) ]
   [ lookup reg 1 set __set%d 0x1 ]
 
-# meta l4proto ipv6-icmp icmpv6 type nd-router-advert
-ip test-ip4 input
-  [ meta load l4proto => reg 1 ]
-  [ cmp eq reg 1 0x0000003a ]
-  [ payload load 1b @ transport header + 0 => reg 1 ]
-  [ cmp eq reg 1 0x00000086 ]
-
 # meta mark 0x4
 ip test-ip4 input
   [ meta load mark => reg 1 ]
diff --git a/tests/py/ip/meta.t b/tests/py/ip/meta.t
new file mode 100644 (file)
index 0000000..31c9950
--- /dev/null
@@ -0,0 +1,9 @@
+:input;type filter hook input priority 0
+
+*ip;test-ip4;input
+
+icmp type echo-request;ok
+meta l4proto icmp icmp type echo-request;ok;icmp type echo-request
+meta l4proto ipv6-icmp icmpv6 type nd-router-advert;ok;meta l4proto 58 icmpv6 type nd-router-advert
+meta l4proto 58 icmpv6 type nd-router-advert;ok
+icmpv6 type nd-router-advert;fail
diff --git a/tests/py/ip/meta.t.payload b/tests/py/ip/meta.t.payload
new file mode 100644 (file)
index 0000000..b186b4b
--- /dev/null
@@ -0,0 +1,28 @@
+# icmp type echo-request
+ip test-ip4 input
+  [ meta load l4proto => reg 1 ]
+  [ cmp eq reg 1 0x00000001 ]
+  [ payload load 1b @ transport header + 0 => reg 1 ]
+  [ cmp eq reg 1 0x00000008 ]
+
+# meta l4proto icmp icmp type echo-request
+ip test-ip4 input
+  [ meta load l4proto => reg 1 ]
+  [ cmp eq reg 1 0x00000001 ]
+  [ payload load 1b @ transport header + 0 => reg 1 ]
+  [ cmp eq reg 1 0x00000008 ]
+
+# meta l4proto ipv6-icmp icmpv6 type nd-router-advert
+ip test-ip4 input
+  [ meta load l4proto => reg 1 ]
+  [ cmp eq reg 1 0x0000003a ]
+  [ payload load 1b @ transport header + 0 => reg 1 ]
+  [ cmp eq reg 1 0x00000086 ]
+
+# meta l4proto 58 icmpv6 type nd-router-advert
+ip test-ip4 input
+  [ meta load l4proto => reg 1 ]
+  [ cmp eq reg 1 0x0000003a ]
+  [ payload load 1b @ transport header + 0 => reg 1 ]
+  [ cmp eq reg 1 0x00000086 ]
+
diff --git a/tests/py/ip6/meta.t b/tests/py/ip6/meta.t
new file mode 100644 (file)
index 0000000..68fa89f
--- /dev/null
@@ -0,0 +1,11 @@
+:input;type filter hook input priority 0
+
+*ip6;test-ip6;input
+
+icmpv6 type nd-router-advert;ok
+meta l4proto ipv6-icmp icmpv6 type nd-router-advert;ok;icmpv6 type nd-router-advert
+
+meta l4proto icmp icmp type echo-request;ok;meta l4proto 1 icmp type echo-request
+meta l4proto 1 icmp type echo-request;ok
+
+icmp type echo-request;fail