summaryrefslogtreecommitdiffstats
path: root/tests/py/ip/ct.t.payload
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2016-01-04 20:53:52 +0100
committerFlorian Westphal <fw@strlen.de>2016-01-04 20:54:13 +0100
commit399d11797bd2c2d5e8f793081cd81832fe872889 (patch)
treec82596fb1828f70f83da416f8eb7ceb72d1f0390 /tests/py/ip/ct.t.payload
parent2d81dd1fdf13571ee95d4c1c3cde03b5774a0084 (diff)
tests: add ct tests for ip family
Cannot check e.g. saddr for 192.168.0.1 for 'any' protocol, nft needs to expect arguments of a specific address type. So e.g. when using 'inet' we need to add a rule that makes the expected family explicit, e.g. 'meta nfproto ipv4'. Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/py/ip/ct.t.payload')
-rw-r--r--tests/py/ip/ct.t.payload62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/py/ip/ct.t.payload b/tests/py/ip/ct.t.payload
new file mode 100644
index 00000000..e06d988c
--- /dev/null
+++ b/tests/py/ip/ct.t.payload
@@ -0,0 +1,62 @@
+# ct saddr original 192.168.0.1
+ip test-ip4 output
+ [ ct load src => reg 1 , dir original ]
+ [ cmp eq reg 1 0x0100a8c0 ]
+
+# ct saddr reply 192.168.0.1
+ip test-ip4 output
+ [ ct load src => reg 1 , dir reply ]
+ [ cmp eq reg 1 0x0100a8c0 ]
+
+# ct daddr original 192.168.0.1
+ip test-ip4 output
+ [ ct load dst => reg 1 , dir original ]
+ [ cmp eq reg 1 0x0100a8c0 ]
+
+# ct daddr reply 192.168.0.1
+ip test-ip4 output
+ [ ct load dst => reg 1 , dir reply ]
+ [ cmp eq reg 1 0x0100a8c0 ]
+
+# ct saddr original 192.168.1.0/24
+ip test-ip4 output
+ [ ct load src => reg 1 , dir original ]
+ [ bitwise reg 1 = (reg=1 & 0x00ffffff ) ^ 0x00000000 ]
+ [ cmp eq reg 1 0x0001a8c0 ]
+
+# ct saddr reply 192.168.1.0/24
+ip test-ip4 output
+ [ ct load src => reg 1 , dir reply ]
+ [ bitwise reg 1 = (reg=1 & 0x00ffffff ) ^ 0x00000000 ]
+ [ cmp eq reg 1 0x0001a8c0 ]
+
+# ct daddr original 192.168.1.0/24
+ip test-ip4 output
+ [ ct load dst => reg 1 , dir original ]
+ [ bitwise reg 1 = (reg=1 & 0x00ffffff ) ^ 0x00000000 ]
+ [ cmp eq reg 1 0x0001a8c0 ]
+
+# ct daddr reply 192.168.1.0/24
+ip test-ip4 output
+ [ ct load dst => reg 1 , dir reply ]
+ [ bitwise reg 1 = (reg=1 & 0x00ffffff ) ^ 0x00000000 ]
+ [ cmp eq reg 1 0x0001a8c0 ]
+
+# ct l3proto original ipv4
+ip test-ip4 output
+ [ ct load l3protocol => reg 1 , dir original ]
+ [ cmp eq reg 1 0x00000002 ]
+
+# ct protocol original 6 ct proto-dst original 22
+ip test-ip4 output
+ [ ct load protocol => reg 1 , dir original ]
+ [ cmp eq reg 1 0x00000006 ]
+ [ ct load proto_dst => reg 1 , dir original ]
+ [ cmp eq reg 1 0x00001600 ]
+
+# ct protocol original 17 ct proto-src reply 53
+ip test-ip4 output
+ [ ct load protocol => reg 1 , dir original ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ ct load proto_src => reg 1 , dir reply ]
+ [ cmp eq reg 1 0x00003500 ]