]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: add icmp/6 test where dependency should be left alone
authorFlorian Westphal <fw@strlen.de>
Mon, 1 Feb 2021 21:44:25 +0000 (22:44 +0100)
committerFlorian Westphal <fw@strlen.de>
Mon, 1 Feb 2021 21:47:04 +0000 (22:47 +0100)
These tests fail: nft should leave the type as-is.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/ip/icmp.t
tests/py/ip/icmp.t.json
tests/py/ip/icmp.t.payload.ip
tests/py/ip6/icmpv6.t
tests/py/ip6/icmpv6.t.json
tests/py/ip6/icmpv6.t.payload.ip6

index c22b55eb1e3f479d06bbc7f13e61c4210692e15a..11f3662e2b027b7b5aa92e7379ea155b003bc0a3 100644 (file)
@@ -86,3 +86,5 @@ icmp gateway != { 33-55};ok
 icmp gateway != 34;ok
 icmp gateway != { 333, 334};ok
 
+icmp code 1 icmp type 2;ok;icmp type 2 icmp code host-unreachable
+icmp code != 1 icmp type 2 icmp mtu 5;fail
index 9691f0727f5eb0ea54ab6f9ea199e6c450991902..12b53b0fe2cc6b54d79b1c722cf7501a329b09ba 100644 (file)
         }
     }
 ]
+
+# icmp code 1 icmp type 2
+[
+    {
+        "match": {
+            "left": {
+                "payload": {
+                    "field": "type",
+                    "protocol": "icmp"
+                }
+            },
+            "op": "==",
+            "right": 2
+        }
+    },
+    {
+        "match": {
+            "left": {
+                "payload": {
+                    "field": "code",
+                    "protocol": "icmp"
+                }
+            },
+            "op": "==",
+            "right": "host-unreachable"
+        }
+    }
+]
index d75d12a0612528fb76d19950a63efbecac73291b..97464a08379e3f5e27c57cef9884cd8903529f5f 100644 (file)
@@ -787,3 +787,9 @@ ip test-ip4 input
   [ lookup reg 1 set __set%d ]
   [ immediate reg 0 accept ]
 
+# icmp code 1 icmp type 2
+ip 
+  [ meta load l4proto => reg 1 ]
+  [ cmp eq reg 1 0x00000001 ]
+  [ payload load 2b @ transport header + 0 => reg 1 ]
+  [ cmp eq reg 1 0x00000102 ]
index 8b411a8bf4392c4c77a79499f46bf32f956c36ef..d07c34bd939dc06a6d6503c46f127e946a9c7ef1 100644 (file)
@@ -92,3 +92,5 @@ icmpv6 max-delay {33, 55, 67, 88};ok
 icmpv6 max-delay != {33, 55, 67, 88};ok
 icmpv6 max-delay {33-55};ok
 icmpv6 max-delay != {33-55};ok
+
+icmpv6 type parameter-problem icmpv6 code no-route;ok
index ffc4931c4e0c4510aa991b2c5265529a1d1c8cf2..e2b25a65444fd5813813e23c61981b45f09ed5a4 100644 (file)
         }
     }
 ]
+
+# icmpv6 type parameter-problem icmpv6 code no-route
+[
+    {
+        "match": {
+            "left": {
+                "payload": {
+                    "field": "type",
+                    "protocol": "icmpv6"
+                }
+            },
+            "op": "==",
+            "right": "parameter-problem"
+        }
+    },
+    {
+        "match": {
+            "left": {
+                "payload": {
+                    "field": "code",
+                    "protocol": "icmpv6"
+                }
+            },
+            "op": "==",
+            "right": "no-route"
+        }
+    }
+]
index 171b7eade6d3ec6911392ccef05f470b4bb30696..448779d16922cd312b62fd0b7ccbb343a544d250 100644 (file)
@@ -682,3 +682,10 @@ ip6 test-ip6 input
   [ payload load 2b @ transport header + 4 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
 
+# icmpv6 type parameter-problem icmpv6 code no-route
+ip6 
+  [ meta load l4proto => reg 1 ]
+  [ cmp eq reg 1 0x0000003a ]
+  [ payload load 2b @ transport header + 0 => reg 1 ]
+  [ cmp eq reg 1 0x00000004 ]
+