summaryrefslogtreecommitdiffstats
path: root/tests/regression
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2015-09-29 20:27:48 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2015-09-30 17:32:10 +0200
commitbbcd43ec4517b554c1b93445c84831f23e96ecdd (patch)
treed481e60e5efa4cece289a73022c830fd594731c1 /tests/regression
parentb870b949470af0b1b578590b38efdd80048b539e (diff)
tests: add tests for dup
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/regression')
-rw-r--r--tests/regression/ip/dup.t6
-rw-r--r--tests/regression/ip/dup.t.payload21
-rw-r--r--tests/regression/ip/dup.t.payload.got26
-rw-r--r--tests/regression/ip6/dup.t6
-rw-r--r--tests/regression/ip6/dup.t.payload21
5 files changed, 80 insertions, 0 deletions
diff --git a/tests/regression/ip/dup.t b/tests/regression/ip/dup.t
new file mode 100644
index 00000000..9320d546
--- /dev/null
+++ b/tests/regression/ip/dup.t
@@ -0,0 +1,6 @@
+*ip;test-ip4
+:input;type filter hook input priority 0
+
+dup to 192.168.2.1;ok
+dup to 192.168.2.1 device eth0;ok
+dup to ip saddr map { 192.168.2.120 : 192.168.2.1 } device eth0;ok
diff --git a/tests/regression/ip/dup.t.payload b/tests/regression/ip/dup.t.payload
new file mode 100644
index 00000000..7928d5d5
--- /dev/null
+++ b/tests/regression/ip/dup.t.payload
@@ -0,0 +1,21 @@
+# dup to 192.168.2.1
+ip test-ip4 test
+ [ immediate reg 1 0x0102a8c0 ]
+ [ dup sreg_addr 1 ]
+
+# dup to 192.168.2.1 device eth0
+ip test-ip4 test
+ [ immediate reg 1 0x0102a8c0 ]
+ [ immediate reg 2 0x00000002 ]
+ [ dup sreg_addr 1 sreg_dev 2 ]
+
+# dup to ip saddr map { 192.168.2.120 : 192.168.2.1 } device eth0
+map%d test-ip4 b
+map%d test-ip4 0
+ element 7802a8c0 : 0102a8c0 0 [end]
+ip test-ip4 test
+ [ payload load 4b @ network header + 12 => reg 1 ]
+ [ lookup reg 1 set map%d dreg 1 ]
+ [ immediate reg 2 0x00000002 ]
+ [ dup sreg_addr 1 sreg_dev 2 ]
+
diff --git a/tests/regression/ip/dup.t.payload.got b/tests/regression/ip/dup.t.payload.got
new file mode 100644
index 00000000..23e0a7e7
--- /dev/null
+++ b/tests/regression/ip/dup.t.payload.got
@@ -0,0 +1,26 @@
+# dup to 192.168.2.1 device eth0
+ip test-ip4 input
+ [ immediate reg 1 0x0102a8c0 ]
+ [ immediate reg 2 0x00000002 0x00000000 0x00000000 0x00000000 ]
+ [ dup sreg_addr 1 sreg_dev 2 ]
+
+# dup to ip saddr map { 192.168.2.120 : 192.168.2.1 } device eth0
+map%d test-ip4 b
+map%d test-ip4 0
+ element 7802a8c0 : 0102a8c0 0 [end]
+ip test-ip4 input
+ [ payload load 4b @ network header + 12 => reg 1 ]
+ [ lookup reg 1 set map%d dreg 1 ]
+ [ immediate reg 2 0x00000002 0x00000000 0x00000000 0x00000000 ]
+ [ dup sreg_addr 1 sreg_dev 2 ]
+
+# dup to ip saddr map { 192.168.2.120 : 192.168.2.1 } device eth0
+map%d test-ip4 b
+map%d test-ip4 0
+ element 7802a8c0 : 0102a8c0 0 [end]
+ip test-ip4 input
+ [ payload load 4b @ network header + 12 => reg 1 ]
+ [ lookup reg 1 set map%d dreg 1 ]
+ [ immediate reg 2 0x00000002 0x00000000 0x00000000 0x00000000 ]
+ [ dup sreg_addr 1 sreg_dev 2 ]
+
diff --git a/tests/regression/ip6/dup.t b/tests/regression/ip6/dup.t
new file mode 100644
index 00000000..34f302f2
--- /dev/null
+++ b/tests/regression/ip6/dup.t
@@ -0,0 +1,6 @@
+*ip6;test-ip6
+:input;type filter hook input priority 0
+
+dup to abcd::1;ok
+dup to abcd::1 device eth0;ok
+dup to ip6 saddr map { abcd::1 : cafe::cafe } device eth0;ok
diff --git a/tests/regression/ip6/dup.t.payload b/tests/regression/ip6/dup.t.payload
new file mode 100644
index 00000000..1df414cd
--- /dev/null
+++ b/tests/regression/ip6/dup.t.payload
@@ -0,0 +1,21 @@
+# dup to abcd::1
+ip6 test test
+ [ immediate reg 1 0x0000cdab 0x00000000 0x00000000 0x01000000 ]
+ [ dup sreg_addr 1 ]
+
+# dup to abcd::1 device eth0
+ip6 test test
+ [ immediate reg 1 0x0000cdab 0x00000000 0x00000000 0x01000000 ]
+ [ immediate reg 2 0x00000002 ]
+ [ dup sreg_addr 1 sreg_dev 2 ]
+
+# dup to ip6 saddr map { abcd::1 : cafe::cafe } device eth0
+map%d test-ip6 b
+map%d test-ip6 0
+ element 0000cdab 00000000 00000000 01000000 : 0000feca 00000000 00000000 feca0000 0 [end]
+ip6 test-ip6 input
+ [ payload load 16b @ network header + 8 => reg 1 ]
+ [ lookup reg 1 set map%d dreg 1 ]
+ [ immediate reg 2 0x00000002 ]
+ [ dup sreg_addr 1 sreg_dev 2 ]
+