The branch stable/13 has been updated by jrm:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7aedea8685359fa5e914a7341ef0ef33b8227d7c

commit 7aedea8685359fa5e914a7341ef0ef33b8227d7c
Author:     Joseph Mingrone <j...@freebsd.org>
AuthorDate: 2023-02-13 22:06:51 +0000
Commit:     Joseph Mingrone <j...@freebsd.org>
CommitDate: 2025-01-29 19:29:28 +0000

    libpcap: Update to 1.10.3
    
    Prior to this MFC, the stable/13 libpcap was at version 1.9.1, which was
    released over five years ago.  Several CVEs have been identified in that
    version.  For a detailed list, see
    https://www.tcpdump.org/public-cve-list.txt.
    
    Reviewed by:    kp (pf changes)
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 6d1c946e916845d01062e146aad5395410da1e54)
    (cherry picked from commit 0c59e0b4e5817f139ce28486085b2f196351c7a3)
    (cherry picked from commit 512c553671bef26e93342d4ae1ec5f60d8ae112b)
    (cherry picked from commit 6f9cba8f8b5efd16249633e52483ea351876b67b)
    (cherry picked from commit 437f05885047c533cadf15b564729cfd0273d2fe)
    
    Commit 437f05885047c533cadf15b564729cfd0273d2fe has been adapted to only
    include the changes for the libpcap 1.10.3 update.
---
 ObsoleteFiles.inc                                  |    3 +
 contrib/libpcap/CHANGES                            |  448 +-
 contrib/libpcap/CMakeLists.txt                     | 1627 ++++-
 contrib/libpcap/CONTRIBUTING.md                    |    6 +-
 contrib/libpcap/CREDITS                            |   83 +-
 contrib/libpcap/INSTALL.md                         |  481 +-
 contrib/libpcap/Makefile-devel-adds                |    4 +-
 contrib/libpcap/Makefile.in                        |  175 +-
 contrib/libpcap/README.md                          |   73 +-
 contrib/libpcap/TODO                               |    2 -
 contrib/libpcap/VERSION                            |    2 +-
 contrib/libpcap/Win32/Prj/wpcap.sln                |   28 -
 contrib/libpcap/Win32/Prj/wpcap.vcxproj            |  233 -
 contrib/libpcap/Win32/Prj/wpcap.vcxproj.filters    |  107 -
 contrib/libpcap/aclocal.m4                         |  585 +-
 contrib/libpcap/atmuni31.h                         |    2 +-
 contrib/libpcap/bpf_filter.c                       |   86 +-
 contrib/libpcap/bpf_image.c                        |  156 +-
 contrib/libpcap/charconv.c                         |  217 +
 contrib/libpcap/charconv.h                         |   44 +
 contrib/libpcap/cmake/Modules/FindAirPcap.cmake    |   69 +
 contrib/libpcap/cmake/Modules/FindDAG.cmake        |    7 +
 contrib/libpcap/cmake/Modules/FindPacket.cmake     |   63 +-
 contrib/libpcap/cmake/Modules/FindSNF.cmake        |    6 +
 contrib/libpcap/cmake/Modules/Finddpdk.cmake       |  118 +
 contrib/libpcap/cmakeconfig.h.in                   |   85 +-
 contrib/libpcap/config.guess                       | 1510 +++--
 contrib/libpcap/config.h.in                        |   96 +-
 contrib/libpcap/config.sub                         | 1686 ++---
 contrib/libpcap/configure                          | 6968 ++++++++++++++------
 contrib/libpcap/configure.ac                       | 1684 +++--
 contrib/libpcap/diag-control.h                     |  241 +-
 contrib/libpcap/dlpisubs.c                         |   31 +-
 contrib/libpcap/doc/DLT_ALLOCATE_HOWTO.md          |   29 -
 contrib/libpcap/doc/README.Win32.md                |  199 +-
 contrib/libpcap/doc/README.aix                     |   24 +-
 contrib/libpcap/doc/README.dag                     |    6 +-
 contrib/libpcap/doc/README.hpux                    |   10 +-
 contrib/libpcap/doc/README.linux                   |   36 +
 contrib/libpcap/doc/README.linux.md                |  108 -
 contrib/libpcap/doc/README.septel                  |    4 +-
 contrib/libpcap/doc/README.sita                    |   13 +-
 contrib/libpcap/doc/README.solaris.md              |   58 +
 contrib/libpcap/doc/README.tru64                   |   49 -
 contrib/libpcap/etherent.c                         |   20 +-
 contrib/libpcap/ethertype.h                        |   38 +-
 contrib/libpcap/extract.h                          |  302 +-
 contrib/libpcap/fad-getad.c                        |    3 +-
 contrib/libpcap/fad-gifc.c                         |   10 +-
 contrib/libpcap/fad-glifc.c                        |    3 +-
 contrib/libpcap/fmtutils.c                         |  308 +-
 contrib/libpcap/fmtutils.h                         |    8 +
 contrib/libpcap/ftmacros.h                         |   28 +-
 contrib/libpcap/gencode.c                          | 1045 ++-
 contrib/libpcap/gencode.h                          |   82 +-
 contrib/libpcap/{grammar.y => grammar.y.in}        |  246 +-
 contrib/libpcap/ieee80211.h                        |    2 +-
 contrib/libpcap/lbl/os-osf4.h                      |    4 +-
 contrib/libpcap/lbl/os-osf5.h                      |    6 +-
 contrib/libpcap/lbl/os-solaris2.h                  |    2 +-
 contrib/libpcap/lbl/os-sunos4.h                    |    2 +-
 contrib/libpcap/libpcap.pc.in                      |    5 +-
 contrib/libpcap/missing/asprintf.c                 |    2 +-
 contrib/libpcap/missing/getopt.c                   |   17 +-
 contrib/libpcap/missing/snprintf.c                 |  631 --
 contrib/libpcap/missing/win_asprintf.c             |    4 +-
 contrib/libpcap/missing/win_snprintf.c             |   43 -
 contrib/libpcap/mkdep                              |   53 +-
 contrib/libpcap/msdos/readme.dos                   |    8 +-
 contrib/libpcap/nametoaddr.c                       |   66 +-
 contrib/libpcap/nomkdep                            |    0
 contrib/libpcap/optimize.c                         |  677 +-
 contrib/libpcap/org.tcpdump.chmod_bpf.plist        |    2 +-
 contrib/libpcap/pcap-airpcap.c                     | 1054 +++
 contrib/libpcap/pcap-airpcap.h                     |   36 +
 contrib/libpcap/pcap-bpf.c                         |  688 +-
 contrib/libpcap/pcap-bt-linux.c                    |   54 +-
 contrib/libpcap/pcap-bt-monitor-linux.c            |   31 +-
 contrib/libpcap/pcap-common.c                      |  450 +-
 contrib/libpcap/pcap-common.h                      |   25 -
 contrib/libpcap/pcap-config.1                      |    4 +-
 contrib/libpcap/pcap-config.in                     |   98 +-
 contrib/libpcap/pcap-dag.c                         |   93 +-
 contrib/libpcap/pcap-dbus.c                        |   28 +-
 contrib/libpcap/pcap-dll.rc                        |    6 +-
 contrib/libpcap/pcap-dlpi.c                        |  148 +-
 contrib/libpcap/pcap-dos.c                         |   50 +-
 contrib/libpcap/pcap-dpdk.c                        | 1086 +++
 contrib/libpcap/pcap-dpdk.h                        |   28 +
 contrib/libpcap/pcap-enet.c                        |    4 +-
 contrib/libpcap/pcap-filter.manmisc.in             |  651 +-
 contrib/libpcap/pcap-haiku.cpp                     |  305 +
 contrib/libpcap/pcap-int.h                         |  177 +-
 contrib/libpcap/pcap-libdlpi.c                     |   52 +-
 contrib/libpcap/pcap-linktype.manmisc.in           |    8 +-
 contrib/libpcap/pcap-linux.c                       | 5447 +++++----------
 contrib/libpcap/pcap-netfilter-linux.c             |   74 +-
 contrib/libpcap/pcap-netmap.c                      |    7 +-
 contrib/libpcap/pcap-new.c                         |   54 +-
 contrib/libpcap/pcap-nit.c                         |   12 +-
 contrib/libpcap/pcap-npf.c                         |  803 ++-
 contrib/libpcap/pcap-pf.c                          |   26 +-
 contrib/libpcap/pcap-rdmasniff.c                   |   63 +-
 contrib/libpcap/pcap-rpcap.c                       |  767 ++-
 contrib/libpcap/pcap-savefile.manfile.in           |    8 +-
 contrib/libpcap/pcap-septel.c                      |   40 +-
 contrib/libpcap/pcap-sita.c                        |   61 +-
 contrib/libpcap/pcap-sita.html                     |   28 +-
 contrib/libpcap/pcap-snf.c                         |   62 +-
 contrib/libpcap/pcap-snit.c                        |   22 +-
 contrib/libpcap/pcap-snoop.c                       |    8 +-
 contrib/libpcap/pcap-tc.c                          |  178 +-
 contrib/libpcap/pcap-tstamp.manmisc.in             |   61 +-
 contrib/libpcap/pcap-types.h                       |    1 -
 contrib/libpcap/pcap-usb-linux-common.c            |  130 +
 contrib/libpcap/pcap-usb-linux-common.h            |   26 +
 contrib/libpcap/pcap-usb-linux.c                   |  877 +--
 contrib/libpcap/pcap-util.c                        |  474 ++
 contrib/libpcap/pcap-util.h                        |   55 +
 contrib/libpcap/pcap.3pcap.in                      |  136 +-
 contrib/libpcap/pcap.c                             |  783 ++-
 contrib/libpcap/pcap/bpf.h                         |   60 +-
 contrib/libpcap/pcap/can_socketcan.h               |    7 +-
 contrib/libpcap/pcap/compiler-tests.h              |   52 +-
 contrib/libpcap/pcap/dlt.h                         |  210 +-
 contrib/libpcap/pcap/funcattrs.h                   |  130 +-
 contrib/libpcap/pcap/namedb.h                      |    4 +-
 contrib/libpcap/pcap/pcap-inttypes.h               |   85 +-
 contrib/libpcap/pcap/pcap.h                        |  332 +-
 contrib/libpcap/pcap/socket.h                      |    9 -
 contrib/libpcap/pcap_activate.3pcap                |   35 +-
 contrib/libpcap/pcap_breakloop.3pcap               |  101 +-
 contrib/libpcap/pcap_can_set_rfmon.3pcap           |   28 +-
 contrib/libpcap/pcap_close.3pcap                   |    4 +-
 contrib/libpcap/pcap_compile.3pcap.in              |   26 +-
 contrib/libpcap/pcap_create.3pcap                  |    8 +-
 contrib/libpcap/pcap_datalink.3pcap.in             |   15 +-
 contrib/libpcap/pcap_datalink_name_to_val.3pcap    |    8 +-
 contrib/libpcap/pcap_datalink_val_to_name.3pcap    |   22 +-
 contrib/libpcap/pcap_dump.3pcap                    |   12 +-
 contrib/libpcap/pcap_dump_close.3pcap              |    6 +-
 contrib/libpcap/pcap_dump_file.3pcap               |    6 +-
 contrib/libpcap/pcap_dump_flush.3pcap              |   13 +-
 contrib/libpcap/pcap_dump_ftell.3pcap              |   16 +-
 contrib/libpcap/pcap_dump_open.3pcap.in            |   51 +-
 contrib/libpcap/pcap_file.3pcap                    |   20 +-
 contrib/libpcap/pcap_fileno.3pcap                  |   20 +-
 contrib/libpcap/pcap_findalldevs.3pcap             |   30 +-
 contrib/libpcap/pcap_freecode.3pcap                |    8 +-
 .../libpcap/pcap_get_required_select_timeout.3pcap |  156 +-
 contrib/libpcap/pcap_get_selectable_fd.3pcap       |   77 +-
 contrib/libpcap/pcap_get_tstamp_precision.3pcap.in |   12 +-
 contrib/libpcap/pcap_geterr.3pcap                  |    6 +-
 contrib/libpcap/pcap_init.3pcap                    |   99 +
 contrib/libpcap/pcap_inject.3pcap                  |   46 +-
 contrib/libpcap/pcap_is_swapped.3pcap              |   16 +-
 contrib/libpcap/pcap_lib_version.3pcap             |    4 +-
 contrib/libpcap/pcap_list_datalinks.3pcap.in       |   22 +-
 contrib/libpcap/pcap_list_tstamp_types.3pcap.in    |   21 +-
 contrib/libpcap/pcap_lookupdev.3pcap               |   33 +-
 contrib/libpcap/pcap_lookupnet.3pcap               |   10 +-
 contrib/libpcap/pcap_loop.3pcap                    |  102 +-
 contrib/libpcap/pcap_major_version.3pcap           |   10 +-
 contrib/libpcap/pcap_next_ex.3pcap                 |   65 +-
 contrib/libpcap/pcap_offline_filter.3pcap          |    8 +-
 contrib/libpcap/pcap_open_dead.3pcap.in            |   25 +-
 contrib/libpcap/pcap_open_live.3pcap               |   16 +-
 contrib/libpcap/pcap_open_offline.3pcap.in         |   31 +-
 contrib/libpcap/pcap_set_buffer_size.3pcap         |   12 +-
 contrib/libpcap/pcap_set_datalink.3pcap            |   21 +-
 contrib/libpcap/pcap_set_immediate_mode.3pcap.in   |   32 +-
 contrib/libpcap/pcap_set_promisc.3pcap             |   12 +-
 contrib/libpcap/pcap_set_protocol_linux.3pcap      |   20 +-
 contrib/libpcap/pcap_set_rfmon.3pcap               |   14 +-
 contrib/libpcap/pcap_set_snaplen.3pcap             |   12 +-
 contrib/libpcap/pcap_set_timeout.3pcap             |   13 +-
 contrib/libpcap/pcap_set_tstamp_precision.3pcap.in |   20 +-
 contrib/libpcap/pcap_set_tstamp_type.3pcap.in      |   22 +-
 contrib/libpcap/pcap_setdirection.3pcap            |   22 +-
 contrib/libpcap/pcap_setfilter.3pcap               |   22 +-
 contrib/libpcap/pcap_setnonblock.3pcap             |   55 +-
 contrib/libpcap/pcap_snapshot.3pcap                |   14 +-
 contrib/libpcap/pcap_stats.3pcap                   |   23 +-
 contrib/libpcap/pcap_statustostr.3pcap             |    4 +-
 contrib/libpcap/pcap_strerror.3pcap                |    4 +-
 contrib/libpcap/pcap_tstamp_type_name_to_val.3pcap |    7 +-
 contrib/libpcap/pcap_tstamp_type_val_to_name.3pcap |    7 +-
 contrib/libpcap/pflog.h                            |  157 +
 contrib/libpcap/portability.h                      |   70 +-
 contrib/libpcap/rpcap-protocol.c                   |    6 +-
 contrib/libpcap/rpcap-protocol.h                   |   56 +-
 contrib/libpcap/rpcapd/CMakeLists.txt              |   39 +-
 contrib/libpcap/rpcapd/Makefile.in                 |    5 +-
 contrib/libpcap/rpcapd/daemon.c                    |  803 ++-
 contrib/libpcap/rpcapd/daemon.h                    |    8 +-
 contrib/libpcap/rpcapd/fileconf.c                  |   32 +-
 contrib/libpcap/rpcapd/log.c                       |    2 +-
 contrib/libpcap/rpcapd/org.tcpdump.rpcapd.plist    |    2 +-
 contrib/libpcap/rpcapd/rpcapd-config.manfile.in    |    8 +-
 contrib/libpcap/rpcapd/rpcapd.c                    |  172 +-
 contrib/libpcap/rpcapd/rpcapd.manadmin.in          |   91 +-
 contrib/libpcap/rpcapd/win32-svc.c                 |   13 +-
 contrib/libpcap/rpcapd/win32-svc.h                 |    2 +-
 contrib/libpcap/savefile.c                         |  249 +-
 contrib/libpcap/scanner.l                          |  255 +-
 contrib/libpcap/sf-pcap.c                          |  147 +-
 contrib/libpcap/sf-pcapng.c                        |  114 +-
 contrib/libpcap/sockutils.c                        |  817 ++-
 contrib/libpcap/sockutils.h                        |   31 +-
 contrib/libpcap/sslutils.c                         |  239 +
 contrib/libpcap/sslutils.h                         |   66 +
 contrib/libpcap/testprogs/CMakeLists.txt           |   13 +-
 contrib/libpcap/testprogs/Makefile.in              |   54 +-
 contrib/libpcap/testprogs/can_set_rfmon_test.c     |    1 -
 contrib/libpcap/testprogs/capturetest.c            |   89 +-
 contrib/libpcap/testprogs/filtertest.c             |   44 +-
 contrib/libpcap/testprogs/findalldevstest-perf.c   |   97 +
 contrib/libpcap/testprogs/findalldevstest.c        |   29 +-
 contrib/libpcap/testprogs/fuzz/CMakeLists.txt      |   43 +
 contrib/libpcap/testprogs/fuzz/fuzz_both.c         |  101 +
 contrib/libpcap/testprogs/fuzz/fuzz_both.options   |    2 +
 contrib/libpcap/testprogs/fuzz/fuzz_filter.c       |   43 +
 contrib/libpcap/testprogs/fuzz/fuzz_filter.options |    2 +
 contrib/libpcap/testprogs/fuzz/fuzz_pcap.c         |   80 +
 contrib/libpcap/testprogs/fuzz/fuzz_pcap.options   |    2 +
 contrib/libpcap/testprogs/fuzz/onefile.c           |   54 +
 contrib/libpcap/testprogs/nonblocktest.c           |  187 +
 contrib/libpcap/testprogs/opentest.c               |   19 +-
 contrib/libpcap/testprogs/reactivatetest.c         |    1 -
 contrib/libpcap/testprogs/selpolltest.c            |   66 +-
 contrib/libpcap/testprogs/threadsignaltest.c       |   58 +-
 contrib/libpcap/testprogs/valgrindtest.c           |   34 +-
 contrib/libpcap/testprogs/visopts.py               |  317 +
 contrib/libpcap/testprogs/writecaptest.c           |  556 ++
 contrib/libpcap/tests/pcap-invalid-version-1.pcap  |  Bin 0 -> 530 bytes
 contrib/libpcap/tests/pcap-invalid-version-2.pcap  |  Bin 0 -> 530 bytes
 contrib/libpcap/tests/pcapng-invalid-vers-1.pcapng |  Bin 0 -> 260 bytes
 contrib/libpcap/tests/pcapng-invalid-vers-2.pcapng |  Bin 0 -> 260 bytes
 contrib/pf/pflogd/pflogd.c                         |    2 +-
 contrib/tcpdump/interface.h                        |    6 +
 lib/libpcap/Makefile                               |   11 +-
 sys/net/dlt.h                                      |  260 +-
 242 files changed, 29090 insertions(+), 15236 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 2d18851051d8..0e7060eedd52 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -2126,6 +2126,9 @@ OLD_FILES+=usr/include/c++/v1/__nullptr
 OLD_FILES+=usr/include/c++/v1/__string
 OLD_FILES+=usr/include/c++/v1/experimental/filesystem
 
+# 20230331: libpcap updated to 1.10.3
+OLD_FILES+=usr/include/fmtutils.h
+
 # 20230320: vcount.9 removed
 OLD_FILES+=usr/share/man/man9/count_dev.9.gz
 OLD_FILES+=usr/share/man/man9/vcount.9.gz
diff --git a/contrib/libpcap/CHANGES b/contrib/libpcap/CHANGES
index 89e739c46fa2..d174cd5e1a9c 100644
--- a/contrib/libpcap/CHANGES
+++ b/contrib/libpcap/CHANGES
@@ -1,3 +1,432 @@
+Thursday, January 12, 2023 / The Tcpdump Group
+  Summary for 1.10.3 libpcap release
+    Source code:
+      Sort the PUBHDR variable in Makefile.in in "ls" order.
+      Fix typo in comment in pflog.h.
+      Remove two no-longer-present files from .gitignore.
+      Update code and comments for handling failure to set promiscuous
+        mode based on new information.
+    Building and testing:
+      install: Fixed not to install the non-public pcap-util.h header.
+      pcap-config: add a --version flag.
+      Makefile.in: Add some missing files in the distclean target.
+
+Saturday, December 31, 2022 / The Tcpdump Group
+  Summary for 1.10.2 libpcap release
+    Source code:
+      Use __builtin_unreachable() in PCAP_UNREACHABLE.
+      Use AS_HELP_STRING macro instead of AC_HELP_STRING in the
+        configure scripts, to avoid deprecation warnings.
+      Change availability tags in pcap.h to make it easier to
+        arrange for it to be used in Darwin releases.
+      Use AS_HELP_STRING for --enable-remote.
+      Fix some formatting string issues found by cppcheck.
+      Various small code and comment cleanups.
+      Use PCAP_ERROR (defined as -1) rather than explicit -1 for
+        functions the documentation says return PCAP_ERROR.
+      Remove unused code from the filter compiler.
+      Use _declspec(deprecated(msg)) rather than __pragma(deprecated)
+        for Windows deprecation warnings, so the message that was
+        specified shows up.
+      diag-control.h: define PCAP_DO_PRAGMA() iff we're going to use it.
+      Use "%d" to print some signed ints.
+      Use the Wayback Machine for a removed document in a comment.
+      Add some const qualifiers.
+      RDMA: Use PRIu64 to print a uint64_t.
+    "Dead" pcap_ts from pcap_open_dead() and ..._with_tstamp_precision():
+        Don't crash if pcap_breakloop() is called.
+    Savefiles:
+      Fix pcap_dispatch() to return number of packets processed, rather
+        than 0, even at EOF.
+      If we get an error writing the packet header, don't write the
+        packet data.
+      Put PFLOG UID and PID values in the header into host byte order
+        when reading a LINKTYPE_PFLOG file.
+      Put CAN ID field in CAN pseudo-headers for LINUX_SLL2, as we do
+        for LINUX_SLL.
+      Fix inorrectly-computed "real" length for isochronous USB
+        transfers when reading savefiles.
+      Don't crash if pcap_can_set_rfmon() is called.
+      Fix pcap_offline_read() loop.
+    Capture:
+      Never process more than INT_MAX packets in a pcap_dispatch() call,
+        to avoid integer overflow (issue #1087).
+      Improve error messages for "no such device" and "permission
+        denied" errors.
+      SITA: Fix a typo in a variable name.
+    Packet filtering:
+      Get PFLOG header length from the length value in the header.
+      Support all the direction, reason, and action types supported by
+        all systems that support PFLOG.
+      Don't require PFLOG support on the target machine in order to
+        support PFLOG filtering (also fixes issue #1076).
+      Expand abbreviations into "proto X" properly.
+      gencode.c: Update a comment about the VLAN TPID test.
+      Add the minimum and maximum matching DLTs to an error message.
+    Linux:
+      Fix memory leak in capture device open (pull request #1038).
+      Fix detection of CAN/CAN FD packets in direction check (issue
+        #1051).
+      Fix double-free crashes on errors such as running on a kernel with
+        CONFIG_PACKET_MMAP not configured (issue #1054).
+      Use DLT_CAN_SOCKETCAN for CANbus interfaces (issue #1052; includes
+        changes from pull request #1035).
+      Make sure the CANFD_FDF can be relied on to indicate whether a
+        CANbus packet is a CAN frame or a CAN FD frame
+      Improve error message for "out of memory" errors for kernel
+        filters (see issue #1089).
+      Fix pcap_findalldevs() to find usbmon devices.
+      Fix handling of VLAN tagged packets if the link-layer type is
+        changed from DLT_LINUX_SLL to DLT_LINUX_SLL2 (see issue #1105).
+      Always turn on PACKET_AUXDATA (see issue #1105).
+      We require 2.6.27 or later, so PACKET_RESERVE is available.
+      Make sure there's reserved space for a DLT_LINUX_SLL2 header
+        when capturing.
+      Correctly compute the "real" length for isochronous USB transfers.
+      Don't have an eventfd descriptor open in non-blocking mode, so as
+        not to waste descriptors.
+      netfilter: Squelch a narrowing warning (To be look at before 2038).
+    BPF capture (*BSD, macOS, AIX, Solaris 11):
+      Fix case where a device open might fail, rather than falling back
+        to a smaller buffer size, when the initial buffer size is too
+        big.
+      Use an unsigned device number to iterate over BPF devices, to
+        squelch a compiler warning.
+    NetBSD:
+      Fix handling of LINKTYPE_HDLC/DLT_HDLC.
+    rpcap:
+      Fix unaligned accesses in rpcapd (pull request #1037).
+      Fix code to process port number.
+      Clean up findalldevs code in rpcapd.
+      Clean up bufferizing code.
+      Fix a file descriptor/handle leak in pcap_findalldevs_ex()
+        (Coverity CID 1507240).
+      Improve error messages for host and port resolution errors.
+      Fix connect code not to fail if both IPv4 and IPv6 addresses are
+        tried.
+      Improve connect failure error message.
+      Provide an error message for a bad authentication reply size.
+      For link-layer types with host-endian fields in the header, fix
+        those fields if capturing from a server with a different byte
+        order.
+      Suppress temporarily the warnings with "enable remote packet capture".
+    Windows:
+      Add support for NdisMediumIP (pull request #1027).
+      Don't require applications using pcap to be built with VS 2015 or
+        later.
+      Use the correct string for the DLL VersionInfo.
+      Remove unnecessary DllMain() function.
+      Correctly handle ERROR_INVALID_FUNCTION from
+        PacketGetTimestampModes() (indicate that WinPcap or an older
+        version of Npcap is probably installed).
+      Fix use-after-free in some cases when a pcap_t is closed.
+      Make sure an error is returned by pcap_create_interface() if
+        PacketOpenAdapter() fails.
+      Return an error if the driver reports 0 timestamp modes supported.
+      Close the ADAPTER handle for some errors in
+        pcap_create_interface().
+      Get rid of old umaintained VS project files.
+      Fix deprecation warning for pcap_handle().
+      Npcap is now at npcap.com, not npcap.org.
+      Make sure "no such device" and "no permission to open device"
+        errors show up in pcap_activate(), not pcap_create() (fixes,
+        among other things, tcpdump -i <interface-number>).
+      npcap: squelch deprecation warnings for kernel dump mode.
+    Haiku:
+      Implement pcap_lib_version(), as now required.
+      Handle negative or too-large snaplen values.
+      Fix various build issues and warnings.
+    Building and testing:
+      Update configure-time universal build checks for macOS.
+      Update config.guess and config.sub.
+      If we look for an SSL library with pkg-config in configure script,
+        try pkg-config first.
+      If we have pkg-config and Homebrew, try to set pkg-config up to
+        find Homebrew packages.
+      Handle some Autoconf/make errors better.
+      Use "git archive" for the "make releasetar" process.
+      Remove the release candidate rcX targets.
+      Fix compiling on Solaris 9/SPARC and 11/AMD64.
+      Address assorted compiler warnings.
+      Fix cross-building on Linux for Windows with mingw32 for Win64
+        (pull request #1031).
+      Properly set installation directory on Windows when not compiling
+        with MSVC.
+      Fix configure script checks for compiler flags.
+      Give more details if check for usable (F)Lex fails.
+      Fix compiling with GCC 4.6.4.
+      Don't use add_compile_options() with CMake, as we currently don't
+        require 2.8.12, where it first appeared.
+      Don't provide -L/usr/lib for pkg-config --libs in pkg-config.
+      Fix error message for inadequate Bison/Berkeley YACC.
+      configure: correctly do some DPDK checks.
+      Only use pkg-config when checking for DPDK.
+      Allow the path in which DPDK is installed to be specified.
+      Use pkg-config first when checking for libibverbs.
+      CMake: fix check for libibverbs with Sun's C compiler.
+      Have CMake warn if no capture mechanism can be found.
+      Don't do stuff requiring 3.19 or later on earlier CMakes.
+      Squelch some CMake warnings.
+      Fix diag-control.h to handle compiling with clang-cl (issues
+        #1101 and #1115).
+      Cleanup various leftover cruft in the configure script.
+      Fix building without protochain support. (GH #852)
+      Check for a usable YACC (or Bison) and {F}lex in CMake, as we do
+        in autotools.
+      Only check for a C++ compiler on Haiku, as that's the only
+        platform with C++ code, and make sure they generate code for
+        the same instruction set bit-width (both 32-bit or both 64-bit)
+        (issue #1112).
+      On Solaris, check the target bit-width and set PKG_CONFIG_PATH
+        appropriately, to handle the mess that is the D-Bus library
+        package (issue #1112).
+      Fix generation of pcap-config and libpcap.pc files (issue #1062).
+      pcap-config: don't assume the system library directory is /usr/lib.
+      pcap-config: add a --static-pcap-only flag.
+      Cirrus CI: Use the same configuration as for the main branch.
+      Add four libpcap test files.
+      Update Npcap SDK to 1.13.
+      Makefile.in: Use TEST_DIST, like for tcpdump.
+      Remove awk code from mkdep.
+      Cirrus CI: Add the libssl-dev package in the Linux task.
+      Cirrus CI: Add the openssl@3 brew package in the macOS task.
+      Get "make shellcheck" to pass again.
+      CMake: Build valgrindtest only if Autoconf would.
+      CMake: use ${CMAKE_INSTALL_SBINDIR} rather than just sbin.
+      CMake: use NUL: as the null device on Windows.
+      autoconf: fix typo in test of macOS version.
+      Makefile.in: Add two missing files in EXTRA_DIST.
+      autotools, cmake: provide an rpath option if necessary.
+      configure: get rid of the attempt to auto-run PKG_PROG_PKG_CONFIG.
+      configure: use PKG_CHECK_MODULES to run pkg-config.
+    Documentation:
+      Add README.solaris.md.
+      Add SCTP to pcap-filter(7).
+      Note that = and == are the same operator in filters (issue #1044).
+      Update INSTALL.md, README.md, and README.solaris.md.
+      Update and clean up CONTRIBUTING.md.
+      Trim documentation of support for now-dead UN*Xe and older
+        versions of other UN*Xes.
+      Move the "how to allocate a LINKTYPE_/DLT_ value" documentation to
+        the web site.
+      Clean up man pages.
+      Move README.capture-module to the web site.
+      Improve some protocol details in pcap-filter(7).
+      Refine "relop" notes in pcap-filter(7).
+      In pcap-filter(7) "domain" is an id.
+      Discuss backward compatibility in pcap-filter(7).
+      Other improvements to pcap-filter(7).
+      Document pcap_breakloop(3PCAP) interaction with threads better.
+      Document PCAP_ERROR_NOT_ACTIVATED for more routines.
+
+Wednesday, June 9, 2021:
+  Summary for 1.10.1 libpcap release:
+    Packet filtering:
+      Fix "type XXX subtype YYY" giving a parse error
+    Source code:
+      Add PCAP_AVAILABLE_1_11.
+    Building and testing:
+      Rename struct bpf_aux_data to avoid NetBSD compile errors
+      Squelch some compiler warnings
+      Squelch some Bison warnings
+      Fix cross-builds with older kernels lacking BPF_MOD and BPF_XOR
+      Fix Bison detection for minor version 0.
+      Fix parallel build with FreeBSD make.
+      Get DLT_MATCHING_MAX right in gencode.c on NetBSD.
+      Define timeradd() and timersub() if necessary.
+      Fix Cygwin/MSYS target directories.
+      Fix symlinking with DESTDIR.
+      Fix generation of libpcap.pc with CMake when not building a shared
+          library.
+      Check for Arm64 as well as x86-64 when looking for packet.lib on
+          Windows.
+    Documentation:
+      Refine Markdown in README.md.
+      Improve the description of portrange in filters.
+      README.linux.md isn't Markdown, rename it just README.linux.
+    pcapng:
+      Support reading version 1.2, which some writers produce, and which
+          is the same as 1.0 (some new block types were added, but
+          that's not sufficient reason to bump the minor version number,
+          as code that understands those new block types can handle them
+          in a 1.0 file)
+    Linux:
+      Drop support for text-mode USB captures, as we require a 2.6.27
+          or later kernel (credit to Chaoyuan Peng for noting the
+          sscanf vulnerabilities in the text-mode code that got me to
+          realize that we didn't need this code any more)
+      Bluetooth: fix non-blocking mode.
+      Don't assume that all compilers used to build for Linux support
+          the __atomic builtins
+    Windows:
+      Add more information in "interface disappeared" error messages, in
+        the hopes of trying to figure out the cause.
+      Treat ERROR_DEVICE_REMOVED as "device was removed".
+      Indicate in the error message which "device was removed" error
+          occurred.
+      Report the Windows error status if PacketSendPacket() fails.
+      Use %lu for ULONGs in error message formats.
+      Don't treat the inability to find airpcap.dll as an error.
+      Ignore spurious error reports by Microsoft Surface mobile
+          telephony modem driver
+    rpcap:
+      Clean up error checking and error messages for server address
+          lookup.
+
+Tuesday, December 29, 2020
+  Summary for 1.10.0 libpcap release
+    Add support for capturing on DPDK devices
+    Label most APIs by the first release in which they're available
+    Fix some memory leaks, including in pcap_compile()
+    Add pcap_datalink_val_to_description_or_dlt()
+    Handle the pcap private data in a fashion that makes fewer
+       assumptions about memory layouts (might fix GitHub issue #940
+       on ARM)
+    Fix some thread safety issues
+    pcap_findalldevs(): don't sort interfaces by unit number
+    Always return a list of supported time-stamp types, even if only
+        host time stamps are supported
+    Increase the maximum snaplen for LINKTYPE_USBPCAP/DLT_USBPCAP
+    Report the DLT description in error messages
+    Add pcap_init() for first-time initialization and global option
+        setting; it's not required, but may be used
+    Remove (unused) SITA support
+    Capture file reading:
+        Correctly handle pcapng captures with more than one IDB with a
+            snspshot length greater than the supported maximum
+    Capture file writing:
+        Create the file in pcap_dump_open_append() if it doesn't exist
+    Packet filtering:
+        Fix "unknown ether proto 'aarp'"
+        Add a new filter "ifindex" for DLT_LINUX_SLL2 files on all
+            platforms and live Linux captures
+        Add a hack to the optimizer to try to catch certain optimizer
+            loops (should prevent GitHub issue #112)
+        Show special Linux BPF offsets symbolically in bpf_image() and
+            bpf_dump()
+        Added support for ICMPv6 types 1-4 as tokens with names
+        Remove undocumented and rather old "ether proto" protocols
+        Catch invalid IPv4 addresses in filters
+        Don't assume ARM supports unaligned accesses
+    Security and other issues found by analysis:
+        Fix various security issues reported by Charles Smith at Tangible
+            Security
+        Fix various security issues reported by Include Security
+        Fix some issues found by cppcheck.
+        Add some overflow checks in the optimizer
+    rpcap:
+        Support rpcap-over-TLS
+        Redo protocol version negotiation to avoid problems with old
+            servers (it still works with servers using the old negotiation,
+            as well as servers not supporting negotiation)
+        Error handling cleanups
+        Add some new authentication libpcap error codes for specific
+            errors
+        Fix some inetd issues in rpcapd
+        Fix rpcapd core dumps with invalid configuration file
+        On UN*X, don't have rpcapd tell the client why authentication
+            failed, so a brute-force attacker can't distinguish between
+            "unknown user name" and "known user name, wrong password"
+        Allow rpcapd to rebind more rapidly (GitHub issue #765)
+    Documentation:
+        Improve man pages, including adding backward compatibility notes
+    Building and testing:
+        Require, and assume, some level of C99 support in the C compiler
+        Require Visual Studio 2015 or later if using Visual Studio
+        Fix configure script issues, including with libnl on Linux
+        Fix CMake issues
+        Squelch complaints from Bison about "%define api.pure" being
+            deprecated
+        Fix compilation of pcap-tc.c
+    Linux:
+        Require PF_PACKET support, and kernel 2.6.27 or later
+        Handle systems without AF_INET or AF_UNIX socket support
+        Get rid of Wireless Extensions for turning monitor mode on
+        Proper memory sync for PACKET_MMAP (may prevent GitHub issue
+            #898)
+        Drop support for libnl 1 and 2.
+        Return error on interface going away, but not if it just went
+            down but is still present
+        Set socket protocol only after packet ring configured,
+            reducing bogus packet drop reports
+        Get ifdrop stats from sysfs.
+        When adjusting BPF programs, do not subtract the
+            SLL[2]_HDR_LEN if the location is negative (special metadata
+            offset), to preserve references to metadata; see
+            
https://github.com/the-tcpdump-group/tcpdump/issues/480#issuecomment-486827278
+        Report a warning for unknown ARPHRD types
+        Have pcap_breakloop() forcibly break out of a sleeping
+            capture loop
+        Add support for DSA data link types
+        For raw USB bus capture, use the snapshot length to set the
+            buffer size, and set the len field to reflect the length
+            in the URB (GitHub issue #808)
+        With a timeout of zero, wait indefinitely
+        Clean up support for some non-GNU libc C libraries
+        Add DLT_LINUX_SLL2 for cooked-mode captures
+        Probe CONFIGURATION descriptor of connected USB devices
+        Treat EPERM on ethtool ioctls as meaning "not supported", as
+            permissions checks are done before checking whether the
+            ioctl is supported at all
+    macOS:
+        Cope with getting EPWROFF from SIOCGIFMEDIA
+        Treat EPERM on SIOCGIFMEDIA as meaning "not supported", as
+            permissions checks are done before checking whether the
+            ioctl is supported at all
+        Treat ENXIO when reading packets as meaning "the interface
+            was removed"
+        Report "the interface disappeared", not "the interface went
+            down", if the interface was removed during a capture
+    FreeBSD:
+        Treat ENXIO as meaning "the interface was removed"
+        Report "the interface disappeared", not "the interface went
+            down", if the interface was removed during a capture
+    NetBSD:
+        Treat ENXIO as meaning "the interface was removed"
+        Report "the interface disappeared", not "the interface went
+            down", if the interface was removed during a capture
+    OpenBSD:
+        Treat EIO as meaning "the interface was removed"
+        Report "the interface disappeared", not "the interface went
+            down", if the interface was removed during a capture
+    DragonFly BSD:
+        Treat ENXIO as meaning "the interface was removed"
+        Report "the interface disappeared", not "the interface went
+            down", if the interface was removed during a capture
+    Solaris:
+        Treat ENXIO as meaning "the interface was removed"
+        Report "the interface disappeared", not "the interface went
+            down", if the interface was removed during a capture
+    AIX:
+        Fix loading of BPF kernel extension
+        Treat ENXIO as meaning "the interface was removed"
+        Report "the interface disappeared", not "the interface went
+            down", if the interface was removed during a capture
+    Windows:
+        Make the snapshot length work even if pcap_setfilter()
+            isn't called
+        Fix compilation on Cygwin/MSYS
+        Add pcap_handle(), and deprecate pcap_fileno()
+        Report PCAP_ERROR_NO_SUCH_DEVICE for a non-existent device
+        Return an appropriate error message for device removed or
+            device unusable due to a suspend/resume
+        Report a warning for unknown NdisMedium types
+        Have pcap_breakloop() forcibly break out of a sleeping
+            capture loop
+        Clean up building DLL
+        Handle CRT mismatch for pcap_dump_fopen()
+        Map NdisMediumWirelessWan to DLT_RAW
+        Add AirPcap support in a module, rather than using
+            WinPcap/Npcap's support for it
+        Report the system error for PacketSetHwFilter() failures
+        Add support for getting and setting packet time stamp types
+            with Npcap
+        Have pcap_init() allow selecting whether the API should use
+            local code page strings or UTF-8 strings (including error
+            messages)
+    Haiku:
+        Add capture support
+
 Sunday, July 22, 2018
   Summary for 1.9.1 libpcap release
     Mention pcap_get_required_select_timeout() in the main pcap man page
@@ -26,7 +455,7 @@ Sunday, July 22, 2018
         need to be
     Fix reading of capture statistics for Linux USB
     Fix packet size values for Linux USB packets (GitHub issue #808)
-    Check only VID in VLAN test in filterss (GitHub issue #461)
+    Check only VID in VLAN test in filters (GitHub issue #461)
     Fix pcap_list_datalinks on 802.11 devices on macOS
     Fix overflows with very large snapshot length in pcap file
     Improve parsing of rpcapd configuration file (GitHub issue #767)
@@ -67,7 +496,6 @@ Sunday, July 22, 2018
     Boost the TPACKET_V3 timeout to the maximum if a timeout of 0 was
         specified
     Five CVE-2019-15161, CVE-2019-15162, CVE-2019-15163, CVE-2019-15164, 
CVE-2019-15165
-    Fixes for CVE-2018-16301, errors in pcapng reading.
     PCAPNG reader applies some sanity checks before doing malloc().
 
 Sunday, June 24, 2018, by m...@sandelman.ca
@@ -75,7 +503,7 @@ Sunday, June 24, 2018, by m...@sandelman.ca
     Added testing system to libpcap, independent of tcpdump
     Changes to how pcap_t is activated
     Adding support for Large stream buffers on Endace DAG cards
-    Changes to BSD 3-clause license to 2-clause licence
+    Changes to BSD 3-clause license to 2-clause license
     Additions to TCP header parsing, per RFC3168
     Add CMake build process (extensive number of changes)
     Assign a value for OpenBSD DLT_OPENFLOW.
@@ -93,7 +521,7 @@ Sunday, June 24, 2018, by m...@sandelman.ca
     Make VLAN filter handle both metadata and inline tags
     D-Bus captures can now be up to 128MB in size
     Added LORATAP DLT value
-    Added DLT_VSOCK for http://qemu-project.org/Features/VirtioVsock
+    Added DLT_VSOCK for https://qemu-project.org/Features/VirtioVsock
     probe_devices() fixes not to overrun buffer for name of device
     Add linux-specific pcap_set_protocol_linux() to allow specifying a 
specific capture protocol.
     RDMA sniffing support for pcap
@@ -275,7 +703,7 @@ Summary for 1.5.0 libpcap release
            than the mcr repository
        Checks added for malloc()/realloc()/etc. failures
        Fixed build on Solaris 11
-       Support filtering filtering E1 SS7 traffic on MTP2 layer Annex A
+       Support filtering E1 SS7 traffic on MTP2 layer Annex A
        Use "ln -s" to link man pages by default
         Add support for getting nanosecond-resolution time stamps when
            capturing and reading capture files
@@ -336,7 +764,7 @@ Summary for 1.3.0 libpcap release
 Friday  December 9, 2011.  g...@alum.mit.edu.
 Summary for 1.2.1 libpcap release
        Update README file.
-       Fix typoes in README.linux file.
+       Fix typos in README.linux file.
        Clean up some compiler warnings.
        Fix Linux compile problems and tests for ethtool.h.
        Treat Debian/kFreeBSD and GNU/Hurd as systems with GNU
@@ -369,7 +797,7 @@ Summary for 1.2 libpcap release
         Noted real nature of LINKTYPE_ARCNET.
         Add a link-layer type for DVB-CI.
         Fix configure-script discovery of VLAN acceleration support.
-         see http://netoptimizer.blogspot.com/2010/09/tcpdump-vs-vlan-tags.html
+         see 
https://netoptimizer.blogspot.com/2010/09/tcpdump-vs-vlan-tags.html
         Linux, HP-UX, AIX, NetBSD and OpenBSD compilation/conflict fixes.
         Protect against including AIX 5.x's <net/bpf.h> having been included.
         Add DLT_DBUS, for raw D-Bus messages.
@@ -568,7 +996,7 @@ Tue.        September 19, 2006. k...@xelerance.com. Summary 
for 0.9.5 libpcap release
         beginning+link-layer
        Add DLT/LINKTYPE for carrying FRF.16 Multi-link Frame Relay
        Fix allocation of buffer for list of link-layer types
-       Added a new DLT and LINKTYPE value for ARINC 653 Interpartition 
Communcation Messages
+       Added a new DLT and LINKTYPE value for ARINC 653 Interpartition 
Communication Messages
        Fixed a typo in a DLT value: it should start with DLT_ and not LINKTYPE_
        Redefined DLT_CAN20B and LINKTYPE_CAN20B as #190 (as this is the right 
value for CAN).
        Added definition for DLT_A429 and LINKTYPE_A429 as #184.
@@ -682,7 +1110,7 @@ Tuesday January 9, 2001. g...@alum.mit.edu. Summary for 
0.6 release
 
        Header files fixed to allow use in C++ programs.
 
-       Removed dependancy on native headers for packet layout.
+       Removed dependency on native headers for packet layout.
        Removed Linux specific headers that were shipped.
 
        Security fixes: Strcpy replaced with strlcpy, sprintf replaced
@@ -820,7 +1248,7 @@ v0.3 Sat Nov 30 20:56:27 PST 1996
 
 v0.2.1 Sun Jul 14 03:02:26 PDT 1996
 
-- Fixes for HP-UX 10. Thanks in part to to Thomas Wolfram
+- Fixes for HP-UX 10. Thanks in part to Thomas Wolfram
   (w...@prz.tu-berlin.de) and Rick Jones (r...@hpisrdq.cup.hp.com)
 
 - Added support for SINIX. Thanks to Andrej Borsenkow
diff --git a/contrib/libpcap/CMakeLists.txt b/contrib/libpcap/CMakeLists.txt
index 55b93f14d74c..58c5159905d0 100644
--- a/contrib/libpcap/CMakeLists.txt
+++ b/contrib/libpcap/CMakeLists.txt
@@ -1,4 +1,11 @@
-cmake_minimum_required(VERSION 2.8.6)
+if(WIN32)
+    #
+    # We need 3.12 or later, so that we can set policy CMP0074; see
+    # below.
+    cmake_minimum_required(VERSION 3.12)
+else(WIN32)
+    cmake_minimum_required(VERSION 2.8.6)
+endif(WIN32)
 
 #
 # Apple doesn't build with an install_name starting with @rpath, and
@@ -9,44 +16,308 @@ if(POLICY CMP0042)
     cmake_policy(SET CMP0042 OLD)
 endif()
 
+#
+# Squelch noise about quoted strings in if() statements.
+# WE KNOW WHAT WE'RE DOING, WE'RE DOING EVERYTHING THE WAY THAT NEWER
+# VERSIONS OF CMAKE EXPECT BY DEFAULT, DON'T WASTE OUR TIME WITH NOISE.
+#
+if(POLICY CMP0054)
+    cmake_policy(SET CMP0054 NEW)
+endif()
+
+#
+# We want find_file() and find_library() to honor {packagename}_ROOT,
+# as that appears to be the only way, with the Visual Studio 2019 IDE
+# and its CMake support, to tell CMake where to look for the Npcap
+# or WinPcap SDK.
+#
+if(POLICY CMP0074)
+    cmake_policy(SET CMP0074 NEW)
+endif()
+
+#
+# We want check_include_file() to honor CMAKE_REQUIRED_LIBRARIES; see
+# the big comment before the check_include_file() test for
+# infiniband/verbs.h for the reason.
+#
+if(POLICY CMP0075)
+    cmake_policy(SET CMP0075 NEW)
+endif()
+
 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
 
-project(pcap)
+#
+# We only need a C++ compiler for Haiku; all code except for its
+# pcap module is in C.
+#
+# We do that by specifying just C in the project() call and, after
+# that finishes, checking for Haiku and, if we're building for
+# Haiku, use enable_language() to check for C++.  This means that
+# we don't require a C++ compiler on platforms other than Haiku.
+#
+# CMAKE_SYSTEM_NAME is set by project(), so we can't do this by
+# testing CMAKE_SYSTEM_NAME and then passing different language
+# lists to project() based on the system.
+#
+project(pcap C)
 
 #
-# Try to enable as many C99 features as we can.
-# At minimum, we want C++/C99-style // comments.
+# For getting raw lists of --libs and --libs --static information from a
+# pkg-config module.
 #
-# Newer versions of compilers might default to supporting C99, but older
-# versions may require a special flag.
+# In CMake up to 2.8.12, pkg_check_modules() sets:
 #
-# Prior to CMake 3.1, setting CMAKE_C_STANDARD will not have any effect,
-# so, unless and until we require CMake 3.1 or later, we have to do it
-# ourselves on pre-3.1 CMake, so we just do it ourselves on all versions
-# of CMake.
+#    <XPREFIX>_LIBRARIES, which is a list of library names to which, on
+#      a UN*X, -l can be prefixed - i.e., names, without extensions,
+#      rather than full paths to the file.
+#    <XPREFIX>_LIBRARY_DIRS, which is a list of paths to directories
+#      containing the libraries, to which, on a UN*X, -L can be
+#      prefixed.
+#    <XPREFIX>_LDFLAGS, which is a list of *all* required linker flags
+#    <XPREFIX>_LDFLAGS_OTHER, which is a list of all linker flags other
+#      than -l and -L flags
 #
-# Note: with CMake 3.1 through 3.5, the only compilers for which CMake
-# handles CMAKE_C_STANDARD are GCC and Clang.  3.6 adds support only
-# for Intel C; 3.9 adds support for PGI C, Sun C, and IBM XL C, and
-# 3.10 adds support for Cray C and IAR C, but no version of CMake has
-# support for HP C.  Therefore, even if we use CMAKE_C_STANDARD with
-# compilers for which CMake supports it, we may still have to do it
-# ourselves on other compilers.
+# In 3.0 (at least as of 3.0.2), it also sets:
 #
-# See the CMake documentation for the CMAKE_<LANG>_COMPILER_ID variables
-# for a list of compiler IDs.
+#    <XPREFIX>_LINK_LIBRARIES, which is a list of full paths to the
+#      library files.
 #
-# We don't worry about MSVC; it doesn't have such a flag - either it
-# doesn't support the C99 features we need at all, or it supports them
-# regardless of the compiler flag.
+# but if <XPREFIX> is <PREFIX>_STATIC, <XPREFIX>_LINK_LIBRARIES is
+# currently not set by CMake.
 #
-# XXX - this just tests whether the option works and adds it if it does.
-# We don't test whether it's necessary in order to get the C99 features
-# that we use; if we ever have a user who tries to compile with a compiler
-# that can't be made to support those features, we can add a test to make
-# sure we actually *have* C99 support.
+# Unfortunately, pkg_check_modules() sets the
+# PKG_CONFIG_ALLOW_SYSTEM_LIBS environment variable when running
+# pkg-config, so the output of --libs, etc. may include a -L for the
+# system library, which we do *NOT* want to put in our libpcap.pc and
+# pcap-config files.
 #
+# So we just run pkg-config ourselves, so that we get its output
+# directly without any processing by CMake.
+#
+macro(pkg_get_link_info _prefix _package)
+  if (PKG_CONFIG_EXECUTABLE)
+    #
+    # Get the --libs information.
+    #
+    # We force PKG_CONFIG_ALLOW_SYSTEM_LIBS to be undefined, as
+    # at least some versions of CMake appear to define it in
+    # pkg_check_modules() before running pkg-config and *not* undefine
+    # it after running it.
+    #
+    unset(ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS})
+    set(_pkg_config_result "")
+    execute_process(
+      COMMAND ${PKG_CONFIG_EXECUTABLE} "--libs" ${_package}
+      OUTPUT_VARIABLE _pkg_config_result
+      RESULT_VARIABLE _pkg_config_failed
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+    if (_pkg_config_failed)
+      #
+      # pkg-config failed; assume that means that there is no such
+      # package for it to find.  XXX - what do we do here?
+      #
+      set(${_prefix}_FOUND_WITH_PKG_CONFIG FALSE)
+    else()
+      #
+      # pkg-config succeeded; replace CR and LF with spaces.
+      #
+      string(REGEX REPLACE "[\r\n]" " " ${_prefix}_LIBS 
"${_pkg_config_result}")
+
+      #
+      # Now get the --libs --static information.
+      #
+      set(_pkg_config_result "")
+      execute_process(
+        COMMAND ${PKG_CONFIG_EXECUTABLE} "--libs" "--static" ${_package}
+        OUTPUT_VARIABLE _pkg_config_result
+        RESULT_VARIABLE _pkg_config_failed
+        OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+      if (_pkg_config_failed)
+        #
+        # pkg-config failed; assume that means that there is no such
+        # package for it to find.  XXX - what do we do here?
+        #
+        set(${_prefix}_FOUND_WITH_PKG_CONFIG FALSE)
+      else()
+        #
+        # pkg-config succeeded; replace CR and LF with spaces.
*** 67527 LINES SKIPPED ***

Reply via email to