From 96c1346d5c230d2c381b9c1c9e8e2b30d3915ea1 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Wed, 16 Aug 2017 16:12:37 +0200 Subject: tests: add test case for ttl/protocol set nft .. ip ttl set 42 did set the protocol field and left ttl alone, add test cases for this. Signed-off-by: Florian Westphal Acked-by: Pablo Neira Ayuso --- tests/py/ip/ip.t.payload | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/py/ip/ip.t.payload') diff --git a/tests/py/ip/ip.t.payload b/tests/py/ip/ip.t.payload index cd54ae0f..f14f33bc 100644 --- a/tests/py/ip/ip.t.payload +++ b/tests/py/ip/ip.t.payload @@ -576,3 +576,19 @@ ip test-ip4 input [ bitwise reg 1 = (reg=1 & 0x000003ff ) ^ 0x00000000 ] [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] +# iif "lo" ip ttl set 23 +ip test-ip4 input + [ meta load iif => reg 1 ] + [ cmp eq reg 1 0x00000001 ] + [ payload load 2b @ network header + 8 => reg 1 ] + [ bitwise reg 1 = (reg=1 & 0x0000ff00 ) ^ 0x00000017 ] + [ payload write reg 1 => 2b @ network header + 8 csum_type 1 csum_off 10 csum_flags 0x0 ] + +# iif "lo" ip protocol set 1 +ip test-ip4 input + [ meta load iif => reg 1 ] + [ cmp eq reg 1 0x00000001 ] + [ payload load 2b @ network header + 8 => reg 1 ] + [ bitwise reg 1 = (reg=1 & 0x000000ff ) ^ 0x00000100 ] + [ payload write reg 1 => 2b @ network header + 8 csum_type 1 csum_off 10 csum_flags 0x1 ] + -- cgit v1.2.3