summaryrefslogtreecommitdiffstats
path: root/tests/py
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2018-03-16 20:15:50 +0100
committerFlorian Westphal <fw@strlen.de>2018-03-17 00:07:04 +0100
commitc2b389b48b08d0b013ca0c588d895178f3c3b02b (patch)
tree15bb4fdba6344458099e18b3a95023dd905b29d8 /tests/py
parent9642a79381793daedc1d58b3ac4c3c61a2ec38f1 (diff)
tests: add srh test cases
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/py')
-rw-r--r--tests/py/ip6/srh.t22
-rw-r--r--tests/py/ip6/srh.t.payload64
2 files changed, 86 insertions, 0 deletions
diff --git a/tests/py/ip6/srh.t b/tests/py/ip6/srh.t
new file mode 100644
index 00000000..442c78f0
--- /dev/null
+++ b/tests/py/ip6/srh.t
@@ -0,0 +1,22 @@
+:input;type filter hook input priority 0
+
+*ip6;test-ip6;input
+
+srh last-entry 0;ok
+srh last-entry 127;ok
+srh last-entry { 0, 4-127, 255 };ok;srh last-entry { 0, 4-127, 255-255}
+
+srh flags 0;ok
+srh flags 127;ok
+srh flags { 0, 4-127, 255 };ok;srh flags { 0, 4-127, 255-255}
+
+srh tag 0;ok
+srh tag 127;ok
+srh tag { 0, 4-127, 0xffff };ok;srh tag { 0, 4-127, 65535-65535}
+
+srh sid[1] dead::beef;ok
+srh sid[2] dead::beef;ok
+
+srh last-entry { 0, 4-127, 256 };fail
+srh flags { 0, 4-127, 256 };fail
+srh tag { 0, 4-127, 0x10000 };fail
diff --git a/tests/py/ip6/srh.t.payload b/tests/py/ip6/srh.t.payload
new file mode 100644
index 00000000..a2a46f13
--- /dev/null
+++ b/tests/py/ip6/srh.t.payload
@@ -0,0 +1,64 @@
+# srh last-entry 0
+ip6 test-ip6 input
+ [ exthdr load 1b @ 43 + 4 => reg 1 ]
+ [ cmp eq reg 1 0x00000000 ]
+
+# srh last-entry 127
+ip6 test-ip6 input
+ [ exthdr load 1b @ 43 + 4 => reg 1 ]
+ [ cmp eq reg 1 0x0000007f ]
+
+# srh last-entry { 0, 4-127, 255 }
+__set%d test-ip6 7 size 5
+__set%d test-ip6 0
+ element 00000000 : 0 [end] element 00000001 : 1 [end] element 00000004 : 0 [end] element 00000080 : 1 [end] element 000000ff : 0 [end] userdata = {
+ip6 test-ip6 input
+ [ exthdr load 1b @ 43 + 4 => reg 1 ]
+ [ lookup reg 1 set __set%d ]
+
+# srh flags 0
+ip6 test-ip6 input
+ [ exthdr load 1b @ 43 + 5 => reg 1 ]
+ [ cmp eq reg 1 0x00000000 ]
+
+# srh flags 127
+ip6 test-ip6 input
+ [ exthdr load 1b @ 43 + 5 => reg 1 ]
+ [ cmp eq reg 1 0x0000007f ]
+
+# srh flags { 0, 4-127, 255 }
+__set%d test-ip6 7 size 5
+__set%d test-ip6 0
+ element 00000000 : 0 [end] element 00000001 : 1 [end] element 00000004 : 0 [end] element 00000080 : 1 [end] element 000000ff : 0 [end] userdata = {
+ip6 test-ip6 input
+ [ exthdr load 1b @ 43 + 5 => reg 1 ]
+ [ lookup reg 1 set __set%d ]
+
+# srh tag 0
+ip6 test-ip6 input
+ [ exthdr load 2b @ 43 + 6 => reg 1 ]
+ [ cmp eq reg 1 0x00000000 ]
+
+# srh tag 127
+ip6 test-ip6 input
+ [ exthdr load 2b @ 43 + 6 => reg 1 ]
+ [ cmp eq reg 1 0x00007f00 ]
+
+# srh tag { 0, 4-127, 0xffff }
+__set%d test-ip6 7 size 5
+__set%d test-ip6 0
+ element 00000000 : 0 [end] element 00000100 : 1 [end] element 00000400 : 0 [end] element 00008000 : 1 [end] element 0000ffff : 0 [end] userdata = {
+ip6 test-ip6 input
+ [ exthdr load 2b @ 43 + 6 => reg 1 ]
+ [ lookup reg 1 set __set%d ]
+
+# srh sid[1] dead::beef
+ip6 test-ip6 input
+ [ exthdr load 16b @ 43 + 8 => reg 1 ]
+ [ cmp eq reg 1 0x0000adde 0x00000000 0x00000000 0xefbe0000 ]
+
+# srh sid[2] dead::beef
+ip6 test-ip6 input
+ [ exthdr load 16b @ 43 + 24 => reg 1 ]
+ [ cmp eq reg 1 0x0000adde 0x00000000 0x00000000 0xefbe0000 ]
+