]> The Tcpdump Group git mirrors - tcpdump/commit
Fix handling of IPv4 prefixes.
authorGuy Harris <[email protected]>
Sun, 30 Oct 2016 09:37:56 +0000 (02:37 -0700)
committerGuy Harris <[email protected]>
Sun, 30 Oct 2016 09:37:56 +0000 (02:37 -0700)
commitfe01d2496c1cc3b4a327d7d9b2faba9c79479a13
treeb02316380b4fb10d22dd214bd8da32c1ec69a0c9
parente2adb166ecaf59555e18787e86ac8c828efa0acc
Fix handling of IPv4 prefixes.

Do *NOT* just use decode_prefix4(); it assumes that the data is in the
packet buffer, and does ND_TCHECK() on it, which is not guaranteed to
work if it's *not* in the packet buffer.  Instead, do something similar
to what decode_prefix4() does, but on an HNCP-style prefix.  Also, when
calling decode_prefix6(), pass it the actual size of the buffer we fill
in.

That buffer, BTW, does not need to be static, so it shouldn't be static.

Make sure we check *all* of the first 12 bytes of the prefix; just use
one memcmp call to check for 10 bytes of 0 followed by 2 bytes of 0xFF.

Don't use safeputs() on the formatted string for the prefix; it's
guaranteed 1) not to have any strange characters and 2) to be
null-terminated.

For invalid body lengths for a TLV, just report a error for that TLV,
but keep processing TLVs.

Handle "the prefix length is invalid" and "the prefix runs past the end
of the packet" differently.
print-hncp.c