diff options
author | Florian Westphal <fw@strlen.de> | 2016-07-21 15:57:15 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2016-07-21 17:22:05 +0200 |
commit | 6c0cb3d568322cc4dc9854980fd3b9d6e8c8046e (patch) | |
tree | 933bd16d2995bf5d2fd2d6cbd1cff878852bad45 /tests/py/ip6 | |
parent | a4fe9cfe788706c0bf1c3a40b7c92f1d2bebf7e7 (diff) |
tests: add basic payload tests
payload set operations should work at least for byte-sized
quantities >= 2 byte.
Before adding support for odd-sized writes (ecn, dscp, ip6 flowlabel
...) add a bunch of tests to cover current state.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/py/ip6')
-rw-r--r-- | tests/py/ip6/ip6.t | 4 | ||||
-rw-r--r-- | tests/py/ip6/ip6.t.payload.inet | 17 | ||||
-rw-r--r-- | tests/py/ip6/ip6.t.payload.ip6 | 12 |
3 files changed, 33 insertions, 0 deletions
diff --git a/tests/py/ip6/ip6.t b/tests/py/ip6/ip6.t index 2278618f..0a58fa8d 100644 --- a/tests/py/ip6/ip6.t +++ b/tests/py/ip6/ip6.t @@ -141,3 +141,7 @@ ip6 saddr ::1 ip6 daddr ::2;ok - ip6 daddr != {::1234:1234:1234:1234:1234:1234:1234, 1234:1234::1234:1234:1234:1234:1234 };ok ip6 daddr != ::1234:1234:1234:1234:1234:1234:1234-1234:1234::1234:1234:1234:1234:1234;ok;ip6 daddr != 0:1234:1234:1234:1234:1234:1234:1234-1234:1234:0:1234:1234:1234:1234:1234 + +# limit impact to lo +iif lo ip6 daddr set ::1;ok +iif lo ip6 hoplimit set 1;ok diff --git a/tests/py/ip6/ip6.t.payload.inet b/tests/py/ip6/ip6.t.payload.inet index c29c5a3f..45bdd09a 100644 --- a/tests/py/ip6/ip6.t.payload.inet +++ b/tests/py/ip6/ip6.t.payload.inet @@ -513,3 +513,20 @@ inet test-inet input [ cmp lt reg 1 0x34120000 0x34123412 0x34123412 0x34123412 ] [ cmp gt reg 1 0x34123412 0x34120000 0x34123412 0x34123412 ] +# iif lo ip6 daddr set ::1 +inet test-inet input + [ meta load iif => reg 1 ] + [ cmp eq reg 1 0x00000001 ] + [ meta load nfproto => reg 1 ] + [ cmp eq reg 1 0x0000000a ] + [ immediate reg 1 0x00000000 0x00000000 0x00000000 0x01000000 ] + [ payload write reg 1 => 16b @ network header + 24 csum_type 0 csum_off 0 ] + +# iif lo ip6 hoplimit set 1 +inet test-inet input + [ meta load iif => reg 1 ] + [ cmp eq reg 1 0x00000001 ] + [ meta load nfproto => reg 1 ] + [ cmp eq reg 1 0x0000000a ] + [ immediate reg 1 0x00000001 ] + [ payload write reg 1 => 1b @ network header + 7 csum_type 0 csum_off 0 ] diff --git a/tests/py/ip6/ip6.t.payload.ip6 b/tests/py/ip6/ip6.t.payload.ip6 index c2499237..e3549890 100644 --- a/tests/py/ip6/ip6.t.payload.ip6 +++ b/tests/py/ip6/ip6.t.payload.ip6 @@ -379,3 +379,15 @@ ip6 test-ip6 input [ cmp lt reg 1 0x34120000 0x34123412 0x34123412 0x34123412 ] [ cmp gt reg 1 0x34123412 0x34120000 0x34123412 0x34123412 ] +# iif lo ip6 daddr set ::1 +ip6 test-ip6 input + [ meta load iif => reg 1 ] + [ cmp eq reg 1 0x00000001 ] + [ immediate reg 1 0x00000000 0x00000000 0x00000000 0x01000000 ] + [ payload write reg 1 => 16b @ network header + 24 csum_type 0 csum_off 0 ] + +# iif lo ip6 hoplimit set 1 +ip6 test-ip6 input + [ meta load iif => reg 1 ] + [ cmp eq reg 1 0x00000001 ] + [ immediate reg 1 0x00000001 ] |