Handle the I-D draft-detienne-dmvpn-01 traffic indication packet.
Print the error code in an error indication symbolically if it's a known
code.
Print the address fields in the mandatory part of the header for error
and traffic indication packets.
Instead, have an additional element in a struct cdp_tlvinfo that
indicates whether to print the TLV in all modes or only in verbose mode;
that would allow other TLVs to printed in non-verbose mode.
Also, use the usual (sizeof x / sizeof x[0]) trick to determine how big
the table is, rather than having a defined size.
DHCPv4: RFC8572 specifies the SZTP redirect tag.
DHCPv6: RFC5970 specifies the boot file URL, used for ZTP,
and RFC8572 specifies the SZTP redirect tag
The base DHCPv6 RFC3315 specifies the user class option.
If we're not in verbose mode, we only show the Device ID TLV, so there's
no good reason to show a hex dump of other TLVs if we don't happen to
have a printer for them - especially given that we don't show the type
value for the TLV, so it's not clear to what type value those hex bytes
correspond. Furthermore, the hex dump causes the non-verbose output to
be multiple lines, and causes the ", length N" to show up at the end of
the hex dump rather than at the end of the first line.
I.e., it seems as if either 1) printing the hex dump in non-verbose mode
wasn't intended or 2) it was intended by whoever intended it didn't look
into what it would involve.
Fixup the comment and have the case block actually fall through
consistently with the comment and the OpenBSD implementation. Update
the test case, which now has the IPv4 packet after the WCCP header. The
indentation does not represent the header nesting, but the same stands
for the OpenBSD implementation.
On Solaris 10 /usr/bin/grep does not implement the -q flag:
checking for pcap-config... ../libpcap/pcap-config
grep: illegal option -- q
Usage: grep -hblcnsviw pattern file . . .
checking for pcap_loop... yes
Follow recommendation of the "Limitations of Usual Tools" section of GNU
Autoconf manual and use output redirection to fix it:
checking for pcap-config... ../libpcap/pcap-config
checking for pcap_loop... yes
If the environment variable INSTRUMENT is
- unset or set to an empty string, print nothing, like with no
instrumentation
- set to "all" or "a", print all the functions names
- set to "global" or "g", print only the global functions names
The configuration with --enable-instrument-functions remains.
Note that before this change, the default was to print all functions.
Now it is to print nothing. So by default 'make check' runs without errors.
This allows to run:
$ INSTRUMENT=a ./tcpdump ...
$ INSTRUMENT=g ./tcpdump ...
$ INSTRUMENT= ./tcpdump ...
or
$ export INSTRUMENT=global
$ ./tcpdump ...
This also allows to run the statically compiled binary on another host
after copying it.
It is no longer necessary to modify the configuration with:
$ make instrument_all
$ make instrument_global
$ make instrument_off
(Targets removed.)
Update .gitignore, CONTRIBUTING.md and Makefile.in accordingly.
Moreover:
Reduce the scope of a variable.
Rename a variable.
Remove '\n' in the perror() call.
Remove 2 spaces in function calls (style).
[skip ci]
In the prose use the names from respective registry [1], which says:
* "PSH", not "PUSH",
* "CWR", not "ECN CWR", and
* "ECE", not "ECN-Echo".
This does not resolve all known inconsistencies related to TCP flags,
but at least makes the problem smaller.
1: https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xhtml
Same as in tcpslice to fix a Coverity issue.
The issue was:
Null pointer dereferences (FORWARD_NULL)
Passing null pointer "func" to "strncmp", which dereferences it.
tcpdump.c requires both HAVE_PCAP_IF_T and HAVE_PCAP_FINDALLDEVS to
manage the code that depends on pcap_findalldevs(). Other than that,
the Autoconf and CMake checks that produce these two macros do not
relate directly, so having the check for pcap_if_t conditional on the
check for pcap_findalldevs() is an unnecessary complication.
More importantly, in the CMake case this places the check_type_size()
for pcap_if_t into a context with CMAKE_REQUIRED_LIBRARIES already set
to PCAP_LIBRARIES. This works only if check_type_size() does not have
to check for <sys/types.h>, <stdint.h> or <stddef.h> implicitly. This
was the case so long as another check_type_size() before the
CMAKE_REQUIRED_LIBRARIES change made the implicit checks and cached the
results, but removing that earlier instance resulted in a warning:
Policy CMP0075 is not set: Include file check macros honor
CMAKE_REQUIRED_LIBRARIES. Run "cmake --help-policy CMP0075" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
CMAKE_REQUIRED_LIBRARIES is set to:
/usr/lib/x86_64-linux-gnu/libpcap.so
For compatibility with CMake 3.11 and below this check is ignoring it.
To fix that, in both Autoconf and CMake make the two checks separate and
unconditional and place the check for pcap_if_t where it fits better.
In CMake remove the earlier workaround with in6_addr.
Some versions of Mac OS X (as it was then called) *did*, in fact, ship
with a libpcap that had pcap_findalldevs() but a pcap.h that didn't
define pcap_if_t; it's not a question of "may ship", it's a fact of "did
ship".
tcpdump source code has not been using struct in6_addr since commit
0c9cfdc in 2019, so lose the conditional structure declaration, which is
a no-op.
Since commit de7c619 in 2015 netdissect-stdinc.h on Windows defines
HAVE_OS_IPV6_SUPPORT if AF_INET6 if defined, which makes it equivalent
to AF_INET6. On Unix-like systems taking struct in6_addr out of scope
would make HAVE_OS_IPV6_SUPPORT equivalent to AF_INET6, thus after
removing struct in6_addr remove HAVE_OS_IPV6_SUPPORT together with
Autoconf and CMake checks that define it. Leave an unrelated CMake
workaround in place for later debugging.
On Windows do not define AF_INET6 if it is not defined, which makes
AF_INET6 a universal indicator of the OS IPv6 support on all supported
OSes. The few remaining use cases that genuinely need AF_INET6 use it
to make OS API calls, so if the macro is not defined, it most likely
means such an API call in the best case would return just a well-formed
error status. With this in mind, in win32_gethostbyaddr() and
ip6addr_string() guard all IPv6-specific code with #ifdef AF_INET6. In
tcpdump.c add a comment to note why a guard is not required for
Casper-specific conditional code that uses AF_INET6.
This way when the OS does not support IPv6, IPv6 addresses will not
resolve to names, which is expected. Other than that, tcpdump should be
able to process IPv6 addresses the usual way regardless if the OS would
be able to process the packets with these addresses.