]> The Tcpdump Group git mirrors - tcpdump/log
tcpdump
3 years agoCirrus CI: Refine resource allocation for freebsd. [skip appveyor]
Denis Ovsienko [Thu, 29 Jul 2021 18:13:10 +0000 (19:13 +0100)] 
Cirrus CI: Refine resource allocation for freebsd. [skip appveyor]

FreeBSD-13.0 is now the fastest, so size it down and size the other two
releases up a bit. Remove a stale comment.

3 years agoIEEE 802.11: include the "TA" field while printing Block Ack Control frame 926/head
Gokul Sivakumar [Tue, 13 Jul 2021 15:43:25 +0000 (21:13 +0530)] 
IEEE 802.11: include the "TA" field while printing Block Ack Control frame

As per the IEEE 802.11-2016 std, section 9.3.1.9, Fig 9-32, the Block Ack
control frame has the Transmitter Address field. So include this TA field
when printing the BA frame to stdout if the "eflag" is enabled.

3 years agoAddress some issues with XL C on Linux/POWER9.
Denis Ovsienko [Tue, 27 Jul 2021 13:06:28 +0000 (14:06 +0100)] 
Address some issues with XL C on Linux/POWER9.

XL C 16.1.1 Community Edition for Linux generated three warnings for
every file:

In file included from ./tcpdump.c:155:
./netdissect.h:254:8: warning: 1540-2990 The attribute
"__attribute__((format(printf, 2, 3)))" is not supported. The
      attribute is ignored.
                     PRINTFLIKE_FUNCPTR(2, 3);
                     ^
./netdissect.h:259:10: warning: 1540-2990 The attribute
" __attribute__((format(printf, 3, 4)))" is not supported.
      The attribute is ignored.
                                     PRINTFLIKE_FUNCPTR(3, 4);
                                     ^
./netdissect.h:263:9: warning: 1540-2990 The attribute
" __attribute__((format(printf, 2, 3)))" is not supported. The
      attribute is ignored.
                      PRINTFLIKE_FUNCPTR(2, 3);
                      ^

As it turns out, this is a bug in the compiler. In compiler-tests.h
update ND_IS_AT_LEAST_XL_C_VERSION() to tell newer XL C versions. In
funcattrs.h exempt XL C 16.1 from PRINTFLIKE_FUNCPTR().

In the course of preparing these changes notice that XL C uses the Clang
block in diag-control.h (XL C mimics both Clang and GCC to some extent),
although the behaviour is different between the two compilers. Add a new
block for XL C there.

In build_common.sh add more comments to explain XL C quirks and detect
XL C for Linux too so it receives the right CFLAGS. Update CHANGES to
mention this and earlier improvements.

3 years agoCI: Make MATRIX_CC loop the outermost.
Denis Ovsienko [Mon, 26 Jul 2021 15:27:28 +0000 (16:27 +0100)] 
CI: Make MATRIX_CC loop the outermost.

This way if an iteration includes a local libpcap, the latter is always
compiled with the same CC. This works around odd linking problems on
AIX 7 and Solaris 9 and 10 when one C compiler is GCC and the other is
the vendor's compiler, for example:

* GCC used for libpcap, XL C used for tcpdump:
ld: 0711-317 ERROR: Undefined symbol: .__udivdi3
ld: 0711-317 ERROR: Undefined symbol: .__umoddi3

* GCC used for libpcap, Sun C used for tcpdump:
Undefined                       first referenced
 symbol                             in file
__ctzsi2                            ../libpcap/libpcap.a(optimize.o)
__udivdi3                           ../libpcap/libpcap.a(sf-pcapng.o)
__umoddi3                           ../libpcap/libpcap.a(sf-pcapng.o)
ld: fatal: Symbol referencing errors. No output written to conftest

Similar issues associated with a mix of GCC and Clang had happened on
FreeBSD/AArch64 earlier (addressed in tcpslice commit 75b7771), and
still seem to happen on OpenBSD/AArch64. Hopefully removing the
toolchain mix from the problem space will make it easier to fix other
problems.

3 years agoCI: Print dynamic dependencies early. [skip ci]
Denis Ovsienko [Mon, 26 Jul 2021 14:33:17 +0000 (15:33 +0100)] 
CI: Print dynamic dependencies early. [skip ci]

Call print_so_deps() just after "make install", so if dynamic linking
has failed for some reason, the failure to run tcpdump binary will not
prevent printing the details. Lose "tcpdump --version" because version
information is a part of "tcpdump -h" output.

-- Installing: /tmp/tcpdump_build_matrix.XXyKaiEo/bin/tcpdump
-- Set runtime path of "/tmp/tcpdump_build_matrix.XXyKaiEo/bin/tcpdump" to ""
-- Installing: /tmp/tcpdump_build_matrix.XXyKaiEo/share/man/man1/tcpdump.1
$ /tmp/tcpdump_build_matrix.XXyKaiEo/bin/tcpdump --version
ld.so.1: tcpdump: fatal: libpcap.so.1: open failed: No such file or directory

3 years agoCI: GCC can appear as "egcc" on OpenBSD. [skip ci]
Denis Ovsienko [Mon, 26 Jul 2021 11:46:33 +0000 (12:46 +0100)] 
CI: GCC can appear as "egcc" on OpenBSD. [skip ci]

3 years agoSquelch a noreturn warning on AIX. [skip ci]
Denis Ovsienko [Mon, 26 Jul 2021 11:01:00 +0000 (12:01 +0100)] 
Squelch a noreturn warning on AIX. [skip ci]

GCC 8.3.0 on AIX 7.1 produced a warning for every file that has a call
to nd_trunc_longjmp():

In file included from ./cpack.c:39:
./extract.h: In function 'nd_trunc_longjmp':
./extract.h:586:1: warning: 'noreturn' function does return

As far as longjmp(3) man page and <setjmp.h> header go, longjmp() is as
noreturn in AIX as everywhere else, but not in a way that GCC can tell.

Disabling -Wsuggest-attribute=noreturn and -Wmissing-noreturn had no
apparent effect, so instead of using diag-control.h add an infinite loop
on AIX to squelch the warning.

3 years agoCI: Refine C compilers handling. [skip appveyor]
Denis Ovsienko [Sun, 25 Jul 2021 22:06:11 +0000 (23:06 +0100)] 
CI: Refine C compilers handling. [skip appveyor]

In build_common.sh add minimal heuristics to print_cc_version() to help
it run the right command; add cc_id() and cc_werr_cflags() to pick the
right CFLAGS for the current compiler instead of the previously
hard-coded "-Werror". Add some comments.

In build.sh remove the CFLAGS exemptions for AIX and Solaris 9 builds,
which are in a better shape now and can complete specific subsets of the
full matrix without a warning. Set CFLAGS from cc_werr_cflags() to make
the best effort to catch as many warnings as possible. Let's see how well
that works.

3 years agoMend "make check" on Solaris 9 (Autoconf only).
Denis Ovsienko [Sun, 25 Jul 2021 13:29:02 +0000 (14:29 +0100)] 
Mend "make check" on Solaris 9 (Autoconf only).

Sun C 5.9 does not support C99. GCC 4.6.4 recognizes -std=gnu99, but
does not support the z length modifier in printf(3). In either case 18
tests fail in the following manner:

<     [...]: domain [length 0 < 12] (invalid)
---
>     [...]: domain [length 0 < zu] (invalid)

Make these tests conditional and disable them when HAVE_NO_PRINTF_Z is
defined. Modify the Autoconf leg of the build process to define the
macro when printf() does not handle %zu as expected. The CMake leg looks
broken on Solaris 9 with 2.8.9 now, so leave it be for now.

3 years agoconfigure: use AC_COMPILE_IFELSE() and AC_LANG_SOURCE() for testing flags.
Guy Harris [Sun, 25 Jul 2021 10:02:54 +0000 (03:02 -0700)] 
configure: use AC_COMPILE_IFELSE() and AC_LANG_SOURCE() for testing flags.

That lets us completely control the program that's compiled with the
compiler flag we're testing, so we can make it a minimal program that
uses only prototype declarations and that therefore won't generate
warnings with some -W flags, e.g. -Wold-style-definition, and thus won't
falsely report those flags as unsupported.

3 years agoconfigure: use ac_c_werror_flag to force unknown compiler flags to fail.
Guy Harris [Sun, 25 Jul 2021 09:22:42 +0000 (02:22 -0700)] 
configure: use ac_c_werror_flag to force unknown compiler flags to fail.

It's not a documented feature, but it's what the documented
AC_LANG_WERROR has used for 13 years, and there's no push/pop mechanism
for AC_LANG_WERROR, so you can't ensure that "fail even on warnings"
will be applied *only* in AC_LBL_CHECK_COMPILER_OPT(), as that's what we
want.  (If we can make sure that *no* compiler tests will produce
warnings, except for the ones we *want* to fail if they produce
warnings, we could just do AC_LANG_WERROR, but that might be tricky to
ensure in the general case.)

We do this because not all compilers have a command-line flag to force
all warnings, *including* warnings from unknown commad-line flags (I'm
looking at *you* IBM XL C!), so we have to have the test check to make
sure no warnings are produced (which, for AC_TRY_COMPILE(), means
"nothing is written to the standard output").

In addition, AC_TRY_COMPILE() generates a return; don't add one:

If we pass [return 0] to AC_TRY_COMPILE(), the test program it compiles
has two "return 0;" statements in a row, and one of the -W flags we
tests reports a warning for that.

We were testing whether a -W flag is supported by checking the standard
error of the compiler to see if *any* error/warning messages are
generated, and treating the flag as unsupported if any are, that meant
that -Wunreachable-code-return was be treated as unsupported even though
it *is* supported.

This should fix that.  (I'm so glad autoconf makes this all so difficult
to do correctly....)

3 years agoFixup the previous commit for GCC. [skip ci]
Denis Ovsienko [Sat, 24 Jul 2021 10:43:25 +0000 (11:43 +0100)] 
Fixup the previous commit for GCC. [skip ci]

Apparently, it does not like pragmas in the middle of a statement:

./missing/getopt_long.c: In function 'getopt_internal':
./missing/getopt_long.c:572:3: error: 'else' without a previous 'if'

3 years agoSuppress "casting away const" warnings in missing/getopt_long.c.
Guy Harris [Sat, 24 Jul 2021 08:51:02 +0000 (01:51 -0700)] 
Suppress "casting away const" warnings in missing/getopt_long.c.

It's explicitly cheating in some places; just cast away the warnings.

Add a Clang version testing macro to compiler-tests.h.

Move the diagnostic control #defines from netdissect-stdinc.h to
diag-control.h, libpcap-style, so that they can be used by code that
doesn't use (or need) netdissect-stdinc.h.  This also means that we can
limit the inclusion of diag-control.h, and the definition of those

Do them more libpcap-style, with separate DIAG_OFF/DIAG_ON pairs for
particular issues, rather than having DIAG_OFF() and DIAG_ON() macros
that take -W option names as arguments; that way, if we need to define
them for compilers that don't have the GCC/Clang syntax for those
pragmas, e.g. MSVC, we can do so.

3 years agoMakefile: Run shellcheck for build_common.sh too. [skip ci]
Denis Ovsienko [Fri, 23 Jul 2021 13:09:53 +0000 (14:09 +0100)] 
Makefile: Run shellcheck for build_common.sh too. [skip ci]

3 years agoCI: Add missing SC2006 squelch directives. [skip ci]
Denis Ovsienko [Fri, 23 Jul 2021 13:05:18 +0000 (14:05 +0100)] 
CI: Add missing SC2006 squelch directives. [skip ci]

3 years agoCI: Import recent build matrix improvements. [skip appveyor]
Denis Ovsienko [Fri, 23 Jul 2021 00:52:50 +0000 (01:52 +0100)] 
CI: Import recent build matrix improvements. [skip appveyor]

Start using build_common.sh, make default assignments early and
uniformly, use Solaris-compatible command substitution and exports,
install bc on linux-amd64, deduplicate and reformat some long commands.
Run "make -s" without CFLAGS=-Werror when warnings are expected.

This implements initial support for AIX and Solaris in the tcpdump build
matrix scripts.

* AIX 7.1
M4='/opt/freeware/bin/m4' \
MATRIX_CC='gcc' \
MATRIX_CMAKE=no \
MATRIX_BUILD_LIBPCAP=yes \
./build_matrix.sh

* Solaris 9
MATRIX_CC=gcc \
MATRIX_CMAKE=no \
MATRIX_BUILD_LIBPCAP=no \
./build_matrix.sh

* Solaris 10 and 11
MATRIX_CC='gcc' \
MATRIX_CMAKE=no \
./build_matrix.sh

3 years agoAdapt TESTrun constants for older Perl. [skip ci]
Denis Ovsienko [Fri, 23 Jul 2021 00:24:22 +0000 (01:24 +0100)] 
Adapt TESTrun constants for older Perl. [skip ci]

Solaris 9 has Perl 5.6.1, which does not support constant declaration
using a hash reference:

$ make check
./tests/TESTrun
Constant name 'HASH(0x2d8f0)' has invalid characters at ./tests/TESTrun
line 24
BEGIN failed--compilation aborted at ./tests/TESTrun line 24.
*** Error code 255
make: Fatal error: Command failed for target `check'

Declare one constant at a time to work around that and get "make check"
to start running tests (18 of which fail, but that's another issue).

3 years agoImport Autoconf/make and "make releasetar" fixes. [skip ci]
Denis Ovsienko [Thu, 22 Jul 2021 17:27:08 +0000 (18:27 +0100)] 
Import Autoconf/make and "make releasetar" fixes. [skip ci]

These have been tested in tcpslice and libpcap.

3 years ago802.11: fetch the CF and TIM IEs a field at a time.
Guy Harris [Mon, 19 Jul 2021 01:45:23 +0000 (18:45 -0700)] 
802.11: fetch the CF and TIM IEs a field at a time.

That should squelch Coverity CIDs 1487524 and 1487523; it also means
that we convert the 2-byte fields from little-endian byte order to host
order, and also avoids issues with padding in the structures we use.

3 years agoUpdate the man page timestamp. [skip ci]
Denis Ovsienko [Sun, 18 Jul 2021 22:51:38 +0000 (23:51 +0100)] 
Update the man page timestamp. [skip ci]

3 years agoFix a typo
Francois-Xavier Le Bail [Wed, 14 Jul 2021 09:14:16 +0000 (11:14 +0200)] 
Fix a typo

[skip ci]

3 years agoCI: Run "make releasetar" regardless of the OS.
Denis Ovsienko [Sun, 18 Jul 2021 00:04:13 +0000 (01:04 +0100)] 
CI: Run "make releasetar" regardless of the OS.

Same as in tcpslice.

3 years agoFix spaces
Francois-Xavier Le Bail [Tue, 13 Jul 2021 19:04:39 +0000 (21:04 +0200)] 
Fix spaces

[skip ci]

3 years agoAdd dissector for ICMP Interface Identification Object
ishaangandhi [Tue, 24 Nov 2020 16:50:18 +0000 (11:50 -0500)] 
Add dissector for ICMP Interface Identification Object

3 years agoRename MPLS Extension to Multipart Extension
ishaangandhi [Tue, 24 Nov 2020 16:49:44 +0000 (11:49 -0500)] 
Rename MPLS Extension to Multipart Extension

3 years agoMerge pull request #918 from dcaratti/gh189
Michael Richardson [Mon, 12 Jul 2021 15:27:05 +0000 (11:27 -0400)] 
Merge pull request #918 from dcaratti/gh189

mptcp: add support for MP_TCPRST

3 years agomptcp: add support for MP_TCPRST 918/head
Davide Caratti [Fri, 7 May 2021 13:42:53 +0000 (15:42 +0200)] 
mptcp: add support for MP_TCPRST

dissect the MP_TCPRST sub-option in accordance to RFC8684 ยง3.6.

Link: https://github.com/multipath-tcp/mptcp_net-next/issues/189
Signed-off-by: Davide Caratti <[email protected]>
3 years agoImprove the handling of size suffixes for -C.
Guy Harris [Sat, 10 Jul 2021 21:01:18 +0000 (14:01 -0700)] 
Improve the handling of size suffixes for -C.

Support upper-case suffixes (K/M/G) as well as lower-case suffixes.

Make sure nothing *follows* the suffix.

We don't need to check for the suffix before parsing the number; the
parsing routines stop if they see a non-digit character.

3 years agoMerge pull request #916 from stevekay/master
Guy Harris [Sat, 10 Jul 2021 20:45:10 +0000 (13:45 -0700)] 
Merge pull request #916 from stevekay/master

optional unit suffix on -C file size

3 years agoRename a test. It's about the AppleTalk protocol
Francois-Xavier Le Bail [Sat, 10 Jul 2021 18:55:10 +0000 (20:55 +0200)] 
Rename a test. It's about the AppleTalk protocol

3 years agoCI: Add back running tcpdump -J/-L and capture, now with Cirrus VMs. 925/head
Francois-Xavier Le Bail [Wed, 7 Jul 2021 16:37:12 +0000 (18:37 +0200)] 
CI: Add back running tcpdump -J/-L and capture, now with Cirrus VMs.

The Cirrus virtual machines are throwaway.

Revert partially f5739ad4cab362afdebbf3af588e9f05e0e0009b.

3 years agoPrint the supported time stamp types (-J) to stdout instead of stderr
Francois-Xavier Le Bail [Thu, 8 Jul 2021 10:26:36 +0000 (12:26 +0200)] 
Print the supported time stamp types (-J) to stdout instead of stderr

It is not an error, thus print them to stdout.

3 years agoFactorize some code
Francois-Xavier Le Bail [Thu, 8 Jul 2021 09:55:21 +0000 (11:55 +0200)] 
Factorize some code

3 years agoPrint the list of data link types (-L) to stdout instead of stderr
Francois-Xavier Le Bail [Wed, 7 Jul 2021 17:19:37 +0000 (19:19 +0200)] 
Print the list of data link types (-L) to stdout instead of stderr

It is not an error, thus print it to stdout.

3 years ago802.11: make the length in the IE structures a u_int.
Guy Harris [Tue, 6 Jul 2021 20:32:38 +0000 (13:32 -0700)] 
802.11: make the length in the IE structures a u_int.

This avoids narrowing warnings.

Clean up PRINT_RATE() a bit while we're at it (avoiding signed vs.
unsigned comparison warnings).

3 years ago802.11: no need for an element ID in the structures for IEs.
Guy Harris [Tue, 6 Jul 2021 20:27:19 +0000 (13:27 -0700)] 
802.11: no need for an element ID in the structures for IEs.

Remove the element_id member, and, instead of copying over the entire IE
header, just set the length to the value we've already fetched.

3 years agoCI: Get Travis CI vestige sorted in build.sh.
Denis Ovsienko [Mon, 5 Jul 2021 18:37:04 +0000 (19:37 +0100)] 
CI: Get Travis CI vestige sorted in build.sh.

Compiling user-provided source code and running the resulting binary
with sudo was a security problem, thus instead of fixing two no-op
blocks remove them altogether. If anyone later needs to debug features
that require higher privileges, they will need to come up with a better
solution. Simplify the debug output test condition and rephrase the
associated comment for clarity.

3 years agoCI: List shared libraries on more OSes.
Denis Ovsienko [Mon, 5 Jul 2021 17:22:23 +0000 (18:22 +0100)] 
CI: List shared libraries on more OSes.

Running ldd on Linux only originates from the Travis CI setup, where the
OS was either Linux or macOS. However, ldd is available in BSD systems
too, and macOS seems to have its own tool for the same job.

3 years agoAddress all shellcheck warnings in update-test.sh.
Denis Ovsienko [Mon, 5 Jul 2021 13:28:34 +0000 (14:28 +0100)] 
Address all shellcheck warnings in update-test.sh.

3 years agoCI: Lose the output folding props.
Denis Ovsienko [Mon, 5 Jul 2021 11:09:59 +0000 (12:09 +0100)] 
CI: Lose the output folding props.

Same as in libpcap.

3 years agoCI: Switch from bash to POSIX shell.
Denis Ovsienko [Mon, 5 Jul 2021 10:59:03 +0000 (11:59 +0100)] 
CI: Switch from bash to POSIX shell.

Same as in libpcap.

3 years agoCI: Simplify some Coverity Scan props.
Denis Ovsienko [Mon, 5 Jul 2021 10:32:03 +0000 (11:32 +0100)] 
CI: Simplify some Coverity Scan props.

Same as in libpcap.

3 years agoAppVeyor: Update Npcap SDK to 1.10
Francois-Xavier Le Bail [Sun, 4 Jul 2021 07:40:42 +0000 (09:40 +0200)] 
AppVeyor: Update Npcap SDK to 1.10

3 years agoFix the misleading comment regarding "From DS", "To DS" Frame Control Flags
Gokul Sivakumar [Sun, 27 Jun 2021 10:43:06 +0000 (16:13 +0530)] 
Fix the misleading comment regarding "From DS", "To DS" Frame Control Flags

In the case where the "From DS" bit is not set and the "To DS" bit is set
in the Frame Control Bitmask, the comment line in the corresponding if else
block was misleading that the "From DS" bit is set and the "To DS" bit is
not set.

3 years agoJuniper: Add some bounds checks
Francois-Xavier Le Bail [Wed, 23 Jun 2021 05:55:34 +0000 (07:55 +0200)] 
Juniper: Add some bounds checks

Avoid to have p (current pointer on packet data) > ndo->ndo_snapend
in isoclns_print() in some cases.

Define ND_LONGJMP_FROM_TCHECK.
Remove some trunc labels.

3 years agoCHANGES: Set the date for the 4.99.1 release
Francois-Xavier Le Bail [Thu, 10 Jun 2021 16:13:36 +0000 (18:13 +0200)] 
CHANGES: Set the date for the 4.99.1 release

3 years agoautoconf: Find a local libpcap even with rcX directory suffix
Francois-Xavier Le Bail [Mon, 7 Jun 2021 19:01:15 +0000 (21:01 +0200)] 
autoconf: Find a local libpcap even with rcX directory suffix

3 years agoAppVeyor: Update Npcap SDK to 1.07
Francois-Xavier Le Bail [Thu, 3 Jun 2021 11:14:23 +0000 (13:14 +0200)] 
AppVeyor: Update Npcap SDK to 1.07

3 years agoUse quoted include netdissect-stdinc.h instead of angle-bracketed one
Francois-Xavier Le Bail [Wed, 2 Jun 2021 09:22:46 +0000 (11:22 +0200)] 
Use quoted include netdissect-stdinc.h instead of angle-bracketed one

Same as other printers.

3 years agoMakefile.in: Add the shellcheck target
Francois-Xavier Le Bail [Tue, 1 Jun 2021 07:44:41 +0000 (09:44 +0200)] 
Makefile.in: Add the shellcheck target

Run shellcheck on the build.sh and the build_matrix.sh scripts.
(using 'gcc' format: GCC compatible output. See the shellcheck man page)

[skip ci]

3 years agobuild_matrix.sh: Fix a shellcheck warning
Francois-Xavier Le Bail [Mon, 31 May 2021 13:03:09 +0000 (15:03 +0200)] 
build_matrix.sh: Fix a shellcheck warning

The warning was:
Use "${var:?}" to ensure this never expands to /* . [SC2115]

3 years agobuild.sh: Disable a shellcheck error
Francois-Xavier Le Bail [Mon, 31 May 2021 13:01:44 +0000 (15:01 +0200)] 
build.sh: Disable a shellcheck error

We need the $@ expansion.

The error was:
Double quote array expansions to avoid re-splitting elements. [SC2068]

3 years agoMerge Readme.Win32 into doc/README.Win32.md. [skip ci]
Guy Harris [Mon, 31 May 2021 11:47:47 +0000 (04:47 -0700)] 
Merge Readme.Win32 into doc/README.Win32.md. [skip ci]

We should only have one "how to build on Windows" file.

3 years agoMakefile.in: Add the build for release candidates
Francois-Xavier Le Bail [Sun, 30 May 2021 08:40:53 +0000 (10:40 +0200)] 
Makefile.in: Add the build for release candidates

It adds rcX suffix to the version.
This avoid to manually update 'VERSION' and 'configure'.
Same as for libpcap.

3 years agoUpdate config.{guess,sub}, timestamps 2021-01-25,2021-03-10
Francois-Xavier Le Bail [Thu, 27 May 2021 15:26:38 +0000 (17:26 +0200)] 
Update config.{guess,sub}, timestamps 2021-01-25,2021-03-10

From repository git://git.savannah.gnu.org/config.git

3 years agoBGP: Use a macro for repeated identical sizeof()
Francois-Xavier Le Bail [Wed, 26 May 2021 09:06:55 +0000 (11:06 +0200)] 
BGP: Use a macro for repeated identical sizeof()

[skip ci]

3 years agoFrame Relay: make the buffer big enough for the biggest message.
Guy Harris [Wed, 26 May 2021 06:25:41 +0000 (23:25 -0700)] 
Frame Relay: make the buffer big enough for the biggest message.

3 years agoCHANGES: list the most recent change. [skip ci]
Guy Harris [Wed, 26 May 2021 05:28:09 +0000 (22:28 -0700)] 
CHANGES: list the most recent change.  [skip ci]

3 years agoFrame Relay: have q922_string() handle errors better.
Guy Harris [Wed, 26 May 2021 05:26:48 +0000 (22:26 -0700)] 
Frame Relay: have q922_string() handle errors better.

Have it return a string indicating an error, rather than a null string.

3 years agoCHANGES: update with additional changes in the 4.99 branch. [skip ci]
Guy Harris [Wed, 26 May 2021 00:53:25 +0000 (17:53 -0700)] 
CHANGES: update with additional changes in the 4.99 branch. [skip ci]

Move some from the 5.0 list to the 4.99 list.

3 years agoARP: fix overwrites of static buffer in q922_string().
Guy Harris [Tue, 25 May 2021 22:22:49 +0000 (15:22 -0700)] 
ARP: fix overwrites of static buffer in q922_string().

Don't call GET_LINKADDR_STRING() twice in a given ND_PRINT() call.

Should address another problem in GitHub issue #919.

3 years agoBGP: Fix overwrites of global 'astostr' temporary buffer
Francois-Xavier Le Bail [Tue, 25 May 2021 16:23:19 +0000 (18:23 +0200)] 
BGP: Fix overwrites of global 'astostr' temporary buffer

Remove the global 'astostr'.

Use a local 'astostr' in the functions that use it.

This should fix GitHub issue #919.

Moreover:
Rename 'asbuf' to 'astostr'.

3 years agoFix a typo
Francois-Xavier Le Bail [Sat, 22 May 2021 12:16:05 +0000 (14:16 +0200)] 
Fix a typo

[skip ci]

3 years agonetdissect.h: Keep the printers declarations names sorted
Francois-Xavier Le Bail [Sat, 22 May 2021 11:41:26 +0000 (13:41 +0200)] 
netdissect.h: Keep the printers declarations names sorted

Moreover:
Declare macsec_print() on one line.
Remove an extra space.

[skip ci]

3 years agoZephyr: Update 'length' type to unsigned
Francois-Xavier Le Bail [Sat, 22 May 2021 07:41:31 +0000 (09:41 +0200)] 
Zephyr: Update 'length' type to unsigned

It is unsigned in the calling function udp_print().

4 years agoDNS: Sync types with IANA
Matthew Martin [Tue, 9 Mar 2021 22:49:46 +0000 (16:49 -0600)] 
DNS: Sync types with IANA

IANA reference:
https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml

Remove the UNSPECA type parsing as IANA has that query type number
assigned to NID now.

4 years agosFlow: Add some spaces (style)
Francois-Xavier Le Bail [Mon, 17 May 2021 16:19:40 +0000 (18:19 +0200)] 
sFlow: Add some spaces (style)

[skip ci]

4 years agoAdd support for IPv6 agent in sFlow.
Neelabh [Thu, 3 Sep 2020 17:06:47 +0000 (22:36 +0530)] 
Add support for IPv6 agent in sFlow.

4 years agoIEEE 802.15.4: Add a bounds check
Francois-Xavier Le Bail [Fri, 14 May 2021 18:34:35 +0000 (20:34 +0200)] 
IEEE 802.15.4: Add a bounds check

This avoids to have cp (current pointer on packet data) > ndo->ndo_snapend
in hex_and_ascii_print(), via ndo_default_print(), via ND_DEFAULTPRINT(),
in some cases.

4 years agoIEEE 802.15.4: Add some bounds checks
Francois-Xavier Le Bail [Tue, 11 May 2021 10:21:28 +0000 (12:21 +0200)] 
IEEE 802.15.4: Add some bounds checks

This avoids to have cp (current pointer on packet data) > ndo->ndo_snapend
in hex_and_ascii_print(), via ndo_default_print(), via ND_DEFAULTPRINT(),
in some cases.

4 years agoRecommend using the upstream CI in CONTRIBUTING. [skip ci]
Denis Ovsienko [Tue, 11 May 2021 22:41:31 +0000 (23:41 +0100)] 
Recommend using the upstream CI in CONTRIBUTING. [skip ci]

CI configuration is a running target, and much of it works on Buildbot,
in which pull requests are the only practicable option for 3rd parties.

4 years agoZEP: Add a bounds check
Francois-Xavier Le Bail [Sun, 9 May 2021 17:48:01 +0000 (19:48 +0200)] 
ZEP: Add a bounds check

This avoids to have cp (current pointer on packet data) > ndo->ndo_snapend
in hex_and_ascii_print(), via ndo_default_print(), via ND_DEFAULTPRINT(),
in some cases.

4 years agooptional unit suffix on -C 916/head
Steve Kay [Sat, 8 May 2021 18:32:24 +0000 (14:32 -0400)] 
optional unit suffix on -C

4 years agoEthernet: Add a bounds check
Francois-Xavier Le Bail [Thu, 6 May 2021 11:39:10 +0000 (13:39 +0200)] 
Ethernet: Add a bounds check

Avoid to have p (current pointer on packet data) > ndo->ndo_snapend
in isoclns_print() in some cases.

Moreover:
Add a "FIXME" comment.

4 years agoMPTCP: parse MPC data_len field
Paolo Abeni [Tue, 23 Mar 2021 17:29:45 +0000 (18:29 +0100)] 
MPTCP: parse MPC data_len field

The RFC 8684 introduced a new field in the MPC header: the data_len.
If the client has not seen yet a DSS sub-option from the server, it
must use MPC with data_lan instead of a DSS for the first packet
carrying a data payload.

This change print the data_len, if present, after the receiver_key.

The field is already there in the existent pcap test trace, we just
need to update the expected output.

Signed-off-by: Paolo Abeni <[email protected]>
4 years agoHaiku is a supported platform. [skip ci]
Denis Ovsienko [Thu, 6 May 2021 09:07:39 +0000 (10:07 +0100)] 
Haiku is a supported platform. [skip ci]

Haiku R1/Beta 2 includes tcpdump and libpcap, even though these seem to
disregard any specified pcap filter expressions.

~> uname -a
Haiku shredder 1 hrev54154+111 Jun  7 2020 07:16 x86_64 x86_64 Haiku
~> tcpdump --version
tcpdump version 4.9.2
libpcap version 1.8.1

4 years agoRemove PLATFORMS (was merged into README.md)
Francois-Xavier Le Bail [Sun, 25 Apr 2021 18:37:28 +0000 (20:37 +0200)] 
Remove PLATFORMS (was merged into README.md)

[skip ci]

4 years agoman: Update DNS sections
Francois-Xavier Le Bail [Sun, 25 Apr 2021 18:05:45 +0000 (20:05 +0200)] 
man: Update DNS sections

The DNS transactions also take place over TCP.

Harmonize text: s/not including/excluding/ like in Name Server Responses
section.

[skip ci]

4 years agoRefine README.md and some related files. [skip ci]
Denis Ovsienko [Fri, 16 Apr 2021 17:25:11 +0000 (18:25 +0100)] 
Refine README.md and some related files. [skip ci]

Lose the README symlink, it was a bad idea of mine to add it in the
first place as it made the packaging problem space bigger, not smaller.

Remove two CI badges at the top of README.md. One badge was stale
anyway, and the other does not represent the current CI configuration,
which is bigger, changes frequently and fits the web-site much better.

Remove the reference to ITA, it has been down for quite a while, it
looks like it won't re-emerge this time.

Merge PLATFORMS into README.md.

4 years agoCirrus CI: Bump FreeBSD 13.0 up to the release.
Denis Ovsienko [Thu, 15 Apr 2021 22:22:03 +0000 (23:22 +0100)] 
Cirrus CI: Bump FreeBSD 13.0 up to the release.

4 years agoCI: Remove the unused .travis.yml. [skip ci]
Denis Ovsienko [Fri, 9 Apr 2021 22:08:43 +0000 (23:08 +0100)] 
CI: Remove the unused .travis.yml. [skip ci]

The service has been disabled for a while, s390x and AArch64 CI runs
elsewhere.

4 years agoMPTCP: Print 'Length' inside mptcp options
Michal Ruprich [Fri, 19 Mar 2021 13:39:23 +0000 (14:39 +0100)] 
MPTCP: Print 'Length' inside mptcp options

Current mptcp parser prints 'mptcp <Subtype>...' but RFC 8684 in Section
3. states that the format should be 'mptcp <Length> <Subtype>...'

4 years agoGeoNet: Add a ND_TCHECK_LEN() call
Francois-Xavier Le Bail [Wed, 31 Mar 2021 08:11:39 +0000 (10:11 +0200)] 
GeoNet: Add a ND_TCHECK_LEN() call

4 years agoForCES: Get rid of some type casts.
Denis Ovsienko [Mon, 29 Mar 2021 14:59:59 +0000 (15:59 +0100)] 
ForCES: Get rid of some type casts.

4 years agoForCES: Refine SPARSEDATA-TLV length check.
Denis Ovsienko [Mon, 29 Mar 2021 14:49:58 +0000 (15:49 +0100)] 
ForCES: Refine SPARSEDATA-TLV length check.

When ilv_valid() returns a non-zero in sdatailv_print(), the amount of
bytes declared remaining may be insufficient to contain a complete
header, let alone any data. Thus do not try to hex dump the data,
instead print an error message and be done with it.

This fixes an inconsistency discovered by Francois-Xavier.

4 years agoLose a few forward declarations in tcpdump.c.
Denis Ovsienko [Mon, 29 Mar 2021 10:23:21 +0000 (11:23 +0100)] 
Lose a few forward declarations in tcpdump.c.

Reinstate a few comments in print.c for consistency.

4 years agoSpell "indent" where it belongs.
Denis Ovsienko [Sun, 28 Mar 2021 12:44:35 +0000 (13:44 +0100)] 
Spell "indent" where it belongs.

4 years agoLose a few forward declarations in print.c.
Denis Ovsienko [Sun, 28 Mar 2021 12:22:48 +0000 (13:22 +0100)] 
Lose a few forward declarations in print.c.

4 years agoASCII/hex: Use nd_trunc_longjmp() in truncation cases
Francois-Xavier Le Bail [Sat, 27 Mar 2021 15:14:27 +0000 (16:14 +0100)] 
ASCII/hex: Use nd_trunc_longjmp() in truncation cases

In functions ascii_print(), hex_and_ascii_print_with_offset() and
hex_print_with_offset().
Therefore indirectly for the functions hex_and_ascii_print(), hex_print()
and ndo_default_print().

Even if hex_and_ascii_print(), hex_print() and ascii_print() are used in
print.c after the setjmp() block with the calls:

1) hex_and_ascii_print(ndo, "\n\t", sp, h->caplen);
2) hex_and_ascii_print(ndo, "\n\t", sp + hdrlen, h->caplen - hdrlen);
3) hex_print(ndo, "\n\t", sp, h->caplen);
4) hex_print(ndo, "\n\t", sp + hdrlen, h->caplen - hdrlen);
5) ascii_print(ndo, sp, h->caplen);
6) ascii_print(ndo, sp + hdrlen, h->caplen - hdrlen);

sp and h->caplen are unmodified, ndo->ndo_snapend was restored.

1), 3) and 5) the length to print is caplen => no truncation can occur.
2), 4) and 6) the length to print is (caplen - hdrlen) after a shift of
hdrlen => no truncation can occur.

Moreover:
Update the output of three tests accordingly.
Remove an useless comment.
Fix indentation.

4 years agoCoverity: Use an executable POSIX shell script.
Denis Ovsienko [Sun, 21 Mar 2021 13:33:36 +0000 (13:33 +0000)] 
Coverity: Use an executable POSIX shell script.

Address all shellcheck warnings.

4 years agoCI: Apply more cleanups. [skip appveyor]
Denis Ovsienko [Sun, 21 Mar 2021 12:18:35 +0000 (12:18 +0000)] 
CI: Apply more cleanups. [skip appveyor]

Lose travis-conditions in the Travis CI script. Simplify libpcap
cloning. Dissolve choose_libpcap() as it just packed two separate
single-use functions into one, also lose a temporary variable. Fixup
indentation.

4 years agoCI: Refine the build matrix scripts. [skip appveyor]
Denis Ovsienko [Sun, 21 Mar 2021 00:26:58 +0000 (00:26 +0000)] 
CI: Refine the build matrix scripts. [skip appveyor]

Reproduce the recent improvements made in tcpslice and libpcap.

4 years agoCI: Use libpcap.a on MATRIX_BUILD_LIBPCAP=yes. [skip appveyor]
Denis Ovsienko [Thu, 18 Mar 2021 02:14:37 +0000 (02:14 +0000)] 
CI: Use libpcap.a on MATRIX_BUILD_LIBPCAP=yes. [skip appveyor]

The only way to pass tests on OpenBSD is to link with the upstream
libpcap using ../libpcap/libpcap.a (hence not using CMake) because
-lpcap always results in linking with OpenBSD /usr/lib/libpcap.so
regardless of the libpcap.a and libpcap.so that build.sh installs under
/tmp/local/.

Work around by not cleaning in ../libpcap on MATRIX_BUILD_LIBPCAP=yes,
so Autoconf can pick the static library up. On MATRIX_BUILD_LIBPCAP=no
do the cleaning so it cannot.

4 years agoDon't try to run the DLT_RAW test on OpenBSD.
Denis Ovsienko [Wed, 17 Mar 2021 11:49:51 +0000 (11:49 +0000)] 
Don't try to run the DLT_RAW test on OpenBSD.

With this change tcpdump passes "make check" on OpenBSD 6.8 AMD64.

4 years agoFixup formatting in tests/*.tests.
Denis Ovsienko [Wed, 17 Mar 2021 11:29:18 +0000 (11:29 +0000)] 
Fixup formatting in tests/*.tests.

4 years agoSquelch compiler warnings on OpenBSD.
Denis Ovsienko [Wed, 17 Mar 2021 04:02:23 +0000 (04:02 +0000)] 
Squelch compiler warnings on OpenBSD.

With these changes tcpdump passes "CFLAGS=-Werror make" on OpenBSD 6.8
AMD64, so build.sh has one less reason to fail.

gcc (GCC) 4.2.1 20070719
(also from OpenBSD clang version 10.0.1 with different wording)

./addrtoname.c: In function 'etheraddr_string':
./addrtoname.c:605: warning: passing argument 2 of 'ether_ntohost'
discards qualifiers from pointer target type

./addrtoname.c: In function 'init_etherarray':
./addrtoname.c:980: warning: passing argument 2 of 'ether_ntohost'
discards qualifiers from pointer target type

./print.c: In function 'pretty_print_packet':
./print.c:389: warning: passing argument 2 of 'ts_print' from
incompatible pointer type

./bpf_dump.c:34: warning: no previous prototype for 'bpf_dump'

4 years agoCirrus CI: Relabel the tasks for consistency.
Denis Ovsienko [Wed, 17 Mar 2021 03:53:06 +0000 (03:53 +0000)] 
Cirrus CI: Relabel the tasks for consistency.

4 years agobuild.sh, build_matrix.sh: Use more the PREFIX variable
Francois-Xavier Le Bail [Sat, 13 Mar 2021 17:30:19 +0000 (18:30 +0100)] 
build.sh, build_matrix.sh: Use more the PREFIX variable

4 years agoUninstall the version stamped tcpdump
Francois-Xavier Le Bail [Sat, 13 Mar 2021 16:23:43 +0000 (17:23 +0100)] 
Uninstall the version stamped tcpdump

4 years agoFix "make clean" for out-of-tree autotools builds
Francois-Xavier Le Bail [Sat, 13 Mar 2021 15:58:10 +0000 (16:58 +0100)] 
Fix "make clean" for out-of-tree autotools builds