]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: json: add missing test case output
authorFlorian Westphal <fw@strlen.de>
Tue, 3 Nov 2020 10:12:50 +0000 (11:12 +0100)
committerFlorian Westphal <fw@strlen.de>
Thu, 5 Nov 2020 08:40:50 +0000 (09:40 +0100)
Fix warnings and errors when running nf-test.py -j due to missing json test case updates.
This also makes bridge/reject.t pass in json mode.

No code changes.

Fixes: 8615ed93f6e4c4 ("evaluate: enable reject with 802.1q")
Fixes: fae0a0972d7a71 ("tests: py: Enable anonymous set rule with concatenated ranges in inet/sets.t")
Fixes: 2a20b5bdbde8a1 ("datatype: add frag-needed (ipv4) to reject options")
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/bridge/reject.t
tests/py/bridge/reject.t.json
tests/py/inet/sets.t.json
tests/py/ip/icmp.t.json
tests/py/ip/icmp.t.json.output

index f5ed203815e5edaa7fc621a75fc939a2ad621ac4..ee33af77eab6bf58b19aa5560e031c4c8353abbb 100644 (file)
@@ -32,7 +32,7 @@ ether type ip6 reject with icmp type host-unreachable;fail
 ether type ip reject with icmpv6 type no-route;fail
 ether type vlan reject;ok
 ether type arp reject;fail
-ether type vlan reject with tcp reset;ok
+ether type vlan reject with tcp reset;ok;meta l4proto 6 ether type vlan reject with tcp reset
 ether type arp reject with tcp reset;fail
 ip protocol udp reject with tcp reset;fail
 
index d20a1d8b5f9eb484154aef65408be572566daa92..aea871f70907e230f8d80e730a17cc8a0b38bbe7 100644 (file)
     }
 ]
 
+# ether type vlan reject with tcp reset
+[
+    {
+        "match": {
+            "left": {
+                "meta": {
+                    "key": "l4proto"
+                }
+            },
+            "op": "==",
+            "right": 6
+        }
+    },
+    {
+        "match": {
+            "left": {
+                "payload": {
+                    "field": "type",
+                    "protocol": "ether"
+                }
+            },
+            "op": "==",
+            "right": "vlan"
+        }
+    },
+    {
+        "reject": {
+            "type": "tcp reset"
+        }
+    }
+]
+
+# ether type vlan reject
+[
+    {
+        "match": {
+            "left": {
+                "payload": {
+                    "field": "type",
+                    "protocol": "ether"
+                }
+            },
+            "op": "==",
+            "right": "vlan"
+        }
+    },
+    {
+        "reject": null
+    }
+]
+
+# ether type vlan reject with icmpx type admin-prohibited
+[
+    {
+        "match": {
+            "left": {
+                "payload": {
+                    "field": "type",
+                    "protocol": "ether"
+                }
+            },
+            "op": "==",
+            "right": "vlan"
+        }
+    },
+    {
+        "reject": {
+            "expr": "admin-prohibited",
+            "type": "icmpx"
+        }
+    }
+]
index 58e19ef647058d8e51dd80dc2b1361bfd8f1bc86..ef0cedca81595e0aa0ac063ba2d88af25cb85dce 100644 (file)
     }
 ]
 
+# ip daddr . tcp dport { 10.0.0.0/8 . 10-23, 192.168.1.1-192.168.3.8 . 80-443 } accept
+[
+    {
+        "match": {
+            "left": {
+                "meta": {
+                    "key": "nfproto"
+                }
+            },
+            "op": "==",
+            "right": "ipv4"
+        }
+    },
+    {
+        "match": {
+            "left": {
+                "concat": [
+                    {
+                        "payload": {
+                            "field": "daddr",
+                            "protocol": "ip"
+                        }
+                    },
+                    {
+                        "payload": {
+                            "field": "dport",
+                            "protocol": "tcp"
+                        }
+                    }
+                ]
+            },
+            "op": "==",
+            "right": {
+                "set": [
+                    {
+                        "concat": [
+                            {
+                                "prefix": {
+                                    "addr": "10.0.0.0",
+                                    "len": 8
+                                }
+                            },
+                            {
+                                "range": [
+                                    10,
+                                    23
+                                ]
+                            }
+                        ]
+                    },
+                    {
+                        "concat": [
+                            {
+                                "range": [
+                                    "192.168.1.1",
+                                    "192.168.3.8"
+                                ]
+                            },
+                            {
+                                "range": [
+                                    80,
+                                    443
+                                ]
+                            }
+                        ]
+                    }
+                ]
+            }
+        }
+    },
+    {
+        "accept": null
+    }
+]
index 4e17274587791e2f881130fdc2aaed8c12d4aa3f..965eb10be9edf2bb2381efdaf9d5464bb3069457 100644 (file)
     }
 ]
 
-# icmp code != { prot-unreachable, 4, 33, 54, 56}
+# icmp code != { prot-unreachable, frag-needed, 33, 54, 56}
 [
     {
         "match": {
             "right": {
                 "set": [
                     "prot-unreachable",
-                    4,
+                    "frag-needed",
                     33,
                     54,
                     56
index e8045bb8182e0177b882c38d762ffe203eb593ac..2391983ab82603faa0841531df59fb0de974981b 100644 (file)
@@ -49,7 +49,7 @@
             "right": {
                 "set": [
                     "prot-unreachable",
-                    4,
+                    "frag-needed",
                     33,
                     54,
                     56