Commit Graph

104 Commits

Author SHA1 Message Date
Partha Ghosh
6f53130273 The ptp (precision time protocol) with UDP as the transport protocol.
- the print routines for ptp different ptp messages
- test completed for sync message, announce message, delay request message,
  delay response message and follow up message.
- integration of the ptp v2 code with the tcpdump code.

Signed-off-by: Partha S. Ghosh <psglinux@gmail.com>
2019-11-22 20:56:21 +01:00
Denis Ovsienko
c9e5ac541b libdnet has bugs, do not use it.
The only function tcpdump used in libdnet was dnet_htoa(), which tries
to translate a binary DECnet address to a nodename through a lookup in
/etc/decnet.conf. The translation is slow and has a bug, so stop using
the function and remove the dependency on libdnet.

This makes tcpdump always print DECnet addresses in numeric format, if
anybody needs the translation back they are welcome to fix libdnet or
(more realistically) add an implementation of dnet_htoa() to the tcpdump
source code and use it.

(This is a forward-port of commit 9a6eb27 from tcpdump-4.9 to master.
Sadly, together with libdnet this change removes the fine work that Guy
had done in the master branch in commits ebf3f19 and 4ef8d63 to put
libdnet usage right whilst my original "do not use libdnet" commit was
aging in the pipeline.)
2019-11-03 23:46:28 +00:00
Guy Harris
42ddfda12d Require CMake 3.12 or later on Windows.
We require it for policy CMP0074, so the user can tell CMake where the
Npcap or WinPcap SDK is hiding with -DPCAP_ROOT=.
2019-10-29 20:09:14 -07:00
Guy Harris
c05087101a Use PCAP_ROOT to tell CMake where to find Npcap or WinPcap. 2019-10-29 18:45:43 -07:00
Guy Harris
1fac78d737 Fix check target to work with the new versions of the test scripts. 2019-08-19 10:32:55 -07:00
Francois-Xavier Le Bail
ab450fb62d Remove trailing spaces 2019-08-16 13:52:46 +02:00
Guy Harris
a386f6baf2 Small cleanups.
Always initialize C_ADDITIONAL_FLAGS to empty.

Get rid of an extra empty line in a comment.
2019-08-09 14:51:07 -07:00
Guy Harris
675f67a20b Always define check_and_add_compiler_option(). 2019-08-09 13:41:06 -07:00
Guy Harris
eb92d85cdf Check for VS 2015 or later at configure time.
Fail if we don't have it, as we require it.

If we're using MSVC, skip the tests for options to request C99
compatibility - either we have VS 2015, which is sufficient, or we
don't, in which case we fail.
2019-08-09 13:19:03 -07:00
Guy Harris
3a000d8878 Use check_symbol_exists() for vsnprintf() and snprintf().
At least with Visual Studio, they're inline functions that call a common
external function, so check_function_exists() doesn't find them.

Clean up indentation while we're at it.
2019-08-09 11:46:19 -07:00
Guy Harris
1ed63b5d06 Remove more old-compiler compensation.
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.
2019-08-08 23:21:35 -07:00
Francois-Xavier Le Bail
a602436cc2 Use -Wpointer-sign if it's available 2019-07-13 11:38:48 +02:00
Guy Harris
cfc6639880 Use spaces rather than tabs. 2019-05-23 11:09:49 -07:00
Guy Harris
23ffab27a9 Add check for openssl/evp.h. 2019-05-23 11:09:49 -07:00
niks3089
e2f14ebc87 New ethertype protocol for Arista Networks 2019-05-23 11:06:14 +02:00
Andreas Jaggi
886fcf669f Add dissector for SSH version exchange 2019-05-08 22:15:55 +02:00
Guy Harris
2c25216be6 Add /utf-8 for MSVC. 2019-04-29 13:06:31 -07:00
Guy Harris
7c30120f52 Squelch C4324 warnings. 2019-04-18 00:20:24 -07:00
Guy Harris
1f30c0e9d3 Update comments to mention Npcap. 2019-04-18 00:16:11 -07:00
alexandr nedvedicky - Sun Microsystems - Prague Czech Republic
ed2c22b7b4 InfiniBand support for tcpdump.
InfiniBand support for tcpdump.
This is an in-house patch. Sent upstream for potential inclusion in future
versions of tcpdump.

(also adding print-ipoib.c to CMakeLists.txt, asked by @guyharris)

(s/u_int16_t/uint16_t asked by @guyharris)
2019-04-18 01:15:03 +02:00
Vivien Didelot
d5c16b1668 Remove MEDSA ethertype printer
MEDSA (which unofficially stands for Marvell EDSA) relies on the
unregistered 0xDADA ethertype value that was randomly choosen and
currently used by the kernel. But with EDSA this value is programmable,
hence can be changed anytime.

Now that a reliable DLT parser is implemented for both DSA and EDSA
tagged master interfaces, let's get rid for the MEDSA ethertype parser.
2019-04-16 12:27:08 -04:00
Vivien Didelot
43b5720499 Add support for decoding Marvell (E)DSA tags
Similarly to commit 6eaebfe adding support for the Broadcom tagging
format supported by the DSA kernel subsystem, this commit adds support
for the Marvell DSA and Ethertype DSA (EDSA) tagging formats.

Marvell DSA is a 4-byte proprietary tag placed between the ether source
address and the ether length/type. It contains data such as the switch
device and port IDs from which a frame came from, or to which port
a frame is targetting. It also contains additional FPri and IEEE bits.

EDSA is a 8-byte variant including a programmable ethertype, two null
bytes and a standard DSA tag.
2019-04-16 12:19:38 -04:00
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