]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: py: Properly fix JSON equivalents for netdev/reject.t
authorPhil Sutter <phil@nwl.cc>
Thu, 12 Jun 2025 10:59:29 +0000 (12:59 +0200)
committerPhil Sutter <phil@nwl.cc>
Thu, 12 Jun 2025 20:55:58 +0000 (22:55 +0200)
Revert commit d1a7b9e19fe65 ("tests: py: update netdev reject test
file"), the stored JSON equivalents were correct in that they matched
the standard syntax input.

In fact, we missed a .json.output file recording the expected deviation
in JSON output.

Fixes: d1a7b9e19fe65 ("tests: py: update netdev reject test file")
Fixes: 7ca3368cd7575 ("reject: Unify inet, netdev and bridge delinearization")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/py/netdev/reject.t.json
tests/py/netdev/reject.t.json.output [new file with mode: 0644]

index 9968aaf834ec2c51a1119865eecfb1ab461f8547..b80db03b9d3aff9d72fbaf22b16f10d8b6e693ff 100644 (file)
 
 # mark 12345 reject with tcp reset
 [
-    {
-        "match": {
-            "left": {
-                "meta": {
-                    "key": "l4proto"
-                }
-            },
-            "op": "==",
-            "right": 6
-        }
-    },
     {
         "match": {
             "left": {
 # reject
 [
     {
-        "reject": {
-            "expr": "port-unreachable",
-            "type": "icmpx"
-        }
+        "reject": null
     }
 ]
 
 # meta protocol ip reject
 [
     {
-        "reject": {
-            "expr": "port-unreachable",
-            "type": "icmp"
+        "match": {
+            "left": {
+                "meta": {
+                    "key": "protocol"
+                }
+            },
+            "op": "==",
+            "right": "ip"
         }
+    },
+    {
+        "reject": null
     }
 ]
 
 # meta protocol ip6 reject
 [
     {
-        "reject": {
-            "expr": "port-unreachable",
-            "type": "icmpv6"
+        "match": {
+            "left": {
+                "meta": {
+                    "key": "protocol"
+                }
+            },
+            "op": "==",
+            "right": "ip6"
         }
+    },
+    {
+        "reject": null
     }
 ]
 
 
 # meta protocol ip reject with icmp host-unreachable
 [
+    {
+        "match": {
+            "left": {
+                "meta": {
+                    "key": "protocol"
+                }
+            },
+            "op": "==",
+            "right": "ip"
+        }
+    },
     {
         "reject": {
             "expr": "host-unreachable",
 
 # meta protocol ip6 reject with icmpv6 no-route
 [
+    {
+        "match": {
+            "left": {
+                "meta": {
+                    "key": "protocol"
+                }
+            },
+            "op": "==",
+            "right": "ip6"
+        }
+    },
     {
         "reject": {
             "expr": "no-route",
diff --git a/tests/py/netdev/reject.t.json.output b/tests/py/netdev/reject.t.json.output
new file mode 100644 (file)
index 0000000..cbd7310
--- /dev/null
@@ -0,0 +1,81 @@
+# mark 12345 reject with tcp reset
+[
+    {
+        "match": {
+            "left": {
+                "meta": {
+                    "key": "l4proto"
+                }
+            },
+            "op": "==",
+            "right": 6
+        }
+    },
+    {
+        "match": {
+            "left": {
+                "meta": {
+                    "key": "mark"
+                }
+            },
+            "op": "==",
+            "right": 12345
+        }
+    },
+    {
+        "reject": {
+            "type": "tcp reset"
+        }
+    }
+]
+
+# reject
+[
+    {
+        "reject": {
+            "expr": "port-unreachable",
+            "type": "icmpx"
+        }
+    }
+]
+
+# meta protocol ip reject
+[
+    {
+        "reject": {
+            "expr": "port-unreachable",
+            "type": "icmp"
+        }
+    }
+]
+
+# meta protocol ip6 reject
+[
+    {
+        "reject": {
+            "expr": "port-unreachable",
+            "type": "icmpv6"
+        }
+    }
+]
+
+# meta protocol ip reject with icmp host-unreachable
+[
+    {
+        "reject": {
+            "expr": "host-unreachable",
+            "type": "icmp"
+        }
+    }
+]
+
+# meta protocol ip6 reject with icmpv6 no-route
+[
+    {
+        "reject": {
+            "expr": "no-route",
+            "type": "icmpv6"
+        }
+    }
+]
+