]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: add ip reject with tcp and check for mark too
authorFlorian Westphal <fw@strlen.de>
Sat, 6 May 2017 23:47:48 +0000 (01:47 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 18 May 2017 16:15:12 +0000 (18:15 +0200)
... to avoid resetting e.g. the ssh session to the vm that runs
nft-test.py.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/bridge/reject.t
tests/py/bridge/reject.t.payload
tests/py/inet/reject.t
tests/py/inet/reject.t.payload.inet
tests/py/ip/reject.t
tests/py/ip/reject.t.payload
tests/py/ip6/reject.t
tests/py/ip6/reject.t.payload.ip6

index 4fa6ac0b3278471a160e1485998d7cf90a250e7f..67deac8d3b5e47dd38abe3da2a6bdf2eba489dc8 100644 (file)
@@ -16,7 +16,7 @@ reject with icmpv6 type admin-prohibited;ok;ether type ip6 reject with icmpv6 ty
 reject with icmpv6 type addr-unreachable;ok;ether type ip6 reject with icmpv6 type addr-unreachable
 reject with icmpv6 type port-unreachable;ok;ether type ip6 reject
 
-ip protocol tcp reject with tcp reset;ok;ip protocol 6 reject with tcp reset
+mark 12345 ip protocol tcp reject with tcp reset;ok;mark 0x00003039 ip protocol 6 reject with tcp reset
 
 reject;ok
 ether type ip reject;ok
index f5a0e6a82963e1899c9da70766b51567f0c49946..b984f6f8de4d6ce227462cc2e460758a8259d46f 100644 (file)
@@ -64,8 +64,10 @@ bridge test-bridge input
   [ cmp eq reg 1 0x0000dd86 ]
   [ reject type 0 code 4 ]
 
-# ip protocol tcp reject with tcp reset
+# mark 12345 ip protocol tcp reject with tcp reset
 bridge test-bridge input
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x00003039 ]
   [ payload load 2b @ link header + 12 => reg 1 ]
   [ cmp eq reg 1 0x00000008 ]
   [ payload load 1b @ network header + 9 => reg 1 ]
index 638f329cf4d5aefd86d587715e35f0c15a2bec0f..7679407e6f8d44cffe355b45811acab2fb08e62a 100644 (file)
@@ -16,7 +16,7 @@ reject with icmpv6 type admin-prohibited;ok;meta nfproto ipv6 reject with icmpv6
 reject with icmpv6 type addr-unreachable;ok;meta nfproto ipv6 reject with icmpv6 type addr-unreachable
 reject with icmpv6 type port-unreachable;ok;meta nfproto ipv6 reject
 
-reject with tcp reset;ok;meta l4proto 6 reject with tcp reset
+mark 12345 reject with tcp reset;ok;meta l4proto 6 mark 0x00003039 reject with tcp reset
 
 reject;ok
 meta nfproto ipv4 reject;ok
index 5770330d9072dbad42741195e081c58feca95161..7a6468e81f9e71a2617db5114fc4524ab4d43f05 100644 (file)
@@ -64,10 +64,12 @@ inet test-inet input
   [ cmp eq reg 1 0x0000000a ]
   [ reject type 0 code 4 ]
 
-# reject with tcp reset
+# mark 12345 reject with tcp reset
 inet test-inet input
   [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x00003039 ]
   [ reject type 1 code 0 ]
 
 # reject
index 6006f0541cb87483354163cc1bfb24bcaadf0340..7befe697fa2396425532bdc33d3accf112dd8e08 100644 (file)
@@ -10,6 +10,7 @@ reject with icmp type port-unreachable;ok;reject
 reject with icmp type net-prohibited;ok
 reject with icmp type host-prohibited;ok
 reject with icmp type admin-prohibited;ok
+mark 0x80000000 reject with tcp reset;ok
 
 reject with icmp type no-route;fail
 reject with icmpv6 type no-route;fail
index d5e87665ebc5590dd8e6c59da5e0d3f5385f3389..ec94b4c1a1c58c8ffd2dbce07befb3ca4594b565 100644 (file)
@@ -30,3 +30,11 @@ ip test-ip4 output
 ip test-ip4 output
   [ reject type 0 code 13 ]
 
+# mark 0x80000000 reject with tcp reset
+ip test-ip4 output
+  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x80000000 ]
+  [ reject type 1 code 0 ]
+
index de09fd978418887223a6bf1fa2163193d44dc55b..a95f2e3fe14a2c489b6a810e27e7bfa60cff0c1e 100644 (file)
@@ -9,7 +9,7 @@ reject with icmpv6 type addr-unreachable;ok
 reject with icmpv6 type port-unreachable;ok;reject
 reject with icmpv6 type policy-fail;ok
 reject with icmpv6 type reject-route;ok
-reject with tcp reset;ok
+mark 0x80000000 reject with tcp reset;ok
 
 reject with icmpv6 type host-unreachable;fail
 reject with icmp type host-unreachable;fail
index fcae382b89c665fbe986cbd16f6572a999d7d44d..7426310154f07488b866c702bc842b05fab8c40c 100644 (file)
@@ -26,9 +26,11 @@ ip6 test-ip6 output
 ip6 test-ip6 output
   [ reject type 0 code 6 ]
 
-# reject with tcp reset
+# mark 0x80000000 reject with tcp reset
 ip6 test-ip6 output
   [ payload load 1b @ network header + 6 => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x80000000 ]
   [ reject type 1 code 0 ]