diff options
author | Florian Westphal <fw@strlen.de> | 2023-12-14 15:39:27 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-12-14 17:53:43 +0100 |
commit | 0404ff08b3c18052e6689d75fa85275d3cef7e8e (patch) | |
tree | f790890dd3b7017cf86c9937f8bc4705bb516e7d /tests/py/ip/ip.t.payload | |
parent | 21657008dd4b4094eac017a175f2a3056af36b17 (diff) |
netlink: don't crash if prefix for < byte is requested
If prefix is used with a datatype that has less than 8 bits an
assertion is triggered:
src/netlink.c:243: netlink_gen_raw_data: Assertion `len > 0' failed.
This is esoteric, the alternative would be to restrict prefixes
to ipv4/ipv6 addresses.
Simpler fix is to use round_up instead of divide.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/py/ip/ip.t.payload')
-rw-r--r-- | tests/py/ip/ip.t.payload | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/py/ip/ip.t.payload b/tests/py/ip/ip.t.payload index 43605a36..d7ddf7be 100644 --- a/tests/py/ip/ip.t.payload +++ b/tests/py/ip/ip.t.payload @@ -556,3 +556,11 @@ ip test-ip4 input [ counter pkts 0 bytes 0 ] [ payload load 4b @ network header + 16 => reg 1 ] [ cmp eq reg 1 0x06050403 ] + +# ip dscp 1/6 +ip test-ip4 input + [ payload load 1b @ network header + 1 => reg 1 ] + [ bitwise reg 1 = ( reg 1 & 0x000000fc ) ^ 0x00000000 ] + [ bitwise reg 1 = ( reg 1 >> 0x00000002 ) ] + [ bitwise reg 1 = ( reg 1 & 0x0000003f ) ^ 0x00000000 ] + [ cmp eq reg 1 0x00000001 ] |