]> The Tcpdump Group git mirrors - tcpdump/commit
UDLD: Refine and modernize the code.
authorDenis Ovsienko <[email protected]>
Sat, 3 Oct 2020 14:29:02 +0000 (15:29 +0100)
committerDenis Ovsienko <[email protected]>
Sat, 3 Oct 2020 14:39:11 +0000 (15:39 +0100)
commit44a89a1d70ed0459556ea1a2b09b5848b4fc793c
tree1d63949ff3ccc4debe07c4dcd36781222face644
parent300a1fa76aa361882532e425989a0efdebeb3fb4
UDLD: Refine and modernize the code.

Enable ND_LONGJMP_FROM_TCHECK. Lose a local variable, instead modify the
provided pointer and length in sync and always fetch one field at a time.
When the packet is declard too short, report it as invalid, not truncated
(it may turn out truncated soon thereafter though). Use a named constant.

When not decoding the packet completely (whether invalid or not), still
check that it is fully within the snapshot.

When decoding it completely, add checks at the beginng of the iteration
to test that both the TL and the V fit into the remaining part of the
declared packet. Move an ND_TCHECK_LEN() into the default case to let the
string printing functions guard the snapshot end. Do not declare the
remainder of the packet invalid on TLV type 0, as RFC 5171 Section 6
says: "If an implementation does not understand a Type value, it should
skip over it using the length field."
print-udld.c