summaryrefslogtreecommitdiffstats
path: root/tests/py/inet/udp.t.payload.ip
diff options
context:
space:
mode:
authorArturo Borrero <arturo.borrero.glez@gmail.com>2015-12-11 11:10:14 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2015-12-15 21:36:14 +0100
commit6b29a5bebb957387fe1aac8fcbfd431e6be237f0 (patch)
tree7e0be595ee6acfbdd2611045a7d227d5f329a16e /tests/py/inet/udp.t.payload.ip
parent564b0e7c13f98b9ad054058137b4c0bb61bd46b4 (diff)
tests/: rearrange tests directory
Rearrange the directory to obtain a better organization of files and tests-suites. We end with a tree like this: tests | .--- py .--- shell .--- files This was suggested by Pablo. Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/py/inet/udp.t.payload.ip')
-rw-r--r--tests/py/inet/udp.t.payload.ip222
1 files changed, 222 insertions, 0 deletions
diff --git a/tests/py/inet/udp.t.payload.ip b/tests/py/inet/udp.t.payload.ip
new file mode 100644
index 00000000..b3ec24b2
--- /dev/null
+++ b/tests/py/inet/udp.t.payload.ip
@@ -0,0 +1,222 @@
+# udp sport 80 accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 0 => reg 1 ]
+ [ cmp eq reg 1 0x00005000 ]
+ [ immediate reg 0 accept ]
+
+# udp sport != 60 accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 0 => reg 1 ]
+ [ cmp neq reg 1 0x00003c00 ]
+ [ immediate reg 0 accept ]
+
+# udp sport 50-70 accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 0 => reg 1 ]
+ [ cmp gte reg 1 0x00003200 ]
+ [ cmp lte reg 1 0x00004600 ]
+ [ immediate reg 0 accept ]
+
+# udp sport != 50-60 accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 0 => reg 1 ]
+ [ cmp lt reg 1 0x00003200 ]
+ [ cmp gt reg 1 0x00003c00 ]
+ [ immediate reg 0 accept ]
+
+# udp sport { 49, 50} drop
+set%d test-ip4 3
+set%d test-ip4 0
+ element 00003100 : 0 [end] element 00003200 : 0 [end]
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 0 => reg 1 ]
+ [ lookup reg 1 set set%d ]
+ [ immediate reg 0 drop ]
+
+# udp sport { 12-40}
+set%d test-ip4 7
+set%d test-ip4 0
+ element 00000000 : 1 [end] element 00000c00 : 0 [end] element 00002900 : 1 [end]
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 0 => reg 1 ]
+ [ lookup reg 1 set set%d ]
+
+# udp dport 80 accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 2 => reg 1 ]
+ [ cmp eq reg 1 0x00005000 ]
+ [ immediate reg 0 accept ]
+
+# udp dport != 60 accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 2 => reg 1 ]
+ [ cmp neq reg 1 0x00003c00 ]
+ [ immediate reg 0 accept ]
+
+# udp dport 70-75 accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 2 => reg 1 ]
+ [ cmp gte reg 1 0x00004600 ]
+ [ cmp lte reg 1 0x00004b00 ]
+ [ immediate reg 0 accept ]
+
+# udp dport != 50-60 accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 2 => reg 1 ]
+ [ cmp lt reg 1 0x00003200 ]
+ [ cmp gt reg 1 0x00003c00 ]
+ [ immediate reg 0 accept ]
+
+# udp dport { 49, 50} drop
+set%d test-ip4 3
+set%d test-ip4 0
+ element 00003100 : 0 [end] element 00003200 : 0 [end]
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 2 => reg 1 ]
+ [ lookup reg 1 set set%d ]
+ [ immediate reg 0 drop ]
+
+# udp dport { 70-75} accept
+set%d test-ip4 7
+set%d test-ip4 0
+ element 00000000 : 1 [end] element 00004600 : 0 [end] element 00004c00 : 1 [end]
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 2 => reg 1 ]
+ [ lookup reg 1 set set%d ]
+ [ immediate reg 0 accept ]
+
+# udp length 6666
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 4 => reg 1 ]
+ [ cmp eq reg 1 0x00000a1a ]
+
+# udp length != 6666
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 4 => reg 1 ]
+ [ cmp neq reg 1 0x00000a1a ]
+
+# udp length 50-65 accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 4 => reg 1 ]
+ [ cmp gte reg 1 0x00003200 ]
+ [ cmp lte reg 1 0x00004100 ]
+ [ immediate reg 0 accept ]
+
+# udp length != 50-65 accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 4 => reg 1 ]
+ [ cmp lt reg 1 0x00003200 ]
+ [ cmp gt reg 1 0x00004100 ]
+ [ immediate reg 0 accept ]
+
+# udp length { 50, 65} accept
+set%d test-ip4 3
+set%d test-ip4 0
+ element 00003200 : 0 [end] element 00004100 : 0 [end]
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 4 => reg 1 ]
+ [ lookup reg 1 set set%d ]
+ [ immediate reg 0 accept ]
+
+# udp length { 35-50}
+set%d test-ip4 7
+set%d test-ip4 0
+ element 00000000 : 1 [end] element 00002300 : 0 [end] element 00003300 : 1 [end]
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 4 => reg 1 ]
+ [ lookup reg 1 set set%d ]
+
+# udp checksum 6666 drop
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 6 => reg 1 ]
+ [ cmp eq reg 1 0x00000a1a ]
+ [ immediate reg 0 drop ]
+
+# udp checksum 22
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 6 => reg 1 ]
+ [ cmp eq reg 1 0x00001600 ]
+
+# udp checksum != 233
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 6 => reg 1 ]
+ [ cmp neq reg 1 0x0000e900 ]
+
+# udp checksum 33-45
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 6 => reg 1 ]
+ [ cmp gte reg 1 0x00002100 ]
+ [ cmp lte reg 1 0x00002d00 ]
+
+# udp checksum != 33-45
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 6 => reg 1 ]
+ [ cmp lt reg 1 0x00002100 ]
+ [ cmp gt reg 1 0x00002d00 ]
+
+# udp checksum { 33, 55, 67, 88}
+set%d test-ip4 3
+set%d test-ip4 0
+ element 00002100 : 0 [end] element 00003700 : 0 [end] element 00004300 : 0 [end] element 00005800 : 0 [end]
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 6 => reg 1 ]
+ [ lookup reg 1 set set%d ]
+
+# udp checksum { 33-55}
+set%d test-ip4 7
+set%d test-ip4 0
+ element 00000000 : 1 [end] element 00002100 : 0 [end] element 00003800 : 1 [end]
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000011 ]
+ [ payload load 2b @ transport header + 6 => reg 1 ]
+ [ lookup reg 1 set set%d ]
+