Commit Graph

82 Commits

Author SHA1 Message Date
Gerard Garcia
cda9bf8c5f Add printing support for vsockmon devices.
Print Linux 4.12 vsockmon captures:

  # modprobe vsockmon
  # ip link add type vsockmon
  # ip link set vsockmon0 up
  # tcpdump -i vsockmon0
  16:25:24.987917 VIRTIO 3.1025 > 2.1234 CONNECT, length 76
  16:25:24.987963 VIRTIO 2.1234 > 3.1025 CONNECT, length 76
  16:25:26.568271 VIRTIO 3.1025 > 2.1234 PAYLOAD, length 82
  16:25:26.568512 VIRTIO 2.1234 > 3.1025 CONTROL, length 76
  16:25:28.411335 VIRTIO 3.1025 > 2.1234 DISCONNECT, length 76
  16:25:28.411628 VIRTIO 2.1234 > 3.1025 DISCONNECT, length 76

For more information about vsock see:
http://wiki.qemu.org/Features/VirtioVsock
2019-04-16 15:12:13 +01:00
Guy Harris
202051bb55 Put IPv4/IPv6 protocol demultiplexing into a common routine.
That means less duplication of functionality - and less chance that
XXX-over-IPv4 will be handled but XXX-over-IPv6 won't be handled, or
*vice versa*.  (CARP and VRRP were being handled over IPv4 but not over
IPv6; this fixes that.)
2019-03-27 19:58:26 -07:00
Michael Richardson
35a1310799 Merge branch 'master' of https://github.com/kivinen/tcpdump into kivinen-master 2019-03-24 09:05:06 +01:00
Florian Fainelli
6eaebfe992 Add support for decoding Broadcom Ethernet switches tags
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.
2019-01-28 10:56:18 -08:00
Guy Harris
1af79d4adf Try to squelch another annoying repeated warning. 2018-12-10 19:57:54 -08:00
Tero Kivinen
8030a66cdc Fixed some warnings, added print-zep.c to CMakeLists 2018-11-18 00:34:33 +02:00
Guy Harris
65f3770fd7 Require sys/capsicum.h to use Capsicum.
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).
2018-11-09 12:00:59 -08:00
Francois-Xavier Le Bail
cb36ac604e Compile with -Wsign-compare in devel mode if supported (cmake) 2018-10-30 21:33:51 +01:00
Guy Harris
9008c09c88 Don't warn about declarations after statements.
We now allow them, and require a compiler that supports them, so there's
no need to warn about them.
2018-09-15 13:16:02 -07:00
Francois-Xavier Le Bail
009bd798b5 Add '-Wunreachable-code-return' warning option in devel mode for cmake 2018-08-07 23:46:16 +02:00
Francois-Xavier Le Bail
7920225334 Sort the tested compiler warning options for cmake 2018-08-07 23:36:44 +02:00
Francois-Xavier Le Bail
34b59a8011 Remove the no more used gmt2local() function 2018-08-07 20:27:46 +02:00
Petr Vorel
152acc2ece Display interface and index and name on DLT_LINUX_SLL2
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>
2018-07-19 07:15:11 +01:00
Francois-Xavier Le Bail
38e32cdf14 Remove trailing spaces/tabs 2018-05-25 09:56:04 +02:00
Guy Harris
e7011808da Declare the NFLOG pseudo-header ourselves.
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.
2018-05-23 14:43:47 -07:00
Guy Harris
e02efb5044 Declare the Bluetooth pseudo-header ourselves.
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.
2018-05-23 14:12:45 -07:00
Guy Harris
9373df8aa3 Don't set COMPILE_FLAGS if there aren't any flags to set.
Otherwise, you get a complaint about there being too few arguments to
set_target_properties().
2018-03-27 14:38:29 -07:00
Guy Harris
2846055e96 Add -W options. 2018-03-27 14:18:14 -07:00
Guy Harris
af51efcd6a The COMPILE_FLAGS property is a string, not a list.
Make C_ADDITIONAL_FLAGS a string as well, and use it appropriately.
2018-03-27 14:11:25 -07:00
Guy Harris
092ae6ddf7 Add C_ADDITIONAL_FLAGS to the compiler flags for targets. 2018-03-27 13:34:09 -07:00
Guy Harris
32f8ededb0 Initialize C_ADDITIONAL_FLAGS where we start setting it. 2018-03-27 13:16:17 -07:00
Guy Harris
111e17e87d Don't use CMAKE_C_STANDARD, it doesn't work on all versions of CMake.
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.
2018-03-27 13:13:30 -07:00
Francois-Xavier Le Bail
a53605c61b Add a malloc/free process with garbage collector
Use it in the PPP printer.
2018-03-14 13:59:26 +01:00
Guy Harris
800d27dd0d Add "make check".
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.
2018-03-05 19:11:09 -08:00
Guy Harris
ace2828188 Add ws2_32, not socket and nsl, if ws2_32 has gethostbyaddr().
Also, fail if we don't have gethostbyaddr(), either on Windows or on
UN*X.

Suppress some UN*X-only tests on Windows while we're at it.
2018-01-30 02:41:43 -08:00
Guy Harris
0f0600c901 Get rid of tests whose results we don't use.
(Crud left over from using libpcap's CMakeLists.txt as a basis for this
one.)
2018-01-30 02:18:31 -08:00
Guy Harris
c499612a7f Add nd_{v}snprintf() routines/wrappers.
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).
2018-01-29 15:48:55 -08:00
Guy Harris
0fb509808c Not all Windows pcaps have pcap_wsockinit().
WinPcap 4.1.3 has only wsockinit(); check for both, on Windows.
2018-01-29 02:16:13 -08:00
Guy Harris
ffe074feba Work around a WinPcap botch. 2018-01-29 02:04:12 -08:00
Guy Harris
a13e29249b Extra libraries needed on Windows. 2018-01-29 01:54:48 -08:00
Guy Harris
c7dfcd6aaf When checking pcap.h, make sure we look in ${PCAP_INCLUDE_DIRS}.
It's not necessarily in one of the default include directories, so look
in the directory where we're supposed to look for pcap header files.
2018-01-29 01:30:20 -08:00
Guy Harris
494c8096e0 Use check_symbol_exists for {v}snprintf().
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().
2018-01-29 00:57:02 -08:00
Guy Harris
b3703ed9cf Pick up Windows snprintf and strdup replacements from libpcap. 2018-01-28 20:57:15 -08:00
Guy Harris
bf8cae24c0 If you need multiple headers, use check_include_files(), plural. 2018-01-28 19:01:10 -08:00
Guy Harris
4ef8d63149 Do libdnet checks the same way autotools does. 2018-01-28 18:58:00 -08:00
Guy Harris
c2a480c367 Don't check for libxnet.
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.
2018-01-28 14:01:17 -08:00
Guy Harris
6c13379a72 Check for ether_ntohost() after finding additional networking libraries.
It might be in one of those libraries.
2018-01-28 13:54:22 -08:00
Guy Harris
25360d9e22 Search TCPDUMP_LINK_LIBRARIES when looking for ether_ntohost(). 2018-01-28 13:50:09 -08:00
Guy Harris
88007d634c Shuffle include(CheckLibraryExists) up with the other includes.
We'll be using it later; might as well include it there.
2018-01-27 11:42:08 -08:00
Guy Harris
757ffb7ab9 Check for pcap_debug and yydebug if we don't have pcap_set_parser_debug(). 2018-01-27 11:34:39 -08:00
Guy Harris
f5c2aca06b Look for pcap header files in the appropriate directory.
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.
2018-01-27 10:40:15 -08:00
Guy Harris
253ef5db82 Don't do "here's the directories in which to look for libraries".
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.
2018-01-26 20:02:32 -08:00
Guy Harris
2a286c71f3 Add ${PCAP_LIBRARY_DIRS} to the list of directories with libraries.
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.
2018-01-26 09:26:30 -08:00
Guy Harris
107e3f1888 Fix typo. 2018-01-24 13:34:36 -08:00
Guy Harris
8c6ffa5124 OK, even with -lxnet, we may need -lnsl.
You are in a twisty little maze of Solaris libraries, all different.
2018-01-24 13:33:14 -08:00
Guy Harris
1d96b4ecf1 Clean up checks for -lsocket/-lnsl/-lxnet.
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.
2018-01-24 13:00:36 -08:00
Guy Harris
96877078a1 Fix check for getrpcbynumber().
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.
2018-01-24 12:04:07 -08:00
Guy Harris
a5a0a64361 Pop check state after pushing it in libcrypto tests. 2018-01-23 12:27:28 -08:00
Guy Harris
587a15c126 -lcap_dns requires -lcasper. 2018-01-23 10:56:17 -08:00
Guy Harris
bd455d07af Fix conditional addition of source files.
Conditionally add everything to LOCALSRC and include LOCALSRC in
NETDISSECT_SOURCE_LIST_C.
2018-01-22 19:43:26 -08:00