This can prevent bizarre failures if, for example, you've done a
configuration in the top-level source directory, leaving behind one
config.h file, and then do an out-of-tree build in another directory,
with different configuration options. This way, we always pick up the
same config.h, in the build directory.
Now all the macros have a name meaning a count in bytes.
With _S_: signed, _U_: unsigned
e.g.:
EXTRACT_BE_32BITS -> EXTRACT_BE_U_4
EXTRACT_LE_32BITS -> EXTRACT_LE_U_4
...
EXTRACT_BE_INT32 -> EXTRACT_BE_S_4
and have:
EXTRACT_8BITS -> EXTRACT_U_1
EXTRACT_INT8 -> EXTRACT_S_1
The bounds check is already done before by ND_TCHECK2(*tptr, len).
So we are deliberately ignoring the return value of fn_printn with last
argument NULL (no bounds check).
Moreover:
Update reference from draft to RFC5171.
Add bounds and length checks.
Fix TLV length printout. It is the length of the type, length, and value
fields.
Filter out non-printable characters.
Print the Echo TLV with fn_printn(). Note: The format of this list of ID
pairs is not documented in the RFC.
Update the output of a test accordingly.
Add and use istr[] and tstr[] strings.
Comment on the TLV format.
Update some comments.
The purpose of this macro was to enable the file-by-file switch to NDO,
after which only tcpdump.c had a use of it and the definitions guarded
by it. Update tcpdump.c not to require them any more and dismiss the
unused definitions.
Make sure all of them are declared const and most of them -- static.
Proper declaration of token arrays is a common review point for new code
that is based on existing decoders. Thus fix the issue at its root.