From 8221d86e616bdd5e9828c3eefb7cfb9abc3d211a Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Fri, 17 Mar 2023 10:16:48 +0100 Subject: tests: py: add test-cases for ct and packet mark payload expressions Add new test-cases to verify that defining a rule that sets the ct or packet mark to a value derived from a payload works correctly. Signed-off-by: Jeremy Sowden Signed-off-by: Pablo Neira Ayuso --- tests/py/ip6/meta.t.payload | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/py/ip6/meta.t.payload') diff --git a/tests/py/ip6/meta.t.payload b/tests/py/ip6/meta.t.payload index 0e3db6ba..f0507dc4 100644 --- a/tests/py/ip6/meta.t.payload +++ b/tests/py/ip6/meta.t.payload @@ -60,3 +60,23 @@ ip6 test-ip6 input [ cmp eq reg 1 0x00000011 ] [ payload load 2b @ transport header + 2 => reg 1 ] [ cmp eq reg 1 0x00004300 ] + +# meta mark set ip6 dscp << 2 | 0x10 +ip6 test-ip6 input + [ payload load 2b @ network header + 0 => reg 1 ] + [ bitwise reg 1 = ( reg 1 & 0x0000c00f ) ^ 0x00000000 ] + [ bitwise reg 1 = ( reg 1 >> 0x00000006 ) ] + [ byteorder reg 1 = ntoh(reg 1, 2, 1) ] + [ bitwise reg 1 = ( reg 1 << 0x00000002 ) ] + [ bitwise reg 1 = ( reg 1 & 0xffffffef ) ^ 0x00000010 ] + [ meta set mark with reg 1 ] + +# meta mark set ip6 dscp << 26 | 0x10 +ip6 test-ip6 input + [ payload load 2b @ network header + 0 => reg 1 ] + [ bitwise reg 1 = ( reg 1 & 0x0000c00f ) ^ 0x00000000 ] + [ bitwise reg 1 = ( reg 1 >> 0x00000006 ) ] + [ byteorder reg 1 = ntoh(reg 1, 2, 1) ] + [ bitwise reg 1 = ( reg 1 << 0x0000001a ) ] + [ bitwise reg 1 = ( reg 1 & 0xffffffef ) ^ 0x00000010 ] + [ meta set mark with reg 1 ] -- cgit v1.2.3