From 6bc84e04c40a2497c4c416556df09e2782059e1c Mon Sep 17 00:00:00 2001 From: "Anders K. Pedersen" Date: Sat, 29 Oct 2016 03:12:41 +0200 Subject: Replace tests/files/expr-rt with Python based tests, and replace ether type with meta nfproto, which generates a bit fewer instructions. Signed-off-by: Anders K. Pedersen Signed-off-by: Florian Westphal --- tests/files/expr-rt | 21 --------------------- tests/py/any/rt.t | 7 +++++++ tests/py/any/rt.t.payload | 5 +++++ tests/py/inet/rt.t | 8 ++++++++ tests/py/inet/rt.t.payload | 14 ++++++++++++++ tests/py/ip/rt.t | 6 ++++++ tests/py/ip/rt.t.payload | 5 +++++ tests/py/ip6/rt0.t | 6 ++++++ tests/py/ip6/rt0.t.payload | 5 +++++ 9 files changed, 56 insertions(+), 21 deletions(-) delete mode 100644 tests/files/expr-rt create mode 100644 tests/py/any/rt.t create mode 100644 tests/py/any/rt.t.payload create mode 100644 tests/py/inet/rt.t create mode 100644 tests/py/inet/rt.t.payload create mode 100644 tests/py/ip/rt.t create mode 100644 tests/py/ip/rt.t.payload create mode 100644 tests/py/ip6/rt0.t create mode 100644 tests/py/ip6/rt0.t.payload (limited to 'tests') diff --git a/tests/files/expr-rt b/tests/files/expr-rt deleted file mode 100644 index 4c154091..00000000 --- a/tests/files/expr-rt +++ /dev/null @@ -1,21 +0,0 @@ -#! nft -f - -add table ip filter -add chain ip filter output { type filter hook output priority 0 ; } - -add table ip6 filter -add chain ip6 filter output { type filter hook output priority 0 ; } - -add table inet filter -add chain inet filter output { type filter hook output priority 0 ; } - -# rt: classid (see /etc/iproute2/rt_realms) -add rule ip filter output rt classid cosmos counter -add rule ip6 filter output rt classid cosmos counter -add rule inet filter output rt classid cosmos counter - -# rt: nexthop -add rule ip filter output rt nexthop 192.168.0.1 counter -add rule ip6 filter output rt nexthop fd00::1 counter -add rule inet filter output ether type ip rt nexthop 192.168.0.1 counter -add rule inet filter output ether type ip6 rt nexthop fd00::1 counter diff --git a/tests/py/any/rt.t b/tests/py/any/rt.t new file mode 100644 index 00000000..4f65eaad --- /dev/null +++ b/tests/py/any/rt.t @@ -0,0 +1,7 @@ +:output;type filter hook input priority 0 + +*ip;test-ip4;output +*ip6;test-ip6;output +*inet;test-inet;output + +rt classid "cosmos";ok diff --git a/tests/py/any/rt.t.payload b/tests/py/any/rt.t.payload new file mode 100644 index 00000000..0e354fa0 --- /dev/null +++ b/tests/py/any/rt.t.payload @@ -0,0 +1,5 @@ +# rt classid "cosmos" +ip test-ip4 input + [ rt load classid => reg 1 ] + [ cmp eq reg 1 0x00000000 ] + diff --git a/tests/py/inet/rt.t b/tests/py/inet/rt.t new file mode 100644 index 00000000..f2dcbdc4 --- /dev/null +++ b/tests/py/inet/rt.t @@ -0,0 +1,8 @@ +:output;type filter hook input priority 0 + +*inet;test-inet;output + +rt nexthop 192.168.0.1;fail +rt nexthop fd00::1;fail +meta nfproto ipv4 rt nexthop 192.168.0.1;ok +meta nfproto ipv6 rt nexthop fd00::1;ok diff --git a/tests/py/inet/rt.t.payload b/tests/py/inet/rt.t.payload new file mode 100644 index 00000000..d94973e0 --- /dev/null +++ b/tests/py/inet/rt.t.payload @@ -0,0 +1,14 @@ +# meta nfproto ipv4 rt nexthop 192.168.0.1 +inet test-inet output + [ meta load nfproto => reg 1 ] + [ cmp eq reg 1 0x00000002 ] + [ rt load nexthop4 => reg 1 ] + [ cmp eq reg 1 0x0100a8c0 ] + +# meta nfproto ipv6 rt nexthop fd00::1 +inet test-inet output + [ meta load nfproto => reg 1 ] + [ cmp eq reg 1 0x0000000a ] + [ rt load nexthop6 => reg 1 ] + [ cmp eq reg 1 0x000000fd 0x00000000 0x00000000 0x01000000 ] + diff --git a/tests/py/ip/rt.t b/tests/py/ip/rt.t new file mode 100644 index 00000000..99750c5d --- /dev/null +++ b/tests/py/ip/rt.t @@ -0,0 +1,6 @@ +:output;type filter hook input priority 0 + +*ip;test-ip4;output + +rt nexthop 192.168.0.1;ok +rt nexthop fd00::1;fail diff --git a/tests/py/ip/rt.t.payload b/tests/py/ip/rt.t.payload new file mode 100644 index 00000000..93eef4a7 --- /dev/null +++ b/tests/py/ip/rt.t.payload @@ -0,0 +1,5 @@ +# rt nexthop 192.168.0.1 +ip test-ip4 output + [ rt load nexthop4 => reg 1 ] + [ cmp eq reg 1 0x0100a8c0 ] + diff --git a/tests/py/ip6/rt0.t b/tests/py/ip6/rt0.t new file mode 100644 index 00000000..92614de3 --- /dev/null +++ b/tests/py/ip6/rt0.t @@ -0,0 +1,6 @@ +:output;type filter hook input priority 0 + +*ip6;test-ip6;output + +rt nexthop 192.168.0.1;fail +rt nexthop fd00::1;ok diff --git a/tests/py/ip6/rt0.t.payload b/tests/py/ip6/rt0.t.payload new file mode 100644 index 00000000..464b7f21 --- /dev/null +++ b/tests/py/ip6/rt0.t.payload @@ -0,0 +1,5 @@ +# rt nexthop fd00::1 +ip6 test-ip6 output + [ rt load nexthop6 => reg 1 ] + [ cmp eq reg 1 0x000000fd 0x00000000 0x00000000 0x01000000 ] + -- cgit v1.2.3