diff options
author | Florian Westphal <fw@strlen.de> | 2016-01-24 13:29:55 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2016-01-26 14:31:30 +0100 |
commit | 1441728b56f3ed8288b7b3bab0422adf1f90cecc (patch) | |
tree | a41361c8f95666afe846f15fe57beb4551a855c6 /tests/py/inet | |
parent | ef397928c17b7ea9cb86f03935577cebd56d0a3d (diff) |
tests: add two map test cases
One normal map lookup, one with an explicit binop.
The latter is supposed to also work with the followup patch applied.
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/py/inet')
-rw-r--r-- | tests/py/inet/map.t | 8 | ||||
-rw-r--r-- | tests/py/inet/map.t.payload.inet | 11 | ||||
-rw-r--r-- | tests/py/inet/map.t.payload.ip | 9 | ||||
-rw-r--r-- | tests/py/inet/map.t.payload.netdev | 11 |
4 files changed, 39 insertions, 0 deletions
diff --git a/tests/py/inet/map.t b/tests/py/inet/map.t new file mode 100644 index 00000000..f48afcd2 --- /dev/null +++ b/tests/py/inet/map.t @@ -0,0 +1,8 @@ +:input;type filter hook input priority 0 +:ingress;type filter hook ingress device lo priority 0 + +*ip;test-ip4;input +*inet;test-inet;input +*netdev;test-netdev;ingress + +mark set ip saddr map { 10.2.3.2 : 0x0000002a, 10.2.3.1 : 0x00000017};ok;mark set ip saddr map { 10.2.3.1 : 0x00000017, 10.2.3.2 : 0x0000002a} diff --git a/tests/py/inet/map.t.payload.inet b/tests/py/inet/map.t.payload.inet new file mode 100644 index 00000000..73e68b60 --- /dev/null +++ b/tests/py/inet/map.t.payload.inet @@ -0,0 +1,11 @@ +# mark set ip saddr map { 10.2.3.2 : 0x0000002a, 10.2.3.1 : 0x00000017} +map%d test-inet b +map%d test-inet 0 + element 0203020a : 0000002a 0 [end] element 0103020a : 00000017 0 [end] +inet test-inet input + [ meta load nfproto => reg 1 ] + [ cmp eq reg 1 0x00000002 ] + [ payload load 4b @ network header + 12 => reg 1 ] + [ lookup reg 1 set map%d dreg 1 ] + [ meta set mark with reg 1 ] + diff --git a/tests/py/inet/map.t.payload.ip b/tests/py/inet/map.t.payload.ip new file mode 100644 index 00000000..54b9583a --- /dev/null +++ b/tests/py/inet/map.t.payload.ip @@ -0,0 +1,9 @@ +# mark set ip saddr map { 10.2.3.2 : 0x0000002a, 10.2.3.1 : 0x00000017} +map%d test-ip b +map%d test-ip 0 + element 0103020a : 00000017 0 [end] element 0203020a : 0000002a 0 [end] +ip test-ip input + [ payload load 4b @ network header + 12 => reg 1 ] + [ lookup reg 1 set map%d dreg 1 ] + [ meta set mark with reg 1 ] + diff --git a/tests/py/inet/map.t.payload.netdev b/tests/py/inet/map.t.payload.netdev new file mode 100644 index 00000000..27a3ca8f --- /dev/null +++ b/tests/py/inet/map.t.payload.netdev @@ -0,0 +1,11 @@ +# mark set ip saddr map { 10.2.3.2 : 0x0000002a, 10.2.3.1 : 0x00000017} +map%d test-netdev b +map%d test-netdev 0 + element 0103020a : 00000017 0 [end] element 0203020a : 0000002a 0 [end] +netdev test-netdev ingress + [ meta load protocol => reg 1 ] + [ cmp eq reg 1 0x00000008 ] + [ payload load 4b @ network header + 12 => reg 1 ] + [ lookup reg 1 set map%d dreg 1 ] + [ meta set mark with reg 1 ] + |