RFC5462 (https://tools.ietf.org/html/rfc5462) renamed the
MPLS "EXP" field to "Traffic Class" in 2009. Use "tc" as an
abbreviation for this field name.
ND_TCHECK_n(e).
They are redundant because they are followed by a GET_.*_n(e) call,
same n, same e, which do the bounds check.
Remove unused 'trunc' label(s) and most associated code(s).
ND_TCHECK_4(e).
They are redundant because they are followed by a GET_IPADDR_STRING(e)
call, same e, which do the bounds check.
Remove unused 'trunc' labels and associated codes.
Update the output of a test accordingly.
ND_TCHECK_n(e), n in { 1, 2, 3, 4, 8 }.
They are redundant because they are followed by a GET_.*_n(e) call,
same n, same e, which do the bounds check.
Remove unused 'trunc' labels and most associated codes.
Update the outputs of some tests accordingly.
Replace more calls to ipaddr_string()/ip6addr_string() with calls to
GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds
checking.
Add similar bounds-checking inline functions and macros to wrap
linkaddr_string(), etheraddr_string(), and isonsap_string() and convert
calls to them to use the macros as well.
Shuffle the inline functions in addrtoname.h around a bit, so that the
inline functions, external declarations, and macros are all in the same
order.
We require an environment with a C99-compatible snprintf(), so we don't
need to work around older implementations. Make the configuration
process fail if we don't have snprintf() and vsnprintf().
We require at least VS 2015, so we don't have to check for _MSC_VER >=
1400. Make the build fail if we don't have at least VS 2015.
We apparently do, however, have to use __inline, as the VS 2015
documentation doesn't meaning plain old "inline". Update a comment.
The exceptions are currently:
Some EXTRACT_ in print-juniper.c, not used on packet buffer pointer.
An EXTRACT_BE_U_3 in addrtoname.c, not always used on packet buffer
pointer.
In 'struct icmp'.
This avoid some 'undefined-behavior' warnings with clang and option
-fsanitize=undefined enabled.
Moreover:
Remove unneeded '&' when getting a pointer to a nd_ipv4 type.
Fix indentation.
The warnings were like:
print-icmp.c:355:2: runtime error: member access within misaligned address
0x61d00001eabe for type 'const struct icmp', which requires 4 byte alignment
0x61d00001eabe: note: pointer points here
ef 01 02 03 08 00 90 e1 00 03 00 00 00 00 00 00 00 05 ed 60 ab cd ab cd ab cd ab cd ab cd ab cd
^
SUMMARY: AddressSanitizer: undefined-behavior print-icmp.c:355:2 in
Some versions of the MSVC runtime library have a non-C99-compliant
vsnprintf(), which we want to avoid. On Windows, use snprintf() and
vsnprintf() for VS 2015 and later, where they both exist in
C99-compliant forms, and wrap _{v}snprintf_s() otherwise (they're
guaranteed to do the null termination that we want).
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.
Use nd_ types for various packet structures, and use EXTRACT_ macros as
necessary. Get rid of & in EXTRACT_ macros if not necessary.
The 1-byte pad RPL suboption is called PAD1, not PAD0, in the RFC.
Rename rpl_dio_printopt() to rpl_printopts() because 1) it's for all RPL
messages and 2) it prints multiple options. Clean up its processing
loop.
Pass rpl_print() the ICMPv6 code, not a pointer to the full header; all
it needs is the code.
Use %u to print unsigned values.
In Node Information node address lists, the TTL comes before the
address, as per the RFC. Dissect it that way.
This catches direct references, so we can change them to use EXTRACT_U_1
or EXTRACT_S_1.
Also, change some structures to use the nd_ types that weren't already
using them.
Then make the appropriate EXTRACT_{U,S}_1() changes.
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
[print-icmp.c:402]: (warning) %d in format string (no. 2) requires 'int'
but the argument type is 'unsigned int'.
[print-icmp.c:560]: (style) The scope of the variable 'sum' can be
reduced.
[print-icmp.c:560]: (style) The scope of the variable 'icmp_sum' can be
reduced.
[print-icmp.c:509]: (warning) %d in format string (no. 1) requires 'int'
but the argument type is 'unsigned int'.
[print-icmp.c:517]: (warning) %d in format string (no. 1) requires 'int'
but the argument type is 'unsigned int'.
Check before fetching the length from the included packet's IPv4 header.
This fixes a buffer over-read discovered by Bhargava Shastry,
SecT/TU Berlin.
Add a test using the capture file supplied by the reporter(s), modified
so the capture file won't be rejected as an invalid capture.
This fixes a buffer over-read discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.
Add tests using the capture files supplied by the reporter(s).
It's *not* the length of the captured data in the packet, it's the
snapshot length for the live capture or the savefile - the length of the
captured data in the packet could be less.
with the tag '\summary:' for greping.
Remark: Currently some printers have no summary line.
Moreover:
Summarize all printers with a single line in INSTALL.txt
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.
Check for the ICMP types that *do* include an IP packet, rather than
checking for a set that doesn't. This does a better job of handling
unknown ICMP types.
And, as we require at least autoconf 2.61, and as autoconf 2.61 and
later have AC_TYPE_UINTn_T and AC_TYPE_INTn_T macros, we use them to
define the uintN_t and intN_t macros if the system doesn't define them
for us.
This lets us get rid of bitypes.h as well.