]> The Tcpdump Group git mirrors - tcpdump/log
tcpdump
3 years agotests: Add a pcap test for BGP link-bandwidth extended community 941/head
Donatas Abraitis [Thu, 23 Sep 2021 07:56:24 +0000 (10:56 +0300)] 
tests: Add a pcap test for BGP link-bandwidth extended community

Signed-off-by: Donatas Abraitis <[email protected]>
3 years agobgp: Decode BGP link-bandwidth extended community properly
Donatas Abraitis [Wed, 22 Sep 2021 08:30:06 +0000 (11:30 +0300)] 
bgp: Decode BGP link-bandwidth extended community properly

First two bytes are reserved for AS.

Before:
```
  Extended Community (16), length: 8, Flags [OT]:
    link-BW (0x4004), Flags [non-transitive]: bandwidth: -308754489798474897524123005616128.000 Mbps
    0x0000:  4004 fde8 47f4 2400
  Updated routes:
    192.168.10.0/23
```

After:
```
  Extended Community (16), length: 8, Flags [OT]:
    link-BW (0x4004), Flags [non-transitive]: bandwidth: 1.000 Mbps
    0x0000:  4004 fde8 47f4 2400
  Updated routes:
    192.168.10.0/23
```

Signed-off-by: Donatas Abraitis <[email protected]>
3 years agoMerge pull request #889 from westermo/dsa-vid
Michael Richardson [Wed, 6 Oct 2021 18:38:09 +0000 (14:38 -0400)] 
Merge pull request #889 from westermo/dsa-vid

DSA: Correctly determine VID

3 years agoDSA: Correctly determine VID 889/head
Tobias Waldekranz [Tue, 5 Oct 2021 20:46:40 +0000 (22:46 +0200)] 
DSA: Correctly determine VID

The 4 MSBs of the VID is stored in the lower nibble of the tag's third
byte.

Previously the priority bits where folded into the VID space, e.g. a
packet with VID=1 and priority 6 was printed as having a VID of
1537 (0x601).

Add DSA test PCAPs with packets containing a high VID and non-zero
FPri values to make sure we catch any future regressions.

Signed-off-by: Tobias Waldekranz <[email protected]>
3 years agoMove the backported items to 4.99.2 in CHANGES. [skip ci]
Denis Ovsienko [Wed, 29 Sep 2021 14:26:15 +0000 (15:26 +0100)] 
Move the backported items to 4.99.2 in CHANGES. [skip ci]

3 years agolwres: Fix a length check
Francois-Xavier Le Bail [Mon, 27 Sep 2021 13:43:32 +0000 (15:43 +0200)] 
lwres: Fix a length check

This fix some inconsistent outputs clang versus gcc in 32 bits mode.

Add a test file.

3 years agoCI: Refine GCC identification. [skip appveyor]
Denis Ovsienko [Wed, 15 Sep 2021 08:54:11 +0000 (09:54 +0100)] 
CI: Refine GCC identification. [skip appveyor]

Same as in libpcap.

3 years agoMerge pull request #926 from gokulkumar792/print_Block_Ack_TA_field
Guy Harris [Mon, 13 Sep 2021 21:50:43 +0000 (14:50 -0700)] 
Merge pull request #926 from gokulkumar792/print_Block_Ack_TA_field

IEEE 802.11: include the "TA" field while printing Block Ack Control frame

3 years agoRemove last remaining trailing whitespace
a1346054 [Fri, 3 Sep 2021 21:18:14 +0000 (21:18 +0000)] 
Remove last remaining trailing whitespace

3 years agoMerge pull request #924 from gokulkumar792/print_meshid
Michael Richardson [Wed, 25 Aug 2021 15:44:08 +0000 (11:44 -0400)] 
Merge pull request #924 from gokulkumar792/print_meshid

IEEE 802.11: include the "Mesh ID" field while printing management frames

3 years agoIEEE 802.11: Add a test to check the 802.11s Mesh ID in management frames 924/head
Gokul Sivakumar [Sun, 4 Jul 2021 12:54:57 +0000 (18:24 +0530)] 
IEEE 802.11: Add a test to check the 802.11s Mesh ID in management frames

The newly added pcap file contains a Mesh Beacon frame, a Wildcard Probe
Request and a Mesh Probe Response. The test case checks if the "Mesh ID"
field is properly parsed by the IEEE 802.11 printer.

3 years agoIEEE 802.11: include the "Mesh ID" field while printing management frames
Gokul Sivakumar [Sun, 4 Jul 2021 12:54:19 +0000 (18:24 +0530)] 
IEEE 802.11: include the "Mesh ID" field while printing management frames

In an 802.11s mesh network, on detecting that the Beacon and Probe Response
frames transmitted has a non-zero length "Mesh ID", print it.

3 years agoMPTCP: Add missing MP_CAPABLE Flags 934/head
Rui [Mon, 16 Aug 2021 18:36:00 +0000 (19:36 +0100)] 
MPTCP: Add missing MP_CAPABLE Flags

Parse previous ignored flags from MP_CAPABLE option

3 years agoCI: Add MAKE_BIN to allow non-default makes. [skip ci]
Denis Ovsienko [Tue, 17 Aug 2021 19:35:21 +0000 (20:35 +0100)] 
CI: Add MAKE_BIN to allow non-default makes. [skip ci]

This way parallel builds are simpler on Solaris and OpenIndiana.

3 years agoDocument some OpenIndiana particulars. [skip ci]
Denis Ovsienko [Tue, 17 Aug 2021 16:39:47 +0000 (17:39 +0100)] 
Document some OpenIndiana particulars. [skip ci]

3 years agoCI: Clean in ../libpcap only if present. [skip ci]
Denis Ovsienko [Tue, 17 Aug 2021 16:20:32 +0000 (17:20 +0100)] 
CI: Clean in ../libpcap only if present. [skip ci]

./build_matrix.sh[89]: cd: /export/home/denis/libpcap: [No such file or
  directory]

3 years agoFixup commit 604cd4a for OpenIndiana.
Denis Ovsienko [Mon, 16 Aug 2021 22:47:07 +0000 (23:47 +0100)] 
Fixup commit 604cd4a for OpenIndiana.

SunOS openindiana 5.11 illumos-755ccbcfa2 i86pc i386 i86pc
gcc (OpenIndiana 10.3.0-oi-0) 10.3.0

As it turns out, in OpenIndiana 2021.04 ND_UNREACHABLE is one of the
neighbour discovery states in <net/if.h>:

In file included from ./extract.h:40,
                 from ./addrtoname.h:22,
                 from ./addrtoname.c:112:
./diag-control.h:181: warning: "ND_UNREACHABLE" redefined

In file included from ./addrtoname.c:87:
/usr/include/net/if.h:307: note: this is the location of the previous
  definition

In file included from ./extract.h:40,
                 from ./addrtoname.h:22,
                 from ./print-sll.c:36:
./diag-control.h:181: warning: "ND_UNREACHABLE" redefined

In file included from ./print-sll.c:29:
/usr/include/net/if.h:307: note: this is the location of the previous
  definition

3 years agoUse more the ND_TCHECK_1() macro
Francois-Xavier Le Bail [Sun, 15 Aug 2021 11:04:42 +0000 (13:04 +0200)] 
Use more the ND_TCHECK_1() macro

This is a follow-up to 7b7b84716e604abd8bd92cee75e6385cab6ce3dc.

3 years agoUse more the ND_TCHECK_1() macro
Francois-Xavier Le Bail [Sun, 15 Aug 2021 09:20:12 +0000 (11:20 +0200)] 
Use more the ND_TCHECK_1() macro

This is a follow-up to 880b867ee73ae757faebbab13213c7d4079222a5.

3 years agoUse __builtin_unreachable(). [skip ci]
Denis Ovsienko [Sun, 15 Aug 2021 09:54:50 +0000 (10:54 +0100)] 
Use __builtin_unreachable(). [skip ci]

Same as in libpcap.

3 years agoRemove the space I added to provoke a rebuild.
Guy Harris [Wed, 11 Aug 2021 23:37:34 +0000 (16:37 -0700)] 
Remove the space I added to provoke a rebuild.

(This should also provoke a rebuild; the NetBSD libpcap build should no
longer have the issue that caused tcpdump to fail when built with it.)

3 years agoAdd a space at the end of the first line, to provoke a build.
Guy Harris [Wed, 11 Aug 2021 10:18:54 +0000 (03:18 -0700)] 
Add a space at the end of the first line, to provoke a build.

(There doesn't appear to be an obvious way to force a rebuild, and a
change to libpcap doesn't force a rebuild of programs such as tcpdump
for which the CI build includes a build with the tip of the main branch
of libpcap.)

3 years agoConsistenly use "XYZZY compiler M.N and later". [skip ci]
Guy Harris [Wed, 11 Aug 2021 08:50:47 +0000 (01:50 -0700)] 
Consistenly use "XYZZY compiler M.N and later".  [skip ci]

Use that rather than "... or later".

3 years agoGet rid of duplicate definition of __has_attribute.
Guy Harris [Wed, 11 Aug 2021 08:44:51 +0000 (01:44 -0700)] 
Get rid of duplicate definition of __has_attribute.

compiler-tests.h already checks whether __has_attribute and, if not,
defines it as a macro that always returns 0 (so that we use the "what
version of the compiler is this?" fallback checks for a given
attribute).  We include compiler-tests.h before we define
__has_attribute ourselves, so we don't need to do it ourselves.

3 years agoFix a comment. [skip ci]
Guy Harris [Wed, 11 Aug 2021 08:28:42 +0000 (01:28 -0700)] 
Fix a comment.  [skip ci]

3 years agoMake the tests a bit easier to read.
Guy Harris [Wed, 11 Aug 2021 08:05:52 +0000 (01:05 -0700)] 
Make the tests a bit easier to read.

Add comments and indentation.

Handle XL C a bit more like the other compilers.  Make the first test be
"is this someting that's not XL C", as is the case for other compilers;
that test is done as "are both __xlC__ and __ibmxl__ undefined".  If
either of them are defined, use __ibmxl_version__ if __ibmxl__ is
defined, and use __xlC__ otherwise.

3 years agoDo not define __EXTENSIONS__ if already defined. [skip ci]
Denis Ovsienko [Tue, 10 Aug 2021 09:18:19 +0000 (10:18 +0100)] 
Do not define __EXTENSIONS__ if already defined. [skip ci]

SunOS solaris11-amd64 5.11 11.4.0.15.0 i86pc i386 i86pc
clang version 6.0.0 (tags/RELEASE_600/final)

Every .c file that included netdissect-stdinc.h generated a warning:

In file included from ./netdissect-stdinc.h:42:
./ftmacros.h:48:11: warning: '__EXTENSIONS__' macro redefined
      [-Wmacro-redefined]
<built-in>:345:9: note: previous definition is here

3 years agoTell CMake not to check for a C++ compiler.
Guy Harris [Sun, 8 Aug 2021 18:54:17 +0000 (11:54 -0700)] 
Tell CMake not to check for a C++ compiler.

We only need a C compiler, and if either

1) the C and C++ compilers don't match (e.g., a defaults-to-64-bit GCC
and a defaults-to-32-bit Oracle Studio C++)

or

2) you set CFLAGS in the environment to force a 64-bit build but don't
also set CXXFLAGS

CMake will get confused and think it's doing a 32-bit build even though
we'll be doing a 64-bit build, and all sorts of weirdness will occur.

Just say "C" in the project() command.

3 years agoOn Solaris, for 64-bit builds, use the 64-bit pcap-config.
Guy Harris [Sun, 8 Aug 2021 07:36:42 +0000 (00:36 -0700)] 
On Solaris, for 64-bit builds, use the 64-bit pcap-config.

There are two versions of pcap-config supplied on Solaris (or, at least,
on 64-bit Solaris) - a version that has the right --libs output to find
the 32-bit libraries and a version that has the right --libs output to
find the 64-bit libraries.

Try to figure out whether we're doing a 32-bit or 64-bit build (based on
the pointer size) and, for 64-bit builds, run the 64-bit version of
pcap-config.

3 years agoUse basename() and dirname() right on FreeBSD. [skip appveyor]
Denis Ovsienko [Thu, 5 Aug 2021 13:18:55 +0000 (14:18 +0100)] 
Use basename() and dirname() right on FreeBSD. [skip appveyor]

On FreeBSD CMake runs Clang with -std=gnu99, which used to emit three
warnings in a Capsicum-specific block along the following lines:

tcpdump.c:2432:32: warning: '_Generic' is a C11 extension
  [-Wc11-extensions]
/usr/include/libgen.h:61:21: note: expanded from macro 'basename'
  basename)(x)
/usr/include/sys/cdefs.h:325:2: note: expanded from macro '__generic'
        _Generic(expr, t: yes, default: no)

(In the same context Autoconf does not request a specific C standard
from Clang, so it happens to use C17 and there is no warning.)

Type-generic expressions support in C99 mode seems to be a quirk of
Clang that cannot be disabled and is harmless in this context, so
introduce and use another pair of diagnostic control macros (for Clang
only) to squelch the warnings.

While at it, study the reason for _Generic use in /usr/include/libgen.h
and realize that tcpdump.c still assumes the behaviour before FreeBSD
12.0.  Add two temporary buffers around basename() and dirname() calls
to get consistent results regardless of which FreeBSD version it is.

Remove the last remaining exemption rule.

3 years agoFix auto-enabling of Capsicum on FreeBSD with Autoconf. [skip appveyor]
Denis Ovsienko [Tue, 3 Aug 2021 23:20:36 +0000 (00:20 +0100)] 
Fix auto-enabling of Capsicum on FreeBSD with Autoconf. [skip appveyor]

Even after commit 6393bb6 --with-sandbox-capsicum didn't work entirely
as documented, as it defaulted to disabled:

checking whether to sandbox using capsicum... no
checking whether to sandbox using Casper library... no

Get the test condition right so it does what it says:

checking sys/capsicum.h usability... yes
checking sys/capsicum.h presence... yes
checking for sys/capsicum.h... yes
checking for cap_enter... yes
checking for cap_rights_limit... yes
checking for cap_ioctls_limit... yes
checking for openat... yes
checking for cap_init in -lcasper... yes
checking for cap_gethostbyaddr in -lcap_dns... yes
checking whether to sandbox using capsicum... yes
checking whether to sandbox using Casper library... yes

3 years agoSquelch a warning with Capsicum enabled. [skip appveyor]
Denis Ovsienko [Tue, 3 Aug 2021 22:38:48 +0000 (23:38 +0100)] 
Squelch a warning with Capsicum enabled. [skip appveyor]

The Capsicum workaround I added in commit 706c79e causes a side effect
on FreeBSD 11.4, 12.2 and 13.0 with local libpcap when Capsicum is
enabled, that is, in CMake builds (Capsicum detection is broken in
Autoconf builds, as it turns out).  Add a workaround for the side effect
as well and get rid of another warning and respective exemption:

tcpdump.c:2286:3: warning: implicit declaration of function 'bpf_dump'
  is invalid in C99 [-Wimplicit-function-declaration]

3 years agoCMake: Fix EXTRA_CFLAGS after commit cae0c65. [skip appveyor]
Denis Ovsienko [Tue, 3 Aug 2021 22:25:02 +0000 (23:25 +0100)] 
CMake: Fix EXTRA_CFLAGS after commit cae0c65. [skip appveyor]

Same as in libpcap.

3 years agoconfigure: special-case macOS /usr/bin/pcap-config as we do in CMake.
Guy Harris [Tue, 3 Aug 2021 19:58:34 +0000 (12:58 -0700)] 
configure: special-case macOS /usr/bin/pcap-config as we do in CMake.

macOS's /usr/bin/pcap-config is incorrectly generated - pcap-config
--cflags includes -I/usr/local/include and pcap-config --libs includes
-L/usr/local/lib, even though it's the pcap-config file for the libpcap
that comes with the OS and should omit those.

3 years agoDefine PRINTFLIKE_FUNCPTR() exactly for XL C. [skip appveyor]
Denis Ovsienko [Tue, 3 Aug 2021 17:23:13 +0000 (18:23 +0100)] 
Define PRINTFLIKE_FUNCPTR() exactly for XL C. [skip appveyor]

XL C full version consists of 4 numbers.  Introduce an additional macro
for testing the two least significant numbers.  Using the fix lists
published by IBM, tell XL C 16.1 that has the bug interpreting the
__format__ attribute of a function pointer from XL C 16.1 that has not.
Rejig the #if block to make it easier to follow.

3 years agoCI: Get randomness right in mktempdir_diy(). [skip ci]
Denis Ovsienko [Tue, 3 Aug 2021 14:36:31 +0000 (15:36 +0100)] 
CI: Get randomness right in mktempdir_diy(). [skip ci]

Same as in tcpslice.

3 years agoCI: Put a misplaced comment right in build.sh. [skip ci]
Denis Ovsienko [Tue, 3 Aug 2021 14:31:54 +0000 (15:31 +0100)] 
CI: Put a misplaced comment right in build.sh. [skip ci]

The script both assigns and uses TCPDUMP_BIN, so it is the export line
that is purposed for TESTrun rather than the variable assignment.

3 years agoMove capdns from tcpdump.c to addrtoname.c.
Denis Ovsienko [Sun, 1 Aug 2021 23:32:46 +0000 (00:32 +0100)] 
Move capdns from tcpdump.c to addrtoname.c.

Address the warning below (specific to a few versions of Clang, CMake
and FreeBSD) and update the exemption rule comment in build.sh.

tcpdump.c:244:16: warning: no previous extern declaration for non-static
  variable 'capdns' [-Wmissing-variable-declarations]

3 years agoCMake: Handle EXTRA_CFLAGS w/o add_compile_options(). [skip ci]
Denis Ovsienko [Sat, 31 Jul 2021 20:35:17 +0000 (21:35 +0100)] 
CMake: Handle EXTRA_CFLAGS w/o add_compile_options(). [skip ci]

Same as in libpcap commit 29d7856.

3 years agoLose two unused macros in diag-control.h. [skip ci]
Denis Ovsienko [Sat, 31 Jul 2021 20:04:11 +0000 (21:04 +0100)] 
Lose two unused macros in diag-control.h. [skip ci]

3 years agoCI: Explain useful side effects of "-D" and "-J". [skip ci]
Denis Ovsienko [Fri, 30 Jul 2021 15:20:34 +0000 (16:20 +0100)] 
CI: Explain useful side effects of "-D" and "-J". [skip ci]

3 years agoCMake: Add a way to request -Werror and equivalents.
Denis Ovsienko [Fri, 30 Jul 2021 09:12:59 +0000 (10:12 +0100)] 
CMake: Add a way to request -Werror and equivalents.

As it turns out, most FreeBSD/CMake tcpdump builds were emitting some
warnings.  This was difficult to notice because make returned success
regardless of the warnings because the compiler never received -Werror
because there was no way to tell CMake to append any compiler flags at
the build time, but not at the buildsystem generation time.  In other
words, the command "make CFLAGS=-Werror" had the same effect as just
"make".

Implement the desired behaviour with "cmake -DEXTRA_CFLAGS='xyz'" and
set the variable in build.sh when and as required.  Reword the comment
for clarity and define two known exemptions.

3 years agoCI: Port recent improvements from tcpslice. [skip appveyor]
Denis Ovsienko [Fri, 30 Jul 2021 08:44:04 +0000 (09:44 +0100)] 
CI: Port recent improvements from tcpslice. [skip appveyor]

Introduce TCPDUMP_TAINTED, improve OS and compiler identification, print
matrix progress to stderr.

3 years agoCirrus CI: Fixup the previous commit. [skip appveyor]
Denis Ovsienko [Thu, 29 Jul 2021 20:20:00 +0000 (21:20 +0100)] 
Cirrus CI: Fixup the previous commit. [skip appveyor]

Failed to start an instance: [...]
Number of vCPUs should be multiple of 2 if greater than 2, while 3.0 is
requested. Memory size for 3.0 vCPU instance should be between 2816MiB
and 19968MiB, while 2048MiB is requested.

3 years agonetdissect.h requires funcattrs.h
Denis Ovsienko [Thu, 29 Jul 2021 20:12:06 +0000 (21:12 +0100)] 
netdissect.h requires funcattrs.h

...because the former uses PRINTFLIKE_FUNCPTR().  However, it didn't
have the #include.  However, the problem was not visible because most
files that included netdissect.h also included (directly or through
another header) funcattrs.h beforehand.  The only exceptions were the
following two files, which apparently have not been compiled anywhere
for a long time:

In file included from missing/strdup.c:38:
./netdissect.h:254:8: error: expected ':', ',', ';', '}' or
'__attribute__' before 'PRINTFLIKE_FUNCPTR'

In file included from missing/snprintf.c:45:
./netdissect.h:254:8: error: expected ':', ',', ';', '}' or
'__attribute__' before 'PRINTFLIKE_FUNCPTR'

Add the missing #include to netdissect.h to eliminate this space for
failure.

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