This adds support for decoding the Broadcom Ethernet switches tags which
are are 4byte in length and are located between the Ethernet MAC SA and
the Type/Length field (DSA_TAG_BRCM) as well as the pre-pended Broadcom
tag (DSA_TAG_BRCM_PREPEND) which are located in front of the standard
Ethernet header.
This makes use of the recently introduced ether_print_hdr_len() to allow
specifying the non-standard Ethernet header length of 12 + 4 + 2 bytes.
My PC-BSD 9.1 VM, at least, has sys/capability.h but not sys/capsicum.h;
we now use sys/capsicum.h, so require it to be present (which it is in
FreeBSD 10 and later).
Index is displayed always, name only if available.
Warn about possible wrong interfaces when in reading mode
(pcap file can be displayed on a different host then where
was captured) [1].
See: GH the-tcpdump-group/libpcap#127
[1] https://lists.sandelman.ca/pipermail/tcpdump-workers/2018-July/001019.html
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Suggested-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Denis Ovsienko <denis@ovsienko.info>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
It's not specified by a libpcap header that might have a different
layout in different pcap releases, it's specified on the list of
link-layer header types and must remain the same forever (except for
getting additional bits defined), so we don't need to pick it up from
libpcap.
This means we get to use tcpdump's nd_ types; do so.
It's not specified by a libpcap header that might have a different
layout in different pcap releases, it's specified on the list of
link-layer header types and must remain the same forever (except for
getting additional bits defined), so we don't need to pick it up from
libpcap.
This means we get to use tcpdump's nd_ types; do so.
It doesn't work at all prior to CMake 3.1 and, even in newer versions of
CMake, it doesn't support all the vendor compilers out there for various
UNIXes.
This assumes you can run tests/TESTrun.sh as a script, which means it
assumes your command interpreter will either recognize it as a shell
script and run it in a Bourne-compatible shell or will just try and
execute it and the #! header will cause it to be run by /bin/sh.
This probably won't work on Windows.
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).
With MSVC 2015, stdio.h defines snprintf() and vsnprintf() as inline
functions, so you need to include stdio.h when testing for them -
check_function_exists() won't do it, you need check_symbol_exists().
We don't need it for tcpdump; libpcap will pick it up if necessary if
it's dynamically-linked, we'll link with it ourselves if it's
statically-linked, and libpcap will bind to the libxnet version of
recvmsg() even if we link with libsocket (as it's compiled to refer to
it with a decorated name).
Also, we don't check for it with autotools.
Include the directory in which the pcap find module found the main pcap
header file in the list of directories in which to search for other pcap
header files; otherwise, it won't find them unless they're system header
files.
CMake *hates* that. -L considered harmful, I guess (and I don't know
how that's done with tools other than UN*X linkers - do all of them
support an equivalent to -L?).
This should fix the checks for pcap functions to look in the library we
found.
Also, use ${PCAP_INCLUDE_DIRS} rather than ${PCAP_INCLUDE_DIR} for the
list of directories with header files (it should be a one-element list,
but do this for consistency), and search for pcap headers *after* we've
found libpcap, so we look in the appropriate directory.
Do the checks for -lnsl/-lxnet in the same way that we do them for
libpcap, before checking for functions that might require those
libraries. Include the results of those checks when checking for
routines that require them.
For getservent(), check for -lsocket as well.
Clean up ${XXX_LIBRARY} vs. ${XXX_LIBRARIES} usage while we're at it.
Multiple checks for a function, in different libraries, need different
variables, as, if only one variable is used, the first test checks, and
subsequent tests are skipped because the variable is already set.
Autotools' check in AC_CHECK_HEADERS() apparently either doesn't
actually try to include it or somehow arranges to define stuff that it
requires on FreeBSD. CMake's check in check_include_file() just tries
to include it, which fails on FreeBSD because __BEGIN_DECLS isn't
defined.
The man page for getrpcbynumber() says we just need to include
<rpc/rpc.h>; perhaps there are platforms on which we require both, and
that's what we do, so test it with rpc/rpc.h if we have rpc/rpc.h.
No, I have no idea why CMake has option() to create user-settable
documented Boolean parameters but uses a special variant of set() to
create user-settable documented non-Boolean parameters.
If a library is found:
add the include directories for it as a SYSTEM include
directory;
add the library for it to a list of libraries with which to link
tcpdump;
and link with that list of libraries.
We only use it in addrtoname.c to declare ether_ntohost(), so there's no
need to check for it unless we have ether_ntohost() and there's no other
header that declares it.
1988 called; it wants its pre-standard version of C back. As the
comment in vfprintf.c said, "Stock 4.3 doesn't have vfprintf."; it's
been a while since 4.3BSD was the latest shiniest BSD-flavored OS.
Instead, use compiler test macros to check whether *particular*
attributes are supported, and set various #defines appropriately, in
header files.
Rename the UNALIGNED structure attribute to ND_UNALIGNED, and ask
whether we still need it.