]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: avoid warning and add missing json test cases
authorFlorian Westphal <fw@strlen.de>
Tue, 3 Nov 2020 12:48:20 +0000 (13:48 +0100)
committerFlorian Westphal <fw@strlen.de>
Thu, 5 Nov 2020 08:40:50 +0000 (09:40 +0100)
make dnat.t pass in json mode.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/inet/dnat.t
tests/py/inet/dnat.t.json

index a266100890e3e1a3387e5b52ca1396b0ba671146..b460af392557031093193c0a36f30aec1cee2970 100644 (file)
@@ -15,7 +15,7 @@ dnat to 1.2.3.4;fail
 dnat ip6 to ct mark . ip daddr map { 0x00000014 . 1.1.1.1 : 1.2.3.4};fail
 ip6 daddr dead::beef dnat to 10.1.2.3;fail
 
-meta l4proto { tcp, udp } dnat ip to 1.1.1.1:80;ok
-ip protocol { tcp, udp } dnat ip to 1.1.1.1:80;ok
+meta l4proto { tcp, udp } dnat ip to 1.1.1.1:80;ok;meta l4proto { 6, 17} dnat ip to 1.1.1.1:80
+ip protocol { tcp, udp } dnat ip to 1.1.1.1:80;ok;ip protocol { 6, 17} dnat ip to 1.1.1.1:80
 meta l4proto { tcp, udp } tcp dport 20 dnat to 1.1.1.1:80;fail
 ip protocol { tcp, udp } tcp dport 20 dnat to 1.1.1.1:80;fail
index ac6dac620a85e85bd4ef91b98ceb25c2860c3ed0..1b8aba6297d36bed1df5c9178f446beeda2c66af 100644 (file)
     }
 ]
 
+# meta l4proto { tcp, udp } dnat ip to 1.1.1.1:80
+[
+    {
+        "match": {
+            "left": {
+                "meta": {
+                    "key": "l4proto"
+                }
+            },
+            "op": "==",
+            "right": {
+                "set": [
+                    6,
+                    17
+                ]
+            }
+        }
+    },
+    {
+        "dnat": {
+            "addr": "1.1.1.1",
+            "family": "ip",
+            "port": 80
+        }
+    }
+]
+
+# ip protocol { tcp, udp } dnat ip to 1.1.1.1:80
+[
+    {
+        "match": {
+            "left": {
+                "payload": {
+                    "field": "protocol",
+                    "protocol": "ip"
+                }
+            },
+            "op": "==",
+            "right": {
+                "set": [
+                    6,
+                    17
+                ]
+            }
+        }
+    },
+    {
+        "dnat": {
+            "addr": "1.1.1.1",
+            "family": "ip",
+            "port": 80
+        }
+    }
+]
+