git: 6af32a9d37ad - stable/15 - tcpdump: Update to 4.99.6

From: Joseph Mingrone <jrm_at_FreeBSD.org>
Date: Mon, 06 Apr 2026 21:03:52 UTC
The branch stable/15 has been updated by jrm:

URL: https://cgit.FreeBSD.org/src/commit/?id=6af32a9d37ad689a9a72c45bfeaa6f7e52a33a4f

commit 6af32a9d37ad689a9a72c45bfeaa6f7e52a33a4f
Author:     Joseph Mingrone <jrm@FreeBSD.org>
AuthorDate: 2026-03-16 02:22:18 +0000
Commit:     Joseph Mingrone <jrm@FreeBSD.org>
CommitDate: 2026-04-06 19:42:59 +0000

    tcpdump: Update to 4.99.6
    
    Changes:        https://github.com/the-tcpdump-group/tcpdump/blob/tcpdump-4.99/CHANGES
    Obtained from:  https://www.tcpdump.org/release/tcpdump-4.99.6.tar.xz
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D55578
    Differential Revision:  https://reviews.freebsd.org/D55871
    
    (cherry picked from commit e6083790f217ba7f89cd2957922bd45e35466359)
---
 contrib/tcpdump/CHANGES                      |  78 +++-
 contrib/tcpdump/CMakeLists.txt               | 186 ++++++----
 contrib/tcpdump/CONTRIBUTING.md              |   2 +-
 contrib/tcpdump/INSTALL.md                   |   4 +
 contrib/tcpdump/Makefile.in                  |  28 +-
 contrib/tcpdump/README.md                    |   2 +-
 contrib/tcpdump/VERSION                      |   2 +-
 contrib/tcpdump/addrtostr.c                  |   8 +-
 contrib/tcpdump/autogen.sh                   |  41 ++-
 contrib/tcpdump/checksum.c                   |  24 +-
 contrib/tcpdump/cmake/Modules/FindPCAP.cmake |  36 ++
 contrib/tcpdump/cmakeconfig.h.in             |   5 +
 contrib/tcpdump/config.h.in                  |  11 +-
 contrib/tcpdump/configure                    | 136 +++++--
 contrib/tcpdump/configure.ac                 |  50 ++-
 contrib/tcpdump/diag-control.h               |  30 +-
 contrib/tcpdump/doc/README.NetBSD.md         |  22 --
 contrib/tcpdump/doc/README.aix.md            |  17 -
 contrib/tcpdump/doc/README.haiku.md          |  33 --
 contrib/tcpdump/doc/README.solaris.md        |  46 ---
 contrib/tcpdump/extract.h                    |   6 +-
 contrib/tcpdump/ipproto.c                    |   3 +-
 contrib/tcpdump/ipproto.h                    |   2 +-
 contrib/tcpdump/missing/getopt_long.h        |   2 +-
 contrib/tcpdump/missing/snprintf.c           | 508 ---------------------------
 contrib/tcpdump/netdissect-stdinc.h          |  15 -
 contrib/tcpdump/netdissect.c                 |   2 +-
 contrib/tcpdump/netdissect.h                 |  24 +-
 contrib/tcpdump/nfs.h                        |   2 +-
 contrib/tcpdump/ntp.c                        |  26 +-
 contrib/tcpdump/ntp.h                        |   2 +
 contrib/tcpdump/parsenfsfh.c                 |  17 +-
 contrib/tcpdump/print-802_11.c               |   2 +-
 contrib/tcpdump/print-arista.c               |  19 +-
 contrib/tcpdump/print-ascii.c                |  20 +-
 contrib/tcpdump/print-bootp.c                | 117 +++---
 contrib/tcpdump/print-domain.c               |  10 +-
 contrib/tcpdump/print-egp.c                  | 186 +++++-----
 contrib/tcpdump/print-frag6.c                |   3 +
 contrib/tcpdump/print-icmp6.c                | 187 +++++-----
 contrib/tcpdump/print-ip.c                   |  22 +-
 contrib/tcpdump/print-ip6.c                  |   8 +-
 contrib/tcpdump/print-ip6opts.c              | 129 +++----
 contrib/tcpdump/print-isakmp.c               |   8 +-
 contrib/tcpdump/print-isoclns.c              |  82 ++---
 contrib/tcpdump/print-juniper.c              |   4 +-
 contrib/tcpdump/print-lspping.c              |   5 +-
 contrib/tcpdump/print-lwapp.c                |  86 ++---
 contrib/tcpdump/print-mobility.c             | 138 +++-----
 contrib/tcpdump/print-msdp.c                 |  51 ++-
 contrib/tcpdump/print-ntp.c                  |   4 +-
 contrib/tcpdump/print-otv.c                  |  74 ----
 contrib/tcpdump/print-pflog.c                |   2 +-
 contrib/tcpdump/print-ppp.c                  |   2 -
 contrib/tcpdump/print-ptp.c                  |  80 +++--
 contrib/tcpdump/print-raw.c                  |   2 +-
 contrib/tcpdump/print-sunrpc.c               |   2 +-
 contrib/tcpdump/print-tcp.c                  |  60 ++--
 contrib/tcpdump/print-udp.c                  |   4 +-
 contrib/tcpdump/print-zep.c                  |  42 +--
 contrib/tcpdump/rpc_auth.h                   |   2 +-
 contrib/tcpdump/rpc_msg.h                    |   2 +-
 contrib/tcpdump/tcpdump.1.in                 |  68 +++-
 contrib/tcpdump/tcpdump.c                    | 358 ++++++++++++++++---
 contrib/tcpdump/timeval-operations.h         |   2 +
 contrib/tcpdump/udp.h                        |   4 +-
 contrib/tcpdump/util-print.c                 |  63 ++--
 usr.sbin/tcpdump/tcpdump/Makefile            |   1 -
 usr.sbin/tcpdump/tcpdump/config.h            |  42 +--
 69 files changed, 1592 insertions(+), 1669 deletions(-)

diff --git a/contrib/tcpdump/CHANGES b/contrib/tcpdump/CHANGES
index b63d1eb658d3..72496fde7a43 100644
--- a/contrib/tcpdump/CHANGES
+++ b/contrib/tcpdump/CHANGES
@@ -1,3 +1,76 @@
+Tuesday, December 30, 2025 / The Tcpdump Group
+  Summary for 4.99.6 tcpdump release
+    Remove protocol decoding for:
+      OTV (draft-hasmit-otv-04, this Internet-Draft is no longer active).
+    Refine protocol decoding for:
+      DNS: Use ND_TCHECK_LEN() instead of a custom bounds check.
+      IPv6: Add a missing comma and remove a colon in the output.
+      TCP: Note if the Urgent Pointer is non-zero while URG flag not set,
+           if the verbose level is > 1 (option -vv and more).
+      TCP: Note if the Acknowledgment Number is non-zero while ACK flag not set,
+           if the verbose level is > 1 (option -vv and more).
+      TCP: Fix Reset segment processing.
+      IP, IPv6: Fix setting the snapshot length for the payload.
+      IP: Use ND_TTEST_LEN() instead of a custom bounds check.
+      frag6: Add a bounds check in non-verbose mode.
+      PTP: Remove spaces before colons in output.
+      PTP: Fix management packet fields.
+      ISO: Avoid undefined behavior and integer overflow in the Fletcher
+           checksum calculation.
+      NFS: Delete dead code.
+      BOOTP: Use an uint16_t variable to get the result of a GET_BE_U_2().
+      ZEP: use the existing NTP time formatting code.
+      NTP: Fix p_ntp_time_fmt() using epoch 1/epoch 2 convention (RFC 4330).
+      NTP: Update a field name with the RFC 5905 name (Origin Timestamp).
+      IPv6 mobility: Modernize packet parsing and make fixes.
+      IP6OPTS: Modernize packet parsing and make fixes.
+      VXLAN: Add UDP port 8472 used by Linux as the default port.
+      EGP: Replace custom code with tok2str(); Modernize packet parsing and
+        fix printing with -v option.
+    User interface:
+      Add optional unit suffix on -C file size.
+      Improve the handling of size suffixes for -C.
+      Print errors for options -A, -x[x] and -X[X] (mutually exclusive).
+      Print errors about -C, -G and -z options usage.
+      For PCAP_ERROR_CAPTURE_NOTSUP, show the error message provided
+        by libpcap for that error if it's non-empty.
+      Update the -z option processing. Print "invalid option -- z" when it is.
+      Add the -g option, causing IPv4 output in verbose mode to be on one line.
+    Other:
+      Avoid race condition when receiving signal during shutdown.
+      Always show the interface name in error messages when the
+        interface can't be opened.
+      Clean up the message shown if a -i flag is specified with an
+        interface index that's too large.
+    Source code:
+      Fix '-tt' option printing when time > 2106-02-07T06:28:15Z.
+      Add sub-second packet timestamp checks for invalid micro/nano.
+      Remove unused missing/snprintf.c.
+      Fix incompatible pointer types with time functions calls on Windows.
+      Use C99 macros to define 64-bit constants and maximum 64-bit values.
+    Windows:
+      Fixed to find wpcap.dll if WinPcap isn't installed and Npcap was
+        installed without the WinPcap API compatibility option. (GitHub
+        issue #1226).
+    Building and testing:
+      Makefile.in: Use a local libpcap in the releasecheck target.
+      CMake: Fix build with CMake 3.31.
+      autotools, CMake: don't separately test whether snprintf(3) is
+        available and whether it's suitable - the test for whether it's
+        suitable also fails if it's unavailable.
+      CMake: Skip snprintf(3) tests when cross-compiling.
+      autotools, CMake: fix issues with snprintf test and sanitizers.
+      CMake: check whether check_c_source_runs() works, treat the build
+        as a cross-compile if it doesn't work.
+      Autoconf: Use AC_SYS_YEAR2038_RECOMMENDED when possible if the
+        environment variable BUILD_YEAR2038 = yes (via autogen.sh).
+      Autoconf: Avoid incorrectly include the libpcap's config.h.
+      Autoconf: Refine reporting of os-proto.h.
+      Require config.h to be from the tcpdump build.
+      AppVeyor: Update Npcap SDK to 1.15.
+      autogen.sh: Allow to configure Autoconf warnings.
+      autogen.sh: Delete all trailing blank lines at end of configure.
+
 Friday, August 30, 2024 / The Tcpdump Group
   Summary for 4.99.5 tcpdump release
     Refine protocol decoding for:
@@ -38,7 +111,7 @@ Friday, August 30, 2024 / The Tcpdump Group
       OSPF: Pad TLVs in LS_OPAQUE_TYPE_RI to multiples of 4 bytes.
       OSPF: Update LS-Ack printing not to run off the end of the packet.
       OSPF6: Fix an undefined behavior.
-      pflog: use nd_ types in struct pfloghdr.
+      pflog: Use nd_ types in struct pfloghdr.
       PPP: Check if there is some data to hexdump.
       PPP: Remove an extra colon before LCP Callback Operation.
       Use the buffer stack for de-escaping PPP; fixes CVE-2024-2397;
@@ -122,6 +195,7 @@ Friday, August 30, 2024 / The Tcpdump Group
       Make various improvements to the man page.
       Add initial README file for Haiku.
       Make various improvements to CONTRIBUTING.md.
+      man: Clarify the "any" pseudo-interface further.
 
 Friday, April 7, 2023 / The Tcpdump Group
   Summary for 4.99.4 tcpdump release
@@ -179,7 +253,7 @@ Saturday, December 31, 2022 / The Tcpdump Group
       802.11: Fetch the CF and TIM IEs a field at a time.
       802.15.4, BGP, LISP: fix some length checks, compiler warnings,
         and undefined behavior warnings.
-      PFLOG: handle LINKTYPE_PFLOG/DLT_PFLOG files from all OSes on all
+      PFLOG: Handle LINKTYPE_PFLOG/DLT_PFLOG files from all OSes on all
         OSes.
       RRCP: support more Realtek protocols than just RRCP.
       MPLS: show the EXP field as TC, as per RFC 5462.
diff --git a/contrib/tcpdump/CMakeLists.txt b/contrib/tcpdump/CMakeLists.txt
index f9071295eff1..6b8647201038 100644
--- a/contrib/tcpdump/CMakeLists.txt
+++ b/contrib/tcpdump/CMakeLists.txt
@@ -13,14 +13,21 @@ else(WIN32)
     #  on a "long-term support" version # of some OS and that
     #  version supplies an older version of CMake;
     #
-    #  otherwise, require 3.5, so we don't get messages warning
-    #  that support for versions of CMake lower than 3.5 is
+    #  otherwise, if it's a version less than 3.10, require only
+    #  3.5, just in case somebody is configuring with CMake
+    #  on a "long-term support" version # of some OS and that
+    #  version supplies an older version of CMake;
+    #
+    #  otherwise, require 3.10, so we don't get messages warning
+    #  that support for versions of CMake lower than 3.10 is
     #  deprecated.
     #
     if(CMAKE_VERSION VERSION_LESS "3.5")
         cmake_minimum_required(VERSION 2.8.12)
-    else()
+    elseif(CMAKE_VERSION VERSION_LESS "3.10")
         cmake_minimum_required(VERSION 3.5)
+    else()
+        cmake_minimum_required(VERSION 3.10)
     endif()
 endif(WIN32)
 
@@ -392,6 +399,35 @@ if(MSVC)
    endif (USE_STATIC_RT)
 endif(MSVC)
 
+#
+# CMake's definition of "cross-compiling" appears to be "compiling
+# for an *operating system* other than the one on which the build
+# is being done*.
+#
+# This is an inadequate definition, as people build for the same
+# operating system but a different instruction set, e.g. building
+# on an IA-32 or x86-64 Linux box for an Arm embedded Linux box,
+# or building Arm code on an IA-32 or x86-64 Windows box.
+#
+# So just test whether check_c_source_runs() on a trivial program
+# works; if not, it's probably because the generated code won't
+# run on the platform on which we're running.
+#
+include(CheckCSourceRuns)
+if (NOT CMAKE_CROSSCOMPILING)
+    check_c_source_runs("
+    int main()
+    {
+        return 0;
+    }
+    "
+        CHECK_C_SOURCE_RUNS_WORKS
+    )
+    if (NOT CHECK_C_SOURCE_RUNS_WORKS)
+        set(CMAKE_CROSSCOMPILING TRUE)
+    endif()
+endif()
+
 ###################################################################
 #   Detect available platform features
 ###################################################################
@@ -407,11 +443,16 @@ include(CheckVariableExists)
 include(CheckTypeSize)
 
 #
-# Get the size of a time_t, to know whether it's 32-bit or 64-bit.
+# Get the size of a time_t, to know whether it's 32-bit or 64-bit. Print it.
 #
 cmake_push_check_state()
 set(CMAKE_EXTRA_INCLUDE_FILES time.h)
 check_type_size("time_t" SIZEOF_TIME_T)
+if(SIZEOF_TIME_T EQUAL 4)
+  message(STATUS "32-bit time_t")
+elseif(SIZEOF_TIME_T EQUAL 8)
+  message(STATUS "64-bit time_t")
+endif()
 cmake_pop_check_state()
 
 #
@@ -493,67 +534,77 @@ else(STDLIBS_HAVE_GETSERVENT)
 endif(STDLIBS_HAVE_GETSERVENT)
 cmake_pop_check_state()
 
-#
-# Make sure we have snprintf(); we require it.
-# We use check_symbol_exists(), as it isn't necessarily an external
-# function - in Visual Studio, for example, it is an inline function
-# calling an external function.
-#
-check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
-if(NOT HAVE_SNPRINTF)
-    message(FATAL_ERROR "snprintf() is required but wasn't found")
-endif()
-
-#
-# Require a proof of suitable snprintf(3), same as in Autoconf.
-#
-include(CheckCSourceRuns)
-check_c_source_runs("
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-#include <sys/types.h>
-
-int main()
-{
-  char buf[100];
-  uint64_t t = (uint64_t)1 << 32;
-
-  snprintf(buf, sizeof(buf), \"%zu\", sizeof(buf));
-  if (strncmp(buf, \"100\", sizeof(buf)))
-    return 1;
-
-  snprintf(buf, sizeof(buf), \"%zd\", -sizeof(buf));
-  if (strncmp(buf, \"-100\", sizeof(buf)))
-    return 2;
-
-  snprintf(buf, sizeof(buf), \"%\" PRId64, -t);
-  if (strncmp(buf, \"-4294967296\", sizeof(buf)))
-    return 3;
-
-  snprintf(buf, sizeof(buf), \"0o%\" PRIo64, t);
-  if (strncmp(buf, \"0o40000000000\", sizeof(buf)))
-    return 4;
-
-  snprintf(buf, sizeof(buf), \"0x%\" PRIx64, t);
-  if (strncmp(buf, \"0x100000000\", sizeof(buf)))
-    return 5;
-
-  snprintf(buf, sizeof(buf), \"%\" PRIu64, t);
-  if (strncmp(buf, \"4294967296\", sizeof(buf)))
-    return 6;
-
-  return 0;
-}
-
-"
-    SUITABLE_SNPRINTF
-)
-if(NOT SUITABLE_SNPRINTF)
-    message(FATAL_ERROR
+if (NOT CMAKE_CROSSCOMPILING)
+    #
+    # Require a proof of suitable snprintf(3), same as in Autoconf.
+    #
+    check_c_source_runs("
+    #include <stdio.h>
+    #include <string.h>
+    #include <inttypes.h>
+    #include <sys/types.h>
+
+    #if defined(_WIN32) && !defined(_SSIZE_T_DEFINED)
+    /*
+     * On UN*Xes, this is a signed integer type of the same size as size_t.
+     *
+     * It's not defined by Visual Studio; we assume that ptrdiff_t will
+     * be a type that is a signed integer type of the same size as size_t.
+     */
+    typedef ptrdiff_t ssize_t;
+    #endif
+
+    /*
+     * Avoid trying to cast negative values to unsigned types, or doing
+     * shifts of signed types, in order not to have the test program fail
+     * if we're building with undefined-behavior sanitizers enabled.
+     */
+    int main()
+    {
+      char buf[100];
+      unsigned int ui = sizeof(buf);
+      int i = sizeof(buf);
+      int64_t i64 = INT64_C(0x100000000);
+      uint64_t ui64 = UINT64_C(0x100000000);
+
+      snprintf(buf, sizeof(buf), \"%zu\", (size_t)ui);
+      if (strncmp(buf, \"100\", sizeof(buf)))
+        return 1;
+
+      snprintf(buf, sizeof(buf), \"%zd\", (ssize_t)(-i));
+      if (strncmp(buf, \"-100\", sizeof(buf)))
+        return 2;
+
+      snprintf(buf, sizeof(buf), \"%\" PRId64, -i64);
+      if (strncmp(buf, \"-4294967296\", sizeof(buf)))
+        return 3;
+
+      snprintf(buf, sizeof(buf), \"0o%\" PRIo64, ui64);
+      if (strncmp(buf, \"0o40000000000\", sizeof(buf)))
+        return 4;
+
+      snprintf(buf, sizeof(buf), \"0x%\" PRIx64, ui64);
+      if (strncmp(buf, \"0x100000000\", sizeof(buf)))
+        return 5;
+
+      snprintf(buf, sizeof(buf), \"%\" PRIu64, ui64);
+      if (strncmp(buf, \"4294967296\", sizeof(buf)))
+        return 6;
+
+      return 0;
+    }
+
+    "
+        SUITABLE_SNPRINTF
+    )
+    if(NOT SUITABLE_SNPRINTF)
+        message(FATAL_ERROR
 "The snprintf(3) implementation in this libc is not suitable,
 tcpdump would not work correctly even if it managed to compile."
-    )
+        )
+    endif()
+else()
+    message(STATUS "Skipped SUITABLE_SNPRINTF because cross-compiling.")
 endif()
 
 check_function_exists(getopt_long HAVE_GETOPT_LONG)
@@ -908,7 +959,7 @@ check_function_exists(pcap_dump_ftell64 HAVE_PCAP_DUMP_FTELL64)
 # we should check for it, so that we can use it if it's present.
 #
 # So we check for pcap_open() and pcap_findalldevs_ex() if 1) this isn't
-# macOS or 2) the the libpcap we found is not a system library, meaning
+# macOS or 2) the libpcap we found is not a system library, meaning
 # that its path begins neither with /usr/lib (meaning it's a system
 # dylib) nor /Application/Xcode.app (meaning it's a file in
 # the Xcode SDK).
@@ -1160,6 +1211,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.devel OR EXISTS ${CMAKE_BINARY_DIR}/.devel)
         check_and_add_compiler_option(-Wall)
         check_and_add_compiler_option(-Wassign-enum)
         check_and_add_compiler_option(-Wcast-qual)
+        check_and_add_compiler_option(-Wcomma)
         check_and_add_compiler_option(-Wmissing-prototypes)
         check_and_add_compiler_option(-Wmissing-variable-declarations)
         check_and_add_compiler_option(-Wold-style-definition)
@@ -1331,7 +1383,6 @@ set(NETDISSECT_SOURCE_LIST_C
     print-openflow.c
     print-ospf.c
     print-ospf6.c
-    print-otv.c
     print-pflog.c
     print-pgm.c
     print-pim.c
@@ -1496,6 +1547,9 @@ add_executable(tcpdump ${TCPDUMP_SOURCE_LIST_C})
 if(NOT C_ADDITIONAL_FLAGS STREQUAL "")
     set_target_properties(tcpdump PROPERTIES COMPILE_FLAGS ${C_ADDITIONAL_FLAGS})
 endif()
+if(NOT "${PCAP_LINK_FLAGS}" STREQUAL "")
+    set_target_properties(tcpdump PROPERTIES LINK_FLAGS ${PCAP_LINK_FLAGS})
+endif()
 target_link_libraries(tcpdump netdissect ${TCPDUMP_LINK_LIBRARIES})
 
 ######################################
@@ -1551,7 +1605,7 @@ add_custom_target(uninstall
     COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
 
 #
-# Tcpdump tests
+# tcpdump tests
 # We try to find the Perl interpreter and, if we do, we have the check
 # rule run tests/TESTrun with it, because just trying to run the TESTrun
 # script as a command won't work on Windows.
diff --git a/contrib/tcpdump/CONTRIBUTING.md b/contrib/tcpdump/CONTRIBUTING.md
index 215e4c6831c4..fdad452b47b8 100644
--- a/contrib/tcpdump/CONTRIBUTING.md
+++ b/contrib/tcpdump/CONTRIBUTING.md
@@ -39,7 +39,7 @@ and ask!
 1) Check that there isn't a pull request already opened for the changes you
    intend to make.
 
-2) [Fork](https://help.github.com/articles/fork-a-repo/) the Tcpdump
+2) [Fork](https://help.github.com/articles/fork-a-repo/) the tcpdump
    [repository](https://github.com/the-tcpdump-group/tcpdump).
 
 3) The easiest way to test your changes on multiple operating systems and
diff --git a/contrib/tcpdump/INSTALL.md b/contrib/tcpdump/INSTALL.md
index 08fc31b682d0..15b8270ccced 100644
--- a/contrib/tcpdump/INSTALL.md
+++ b/contrib/tcpdump/INSTALL.md
@@ -18,6 +18,10 @@ directory), do the following steps:
 run `./autogen.sh` (a shell script). The autogen.sh script will
 build the `configure` and `config.h.in` files.
 
+* If you build on a Linux 32-bit system, with Autoconf version >= 2.72
+and GNU C Library version >= 2.34, run `export BUILD_YEAR2038=yes`
+before running `./autogen.sh` to build with 64-bit time_t (Y2038-safe).
+
 On some system, you may need to set the `AUTORECONF` variable, like:
 `AUTORECONF=autoreconf-2.69 ./autogen.sh`
 to select the `autoreconf` version you want to use.
diff --git a/contrib/tcpdump/Makefile.in b/contrib/tcpdump/Makefile.in
index e991cce2da0f..72dd01d6e3c0 100644
--- a/contrib/tcpdump/Makefile.in
+++ b/contrib/tcpdump/Makefile.in
@@ -49,7 +49,7 @@ DEFS = @DEFS@ @CPPFLAGS@ @V_DEFS@
 
 # Standard CFLAGS
 CFLAGS = @CFLAGS@
-FULL_CFLAGS = $(CCOPT) $(DEFS) $(INCLS) $(CFLAGS)
+FULL_CFLAGS = $(INCLS) $(CCOPT) $(DEFS) $(CFLAGS)
 
 # Standard LDFLAGS
 LDFLAGS = @LDFLAGS@
@@ -192,7 +192,6 @@ LIBNETDISSECT_SRC=\
 	print-openflow.c \
 	print-ospf.c \
 	print-ospf6.c \
-	print-otv.c \
 	print-pflog.c \
 	print-pgm.c \
 	print-pim.c \
@@ -373,7 +372,6 @@ EXTRA_DIST = \
 	missing/getopt_long.h \
 	missing/getservent.c \
 	missing/pcap_dump_ftell.c \
-	missing/snprintf.c \
 	missing/strdup.c \
 	missing/strlcat.c \
 	missing/strlcpy.c \
@@ -409,8 +407,6 @@ getservent.o: $(srcdir)/missing/getservent.c
 	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getservent.c
 getopt_long.o: $(srcdir)/missing/getopt_long.c
 	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getopt_long.c
-snprintf.o: $(srcdir)/missing/snprintf.c
-	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
 strdup.o: $(srcdir)/missing/strdup.c
 	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strdup.c
 strlcat.o: $(srcdir)/missing/strlcat.c
@@ -504,7 +500,7 @@ releasetar:
 	     tar xf -) && \
 	    echo "No $$TAG tag. Archive build from HEAD."; \
 	fi && \
-	(cd "$$TAG" && "$${AUTORECONF:-autoreconf}" && rm -rf autom4te.cache) && \
+	(cd "$$TAG" && ./autogen.sh && rm -rf autom4te.cache) && \
 	tar cf "$$DIR/$$TAG".tar "$$TAG" && \
 	rm -f "$$DIR/$$TAG".tar.gz && \
 	gzip --best "$$DIR/$$TAG".tar && \
@@ -516,6 +512,22 @@ releasecheck: releasetar
 	INSTALL_DIR=/tmp/install_"$$TAG"_$$$$ && \
 	DIR=`pwd` && \
 	cd /tmp && \
+	rm -rf libpcap && \
+	rm -rf install_libpcap && \
+	echo "[$@] $$ git clone [...] libpcap.git" && \
+	git clone --depth 3 --quiet https://github.com/the-tcpdump-group/libpcap.git && \
+	echo "[$@] $$ cd libpcap" && \
+	cd libpcap && \
+	echo "[$@] $$ ./autogen.sh" && \
+	./autogen.sh && \
+	echo "[$@] $$ ./configure --quiet --prefix=/tmp/install_libpcap" && \
+	./configure --quiet --prefix=/tmp/install_libpcap && \
+	echo "[$@] $$ make -s " && \
+	make -s && \
+	echo "[$@] $$ make -s install" && \
+	make -s install && \
+	echo "[$@] $$ cd .." && \
+	cd .. && \
 	rm -rf "$$TAG" && \
 	rm -rf "$$INSTALL_DIR" && \
 	tar xf "$$DIR"/"$$TAG".tar.gz && \
@@ -537,6 +549,8 @@ releasecheck: releasetar
 	touch .devel && \
 	mkdir build && \
 	cd build && \
+	echo "[$@] $$ export PKG_CONFIG_PATH=/tmp/install_libpcap/lib/pkgconfig" && \
+	export PKG_CONFIG_PATH=/tmp/install_libpcap/lib/pkgconfig && \
 	echo '[$@] $$ cmake -DENABLE_SMB=yes [...] ..' && \
 	cmake -DENABLE_SMB=yes \
 	    -DCMAKE_INSTALL_PREFIX="$$INSTALL_DIR" \
@@ -551,6 +565,8 @@ releasecheck: releasetar
 	cd ../.. && \
 	rm -rf "$$TAG" && \
 	rm -rf "$$INSTALL_DIR" && \
+	rm -rf install_libpcap && \
+	rm -rf libpcap && \
 	echo '[$@] Done.'
 
 whitespacecheck:
diff --git a/contrib/tcpdump/README.md b/contrib/tcpdump/README.md
index 566b7b7a874f..a227e126d00c 100644
--- a/contrib/tcpdump/README.md
+++ b/contrib/tcpdump/README.md
@@ -40,7 +40,7 @@ tcpdump compiles and works on at least the following platforms:
 * Windows (requires WinPcap or Npcap, and Visual Studio with CMake)
 
 ### Dependency on libpcap
-Tcpdump uses libpcap, a system-independent interface for user-level
+tcpdump uses libpcap, a system-independent interface for user-level
 packet capture.  Before building tcpdump, you must first retrieve and
 build libpcap.
 
diff --git a/contrib/tcpdump/VERSION b/contrib/tcpdump/VERSION
index 33640cd1b928..aeec4132fdd6 100644
--- a/contrib/tcpdump/VERSION
+++ b/contrib/tcpdump/VERSION
@@ -1 +1 @@
-4.99.5
+4.99.6
diff --git a/contrib/tcpdump/addrtostr.c b/contrib/tcpdump/addrtostr.c
index 1fd2cf0908bf..2c4133b5be72 100644
--- a/contrib/tcpdump/addrtostr.c
+++ b/contrib/tcpdump/addrtostr.c
@@ -127,9 +127,11 @@ addrtostr6 (const void *src, char *dst, size_t size)
   cur.base  = -1;
   for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) {
     if (words[i] == 0) {
-      if (cur.base == -1)
-           cur.base = i, cur.len = 1;
-      else cur.len++;
+      if (cur.base == -1) {
+         cur.base = i;
+         cur.len = 1;
+      } else
+         cur.len++;
     } else if (cur.base != -1) {
       if (best.base == -1 || cur.len > best.len)
          best = cur;
diff --git a/contrib/tcpdump/autogen.sh b/contrib/tcpdump/autogen.sh
index c84a6b5c5dd2..95c0233c80de 100755
--- a/contrib/tcpdump/autogen.sh
+++ b/contrib/tcpdump/autogen.sh
@@ -1,6 +1,7 @@
 #!/bin/sh -e
 
 : "${AUTORECONF:=autoreconf}"
+: "${BUILD_YEAR2038:=no}"
 
 AUTORECONFVERSION=`$AUTORECONF --version 2>&1 | grep "^autoreconf" | sed 's/.*) *//'`
 
@@ -21,5 +22,43 @@ if [ "$maj" = "" ] || [ "$min" = "" ] || \
 	exit 1
 fi
 
+# On Linux, if Autoconf version >= 2.72 and GNU C Library version >= 2.34,
+# s/AC_SYS_LARGEFILE/AC_SYS_YEAR2038_RECOMMENDED/ to ensure time_t
+# is Y2038-safe.
+if [ "$BUILD_YEAR2038" = yes ] && [ "`uname -s`" = Linux ]; then
+	if [ "$maj" -gt 2 ] || { [ "$maj" -eq 2 ] && [ "$min" -ge 72 ]; }; then
+		GLIBC_VERSION=`ldd --version|head -1|grep GLIBC|sed 's/.* //'`
+		maj_glibc=`echo "$GLIBC_VERSION" | cut -d. -f1`
+		min_glibc=`echo "$GLIBC_VERSION" | cut -d. -f2`
+		echo "GNU C Library identification: $GLIBC_VERSION"
+		if [ "$maj_glibc" -gt 2 ] || { [ "$maj_glibc" -eq 2 ] && \
+		   [ "$min_glibc" -ge 34 ]; }; then
+			CONFIGURE_AC_NEW="configure.ac.new$$"
+			sed 's/^# \(AC_SYS_YEAR2038_RECOMMENDED\)/\1/' \
+				<configure.ac >"$CONFIGURE_AC_NEW"
+			cmp -s configure.ac "$CONFIGURE_AC_NEW" || \
+			cat "$CONFIGURE_AC_NEW" >configure.ac
+			rm -f "$CONFIGURE_AC_NEW"
+			echo 'Setup to ensure time_t is Y2038-safe.'
+		fi
+	fi
+fi
+
 echo "$AUTORECONF identification: $AUTORECONFVERSION"
-"$AUTORECONF" -f
+
+# configure.ac is an Autoconf 2.69 file, but it works as expected even with
+# Autoconf 2.72.  However, in Autoconf versions 2.70 and later obsolete
+# construct warnings are enabled by default, which adds varying (depending on
+# the branch) amount of noise to the build matrix output, so provide a means
+# to silence that.
+env ${AUTOCONF_WARNINGS:+WARNINGS="$AUTOCONF_WARNINGS"} "$AUTORECONF" -f
+
+# Autoconf 2.71 adds a blank line after the final "exit 0" on Linux, but not
+# on OpenBSD.  Remove this difference to make it easier to compare the result
+# of "make releasetar" across different platforms.  From sed one-liners:
+# "delete all trailing blank lines at end of file (works on all seds)".  Don't
+# use mktemp(1) because AIX does not have it.
+CONFIGURE_NEW="configure.new$$"
+sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' <configure >"$CONFIGURE_NEW"
+cmp -s configure "$CONFIGURE_NEW" || cat "$CONFIGURE_NEW" >configure
+rm -f "$CONFIGURE_NEW"
diff --git a/contrib/tcpdump/checksum.c b/contrib/tcpdump/checksum.c
index 4bb97f1e33f4..bb07664dcec7 100644
--- a/contrib/tcpdump/checksum.c
+++ b/contrib/tcpdump/checksum.c
@@ -106,9 +106,9 @@ create_osi_cksum (const uint8_t *pptr, int checksum_offset, int length)
 
     int x;
     int y;
-    uint32_t mul;
+    int32_t mul;
     uint32_t c0;
-    uint32_t c1;
+    uint64_t c1;
     uint16_t checksum;
     int idx;
 
@@ -134,21 +134,23 @@ create_osi_cksum (const uint8_t *pptr, int checksum_offset, int length)
 
     mul = (length - checksum_offset)*(c0);
 
-    x = mul - c0 - c1;
-    y = c1 - mul - 1;
-
-    if ( y >= 0 ) y++;
-    if ( x < 0 ) x--;
+    /*
+     * Casting c0 and c1 here is guaranteed to be safe, because we know
+     * they have values between 0 and 254 inclusive.  These casts are
+     * done to ensure that all of the arithmetic operations are
+     * well-defined (i.e., not mixing signed and unsigned integers).
+     */
+    x = mul - (int)c0 - (int)c1;
+    y = (int)c1 - mul;
 
     x %= 255;
     y %= 255;
 
-
-    if (x == 0) x = 255;
-    if (y == 0) y = 255;
+    if (x <= 0) x += 255;
+    if (y <= 0) y += 255;
 
     y &= 0x00FF;
-    checksum = ((x << 8) | y);
+    checksum = (uint16_t)((x << 8) | y);
 
     return checksum;
 }
diff --git a/contrib/tcpdump/cmake/Modules/FindPCAP.cmake b/contrib/tcpdump/cmake/Modules/FindPCAP.cmake
index 11074655f457..e27709256f72 100644
--- a/contrib/tcpdump/cmake/Modules/FindPCAP.cmake
+++ b/contrib/tcpdump/cmake/Modules/FindPCAP.cmake
@@ -61,6 +61,42 @@ if(WIN32)
   if(PCAP_FOUND)
     set(PCAP_LIBRARIES ${PCAP_LIBRARY})
     set(PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR})
+
+    #
+    # We need to look for wpcap.dll in \Windows\System32\Npcap first,
+    # as either:
+    #
+    #  1) WinPcap isn't installed and Npcap isn't installed in "WinPcap
+    #     API-compatible Mode", so there's no wpcap.dll in
+    #     \Windows\System32, only in \Windows\System32\Npcap;
+    #
+    #  2) WinPcap is installed and Npcap isn't installed in "WinPcap
+    #     API-compatible Mode", so the wpcap.dll in \Windows\System32
+    #     is a WinPcap DLL, but we'd prefer an Npcap DLL (we should
+    #     work with either one if we're configured against WinPcap,
+    #     and we'll probably require Npcap if we're configured against
+    #     it), and that's in \Windows\System32\Npcap;
+    #
+    #  3) Npcap is installed in "WinPcap API-compatible Mode", so both
+    #     \Windows\System32 and \Windows\System32\Npcap have an Npcap
+    #     wpcap.dll.
+    #
+    # Unfortunately, Windows has no notion of an rpath, so we can't
+    # set the rpath to include \Windows\System32\Npcap at link time;
+    # what we need to do is to link wpcap as a delay-load DLL and
+    # add \Windows\System32\Npcap to the DLL search path early in
+    # main() with a call to SetDllDirectory().
+    #
+    # We add /delayload:wpcap.dll to the linker options here.
+    #
+    # See https://npcap.com/guide/npcap-devguide.html#npcap-feature-native-dll-implicitly
+    #
+    set(PCAP_LINK_FLAGS /delayload:wpcap.dll)
+
+    #
+    # Delay-loading libraries means we need to link with delayimp.lib.
+    #
+    set(PCAP_LIBRARIES ${PCAP_LIBRARIES} delayimp.lib)
   endif()
 else(WIN32)
   #
diff --git a/contrib/tcpdump/cmakeconfig.h.in b/contrib/tcpdump/cmakeconfig.h.in
index 0bd1e96e165a..244bcb818a6a 100644
--- a/contrib/tcpdump/cmakeconfig.h.in
+++ b/contrib/tcpdump/cmakeconfig.h.in
@@ -1,5 +1,8 @@
 /* cmakeconfig.h.in */
 
+#ifndef TCPDUMP_CONFIG_H_
+#define TCPDUMP_CONFIG_H_
+
 /* Define to 1 if arpa/inet.h declares `ether_ntohost' */
 #cmakedefine ARPA_INET_H_DECLARES_ETHER_NTOHOST 1
 
@@ -288,3 +291,5 @@
 /* Define to the type of an unsigned integer type wide enough to hold a
    pointer, if such a type exists, and if the system does not define it. */
 #cmakedefine uintptr_t 1
+
+#endif // TCPDUMP_CONFIG_H_
diff --git a/contrib/tcpdump/config.h.in b/contrib/tcpdump/config.h.in
index c1bc5f7d9de8..da600e885fde 100644
--- a/contrib/tcpdump/config.h.in
+++ b/contrib/tcpdump/config.h.in
@@ -1,5 +1,10 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+
+#ifndef TCPDUMP_CONFIG_H_
+#define TCPDUMP_CONFIG_H_
+
+
 /* Define to 1 if arpa/inet.h declares `ether_ntohost' */
 #undef ARPA_INET_H_DECLARES_ETHER_NTOHOST
 
@@ -75,7 +80,7 @@
 /* define if the OS provides AF_INET6 and struct in6_addr */
 #undef HAVE_OS_IPV6_SUPPORT
 
-/* if there's an os_proto.h for this platform, to use additional prototypes */
+/* if there's an os-proto.h for this platform, to use additional prototypes */
 #undef HAVE_OS_PROTO_H
 
 /* Define to 1 if you have the `pcap_breakloop' function. */
@@ -287,3 +292,7 @@
 /* Define to the type of an unsigned integer type wide enough to hold a
    pointer, if such a type exists, and if the system does not define it. */
 #undef uintptr_t
+
+
+#endif // TCPDUMP_CONFIG_H_
+
diff --git a/contrib/tcpdump/configure b/contrib/tcpdump/configure
index 9400d62bc838..222d8a513fd0 100755
--- a/contrib/tcpdump/configure
+++ b/contrib/tcpdump/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for tcpdump 4.99.5.
+# Generated by GNU Autoconf 2.71 for tcpdump 4.99.6.
 #
 #
 # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
@@ -608,8 +608,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='tcpdump'
 PACKAGE_TARNAME='tcpdump'
-PACKAGE_VERSION='4.99.5'
-PACKAGE_STRING='tcpdump 4.99.5'
+PACKAGE_VERSION='4.99.6'
+PACKAGE_STRING='tcpdump 4.99.6'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1306,7 +1306,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures tcpdump 4.99.5 to adapt to many kinds of systems.
+\`configure' configures tcpdump 4.99.6 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1372,7 +1372,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of tcpdump 4.99.5:";;
+     short | recursive ) echo "Configuration of tcpdump 4.99.6:";;
    esac
   cat <<\_ACEOF
 
@@ -1489,7 +1489,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-tcpdump configure 4.99.5
+tcpdump configure 4.99.6
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2086,7 +2086,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by tcpdump $as_me 4.99.5, which was
+It was created by tcpdump $as_me 4.99.6, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -4248,6 +4248,11 @@ then :
 
 fi
 
+
+# On Linux, if Autoconf version >= 2.72 and GNU C Library version >= 2.34,
+# uncomment AC_SYS_YEAR2038_RECOMMENDED to ensure time_t is Y2038-safe.
+# (Can be done by autogen.sh)
+# AC_SYS_YEAR2038_RECOMMENDED
 #
 # Get the size of a void *, to know whether this is a 32-bit or 64-bit build.
 #
@@ -5838,18 +5843,6 @@ then :
 fi
 
 
-#
-# Make sure we have snprintf(); we require it.
-#
-ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf"
-if test "x$ac_cv_func_snprintf" = xyes
-then :
-
-else $as_nop
-  as_fn_error $? "snprintf() is required but wasn't found" "$LINENO" 5
-fi
-
-
 #
 # It became apparent at some point that using a suitable C99 compiler does not
 # automatically mean snprintf(3) implementation in the libc supports all the
@@ -5883,32 +5876,50 @@ else $as_nop
 #include <inttypes.h>
 #include <sys/types.h>
 
+#if defined(_WIN32) && !defined(_SSIZE_T_DEFINED)
+/*
+ * On UN*Xes, this is a signed integer type of the same size as size_t.
+ *
+ * It's not defined by Visual Studio; we assume that ptrdiff_t will
+ * be a type that is a signed integer type of the same size as size_t.
+ */
+typedef ptrdiff_t ssize_t;
+#endif
+
+/*
+ * Avoid trying to cast negative values to unsigned types, or doing
+ * shifts of signed types, in order not to have the test program fail
+ * if we're building with undefined-behavior sanitizers enabled.
+ */
 int main()
 {
   char buf[100];
-  uint64_t t = (uint64_t)1 << 32;
+  unsigned int ui = sizeof(buf);
+  int i = sizeof(buf);
+  int64_t i64 = INT64_C(0x100000000);
+  uint64_t ui64 = UINT64_C(0x100000000);
 
-  snprintf(buf, sizeof(buf), "%zu", sizeof(buf));
+  snprintf(buf, sizeof(buf), "%zu", (size_t)ui);
   if (strncmp(buf, "100", sizeof(buf)))
     return 1;
 
-  snprintf(buf, sizeof(buf), "%zd", -sizeof(buf));
+  snprintf(buf, sizeof(buf), "%zd", (ssize_t)(-i));
   if (strncmp(buf, "-100", sizeof(buf)))
     return 2;
 
-  snprintf(buf, sizeof(buf), "%" PRId64, -t);
+  snprintf(buf, sizeof(buf), "%" PRId64, -i64);
   if (strncmp(buf, "-4294967296", sizeof(buf)))
     return 3;
 
-  snprintf(buf, sizeof(buf), "0o%" PRIo64, t);
+  snprintf(buf, sizeof(buf), "0o%" PRIo64, ui64);
   if (strncmp(buf, "0o40000000000", sizeof(buf)))
     return 4;
 
-  snprintf(buf, sizeof(buf), "0x%" PRIx64, t);
+  snprintf(buf, sizeof(buf), "0x%" PRIx64, ui64);
   if (strncmp(buf, "0x100000000", sizeof(buf)))
     return 5;
 
-  snprintf(buf, sizeof(buf), "%" PRIu64, t);
+  snprintf(buf, sizeof(buf), "%" PRIu64, ui64);
   if (strncmp(buf, "4294967296", sizeof(buf)))
     return 6;
 
@@ -7845,6 +7856,11 @@ fi
 
 
 rm -f os-proto.h
+    #
+    # MKDEP defaults to no-op (":") if we don't test whether the compiler
+    # supports generating dependencies
+    #
+    MKDEP=:
     if test "${LBL_CFLAGS+set}" = set; then
 	    V_CCOPT="$V_CCOPT ${LBL_CFLAGS}"
     fi
@@ -8066,6 +8082,59 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
+	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wcomma option" >&5
+printf %s "checking whether the compiler supports the -Wcomma option... " >&6; }
*** 5391 LINES SKIPPED ***