Snap for 10447354 from bbb101d25e92b5dc80aca428fa355d6e27da9ecc to mainline-resolv-release

Change-Id: If4804b3d487826f6f57ad5d7e8ad83c2c1210807
diff --git a/.appveyor.yml b/.appveyor.yml
index 001d50c..7b1f9f2 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -15,8 +15,8 @@
   - win_bison --version
   - appveyor DownloadFile https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip
   - 7z x .\WpdPack_4_1_2.zip -oc:\projects\libpcap\Win32
-  - appveyor DownloadFile https://nmap.org/npcap/dist/npcap-sdk-1.07.zip
-  - 7z x .\npcap-sdk-1.07.zip -oc:\projects\libpcap\Win32\npcap-sdk-1.07
+  - appveyor DownloadFile https://npcap.com/dist/npcap-sdk-1.13.zip
+  - 7z x .\npcap-sdk-1.13.zip -oc:\projects\libpcap\Win32\npcap-sdk-1.13
   - appveyor DownloadFile https://support.riverbed.com/bin/support/download?sid=l3vk3eu649usgu3rj60uncjqqu -FileName AirPcap_Devpack.zip
   - 7z x .\AirPcap_Devpack.zip -oc:\projects\libpcap\Win32
 
@@ -28,24 +28,15 @@
       AIRPCAP: -DDISABLE_AIRPCAP=YES
       MINGW_ROOT: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
-      GENERATOR: "MinGW Makefiles"
-      SDK: npcap-sdk-1.07
-      AIRPCAP: -DDISABLE_AIRPCAP=YES
-      MINGW_ROOT: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0
-    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
-      GENERATOR: "Visual Studio 14 2015"
-      SDK: WpdPack
-      AIRPCAP: -DDISABLE_AIRPCAP=YES
-    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
       GENERATOR: "Visual Studio 14 2015 Win64"
       SDK: WpdPack
       AIRPCAP: -DDISABLE_AIRPCAP=YES
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
       GENERATOR: "Visual Studio 14 2015"
-      SDK: npcap-sdk-1.07
+      SDK: npcap-sdk-1.12
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
       GENERATOR: "Visual Studio 14 2015 Win64"
-      SDK: npcap-sdk-1.07
+      SDK: npcap-sdk-1.12
       AIRPCAP: -DDISABLE_AIRPCAP=YES
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
       GENERATOR: "Visual Studio 15 2017"
@@ -56,15 +47,15 @@
       AIRPCAP: -DDISABLE_AIRPCAP=YES
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
       GENERATOR: "Visual Studio 15 2017"
-      SDK: npcap-sdk-1.07
+      SDK: npcap-sdk-1.12
       AIRPCAP: -DDISABLE_AIRPCAP=YES
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
       GENERATOR: "Visual Studio 15 2017 Win64"
-      SDK: npcap-sdk-1.07
+      SDK: npcap-sdk-1.12
       AIRPCAP: -DDISABLE_AIRPCAP=YES
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
       GENERATOR: "Visual Studio 15 2017 Win64"
-      SDK: npcap-sdk-1.07
+      SDK: npcap-sdk-1.12
       AIRPCAP: -DDISABLE_AIRPCAP=NO
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
       GENERATOR: "Visual Studio 16 2019"
@@ -79,17 +70,17 @@
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
       GENERATOR: "Visual Studio 16 2019"
       PLATFORM: Win32
-      SDK: npcap-sdk-1.07
+      SDK: npcap-sdk-1.12
       AIRPCAP: -DDISABLE_AIRPCAP=YES
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
       GENERATOR: "Visual Studio 16 2019"
       PLATFORM: x64
-      SDK: npcap-sdk-1.07
+      SDK: npcap-sdk-1.12
       AIRPCAP: -DDISABLE_AIRPCAP=YES
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
       GENERATOR: "Visual Studio 16 2019"
       PLATFORM: x64
-      SDK: npcap-sdk-1.07
+      SDK: npcap-sdk-1.12
       AIRPCAP: -DDISABLE_AIRPCAP=NO
 
 build_script:
diff --git a/.travis-coverity-scan-build.sh b/.ci-coverity-scan-build.sh
similarity index 79%
rename from .travis-coverity-scan-build.sh
rename to .ci-coverity-scan-build.sh
index 7ea1dac..686806a 100755
--- a/.travis-coverity-scan-build.sh
+++ b/.ci-coverity-scan-build.sh
@@ -6,7 +6,6 @@
 printf "\033[33;1mNote: COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN are available on Project Settings page on scan.coverity.com\033[0m\n"
 [ -z "$COVERITY_SCAN_PROJECT_NAME" ] && echo "ERROR: COVERITY_SCAN_PROJECT_NAME must be set" && exit 1
 #[ -z "$COVERITY_SCAN_NOTIFICATION_EMAIL" ] && echo "ERROR: COVERITY_SCAN_NOTIFICATION_EMAIL must be set" && exit 1
-[ -z "$COVERITY_SCAN_BRANCH_PATTERN" ] && echo "ERROR: COVERITY_SCAN_BRANCH_PATTERN must be set" && exit 1
 [ -z "$COVERITY_SCAN_BUILD_COMMAND" ] && echo "ERROR: COVERITY_SCAN_BUILD_COMMAND must be set" && exit 1
 [ -z "$COVERITY_SCAN_TOKEN" ] && echo "ERROR: COVERITY_SCAN_TOKEN must be set" && exit 1
 
@@ -17,31 +16,6 @@
 UPLOAD_URL="https://scan.coverity.com/builds"
 SCAN_URL="https://scan.coverity.com"
 
-# Verify Coverity Scan run condition
-COVERITY_SCAN_RUN_CONDITION=${coverity_scan_run_condition:-true}
-printf "\033[33;1mTesting '%s' condition... " "$COVERITY_SCAN_RUN_CONDITION"
-if eval [ "$COVERITY_SCAN_RUN_CONDITION" ]; then
-  printf "True.\033[0m\n"
-else
-  printf "False. Exit.\033[0m\n"
-  exit 0
-fi
-
-# Do not run on pull requests
-if [ "${TRAVIS_PULL_REQUEST}" = "true" ]; then
-  printf "\033[33;1mINFO: Skipping Coverity Analysis: branch is a pull request.\033[0m\n"
-  exit 0
-fi
-
-# Verify this branch should run
-IS_COVERITY_SCAN_BRANCH=$(ruby -e "puts '${TRAVIS_BRANCH}' =~ /\\A$COVERITY_SCAN_BRANCH_PATTERN\\z/ ? 1 : 0")
-if [ "$IS_COVERITY_SCAN_BRANCH" = "1" ]; then
-  printf "\033[33;1mCoverity Scan configured to run on branch %s\033[0m\n" "$TRAVIS_BRANCH"
-else
-  printf "\033[33;1mCoverity Scan NOT configured to run on branch %s\033[0m\n" "$TRAVIS_BRANCH"
-  exit 1
-fi
-
 # Verify upload is permitted
 AUTH_RES=$(curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted)
 if [ "$AUTH_RES" = "Access denied" ]; then
@@ -82,6 +56,7 @@
 eval "${COVERITY_SCAN_BUILD_COMMAND_PREPEND}"
 # Do not quote COV_BUILD_OPTIONS so it collapses when it is empty and expands
 # when it is not.
+# shellcheck disable=SC2086
 COVERITY_UNSUPPORTED=1 cov-build --dir "$RESULTS_DIR" $COV_BUILD_OPTIONS "$COVERITY_SCAN_BUILD_COMMAND"
 cov-import-scm --dir $RESULTS_DIR --scm git --log $RESULTS_DIR/scm_log.txt 2>&1
 
diff --git a/.cirrus.yml b/.cirrus.yml
index e150cbb..c2cf422 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -7,58 +7,67 @@
   only_if: $CIRRUS_BRANCH != 'coverity_scan'
   freebsd_instance:
     matrix:
-      - image_family: freebsd-11-4
+      - image_family: freebsd-12-3
         cpu: 2
         memory: 2G
-      - image_family: freebsd-12-2
-        cpu: 2
-        memory: 2G
-      - image_family: freebsd-13-0
+      - image_family: freebsd-13-1
         cpu: 4
         memory: 4G
   env:
     IGNORE_OSVERSION: yes
     MAKEFLAGS: -j 4
-    MATRIX_CC: clang gcc48 gcc10
+    MATRIX_CC: clang14 gcc12
   script:
-    - pkg install -qy autoconf gcc48 gcc10
-    - pkg install -qy bash cmake git # for build_matrix.sh and build.sh
+    - pkg install -qy autoconf gcc12 llvm14
+    - pkg install -qy cmake git-tiny # for build_matrix.sh and build.sh
     - ./build_matrix.sh
 
 linux_task:
   name: linux-amd64
   only_if: $CIRRUS_BRANCH != 'coverity_scan'
   container:
-    image: ubuntu:20.04
+    image: ubuntu:22.04
     cpu: 2
     memory: 1G
   env:
     DEBIAN_FRONTEND: noninteractive
     MAKEFLAGS: -j 3
   script:
-    - apt-get -qy update
-    - apt-get -qy install libdbus-1-dev libbluetooth-dev libnl-genl-3-dev libibverbs-dev
-    - apt-get -qy install flex bison autoconf make clang gcc
-    - apt-get -qy install cmake git # for build_matrix.sh and build.sh
+    - apt-get -qy update >/dev/null
+    - apt-get -qy install libdbus-1-dev libbluetooth-dev libnl-genl-3-dev libibverbs-dev libssl-dev >/dev/null
+    - apt-get -qy install flex bison autoconf make clang gcc valgrind >/dev/null
+    - apt-get -qy install cmake git bc >/dev/null # for build_matrix.sh and build.sh
     - apt list --installed 'lib*-dev'
     - ./build_matrix.sh
 
 macos_task:
-  name: macos-amd64
+  name: macos-aarch64
   only_if: $CIRRUS_BRANCH != 'coverity_scan'
   macos_instance:
-    image: big-sur-xcode
+    image: ghcr.io/cirruslabs/macos-ventura-xcode:14.1 # macOS 13 with Xcode 14.1
   env:
-    MAKEFLAGS: '-j 12' # macOS VMs always run on 12 cores
+    MAKEFLAGS: '-j 4' # macOS VMs run on 4 cores
   script:
     - brew update >/dev/null
+    - brew install openssl@3
     - ./build_matrix.sh
 
+#
+# Just testing for now.
+#
+windows_task:
+  name: windows-amd64
+  only_if: $CIRRUS_BRANCH != 'coverity_scan'
+  windows_container:
+    image: cirrusci/windowsservercore:2019
+  script:
+    - set/?
+
 coverity_task:
   name: Coverity Scan
   only_if: $CIRRUS_BRANCH == 'coverity_scan'
   container:
-    image: ubuntu:20.04
+    image: ubuntu:22.04
     cpu: 2
     memory: 2G
   env:
@@ -68,13 +77,10 @@
     COVERITY_SCAN_TOKEN: ENCRYPTED[58bfbfcf624e5b7b85fb9df95dd0b3f9f93642824e6ae94616e4d345af4848580932a6ece02337fee112194b29ce6593]
     COVERITY_SCAN_BUILD_COMMAND_PREPEND: ./configure --enable-remote
     COVERITY_SCAN_BUILD_COMMAND: make
-    COVERITY_SCAN_BRANCH_PATTERN: $CIRRUS_BRANCH
-    TRAVIS_BRANCH: $CIRRUS_BRANCH
-    TRAVIS_PULL_REQUEST: ${CIRRUS_BASE_BRANCH:+true}
   script:
-    - apt-get -qy update
-    - apt-get -qy install libdbus-1-dev libbluetooth-dev libnl-genl-3-dev libibverbs-dev
-    - apt-get -qy install flex bison autoconf make gcc
-    - apt-get -qy install git curl wget ruby rubygems ruby-json # for the coverity script
+    - apt-get -qy update >/dev/null
+    - apt-get -qy install libdbus-1-dev libbluetooth-dev libnl-genl-3-dev libibverbs-dev >/dev/null
+    - apt-get -qy install flex bison autoconf make gcc >/dev/null
+    - apt-get -qy install git curl wget ruby rubygems ruby-json >/dev/null # for the coverity script
     - apt list --installed 'lib*-dev'
-    - ./.travis-coverity-scan-build.sh
+    - ./.ci-coverity-scan-build.sh
diff --git a/.github/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE
new file mode 100644
index 0000000..34fd328
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE
@@ -0,0 +1,5 @@
+To report a security issue please send an e-mail to security@tcpdump.org.
+
+To report bugs and other problems, contribute patches, request a
+feature, provide generic feedback etc please see the file
+CONTRIBUTING.md in the libpcap source tree root.
diff --git a/.gitignore b/.gitignore
index 06a62e5..789b8df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,73 @@
+.DS_Store
 Makefile
 *~
-*.a
 *.o
+/bpf_filter.c
+capturetest
+can_set_rfmon_test
+CMakeCache.txt
+cmake_install.cmake
+CMakeFiles/
+config.h
 config.log
 config.cache
 config.status
 stamp-h
 stamp-h.in
 autom4te.cache/
+.devel
+filtertest
+findalldevstest
+opentest
+valgrindtest
+reactivatetest
+grammar.c
+grammar.h
+grammar.y
+libpcap.a
+libpcap.*.dylib
+libpcap.pc
+libpcap.sl
+libpcap.so
+libpcap.so.*
+libpcap-*.tar.gz
+net
+os-proto.h
+pcap-config
+pcap-filter.manmisc
+pcap-linktype.manmisc
+pcap-savefile.manfile
+pcap-tstamp.manmisc
+pcap.3pcap
+pcap_compile.3pcap
+pcap_datalink.3pcap
+pcap_dump_open.3pcap
+pcap_get_tstamp_precision.3pcap
+pcap_list_datalinks.3pcap
+pcap_list_tstamp_types.3pcap
+pcap_open_dead.3pcap
+pcap_open_offline.3pcap
+pcap_set_immediate_mode.3pcap
+pcap_set_tstamp_precision.3pcap
+pcap_set_tstamp_type.3pcap
+scanner.c
+scanner.c.bottom
+scanner.h
+selpolltest
+*.log
+*.tlog
+*.obj
+*.sdf
+*.opensdf
+*.suo
+*.pdb
+*.lib
+*.dll
+*.exp
+*.vcxproj.user
+Debug/
+Release/
+msdos/.depend.dj
+msdos/bin2c.exe
+msdos/pkt_rx1.lst
+msdos/pkt_stub.inc
diff --git a/Android.bp b/Android.bp
index e3a7a1b..37d6227 100644
--- a/Android.bp
+++ b/Android.bp
@@ -47,26 +47,28 @@
     defaults: ["libpcap_defaults"],
 
     // (Matches order in libpcap's Makefile.)
-    srcs: [
-        "pcap-linux.c",
-        "pcap-usb-linux.c",
-        "pcap-netfilter-linux-android.c",
-        "fad-getad.c",
-        "pcap.c",
-        "gencode.c",
-        "optimize.c",
-        "nametoaddr.c",
+    srcs: [     
+        "bpf_dump.c",
+        "bpf_filter.c",
+        "bpf_image.c",
         "etherent.c",
+        "fad-getad.c",
         "fmtutils.c",
+        "gencode.c",
+        "grammar.c",
+        "nametoaddr.c",
+        "optimize.c",
+        "pcap-common.c",
+        "pcap-linux.c",
+        "pcap-netfilter-linux-android.c",
+        "pcap-usb-linux-common.c",
+        "pcap-usb-linux.c",
+        "pcap-util.c",
+        "pcap.c",
         "savefile.c",
+        "scanner.c",
         "sf-pcap.c",
         "sf-pcapng.c",
-        "pcap-common.c",
-        "bpf_image.c",
-        "bpf_filter.c",
-        "bpf_dump.c",
-        "scanner.c",
-        "grammar.c",
     ],
 
     target: {
diff --git a/CHANGES b/CHANGES
index 874e2f2..d174cd5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,225 @@
-Wednesday, June 9, 2011:
+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
@@ -234,7 +455,7 @@
         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)
@@ -275,7 +496,6 @@
     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 mcr@sandelman.ca
@@ -283,7 +503,7 @@
     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.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b83fbbd..58c5159 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,9 +35,283 @@
     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)
+
+#
+# For getting raw lists of --libs and --libs --static information from a
+# pkg-config module.
+#
+# In CMake up to 2.8.12, pkg_check_modules() sets:
+#
+#    <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
+#
+# In 3.0 (at least as of 3.0.2), it also sets:
+#
+#    <XPREFIX>_LINK_LIBRARIES, which is a list of full paths to the
+#      library files.
+#
+# but if <XPREFIX> is <PREFIX>_STATIC, <XPREFIX>_LINK_LIBRARIES is
+# currently not set by CMake.
+#
+# 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.
+        #
+        string(REGEX REPLACE "[\r\n]" " " ${_prefix}_LIBS_STATIC "${_pkg_config_result}")
+
+        #
+        # List this package in its PACKAGE_NAME variable.
+        #
+        set(${_prefix}_PACKAGE_NAME "${_package}")
+
+        #
+        # It worked.
+        #
+        set(${_prefix}_FOUND_WITH_PKG_CONFIG TRUE)
+      endif()
+    endif()
+  endif()
+endmacro()
+
+macro(get_link_info_from_library_path  _library_prefix _library_name)
+  if(NOT ${_library_prefix}_LIBRARY STREQUAL "${_library_prefix}_LIBRARY-NOTFOUND")
+    get_filename_component(_lib_directory "${${_library_prefix}_LIBRARY}}" DIRECTORY)
+
+    #
+    # The closest thing to a list of "system library directories" in
+    # which the linker will, by default, search for libraries appears to
+    # be CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES, so that's what we use
+    # when we're trying to construct a -L argument, for insertion into
+    # pcap-config and libpcap.pc, for a library upon which we depend.
+    #
+    # In some versions of CMake it appears to have duplicate entries,
+    # but that shouldn't affect a search for a directory in that list.
+    #
+    list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${_lib_directory}" _lib_index)
+    if(_lib_index EQUAL -1)
+      #
+      # No, so add a -L flag to get the linker to search in that
+      # directory.
+      #
+      set(${_library_prefix}_LIBS "-L${_lib_directory}")
+      set(${_library_prefix}_LIBS_STATIC "-L${_lib_directory}")
+      set(${_libraryprefix}_LIBS_PRIVATE "-L${_lib_directory}")
+    endif()
+    set(${_library_prefix}_LIBS "${${_library_prefix}_LIBS} -l${_library_name}")
+    set(${_library_prefix}_LIBS_STATIC "${${_library_prefix}_LIBS} -l${_library_name}")
+    set(${_library_prefix}_LIBS_PRIVATE "${${_library_prefix}_LIBS} -l${_library_name}")
+  endif()
+endmacro()
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
+    enable_language(CXX)
+
+    #
+    # OK, this is a royal pain.
+    #
+    # CMake will try to determine the sizes of some data types, including
+    # void *, early in the process of configuration; apparently, it's done
+    # as part of processing the project() command.
+    #
+    # At least as of CMake 2.8.6, it does so by checking the size of
+    # "void *" in C, setting CMAKE_C_SIZEOF_DATA_PTR based on that,
+    # setting CMAKE_SIZEOF_VOID_P to that, and then checking the size
+    # of "void *" in C++, setting CMAKE_CXX_SIZEOF_DATA_PTR based on
+    # that, and then setting CMAKE_SIZEOF_VOID_P to *that*.
+    #
+    # The compile tests include whatever C flags may have been provided
+    # to CMake in the CFLAGS and CXXFLAGS environment variables.
+    #
+    # If you set an architecture flag such as -m32 or -m64 in CFLAGS
+    # but *not* in CXXFLAGS, the size for C++ will win, and hilarity
+    # will ensue.
+    #
+    # Or if, at least on Solaris, you have a newer version of GCC
+    # installed, but *not* a newer version of G++, and you have Oracle
+    # Studio installed, it will find GCC, which will default to building
+    # 64-bit, and Oracle Studio's C++ compiler, which will default to
+    # building 32-bit, the size for C++ will win, and, again, hilarity
+    # will ensue.
+    #
+    # So we make sure both languages have the same pointer sizes with
+    # the flags they're given; if they don't, it means that the
+    # compilers for the languages will, with those flags, not produce
+    # code that can be linked together.
+    #
+    # This is unlikely to happen on Haiku, but it *has* happened on
+    # Solaris; we do this for future-proofing, in case we ever need
+    # C++ on a platform where that can happen.
+    #
+    if(NOT ${CMAKE_C_SIZEOF_DATA_PTR} EQUAL ${CMAKE_CXX_SIZEOF_DATA_PTR})
+         message(FATAL_ERROR
+"C compiler ${CMAKE_C_COMPILER} produces code with \
+${CMAKE_C_SIZEOF_DATA_PTR}-byte pointers while C++ compiler \
+${CMAKE_CXX_COMPILER} produces code with \
+${CMAKE_CXX_SIZEOF_DATA_PTR}-byte pointers. \
+This prevents code in these languages from being combined.")
+    endif()
+endif()
+
+#
+# Show the bit width for which we're compiling.
+# This can help debug problems if you're dealing with a compiler that
+# defaults to generating 32-bit code even when running on a 64-bit
+# platform, and where that platform may provide only 64-bit versions of
+# libraries that we might use (looking at *you*, Oracle Studio!).
+#
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+  message(STATUS "Building 32-bit")
+elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+  message(STATUS "Building 64-bit")
+endif()
+
+#
+# Solaris pkg-config is annoying.  For at least one package (D-Bus, I'm
+# looking at *you*!), there are separate include files for 32-bit and
+# 64-bit builds (I guess using "unsigned long long" as a 64-bit integer
+# type on a 64-bit build is like crossing the beams or soething), and
+# there are two separate .pc files, so if we're doing a 32-bit build we
+# should make sure we look in /usr/lib/pkgconfig for .pc files and if
+# we're doing a 64-bit build we should make sure we look in
+# /usr/lib/amd64/pkgconfig for .pc files.
+#
+if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
+    #
+    # Note: string(REPLACE) does not appear to support using ENV{...}
+    # as an argument, so we set a variable and then use set() to set
+    # the environment variable.
+    #
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+        #
+        # 64-bit build.  If /usr/lib/pkgconfig appears in the path,
+        # prepend /usr/lib/amd64/pkgconfig to it; otherwise,
+        # put /usr/lib/amd64 at the end.
+        #
+        if((NOT DEFINED ENV{PKG_CONFIG_PATH}) OR "$ENV{PKG_CONFIG_PATH}" EQUAL "")
+            #
+            # Not set, or empty.  Set it to /usr/lib/amd64/pkgconfig.
+            #
+            set(fixed_path "/usr/lib/amd64/pkgconfig")
+        elseif("$ENV{PKG_CONFIG_PATH}" MATCHES "/usr/lib/pkgconfig")
+            #
+            # It contains /usr/lib/pkgconfig.  Prepend
+            # /usr/lib/amd64/pkgconfig to /usr/lib/pkgconfig.
+            #
+            string(REPLACE "/usr/lib/pkgconfig"
+                "/usr/lib/amd64/pkgconfig:/usr/lib/pkgconfig"
+                fixed_path "$ENV{PKG_CONFIG_PATH}")
+        else()
+            #
+            # Not empty, but doesn't contain /usr/lib/pkgconfig.
+            # Append /usr/lib/amd64/pkgconfig to it.
+            #
+            set(fixed_path "$ENV{PKG_CONFIG_PATH}:/usr/lib/amd64/pkgconfig")
+        endif()
+        set(ENV{PKG_CONFIG_PATH} "${fixed_path}")
+    elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+        #
+        # 32-bit build.  If /usr/amd64/lib/pkgconfig appears in the path,
+        # prepend /usr/lib/pkgconfig to it.
+        #
+        if("$ENV{PKG_CONFIG_PATH}" MATCHES "/usr/lib/amd64/pkgconfig")
+            #
+            # It contains /usr/lib/amd64/pkgconfig.  Prepend
+            # /usr/lib/pkgconfig to /usr/lib/amd64/pkgconfig.
+            #
+            string(REPLACE "/usr/lib/amd64/pkgconfig"
+                "/usr/lib/pkgconfig:/usr/lib/amd64/pkgconfig"
+                fixed_path "$ENV{PKG_CONFIG_PATH}")
+            set(ENV{PKG_CONFIG_PATH} "${fixed_path}")
+        endif()
+    endif()
+endif()
 
 include(CheckCCompilerFlag)
 
@@ -141,15 +415,17 @@
 
 #
 # If we're building with MinGW, we need to specify _WIN32_WINNT as
-# 0x0600 ("NT 6.0", a/k/a Vista/Windows Server 2008) in order to
-# get the full IPv6 API, including inet_ntop().
+# 0x0600 ("NT 6.0", a/k/a Vista/Windows Server 2008) or higher
+# in order to get the full IPv6 API, including inet_ntop(), and we
+# need to specify it as 0x0601 ("NT 6.1", a/k/a Windows 7) or higher
+# in order to get NdisMediumIP.
 #
 # NOTE: pcap does *NOT* work with msvcrt.dll; it must link with
 # a newer version of the C library, i.e. Visual Studio 2015 or
 # later, as it depends on C99 features introduced in VS 2015.
 #
 if(MINGW)
-    add_definitions(-D_WIN32_WINNT=0x0600)
+    add_definitions(-D_WIN32_WINNT=0x0601)
 endif(MINGW)
 
 #
@@ -183,6 +459,7 @@
     option(USE_STATIC_RT "Use static Runtime" ON)
 endif(WIN32)
 option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+set(dpdk_ROOT "" CACHE PATH "Path to directory with include and lib subdirectories for DPDK")
 if(WIN32)
     set(Packet_ROOT "" CACHE PATH "Path to directory with include and lib subdirectories for packet.dll")
     set(AirPcap_ROOT "" CACHE PATH "Path to directory with include and lib subdirectories for airpcap.dll")
@@ -304,19 +581,19 @@
     endif(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/../../Common)
 
     find_package(Packet)
-    if(PACKET_FOUND)
+    if(Packet_FOUND)
         set(HAVE_PACKET32 TRUE)
-        include_directories(${PACKET_INCLUDE_DIRS})
+        include_directories(${Packet_INCLUDE_DIRS})
         #
         # Check whether we have the NPcap PacketIsLoopbackAdapter()
         # function.
         #
         cmake_push_check_state()
-        set(CMAKE_REQUIRED_LIBRARIES ${PACKET_LIBRARIES})
+        set(CMAKE_REQUIRED_LIBRARIES ${Packet_LIBRARIES})
         check_function_exists(PacketIsLoopbackAdapter HAVE_PACKET_IS_LOOPBACK_ADAPTER)
         check_function_exists(PacketGetTimestampModes HAVE_PACKET_GET_TIMESTAMP_MODES)
         cmake_pop_check_state()
-    endif(PACKET_FOUND)
+    endif(Packet_FOUND)
 
     message(STATUS "checking for Npcap's version.h")
     check_symbol_exists(WINPCAP_PRODUCT_NAME "${CMAKE_SOURCE_DIR}/../../version.h" HAVE_VERSION_H)
@@ -380,25 +657,6 @@
     check_include_file(sys/select.h HAVE_SYS_SELECT_H)
 
     check_include_file(netpacket/packet.h HAVE_NETPACKET_PACKET_H)
-    check_include_files("sys/types.h;sys/socket.h;net/if.h;net/pfvar.h" HAVE_NET_PFVAR_H)
-    if(HAVE_NET_PFVAR_H)
-        #
-        # Check for various PF actions.
-        #
-        check_c_source_compiles(
-"#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <net/pfvar.h>
-
-int
-main(void)
-{
-    return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;
-}
-"
-            HAVE_PF_NAT_THROUGH_PF_NORDR)
-    endif(HAVE_NET_PFVAR_H)
     check_include_file(netinet/if_ether.h HAVE_NETINET_IF_ETHER_H)
 endif(NOT WIN32)
 
@@ -522,6 +780,10 @@
 # that's been set, it skips the test, so we need different variables.
 #
 set(PCAP_LINK_LIBRARIES "")
+set(LIBS "")
+set(LIBS_STATIC "")
+set(REQUIRES_PRIVATE "")
+set(LIBS_PRIVATE "")
 include(CheckLibraryExists)
 if(WIN32)
     #
@@ -557,6 +819,9 @@
             # OK, we found it in libsocket.
             #
             set(PCAP_LINK_LIBRARIES socket nsl ${PCAP_LINK_LIBRARIES})
+            set(LIBS "-lsocket -lnsl ${LIBS}")
+            set(LIBS_STATIC "-lsocket -lnsl ${LIBS_STATIC}")
+            set(LIBS_PRIVATE "-lsocket -lnsl ${LIBS_PRIVATE}")
         else(LIBSOCKET_HAS_GETADDRINFO)
             check_library_exists(network getaddrinfo "" LIBNETWORK_HAS_GETADDRINFO)
             if(LIBNETWORK_HAS_GETADDRINFO)
@@ -564,6 +829,9 @@
                 # OK, we found it in libnetwork (Haiku).
                 #
                 set(PCAP_LINK_LIBRARIES network ${PCAP_LINK_LIBRARIES})
+                set(LIBS "-lnetwork ${LIBS}")
+                set(LIBS_STATIC "-lnetwork ${LIBS_STATIC}")
+                set(LIBS_PRIVATE "-lnetwork ${LIBS_PRIVATE}")
             else(LIBNETWORK_HAS_GETADDRINFO)
                 #
                 # We didn't find it.
@@ -585,6 +853,9 @@
             # Yes - link with it as well.
             #
             set(PCAP_LINK_LIBRARIES xnet ${PCAP_LINK_LIBRARIES})
+            set(LIBSC "-lxnet ${LIBS_LIBS}")
+            set(LIBS_STATIC "-lxnet ${LIBS_STATIC}")
+            set(LIBS_PRIVATE "-lxnet ${LIBS_PRIVATE}")
         endif(LIBXNET_HAS_RECVMSG)
     endif(NOT STDLIBS_HAVE_GETADDRINFO)
 
@@ -594,8 +865,20 @@
         check_library_exists(str putmsg "" LIBSTR_HAS_PUTMSG)
         if(LIBSTR_HAS_PUTMSG)
             set(PCAP_LINK_LIBRARIES str ${PCAP_LINK_LIBRARIES})
+            set(LIBS "-lstr ${LIBS}")
+            set(LIBS_STATIC "-lstr ${LIBS_STATIC}")
+            set(LIBS_PRIVATE "-lstr ${LIBS_PRIVATE}")
         endif(LIBSTR_HAS_PUTMSG)
     endif(NOT STDLIBS_HAVE_PUTMSG)
+
+    # Haiku has getpass in libbsd
+    check_function_exists(getpass STDLIBS_HAVE_GETPASS)
+    if(NOT STDLIBS_HAVE_GETPASS)
+        check_library_exists(bsd getpass "" LIBBSD_HAS_GETPASS)
+        if(LIBBSD_HAS_GETPASS)
+            set(PCAP_LINK_LIBRARIES bsd ${PCAP_LINK_LIBRARIES})
+        endif(LIBBSD_HAS_GETPASS)
+    endif(NOT STDLIBS_HAVE_GETPASS)
 endif(WIN32)
 
 #
@@ -1049,6 +1332,76 @@
   #
   include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})
   set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} ${OPENSSL_LIBRARIES})
+
+  #
+  # The find_package() module CMake provides for OpenSSL uses does not
+  # give us a defined indication of whether it found OpenSSL with
+  # pkg-config or not.  We need to know that as, if it was found with
+  # pkg-config, we should set the Requires.private value in libpcap.pc
+  # to include its package name, openssl, otherwise we should add the
+  # names for the static libraries to Libs.private.
+  #
+  # On UN*X, FindOpenSSL happens to use pkg-config to find OpenSSL, but
+  # it doesn't appear to be documented as doing so; therefore, we don't
+  # assume that, if we got here, we have pkg-config.
+  #
+  # So we use pkg_get_link_info() to run pkg-config ourselves, both
+  # because FindOpenSSL doesn't set the OPENSSL_LDFLAGS or
+  # OPENSSL_STATIC_LDFLAGS variables and because, for reasons explained
+  # in the comment before the pkg_get_link_info() macro, even if it did,
+  # it wouldn't be what we want anyway.
+  #
+  if (PKG_CONFIG_EXECUTABLE)
+    pkg_get_link_info(OPENSSL openssl)
+    if (OPENSSL_FOUND_WITH_PKG_CONFIG)
+      #
+      # pkg-config failed; assume that means that there is no openssl
+      # package for it to find.  Just add OPENSSL_LIBRARIES to
+      # LIBS_PRIVATE AND LIBS_STATIC, as that's the
+      # best we can do. XXX - need list of -l and -L flags to add....
+      #
+      set(LIBS "${LIBS} ${OPENSSL_LIBS}")
+      set(LIBS_STATIC "${LIBS_STATIC} ${OPENSSL_LIBS_STATIC}")
+      set(REQUIRES_PRIVATE "${REQUIRES_PRIVATE} ${OPENSSL_PACKAGE_NAME}")
+    endif()
+  else()
+    # Get it from OPENSSL_LIBRARIES
+    foreach(_lib IN LISTS OPENSSL_LIBRARIES)
+      #
+      # Get the directory in which the library resides.
+      #
+      get_filename_component(_lib_directory "${_lib}" DIRECTORY)
+
+      #
+      # Is the library directory in CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES?
+      # (See comment above on why we use that.)
+      #
+      list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${_lib_directory}" _lib_index)
+      if(_lib_index EQUAL -1)
+        #
+        # No, so add a -L flag to get the linker to search in that
+        # directory.
+        #
+        set(LIBS "${LIBS} -L${_lib_directory}")
+        set(LIBS_STATIC "${LIBS_STATIC} -L${_lib_directory}")
+        set(LIBS_PRIVATE "${LIBS_PRIVATE} -L${_lib_directory}")
+      endif()
+
+      #
+      # Get the file name of the library, without the extension.
+      #
+      get_filename_component(_lib_filename "${_lib}" NAME_WE)
+
+      #
+      # Strip off the "lib" prefix to get the library name, and
+      # add a -l flag based on that.
+      #
+      string(REGEX REPLACE "^lib" "" _library_name "${_lib_filename}")
+      set(LIBS "${LIBS} -l${_library_name}")
+      set(LIBS_STATIC "${LIBS_STATIC} -l${_library_name}")
+      set(LIBS_PRIVATE "${LIBS_PRIVATE} -l${_library_name}")
+    endforeach()
+  endif()
   set(HAVE_OPENSSL YES)
 endif(OPENSSL_FOUND)
 
@@ -1078,6 +1431,8 @@
     nametoaddr.c
     optimize.c
     pcap-common.c
+    pcap-usb-linux-common.c
+    pcap-util.c
     pcap.c
     savefile.c
     sf-pcapng.c
@@ -1255,6 +1610,9 @@
             # Nothing we support.
             #
             set(PCAP_TYPE null)
+            message(WARNING
+"cannot determine packet capture interface
+(see the INSTALL.md file for more info)")
         endif()
     endif()
 endif(WIN32)
@@ -1270,7 +1628,7 @@
         #
         # Link with packet.dll before Winsock2.
         #
-        set(PCAP_LINK_LIBRARIES ${PACKET_LIBRARIES} ${PCAP_LINK_LIBRARIES})
+        set(PCAP_LINK_LIBRARIES ${Packet_LIBRARIES} ${PCAP_LINK_LIBRARIES})
     elseif(PCAP_TYPE STREQUAL "null")
     else()
         message(FATAL_ERROR "${PCAP_TYPE} is not a valid pcap type")
@@ -1309,6 +1667,9 @@
             # XXX - add -L/lib
             #
             set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} dlpi)
+            set(LIBS "${LIBS} -ldlpi")
+            set(LIBS_STATIC "${LIBS_STATIC} -ldlpi")
+            set(LIBS_PRIVATE "${LIBS_PRIVATE} -ldlpi")
             set(PCAP_TYPE libdlpi)
         endif()
 
@@ -1341,9 +1702,17 @@
         # let's drop support for older versions of libnl, too.
         #
         if(BUILD_WITH_LIBNL)
-            pkg_check_modules(LIBNL libnl-3.0)
+            pkg_check_modules(LIBNL libnl-genl-3.0)
             if(LIBNL_FOUND)
                 set(PCAP_LINK_LIBRARIES ${LIBNL_LIBRARIES} ${PCAP_LINK_LIBRARIES})
+
+                #
+                # Get raw link flags from pkg-config.
+                #
+                pkg_get_link_info(LIBNL libnl-genl-3.0)
+                set(LIBS "${LIBNL_LIBS} ${LIBS}")
+                set(LIBS_STATIC "${LIBNL_LIBS_STATIC} ${LIBS_STATIC}")
+                set(REQUIRES_PRIVATE "${LIBNL_PACKAGE_NAME} ${REQUIRES_PRIVATE}")
             else()
                 cmake_push_check_state()
                 set(CMAKE_REQUIRED_LIBRARIES nl-3)
@@ -1355,6 +1724,9 @@
                     #
                     set(PCAP_LINK_LIBRARIES nl-genl-3 nl-3 ${PCAP_LINK_LIBRARIES})
                     include_directories("/usr/include/libnl3")
+                    set(LIBS "-lnl-genl-3 -lnl-3 ${LIBS}")
+                    set(LIBS_STATIC "-lnl-genl-3 -lnl-3 ${LIBS_STATIC}")
+                    set(LIBS_PRIVATE "-lnl-genl-3 -lnl-3 ${LIBS_PRIVATE}")
                 endif()
             endif()
         else()
@@ -1437,6 +1809,9 @@
                 check_library_exists(socket getifaddrs "" SOCKET_HAS_GETIFADDRS)
                 if(SOCKET_HAS_GETIFADDRS)
                     set(PCAP_LINK_LIBRARIES socket ${PCAP_LINK_LIBRARIES})
+                    set(LIBS "-lsocket ${LIBS}")
+                    set(LIBS_STATIC "-lsocket ${LIBS_STATIC}")
+                    set(LIBS_PRIVATE "-lsocket ${LIBS_PRIVATE}")
                     set(HAVE_GETIFADDRS TRUE)
                 endif()
             endif()
@@ -1514,7 +1889,6 @@
     if(NOT DISABLE_LINUX_USBMON)
         set(PCAP_SUPPORT_LINUX_USBMON TRUE)
         set(PROJECT_SOURCE_LIST_C ${PROJECT_SOURCE_LIST_C} pcap-usb-linux.c)
-        set(LINUX_USB_MON_DEV /dev/usbmon)
         #
         # Do we have a version of <linux/compiler.h> available?
         # If so, we might need it for <linux/usbdevice_fs.h>.
@@ -1605,25 +1979,23 @@
     find_package(dpdk)
     if(dpdk_FOUND)
         #
-        # We include rte_bus.h, and older versions of DPDK didn't have
-        # it, so check for it.
-        #
-        # Also, we call rte_eth_dev_count_avail(), and older versions
-        # of DPDK didn't have it, so check for it.
+        # We call rte_eth_dev_count_avail(), and older versions of DPDK
+        # didn't have it, so check for it.
         #
         cmake_push_check_state()
         set(CMAKE_REQUIRED_INCLUDES ${dpdk_INCLUDE_DIRS})
-        check_include_file(rte_bus.h HAVE_RTE_BUS_H)
         set(CMAKE_REQUIRED_LIBRARIES ${dpdk_LIBRARIES})
         check_function_exists(rte_eth_dev_count_avail HAVE_RTE_ETH_DEV_COUNT_AVAIL)
         cmake_pop_check_state()
-        if(HAVE_RTE_BUS_H AND HAVE_RTE_ETH_DEV_COUNT_AVAIL)
+        if(HAVE_RTE_ETH_DEV_COUNT_AVAIL)
             set(DPDK_C_FLAGS "-march=native")
-            set(DPDK_LIB dpdk rt m numa dl)
             set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} ${DPDK_C_FLAGS})
             include_directories(AFTER ${dpdk_INCLUDE_DIRS})
             link_directories(AFTER ${dpdk_LIBRARIES})
             set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} ${dpdk_LIBRARIES})
+            set(LIBS "${LIBS} ${dpdk_LIBS}")
+            set(LIBS_STATIC "${LIBS_STATIC} ${dpdk_LIBS_STATIC}")
+            set(REQUIRES_PRIVATE "${REQUIRES_PRIVATE} ${dpdk_PACKAGE_NAME}")
             set(PROJECT_SOURCE_LIST_C ${PROJECT_SOURCE_LIST_C} pcap-dpdk.c)
             set(PCAP_SUPPORT_DPDK TRUE)
 
@@ -1639,6 +2011,11 @@
             check_type_size("struct rte_ether_addr" STRUCT_RTE_ETHER_ADDR)
             cmake_pop_check_state()
         endif()
+    else()
+      message(WARNING,
+"We couldn't find DPDK with pkg-config.  If you want DPDK support,
+make sure that pkg-config is installed, that DPDK 18.02.2 or later is
+installed, and that DPDK provides a .pc file.")
     endif()
 endif()
 
@@ -1721,22 +2098,80 @@
             list(APPEND DBUS_LIBRARY_FULLPATHS ${_libfullpath})
         endforeach()
         set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} ${DBUS_LIBRARY_FULLPATHS})
+
+        #
+        # Get library information for DPDK.
+        #
+        pkg_get_link_info(DBUS dbus-1)
+        set(LIBS "${LIBS} ${DBUS_LIBS}")
+        set(LIBS_STATIC "${LIBS_STATIC} ${DBUS_LIBS_STATIC}")
+        set(REQUIRES_PRIVATE "${REQUIRES_PRIVATE} ${DBUS_PACKAGE_NAME}")
     endif(DBUS_FOUND)
 endif(NOT DISABLE_DBUS)
 
 # Check for RDMA sniffing support
 if(NOT DISABLE_RDMA)
-    check_library_exists(ibverbs ibv_get_device_list "" LIBIBVERBS_HAS_IBV_GET_DEVICE_LIST)
-    if(LIBIBVERBS_HAS_IBV_GET_DEVICE_LIST)
+    pkg_check_modules(LIBIBVERBS libibverbs)
+    if(LIBIBVERBS_FOUND)
+        #
+        # pkg-config found it; remember its pkg-config name.
+        #
+        set(LIBIBVERBS_REQUIRES_PRIVATE ${LIBIBVERBS_PACKAGE_NAME})
+
+        #
+        # Get static linking information for it.
+        #
+        pkg_get_link_info(LIBIBVERBS libibverbs)
+    else()
+        #
+        # pkg-config didn't find it; try to look for it ourselves
+        #
+        check_library_exists(ibverbs ibv_get_device_list "" LIBIBVERBS_HAS_IBV_GET_DEVICE_LIST)
+        if(LIBIBVERBS_HAS_IBV_GET_DEVICE_LIST)
+            set(LIBIBVERBS_FOUND TRUE)
+            set(LIBIBVERBS_LIBRARIES ibverbs)
+            # XXX - at least on Ubuntu 20.04, there are many more
+            # libraries needed; is there any platform where
+            # libibverbs is available but where pkg-config
+            # isn't available or libibverbs doesn't use it?
+            # If not, we should only use pkg-config for it.
+            set(LIBIBVERBS_STATIC_LIBRARIES ibverbs)
+            set(LIBIBVERBS_LIBS -libverbs)
+            set(LIBIBVERBS_LIBS_STATIC -libverbs)
+            set(LIBIBVERBS_LIBS_PRIVATE -libverbs)
+        endif()
+    endif()
+    if(LIBIBVERBS_FOUND)
+        #
+        # For unknown reasons, check_include_file() doesn't just attempt
+        # to compile a test program that includes the header in
+        # question, it also attempts to link it.
+        #
+        # For unknown reasons, at least some of the static inline
+        # functions defined in infiniband/verbs.h are not inlined by the
+        # Sun^WOracle Studio C compiler, so the compiler generates code
+        # for them as part of the object code resulting from compiling
+        # the test program. At lest some of those functions call
+        # routines in -libverbs, so, in order to keep the compile and
+        # link from failing, even though the header file exists and is
+        # usable, we need to link with -libverbs.
+        #
+        cmake_push_check_state()
+        set(CMAKE_REQUIRED_LIBRARIES ${LIBIBVERBS_LIBRARIES})
         check_include_file(infiniband/verbs.h HAVE_INFINIBAND_VERBS_H)
         if(HAVE_INFINIBAND_VERBS_H)
             check_symbol_exists(ibv_create_flow infiniband/verbs.h PCAP_SUPPORT_RDMASNIFF)
             if(PCAP_SUPPORT_RDMASNIFF)
                 set(PROJECT_SOURCE_LIST_C ${PROJECT_SOURCE_LIST_C} pcap-rdmasniff.c)
-                set(PCAP_LINK_LIBRARIES ibverbs ${PCAP_LINK_LIBRARIES})
+                set(PCAP_LINK_LIBRARIES ${LIBIBVERBS_LIBRARIES} ${PCAP_LINK_LIBRARIES})
+                set(LIBS "${LIBIBVERBS_LIBS} ${LIBS}")
+                set(LIBS_STATIC "${LIBIBVERBS_LIBS_STATIC} ${LIBS_STATIC}")
+                set(LIBS_PRIVATE "${LIBIBVERBS_LIBS_PRIVATE} ${LIBS_PRIVATE}")
+                set(REQUIRES_PRIVATE "${REQUIRES_PRIVATE} ${LIBIBVERBS_PACKAGE_NAME}")
             endif(PCAP_SUPPORT_RDMASNIFF)
         endif(HAVE_INFINIBAND_VERBS_H)
-    endif(LIBIBVERBS_HAS_IBV_GET_DEVICE_LIST)
+        cmake_pop_check_state()
+    endif(LIBIBVERBS_FOUND)
 endif(NOT DISABLE_RDMA)
 
 #
@@ -1774,12 +2209,18 @@
         set(PROJECT_SOURCE_LIST_C ${PROJECT_SOURCE_LIST_C} pcap-dag.c)
         set(HAVE_DAG_API TRUE)
         set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} ${DAG_LIBRARIES})
+        set(LIBS "${LIBS} ${DAG_LIBS}")
+        set(LIBS_STATIC "${LIBS_STATIC} ${DAG_LIBS_STATIC}")
+        set(LIBS_PRIVATE "${LIBS_PRIVATE} ${DAG_LIBS_PRIVATE}")
 
         if(HAVE_DAG_LARGE_STREAMS_API)
             get_filename_component(DAG_LIBRARY_DIR ${DAG_LIBRARY} PATH)
             check_library_exists(vdag vdag_set_device_info ${DAG_LIBRARY_DIR} HAVE_DAG_VDAG)
             if(HAVE_DAG_VDAG)
                 set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
+                set(LIBS "${LIBS} ${CMAKE_THREAD_LIBS_INIT}")
+                set(LIBS_STATIC "${LIBS_STATIC} ${CMAKE_THREAD_LIBS_INIT}")
+                set(LIBS_PRIVATE "${LIBS_PRIVATE} ${CMAKE_THREAD_LIBS_INIT}")
             endif()
         endif()
     endif()
@@ -1825,6 +2266,9 @@
         set(PROJECT_SOURCE_LIST_C ${PROJECT_SOURCE_LIST_C} pcap-snf.c)
         set(HAVE_SNF_API TRUE)
         set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} ${SNF_LIBRARIES})
+        set(LIBS "${LIBS_STATIC} ${SNF_LIBS}")
+        set(LIBS_STATIC "${LIBS_STATIC} ${SNF_LIBS_STATIC}")
+        set(LIBS_PRIVATE "${LIBS_PRIVATE} ${SNF_LIBS_PRIVATE}")
     endif()
 endif()
 
@@ -1838,14 +2282,14 @@
     #
     # Did we succeed?
     #
-    if(AIRPCAP_FOUND)
+    if(AirPcap_FOUND)
         #
         # Yes.
         #
-        include_directories(AFTER ${AIRPCAP_INCLUDE_DIRS})
+        include_directories(AFTER ${AirPcap_INCLUDE_DIRS})
         set(PROJECT_SOURCE_LIST_C ${PROJECT_SOURCE_LIST_C} pcap-airpcap.c)
         set(HAVE_AIRPCAP_API TRUE)
-        set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} ${AIRPCAP_LIBRARIES})
+        set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} ${AirPcap_LIBRARIES})
     endif()
 endif()
 
@@ -2051,6 +2495,19 @@
 endif(NOT MSVC)
 
 #
+# Extra compiler options for the build matrix scripts to request -Werror or
+# its equivalent if required.  The CMake variable name cannot be CFLAGS
+# because that is already used for a different purpose in CMake.  Example
+# usage: cmake -DEXTRA_CFLAGS='-Wall -Wextra -Werror' ...
+#
+if(NOT "${EXTRA_CFLAGS}" STREQUAL "")
+    foreach(_extra_cflag ${EXTRA_CFLAGS})
+        check_and_add_compiler_option("${_extra_cflag}")
+    endforeach(_extra_cflag)
+    message(STATUS "Added extra compile options (${EXTRA_CFLAGS})")
+endif()
+
+#
 # Flex/Lex and YACC/Berkeley YACC/Bison.
 # From a mail message to the CMake mailing list by Andy Cedilnik of
 # Kitware.
@@ -2065,6 +2522,28 @@
 endif()
 message(STATUS "Lexical analyzer generator: ${LEX_EXECUTABLE}")
 
+#
+# Make sure {f}lex supports the -P, --header-file, and --nounput flags
+# and supports processing our scanner.l.
+#
+if(WIN32)
+    set(NULL_DEVICE "NUL:")
+else()
+    set(NULL_DEVICE "/dev/null")
+endif()
+execute_process(COMMAND ${LEX_EXECUTABLE} -P pcap_ --header-file=${NULL_DEVICE} --nounput -t ${pcap_SOURCE_DIR}/scanner.l
+    OUTPUT_QUIET RESULT_VARIABLE EXIT_STATUS)
+if(NOT EXIT_STATUS EQUAL 0)
+    message(FATAL_ERROR "${LEX_EXECUTABLE} is insufficient to compile libpcap.
+libpcap requires Flex 2.5.31 or later, or a compatible version of lex.
+If a suitable version of Lex/Flex is available as a non-standard command
+and/or not in the PATH, you can specify it using the LEX environment
+variable. That said, on some systems the error can mean that Flex/Lex is
+actually acceptable, but m4 is not. Likewise, if a suitable version of
+m4 (such as GNU M4) is available but has not been detected, you can
+specify it using the M4 environment variable.")
+endif()
+
 add_custom_command(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/scanner.c ${CMAKE_CURRENT_BINARY_DIR}/scanner.h
     SOURCE ${pcap_SOURCE_DIR}/scanner.l
@@ -2098,6 +2577,25 @@
 
 if(YACC_EXECUTABLE MATCHES "byacc" OR YACC_EXECUTABLE MATCHES "yacc")
     #
+    # Make sure this is Berkeley YACC, not AT&T YACC;
+    # the latter doesn't support reentrant parsers.
+    # Run it with "-V"; that succeeds and reports the
+    # version number with Berkeley YACC, but will
+    # (probably) fail with various vendor flavors
+    # of AT&T YACC.
+    #
+    # Hopefully this also eliminates any versions
+    # of Berkeley YACC that don't support reentrant
+    # parsers, if there are any.
+    #
+    execute_process(COMMAND ${YACC_EXECUTABLE} -V OUTPUT_QUIET
+        RESULT_VARIABLE EXIT_STATUS)
+    if(NOT EXIT_STATUS EQUAL 0)
+        message(FATAL_ERROR "${YACC_EXECUTABLE} is insufficient to compile libpcap.
+libpcap requires Bison, a newer version of Berkeley YACC with support
+for reentrant parsers, or another YACC compatible with them.")
+    endif()
+    #
     # Berkeley YACC doesn't support "%define api.pure", so use
     # "%pure-parser".
     #
@@ -2162,6 +2660,9 @@
         # we use them to load the BPF module.
         #
         set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} odm cfg)
+        set(LIBS "${LIBS} -lodm -lcfg")
+        set(LIBS_STATIC "${LIBS_STATIC} -lodm -lcfg")
+        set(LIBS_PRIVATE "${LIBS_PRIVATE} -lodm -lcfg")
     endif()
 elseif(CMAKE_SYSTEM_NAME STREQUAL "HP-UX")
     if(CMAKE_SYSTEM_VERSION MATCHES "[A-Z.]*9\.[0-9]*")
@@ -2200,7 +2701,7 @@
     set(MAN_MISC_INFO 5)
 elseif(CMAKE_SYSTEM_NAME STREQUAL "OSF1")
     #
-    # DEC OSF/1, a/k/a Digial UNIX, a/k/a Tru64 UNIX.
+    # DEC OSF/1, a/k/a Digital UNIX, a/k/a Tru64 UNIX.
     # Use Tru64 UNIX conventions for man pages; they're the same as the
     # System V conventions except that they use section 8 for
     # administrative commands and daemons.
@@ -2445,13 +2946,10 @@
         # captures.)
         #
         set(OSX_LIBRARY_ARCHITECTURES "x86_64;i386;ppc")
-    else()
+    elseif(SYSTEM_VERSION_MAJOR GREATER 10 AND SYSTEM_VERSION_MAJOR LESS 19)
         #
-        # Post-Snow Leopard.  Build for x86-64 and 32-bit x86,
-        # with x86-64 first.  (That's what Apple does)
-        # XXX - update if and when Apple drops support
-        # for 32-bit x86 code and if and when Apple adds
-        # ARM-based Macs.  (You're on your own for iOS etc.)
+        # Post-Snow Leopard, pre-Catalina.  Build for x86-64
+        # and 32-bit x86, with x86-64 first.  (That's what Apple does)
         #
         # First, check whether we're building with OpenSSL.
         # If so, don't bother trying to build fat.
@@ -2494,6 +2992,61 @@
               endif()
           endif()
         endif()
+    elseif(SYSTEM_VERSION_MAJOR EQUAL 19)
+        #
+        # Catalina.  Build libraries and executables
+        # only for x86-64.  (That's what Apple does;
+        # 32-bit x86 binaries are not supported on
+        # Catalina.)
+        #
+        set(OSX_LIBRARY_ARCHITECTURES "x86_64")
+    else()
+        #
+        # Post-Catalina.  Build libraries and
+        # executables for x86-64 and ARM64.
+        # (That's what Apple does, except they
+        # build for arm64e, which may include
+        # some of the pointer-checking extensions.)
+        #
+        # If we're building with libssl, make sure
+        # we can build fat with it (i.e., that it
+        # was built fat); if we can't, don't set
+        # the target architectures, and just
+        # build for the host we're on.
+        #
+        # Otherwise, just add both of them.
+        #
+        if(HAVE_OPENSSL)
+          cmake_push_check_state()
+          set(CMAKE_REQUIRED_FLAGS "-arch x86_64 -arch arm64")
+          set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
+          set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
+          #
+          # We must test whether this compiles and links, so
+          # check_symbol_exists() isn't sufficient.
+          #
+          # SSL_library_init() may be a macro that's #defined
+          # to be the real function to call, so we have to
+          # include <openssl/ssl.h>, and check_function_exists()
+          # isn't sufficient.
+          #
+          check_c_source_compiles(
+"#include <openssl/ssl.h>
+int
+main(void)
+{
+    SSL_library_init();
+    return 0;
+}
+"
+              FAT_SSL_BUILDS_SUPPORTED)
+          cmake_pop_check_state()
+          if(FAT_SSL_BUILDS_SUPPORTED)
+              set(OSX_LIBRARY_ARCHITECTURES "x86_64;arm64")
+          endif()
+        else()
+            set(OSX_LIBRARY_ARCHITECTURES "x86_64;arm64")
+        endif()
     endif()
     if(BUILD_SHARED_LIBS)
         set_target_properties(${LIBRARY_NAME} PROPERTIES
@@ -2619,7 +3172,9 @@
     pcap_tstamp_type_name_to_val.3pcap
     pcap_tstamp_type_val_to_name.3pcap
 )
-set(MANFILE_EXPAND pcap-savefile.manfile.in)
+set(MANFILE_EXPAND
+    pcap-savefile.manfile.in
+)
 set(MANMISC_EXPAND
     pcap-filter.manmisc.in
     pcap-linktype.manmisc.in
@@ -2633,6 +3188,11 @@
 endif(BUILD_SHARED_LIBS)
 
 if(WIN32 OR CYGWIN OR MSYS)
+    #
+    # XXX - according to the CMake documentation, WIN32 is set if
+    # the target is Windows; would there ever be a case where
+    # CYGWIN or MSYS are set but WIN32 *isn't* set?
+    #
     if(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
         #
         # Install 64-bit code built with MSVC in the x64 subdirectories,
@@ -2685,36 +3245,69 @@
     set(exec_prefix "\${prefix}")
     set(includedir "\${prefix}/include")
     set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
-    if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
-       CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR
-       CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
-       CMAKE_SYSTEM_NAME STREQUAL "DragonFly BSD" OR
-       CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
-       CMAKE_SYSTEM_NAME STREQUAL "OSF1")
-        #
-        # Platforms where the linker is the GNU linker
-        # or accepts command-line arguments like
-        # those the GNU linker accepts.
-        #
-        set(V_RPATH_OPT "-Wl,-rpath,")
-    elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
-        #
-        # SunOS 5.x.
-        #
-        # XXX - this assumes GCC is using the Sun linker,
-        # rather than the GNU linker.
-        #
-        set(V_RPATH_OPT "-Wl,-R,")
-    else()
-        #
-        # No option needed to set the RPATH.
-        #
-        set(V_RPATH_OPT "")
+
+    #
+    # If this is a platform where we need to have the .pc file and
+    # pcap-config script supply an rpath option to specify the directory
+    # in which the libpcap shared library is installed, and the install
+    # prefix /usr (meaning we're not installing a system library),
+    # provide the rpath option.
+    #
+    # (We must check CMAKE_INSTALL_PREFIX, as the library directory
+    # isn't  necessarily /usr/lib in this case - for example, Linux
+    # distributions for 64-bit platforms that also provide support for
+    # binaries for a 32-bit version of the platform may put the 64-bit
+    # libraries, the 32-bit libraries, or both in directories other than
+    # /usr/lib.)
+    #
+    # In AIX, do we have to do this?
+    #
+    # In Darwin-based OSes, the full paths of the shared libraries with
+    # which the program was linked are stored in the executable, so we
+    # don't need to provide an rpath option.
+    #
+    # With the HP-UX linker, directories specified with -L are, by
+    # default, added to the run-time search path, so we don't need to
+    # supply them.
+    #
+    # For Tru64 UNIX, "-rpath" works with DEC's^WCompaq's^WHP's C
+    # compiler for Alpha, but isn't documented as working with GCC, and
+    # no GCC-compatible option is documented as working with the DEC
+    # compiler.  If anybody needs this on Tru64/Alpha, they're welcome
+    # to figure out a way to make it work.
+    #
+    # This must *not* depend on the compiler, as, on platforms where
+    # there's a GCC-compatible compiler and a vendor compiler, we need
+    # to work with both.
+    #
+    if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
+        if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
+           CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR
+           CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
+           CMAKE_SYSTEM_NAME STREQUAL "DragonFly BSD" OR
+           CMAKE_SYSTEM_NAME STREQUAL "Linux")
+            #
+            # Platforms where the "native" C compiler is GCC or accepts
+            # compatible command-line arguments, and the "native" linker
+            # is the GNU linker or accepts compatible command-line
+            # arguments.
+            #
+            set(RPATH "-Wl,-rpath,\${libdir}")
+        elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
+            #
+            # SunOS 5.x.
+            #
+            # Sun/Oracle's linker, the GNU linker, and GNU-compatible
+            # linkers all support -R.
+            #
+            set(RPATH "-Wl,-R,\${libdir}")
+        else()
+            #
+            # No option needed to set the RPATH.
+            #
+            set(RPATH "")
+        endif()
     endif()
-    set(LIBS "")
-    foreach(LIB ${PCAP_LINK_LIBRARIES})
-        set(LIBS "${LIBS} -l${LIB}")
-    endforeach(LIB)
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pcap-config.in ${CMAKE_CURRENT_BINARY_DIR}/pcap-config @ONLY)
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpcap.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc @ONLY)
     install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/pcap-config DESTINATION bin)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 69b5972..fb22c5e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -14,10 +14,10 @@
 and check if the problem has already been reported. If it has not, please open
 a new issue and provide the following details:
 
-* libpcap version (e.g. from tcpdump --version)
+* libpcap version (e.g. from `tcpdump --version`)
 * operating system name and version and any other details that may be relevant
-  (uname -a, compiler name and version, CPU type etc.)
-* configure flags if any were used
+  (`uname -a`, compiler name and version, CPU type etc.)
+* `configure` or `cmake` flags if any were used
 * statement of the problem
 * steps to reproduce
 
diff --git a/CREDITS b/CREDITS
index d01e832..4b820ee 100644
--- a/CREDITS
+++ b/CREDITS
@@ -33,6 +33,7 @@
     Baptiste Peugnez              <baptiste dot peugnez at cea dot fr>
     Baruch Siach                  <baruch at tkos dot co dot il>
     Bill Parker                   <wp02855 at gmail dot com>
+    Biswapriyo Nath               <nathbappai at gmail dot com>
     blazeable                     <blazeable at blazeable dot eu>
     bleader                       <bleader at ratonland dot org>
     Brent Cook                    <brent at boundary dot com>
@@ -58,6 +59,7 @@
     Dave Barach                   <dave at barachs dot net>
     David Clark                   <david dot clark at datasoft dot com>
     David Kaelbling               <drk at sgi dot com>
+    David Karoly                  <david dot karoly at outlook dot com>
     David Ward                    <david dot ward at ll dot mit dot edu>
     David Young                   <dyoung at ojctech dot com>
     Dean Gaudet                   <dean at arctic dot org>
@@ -68,11 +70,13 @@
     Dustin Spicuzza               <dustin at virtualroadside dot com>
     dzejarczech                   <dzejarczech at sourceforge dot net>
     Edward Sheldrake              <ejs1920 at sourceforge dot net>
+    Eli Schwartz                  <eschwartz93 at gmail dot com>
     Eric Anderson                 <anderse at hpl dot hp dot com>
     Erik de Castro Lopo           <erik dot de dot castro dot lopo at sensorynetworks dot com>
     Fedor Sakharov                <fedor dot sakharov at gmail dot com>
     Felix Janda                   <felix dot janda at posteo dot de>
     Felix Obenhuber               <felix at obenhuber dot de>
+    fghzxm                        <fghzxm at outlook dot com>
     Florent Drouin                <Florent dot Drouin at alcatel-lucent dot fr>
     Florian Fainelli              <f dot fainelli at gmail dot com>
     François Revol                <revol at free dot fr>
@@ -132,6 +136,7 @@
     Kris Katterjohn               <katterjohn at gmail dot com>
     Krzysztof Halasa              <khc at pm dot waw dot pl>
     Lennert Buytenhek             <buytenh at wantstofly dot org>
+    Li kunyu                      <kunyu at nfschina dot com>
     lixiaoyan                     <lixiaoyan at google dot com>
     Lorenzo Cavallaro             <sullivan at sikurezza dot org>
     Loris Degioanni               <loris at netgroup-serv dot polito dot it>
@@ -157,6 +162,7 @@
     Max Laier                     <max at love2party dot net>
     Michal Kubecek                <mkubecek at suse dot cz>
     Michal Labedzki               <michal dot labedzki at tieto dot com>
+    Michal Ruprich                <michalruprich at gmail dot com>
     Michal Sekletar               <msekleta at redhat dot com>
     Mike Frysinger                <vapier at gmail dot com>
     Mike Kershaw                  <dragorn at kismetwireless dot net>
@@ -166,6 +172,7 @@
     Monroe Williams               <monroe at pobox dot com>
     Myricom Help                  <myri at users dot noreply dot github dot com>
     Nan Xiao                      <nan at chinadtrace dot org>
+    nic-kaczinsky                 <68271784+nic-kaczinsky at users dot noreply dot github dot com>
     Nick Kelsey                   <nickk at silicondust dot com>
     Nicolas Dade                  <ndade at nsd dot dyndns dot org>
     Niko Delarich                 <niko dot delarich at gmail dot com>
@@ -181,7 +188,7 @@
     Ørjan Malde                   <red at foxi dot me>
     Paolo Abeni                   <pabeni at redhat dot com>
     Patrick Marie                 <mycroft at virgaria dot org>
-    Patrick McHardy               <kaber at trash not net>
+    Patrick McHardy               <kaber at trash dot net>
     Paul Mundt                    <lethal at linux-sh dot org>
     Pavel Kankovsky               <kan at dcit dot cz>
     Pawel Brzezinski              <pawel dot brzezinski at harman dot com>
@@ -193,6 +200,7 @@
     Philippe Antoine              <contact at catenacyber dot fr>
     Phil Wood                     <cpw at lanl dot gov>
     Rafal Maszkowski              <rzm at icm dot edu dot pl>
+    ramin                         <lordrasmus at gmail dot com>
                                   <rcb-isis at users dot sourceforge dot net>
     Richard Stearn                <richard at rns-stearn dot demon dot co dot uk>
     Rick Jones                    <raj at cup dot hp dot com>
@@ -208,6 +216,7 @@
     Sebastian Krahmer             <krahmer at cs dot uni-potsdam dot de>
     Sebastien Roy                 <Sebastien dot Roy at Sun dot COM>
     Sepherosa Ziehau              <sepherosa at gmail dot com>
+    Shane Kerr                    <shane at time-travellers dot org>
     Shaun Clowes                  <delius at progsoc dot uts dot edu dot au>
     solofox                       <wensg100 at sina dot com>
     Solomon Peachy                <pizza at shaftnet dot org>
diff --git a/INSTALL.md b/INSTALL.md
index feef03d..d0a19d8 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -1,105 +1,120 @@
-To build libpcap, run "./configure" (a shell script). The configure
-script will determine your system attributes and generate an
-appropriate Makefile from Makefile.in. Next run "make". If everything
-goes well you can su to root and run "make install". However, you need
-not install libpcap if you just want to build tcpdump; just make sure
-the tcpdump and libpcap directory trees have the same parent
-directory.
+# libpcap installation notes
+Libpcap can be built either with the configure script and `make`, or
+with CMake and any build system supported by CMake.
+
+To build libpcap with the configure script and `make`:
+
+* Run `./configure` (a shell script).  The configure script will
+determine your system attributes and generate an appropriate `Makefile`
+from `Makefile.in`.  The configure script has a number of options to
+control the configuration of libpcap; `./configure --help`` will show
+them.
+
+* Next, run `make`.  If everything goes well, you can
+`su` to root and run `make install`.  However, you need not install
+libpcap if you just want to build tcpdump; just make sure the tcpdump
+and libpcap directory trees have the same parent directory.
+
+To build libpcap with CMake and the build system of your choice, from
+the command line:
+
+* Create a build directory into which CMake will put the build files it
+generates; CMake does not work as well with builds done in the source
+code directory as does the configure script.  The build directory may be
+created as a subdirectory of the source directory or as a directory
+outside the source directory.
+
+* Change to the build directory and run CMake with the path from the
+build directory to the source directory as an argument.  The `-G` flag
+can be used to select the CMake "generator" appropriate for the build
+system you're using; various `-D` flags can be used to control the
+configuration of libpcap.
+
+* Run the build tool.  If everything goes well, you can `su` to root and
+run the build tool with the `install` target.  Building tcpdump from a
+libpcap in a build directory is not supported.
+
+An `uninstall` target is supported with both `./configure` and CMake.
+
+***DO NOT*** run the build as root; there is no need to do so, running
+anything as root that doesn't need to be run as root increases the risk
+of damaging your system, and running the build as root will put files in
+the build directory that are owned by root and that probably cannot be
+overwritten, removed, or replaced except by root, which could cause
+permission errors in subsequent builds.
 
 If configure says:
 
     configure: warning: cannot determine packet capture interface
-    configure: warning: (see INSTALL for more info)
+    configure: warning: (see INSTALL.md file for more info)
+
+or CMake says:
+
+    cannot determine packet capture interface
+
+    (see the INSTALL.md file for more info)
 
 then your system either does not support packet capture or your system
 does support packet capture but libpcap does not support that
 particular type. (If you have HP-UX, see below.) If your system uses a
 packet capture not supported by libpcap, please send us patches; don't
 forget to include an autoconf fragment suitable for use in
-configure.ac.
+`configure.ac`.
 
-It is possible to override the default packet capture type, although
-the circumstance where this works are limited. For example if you have
-installed bpf under SunOS 4 and wish to build a snit libpcap:
+It is possible to override the default packet capture type with the
+`--with-pcap`` option to `./configure` or the `-DPCAP_TYPE` option to
+CMake, although the circumstances where this works are limited.  One
+possible reason to do that would be to force a supported packet capture
+type in the case where the configure or CMake scripts fails to detect
+it.
 
-    ./configure --with-pcap=snit
-
-Another example is to force a supported packet capture type in the case
-where the configure scripts fails to detect it.
-
-You will need an ANSI C compiler to build libpcap. The configure script
-will abort if your compiler is not ANSI compliant. If this happens, use
-the generally available GNU C compiler (GCC).
+You will need a C99 compiler to build libpcap. The configure script
+will abort if your compiler is not C99 compliant. If this happens, use
+the generally available GNU C compiler (GCC) or Clang.
 
 You will need either Flex 2.5.31 or later, or a version of Lex
 compatible with it (if any exist), to build libpcap.  The configure
-script will abort if there isn't any such program.  If you have an older
-version of Flex, or don't have a compatible version of Lex, the current
-version of flex is available at flex.sourceforge.net.
+script will abort if there isn't any such program; CMake fails if Flex
+or Lex cannot be found, but doesn't ensure that it's compatible with
+Flex 2.5.31 or later.  If you have an older version of Flex, or don't
+have a compatible version of Lex, the current version of Flex is
+available [here](https://github.com/westes/flex).
 
 You will need either Bison, Berkeley YACC, or a version of YACC
 compatible with them (if any exist), to build libpcap.  The configure
-script will abort if there isn't any such program.  If you don't have
-any such program, the current version of Bison can be found at
-https://ftp.gnu.org/gnu/bison/ and the current version of Berkeley YACC
-can be found at https://invisible-island.net/byacc/.
+script will abort if there isn't any such program; CMake fails if Bison
+or some form of YACC cannot be found, but doesn't ensure that it's
+compatible with Bison or Berkeley YACC.  If you don't have any such
+program, the current version of Bison can be found
+[here](https://ftp.gnu.org/gnu/bison/) and the current version of
+Berkeley YACC can be found [here](https://invisible-island.net/byacc/).
 
 Sometimes the stock C compiler does not interact well with Flex and
-Bison. The list of problems includes undefined references for alloca.
+Bison. The list of problems includes undefined references for alloca(3).
 You can get around this by installing GCC.
 
-If you use Solaris, there is a bug with bufmod(7) that is fixed in
-Solaris 2.3.2 (aka SunOS 5.3.2). Setting a snapshot length with the
-broken bufmod(7) results in data be truncated from the FRONT of the
-packet instead of the end.  The work around is to not set a snapshot
-length but this results in performance problems since the entire packet
-is copied to user space. If you must run an older version of Solaris,
-there is a patch available from Sun; ask for bugid 1149065. After
-installing the patch, use "setenv BUFMOD_FIXED" to enable use of
-bufmod(7). However, we recommend you run a more current release of
-Solaris.
+## Linux specifics
+On Linux, libpcap will not work if the kernel does not have the packet
+socket option enabled; see [this file](doc/README.linux) for more
+information.
 
+## Solaris specifics
 If you use the SPARCompiler, you must be careful to not use the
-/usr/ucb/cc interface. If you do, you will get bogus warnings and
-perhaps errors. Either make sure your path has /opt/SUNWspro/bin
-before /usr/ucb or else:
+`/usr/ucb/cc` interface. If you do, you will get bogus warnings and
+perhaps errors. Either make sure your path has `/opt/SUNWspro/bin`
+before `/usr/ucb` or else:
 
     setenv CC /opt/SUNWspro/bin/cc
 
-before running configure. (You might have to do a "make distclean"
-if you already ran configure once).
+before running configure. (You might have to do a `make distclean`
+if you already ran `configure` once).
 
-If you are trying to do packet capture with a FORE ATM card, you may or
-may not be able to. They usually only release their driver in object
-code so unless their driver supports packet capture, there's not much
-libpcap can do.
+See [this file](doc/README.solaris.md) for more up to date
+Solaris-related information.
 
-If you get an error like:
-
-    tcpdump: recv_ack: bind error 0x???
-
-when using DLPI, look for the DL_ERROR_ACK error return values, usually
-in /usr/include/sys/dlpi.h, and find the corresponding value.
-
-Under {DEC OSF/1, Digital UNIX, Tru64 UNIX}, packet capture must be
-enabled before it can be used.  For instructions on how to enable packet
-filter support, see:
-
-	ftp://ftp.digital.com/pub/Digital/dec-faq/Digital-UNIX
-
-Look for the "How do I configure the Berkeley Packet Filter and capture
-tcpdump traces?" item.
-
-Once you enable packet filter support, your OSF system will support bpf
-natively.
-
-Under Ultrix, packet capture must be enabled before it can be used. For
-instructions on how to enable packet filter support, see:
-
-	ftp://ftp.digital.com/pub/Digital/dec-faq/ultrix
-
+## HP-UX specifics
 If you use HP-UX, you must have at least version 9 and either the
-version of cc that supports ANSI C (cc -Aa) or else use the GNU C
+version of `cc` that supports C99 (`cc -AC99`) or else use the GNU C
 compiler. You must also buy the optional streams package. If you don't
 have:
 
@@ -113,10 +128,10 @@
 The DLPI streams package is standard starting with HP-UX 10.
 
 The HP implementation of DLPI is a little bit eccentric. Unlike
-Solaris, you must attach /dev/dlpi instead of the specific /dev/*
+Solaris, you must attach `/dev/dlpi` instead of the specific `/dev/*`
 network pseudo device entry in order to capture packets. The PPA is
 based on the ifnet "index" number. Under HP-UX 9, it is necessary to
-read /dev/kmem and the kernel symbol file (/hp-ux). Under HP-UX 10,
+read `/dev/kmem` and the kernel symbol file (`/hp-ux`). Under HP-UX 10,
 DLPI can provide information for determining the PPA. It does not seem
 to be possible to trace the loopback interface. Unlike other DLPI
 implementations, PHYS implies MULTI and SAP and you get an error if you
@@ -137,117 +152,34 @@
 
 	echo 'lanc_outbound_promisc_flag/W 1' | adb -w /stand/vmunix /dev/mem
 
-You would have to arrange that this happen on reboots; the right way to
+You would have to arrange that this happens on reboots; the right way to
 do that would probably be to put it into an executable script file
-"/sbin/init.d/outbound_promisc" and making
-"/sbin/rc2.d/S350outbound_promisc" a symbolic link to that script.
+`/sbin/init.d/outbound_promisc` and making
+`/sbin/rc2.d/S350outbound_promisc` a symbolic link to that script.
 
 Finally, testing shows that there can't be more than one simultaneous
 DLPI user per network interface.
 
-If you use Linux, this version of libpcap is known to compile and run
-under Red Hat 4.0 with the 2.0.25 kernel.  It may work with earlier 2.X
-versions but is guaranteed not to work with 1.X kernels.  Running more
-than one libpcap program at a time, on a system with a 2.0.X kernel, can
-cause problems since promiscuous mode is implemented by twiddling the
-interface flags from the libpcap application; the packet capture
-mechanism in the 2.2 and later kernels doesn't have this problem.  Also,
-packet timestamps aren't very good.  This appears to be due to haphazard
-handling of the timestamp in the kernel.
+See [this file](doc/README.hpux) for more information specific to HP-UX.
 
-Note well: there is rumoured to be a version of tcpdump floating around
-called 3.0.3 that includes libpcap and is supposed to support Linux.
-You should be advised that neither the Network Research Group at LBNL
-nor the Tcpdump Group ever generated a release with this version number.
-The LBNL Network Research Group notes with interest that a standard
-cracker trick to get people to install trojans is to distribute bogus
-packages that have a version number higher than the current release.
-They also noted with annoyance that 90% of the Linux related bug reports
-they got are due to changes made to unofficial versions of their page.
-If you are having trouble but aren't using a version that came from
-tcpdump.org, please try that before submitting a bug report!
-
-On Linux, libpcap will not work if the kernel does not have the packet
-socket option enabled; see the README.linux file for information about
-this.
-
-If you use AIX, you may not be able to build libpcap from this release.
-We do not have an AIX system in house so it's impossible for us to test
-AIX patches submitted to us.  We are told that you must link against
-/lib/pse.exp, that you must use AIX cc or a GNU C compiler newer than
-2.7.2, and that you may need to run strload before running a libpcap
-application.
-
-Read the README.aix file for information on installing libpcap and
+## AIX specifics
+See [this file](doc/README.aix) for information on installing libpcap and
 configuring your system to be able to support libpcap.
 
-If you use NeXTSTEP, you will not be able to build libpcap from this
-release.
+## other specifics
+If you are trying to do packet capture with a FORE ATM card, you may or
+may not be able to. They usually only release their driver in object
+code so unless their driver supports packet capture, there's not much
+libpcap can do.
 
-If you use SINIX, you should be able to build libpcap from this
-release. It is known to compile and run on SINIX-Y/N 5.42 with the C-DS
-V1.0 or V1.1 compiler. But note that in some releases of SINIX, yacc
-emits incorrect code; if grammar.y fails to compile, change every
-occurrence of:
+If you get an error like:
 
-	#ifdef YYDEBUG
+    tcpdump: recv_ack: bind error 0x???
 
-to:
-	#if YYDEBUG
+when using DLPI, look for the DL_ERROR_ACK error return values, usually
+in `/usr/include/sys/dlpi.h`, and find the corresponding value.
 
-Another workaround is to use flex and bison.
-
-If you use SCO, you might have trouble building libpcap from this
-release. We do not have a machine running SCO and have not had reports
-of anyone successfully building on it; the current release of libpcap
-does not compile on SCO OpenServer 5.  Although SCO apparently supports
-DLPI to some extent, the DLPI in OpenServer 5 is very non-standard, and
-it appears that completely new code would need to be written to capture
-network traffic.  SCO do not appear to provide tcpdump binaries for
-OpenServer 5 or OpenServer 6 as part of SCO Skunkware:
-
-  http://www.sco.com/skunkware/
-
-If you use UnixWare, you might be able to build libpcap from this
-release, or you might not.  We do not have a machine running UnixWare,
-so we have not tested it; however, SCO provide packages for libpcap
-0.6.2 and tcpdump 3.7.1 in the UnixWare 7/Open UNIX 8 part of SCO
-Skunkware, and the source package for libpcap 0.6.2 is not changed from
-the libpcap 0.6.2 source release, so this release of libpcap might also
-build without changes on UnixWare 7.
-
-If linking tcpdump fails with "Undefined: _alloca" when using bison on
-a Sun4, your version of Bison is broken. In any case version 1.16 or
-higher is recommended (1.14 is known to cause problems 1.16 is known to
-work). Either pick up a current version from:
-
-  https://ftp.gnu.org/gnu/bison/
-
-or hack around it by inserting the lines:
-
-	#ifdef __GNUC__
-	#define alloca __builtin_alloca
-	#else
-	#ifdef sparc
-	#include <alloca.h>
-	#else
-	char *alloca ();
-	#endif
-	#endif
-
-right after the (100 line!) GNU license comment in bison.simple, remove
-grammar.[co] and fire up make again.
-
-If you use SunOS 4, your kernel must support streams NIT. If you run a
-libpcap program and it dies with:
-
-    /dev/nit: No such device
-
-You must add streams NIT support to your kernel configuration, run
-config and boot the new kernel.
-
-FILES
------
+## Description of files
 	CHANGES		    - description of differences between releases
 	ChmodBPF/*	    - macOS startup item to set ownership and permissions on /dev/bpf*
 	CMakeLists.txt	    - CMake file
@@ -264,10 +196,9 @@
 	doc/README.macos    - notes on using libpcap on macOS
 	doc/README.septel   - notes on using libpcap to capture on Intel/Septel devices
 	doc/README.sita	    - notes on using libpcap to capture on SITA devices
-	doc/README.tru64    - notes on using libpcap on Digital/Tru64 UNIX
+	doc/README.solaris.md - notes on using libpcap on Solaris
 	doc/README.Win32.md - notes on using libpcap on Win32 systems (with Npcap)
 	VERSION		    - version of this release
-	acconfig.h	    - support for post-2.13 autoconf
 	aclocal.m4	    - autoconf macros
 	arcnet.h	    - ARCNET definitions
 	atmuni31.h	    - ATM Q.2931 definitions
@@ -286,8 +217,8 @@
 	fad-getad.c	    - pcap_findalldevs() for systems with getifaddrs()
 	fad-gifc.c	    - pcap_findalldevs() for systems with only SIOCGIFLIST
 	fad-glifc.c	    - pcap_findalldevs() for systems with SIOCGLIFCONF
-	filtertest.c	    - test program for BPF compiler
-	findalldevstest.c   - test program for pcap_findalldevs()
+	testprogs/filtertest.c      - test program for BPF compiler
+	testprogs/findalldevstest.c - test program for pcap_findalldevs()
 	gencode.c	    - BPF code generation routines
 	gencode.h	    - BPF code generation definitions
 	grammar.y	    - filter string grammar
@@ -300,7 +231,6 @@
 	msdos/*		    - drivers for MS-DOS capture support
 	nametoaddr.c	    - hostname to address routines
 	nlpid.h		    - OSI network layer protocol identifier definitions
-	net		    - symlink to bpf/net
 	optimize.c	    - BPF optimization routines
 	pcap/bluetooth.h    - public definition of DLT_BLUETOOTH_HCI_H4_WITH_PHDR header
 	pcap/bpf.h	    - BPF definitions
@@ -323,17 +253,14 @@
 	pcap-linux.c	    - Linux packet socket support
 	pcap-namedb.h	    - header for backwards compatibility
 	pcap-nit.c	    - SunOS Network Interface Tap support
-	pcap-nit.h	    - SunOS Network Interface Tap definitions
 	pcap-npf.c	    - Npcap capture support
 	pcap-null.c	    - dummy monitor support (allows offline use of libpcap)
 	pcap-pf.c	    - Ultrix and Digital/Tru64 UNIX Packet Filter support
-	pcap-pf.h	    - Ultrix and Digital/Tru64 UNIX Packet Filter definitions
 	pcap-septel.c       - Intel/Septel device capture support
 	pcap-septel.h       - Intel/Septel device capture support
 	pcap-sita.c	    - SITA device capture support
 	pcap-sita.h	    - SITA device capture support
 	pcap-sita.html	    - SITA device capture documentation
-	pcap-stdinc.h	    - includes and #defines for compiling on Win32 systems
 	pcap-snit.c	    - SunOS 4.x STREAMS-based Network Interface Tap support
 	pcap-snoop.c	    - IRIX Snoop network monitoring support
 	pcap-usb-linux.c    - USB capture support for Linux
@@ -342,10 +269,9 @@
 	pcap.c		    - pcap utility routines
 	pcap.h		    - header for backwards compatibility
 	pcap_*.3pcap	    - manual entries for library functions
-	pcap-filter.4	    - manual entry for filter syntax
-	pcap-linktype.4	    - manual entry for link-layer header types
+	pcap-filter.manmisc.in   - manual entry for filter syntax
+	pcap-linktype.manmisc.in - manual entry for link-layer header types
 	ppp.h		    - Point to Point Protocol definitions
 	savefile.c	    - offline support
 	scanner.l	    - filter string scanner
 	sunatmpos.h	    - definitions for SunATM capturing
-	Win32		    - headers and routines for building on Win32 systems
diff --git a/METADATA b/METADATA
index 7a7b0b7..8ca5f37 100644
--- a/METADATA
+++ b/METADATA
@@ -1,3 +1,7 @@
+# This project was upgraded with external_updater.
+# Usage: tools/external_updater/updater.sh update libpcap
+# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+
 name: "libpcap"
 description: "A system-independent interface for user-level packet capture."
 third_party {
@@ -6,14 +10,17 @@
     value: "https://www.tcpdump.org/"
   }
   url {
-    type: ARCHIVE
-    value: "https://github.com/the-tcpdump-group/libpcap/archive/libpcap-1.10.1.tar.gz"
+    type: GIT
+    value: "https://github.com/the-tcpdump-group/libpcap.git"
   }
-  version: "libpcap-1.10.1"
+  version: "libpcap-1.10.3"
   license_type: NOTICE
+  security {
+    tag: "NVD-CPE2.3:cpe:/a:tcpdump:libpcap:-"
+  }
   last_upgrade_date {
-    year: 2021
-    month: 8
-    day: 20
+    year: 2023
+    month: 2
+    day: 14
   }
 }
diff --git a/Makefile.in b/Makefile.in
index 5d88ea7..5424658 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -61,13 +61,12 @@
 CFLAGS = @CFLAGS@   ${CROSSFLAGS}
 LDFLAGS = @LDFLAGS@ ${CROSSFLAGS}
 DYEXT = @DYEXT@
-V_RPATH_OPT = @V_RPATH_OPT@
+RPATH = @RPATH@
 DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
 PROG=libpcap
 PTHREAD_LIBS=@PTHREAD_LIBS@
 BUILD_RPCAPD=@BUILD_RPCAPD@
 INSTALL_RPCAPD=@INSTALL_RPCAPD@
-EXTRA_NETWORK_LIBS=@EXTRA_NETWORK_LIBS@
 
 # Standard CFLAGS for building members of a shared library
 FULL_CFLAGS = $(CCOPT) @V_LIB_CCOPT_FAT@ $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
@@ -93,9 +92,9 @@
 MODULE_C_SRC =		@MODULE_C_SRC@
 REMOTE_C_SRC =		@REMOTE_C_SRC@
 COMMON_C_SRC =	pcap.c gencode.c optimize.c nametoaddr.c etherent.c \
-		fmtutils.c \
+		fmtutils.c pcap-util.c \
 		savefile.c sf-pcap.c sf-pcapng.c pcap-common.c \
-		bpf_image.c bpf_filter.c bpf_dump.c
+		pcap-usb-linux-common.c bpf_image.c bpf_filter.c bpf_dump.c
 GENERATED_C_SRC = scanner.c grammar.c
 LIBOBJS = @LIBOBJS@
 
@@ -115,21 +114,21 @@
 	pcap.h \
 	pcap-bpf.h \
 	pcap-namedb.h \
-	pcap/bpf.h \
 	pcap/bluetooth.h \
+	pcap/bpf.h \
 	pcap/can_socketcan.h \
 	pcap/compiler-tests.h \
 	pcap/dlt.h \
 	pcap/funcattrs.h \
-	pcap/pcap-inttypes.h \
 	pcap/ipnet.h \
 	pcap/namedb.h \
 	pcap/nflog.h \
+	pcap/pcap-inttypes.h \
 	pcap/pcap.h \
 	pcap/sll.h \
 	pcap/socket.h \
-	pcap/vlan.h \
-	pcap/usb.h
+	pcap/usb.h \
+	pcap/vlan.h
 
 HDR = $(PUBHDR) \
 	arcnet.h \
@@ -149,6 +148,9 @@
 	pcap-int.h \
 	pcap-rpcap.h \
 	pcap-types.h \
+	pcap-usb-linux-common.h \
+	pcap-util.h \
+	pflog.h \
 	portability.h \
 	ppp.h \
 	rpcap-protocol.h \
@@ -252,7 +254,15 @@
 	Makefile.in \
 	Makefile-devel-adds \
 	README.md \
-	doc \
+	doc/README.Win32.md \
+	doc/README.aix \
+	doc/README.dag \
+	doc/README.hpux \
+	doc/README.linux \
+	doc/README.macos \
+	doc/README.septel \
+	doc/README.sita \
+	doc/README.solaris.md \
 	CONTRIBUTING.md \
 	TODO \
 	VERSION \
@@ -262,6 +272,7 @@
 	chmod_bpf \
 	cmake_uninstall.cmake.in \
 	cmakeconfig.h.in \
+	cmake/Modules/FindAirPcap.cmake \
 	cmake/Modules/FindDAG.cmake \
 	cmake/Modules/Finddpdk.cmake \
 	cmake/Modules/FindFseeko.cmake \
@@ -402,6 +413,7 @@
 	testprogs/fuzz/fuzz_pcap.c \
 	testprogs/fuzz/fuzz_pcap.options \
 	testprogs/fuzz/onefile.c \
+	testprogs/nonblocktest.c \
 	testprogs/opentest.c \
 	testprogs/reactivatetest.c \
 	testprogs/selpolltest.c \
@@ -409,11 +421,13 @@
 	testprogs/unix.h \
 	testprogs/valgrindtest.c \
 	testprogs/visopts.py \
-	testprogs/writecaptest.c \
-	tests/shb-option-too-long.pcapng \
-	Win32/Prj/wpcap.sln \
-	Win32/Prj/wpcap.vcxproj \
-	Win32/Prj/wpcap.vcxproj.filters
+	testprogs/writecaptest.c
+
+TEST_DIST = `git ls-files tests | grep -v 'tests/\..*'`
+
+RELEASE_FILES = $(COMMON_C_SRC) $(HDR) $(MAN1) $(MAN3PCAP_EXPAND) \
+	$(MAN3PCAP_NOEXPAND) $(MANFILE) $(MANMISC) $(EXTRA_DIST) \
+	$(TEST_DIST)
 
 all: libpcap.a shared $(BUILD_RPCAPD) libpcap.pc pcap-config
 
@@ -795,8 +809,8 @@
 
 distclean: clean
 	rm -f Makefile grammar.y config.cache config.log config.status \
-	    config.h gnuc.h net os-proto.h libpcap.pc \
-	    pcap-config stamp-h stamp-h.in
+	    config.h config.h.in~ configure~ configure.ac~ \
+	    gnuc.h net os-proto.h libpcap.pc pcap-config stamp-h stamp-h.in
 	rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)
 	rm -rf autom4te.cache
 	(cd rpcapd; $(MAKE) distclean)
@@ -809,21 +823,16 @@
 	ctags -wtd $(TAGFILES)
 
 releasetar:
-	@autoreconf -f; \
-	name=$(PROG)-`cat VERSION` ; \
-	   mkdir $$name; \
-	   tar -c --exclude='*~' -f - $(COMMON_C_SRC) $(HDR) $(MAN1) \
-	      $(MAN3PCAP_EXPAND) $(MAN3PCAP_NOEXPAND) $(MANFILE) \
-	      $(MANMISC) $(EXTRA_DIST) | \
-	      (cd $$name; tar xf -); \
-	   tar -c -z -f $$name.tar.gz $$name; \
-	   rm -rf $$name
-
-rc1 rc2 rc3 rc4 rc5:
-	@VER=`cat $(srcdir)/VERSION`; \
-	sed -i "s/$$VER/$${VER}$@/" VERSION ; \
-	make releasetar; \
-	git checkout VERSION configure
+	@TAG=$(PROG)-`cat VERSION` && \
+	if git show-ref --tags --quiet --verify -- "refs/tags/$$TAG"; then \
+	    git archive --prefix="$$TAG"/ -o "$$TAG".tar.gz "$$TAG" \
+	    $(RELEASE_FILES) && \
+	    echo "Archive build from tag $$TAG."; \
+	else \
+	    git archive --prefix="$$TAG"/ -o "$$TAG".tar.gz HEAD \
+	    $(RELEASE_FILES) && \
+	    echo "No $$TAG tag. Archive build from HEAD."; \
+	fi
 
 depend:	$(GENERATED_C_SRC) $(GENHDR)
 	$(MKDEP) -c "$(CC)" -m "$(DEPENDENCY_CFLAG)" -s "$(srcdir)" $(CFLAGS) $(DEFS) $(INCLS) $(SRC)
@@ -831,4 +840,4 @@
 	(cd testprogs; $(MAKE) depend)
 
 shellcheck:
-	shellcheck -f gcc build.sh build_matrix.sh
+	shellcheck -f gcc -e SC2006 build.sh build_matrix.sh build_common.sh
diff --git a/README.md b/README.md
index d89e3bb..46c33c2 100644
--- a/README.md
+++ b/README.md
@@ -52,12 +52,10 @@
 with the underlying kernel subsystem, but this is not yet implemented.
 
 BPF is standard in 4.4BSD, BSD/OS, NetBSD, FreeBSD, OpenBSD, DragonFly
-BSD, and macOS; an older, modified and undocumented version is standard
-in AIX.  {DEC OSF/1, Digital UNIX, Tru64 UNIX} uses the packetfilter
-interface but has been extended to accept BPF filters (which libpcap
-utilizes).  Also, you can add BPF filter support to Ultrix using the
-kernel source and/or object patches available
-[here](https://www.tcpdump.org/other/bpfext42.tar.Z).
+BSD, macOS, and Solaris 11; an older, modified and undocumented version
+is standard in AIX.  {DEC OSF/1, Digital UNIX, Tru64 UNIX} uses the
+packetfilter interface but has been extended to accept BPF filters
+(which libpcap utilizes).
 
 Linux has a number of BPF based systems, and libpcap does not support
 any of the eBPF mechanisms as yet, although it supports many of the
diff --git a/VERSION b/VERSION
index 4dae298..587c5f0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.10.1
+1.10.3
diff --git a/Win32/Prj/wpcap.sln b/Win32/Prj/wpcap.sln
deleted file mode 100644
index 5a9fce9..0000000
--- a/Win32/Prj/wpcap.sln
+++ /dev/null
@@ -1,28 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.40629.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wpcap", "wpcap.vcxproj", "{8E92D840-6A36-452A-A13C-6E1BA5A2C5A9}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Win32 = Debug|Win32
-		Debug|x64 = Debug|x64
-		Release|Win32 = Release|Win32
-		Release|x64 = Release|x64
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{8E92D840-6A36-452A-A13C-6E1BA5A2C5A9}.Debug|Win32.ActiveCfg = Debug|Win32
-		{8E92D840-6A36-452A-A13C-6E1BA5A2C5A9}.Debug|Win32.Build.0 = Debug|Win32
-		{8E92D840-6A36-452A-A13C-6E1BA5A2C5A9}.Debug|x64.ActiveCfg = Debug|x64
-		{8E92D840-6A36-452A-A13C-6E1BA5A2C5A9}.Debug|x64.Build.0 = Debug|x64
-		{8E92D840-6A36-452A-A13C-6E1BA5A2C5A9}.Release|Win32.ActiveCfg = Release|Win32
-		{8E92D840-6A36-452A-A13C-6E1BA5A2C5A9}.Release|Win32.Build.0 = Release|Win32
-		{8E92D840-6A36-452A-A13C-6E1BA5A2C5A9}.Release|x64.ActiveCfg = Release|x64
-		{8E92D840-6A36-452A-A13C-6E1BA5A2C5A9}.Release|x64.Build.0 = Release|x64
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
diff --git a/Win32/Prj/wpcap.vcxproj b/Win32/Prj/wpcap.vcxproj
deleted file mode 100644
index 43b7099..0000000
--- a/Win32/Prj/wpcap.vcxproj
+++ /dev/null
@@ -1,233 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <SccProjectName />
-    <SccLocalPath />
-    <ProjectGuid>{8E92D840-6A36-452A-A13C-6E1BA5A2C5A9}</ProjectGuid>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>MultiByte</CharacterSet>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>MultiByte</CharacterSet>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>.\Release\</OutDir>
-    <IntDir>.\Release\</IntDir>
-    <LinkIncremental>false</LinkIncremental>
-    <IncludePath>../../../;$(IncludePath)</IncludePath>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <LinkIncremental>false</LinkIncremental>
-    <IncludePath>../../../;$(IncludePath)</IncludePath>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>.\Debug\</OutDir>
-    <IntDir>.\Debug\</IntDir>
-    <LinkIncremental>true</LinkIncremental>
-    <IncludePath>../../../;$(IncludePath)</IncludePath>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <LinkIncremental>true</LinkIncremental>
-    <IncludePath>../../../;$(IncludePath)</IncludePath>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
-      <StringPooling>true</StringPooling>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <Optimization>MaxSpeed</Optimization>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <WarningLevel>Level3</WarningLevel>
-      <AdditionalIncludeDirectories>../../;../../lbl/;../../bpf/;../include/;../../../../common;../../../../dag/include;../../../../dag/drv/windows;../../../Win32-Extensions;./;Win32-Extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;NDEBUG;YY_NEVER_INTERACTIVE;_USRDLL;pcap_EXPORTS;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;ENABLE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ResourceCompile>
-      <Culture>0x0409</Culture>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>ws2_32.lib;..\..\..\..\packetWin7\Dll\Project\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-    <PreBuildEvent>
-      <Command>call ..\..\GenVersion.bat ..\..\VERSION ..\..\pcap_version.h.in ..\..\pcap_version.h
-win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
-win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Command>
-    </PreBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <ClCompile>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
-      <StringPooling>true</StringPooling>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <Optimization>MaxSpeed</Optimization>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <WarningLevel>Level3</WarningLevel>
-      <AdditionalIncludeDirectories>../../;../../lbl/;../../bpf/;../include/;../../../../common;../../../../dag/include;../../../../dag/drv/windows;../../../Win32-Extensions;./;Win32-Extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;NDEBUG;YY_NEVER_INTERACTIVE;_USRDLL;pcap_EXPORTS;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;ENABLE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ResourceCompile>
-      <Culture>0x0409</Culture>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>ws2_32.lib;..\..\..\..\packetWin7\Dll\Project\x64\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-    <PreBuildEvent>
-      <Command>call ..\..\GenVersion.bat ..\..\VERSION ..\..\pcap_version.h.in ..\..\pcap_version.h
-win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
-win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Command>
-    </PreBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
-      <FunctionLevelLinking>false</FunctionLevelLinking>
-      <Optimization>Disabled</Optimization>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <WarningLevel>Level3</WarningLevel>
-      <MinimalRebuild>true</MinimalRebuild>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
-      <AdditionalIncludeDirectories>../../;../../lbl/;../../bpf/;../include/;../../../../common;../../../../dag/include;../../../../dag/drv/windows;../../../Win32-Extensions;./;Win32-Extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;_DEBUG;YY_NEVER_INTERACTIVE;_USRDLL;pcap_EXPORTS;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;ENABLE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-    </ClCompile>
-    <ResourceCompile>
-      <Culture>0x0409</Culture>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>ws2_32.lib;..\..\..\..\packetWin7\Dll\Project\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-    <PreBuildEvent>
-      <Command>call ..\..\GenVersion.bat ..\..\VERSION ..\..\pcap_version.h.in ..\..\pcap_version.h
-win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
-win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Command>
-    </PreBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <ClCompile>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
-      <FunctionLevelLinking>false</FunctionLevelLinking>
-      <Optimization>Disabled</Optimization>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <AdditionalIncludeDirectories>../../;../../lbl/;../../bpf/;../include/;../../../../common;../../../../dag/include;../../../../dag/drv/windows;../../../Win32-Extensions;./;Win32-Extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>HAVE_VERSION_H;__STDC_VERSION__=199901L;HAVE_PACKET_IS_LOOPBACK_ADAPTER;_DEBUG;YY_NEVER_INTERACTIVE;_USRDLL;pcap_EXPORTS;HAVE_STRERROR;__STDC__;INET6;_WINDOWS;ENABLE_REMOTE;WIN32;_U_=;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-    </ClCompile>
-    <ResourceCompile>
-      <Culture>0x0409</Culture>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>ws2_32.lib;..\..\..\..\packetWin7\Dll\Project\x64\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-    <PreBuildEvent>
-      <Command>call ..\..\GenVersion.bat ..\..\VERSION ..\..\pcap_version.h.in ..\..\pcap_version.h
-win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
-win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Command>
-    </PreBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="..\..\bpf\net\bpf_filter.c" />
-    <ClCompile Include="..\..\bpf_dump.c" />
-    <ClCompile Include="..\..\bpf_image.c" />
-    <ClCompile Include="..\..\etherent.c" />
-    <ClCompile Include="..\..\gencode.c" />
-    <ClCompile Include="..\..\grammar.c" />
-    <ClCompile Include="..\..\inet.c" />
-    <ClCompile Include="..\..\missing\win_snprintf.c" />
-    <ClCompile Include="..\..\nametoaddr.c" />
-    <ClCompile Include="..\..\optimize.c" />
-    <ClCompile Include="..\..\pcap-common.c" />
-    <ClCompile Include="..\..\pcap-new.c" />
-    <ClCompile Include="..\..\pcap-rpcap.c" />
-    <ClCompile Include="..\..\pcap-win32.c" />
-    <ClCompile Include="..\..\pcap.c" />
-    <ClCompile Include="..\..\savefile.c" />
-    <ClCompile Include="..\..\scanner.c" />
-    <ClCompile Include="..\..\sf-pcapng.c" />
-    <ClCompile Include="..\..\sf-pcap.c" />
-    <ClCompile Include="..\..\sockutils.c" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="..\..\pcap-common.h" />
-    <ClInclude Include="..\..\pcap-int.h" />
-    <ClInclude Include="..\..\pcap-rpcap.h" />
-    <ClInclude Include="..\..\pcap-stdinc.h" />
-    <ClInclude Include="..\..\pcap.h" />
-    <ClInclude Include="..\..\remote-ext.h" />
-    <ClInclude Include="..\..\sockutils.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="..\..\..\Win32-Extensions\version.rc" />
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
diff --git a/Win32/Prj/wpcap.vcxproj.filters b/Win32/Prj/wpcap.vcxproj.filters
deleted file mode 100644
index 879bb05..0000000
--- a/Win32/Prj/wpcap.vcxproj.filters
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="https://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <ClCompile Include="..\..\bpf_dump.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\bpf\net\bpf_filter.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\bpf_image.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\etherent.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\gencode.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\grammar.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\inet.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\nametoaddr.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\optimize.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\pcap.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\pcap-win32.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\savefile.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\scanner.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\sf-pcap.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\sf-pcapng.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\pcap-common.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\fad-helpers.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\missing\win_snprintf.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\pcap-new.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\pcap-rpcap.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\sockutils.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{c51dce5e-0da9-4e33-a235-d5c76c76485c}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{5ec9fd4b-10b5-4527-b249-56b53d844fb1}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Resource Files">
-      <UniqueIdentifier>{c90886f0-8973-436b-a7a1-b9e881544f9a}</UniqueIdentifier>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="..\..\pcap-stdinc.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\pcap-common.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\pcap.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\pcap-int.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\pcap-rpcap.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\remote-ext.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\sockutils.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="..\..\..\Win32-Extensions\version.rc">
-      <Filter>Resource Files</Filter>
-    </ResourceCompile>
-  </ItemGroup>
-</Project>
diff --git a/aclocal.m4 b/aclocal.m4
index 2fd29fe..502a371 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -232,34 +232,27 @@
 ])
 
 dnl
-dnl Check whether, if you pass an unknown warning option to the
-dnl compiler, it fails or just prints a warning message and succeeds.
-dnl Set ac_lbl_unknown_warning_option_error to the appropriate flag
-dnl to force an error if it would otherwise just print a warning message
-dnl and succeed.
+dnl Save the values of various variables that affect compilation and
+dnl linking, and that we don't ourselves modify persistently; done
+dnl before a test involving compiling or linking is done, so that we
+dnl can restore those variables after the test is done.
 dnl
-AC_DEFUN(AC_LBL_CHECK_UNKNOWN_WARNING_OPTION_ERROR,
-    [
-	AC_MSG_CHECKING([whether the compiler fails when given an unknown warning option])
+AC_DEFUN(AC_LBL_SAVE_CHECK_STATE,
+[
 	save_CFLAGS="$CFLAGS"
-	CFLAGS="$CFLAGS -Wxyzzy-this-will-never-succeed-xyzzy"
-	AC_TRY_COMPILE(
-	    [],
-	    [return 0],
-	    [
-		AC_MSG_RESULT([no])
-		#
-		# We're assuming this is clang, where
-		# -Werror=unknown-warning-option is the appropriate
-		# option to force the compiler to fail.
-		#
-		ac_lbl_unknown_warning_option_error="-Werror=unknown-warning-option"
-	    ],
-	    [
-		AC_MSG_RESULT([yes])
-	    ])
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+])
+
+dnl
+dnl Restore the values of variables saved by AC_LBL_SAVE_CHECK_STATE.
+dnl
+AC_DEFUN(AC_LBL_RESTORE_CHECK_STATE,
+[
 	CFLAGS="$save_CFLAGS"
-    ])
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+])
 
 dnl
 dnl Check whether the compiler option specified as the second argument
@@ -278,21 +271,35 @@
     [
 	AC_MSG_CHECKING([whether the compiler supports the $2 option])
 	save_CFLAGS="$CFLAGS"
-	if expr "x$2" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error $2"
-	elif expr "x$2" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror $2"
-	elif expr "x$2" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror $2"
-	else
-	    CFLAGS="$CFLAGS $2"
-	fi
-	AC_TRY_COMPILE(
-	    [],
-	    [return 0],
+	CFLAGS="$CFLAGS $2"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
+	AC_COMPILE_IFELSE(
+	    [AC_LANG_SOURCE([[int main(void) { return 0; }]])],
 	    [
 		AC_MSG_RESULT([yes])
 		can_add_to_cflags=yes
@@ -332,6 +339,7 @@
 		AC_MSG_RESULT([no])
 		CFLAGS="$save_CFLAGS"
 	    ])
+	ac_c_werror_flag="$save_ac_c_werror_flag"
     ])
 
 dnl
@@ -460,7 +468,6 @@
 dnl	V_SHLIB_CMD
 dnl	V_SHLIB_OPT
 dnl	V_SONAME_OPT
-dnl	V_RPATH_OPT
 dnl
 AC_DEFUN(AC_LBL_SHLIBS_INIT,
     [AC_PREREQ(2.50)
@@ -486,9 +493,10 @@
 
 	    freebsd*|netbsd*|openbsd*|dragonfly*|linux*|osf*|haiku*|midipix*)
 		    #
-		    # Platforms where the linker is the GNU linker
-		    # or accepts command-line arguments like
-		    # those the GNU linker accepts.
+		    # Platforms where the C compiler is GCC or accepts
+		    # compatible command-line arguments, and the linker
+		    # is the GNU linker or accepts compatible command-line
+		    # arguments.
 		    #
 		    # Some instruction sets require -fPIC on some
 		    # operating systems.  Check for them.  If you
@@ -509,7 +517,6 @@
 		    esac
 		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT $PIC_OPT"
 		    V_SONAME_OPT="-Wl,-soname,"
-		    V_RPATH_OPT="-Wl,-rpath,"
 		    ;;
 
 	    hpux*)
@@ -531,11 +538,12 @@
 	    solaris*)
 		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
 		    #
-		    # XXX - this assumes GCC is using the Sun linker,
-		    # rather than the GNU linker.
+		    # Sun/Oracle's C compiler, GCC, and GCC-compatible
+		    # compilers support -Wl,{comma-separated list of options},
+		    # and we use the C compiler, not ld, for all linking,
+		    # including linking to produce a shared library.
 		    #
 		    V_SONAME_OPT="-Wl,-h,"
-		    V_RPATH_OPT="-Wl,-R,"
 		    ;;
 	    esac
     else
@@ -557,7 +565,7 @@
 	    # "-Wl,-soname,{soname}" option, with the soname part
 	    # of the option, while on other platforms the C compiler
 	    # driver takes it as a regular option with the soname
-	    # following the option.  The same applies to V_RPATH_OPT.
+	    # following the option.
 	    #
 	    case "$host_os" in
 
@@ -568,13 +576,17 @@
 
 	    freebsd*|netbsd*|openbsd*|dragonfly*|linux*)
 		    #
-		    # "cc" is GCC.
+		    # Platforms where the C compiler is GCC or accepts
+		    # compatible command-line arguments, and the linker
+		    # is the GNU linker or accepts compatible command-line
+		    # arguments.
+		    #
+		    # XXX - does 64-bit SPARC require -fPIC?
 		    #
 		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
 		    V_SHLIB_CMD="\$(CC)"
 		    V_SHLIB_OPT="-shared"
 		    V_SONAME_OPT="-Wl,-soname,"
-		    V_RPATH_OPT="-Wl,-rpath,"
 		    ;;
 
 	    hpux*)
@@ -597,15 +609,19 @@
 		    V_SHLIB_CMD="\$(CC)"
 		    V_SHLIB_OPT="-shared"
 		    V_SONAME_OPT="-soname "
-		    V_RPATH_OPT="-rpath "
 		    ;;
 
 	    solaris*)
 		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -Kpic"
 		    V_SHLIB_CMD="\$(CC)"
 		    V_SHLIB_OPT="-G"
-		    V_SONAME_OPT="-h "
-		    V_RPATH_OPT="-R"
+		    #
+		    # Sun/Oracle's C compiler, GCC, and GCC-compatible
+		    # compilers support -Wl,{comma-separated list of options},
+		    # and we use the C compiler, not ld, for all linking,
+		    # including linking to produce a shared library.
+		    #
+		    V_SONAME_OPT="-Wl,-h,"
 		    ;;
 	    esac
     fi
@@ -662,8 +678,6 @@
     fi
     AC_DEFINE_UNQUOTED(inline, $ac_cv_lbl_inline, [Define as token for inline if inlining supported])])
 
-FFF
-
 #
 # Test whether we have __atomic_load_n() and __atomic_store_n().
 #
@@ -819,7 +833,6 @@
 	    # Skip all the warning option stuff on some compilers.
 	    #
 	    if test "$ac_lbl_cc_dont_try_gcc_dashW" != yes; then
-		    AC_LBL_CHECK_UNKNOWN_WARNING_OPTION_ERROR()
 		    AC_LBL_CHECK_COMPILER_OPT($1, -W)
 		    AC_LBL_CHECK_COMPILER_OPT($1, -Wall)
 		    AC_LBL_CHECK_COMPILER_OPT($1, -Wcomma)
@@ -1000,19 +1013,23 @@
 	    LIBS="-lsocket -lnsl $LIBS"
 	],
 	[
-		AC_CHECK_LIB(network, getaddrinfo,
-		[
-		    #
-		    # OK, we found it in libnetwork on Haiku.
-		    #
-		    LIBS="-lnetwork $LIBS"
-		],
-		[
-		    #
-		    # We didn't find it.
-		    #
-		    AC_MSG_ERROR([getaddrinfo is required, but wasn't found])
-		])
+	    #
+	    # Not found in libsocket; test for it in libnetwork, which
+	    # is where it is in Haiku.
+	    #
+	    AC_CHECK_LIB(network, getaddrinfo,
+	    [
+		#
+		# OK, we found it in libnetwork.
+		#
+		LIBS="-lnetwork $LIBS"
+	    ],
+	    [
+		#
+		# We didn't find it.
+		#
+		AC_MSG_ERROR([getaddrinfo is required, but wasn't found])
+	    ])
 	], -lnsl)
 
 	#
@@ -1118,13 +1135,8 @@
 dnl
 dnl Check to see whether a particular set of modules exists. Similar to
 dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
-dnl
-dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-dnl only at the first occurrence in configure.ac, so if the first place
-dnl it's called might be skipped (such as if it is within an "if", you
-dnl have to call PKG_CHECK_EXISTS manually
 AC_DEFUN([PKG_CHECK_EXISTS],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+[
 if test -n "$PKG_CONFIG" && \
     AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
   m4_default([$2], [:])
@@ -1132,7 +1144,7 @@
   $3])dnl
 fi])
 
-dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+dnl _PKG_CONFIG([VARIABLE], [FLAGS], [MODULES])
 dnl ---------------------------------------------
 dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
 dnl pkg_failed based on the result.
@@ -1141,7 +1153,7 @@
     pkg_cv_[]$1="$$1"
  elif test -n "$PKG_CONFIG"; then
     PKG_CHECK_EXISTS([$3],
-                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+                     [pkg_cv_[]$1=`$PKG_CONFIG $2 "$3" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes ],
 		     [pkg_failed=yes])
  else
@@ -1153,7 +1165,7 @@
 dnl ---------------------------
 dnl Internal check to see if pkg-config supports short errors.
 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+[
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
         _pkg_short_errors_supported=yes
 else
@@ -1166,37 +1178,44 @@
 dnl   [ACTION-IF-NOT-FOUND])
 dnl --------------------------------------------------------------
 dnl Since: 0.4.0
-dnl
-dnl Note that if there is a possibility the first call to
-dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
-dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
 AC_DEFUN([PKG_CHECK_MODULES],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
-AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+[
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $2, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $2, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS_STATIC], [static-link linker flags for $2, overriding pkg-config])dnl
 
 pkg_failed=no
-AC_MSG_CHECKING([for $1])
+AC_MSG_CHECKING([for $2 with pkg-config])
+PKG_CHECK_EXISTS($2,
+    [
+	#
+	# The package was found, so try to get its C flags and
+	# libraries.
+	#
+	_PKG_CONFIG([$1][_CFLAGS], [--cflags], [$2])
+	_PKG_CONFIG([$1][_LIBS], [--libs], [$2])
+	_PKG_CONFIG([$1][_LIBS_STATIC], [--libs --static], [$2])
 
-_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-_PKG_CONFIG([$1][_LIBS], [libs], [$2])
-
-m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+	m4_define([_PKG_TEXT], [
+Alternatively, you may set the environment variables $1[]_CFLAGS
 and $1[]_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.])
 
-if test $pkg_failed = yes; then
-   	AC_MSG_RESULT([no])
-        _PKG_SHORT_ERRORS_SUPPORTED
-        if test $_pkg_short_errors_supported = yes; then
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
-        else
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+	if test $pkg_failed = yes; then
+		#
+		# That failed - report an error.
+		#
+	   	AC_MSG_RESULT([error])
+        	_PKG_SHORT_ERRORS_SUPPORTED
+	        if test $_pkg_short_errors_supported = yes; then
+		        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+	        else
+		        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+	        fi
+		# Put the nasty error message in config.log where it belongs
+		echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
 
-	m4_default([$4], [AC_MSG_ERROR(
+		m4_default([$4], [AC_MSG_ERROR(
 [Package requirements ($2) were not met:
 
 $$1_PKG_ERRORS
@@ -1206,23 +1225,28 @@
 
 _PKG_TEXT])[]dnl
         ])
-elif test $pkg_failed = untried; then
-     	AC_MSG_RESULT([no])
-	m4_default([$4], [AC_MSG_FAILURE(
-[The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-_PKG_TEXT
-
-To get pkg-config, see <https://pkg-config.freedesktop.org/>.])[]dnl
-        ])
-else
-	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
-	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
-        AC_MSG_RESULT([yes])
-	$3
-fi[]dnl
+	elif test $pkg_failed = untried; then
+		#
+		# We don't have pkg-config, so it didn't work.
+		#
+	     	AC_MSG_RESULT([not found (pkg-config not found)])
+	else
+		#
+		# We found the package.
+		#
+		$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+		$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+		$1[]_LIBS_STATIC=$pkg_cv_[]$1[]_LIBS_STATIC
+	        AC_MSG_RESULT([found])
+		$3
+	fi[]dnl
+    ],
+    [
+	#
+	# The package isn't present.
+	#
+	AC_MSG_RESULT([not found])
+    ])
 ])dnl PKG_CHECK_MODULES
 
 
@@ -1234,13 +1258,8 @@
 dnl Checks for existence of MODULES and gathers its build flags with
 dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
 dnl and VARIABLE-PREFIX_LIBS from --libs.
-dnl
-dnl Note that if there is a possibility the first call to
-dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
-dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
-dnl configure.ac.
 AC_DEFUN([PKG_CHECK_MODULES_STATIC],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+[
 _save_PKG_CONFIG=$PKG_CONFIG
 PKG_CONFIG="$PKG_CONFIG --static"
 PKG_CHECK_MODULES($@)
@@ -1299,12 +1318,11 @@
 dnl
 dnl Retrieves the value of the pkg-config variable for the given module.
 AC_DEFUN([PKG_CHECK_VAR],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+[
 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
 
-_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+_PKG_CONFIG([$1], [--variable="][$3]["], [$2])
 AS_VAR_COPY([$1], [pkg_cv_][$1])
 
 AS_VAR_IF([$1], [""], [$5], [$4])dnl
 ])dnl PKG_CHECK_VAR
-
diff --git a/build.sh b/build.sh
index e14ea68..1af10ca 100755
--- a/build.sh
+++ b/build.sh
@@ -1,96 +1,152 @@
-#!/usr/bin/env bash
+#!/bin/sh -e
 
 # This script runs one build with setup environment variables: CC, CMAKE and
-# REMOTE (default: CC=gcc, CMAKE=no, REMOTE=no).
+# REMOTE.
+: "${CC:=gcc}"
+: "${CMAKE:=no}"
+: "${REMOTE:=no}"
+: "${LIBPCAP_TAINTED:=no}"
+: "${MAKE_BIN:=make}"
 
-set -e
-
-# CC: gcc or clang
-CC=${CC:-gcc}
-# GCC and Clang recognize --version and print to stdout. Sun compilers
-# recognize -V and print to stderr.
-"$CC" --version 2>/dev/null || "$CC" -V || :
-# CMAKE: no or yes
-CMAKE=${CMAKE:-no}
-# REMOTE: no or yes
-REMOTE=${REMOTE:-no}
+. ./build_common.sh
 # Install directory prefix
 if [ -z "$PREFIX" ]; then
-    PREFIX=$(mktemp -d -t libpcap_build_XXXXXXXX)
+    PREFIX=`mktempdir libpcap_build`
     echo "PREFIX set to '$PREFIX'"
     DELETE_PREFIX=yes
 fi
 
-travis_fold() {
-    local action=${1:?}
-    local name=${2:?}
-    if [ "$TRAVIS" != true ]; then return; fi
-    echo -ne "travis_fold:$action:$LABEL.script.$name\\r"
-    sleep 1
-}
+print_cc_version
 
-# Run a command after displaying it
-run_after_echo() {
-    echo -n '$ '
-    echo "$@"
-    # shellcheck disable=SC2068
-    $@
-}
+# The norm is to compile without any warnings, but libpcap builds on some OSes
+# are not warning-free for one or another reason.  If you manage to fix one of
+# these cases, please remember to remove respective exemption below to help any
+# later warnings in the same matrix subset trigger an error.
+# shellcheck disable=SC2221,SC2222
+case `cc_id`/`os_id` in
+gcc-*/Linux-*)
+    # This warning is a bit odd.  It is steadily present in Cirrus CI, but not
+    # in Buildbot.  On my Linux system with the same exact distribution and GCC
+    # as Cirrus CI it reproduces only if GCC receives the "-g" flag:
+    # make CFLAGS=-g -- does not reproduce
+    # CFLAGS=-g make -- reproduces
+    # make -- reproduces
+    #
+    # pcap-linux.c:947:8: warning: ignoring return value of 'write', declared
+    # with attribute warn_unused_result [-Wunused-result]
+    #
+    # And even this way it does not make GCC exit with an error when it has
+    # reported the warning and has received the "-Werror" flag. So let's keep
+    # this block no-op for now.
+    ;;
+clang-*/NetBSD-*)
+    # pcap-bpf.c:1044:18: warning: implicit conversion loses integer precision:
+    # 'uint64_t' (aka 'unsigned long') to 'u_int' (aka 'unsigned int')
+    # [-Wshorten-64-to-32]
+    # pcap-bpf.c:1045:18: warning: implicit conversion loses integer precision:
+    # 'uint64_t' (aka 'unsigned long') to 'u_int' (aka 'unsigned int')
+    # [-Wshorten-64-to-32]
+    # pcap-bpf.c:1274:39: warning: implicit conversion loses integer precision:
+    # 'long' to 'suseconds_t' (aka 'int') [-Wshorten-64-to-32]
+    LIBPCAP_TAINTED=yes
+    ;;
+clang-15.*/*)
+    # grammar.c:1369:14: warning: variable 'pcap_nerrs' set but not used
+    #   [-Wunused-but-set-variable]
+    LIBPCAP_TAINTED=yes
+    ;;
+clang-*/SunOS-5.11)
+    # (Solaris 11 and OpenIndiana)
+    # pcap-bpf.c:1044:18: warning: implicit conversion loses integer precision:
+    #   'uint64_t' (aka 'unsigned long') to 'u_int' (aka 'unsigned int')
+    #   [-Wshorten-64-to-32]
+    # pcap-bpf.c:1045:18: warning: implicit conversion loses integer precision:
+    #   'uint64_t' (aka 'unsigned long') to 'u_int' (aka 'unsigned int')
+    #   [-Wshorten-64-to-32]
+    # fad-getad.c:266:52: warning: implicit conversion loses integer precision:
+    #   'uint64_t'(aka 'unsigned long') to 'bpf_u_int32' (aka 'unsigned int')
+    #   [-Wshorten-64-to-32]
+    # (Solaris 11)
+    # pcap-bpf.c:1843:22: warning: implicit conversion loses integer precision:
+    #   'long' to 'int' [-Wshorten-64-to-32]
+    # (OpenIndiana)
+    # rpcapd.c:393:18: warning: this function declaration is not a prototype
+    #   [-Wstrict-prototypes]
+    [ "`uname -p`" = i386 ] && LIBPCAP_TAINTED=yes
+    ;;
+suncc-5.1[45]/SunOS-5.11)
+    # "scanner.l", line 257: warning: statement not reached
+    # (186 warnings for scanner.l)
+    #
+    # "./filtertest.c", line 259: warning: statement not reached
+    # "./filtertest.c", line 276: warning: statement not reached
+    # "./filtertest.c", line 281: warning: statement not reached
+    LIBPCAP_TAINTED=yes
+    ;;
+*/Haiku-*)
+    # (GCC 8.3.0 and later, Clang 9.0.1.)
+    # pcap-haiku.cpp:55:21: warning: unused variable 'handlep' [-Wunused-variable]
+    # pcap-haiku.cpp:50:37: warning: unused parameter 'maxPackets' [-Wunused-parameter]
+    # pcap-haiku.cpp:111:47: warning: unused parameter 'buffer' [-Wunused-parameter]
+    # pcap-haiku.cpp:111:59: warning: unused parameter 'size' [-Wunused-parameter]
+    # pcap-haiku.cpp:268:26: warning: unused parameter 'name' [-Wunused-parameter]
+    # pcap-haiku.cpp:274:26: warning: unused parameter 'name' [-Wunused-parameter]
+    # pcap-haiku.cpp:274:58: warning: unused parameter 'errbuf' [-Wunused-parameter]
+    #
+    # (The warnings below come from GCC and Clang in CMake builds after installing
+    # all system updates.)
+    # gencode.c:4143:9: warning: converting a packed 'struct in6_addr' pointer
+    #   (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may
+    #   result in an unaligned pointer value [-Waddress-of-packed-member]
+    # gencode.c:4144:9: warning: converting a packed 'struct in6_addr' pointer
+    #   (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may
+    #   result in an unaligned pointer value [-Waddress-of-packed-member]
+    # gencode.c:7189:9: warning: converting a packed 'struct in6_addr' pointer
+    #   (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may
+    #   result in an unaligned pointer value [-Waddress-of-packed-member]
+    # gencode.c:7190:9: warning: converting a packed 'struct in6_addr' pointer
+    #   (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may
+    #   result in an unaligned pointer value [-Waddress-of-packed-member]
+    LIBPCAP_TAINTED=yes
+    ;;
+esac
+[ "$LIBPCAP_TAINTED" != yes ] && CFLAGS=`cc_werr_cflags`
 
-# LABEL is needed to build the travis fold labels
-LABEL="$CC.$CMAKE.$REMOTE"
 if [ "$CMAKE" = no ]; then
-    echo '$ ./configure [...]'
-    travis_fold start configure
-    ./configure --prefix="$PREFIX" --enable-remote="$REMOTE"
-    travis_fold end configure
+    run_after_echo ./configure --prefix="$PREFIX" --enable-remote="$REMOTE"
 else
     # Remove the leftovers from any earlier in-source builds, so this
     # out-of-source build does not break because of that.
     # https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#what-is-an-out-of-source-build
-    rm -rf CMakeFiles/ CMakeCache.txt
-    [ ! -d build ] && mkdir build
-    cd build
-    echo '$ cmake [...]'
-    travis_fold start cmake
-    cmake -DCMAKE_INSTALL_PREFIX="$PREFIX" -DENABLE_REMOTE="$REMOTE" ..
-    travis_fold end cmake
+    # (The contents of build/ remaining after an earlier unsuccessful attempt
+    # can fail subsequent build attempts too, sometimes in non-obvious ways,
+    # so remove that directory as well.)
+    run_after_echo rm -rf CMakeFiles/ CMakeCache.txt build/
+    run_after_echo mkdir build
+    run_after_echo cd build
+    run_after_echo cmake ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
+        -DCMAKE_INSTALL_PREFIX="$PREFIX" -DENABLE_REMOTE="$REMOTE" ..
 fi
-run_after_echo "make -s clean"
-run_after_echo "make -s"
-run_after_echo "make -s testprogs"
-echo '$ make install'
-travis_fold start make_install
-make install
-travis_fold end make_install
+run_after_echo "$MAKE_BIN" -s clean
 if [ "$CMAKE" = no ]; then
-    run_after_echo "testprogs/findalldevstest"
+    run_after_echo "$MAKE_BIN" -s ${CFLAGS:+CFLAGS="$CFLAGS"}
+    run_after_echo "$MAKE_BIN" -s testprogs ${CFLAGS:+CFLAGS="$CFLAGS"}
 else
-    run_after_echo "run/findalldevstest"
+    # The "-s" flag is a no-op and CFLAGS is set using -DEXTRA_CFLAGS above.
+    run_after_echo "$MAKE_BIN"
+    run_after_echo "$MAKE_BIN" testprogs
 fi
+run_after_echo "$MAKE_BIN" install
+# VALGRIND_CMD is meant either to collapse or to expand.
+# shellcheck disable=SC2086
 if [ "$CMAKE" = no ]; then
-    system=$(uname -s)
-    if [ "$system" = Darwin ] || [ "$system" = Linux ]; then
-        run_after_echo "make releasetar"
-    fi
+    run_after_echo $VALGRIND_CMD testprogs/findalldevstest
+    run_after_echo "$MAKE_BIN" releasetar
+else
+    run_after_echo $VALGRIND_CMD run/findalldevstest
 fi
-if [ "$TRAVIS" = true ]; then
-    echo '$ cat Makefile [...]'
-    travis_fold start cat_makefile
-    sed '/^# DO NOT DELETE THIS LINE -- mkdep uses it.$/q' < Makefile
-    travis_fold end cat_makefile
-    echo '$ cat config.h'
-    travis_fold start cat_config_h
-    cat config.h
-    travis_fold end cat_config_h
-    if [ "$CMAKE" = no ]; then
-        echo '$ cat config.log'
-        travis_fold start cat_config_log
-        cat config.log
-        travis_fold end cat_config_log
-    fi
-fi
+handle_matrix_debug
 if [ "$DELETE_PREFIX" = yes ]; then
-    rm -rf "$PREFIX"
+    run_after_echo rm -rf "$PREFIX"
 fi
 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :
diff --git a/build_common.sh b/build_common.sh
new file mode 100644
index 0000000..b5fa66b
--- /dev/null
+++ b/build_common.sh
@@ -0,0 +1,287 @@
+#!/bin/sh -e
+
+# The only purpose of the above shebang is to orient shellcheck right.
+# To make CI scripts maintenance simpler, copies of this file in the
+# libpcap, tcpdump and tcpslice git repositories should be identical.
+# Please mind that Solaris /bin/sh before 11 does not support the $()
+# command substitution syntax, hence the "-e SC2006" flag in Makefile.
+
+# A poor man's mktemp(1) for OSes that don't have one (e.g. AIX 7, Solaris 9).
+mktempdir_diy() {
+    while true; do
+        # /bin/sh implements $RANDOM in AIX 7, but not in Solaris before 11,
+        # thus use dd and od instead.
+        mktempdir_diy_suffix=`dd if=/dev/urandom bs=4 count=1 2>/dev/null | od -t x -A n | head -1 | tr -d '\t '`
+        [ -z "$mktempdir_diy_suffix" ] && return 1
+        mktempdir_diy_path="${TMPDIR:-/tmp}/${1:?}.${mktempdir_diy_suffix}"
+        # "test -e" would be more appropriate, but it is not available in
+        # Solaris /bin/sh before 11.
+        if [ ! -d "$mktempdir_diy_path" ]; then
+            mkdir "$mktempdir_diy_path"
+            chmod go= "$mktempdir_diy_path"
+            echo "$mktempdir_diy_path"
+            break
+        fi
+        # Try again (very unlikely, just in case).
+    done
+}
+
+mktempdir() {
+    mktempdir_prefix=${1:-tmp}
+    case `os_id` in
+    Darwin-*|FreeBSD-*|NetBSD-*)
+        # In these operating systems mktemp(1) always appends an implicit
+        # ".XXXXXXXX" suffix to the requested template when creating a
+        # temporary directory.
+        mktemp -d -t "$mktempdir_prefix"
+        ;;
+    SunOS-5.10|SunOS-5.11)
+        # Although the suffix is optional, specify it for consistent results.
+        mktemp -d -t "${mktempdir_prefix}.XXXXXXXX"
+        ;;
+    SunOS-*|AIX-*)
+        mktempdir_diy "$mktempdir_prefix"
+        ;;
+    *)
+        # At least Haiku, Linux and OpenBSD implementations require explicit
+        # trailing X'es in the template, so make it the same suffix as above.
+        mktemp -d -t "${mktempdir_prefix}.XXXXXXXX"
+        ;;
+    esac
+}
+
+print_sysinfo() {
+    uname -a
+    printf 'OS identification: '
+    os_id
+    date
+}
+
+# Try to make the current C compiler print its version information (usually
+# multi-line) to stdout.
+cc_version_nocache() {
+    : "${CC:?}"
+    case `basename "$CC"` in
+    gcc*|egcc*|clang*)
+        # GCC and Clang recognize --version, print to stdout and exit with 0.
+        "$CC" --version
+        ;;
+    xl*)
+        # XL C 12.1 and 13.1 recognize "-qversion", print to stdout and exit
+        # with 0. XL C 12.1 on an unknown command-line flag displays its man
+        # page and waits.
+        # XL C 16.1 recognizes "-qversion" and "--version", prints to stdout
+        # and exits with 0. Community Edition also prints a banner to stderr.
+        "$CC" -qversion 2>/dev/null
+        ;;
+    sun*)
+        # Sun compilers recognize -V, print to stderr and exit with an error.
+        "$CC" -V 2>&1 || :
+        ;;
+    cc)
+        case `os_id` in
+        SunOS-*)
+            # Most likely Sun C.
+            "$CC" -V 2>&1 || :
+            ;;
+        Darwin-*)
+            # Most likely Clang.
+            "$CC" --version
+            ;;
+        Linux-*|FreeBSD-*|NetBSD-*|OpenBSD-*)
+            # Most likely Clang or GCC.
+            "$CC" --version
+            ;;
+        esac
+        ;;
+    *)
+        "$CC" --version || "$CC" -V || :
+        ;;
+    esac
+}
+
+cc_version() {
+    echo "${cc_version_cached:=`cc_version_nocache`}"
+}
+
+print_cc_version() {
+    cc_version
+    printf 'Compiler identification: '
+    cc_id
+}
+
+# For the current C compiler try to print a short and uniform identification
+# string (such as "gcc-9.3.0") that is convenient to use in a case statement.
+cc_id_nocache() {
+    cc_id_firstline=`cc_version | head -1`
+    : "${cc_id_firstline:?}"
+
+    cc_id_guessed=`echo "$cc_id_firstline" | sed 's/^.*clang version \([0-9\.]*\).*$/clang-\1/'`
+    if [ "$cc_id_firstline" != "$cc_id_guessed" ]; then
+        echo "$cc_id_guessed"
+        return
+    fi
+
+    cc_id_guessed=`echo "$cc_id_firstline" | sed 's/^IBM XL C.*, V\([0-9\.]*\).*$/xlc-\1/'`
+    if [ "$cc_id_firstline" != "$cc_id_guessed" ]; then
+        echo "$cc_id_guessed"
+        return
+    fi
+
+    cc_id_guessed=`echo "$cc_id_firstline" | sed 's/^.* Sun C \([0-9\.]*\) .*$/suncc-\1/'`
+    if [ "$cc_id_firstline" != "$cc_id_guessed" ]; then
+        echo "$cc_id_guessed"
+        return
+    fi
+
+    # OpenBSD default GCC:
+    # "gcc (GCC) 4.2.1 20070719"
+    # RedHat GCC:
+    # "gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)"
+    # "gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1)"
+    # other GCC packages:
+    # "sparc-sun-solaris2.9-gcc (GCC) 4.2.0 (gccfss)"
+    # "gcc (GCC) 5.5.0"
+    # "gcc (nb4 20200810) 7.5.0"
+    # "gcc (OpenIndiana 7.5.0-il-0) 7.5.0"
+    # "gcc (Debian 8.3.0-6) 8.3.0"
+    # "gcc (Raspbian 8.3.0-6+rpi1) 8.3.0"
+    # "egcc (GCC) 8.4.0"
+    # "gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0"
+    # "gcc (FreeBSD Ports Collection) 10.3.0"
+    cc_id_guessed=`echo "$cc_id_firstline" | sed 's/^.* (.*) \([0-9\.]*\).*$/gcc-\1/'`
+    if [ "$cc_id_firstline" != "$cc_id_guessed" ]; then
+        echo "$cc_id_guessed"
+        return
+    fi
+}
+
+cc_id() {
+    echo "${cc_id_cached:=`cc_id_nocache`}"
+}
+
+# Call this function each time CC has changed.
+discard_cc_cache() {
+    cc_version_cached=
+    cc_id_cached=
+}
+
+# For the current C compiler try to print CFLAGS value that tells to treat
+# warnings as errors.
+cc_werr_cflags() {
+    case `cc_id` in
+    gcc-*|clang-*)
+        echo '-Werror'
+        ;;
+    xlc-*)
+        # XL C 12.1 and 13.1 recognize "-qhalt=w". XL C 16.1 recognizes that
+        # and "-Werror".
+        echo '-qhalt=w'
+        ;;
+    suncc-*)
+        echo '-errwarn=%all'
+        ;;
+    esac
+}
+
+# Tell whether "gcc" is a symlink to Clang (this is the case on macOS).
+gcc_is_clang_in_disguise() {
+    case `cc_id`/`basename "${CC:?}"` in
+    clang-*/gcc)
+        return 0
+        ;;
+    esac
+    return 1
+}
+
+os_id() {
+    # OS does not change between builds or in the middle of a build, so it is
+    # fine to cache uname output.
+    : "${os_id_sysname:=`uname -s`}"
+    printf '%s-' "$os_id_sysname"
+    : "${os_id_release:=`uname -r`}"
+    case "$os_id_sysname" in
+    AIX)
+        : "${os_id_version:=`uname -v`}"
+        echo "${os_id_version}.${os_id_release}"
+        ;;
+    Darwin|NetBSD|OpenBSD|SunOS)
+        echo "$os_id_release"
+        ;;
+    FreeBSD|Linux)
+        # Meaningful version is usually the substring before the first dash.
+        echo "$os_id_release" | sed 's/^\([0-9\.]*\).*$/\1/'
+        ;;
+    Haiku)
+        # Meaningful version is the substring before the plus sign.
+        # "hrev55181" stands for "R1/beta3".
+        # "hrev54154" stands for "R1/beta2".
+        : "${os_id_version:=`uname -v`}"
+        echo "$os_id_version" | sed 's/^\(hrev.*\)+.*$/\1/'
+        ;;
+    *)
+        echo 'UNKNOWN'
+        ;;
+    esac
+}
+
+increment() {
+    # No arithmetic expansion in Solaris /bin/sh before 11.
+    echo "${1:?} + 1" | bc
+}
+
+# Display text in magenta.
+echo_magenta() {
+    # ANSI magenta, the imploded text, ANSI reset, newline.
+    printf '\033[35;1m%s\033[0m\n' "$*"
+}
+
+# Run a command after displaying it.
+run_after_echo() {
+    : "${1:?}" # Require at least one argument.
+    printf '$ %s\n' "$*"
+    "$@"
+}
+
+print_so_deps() {
+    case `os_id` in
+    Darwin-*)
+        run_after_echo otool -L "${1:?}"
+        ;;
+    *)
+        run_after_echo ldd "${1:?}"
+        ;;
+    esac
+}
+
+# Beware that setting MATRIX_DEBUG for tcpdump or tcpslice will produce A LOT
+# of additional output there and in any nested libpcap builds. Multiplied by
+# the matrix size, the full output log size might exceed limits of some CI
+# systems (as it had previously happened with Travis CI). Use with caution on
+# a reduced matrix.
+handle_matrix_debug() {
+    [ "$MATRIX_DEBUG" != yes ] && return
+    echo '$ cat Makefile [...]'
+    sed '/^# DO NOT DELETE THIS LINE -- mkdep uses it.$/q' <Makefile
+    run_after_echo cat config.h
+    [ "$CMAKE" = yes ] || run_after_echo cat config.log
+}
+
+purge_directory() {
+    if [ "`os_id`" = SunOS-5.11 ]; then
+        # In Solaris 11 /bin/sh the pathname expansion of "*" always includes
+        # "." and "..", so the straightforward rm would always fail.
+        (
+            cd "${1:?}"
+            for pd_each in *; do
+                if [ "$pd_each" != . ] && [ "$pd_each" != .. ]; then
+                    rm -rf "$pd_each"
+                fi
+            done
+        )
+    else
+        rm -rf "${1:?}"/*
+    fi
+}
+
+# vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :
diff --git a/build_matrix.sh b/build_matrix.sh
index 9b4fad5..6006596 100755
--- a/build_matrix.sh
+++ b/build_matrix.sh
@@ -1,71 +1,63 @@
-#!/usr/bin/env bash
+#!/bin/sh -e
 
 # This script executes the matrix loops, exclude tests and cleaning.
-# The matrix can be configured with environment variables MATRIX_CC,
-# MATRIX_CMAKE and MATRIX_REMOTE (default: MATRIX_CC='gcc clang',
-# MATRIX_CMAKE='no yes', MATRIX_REMOTE='no yes').
+# The matrix can be configured with the following environment variables: MATRIX_CC,
+# MATRIX_CMAKE and MATRIX_REMOTE.
+: "${MATRIX_CC:=gcc clang}"
+: "${MATRIX_CMAKE:=no yes}"
+: "${MATRIX_REMOTE:=no yes}"
+# Set this variable to "yes" before calling this script to disregard all
+# warnings in a particular environment (CI or a local working copy).  Set it
+# to "yes" in this script or in build.sh when a matrix subset is known to be
+# not warning-free because of the OS, the compiler or whatever other factor
+# that the scripts can detect both in and out of CI.
+: "${LIBPCAP_TAINTED:=no}"
+# Some OSes have native make without parallel jobs support and sometimes have
+# GNU Make available as "gmake".
+: "${MAKE_BIN:=make}"
 # It calls the build.sh script which runs one build with setup environment
-# variables : CC, CMAKE and REMOTE (default: CC=gcc, CMAKE=no, REMOTE=no).
+# variables: CC, CMAKE and REMOTE.
 
-set -e
-
-# ANSI color escape sequences
-ANSI_MAGENTA="\\033[35;1m"
-ANSI_RESET="\\033[0m"
-uname -a
-date
+. ./build_common.sh
+print_sysinfo
 # Install directory prefix
 if [ -z "$PREFIX" ]; then
-    PREFIX=$(mktemp -d -t libpcap_build_matrix_XXXXXXXX)
+    PREFIX=`mktempdir libpcap_build_matrix`
     echo "PREFIX set to '$PREFIX'"
     export PREFIX
 fi
 COUNT=0
-
-travis_fold() {
-    local action=${1:?}
-    local name=${2:?}
-    if [ "$TRAVIS" != true ]; then return; fi
-    echo -ne "travis_fold:$action:$LABEL.script.$name\\r"
-    sleep 1
-}
-
-# Display text in magenta
-echo_magenta() {
-    echo -ne "$ANSI_MAGENTA"
-    echo "$@"
-    echo -ne "$ANSI_RESET"
-}
+export LIBPCAP_TAINTED
+if command -v valgrind >/dev/null 2>&1; then
+    VALGRIND_CMD="valgrind --leak-check=full --error-exitcode=1"
+    export VALGRIND_CMD
+fi
 
 touch .devel configure
-for CC in ${MATRIX_CC:-gcc clang}; do
+for CC in $MATRIX_CC; do
     export CC
-    # Exclude gcc on macOS (it is just an alias for clang).
-    if [ "$CC" = gcc ] && [ "$(uname -s)" = Darwin ]; then
+    discard_cc_cache
+    if gcc_is_clang_in_disguise; then
         echo '(skipped)'
         continue
     fi
-    for CMAKE in ${MATRIX_CMAKE:-no yes}; do
+    for CMAKE in $MATRIX_CMAKE; do
         export CMAKE
-        for REMOTE in ${MATRIX_REMOTE:-no yes}; do
+        for REMOTE in $MATRIX_REMOTE; do
             export REMOTE
-            COUNT=$((COUNT+1))
-            echo_magenta "===== SETUP $COUNT: CC=$CC CMAKE=$CMAKE REMOTE=$REMOTE ====="
-            # LABEL is needed to build the travis fold labels
-            LABEL="$CC.$CMAKE.$REMOTE"
+            COUNT=`increment $COUNT`
+            echo_magenta "===== SETUP $COUNT: CC=$CC CMAKE=$CMAKE REMOTE=$REMOTE =====" >&2
             # Run one build with setup environment variables: CC, CMAKE and REMOTE
-            ./build.sh
+            run_after_echo ./build.sh
             echo 'Cleaning...'
-            travis_fold start cleaning
-            if [ "$CMAKE" = yes ]; then rm -rf build; else make distclean; fi
-            rm -rf "${PREFIX:?}"/*
-            git status -suall
+            if [ "$CMAKE" = yes ]; then rm -rf build; else "$MAKE_BIN" distclean; fi
+            purge_directory "$PREFIX"
+            run_after_echo git status -suall
             # Cancel changes in configure
-            git checkout configure
-            travis_fold end cleaning
+            run_after_echo git checkout configure
         done
     done
 done
-rm -rf "$PREFIX"
-echo_magenta "Tested setup count: $COUNT"
+run_after_echo rm -rf "$PREFIX"
+echo_magenta "Tested setup count: $COUNT" >&2
 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :
diff --git a/charconv.c b/charconv.c
index 4ede572..5f97509 100644
--- a/charconv.c
+++ b/charconv.c
@@ -34,6 +34,7 @@
 
 #ifdef _WIN32
 #include <stdio.h>
+#include <errno.h>
 
 #include <pcap/pcap.h>	/* Needed for PCAP_ERRBUF_SIZE */
 
diff --git a/charconv.h b/charconv.h
index a37d424..93103d4 100644
--- a/charconv.h
+++ b/charconv.h
@@ -32,8 +32,8 @@
  * SUCH DAMAGE.
  */
 
-#ifndef charonv_h
-#define charonv_h
+#ifndef charconv_h
+#define charconv_h
 
 #ifdef _WIN32
 extern wchar_t *cp_to_utf_16le(UINT codepage, const char *cp_string, DWORD flags);
@@ -41,4 +41,4 @@
 extern void utf_8_to_acp_truncated(char *);
 #endif
 
-#endif
+#endif /* charconv_h */
diff --git a/cmake/Modules/FindAirPcap.cmake b/cmake/Modules/FindAirPcap.cmake
index 8198f70..56c71b7 100644
--- a/cmake/Modules/FindAirPcap.cmake
+++ b/cmake/Modules/FindAirPcap.cmake
@@ -6,14 +6,14 @@
 #
 # This module defines the following variables:
 #
-# AIRPCAP_INCLUDE_DIR     - absolute path to the directory containing airpcap.h.
+# AirPcap_INCLUDE_DIR     - absolute path to the directory containing airpcap.h.
 #
-# AIRPCAP_LIBRARY         - relative or absolute path to the AirPcap library to
+# AirPcap_LIBRARY         - relative or absolute path to the AirPcap library to
 #                          link with. An absolute path is will be used if the
 #                          AirPcap library is not located in the compiler's
 #                          default search path.
 
-# AIRPCAP_FOUND           - TRUE if the AirPcap library *and* header are found.
+# AirPcap_FOUND           - TRUE if the AirPcap library *and* header are found.
 #
 # Hints and Backward Compatibility
 # ================================
@@ -46,24 +46,24 @@
 endif()
 
 # Find the header
-find_path(AIRPCAP_INCLUDE_DIR airpcap.h
+find_path(AirPcap_INCLUDE_DIR airpcap.h
   PATH_SUFFIXES include
 )
 
 # Find the library
-find_library(AIRPCAP_LIBRARY
+find_library(AirPcap_LIBRARY
   NAMES airpcap
 )
 
-# Set AIRPCAP_FOUND to TRUE if AIRPCAP_INCLUDE_DIR and AIRPCAP_LIBRARY are TRUE.
+# Set AirPcap_FOUND to TRUE if AirPcap_INCLUDE_DIR and AirPcap_LIBRARY are TRUE.
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(AIRPCAP
+find_package_handle_standard_args(AirPcap
   DEFAULT_MSG
-  AIRPCAP_INCLUDE_DIR
-  AIRPCAP_LIBRARY
+  AirPcap_INCLUDE_DIR
+  AirPcap_LIBRARY
 )
 
-mark_as_advanced(AIRPCAP_INCLUDE_DIR AIRPCAP_LIBRARY)
+mark_as_advanced(AirPcap_INCLUDE_DIR AirPcap_LIBRARY)
 
-set(AIRPCAP_INCLUDE_DIRS ${AIRPCAP_INCLUDE_DIR})
-set(AIRPCAP_LIBRARIES ${AIRPCAP_LIBRARY})
+set(AirPcap_INCLUDE_DIRS ${AirPcap_INCLUDE_DIR})
+set(AirPcap_LIBRARIES ${AirPcap_LIBRARY})
diff --git a/cmake/Modules/FindDAG.cmake b/cmake/Modules/FindDAG.cmake
index ef13528..f41b90a 100644
--- a/cmake/Modules/FindDAG.cmake
+++ b/cmake/Modules/FindDAG.cmake
@@ -14,6 +14,12 @@
 find_library(DAG_LIBRARY dag)
 find_library(DAGCONF_LIBRARY dagconf)
 
+#
+# Get link information from the _LIBRARY paths.
+#
+get_link_info_from_library_path(DAG dag)
+get_link_info_from_library_path(DAGCONF dagconf)
+
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(DAG
   DEFAULT_MSG
@@ -30,3 +36,4 @@
 
 set(DAG_INCLUDE_DIRS ${DAG_INCLUDE_DIR})
 set(DAG_LIBRARIES ${DAG_LIBRARY} ${DAGCONF_LIBRARY})
+set(DAG_STATIC_LIBRARIES ${DAG_LIBRARY} ${DAGCONF_LIBRARY})
diff --git a/cmake/Modules/FindPacket.cmake b/cmake/Modules/FindPacket.cmake
index 7253d22..8224cd3 100644
--- a/cmake/Modules/FindPacket.cmake
+++ b/cmake/Modules/FindPacket.cmake
@@ -28,14 +28,14 @@
 #
 # This module defines the following variables:
 #
-# PACKET_INCLUDE_DIR     - absolute path to the directory containing Packet32.h.
+# Packet_INCLUDE_DIR     - absolute path to the directory containing Packet32.h.
 #
-# PACKET_LIBRARY         - relative or absolute path to the Packet library to
+# Packet_LIBRARY         - relative or absolute path to the Packet library to
 #                          link with. An absolute path is will be used if the
 #                          Packet library is not located in the compiler's
 #                          default search path.
 
-# PACKET_FOUND           - TRUE if the Packet library *and* header are found.
+# Packet_FOUND           - TRUE if the Packet library *and* header are found.
 #
 # Hints and Backward Compatibility
 # ================================
@@ -72,7 +72,7 @@
 
   file(WRITE "${CMAKE_BINARY_DIR}/archdetect.c" "${archdetect_c_code}")
   try_compile(
-	  IsArm64 
+	  IsArm64
 	  "${CMAKE_BINARY_DIR}/archdetect"
 	  "${CMAKE_BINARY_DIR}/archdetect.c"
 	  )
@@ -86,24 +86,24 @@
 endif()
 
 # Find the header
-find_path(PACKET_INCLUDE_DIR Packet32.h
+find_path(Packet_INCLUDE_DIR Packet32.h
   PATH_SUFFIXES include Include
 )
 
 # Find the library
-find_library(PACKET_LIBRARY
+find_library(Packet_LIBRARY
   NAMES Packet packet
 )
 
-# Set PACKET_FOUND to TRUE if PACKET_INCLUDE_DIR and PACKET_LIBRARY are TRUE.
+# Set Packet_FOUND to TRUE if Packet_INCLUDE_DIR and Packet_LIBRARY are TRUE.
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(PACKET
+find_package_handle_standard_args(Packet
   DEFAULT_MSG
-  PACKET_INCLUDE_DIR
-  PACKET_LIBRARY
+  Packet_INCLUDE_DIR
+  Packet_LIBRARY
 )
 
-mark_as_advanced(PACKET_INCLUDE_DIR PACKET_LIBRARY)
+mark_as_advanced(Packet_INCLUDE_DIR Packet_LIBRARY)
 
-set(PACKET_INCLUDE_DIRS ${PACKET_INCLUDE_DIR})
-set(PACKET_LIBRARIES ${PACKET_LIBRARY})
+set(Packet_INCLUDE_DIRS ${Packet_INCLUDE_DIR})
+set(Packet_LIBRARIES ${Packet_LIBRARY})
diff --git a/cmake/Modules/FindSNF.cmake b/cmake/Modules/FindSNF.cmake
index 76dcced..d873b5a 100644
--- a/cmake/Modules/FindSNF.cmake
+++ b/cmake/Modules/FindSNF.cmake
@@ -8,6 +8,11 @@
 # Try to find the library
 find_library(SNF_LIBRARY snf /opt/snf)
 
+#
+# Get link information from the _LIBRARY paths.
+#
+get_link_info_from_library_path(SNF snf)
+
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(SNF
   DEFAULT_MSG
@@ -22,3 +27,4 @@
 
 set(SNF_INCLUDE_DIRS ${SNF_INCLUDE_DIR})
 set(SNF_LIBRARIES ${SNF_LIBRARY})
+set(SNF_STATIC_LIBRARIES ${SNF_LIBRARY})
diff --git a/cmake/Modules/Finddpdk.cmake b/cmake/Modules/Finddpdk.cmake
index c51b1f3..323262a 100644
--- a/cmake/Modules/Finddpdk.cmake
+++ b/cmake/Modules/Finddpdk.cmake
@@ -5,89 +5,49 @@
 # dpdk_FOUND
 # dpdk_INCLUDE_DIRS
 # dpdk_LIBRARIES
+# dpdk_STATIC_LIBRARIES
+# dpdk_LIBS_STATIC
+# dpdk_REQUIRES_PRIVATE
+# dpdk_PACKAGE_NAME
 
+#
+# We only try to find DPDK using pkg-config; DPDK is *SO*
+# complicated - DPDK 19.02, for example, has about 117(!)
+# libraries, and the precise set of libraries required has
+# changed over time  - so attempting to guess which libraries
+# you need, and hardcoding that in an attempt to find the
+# libraries without DPDK, rather than relying on DPDK to
+# tell you, with a .pc file, what libraries are needed,
+# is *EXTREMELY* fragile and has caused some bug reports,
+# so we're just not going to do it.
+#
+# If that causes a problem, the only thing we will do is
+# accept an alternative way of finding the appropriate
+# library set for the installed version of DPDK that is
+# as robust as pkg-config (i.e., it had better work as well
+# as pkg-config with *ALL* versions of DPDK that provide a
+# libdpdk.pc file).
+#
+# If dpdk_ROOT is set, add ${dpdk_ROOT}/pkgconfig
+# to PKG_CONFIG_PATH, so we look for the .pc file there,
+# first.
+#
 if(PKG_CONFIG_FOUND)
-  pkg_check_modules(dpdk QUIET libdpdk)
-endif()
-message(STATUS "Executing Finddpdk")
-if(NOT dpdk_INCLUDE_DIRS)
-  message(STATUS "Executing find_path")
-  find_path(dpdk_config_INCLUDE_DIR rte_config.h
-    HINTS
-      ENV DPDK_DIR
-    PATH_SUFFIXES
-      dpdk
-      include
-)
-  find_path(dpdk_common_INCLUDE_DIR rte_common.h
-    HINTS
-      ENV DPDK_DIR
-    PATH_SUFFIXES
-      dpdk
-      include
-)
-  set(dpdk_INCLUDE_DIRS "${dpdk_config_INCLUDE_DIR}")
-  if(NOT dpdk_config_INCLUDE_DIR STREQUAL dpdk_common_INCLUDE_DIR)
-    list(APPEND dpdk_INCLUDE_DIRS "${dpdk_common_INCLUDE_DIR}")
+  set(save_PKG_CONFIG_PATH $ENV{PKG_CONFIG_PATH})
+  if(dpdk_ROOT)
+    set(ENV{PKG_CONFIG_PATH} "${dpdk_ROOT}/pkgconfig:$ENV{PKG_CONFIG_PATH}")
   endif()
-
-  set(components
-    bus_pci
-    cmdline
-    eal
-    ethdev
-    hash
-    kvargs
-    mbuf
-    mempool
-    mempool_ring
-    mempool_stack
-    pci
-    pmd_af_packet
-    pmd_bond
-    pmd_i40e
-    pmd_ixgbe
-    pmd_mlx5
-    pmd_ring
-    pmd_vmxnet3_uio
-    ring)
-
-  set(dpdk_LIBRARIES)
-
-  foreach(c ${components})
-    find_library(DPDK_rte_${c}_LIBRARY rte_${c}
-      HINTS
-        ENV DPDK_DIR
-        ${dpdk_LIBRARY_DIRS}
-      PATH_SUFFIXES lib)
-    if(DPDK_rte_${c}_LIBRARY)
-      set(dpdk_lib dpdk::${c})
-      if (NOT TARGET ${dpdk_lib})
-        add_library(${dpdk_lib} UNKNOWN IMPORTED)
-        set_target_properties(${dpdk_lib} PROPERTIES
-          INTERFACE_INCLUDE_DIRECTORIES "${dpdk_INCLUDE_DIRS}"
-          IMPORTED_LOCATION "${DPDK_rte_${c}_LIBRARY}")
-        if(c STREQUAL pmd_mlx5)
-          find_package(verbs QUIET)
-          if(verbs_FOUND)
-            target_link_libraries(${dpdk_lib} INTERFACE IBVerbs::verbs)
-          endif()
-        endif()
-      endif()
-      list(APPEND dpdk_LIBRARIES ${dpdk_lib})
-    endif()
-  endforeach()
-
-  #
-  # Where the heck did this list come from?  libdpdk on Ubuntu 20.04,
-  # for example, doesn't even *have* -ldpdk; that's why we go with
-  # pkg-config, in the hopes that it provides a correct set of flags
-  # for this tangled mess.
-  #
-  list(APPEND dpdk_LIBRARIES dpdk rt m numo dl)
+  pkg_check_modules(dpdk QUIET libdpdk)
+  if(dpdk_FOUND)
+    #
+    # Get link information for DPDK.
+    #
+    pkg_get_link_info(dpdk libdpdk)
+  endif()
+  set(ENV{PKG_CONFIG_PATH} "${save_PKG_CONFIG_PATH}")
 endif()
 
-mark_as_advanced(dpdk_INCLUDE_DIRS ${dpdk_LIBRARIES})
+mark_as_advanced(dpdk_INCLUDE_DIRS dpdk_LIBRARIES dpdk_STATIC_LIBRARIES dpdk_REQUIRES_PRIVATE)
 
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(dpdk DEFAULT_MSG
@@ -95,29 +55,64 @@
   dpdk_LIBRARIES)
 
 if(dpdk_FOUND)
-  if(NOT TARGET dpdk::cflags)
-     if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
-      set(rte_cflags "-march=core2")
-    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM")
-      set(rte_cflags "-march=armv7-a")
-    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
-      set(rte_cflags "-march=armv8-a+crc")
+  #
+  # This depends on CMake support for "imported targets",
+  # which are not supported until CMake 3.19.
+  #
+  # Ubuntu 20.04 provides CMake 3.16.3, so we are *NOT*
+  # going to require CMake 3.19.  If you want to use
+  # Shiny New Features(TM), wait until all the OSes on
+  # which a build might conceivably be done, and that
+  # provide CMake, provide 3.19 or later.
+  #
+  # Just don't do this stuff on earlier versions.  If that
+  # breaks something, figure out a way to do it *without*
+  # "imported targets", and either do this that way, or,
+  # at least, do it that way on older versions of CMake.
+  #
+  # (One good thing about autotools is that only the builders
+  # of a package, and people doing configure-script development,
+  # have to care about the autoconf etc. version; you don't
+  # even need to have autotools installed in order to be able
+  # to run an autotools-generated configure script, you just
+  # need an environment UN*Xy enough, and modern enough, to
+  # run the stuff in the script.
+  #
+  # This is *NOT* the case for CMake; not only do you need
+  # CMake in order to build a package using CMake, you need
+  # a version recent enough to run the stuff the package's
+  # CMake files use.
+  #
+  # Please keep this in mind when changing any CMake files,
+  # and keep in mind what versions of CMake come with, for
+  # example, commonly-used versions of commonly-used
+  # Linux distributiions.)
+  #
+  if(NOT CMAKE_VERSION VERSION_LESS 3.19)
+    if(NOT TARGET dpdk::cflags)
+       if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
+        set(rte_cflags "-march=core2")
+      elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM")
+        set(rte_cflags "-march=armv7-a")
+      elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
+        set(rte_cflags "-march=armv8-a+crc")
+      endif()
+      add_library(dpdk::cflags INTERFACE IMPORTED)
+      if (rte_cflags)
+        set_target_properties(dpdk::cflags PROPERTIES
+          INTERFACE_COMPILE_OPTIONS "${rte_cflags}")
+      endif()
     endif()
-    add_library(dpdk::cflags INTERFACE IMPORTED)
-    if (rte_cflags)
-      set_target_properties(dpdk::cflags PROPERTIES
-        INTERFACE_COMPILE_OPTIONS "${rte_cflags}")
-    endif()
-  endif()
 
-  if(NOT TARGET dpdk::dpdk)
-    add_library(dpdk::dpdk INTERFACE IMPORTED)
-    find_package(Threads QUIET)
-    list(APPEND dpdk_LIBRARIES
-      Threads::Threads
-      dpdk::cflags)
-    set_target_properties(dpdk::dpdk PROPERTIES
-      INTERFACE_LINK_LIBRARIES "${dpdk_LIBRARIES}"
-      INTERFACE_INCLUDE_DIRECTORIES "${dpdk_INCLUDE_DIRS}")
+    if(NOT TARGET dpdk::dpdk)
+      add_library(dpdk::dpdk INTERFACE IMPORTED)
+      find_package(Threads QUIET)
+      list(APPEND dpdk_LIBRARIES
+        Threads::Threads
+        dpdk::cflags)
+      set_target_properties(dpdk::dpdk PROPERTIES
+        INTERFACE_LINK_LIBRARIES "${dpdk_LIBRARIES}"
+        INTERFACE_INCLUDE_DIRECTORIES "${dpdk_INCLUDE_DIRS}")
+    endif()
   endif()
 endif()
diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in
index ee51ac6..4ac85cc 100644
--- a/cmakeconfig.h.in
+++ b/cmakeconfig.h.in
@@ -117,9 +117,6 @@
 /* Define to 1 if you have the <net/pfilt.h> header file. */
 #cmakedefine HAVE_NET_PFILT_H 1
 
-/* Define to 1 if you have the <net/pfvar.h> header file. */
-#cmakedefine HAVE_NET_PFVAR_H 1
-
 /* Define to 1 if you have the <net/raw.h> header file. */
 #cmakedefine HAVE_NET_RAW_H 1
 
@@ -138,9 +135,6 @@
 /* Define to 1 if you have a POSIX-style `strerror_r' function. */
 #cmakedefine HAVE_POSIX_STRERROR_R 1
 
-/* define if net/pfvar.h defines PF_NAT through PF_NORDR */
-#cmakedefine HAVE_PF_NAT_THROUGH_PF_NORDR 1
-
 /* define if you have the Septel API */
 #cmakedefine HAVE_SEPTEL_API 1
 
@@ -274,9 +268,6 @@
 /* IPv6 */
 #cmakedefine INET6 1
 
-/* path for device for USB sniffing */
-#cmakedefine LINUX_USB_MON_DEV "@LINUX_USB_MON_DEV@"
-
 /* Define to 1 if netinet/ether.h declares `ether_hostton' */
 #cmakedefine NETINET_ETHER_H_DECLARES_ETHER_HOSTTON 1
 
diff --git a/config.guess b/config.guess
index 1972fda..a419d86 100755
--- a/config.guess
+++ b/config.guess
@@ -1,12 +1,14 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2021 Free Software Foundation, Inc.
+#   Copyright 1992-2022 Free Software Foundation, Inc.
 
-timestamp='2021-01-25'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2022-08-01'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
@@ -32,7 +34,15 @@
 # Please send patches to <config-patches@gnu.org>.
 
 
-me=$(echo "$0" | sed -e 's,.*/,,')
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX.  However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
+
+me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
 Usage: $0 [OPTION]
@@ -50,7 +60,7 @@
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2021 Free Software Foundation, Inc.
+Copyright 1992-2022 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -84,6 +94,9 @@
   exit 1
 fi
 
+# Just in case it came from the environment.
+GUESS=
+
 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
 # compiler to aid in system detection is discouraged as it requires
 # temporary files to be created and, as you can see below, it is a
@@ -102,8 +115,8 @@
     # prevent multiple calls if $tmp is already set
     test "$tmp" && return 0
     : "${TMPDIR=/tmp}"
-    # shellcheck disable=SC2039
-    { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } ||
+    # shellcheck disable=SC2039,SC3028
+    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
 	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
 	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
 	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
@@ -112,7 +125,7 @@
 	,,)    echo "int x;" > "$dummy.c"
 	       for driver in cc gcc c89 c99 ; do
 		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
-		       CC_FOR_BUILD="$driver"
+		       CC_FOR_BUILD=$driver
 		       break
 		   fi
 	       done
@@ -131,12 +144,12 @@
 	PATH=$PATH:/.attbin ; export PATH
 fi
 
-UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown
-UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown
-UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown
-UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-case "$UNAME_SYSTEM" in
+case $UNAME_SYSTEM in
 Linux|GNU|GNU/*)
 	LIBC=unknown
 
@@ -157,7 +170,8 @@
 	#endif
 	#endif
 	EOF
-	eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')"
+	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+	eval "$cc_set_libc"
 
 	# Second heuristic to detect musl libc.
 	if [ "$LIBC" = unknown ] &&
@@ -176,7 +190,7 @@
 
 # Note: order is significant - the case branches are not exclusive.
 
-case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
+case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
 	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
@@ -188,11 +202,11 @@
 	#
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
-	UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
 	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
 	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
-	    echo unknown))
-	case "$UNAME_MACHINE_ARCH" in
+	    echo unknown)`
+	case $UNAME_MACHINE_ARCH in
 	    aarch64eb) machine=aarch64_be-unknown ;;
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
@@ -200,15 +214,15 @@
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
 	    earmv*)
-		arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,')
-		endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p')
-		machine="${arch}${endian}"-unknown
+		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine=${arch}${endian}-unknown
 		;;
-	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
+	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
 	# to ELF recently (or will in the future) and ABI.
-	case "$UNAME_MACHINE_ARCH" in
+	case $UNAME_MACHINE_ARCH in
 	    earm*)
 		os=netbsdelf
 		;;
@@ -229,10 +243,10 @@
 		;;
 	esac
 	# Determine ABI tags.
-	case "$UNAME_MACHINE_ARCH" in
+	case $UNAME_MACHINE_ARCH in
 	    earm*)
 		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
-		abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr")
+		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
 		;;
 	esac
 	# The OS release
@@ -240,76 +254,82 @@
 	# thus, need a distinct triplet. However, they do not need
 	# kernel version information, so it can be replaced with a
 	# suitable tag, in the style of linux-gnu.
-	case "$UNAME_VERSION" in
+	case $UNAME_VERSION in
 	    Debian*)
 		release='-gnu'
 		;;
 	    *)
-		release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2)
+		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "$machine-${os}${release}${abi-}"
-	exit ;;
+	GUESS=$machine-${os}${release}${abi-}
+	;;
     *:Bitrig:*:*)
-	UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//')
-	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
-	exit ;;
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
+	;;
     *:OpenBSD:*:*)
-	UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//')
-	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
-	exit ;;
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
+	;;
+    *:SecBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
+	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
+	;;
     *:LibertyBSD:*:*)
-	UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//')
-	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
-	exit ;;
+	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
+	;;
     *:MidnightBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
+	;;
     *:ekkoBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
+	;;
     *:SolidBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
+	;;
     *:OS108:*:*)
-	echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
+	;;
     macppc:MirBSD:*:*)
-	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
+	;;
     *:MirBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
+	;;
     *:Sortix:*:*)
-	echo "$UNAME_MACHINE"-unknown-sortix
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-sortix
+	;;
     *:Twizzler:*:*)
-	echo "$UNAME_MACHINE"-unknown-twizzler
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-twizzler
+	;;
     *:Redox:*:*)
-	echo "$UNAME_MACHINE"-unknown-redox
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-redox
+	;;
     mips:OSF1:*.*)
-	echo mips-dec-osf1
-	exit ;;
+	GUESS=mips-dec-osf1
+	;;
     alpha:OSF1:*:*)
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	trap '' 0
 	case $UNAME_RELEASE in
 	*4.0)
-		UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}')
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
 		;;
 	*5.*)
-		UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}')
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
 		;;
 	esac
 	# According to Compaq, /usr/sbin/psrinfo has been available on
 	# OSF/1 and Tru64 systems produced since 1995.  I hope that
 	# covers most systems running today.  This code pipes the CPU
 	# types through head -n 1, so we only detect the type of CPU 0.
-	ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1)
-	case "$ALPHA_CPU_TYPE" in
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case $ALPHA_CPU_TYPE in
 	    "EV4 (21064)")
 		UNAME_MACHINE=alpha ;;
 	    "EV4.5 (21064)")
@@ -346,68 +366,69 @@
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)"
-	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
-	exitcode=$?
-	trap '' 0
-	exit $exitcode ;;
+	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
+	;;
     Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-unknown-sysv4
-	exit ;;
+	GUESS=m68k-unknown-sysv4
+	;;
     *:[Aa]miga[Oo][Ss]:*:*)
-	echo "$UNAME_MACHINE"-unknown-amigaos
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-amigaos
+	;;
     *:[Mm]orph[Oo][Ss]:*:*)
-	echo "$UNAME_MACHINE"-unknown-morphos
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-morphos
+	;;
     *:OS/390:*:*)
-	echo i370-ibm-openedition
-	exit ;;
+	GUESS=i370-ibm-openedition
+	;;
     *:z/VM:*:*)
-	echo s390-ibm-zvmoe
-	exit ;;
+	GUESS=s390-ibm-zvmoe
+	;;
     *:OS400:*:*)
-	echo powerpc-ibm-os400
-	exit ;;
+	GUESS=powerpc-ibm-os400
+	;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-	echo arm-acorn-riscix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=arm-acorn-riscix$UNAME_RELEASE
+	;;
     arm*:riscos:*:*|arm*:RISCOS:*:*)
-	echo arm-unknown-riscos
-	exit ;;
+	GUESS=arm-unknown-riscos
+	;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
-	echo hppa1.1-hitachi-hiuxmpp
-	exit ;;
+	GUESS=hppa1.1-hitachi-hiuxmpp
+	;;
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-	if test "$( (/bin/universe) 2>/dev/null)" = att ; then
-		echo pyramid-pyramid-sysv3
-	else
-		echo pyramid-pyramid-bsd
-	fi
-	exit ;;
+	case `(/bin/universe) 2>/dev/null` in
+	    att) GUESS=pyramid-pyramid-sysv3 ;;
+	    *)   GUESS=pyramid-pyramid-bsd   ;;
+	esac
+	;;
     NILE*:*:*:dcosx)
-	echo pyramid-pyramid-svr4
-	exit ;;
+	GUESS=pyramid-pyramid-svr4
+	;;
     DRS?6000:unix:4.0:6*)
-	echo sparc-icl-nx6
-	exit ;;
+	GUESS=sparc-icl-nx6
+	;;
     DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
-	case $(/usr/bin/uname -p) in
-	    sparc) echo sparc-icl-nx7; exit ;;
-	esac ;;
+	case `/usr/bin/uname -p` in
+	    sparc) GUESS=sparc-icl-nx7 ;;
+	esac
+	;;
     s390x:SunOS:*:*)
-	echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
+	;;
     sun4H:SunOS:5.*:*)
-	echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=sparc-hal-solaris2$SUN_REL
+	;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-	echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=sparc-sun-solaris2$SUN_REL
+	;;
     i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
-	echo i386-pc-auroraux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=i386-pc-auroraux$UNAME_RELEASE
+	;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	set_cc_for_build
 	SUN_ARCH=i386
@@ -416,47 +437,50 @@
 	# This test works for both compilers.
 	if test "$CC_FOR_BUILD" != no_compiler_found; then
 	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
 		grep IS_64BIT_ARCH >/dev/null
 	    then
 		SUN_ARCH=x86_64
 	    fi
 	fi
-	echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
+	;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
 	# it's likely to be more like Solaris than SunOS4.
-	echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=sparc-sun-solaris3$SUN_REL
+	;;
     sun4*:SunOS:*:*)
-	case "$(/usr/bin/arch -k)" in
+	case `/usr/bin/arch -k` in
 	    Series*|S4*)
-		UNAME_RELEASE=$(uname -v)
+		UNAME_RELEASE=`uname -v`
 		;;
 	esac
 	# Japanese Language versions have a version number like `4.1.3-JL'.
-	echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
+	GUESS=sparc-sun-sunos$SUN_REL
+	;;
     sun3*:SunOS:*:*)
-	echo m68k-sun-sunos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-sun-sunos$UNAME_RELEASE
+	;;
     sun*:*:4.2BSD:*)
-	UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
 	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
-	case "$(/bin/arch)" in
+	case `/bin/arch` in
 	    sun3)
-		echo m68k-sun-sunos"$UNAME_RELEASE"
+		GUESS=m68k-sun-sunos$UNAME_RELEASE
 		;;
 	    sun4)
-		echo sparc-sun-sunos"$UNAME_RELEASE"
+		GUESS=sparc-sun-sunos$UNAME_RELEASE
 		;;
 	esac
-	exit ;;
+	;;
     aushp:SunOS:*:*)
-	echo sparc-auspex-sunos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sparc-auspex-sunos$UNAME_RELEASE
+	;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
     # "atarist" or "atariste" at least should have a processor
@@ -466,41 +490,41 @@
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-atari-mint$UNAME_RELEASE
+	;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-atari-mint$UNAME_RELEASE
+	;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-	echo m68k-atari-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-atari-mint$UNAME_RELEASE
+	;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-	echo m68k-milan-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-milan-mint$UNAME_RELEASE
+	;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-	echo m68k-hades-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-hades-mint$UNAME_RELEASE
+	;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-	echo m68k-unknown-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-unknown-mint$UNAME_RELEASE
+	;;
     m68k:machten:*:*)
-	echo m68k-apple-machten"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-apple-machten$UNAME_RELEASE
+	;;
     powerpc:machten:*:*)
-	echo powerpc-apple-machten"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-apple-machten$UNAME_RELEASE
+	;;
     RISC*:Mach:*:*)
-	echo mips-dec-mach_bsd4.3
-	exit ;;
+	GUESS=mips-dec-mach_bsd4.3
+	;;
     RISC*:ULTRIX:*:*)
-	echo mips-dec-ultrix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-dec-ultrix$UNAME_RELEASE
+	;;
     VAX*:ULTRIX*:*:*)
-	echo vax-dec-ultrix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=vax-dec-ultrix$UNAME_RELEASE
+	;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
-	echo clipper-intergraph-clix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=clipper-intergraph-clix$UNAME_RELEASE
+	;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
 	set_cc_for_build
 	sed 's/^	//' << EOF > "$dummy.c"
@@ -525,78 +549,79 @@
 	}
 EOF
 	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
-	  dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') &&
-	  SYSTEM_NAME=$("$dummy" "$dummyarg") &&
+	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
 	    { echo "$SYSTEM_NAME"; exit; }
-	echo mips-mips-riscos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-mips-riscos$UNAME_RELEASE
+	;;
     Motorola:PowerMAX_OS:*:*)
-	echo powerpc-motorola-powermax
-	exit ;;
+	GUESS=powerpc-motorola-powermax
+	;;
     Motorola:*:4.3:PL8-*)
-	echo powerpc-harris-powermax
-	exit ;;
+	GUESS=powerpc-harris-powermax
+	;;
     Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
-	echo powerpc-harris-powermax
-	exit ;;
+	GUESS=powerpc-harris-powermax
+	;;
     Night_Hawk:Power_UNIX:*:*)
-	echo powerpc-harris-powerunix
-	exit ;;
+	GUESS=powerpc-harris-powerunix
+	;;
     m88k:CX/UX:7*:*)
-	echo m88k-harris-cxux7
-	exit ;;
+	GUESS=m88k-harris-cxux7
+	;;
     m88k:*:4*:R4*)
-	echo m88k-motorola-sysv4
-	exit ;;
+	GUESS=m88k-motorola-sysv4
+	;;
     m88k:*:3*:R3*)
-	echo m88k-motorola-sysv3
-	exit ;;
+	GUESS=m88k-motorola-sysv3
+	;;
     AViiON:dgux:*:*)
 	# DG/UX returns AViiON for all architectures
-	UNAME_PROCESSOR=$(/usr/bin/uname -p)
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
 	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
 	then
 	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
 	       test "$TARGET_BINARY_INTERFACE"x = x
 	    then
-		echo m88k-dg-dgux"$UNAME_RELEASE"
+		GUESS=m88k-dg-dgux$UNAME_RELEASE
 	    else
-		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
+		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
 	    fi
 	else
-	    echo i586-dg-dgux"$UNAME_RELEASE"
+	    GUESS=i586-dg-dgux$UNAME_RELEASE
 	fi
-	exit ;;
+	;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
-	echo m88k-dolphin-sysv3
-	exit ;;
+	GUESS=m88k-dolphin-sysv3
+	;;
     M88*:*:R3*:*)
 	# Delta 88k system running SVR3
-	echo m88k-motorola-sysv3
-	exit ;;
+	GUESS=m88k-motorola-sysv3
+	;;
     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
-	echo m88k-tektronix-sysv3
-	exit ;;
+	GUESS=m88k-tektronix-sysv3
+	;;
     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
-	echo m68k-tektronix-bsd
-	exit ;;
+	GUESS=m68k-tektronix-bsd
+	;;
     *:IRIX*:*:*)
-	echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')"
-	exit ;;
+	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
+	GUESS=mips-sgi-irix$IRIX_REL
+	;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-	exit ;;               # Note that: echo "'$(uname -s)'" gives 'AIX '
+	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
+	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
     i*86:AIX:*:*)
-	echo i386-ibm-aix
-	exit ;;
+	GUESS=i386-ibm-aix
+	;;
     ia64:AIX:*:*)
 	if test -x /usr/bin/oslevel ; then
-		IBM_REV=$(/usr/bin/oslevel)
+		IBM_REV=`/usr/bin/oslevel`
 	else
-		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
 	fi
-	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
-	exit ;;
+	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
+	;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
 		set_cc_for_build
@@ -611,68 +636,68 @@
 			exit(0);
 			}
 EOF
-		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy")
+		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
 		then
-			echo "$SYSTEM_NAME"
+			GUESS=$SYSTEM_NAME
 		else
-			echo rs6000-ibm-aix3.2.5
+			GUESS=rs6000-ibm-aix3.2.5
 		fi
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
-		echo rs6000-ibm-aix3.2.4
+		GUESS=rs6000-ibm-aix3.2.4
 	else
-		echo rs6000-ibm-aix3.2
+		GUESS=rs6000-ibm-aix3.2
 	fi
-	exit ;;
+	;;
     *:AIX:*:[4567])
-	IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }')
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
 		IBM_ARCH=powerpc
 	fi
 	if test -x /usr/bin/lslpp ; then
-		IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc |
-			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/)
+		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
 	else
-		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
 	fi
-	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
-	exit ;;
+	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
+	;;
     *:AIX:*:*)
-	echo rs6000-ibm-aix
-	exit ;;
+	GUESS=rs6000-ibm-aix
+	;;
     ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
-	echo romp-ibm-bsd4.4
-	exit ;;
+	GUESS=romp-ibm-bsd4.4
+	;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
-	exit ;;                             # report: romp-ibm BSD 4.3
+	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
+	;;                                  # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
-	echo rs6000-bull-bosx
-	exit ;;
+	GUESS=rs6000-bull-bosx
+	;;
     DPX/2?00:B.O.S.:*:*)
-	echo m68k-bull-sysv3
-	exit ;;
+	GUESS=m68k-bull-sysv3
+	;;
     9000/[34]??:4.3bsd:1.*:*)
-	echo m68k-hp-bsd
-	exit ;;
+	GUESS=m68k-hp-bsd
+	;;
     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
-	echo m68k-hp-bsd4.4
-	exit ;;
+	GUESS=m68k-hp-bsd4.4
+	;;
     9000/[34678]??:HP-UX:*:*)
-	HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
-	case "$UNAME_MACHINE" in
+	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+	case $UNAME_MACHINE in
 	    9000/31?)            HP_ARCH=m68000 ;;
 	    9000/[34]??)         HP_ARCH=m68k ;;
 	    9000/[678][0-9][0-9])
 		if test -x /usr/bin/getconf; then
-		    sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null)
-		    sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null)
-		    case "$sc_cpu_version" in
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+		    case $sc_cpu_version in
 		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
 		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
 		      532)                      # CPU_PA_RISC2_0
-			case "$sc_kernel_bits" in
+			case $sc_kernel_bits in
 			  32) HP_ARCH=hppa2.0n ;;
 			  64) HP_ARCH=hppa2.0w ;;
 			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
@@ -714,7 +739,7 @@
 		    exit (0);
 		}
 EOF
-		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy")
+		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 	esac
@@ -739,12 +764,12 @@
 		HP_ARCH=hppa64
 	    fi
 	fi
-	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
-	exit ;;
+	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
+	;;
     ia64:HP-UX:*:*)
-	HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
-	echo ia64-hp-hpux"$HPUX_REV"
-	exit ;;
+	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+	GUESS=ia64-hp-hpux$HPUX_REV
+	;;
     3050*:HI-UX:*:*)
 	set_cc_for_build
 	sed 's/^	//' << EOF > "$dummy.c"
@@ -772,38 +797,38 @@
 	  exit (0);
 	}
 EOF
-	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") &&
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
 		{ echo "$SYSTEM_NAME"; exit; }
-	echo unknown-hitachi-hiuxwe2
-	exit ;;
+	GUESS=unknown-hitachi-hiuxwe2
+	;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
-	echo hppa1.1-hp-bsd
-	exit ;;
+	GUESS=hppa1.1-hp-bsd
+	;;
     9000/8??:4.3bsd:*:*)
-	echo hppa1.0-hp-bsd
-	exit ;;
+	GUESS=hppa1.0-hp-bsd
+	;;
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
-	echo hppa1.0-hp-mpeix
-	exit ;;
+	GUESS=hppa1.0-hp-mpeix
+	;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
-	echo hppa1.1-hp-osf
-	exit ;;
+	GUESS=hppa1.1-hp-osf
+	;;
     hp8??:OSF1:*:*)
-	echo hppa1.0-hp-osf
-	exit ;;
+	GUESS=hppa1.0-hp-osf
+	;;
     i*86:OSF1:*:*)
 	if test -x /usr/sbin/sysversion ; then
-	    echo "$UNAME_MACHINE"-unknown-osf1mk
+	    GUESS=$UNAME_MACHINE-unknown-osf1mk
 	else
-	    echo "$UNAME_MACHINE"-unknown-osf1
+	    GUESS=$UNAME_MACHINE-unknown-osf1
 	fi
-	exit ;;
+	;;
     parisc*:Lites*:*:*)
-	echo hppa1.1-hp-lites
-	exit ;;
+	GUESS=hppa1.1-hp-lites
+	;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
-	echo c1-convex-bsd
-	exit ;;
+	GUESS=c1-convex-bsd
+	;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
@@ -811,17 +836,18 @@
 	fi
 	exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
-	echo c34-convex-bsd
-	exit ;;
+	GUESS=c34-convex-bsd
+	;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
-	echo c38-convex-bsd
-	exit ;;
+	GUESS=c38-convex-bsd
+	;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
-	echo c4-convex-bsd
-	exit ;;
+	GUESS=c4-convex-bsd
+	;;
     CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=ymp-cray-unicos$CRAY_REL
+	;;
     CRAY*[A-Z]90:*:*:*)
 	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
@@ -829,114 +855,129 @@
 	      -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*TS:*:*:*)
-	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=t90-cray-unicos$CRAY_REL
+	;;
     CRAY*T3E:*:*:*)
-	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=alphaev5-cray-unicosmk$CRAY_REL
+	;;
     CRAY*SV1:*:*:*)
-	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=sv1-cray-unicos$CRAY_REL
+	;;
     *:UNICOS/mp:*:*)
-	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=craynv-cray-unicosmp$CRAY_REL
+	;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)
-	FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
-	FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/')
-	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-	exit ;;
+	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
+	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+	;;
     5000:UNIX_System_V:4.*:*)
-	FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
-	FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/')
-	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-	exit ;;
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+	;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
+	;;
     sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
+	;;
     *:BSD/OS:*:*)
-	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
+	;;
     arm:FreeBSD:*:*)
-	UNAME_PROCESSOR=$(uname -p)
+	UNAME_PROCESSOR=`uname -p`
 	set_cc_for_build
 	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_PCS_VFP
 	then
-	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi
+	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
 	else
-	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf
+	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
 	fi
-	exit ;;
+	;;
     *:FreeBSD:*:*)
-	UNAME_PROCESSOR=$(/usr/bin/uname -p)
-	case "$UNAME_PROCESSOR" in
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case $UNAME_PROCESSOR in
 	    amd64)
 		UNAME_PROCESSOR=x86_64 ;;
 	    i386)
 		UNAME_PROCESSOR=i586 ;;
 	esac
-	echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
-	exit ;;
+	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
+	;;
     i*:CYGWIN*:*)
-	echo "$UNAME_MACHINE"-pc-cygwin
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-cygwin
+	;;
     *:MINGW64*:*)
-	echo "$UNAME_MACHINE"-pc-mingw64
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-mingw64
+	;;
     *:MINGW*:*)
-	echo "$UNAME_MACHINE"-pc-mingw32
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-mingw32
+	;;
     *:MSYS*:*)
-	echo "$UNAME_MACHINE"-pc-msys
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-msys
+	;;
     i*:PW*:*)
-	echo "$UNAME_MACHINE"-pc-pw32
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-pw32
+	;;
+    *:SerenityOS:*:*)
+        GUESS=$UNAME_MACHINE-pc-serenity
+        ;;
     *:Interix*:*)
-	case "$UNAME_MACHINE" in
+	case $UNAME_MACHINE in
 	    x86)
-		echo i586-pc-interix"$UNAME_RELEASE"
-		exit ;;
+		GUESS=i586-pc-interix$UNAME_RELEASE
+		;;
 	    authenticamd | genuineintel | EM64T)
-		echo x86_64-unknown-interix"$UNAME_RELEASE"
-		exit ;;
+		GUESS=x86_64-unknown-interix$UNAME_RELEASE
+		;;
 	    IA64)
-		echo ia64-unknown-interix"$UNAME_RELEASE"
-		exit ;;
+		GUESS=ia64-unknown-interix$UNAME_RELEASE
+		;;
 	esac ;;
     i*:UWIN*:*)
-	echo "$UNAME_MACHINE"-pc-uwin
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-uwin
+	;;
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-	echo x86_64-pc-cygwin
-	exit ;;
+	GUESS=x86_64-pc-cygwin
+	;;
     prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=powerpcle-unknown-solaris2$SUN_REL
+	;;
     *:GNU:*:*)
 	# the GNU system
-	echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')"
-	exit ;;
+	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
+	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
+	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
+	;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC"
-	exit ;;
+	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
+	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
+	;;
     *:Minix:*:*)
-	echo "$UNAME_MACHINE"-unknown-minix
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-minix
+	;;
     aarch64:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     aarch64_be:Linux:*:*)
 	UNAME_MACHINE=aarch64_be
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     alpha:Linux:*:*)
-	case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
 	  EV56)  UNAME_MACHINE=alphaev56 ;;
 	  PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -947,63 +988,63 @@
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
-    arc:Linux:*:* | arceb:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
+    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     arm*:Linux:*:*)
 	set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
 	else
 	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 		| grep -q __ARM_PCS_VFP
 	    then
-		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
+		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
 	    else
-		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
+		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
 	    fi
 	fi
-	exit ;;
+	;;
     avr32*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     cris:Linux:*:*)
-	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+	;;
     crisv32:Linux:*:*)
-	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+	;;
     e2k:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     frv:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     hexagon:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     i*86:Linux:*:*)
-	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
+	;;
     ia64:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     k1om:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
-    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
+    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     m32r*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     m68*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     mips:Linux:*:* | mips64:Linux:*:*)
 	set_cc_for_build
 	IS_GLIBC=0
@@ -1048,138 +1089,150 @@
 	#endif
 	#endif
 EOF
-	eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')"
+	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
+	eval "$cc_set_vars"
 	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
 	;;
     mips64el:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     openrisc*:Linux:*:*)
-	echo or1k-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=or1k-unknown-linux-$LIBC
+	;;
     or32:Linux:*:* | or1k*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=sparc-unknown-linux-$LIBC
+	;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=hppa64-unknown-linux-$LIBC
+	;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
-	case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in
-	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
-	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
-	  *)    echo hppa-unknown-linux-"$LIBC" ;;
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
+	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
+	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
 	esac
-	exit ;;
+	;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpc64-unknown-linux-$LIBC
+	;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpc-unknown-linux-$LIBC
+	;;
     ppc64le:Linux:*:*)
-	echo powerpc64le-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpc64le-unknown-linux-$LIBC
+	;;
     ppcle:Linux:*:*)
-	echo powerpcle-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpcle-unknown-linux-$LIBC
+	;;
     riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     s390:Linux:*:* | s390x:Linux:*:*)
-	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
+	;;
     sh64*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     sh*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     tile*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     vax:Linux:*:*)
-	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
+	;;
     x86_64:Linux:*:*)
 	set_cc_for_build
+	CPU=$UNAME_MACHINE
 	LIBCABI=$LIBC
 	if test "$CC_FOR_BUILD" != no_compiler_found; then
-	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
-		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
-		grep IS_X32 >/dev/null
-	    then
-		LIBCABI="$LIBC"x32
-	    fi
+	    ABI=64
+	    sed 's/^	    //' << EOF > "$dummy.c"
+	    #ifdef __i386__
+	    ABI=x86
+	    #else
+	    #ifdef __ILP32__
+	    ABI=x32
+	    #endif
+	    #endif
+EOF
+	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
+	    eval "$cc_set_abi"
+	    case $ABI in
+		x86) CPU=i686 ;;
+		x32) LIBCABI=${LIBC}x32 ;;
+	    esac
 	fi
-	echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"
-	exit ;;
+	GUESS=$CPU-pc-linux-$LIBCABI
+	;;
     xtensa*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# earlier versions are messed up and put the nodename in both
 	# sysname and nodename.
-	echo i386-sequent-sysv4
-	exit ;;
+	GUESS=i386-sequent-sysv4
+	;;
     i*86:UNIX_SV:4.2MP:2.*)
 	# Unixware is an offshoot of SVR4, but it has its own version
 	# number series starting with 2...
 	# I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
 	# Use sysv4.2uw... so that sysv4* matches it.
-	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
+	;;
     i*86:OS/2:*:*)
 	# If we were able to find `uname', then EMX Unix compatibility
 	# is probably installed.
-	echo "$UNAME_MACHINE"-pc-os2-emx
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-os2-emx
+	;;
     i*86:XTS-300:*:STOP)
-	echo "$UNAME_MACHINE"-unknown-stop
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-stop
+	;;
     i*86:atheos:*:*)
-	echo "$UNAME_MACHINE"-unknown-atheos
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-atheos
+	;;
     i*86:syllable:*:*)
-	echo "$UNAME_MACHINE"-pc-syllable
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-syllable
+	;;
     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
-	echo i386-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=i386-unknown-lynxos$UNAME_RELEASE
+	;;
     i*86:*DOS:*:*)
-	echo "$UNAME_MACHINE"-pc-msdosdjgpp
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
+	;;
     i*86:*:4.*:*)
-	UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//')
+	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
+		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
 	else
-		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
+		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
 	fi
-	exit ;;
+	;;
     i*86:*:5:[678]*)
 	# UnixWare 7.x, OpenUNIX and OpenServer 6.
-	case $(/bin/uname -X | grep "^Machine") in
+	case `/bin/uname -X | grep "^Machine"` in
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
 	esac
-	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	;;
     i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
-		UNAME_REL=$(sed -n 's/.*Version //p' </usr/options/cb.name)
-		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
-		UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //'))
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
 		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
 		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
 			&& UNAME_MACHINE=i586
@@ -1187,11 +1240,11 @@
 			&& UNAME_MACHINE=i686
 		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
 			&& UNAME_MACHINE=i686
-		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
+		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
 	else
-		echo "$UNAME_MACHINE"-pc-sysv32
+		GUESS=$UNAME_MACHINE-pc-sysv32
 	fi
-	exit ;;
+	;;
     pc:*:*:*)
 	# Left here for compatibility:
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
@@ -1199,37 +1252,37 @@
 	# Note: whatever this is, it MUST be the same as what config.sub
 	# prints for the "djgpp" host, or else GDB configure will decide that
 	# this is a cross-build.
-	echo i586-pc-msdosdjgpp
-	exit ;;
+	GUESS=i586-pc-msdosdjgpp
+	;;
     Intel:Mach:3*:*)
-	echo i386-pc-mach3
-	exit ;;
+	GUESS=i386-pc-mach3
+	;;
     paragon:*:*:*)
-	echo i860-intel-osf1
-	exit ;;
+	GUESS=i860-intel-osf1
+	;;
     i860:*:4.*:*) # i860-SVR4
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
+	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
 	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
+	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
 	fi
-	exit ;;
+	;;
     mini*:CTIX:SYS*5:*)
 	# "miniframe"
-	echo m68010-convergent-sysv
-	exit ;;
+	GUESS=m68010-convergent-sysv
+	;;
     mc68k:UNIX:SYSTEM5:3.51m)
-	echo m68k-convergent-sysv
-	exit ;;
+	GUESS=m68k-convergent-sysv
+	;;
     M680?0:D-NIX:5.3:*)
-	echo m68k-diab-dnix
-	exit ;;
+	GUESS=m68k-diab-dnix
+	;;
     M68*:*:R3V[5678]*:*)
 	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
     3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
 	OS_REL=''
 	test -r /etc/.relid \
-	&& OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
 	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
@@ -1240,7 +1293,7 @@
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
 	OS_REL='.3'
 	test -r /etc/.relid \
-	    && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
 	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
@@ -1248,118 +1301,121 @@
 	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
 	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
+	;;
     mc68030:UNIX_System_V:4.*:*)
-	echo m68k-atari-sysv4
-	exit ;;
+	GUESS=m68k-atari-sysv4
+	;;
     TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
+	;;
     rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
+	;;
     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
-	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
+	;;
     SM[BE]S:UNIX_SV:*:*)
-	echo mips-dde-sysv"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-dde-sysv$UNAME_RELEASE
+	;;
     RM*:ReliantUNIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
+	GUESS=mips-sni-sysv4
+	;;
     RM*:SINIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
+	GUESS=mips-sni-sysv4
+	;;
     *:SINIX-*:*:*)
 	if uname -p 2>/dev/null >/dev/null ; then
-		UNAME_MACHINE=$( (uname -p) 2>/dev/null)
-		echo "$UNAME_MACHINE"-sni-sysv4
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		GUESS=$UNAME_MACHINE-sni-sysv4
 	else
-		echo ns32k-sni-sysv
+		GUESS=ns32k-sni-sysv
 	fi
-	exit ;;
+	;;
     PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
 			# says <Richard.M.Bartel@ccMail.Census.GOV>
-	echo i586-unisys-sysv4
-	exit ;;
+	GUESS=i586-unisys-sysv4
+	;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes@openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
-	echo hppa1.1-stratus-sysv4
-	exit ;;
+	GUESS=hppa1.1-stratus-sysv4
+	;;
     *:*:*:FTX*)
 	# From seanf@swdc.stratus.com.
-	echo i860-stratus-sysv4
-	exit ;;
+	GUESS=i860-stratus-sysv4
+	;;
     i*86:VOS:*:*)
 	# From Paul.Green@stratus.com.
-	echo "$UNAME_MACHINE"-stratus-vos
-	exit ;;
+	GUESS=$UNAME_MACHINE-stratus-vos
+	;;
     *:VOS:*:*)
 	# From Paul.Green@stratus.com.
-	echo hppa1.1-stratus-vos
-	exit ;;
+	GUESS=hppa1.1-stratus-vos
+	;;
     mc68*:A/UX:*:*)
-	echo m68k-apple-aux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-apple-aux$UNAME_RELEASE
+	;;
     news*:NEWS-OS:6*:*)
-	echo mips-sony-newsos6
-	exit ;;
+	GUESS=mips-sony-newsos6
+	;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if test -d /usr/nec; then
-		echo mips-nec-sysv"$UNAME_RELEASE"
+		GUESS=mips-nec-sysv$UNAME_RELEASE
 	else
-		echo mips-unknown-sysv"$UNAME_RELEASE"
+		GUESS=mips-unknown-sysv$UNAME_RELEASE
 	fi
-	exit ;;
+	;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
-	echo powerpc-be-beos
-	exit ;;
+	GUESS=powerpc-be-beos
+	;;
     BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
-	echo powerpc-apple-beos
-	exit ;;
+	GUESS=powerpc-apple-beos
+	;;
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
-	echo i586-pc-beos
-	exit ;;
+	GUESS=i586-pc-beos
+	;;
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
-	echo i586-pc-haiku
-	exit ;;
-    x86_64:Haiku:*:*)
-	echo x86_64-unknown-haiku
-	exit ;;
+	GUESS=i586-pc-haiku
+	;;
+    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
+	GUESS=powerpc-apple-haiku
+	;;
+    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
+	GUESS=$UNAME_MACHINE-unknown-haiku
+	;;
     SX-4:SUPER-UX:*:*)
-	echo sx4-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx4-nec-superux$UNAME_RELEASE
+	;;
     SX-5:SUPER-UX:*:*)
-	echo sx5-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx5-nec-superux$UNAME_RELEASE
+	;;
     SX-6:SUPER-UX:*:*)
-	echo sx6-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx6-nec-superux$UNAME_RELEASE
+	;;
     SX-7:SUPER-UX:*:*)
-	echo sx7-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx7-nec-superux$UNAME_RELEASE
+	;;
     SX-8:SUPER-UX:*:*)
-	echo sx8-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx8-nec-superux$UNAME_RELEASE
+	;;
     SX-8R:SUPER-UX:*:*)
-	echo sx8r-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx8r-nec-superux$UNAME_RELEASE
+	;;
     SX-ACE:SUPER-UX:*:*)
-	echo sxace-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sxace-nec-superux$UNAME_RELEASE
+	;;
     Power*:Rhapsody:*:*)
-	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
+	;;
     *:Rhapsody:*:*)
-	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
+	;;
     arm64:Darwin:*:*)
-	echo aarch64-apple-darwin"$UNAME_RELEASE"
-	exit ;;
+	GUESS=aarch64-apple-darwin$UNAME_RELEASE
+	;;
     *:Darwin:*:*)
-	UNAME_PROCESSOR=$(uname -p)
+	UNAME_PROCESSOR=`uname -p`
 	case $UNAME_PROCESSOR in
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
@@ -1393,109 +1449,119 @@
 	    # uname -m returns i386 or x86_64
 	    UNAME_PROCESSOR=$UNAME_MACHINE
 	fi
-	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
+	;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
-	UNAME_PROCESSOR=$(uname -p)
+	UNAME_PROCESSOR=`uname -p`
 	if test "$UNAME_PROCESSOR" = x86; then
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
-	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
+	;;
     *:QNX:*:4*)
-	echo i386-pc-qnx
-	exit ;;
+	GUESS=i386-pc-qnx
+	;;
     NEO-*:NONSTOP_KERNEL:*:*)
-	echo neo-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=neo-tandem-nsk$UNAME_RELEASE
+	;;
     NSE-*:NONSTOP_KERNEL:*:*)
-	echo nse-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nse-tandem-nsk$UNAME_RELEASE
+	;;
     NSR-*:NONSTOP_KERNEL:*:*)
-	echo nsr-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nsr-tandem-nsk$UNAME_RELEASE
+	;;
     NSV-*:NONSTOP_KERNEL:*:*)
-	echo nsv-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nsv-tandem-nsk$UNAME_RELEASE
+	;;
     NSX-*:NONSTOP_KERNEL:*:*)
-	echo nsx-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nsx-tandem-nsk$UNAME_RELEASE
+	;;
     *:NonStop-UX:*:*)
-	echo mips-compaq-nonstopux
-	exit ;;
+	GUESS=mips-compaq-nonstopux
+	;;
     BS2000:POSIX*:*:*)
-	echo bs2000-siemens-sysv
-	exit ;;
+	GUESS=bs2000-siemens-sysv
+	;;
     DS/*:UNIX_System_V:*:*)
-	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
+	;;
     *:Plan9:*:*)
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# is converted to i386 for consistency with other x86
 	# operating systems.
-	# shellcheck disable=SC2154
-	if test "$cputype" = 386; then
+	if test "${cputype-}" = 386; then
 	    UNAME_MACHINE=i386
-	else
-	    UNAME_MACHINE="$cputype"
+	elif test "x${cputype-}" != x; then
+	    UNAME_MACHINE=$cputype
 	fi
-	echo "$UNAME_MACHINE"-unknown-plan9
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-plan9
+	;;
     *:TOPS-10:*:*)
-	echo pdp10-unknown-tops10
-	exit ;;
+	GUESS=pdp10-unknown-tops10
+	;;
     *:TENEX:*:*)
-	echo pdp10-unknown-tenex
-	exit ;;
+	GUESS=pdp10-unknown-tenex
+	;;
     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
-	echo pdp10-dec-tops20
-	exit ;;
+	GUESS=pdp10-dec-tops20
+	;;
     XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
-	echo pdp10-xkl-tops20
-	exit ;;
+	GUESS=pdp10-xkl-tops20
+	;;
     *:TOPS-20:*:*)
-	echo pdp10-unknown-tops20
-	exit ;;
+	GUESS=pdp10-unknown-tops20
+	;;
     *:ITS:*:*)
-	echo pdp10-unknown-its
-	exit ;;
+	GUESS=pdp10-unknown-its
+	;;
     SEI:*:*:SEIUX)
-	echo mips-sei-seiux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-sei-seiux$UNAME_RELEASE
+	;;
     *:DragonFly:*:*)
-	echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
-	exit ;;
+	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
+	;;
     *:*VMS:*:*)
-	UNAME_MACHINE=$( (uname -p) 2>/dev/null)
-	case "$UNAME_MACHINE" in
-	    A*) echo alpha-dec-vms ; exit ;;
-	    I*) echo ia64-dec-vms ; exit ;;
-	    V*) echo vax-dec-vms ; exit ;;
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case $UNAME_MACHINE in
+	    A*) GUESS=alpha-dec-vms ;;
+	    I*) GUESS=ia64-dec-vms ;;
+	    V*) GUESS=vax-dec-vms ;;
 	esac ;;
     *:XENIX:*:SysV)
-	echo i386-pc-xenix
-	exit ;;
+	GUESS=i386-pc-xenix
+	;;
     i*86:skyos:*:*)
-	echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')"
-	exit ;;
+	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
+	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
+	;;
     i*86:rdos:*:*)
-	echo "$UNAME_MACHINE"-pc-rdos
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-rdos
+	;;
+    i*86:Fiwix:*:*)
+	GUESS=$UNAME_MACHINE-pc-fiwix
+	;;
     *:AROS:*:*)
-	echo "$UNAME_MACHINE"-unknown-aros
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-aros
+	;;
     x86_64:VMkernel:*:*)
-	echo "$UNAME_MACHINE"-unknown-esx
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-esx
+	;;
     amd64:Isilon\ OneFS:*:*)
-	echo x86_64-unknown-onefs
-	exit ;;
+	GUESS=x86_64-unknown-onefs
+	;;
     *:Unleashed:*:*)
-	echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
+	;;
 esac
 
+# Do we have a guess based on uname results?
+if test "x$GUESS" != x; then
+    echo "$GUESS"
+    exit
+fi
+
 # No uname command or uname output not recognized.
 set_cc_for_build
 cat > "$dummy.c" <<EOF
@@ -1535,7 +1601,7 @@
 #define __ARCHITECTURE__ "m68k"
 #endif
   int version;
-  version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null);
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
   if (version < 4)
     printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
   else
@@ -1627,7 +1693,7 @@
 }
 EOF
 
-$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) &&
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
 	{ echo "$SYSTEM_NAME"; exit; }
 
 # Apollos put the system type in the environment.
@@ -1635,7 +1701,7 @@
 
 echo "$0: unable to guess system type" >&2
 
-case "$UNAME_MACHINE:$UNAME_SYSTEM" in
+case $UNAME_MACHINE:$UNAME_SYSTEM in
     mips:Linux | mips64:Linux)
 	# If we got here on MIPS GNU/Linux, output extra information.
 	cat >&2 <<EOF
@@ -1657,9 +1723,11 @@
   https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
 EOF
 
-year=$(echo $timestamp | sed 's,-.*,,')
+our_year=`echo $timestamp | sed 's,-.*,,'`
+thisyear=`date +%Y`
 # shellcheck disable=SC2003
-if test "$(expr "$(date +%Y)" - "$year")" -lt 3 ; then
+script_age=`expr "$thisyear" - "$our_year"`
+if test "$script_age" -lt 3 ; then
    cat >&2 <<EOF
 
 If $0 has already been updated, send the following data and any
@@ -1668,20 +1736,20 @@
 
 config.guess timestamp = $timestamp
 
-uname -m = $( (uname -m) 2>/dev/null || echo unknown)
-uname -r = $( (uname -r) 2>/dev/null || echo unknown)
-uname -s = $( (uname -s) 2>/dev/null || echo unknown)
-uname -v = $( (uname -v) 2>/dev/null || echo unknown)
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
 
-/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null)
-/bin/uname -X     = $( (/bin/uname -X) 2>/dev/null)
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
 
-hostinfo               = $( (hostinfo) 2>/dev/null)
-/bin/universe          = $( (/bin/universe) 2>/dev/null)
-/usr/bin/arch -k       = $( (/usr/bin/arch -k) 2>/dev/null)
-/bin/arch              = $( (/bin/arch) 2>/dev/null)
-/usr/bin/oslevel       = $( (/usr/bin/oslevel) 2>/dev/null)
-/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null)
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
 
 UNAME_MACHINE = "$UNAME_MACHINE"
 UNAME_RELEASE = "$UNAME_RELEASE"
diff --git a/config.h b/config.h
index 8f73307..58dfb41 100644
--- a/config.h
+++ b/config.h
@@ -19,6 +19,9 @@
 /* Define to 1 if you have the `asprintf' function. */
 #define HAVE_ASPRINTF 1
 
+/* Define to 1 if you have the <config/HaikuConfig.h> header file. */
+/* #undef HAVE_CONFIG_HAIKUCONFIG_H */
+
 /* Define to 1 if you have the <dagapi.h> header file. */
 /* #undef HAVE_DAGAPI_H */
 
@@ -72,8 +75,8 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #define HAVE_INTTYPES_H 1
 
-/* Define to 1 if you have the `dag' library (-ldag). */
-/* #undef HAVE_LIBDAG */
+/* Define to 1 if you have the `bsd' library (-lbsd). */
+/* #undef HAVE_LIBBSD */
 
 /* if libdlpi exists */
 /* #undef HAVE_LIBDLPI */
@@ -81,45 +84,21 @@
 /* if libnl exists */
 /* #undef HAVE_LIBNL */
 
-/* if libnl exists and is version 2.x */
-/* #undef HAVE_LIBNL_2_x */
-
-/* if libnl exists and is version 3.x */
-/* #undef HAVE_LIBNL_3_x */
-
-/* libnl has NLE_FAILURE */
-/* #undef HAVE_LIBNL_NLE */
-
-/* libnl has new-style socket api */
-/* #undef HAVE_LIBNL_SOCKETS */
-
-/* Define to 1 if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
 /* Define to 1 if you have the <linux/compiler.h> header file. */
 /* #undef HAVE_LINUX_COMPILER_H */
 
-/* Define to 1 if you have the <linux/ethtool.h> header file. */
-#define HAVE_LINUX_ETHTOOL_H 1
-
 /* define if we have the Linux getnetbyname_r() */
 /* #undef HAVE_LINUX_GETNETBYNAME_R */
 
 /* define if we have the Linux getprotobyname_r() */
 /* #undef HAVE_LINUX_GETPROTOBYNAME_R */
 
-/* Define to 1 if you have the <linux/if_bonding.h> header file. */
-#define HAVE_LINUX_IF_BONDING_H 1
-
 /* Define to 1 if you have the <linux/net_tstamp.h> header file. */
 #define HAVE_LINUX_NET_TSTAMP_H 1
 
 /* Define to 1 if you have the <linux/socket.h> header file. */
 #define HAVE_LINUX_SOCKET_H 1
 
-/* Define to 1 if you have the <linux/sockios.h> header file. */
-#define HAVE_LINUX_SOCKIOS_H 1
-
 /* Define to 1 if you have the <linux/usbdevice_fs.h> header file. */
 #define HAVE_LINUX_USBDEVICE_FS_H 1
 
@@ -138,27 +117,33 @@
 /* Define to 1 if you have the <net/enet.h> header file. */
 /* #undef HAVE_NET_ENET_H */
 
+/* Define to 1 if you have the <net/if_dl.h> header file. */
+/* #undef HAVE_NET_IF_DL_H */
+
+/* Define to 1 if you have the <net/if.h> header file. */
+/* #undef HAVE_NET_IF_H */
+
 /* Define to 1 if you have the <net/if_media.h> header file. */
 /* #undef HAVE_NET_IF_MEDIA_H */
 
+/* Define to 1 if you have the <net/if_types.h> header file. */
+/* #undef HAVE_NET_IF_TYPES_H */
+
 /* Define to 1 if you have the <net/nit.h> header file. */
 /* #undef HAVE_NET_NIT_H */
 
 /* Define to 1 if you have the <net/pfilt.h> header file. */
 /* #undef HAVE_NET_PFILT_H */
 
-/* Define to 1 if you have the <net/pfvar.h> header file. */
-/* #undef HAVE_NET_PFVAR_H */
-
 /* Define to 1 if you have the <net/raw.h> header file. */
 /* #undef HAVE_NET_RAW_H */
 
+/* Use OpenSSL */
+/* #undef HAVE_OPENSSL */
+
 /* if there's an os_proto.h for this platform, to use additional prototypes */
 /* #undef HAVE_OS_PROTO_H */
 
-/* define if net/pfvar.h defines PF_NAT through PF_NORDR */
-/* #undef HAVE_PF_NAT_THROUGH_PF_NORDR */
-
 /* Define to 1 if you have a POSIX-style `strerror_r' function. */
 #define HAVE_POSIX_STRERROR_R 1
 
@@ -168,9 +153,6 @@
 /* define if you have the Myricom SNF API */
 /* #undef HAVE_SNF_API */
 
-/* Define to 1 if you have the `snprintf' function. */
-#define HAVE_SNPRINTF 1
-
 /* Define to 1 if the system has the type `socklen_t'. */
 #define HAVE_SOCKLEN_T 1
 
@@ -192,9 +174,6 @@
 /* Define to 1 if you have the `strerror' function. */
 #define HAVE_STRERROR 1
 
-/* Define to 1 if you have the `strerror_s' function. */
-/* #undef HAVE_STRERROR_S */
-
 /* Define to 1 if you have the <strings.h> header file. */
 #define HAVE_STRINGS_H 1
 
@@ -226,6 +205,9 @@
 /* Define to 1 if `msg_flags' is a member of `struct msghdr'. */
 /* #undef HAVE_STRUCT_MSGHDR_MSG_FLAGS */
 
+/* Define to 1 if the system has the type `struct rte_ether_addr'. */
+/* #undef HAVE_STRUCT_RTE_ETHER_ADDR */
+
 /* Define to 1 if `hci_channel' is a member of `struct sockaddr_hci'. */
 /* #undef HAVE_STRUCT_SOCKADDR_HCI_HCI_CHANNEL */
 
@@ -238,9 +220,6 @@
 /* Define to 1 if `tp_vlan_tci' is a member of `struct tpacket_auxdata'. */
 #define HAVE_STRUCT_TPACKET_AUXDATA_TP_VLAN_TCI 1
 
-/* Define to 1 if the system has the type `struct tpacket_stats'. */
-#define HAVE_STRUCT_TPACKET_STATS 1
-
 /* Define to 1 if `bRequestType' is a member of `struct
    usbdevfs_ctrltransfer'. */
 #define HAVE_STRUCT_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE 1
@@ -278,21 +257,21 @@
 /* Define to 1 if you have the `vasprintf' function. */
 #define HAVE_VASPRINTF 1
 
-/* Define to 1 if you have the `vsnprintf' function. */
-#define HAVE_VSNPRINTF 1
-
 /* Define to 1 if you have the `vsyslog' function. */
 #define HAVE_VSYSLOG 1
 
+/* Define to 1 if you have the `_wcserror_s' function. */
+/* #undef HAVE__WCSERROR_S */
+
+/* define if __atomic_load_n is supported by the compiler */
+#define HAVE___ATOMIC_LOAD_N 1
+
+/* define if __atomic_store_n is supported by the compiler */
+#define HAVE___ATOMIC_STORE_N 1
+
 /* IPv6 */
 #define INET6 1
 
-/* if unaligned access fails */
-/* #undef LBL_ALIGN */
-
-/* path for device for USB sniffing */
-#define LINUX_USB_MON_DEV "/dev/usbmon"
-
 /* Define to 1 if netinet/ether.h declares `ether_hostton' */
 #define NETINET_ETHER_H_DECLARES_ETHER_HOSTTON /**/
 
@@ -312,7 +291,7 @@
 #define PACKAGE_NAME "pcap"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "pcap 1.9.1"
+#define PACKAGE_STRING "pcap 1.10.3"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "pcap"
@@ -321,7 +300,7 @@
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "1.9.1"
+#define PACKAGE_VERSION "1.10.3"
 
 /* target host supports Bluetooth sniffing */
 /* #undef PCAP_SUPPORT_BT */
@@ -338,17 +317,11 @@
 /* target host supports netmap */
 /* #undef PCAP_SUPPORT_NETMAP */
 
-/* use packet ring capture support on Linux if available */
-#define PCAP_SUPPORT_PACKET_RING 1
-
 /* target host supports RDMA sniffing */
 /* #undef PCAP_SUPPORT_RDMASNIFF */
 
-/* target host supports USB sniffing */
-#define PCAP_SUPPORT_USB 1
-
-/* include ACN support */
-/* #undef SITA */
+/* The size of `const void *', as computed by sizeof. */
+/* #undef SIZEOF_CONST_VOID_P */
 
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
diff --git a/config.h.in b/config.h.in
index a1e371a..282a955 100644
--- a/config.h.in
+++ b/config.h.in
@@ -72,8 +72,8 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
-/* Define to 1 if you have the `dag' library (-ldag). */
-#undef HAVE_LIBDAG
+/* Define to 1 if you have the `bsd' library (-lbsd). */
+#undef HAVE_LIBBSD
 
 /* if libdlpi exists */
 #undef HAVE_LIBDLPI
@@ -132,9 +132,6 @@
 /* Define to 1 if you have the <net/pfilt.h> header file. */
 #undef HAVE_NET_PFILT_H
 
-/* Define to 1 if you have the <net/pfvar.h> header file. */
-#undef HAVE_NET_PFVAR_H
-
 /* Define to 1 if you have the <net/raw.h> header file. */
 #undef HAVE_NET_RAW_H
 
@@ -144,9 +141,6 @@
 /* if there's an os_proto.h for this platform, to use additional prototypes */
 #undef HAVE_OS_PROTO_H
 
-/* define if net/pfvar.h defines PF_NAT through PF_NORDR */
-#undef HAVE_PF_NAT_THROUGH_PF_NORDR
-
 /* Define to 1 if you have a POSIX-style `strerror_r' function. */
 #undef HAVE_POSIX_STRERROR_R
 
@@ -271,9 +265,6 @@
 /* IPv6 */
 #undef INET6
 
-/* path for device for USB sniffing */
-#undef LINUX_USB_MON_DEV
-
 /* Define to 1 if netinet/ether.h declares `ether_hostton' */
 #undef NETINET_ETHER_H_DECLARES_ETHER_HOSTTON
 
@@ -328,6 +319,12 @@
 /* target host supports RDMA sniffing */
 #undef PCAP_SUPPORT_RDMASNIFF
 
+/* The size of `const void *', as computed by sizeof. */
+#undef SIZEOF_CONST_VOID_P
+
+/* The size of `void *', as computed by sizeof. */
+#undef SIZEOF_VOID_P
+
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
diff --git a/config.sub b/config.sub
index 7f7d0b0..fbaa37f 100755
--- a/config.sub
+++ b/config.sub
@@ -1,12 +1,14 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2021 Free Software Foundation, Inc.
+#   Copyright 1992-2022 Free Software Foundation, Inc.
 
-timestamp='2021-03-10'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2022-08-01'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
@@ -50,7 +52,14 @@
 #	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
 # It is wrong to echo any other type of specification.
 
-me=$(echo "$0" | sed -e 's,.*/,,')
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX.  However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
 Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
@@ -67,7 +76,7 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2021 Free Software Foundation, Inc.
+Copyright 1992-2022 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -112,9 +121,11 @@
 
 # Split fields of configuration type
 # shellcheck disable=SC2162
+saved_IFS=$IFS
 IFS="-" read field1 field2 field3 field4 <<EOF
 $1
 EOF
+IFS=$saved_IFS
 
 # Separate into logical components for further validation
 case $1 in
@@ -163,6 +174,10 @@
 						basic_machine=$field1
 						basic_os=$field2
 						;;
+					zephyr*)
+						basic_machine=$field1-unknown
+						basic_os=$field2
+						;;
 					# Manufacturers
 					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
 					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
@@ -769,22 +784,22 @@
 		vendor=hp
 		;;
 	i*86v32)
-		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
 		vendor=pc
 		basic_os=sysv32
 		;;
 	i*86v4*)
-		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
 		vendor=pc
 		basic_os=sysv4
 		;;
 	i*86v)
-		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
 		vendor=pc
 		basic_os=sysv
 		;;
 	i*86sol2)
-		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
 		vendor=pc
 		basic_os=solaris2
 		;;
@@ -917,14 +932,16 @@
 		;;
 	leon-*|leon[3-9]-*)
 		cpu=sparc
-		vendor=$(echo "$basic_machine" | sed 's/-.*//')
+		vendor=`echo "$basic_machine" | sed 's/-.*//'`
 		;;
 
 	*-*)
 		# shellcheck disable=SC2162
+		saved_IFS=$IFS
 		IFS="-" read cpu vendor <<EOF
 $basic_machine
 EOF
+		IFS=$saved_IFS
 		;;
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
@@ -1003,6 +1020,11 @@
 		;;
 
 	# Here we normalize CPU types with a missing or matching vendor
+	armh-unknown | armh-alt)
+		cpu=armv7l
+		vendor=alt
+		basic_os=${basic_os:-linux-gnueabihf}
+		;;
 	dpx20-unknown | dpx20-bull)
 		cpu=rs6000
 		vendor=bull
@@ -1084,7 +1106,7 @@
 		cpu=mipsisa64sb1el
 		;;
 	sh5e[lb]-*)
-		cpu=$(echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/')
+		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
 		;;
 	spur-*)
 		cpu=spur
@@ -1102,9 +1124,9 @@
 		cpu=x86_64
 		;;
 	xscale-* | xscalee[bl]-*)
-		cpu=$(echo "$cpu" | sed 's/^xscale/arm/')
+		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
 		;;
-	arm64-*)
+	arm64-* | aarch64le-*)
 		cpu=aarch64
 		;;
 
@@ -1165,7 +1187,7 @@
 			| alphapca5[67] | alpha64pca5[67] \
 			| am33_2.0 \
 			| amdgcn \
-			| arc | arceb \
+			| arc | arceb | arc32 | arc64 \
 			| arm | arm[lb]e | arme[lb] | armv* \
 			| avr | avr32 \
 			| asmjs \
@@ -1185,7 +1207,7 @@
 			| k1om \
 			| le32 | le64 \
 			| lm32 \
-			| loongarch32 | loongarch64 | loongarchx32 \
+			| loongarch32 | loongarch64 \
 			| m32c | m32r | m32rle \
 			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
 			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
@@ -1204,9 +1226,13 @@
 			| mips64vr5900 | mips64vr5900el \
 			| mipsisa32 | mipsisa32el \
 			| mipsisa32r2 | mipsisa32r2el \
+			| mipsisa32r3 | mipsisa32r3el \
+			| mipsisa32r5 | mipsisa32r5el \
 			| mipsisa32r6 | mipsisa32r6el \
 			| mipsisa64 | mipsisa64el \
 			| mipsisa64r2 | mipsisa64r2el \
+			| mipsisa64r3 | mipsisa64r3el \
+			| mipsisa64r5 | mipsisa64r5el \
 			| mipsisa64r6 | mipsisa64r6el \
 			| mipsisa64sb1 | mipsisa64sb1el \
 			| mipsisa64sr71k | mipsisa64sr71kel \
@@ -1283,35 +1309,37 @@
 if test x$basic_os != x
 then
 
-# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
+# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
 # set os.
 case $basic_os in
 	gnu/linux*)
 		kernel=linux
-		os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|')
+		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
 		;;
 	os2-emx)
 		kernel=os2
-		os=$(echo $basic_os | sed -e 's|os2-emx|emx|')
+		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
 		;;
 	nto-qnx*)
 		kernel=nto
-		os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|')
+		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
 		;;
 	*-*)
 		# shellcheck disable=SC2162
+		saved_IFS=$IFS
 		IFS="-" read kernel os <<EOF
 $basic_os
 EOF
+		IFS=$saved_IFS
 		;;
 	# Default OS when just kernel was specified
 	nto*)
 		kernel=nto
-		os=$(echo $basic_os | sed -e 's|nto|qnx|')
+		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
 		;;
 	linux*)
 		kernel=linux
-		os=$(echo $basic_os | sed -e 's|linux|gnu|')
+		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
 		;;
 	*)
 		kernel=
@@ -1332,7 +1360,7 @@
 		os=cnk
 		;;
 	solaris1 | solaris1.*)
-		os=$(echo $os | sed -e 's|solaris1|sunos4|')
+		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
 		;;
 	solaris)
 		os=solaris2
@@ -1361,7 +1389,7 @@
 		os=sco3.2v4
 		;;
 	sco3.2.[4-9]*)
-		os=$(echo $os | sed -e 's/sco3.2./sco3.2v/')
+		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
 		;;
 	sco*v* | scout)
 		# Don't match below
@@ -1391,7 +1419,7 @@
 		os=lynxos
 		;;
 	mac[0-9]*)
-		os=$(echo "$os" | sed -e 's|mac|macos|')
+		os=`echo "$os" | sed -e 's|mac|macos|'`
 		;;
 	opened*)
 		os=openedition
@@ -1400,10 +1428,10 @@
 		os=os400
 		;;
 	sunos5*)
-		os=$(echo "$os" | sed -e 's|sunos5|solaris2|')
+		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
 		;;
 	sunos6*)
-		os=$(echo "$os" | sed -e 's|sunos6|solaris3|')
+		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
 		;;
 	wince*)
 		os=wince
@@ -1437,7 +1465,7 @@
 		;;
 	# Preserve the version number of sinix5.
 	sinix5.*)
-		os=$(echo $os | sed -e 's|sinix|sysv|')
+		os=`echo "$os" | sed -e 's|sinix|sysv|'`
 		;;
 	sinix*)
 		os=sysv4
@@ -1684,7 +1712,7 @@
 # Now, validate our (potentially fixed-up) OS.
 case $os in
 	# Sometimes we do "kernel-libc", so those need to count as OSes.
-	musl* | newlib* | uclibc*)
+	musl* | newlib* | relibc* | uclibc*)
 		;;
 	# Likewise for "kernel-abi"
 	eabi* | gnueabi*)
@@ -1707,7 +1735,7 @@
 	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
 	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
 	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
-	     | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \
+	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
 	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
 	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
 	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
@@ -1725,7 +1753,8 @@
 	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
 	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
 	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
-	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*)
+	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
+	     | fiwix* )
 		;;
 	# This one is extra strict with allowed versions
 	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@@ -1742,11 +1771,12 @@
 # As a final step for OS-related things, validate the OS-kernel combination
 # (given a valid OS), if there is a kernel.
 case $kernel-$os in
-	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
+	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
+		   | linux-musl* | linux-relibc* | linux-uclibc* )
 		;;
 	uclinux-uclibc* )
 		;;
-	-dietlibc* | -newlib* | -musl* | -uclibc* )
+	-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
 		# These are just libc implementations, not actual OSes, and thus
 		# require a kernel.
 		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
diff --git a/configure b/configure
index 15a5e68..91fd180 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pcap 1.10.1.
+# Generated by GNU Autoconf 2.69 for pcap 1.10.3.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@
 # Identity of this package.
 PACKAGE_NAME='pcap'
 PACKAGE_TARNAME='pcap'
-PACKAGE_VERSION='1.10.1'
-PACKAGE_STRING='pcap 1.10.1'
+PACKAGE_VERSION='1.10.3'
+PACKAGE_STRING='pcap 1.10.3'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -620,65 +620,77 @@
 #endif"
 
 ac_subst_vars='LTLIBOBJS
-INSTALL_DATA
-INSTALL_SCRIPT
-INSTALL_PROGRAM
-PCAP_SUPPORT_RDMASNIFF
-PCAP_SUPPORT_DBUS
-PCAP_SUPPORT_BT
-PCAP_SUPPORT_DPDK
-PCAP_SUPPORT_NETMAP
-PCAP_SUPPORT_NETFILTER
-PCAP_SUPPORT_LINUX_USBMON
-EXTRA_NETWORK_LIBS
 RPCAPD_LIBS
 INSTALL_RPCAPD
 BUILD_RPCAPD
 PTHREAD_LIBS
-MAN_ADMIN_COMMANDS
-MAN_MISC_INFO
-MAN_FILE_FORMATS
-MAN_DEVICES
-DYEXT
 REMOTE_C_SRC
 MODULE_C_SRC
 PLATFORM_CXX_SRC
 PLATFORM_C_SRC
 ADDLARCHIVEOBJS
 ADDLOBJS
-V_YACC
-V_RPATH_OPT
+RPATH
 V_SONAME_OPT
 V_SHLIB_OPT
 V_SHLIB_CMD
 V_SHLIB_CCOPT
-V_LEX
-V_INCLS
-V_DEFS
-V_PROG_LDFLAGS_FAT
-V_PROG_CCOPT_FAT
-V_LIB_LDFLAGS_FAT
-V_LIB_CCOPT_FAT
-V_CCOPT
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+PCAP_SUPPORT_RDMASNIFF
+LIBIBVERBS_LIBS_STATIC
+LIBIBVERBS_LIBS
+LIBIBVERBS_CFLAGS
+PCAP_SUPPORT_DBUS
+DBUS_LIBS_STATIC
+DBUS_LIBS
+DBUS_CFLAGS
+PCAP_SUPPORT_BT
+PCAP_SUPPORT_DPDK
+DPDK_LIBS_STATIC
+DPDK_LIBS
+DPDK_CFLAGS
+PCAP_SUPPORT_NETMAP
+PCAP_SUPPORT_NETFILTER
+PCAP_SUPPORT_LINUX_USBMON
 MKDEP
 DEPENDENCY_CFLAG
 LN_S
 AR
 RANLIB
+MAN_ADMIN_COMMANDS
+MAN_MISC_INFO
+MAN_FILE_FORMATS
+MAN_DEVICES
+DYEXT
+V_PROG_LDFLAGS_FAT
+V_PROG_CCOPT_FAT
+V_LIB_LDFLAGS_FAT
+V_LIB_CCOPT_FAT
 REENTRANT_PARSER
 BISON_BYACC
 LEXLIB
 LEX_OUTPUT_ROOT
 LEX
-PKGCONFIG
+OPENSSL_LIBS_STATIC
+OPENSSL_LIBS
+OPENSSL_CFLAGS
+LIBNL_LIBS_STATIC
+LIBNL_LIBS
+LIBNL_CFLAGS
+BREW
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
 VALGRINDTEST_SRC
 LIBOBJS
-EGREP
-GREP
-CPP
 ac_ct_CXX
 CXXFLAGS
 CXX
+EGREP
+GREP
+CPP
 OBJEXT
 EXEEXT
 ac_ct_CC
@@ -699,6 +711,12 @@
 build_vendor
 build_cpu
 build
+LIBS_PRIVATE
+REQUIRES_PRIVATE
+LIBS_STATIC
+V_INCLS
+V_DEFS
+V_CCOPT
 target_alias
 host_alias
 build_alias
@@ -718,7 +736,6 @@
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -775,10 +792,28 @@
 LDFLAGS
 LIBS
 CPPFLAGS
+CPP
 CXX
 CXXFLAGS
 CCC
-CPP'
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+LIBNL_CFLAGS
+LIBNL_LIBS
+LIBNL_LIBS_STATIC
+OPENSSL_CFLAGS
+OPENSSL_LIBS
+OPENSSL_LIBS_STATIC
+DPDK_CFLAGS
+DPDK_LIBS
+DPDK_LIBS_STATIC
+DBUS_CFLAGS
+DBUS_LIBS
+DBUS_LIBS_STATIC
+LIBIBVERBS_CFLAGS
+LIBIBVERBS_LIBS
+LIBIBVERBS_LIBS_STATIC'
 
 
 # Initialize some variables set by options.
@@ -817,7 +852,6 @@
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1070,15 +1104,6 @@
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1216,7 +1241,7 @@
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir runstatedir
+		libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1329,7 +1354,7 @@
   # 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 pcap 1.10.1 to adapt to many kinds of systems.
+\`configure' configures pcap 1.10.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1369,7 +1394,6 @@
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1396,7 +1420,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of pcap 1.10.1:";;
+     short | recursive ) echo "Configuration of pcap 1.10.3:";;
    esac
   cat <<\_ACEOF
 
@@ -1408,7 +1432,6 @@
   --disable-protochain    disable \"protochain\" insn
   --enable-ipv6           build IPv6-capable version [default=yes]
   --enable-remote         enable remote packet capture [default=no]
-  --disable-remote        disable remote packet capture
   --enable-optimizer-dbg  build optimizer debugging code
   --enable-yydebug        build parser debugging code
   --disable-universal     don't build universal on macOS
@@ -1460,9 +1483,40 @@
   LIBS        libraries to pass to the linker, e.g. -l<library>
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
-  CPP         C preprocessor
+  PKG_CONFIG  path to pkg-config utility
+  PKG_CONFIG_PATH
+              directories to add to pkg-config's search path
+  PKG_CONFIG_LIBDIR
+              path overriding pkg-config's built-in search path
+  LIBNL_CFLAGS
+              C compiler flags for libnl-genl-3.0, overriding pkg-config
+  LIBNL_LIBS  linker flags for libnl-genl-3.0, overriding pkg-config
+  LIBNL_LIBS_STATIC
+              static-link linker flags for libnl-genl-3.0, overriding
+              pkg-config
+  OPENSSL_CFLAGS
+              C compiler flags for openssl, overriding pkg-config
+  OPENSSL_LIBS
+              linker flags for openssl, overriding pkg-config
+  OPENSSL_LIBS_STATIC
+              static-link linker flags for openssl, overriding pkg-config
+  DPDK_CFLAGS C compiler flags for libdpdk, overriding pkg-config
+  DPDK_LIBS   linker flags for libdpdk, overriding pkg-config
+  DPDK_LIBS_STATIC
+              static-link linker flags for libdpdk, overriding pkg-config
+  DBUS_CFLAGS C compiler flags for dbus-1, overriding pkg-config
+  DBUS_LIBS   linker flags for dbus-1, overriding pkg-config
+  DBUS_LIBS_STATIC
+              static-link linker flags for dbus-1, overriding pkg-config
+  LIBIBVERBS_CFLAGS
+              C compiler flags for libibverbs, overriding pkg-config
+  LIBIBVERBS_LIBS
+              linker flags for libibverbs, overriding pkg-config
+  LIBIBVERBS_LIBS_STATIC
+              static-link linker flags for libibverbs, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1530,7 +1584,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-pcap configure 1.10.1
+pcap configure 1.10.3
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1582,6 +1636,299 @@
 
 } # ac_fn_c_try_compile
 
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
+else
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+  fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
 # ac_fn_cxx_try_compile LINENO
 # ----------------------------
 # Try to compile conftest.$ac_ext, and return whether this succeeded.
@@ -1620,42 +1967,230 @@
 
 } # ac_fn_cxx_try_compile
 
-# ac_fn_c_try_cpp LINENO
-# ----------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_cpp ()
+# ac_fn_cxx_try_run LINENO
+# ------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_cxx_try_run ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_cpp conftest.$ac_ext"
+  if { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
 $as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  (eval "$ac_link") 2>&5
   ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } > conftest.i && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then :
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
   ac_retval=0
 else
-  $as_echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-    ac_retval=1
+       ac_retval=$ac_status
 fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
-} # ac_fn_c_try_cpp
+} # ac_fn_cxx_try_run
+
+# ac_fn_cxx_compute_int LINENO EXPR VAR INCLUDES
+# ----------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_cxx_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
+else
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+  fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_compute_int
 
 # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
 # -------------------------------------------------------
@@ -1744,79 +2279,6 @@
 
 } # ac_fn_c_check_header_mongrel
 
-# ac_fn_c_try_run LINENO
-# ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-       $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_retval=$ac_status
-fi
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_run
-
-# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists and can be compiled using the include files in
-# INCLUDES, setting the cache variable VAR accordingly.
-ac_fn_c_check_header_compile ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_compile
-
 # ac_fn_c_check_func LINENO FUNC VAR
 # ----------------------------------
 # Tests whether FUNC exists, setting the cache variable VAR accordingly
@@ -2044,7 +2506,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by pcap $as_me 1.10.1, which was
+It was created by pcap $as_me 1.10.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2395,6 +2857,86 @@
 
 
 
+#
+# These are the variables that are used in Makefile, pcap-config, and
+# libpcap.pc.
+#
+# CFLAGS: inherited from the environment, not modified by us (except
+# temporarily during tests that involve compilation).  Used only when
+# compiling C source.
+#
+# CXXFLAGS: inherited from the environment, not modified by us.  Used only
+# when compiling C++ source.
+#
+# LDFLAGS: inherited from the environment, not modified by us.
+#
+# LIBS: inherited from the environment; we add libraries required by
+# libpcap.  Librares that the core libpcap code requires are added
+# first; libraries required by additional pcap modules are first
+# added to ADDITIONAL_LIBS, and only added to LIBS at the end, after
+# we're finished doing configuration tests for the modules.
+#
+# LIBS_STATIC: libraries with which a program using the libpcap *static*
+# library needs to be linked.  This is a superset of LIBS, used in
+# pcap-config, so that "pcap-config --libs --static" will report them.
+# Initialized to LIBS.
+#
+# REQUIRES_PRIVATE: pkg-config package names for additional libraries
+# with which a program using the libpcap *static* library needs to be
+# linked and for which a .pc file exists.  This is used in libpcap.pc,
+# so that "pkg-config --libs --static" will report them, and so that
+# those libraries will be determined using the library's .pc file, not
+# from our .pc file.  Initialized to an empty string.
+#
+# V_CCOPT: additional compiler flags other than -I and -D flags
+# needed when compiling libpcap.  Used in Makefile for both C and
+# C++ source.
+#
+# V_DEFS: additional -D compiler flags needed when compiling
+# libpcap.  Used in Makefile for both C and C++ source.
+#
+# V_INCLS: additional -I compiler flags needed when compiling
+# libpcap.  Used in Makefile for both C and C++ source.
+#
+# ADDITIONAL_LIBS: additional libraries with which the libpcap dynamic
+# library needs to be linked.  Used in Makwfile; not used in pcap-config
+# or libpcap.pc, as, in all platforms on which we run, if a dynamic
+# library is linked with other dynamic libraries, a program using
+# that dynamic library doesn't have to link with those libraries -
+# they will be automatically loaded at run time.  Initialized to an
+# empty string.
+#
+# ADDITIONAL_LIBS_STATIC: additional libraries with which a program
+# using the libpcap *static* library needs to be linked.  This is used
+# in pcap-config, so that "pcap-config --libs --static" will report
+# them.  Initialized to an empty string.
+#
+# REQUIRES_PRIVATE: pkg-config package names for additional libraries
+# with which a program using the libpcap *static* library needs to be
+# linked and for which a .pc file exists.  This is used in libpcap.pc,
+# so that "pkg-config --libs --static" will report them, and so that
+# those libraries will be determined using the library's .pc file, not
+# from our .pc file.  Initialized to an empty string.
+#
+# LIBS_PRIVATE: pkg-config package names for additional libraries with
+# which a program using the libpcap *static* library needs to be linked
+# and for which a .pc file does not exist.  This is used in libpcap.pc,
+# so that "pkg-config --libs --static" will report them (those libraries
+# cannot be determined using the library's .pc file, as there is no such
+# file, so it has to come from our .pc file.  Initialized to an empty
+# string.
+#
+LIBS_STATIC=""
+REQUIRES_PRIVATE=""
+LIBS_PRIVATE=""
+
+
+
+
+
+
+
+
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
   if test -f "$ac_dir/install-sh"; then
@@ -3582,1271 +4124,11 @@
 if test "$ac_cv_prog_cc_c99" = "no"; then
 	as_fn_error $? "The C compiler does not support C99" "$LINENO" 5
 fi
-case "$host_os" in
-haiku*)
-	#
-	# Haiku's platform file is in C++.
-	#
-	ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-if test -z "$CXX"; then
-  if test -n "$CCC"; then
-    CXX=$CCC
-  else
-    if test -n "$ac_tool_prefix"; then
-  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CXX"; then
-  ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CXX=$ac_cv_prog_CXX
-if test -n "$CXX"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
-$as_echo "$CXX" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    test -n "$CXX" && break
-  done
-fi
-if test -z "$CXX"; then
-  ac_ct_CXX=$CXX
-  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CXX"; then
-  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CXX="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
-if test -n "$ac_ct_CXX"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
-$as_echo "$ac_ct_CXX" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_CXX" && break
-done
-
-  if test "x$ac_ct_CXX" = x; then
-    CXX="g++"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CXX=$ac_ct_CXX
-  fi
-fi
-
-  fi
-fi
-# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
-  { { ac_try="$ac_compiler $ac_option >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    sed '10a\
-... rest of stderr output deleted ...
-         10q' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-  fi
-  rm -f conftest.er1 conftest.err
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
-$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
-if ${ac_cv_cxx_compiler_gnu+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_compiler_gnu=yes
-else
-  ac_compiler_gnu=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
-$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
-  GXX=yes
-else
-  GXX=
-fi
-ac_test_CXXFLAGS=${CXXFLAGS+set}
-ac_save_CXXFLAGS=$CXXFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
-$as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if ${ac_cv_prog_cxx_g+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
-   ac_cxx_werror_flag=yes
-   ac_cv_prog_cxx_g=no
-   CXXFLAGS="-g"
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_cv_prog_cxx_g=yes
-else
-  CXXFLAGS=""
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-else
-  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-	 CXXFLAGS="-g"
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_cv_prog_cxx_g=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
-$as_echo "$ac_cv_prog_cxx_g" >&6; }
-if test "$ac_test_CXXFLAGS" = set; then
-  CXXFLAGS=$ac_save_CXXFLAGS
-elif test $ac_cv_prog_cxx_g = yes; then
-  if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
-  else
-    CXXFLAGS="-g"
-  fi
-else
-  if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
-  else
-    CXXFLAGS=
-  fi
-fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-	;;
-esac
-
-
-
-
-
-
-    if test "$GCC" = yes ; then
-	    #
-	    # -Werror forces warnings to be errors.
-	    #
-	    ac_lbl_cc_force_warning_errors=-Werror
-
-	    #
-	    # Try to have the compiler default to hiding symbols,
-	    # so that only symbols explicitly exported with
-	    # PCAP_API will be visible outside (shared) libraries.
-	    #
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -fvisibility=hidden option" >&5
-$as_echo_n "checking whether the compiler supports the -fvisibility=hidden option... " >&6; }
-	save_CFLAGS="$CFLAGS"
-	if expr "x-fvisibility=hidden" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -fvisibility=hidden"
-	elif expr "x-fvisibility=hidden" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
-	elif expr "x-fvisibility=hidden" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
-	else
-	    CFLAGS="$CFLAGS -fvisibility=hidden"
-	fi
-	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-		can_add_to_cflags=yes
-		#
-		# The compile supports this; do we have some C code for
-		# which the warning should *not* appear?
-		# We test the fourth argument because the third argument
-		# could contain quotes, breaking the test.
-		#
-		if test "x" != "x"
-		then
-		    CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
-		    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fvisibility=hidden " >&5
-$as_echo_n "checking whether -fvisibility=hidden ... " >&6; }
-		    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-			#
-			# Not a problem.
-			#
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-else
-
-			#
-			# A problem.
-			#
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-			can_add_to_cflags=no
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-		fi
-		CFLAGS="$save_CFLAGS"
-		if test x"$can_add_to_cflags" = "xyes"
-		then
-		    V_CCOPT="$V_CCOPT -fvisibility=hidden"
-		fi
-
-else
-
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-		CFLAGS="$save_CFLAGS"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-    else
-	    V_INCLS="$V_INCLS -I/usr/local/include"
-	    LDFLAGS="$LDFLAGS -L/usr/local/lib"
-
-	    case "$host_os" in
-
-	    darwin*)
-		    #
-		    # This is assumed either to be GCC or clang, both
-		    # of which use -Werror to force warnings to be errors.
-		    #
-		    ac_lbl_cc_force_warning_errors=-Werror
-
-		    #
-		    # Try to have the compiler default to hiding symbols,
-		    # so that only symbols explicitly exported with
-		    # PCAP_API will be visible outside (shared) libraries.
-		    #
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -fvisibility=hidden option" >&5
-$as_echo_n "checking whether the compiler supports the -fvisibility=hidden option... " >&6; }
-	save_CFLAGS="$CFLAGS"
-	if expr "x-fvisibility=hidden" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -fvisibility=hidden"
-	elif expr "x-fvisibility=hidden" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
-	elif expr "x-fvisibility=hidden" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
-	else
-	    CFLAGS="$CFLAGS -fvisibility=hidden"
-	fi
-	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-		can_add_to_cflags=yes
-		#
-		# The compile supports this; do we have some C code for
-		# which the warning should *not* appear?
-		# We test the fourth argument because the third argument
-		# could contain quotes, breaking the test.
-		#
-		if test "x" != "x"
-		then
-		    CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
-		    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fvisibility=hidden " >&5
-$as_echo_n "checking whether -fvisibility=hidden ... " >&6; }
-		    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-			#
-			# Not a problem.
-			#
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-else
-
-			#
-			# A problem.
-			#
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-			can_add_to_cflags=no
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-		fi
-		CFLAGS="$save_CFLAGS"
-		if test x"$can_add_to_cflags" = "xyes"
-		then
-		    V_CCOPT="$V_CCOPT -fvisibility=hidden"
-		fi
-
-else
-
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-		CFLAGS="$save_CFLAGS"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-		    ;;
-
-	    hpux*)
-		    #
-		    # HP C, which is what we presume we're using, doesn't
-		    # exit with a non-zero exit status if we hand it an
-		    # invalid -W flag, can't be forced to do so even with
-		    # +We, and doesn't handle GCC-style -W flags, so we
-		    # don't want to try using GCC-style -W flags.
-		    #
-		    ac_lbl_cc_dont_try_gcc_dashW=yes
-		    ;;
-
-	    irix*)
-		    #
-		    # MIPS C, which is what we presume we're using, doesn't
-		    # necessarily exit with a non-zero exit status if we
-		    # hand it an invalid -W flag, can't be forced to do
-		    # so, and doesn't handle GCC-style -W flags, so we
-		    # don't want to try using GCC-style -W flags.
-		    #
-		    ac_lbl_cc_dont_try_gcc_dashW=yes
-		    #
-		    # It also, apparently, defaults to "char" being
-		    # unsigned, unlike most other C implementations;
-		    # I suppose we could say "signed char" whenever
-		    # we want to guarantee a signed "char", but let's
-		    # just force signed chars.
-		    #
-		    # -xansi is normally the default, but the
-		    # configure script was setting it; perhaps -cckr
-		    # was the default in the Old Days.  (Then again,
-		    # that would probably be for backwards compatibility
-		    # in the days when ANSI C was Shiny and New, i.e.
-		    # 1989 and the early '90's, so maybe we can just
-		    # drop support for those compilers.)
-		    #
-		    # -g is equivalent to -g2, which turns off
-		    # optimization; we choose -g3, which generates
-		    # debugging information but doesn't turn off
-		    # optimization (even if the optimization would
-		    # cause inaccuracies in debugging).
-		    #
-		    V_CCOPT="$V_CCOPT -xansi -signed -g3"
-		    ;;
-
-	    osf*)
-		    #
-		    # Presumed to be DEC OSF/1, Digital UNIX, or
-		    # Tru64 UNIX.
-		    #
-		    # The DEC C compiler, which is what we presume we're
-		    # using, doesn't exit with a non-zero exit status if we
-		    # hand it an invalid -W flag, can't be forced to do
-		    # so, and doesn't handle GCC-style -W flags, so we
-		    # don't want to try using GCC-style -W flags.
-		    #
-		    ac_lbl_cc_dont_try_gcc_dashW=yes
-		    #
-		    # -g is equivalent to -g2, which turns off
-		    # optimization; we choose -g3, which generates
-		    # debugging information but doesn't turn off
-		    # optimization (even if the optimization would
-		    # cause inaccuracies in debugging).
-		    #
-		    V_CCOPT="$V_CCOPT -g3"
-		    ;;
-
-	    solaris*)
-		    #
-		    # Assumed to be Sun C, which requires -errwarn to force
-		    # warnings to be treated as errors.
-		    #
-		    ac_lbl_cc_force_warning_errors=-errwarn
-
-		    #
-		    # Try to have the compiler default to hiding symbols,
-		    # so that only symbols explicitly exported with
-		    # PCAP_API will be visible outside (shared) libraries.
-		    #
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -xldscope=hidden option" >&5
-$as_echo_n "checking whether the compiler supports the -xldscope=hidden option... " >&6; }
-	save_CFLAGS="$CFLAGS"
-	if expr "x-xldscope=hidden" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -xldscope=hidden"
-	elif expr "x-xldscope=hidden" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -xldscope=hidden"
-	elif expr "x-xldscope=hidden" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -xldscope=hidden"
-	else
-	    CFLAGS="$CFLAGS -xldscope=hidden"
-	fi
-	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-		can_add_to_cflags=yes
-		#
-		# The compile supports this; do we have some C code for
-		# which the warning should *not* appear?
-		# We test the fourth argument because the third argument
-		# could contain quotes, breaking the test.
-		#
-		if test "x" != "x"
-		then
-		    CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
-		    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -xldscope=hidden " >&5
-$as_echo_n "checking whether -xldscope=hidden ... " >&6; }
-		    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-			#
-			# Not a problem.
-			#
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-else
-
-			#
-			# A problem.
-			#
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-			can_add_to_cflags=no
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-		fi
-		CFLAGS="$save_CFLAGS"
-		if test x"$can_add_to_cflags" = "xyes"
-		then
-		    V_CCOPT="$V_CCOPT -xldscope=hidden"
-		fi
-
-else
-
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-		CFLAGS="$save_CFLAGS"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-		    ;;
-
-	    ultrix*)
-		    { $as_echo "$as_me:${as_lineno-$LINENO}: checking that Ultrix $CC hacks const in prototypes" >&5
-$as_echo_n "checking that Ultrix $CC hacks const in prototypes... " >&6; }
-		    if ${ac_cv_lbl_cc_const_proto+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-int
-main ()
-{
-struct a { int b; };
-			    void c(const struct a *)
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_lbl_cc_const_proto=yes
-else
-  ac_cv_lbl_cc_const_proto=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-		    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lbl_cc_const_proto" >&5
-$as_echo "$ac_cv_lbl_cc_const_proto" >&6; }
-		    if test $ac_cv_lbl_cc_const_proto = no ; then
-
-$as_echo "#define const /**/" >>confdefs.h
-
-		    fi
-		    ;;
-	    esac
-	    V_CCOPT="$V_CCOPT -O"
-    fi
-
-
-    if test "$GCC" = yes ; then
-	    #
-	    # On platforms where we build a shared library:
-	    #
-	    #	add options to generate position-independent code,
-	    #	if necessary (it's the default in AIX and Darwin/macOS);
-	    #
-	    #	define option to set the soname of the shared library,
-	    #	if the OS supports that;
-	    #
-	    #	add options to specify, at link time, a directory to
-	    #	add to the run-time search path, if that's necessary.
-	    #
-	    V_SHLIB_CMD="\$(CC)"
-	    V_SHLIB_OPT="-shared"
-	    case "$host_os" in
-
-	    aix*)
-		    ;;
-
-	    freebsd*|netbsd*|openbsd*|dragonfly*|linux*|osf*|haiku*|midipix*)
-		    #
-		    # Platforms where the linker is the GNU linker
-		    # or accepts command-line arguments like
-		    # those the GNU linker accepts.
-		    #
-		    # Some instruction sets require -fPIC on some
-		    # operating systems.  Check for them.  If you
-		    # have a combination that requires it, add it
-		    # here.
-		    #
-		    PIC_OPT=-fpic
-		    case "$host_cpu" in
-
-		    sparc64*)
-			case "$host_os" in
-
-			freebsd*|openbsd*|linux*)
-			    PIC_OPT=-fPIC
-			    ;;
-			esac
-			;;
-		    esac
-		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT $PIC_OPT"
-		    V_SONAME_OPT="-Wl,-soname,"
-		    V_RPATH_OPT="-Wl,-rpath,"
-		    ;;
-
-	    hpux*)
-		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
-		    #
-		    # XXX - this assumes GCC is using the HP linker,
-		    # rather than the GNU linker, and that the "+h"
-		    # option is used on all HP-UX platforms, both .sl
-		    # and .so.
-		    #
-		    V_SONAME_OPT="-Wl,+h,"
-		    #
-		    # By default, directories specified with -L
-		    # are added to the run-time search path, so
-		    # we don't add them in pcap-config.
-		    #
-		    ;;
-
-	    solaris*)
-		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
-		    #
-		    # XXX - this assumes GCC is using the Sun linker,
-		    # rather than the GNU linker.
-		    #
-		    V_SONAME_OPT="-Wl,-h,"
-		    V_RPATH_OPT="-Wl,-R,"
-		    ;;
-	    esac
-    else
-	    #
-	    # Set the appropriate compiler flags and, on platforms
-	    # where we build a shared library:
-	    #
-	    #	add options to generate position-independent code,
-	    #	if necessary (it's the default in Darwin/macOS);
-	    #
-	    #	if we generate ".so" shared libraries, define the
-	    #	appropriate options for building the shared library;
-	    #
-	    #	add options to specify, at link time, a directory to
-	    #	add to the run-time search path, if that's necessary.
-	    #
-	    # Note: spaces after V_SONAME_OPT are significant; on
-	    # some platforms the soname is passed with a GCC-like
-	    # "-Wl,-soname,{soname}" option, with the soname part
-	    # of the option, while on other platforms the C compiler
-	    # driver takes it as a regular option with the soname
-	    # following the option.  The same applies to V_RPATH_OPT.
-	    #
-	    case "$host_os" in
-
-	    aix*)
-		    V_SHLIB_CMD="\$(CC)"
-		    V_SHLIB_OPT="-G -bnoentry -bexpall"
-		    ;;
-
-	    freebsd*|netbsd*|openbsd*|dragonfly*|linux*)
-		    #
-		    # "cc" is GCC.
-		    #
-		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
-		    V_SHLIB_CMD="\$(CC)"
-		    V_SHLIB_OPT="-shared"
-		    V_SONAME_OPT="-Wl,-soname,"
-		    V_RPATH_OPT="-Wl,-rpath,"
-		    ;;
-
-	    hpux*)
-		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT +z"
-		    V_SHLIB_CMD="\$(LD)"
-		    V_SHLIB_OPT="-b"
-		    V_SONAME_OPT="+h "
-		    #
-		    # By default, directories specified with -L
-		    # are added to the run-time search path, so
-		    # we don't add them in pcap-config.
-		    #
-		    ;;
-
-	    osf*)
-		    #
-		    # Presumed to be DEC OSF/1, Digital UNIX, or
-		    # Tru64 UNIX.
-		    #
-		    V_SHLIB_CMD="\$(CC)"
-		    V_SHLIB_OPT="-shared"
-		    V_SONAME_OPT="-soname "
-		    V_RPATH_OPT="-rpath "
-		    ;;
-
-	    solaris*)
-		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -Kpic"
-		    V_SHLIB_CMD="\$(CC)"
-		    V_SHLIB_OPT="-G"
-		    V_SONAME_OPT="-h "
-		    V_RPATH_OPT="-R"
-		    ;;
-	    esac
-    fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
-$as_echo_n "checking for inline... " >&6; }
-    save_CFLAGS="$CFLAGS"
-    CFLAGS="$V_CCOPT"
-    if ${ac_cv_lbl_inline+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-	ac_cv_lbl_inline=""
-	ac_lbl_cc_inline=no
-	for ac_lbl_inline in inline __inline__ __inline
-	do
-	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define inline $ac_lbl_inline
-		static inline struct iltest *foo(void);
-		struct iltest {
-		    int iltest1;
-		    int iltest2;
-		};
-
-		static inline struct iltest *
-		foo()
-		{
-		    static struct iltest xxx;
-
-		    return &xxx;
-		}
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_lbl_cc_inline=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-	    if test "$ac_lbl_cc_inline" = yes ; then
-		break;
-	    fi
-	done
-	if test "$ac_lbl_cc_inline" = yes ; then
-	    ac_cv_lbl_inline=$ac_lbl_inline
-	fi
-fi
-
-    CFLAGS="$save_CFLAGS"
-    if test ! -z "$ac_cv_lbl_inline" ; then
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lbl_inline" >&5
-$as_echo "$ac_cv_lbl_inline" >&6; }
-    else
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-    fi
-
-cat >>confdefs.h <<_ACEOF
-#define inline $ac_cv_lbl_inline
-_ACEOF
-
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load_n" >&5
-$as_echo_n "checking for __atomic_load_n... " >&6; }
-	if ${ac_cv_have___atomic_load_n+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_link
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-		    int i = 17;
-		    int j;
-		    j = __atomic_load_n(&i, __ATOMIC_RELAXED);
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_have___atomic_load_n=yes
-else
-  ac_have___atomic_load_n=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_have___atomic_load_n" >&5
-$as_echo "$ac_have___atomic_load_n" >&6; }
-	if test $ac_have___atomic_load_n = yes ; then
-
-$as_echo "#define HAVE___ATOMIC_LOAD_N 1" >>confdefs.h
-
-	fi
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_store_n" >&5
-$as_echo_n "checking for __atomic_store_n... " >&6; }
-	if ${ac_cv_have___atomic_store_n+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-		    int i;
-		    __atomic_store_n(&i, 17, __ATOMIC_RELAXED);
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_have___atomic_store_n=yes
-else
-  ac_have___atomic_store_n=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_have___atomic_store_n" >&5
-$as_echo "$ac_have___atomic_store_n" >&6; }
-	if test $ac_have___atomic_store_n = yes ; then
-
-$as_echo "#define HAVE___ATOMIC_STORE_N 1" >>confdefs.h
-
-	fi
 
 #
-# Try to arrange for large file support.
+# Get the size of a void *, to determine whether this is a 32-bit
+# or 64-bit build.
 #
-# Check whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then :
-  enableval=$enable_largefile;
-fi
-
-if test "$enable_largefile" != no; then
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
-$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if ${ac_cv_sys_largefile_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_sys_largefile_CC=no
-     if test "$GCC" != yes; then
-       ac_save_CC=$CC
-       while :; do
-	 # IRIX 6.2 and later do not support large files by default,
-	 # so use the C compiler's -n32 option if that helps.
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-	 if ac_fn_c_try_compile "$LINENO"; then :
-  break
-fi
-rm -f core conftest.err conftest.$ac_objext
-	 CC="$CC -n32"
-	 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_largefile_CC=' -n32'; break
-fi
-rm -f core conftest.err conftest.$ac_objext
-	 break
-       done
-       CC=$ac_save_CC
-       rm -f conftest.$ac_ext
-    fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
-$as_echo "$ac_cv_sys_largefile_CC" >&6; }
-  if test "$ac_cv_sys_largefile_CC" != no; then
-    CC=$CC$ac_cv_sys_largefile_CC
-  fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if ${ac_cv_sys_file_offset_bits+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_file_offset_bits=no; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _FILE_OFFSET_BITS 64
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_file_offset_bits=64; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_file_offset_bits=unknown
-  break
-done
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
-$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
-case $ac_cv_sys_file_offset_bits in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
-_ACEOF
-;;
-esac
-rm -rf conftest*
-  if test $ac_cv_sys_file_offset_bits = unknown; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
-$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if ${ac_cv_sys_large_files+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_large_files=no; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _LARGE_FILES 1
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_large_files=1; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_large_files=unknown
-  break
-done
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
-$as_echo "$ac_cv_sys_large_files" >&6; }
-case $ac_cv_sys_large_files in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGE_FILES $ac_cv_sys_large_files
-_ACEOF
-;;
-esac
-rm -rf conftest*
-  fi
-
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
-$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
-if ${ac_cv_sys_largefile_source+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
-int
-main ()
-{
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_sys_largefile_source=no; break
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _LARGEFILE_SOURCE 1
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
-int
-main ()
-{
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_sys_largefile_source=1; break
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  ac_cv_sys_largefile_source=unknown
-  break
-done
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
-$as_echo "$ac_cv_sys_largefile_source" >&6; }
-case $ac_cv_sys_largefile_source in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
-_ACEOF
-;;
-esac
-rm -rf conftest*
-
-# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
-# in glibc 2.1.3, but that breaks too many other things.
-# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
-if test $ac_cv_sys_largefile_source != unknown; then
-
-$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
-
-fi
-
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -5245,6 +4527,1411 @@
 done
 
 
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
+$as_echo_n "checking size of void *... " >&6; }
+if ${ac_cv_sizeof_void_p+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_void_p" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (void *)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_void_p=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
+$as_echo "$ac_cv_sizeof_void_p" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+_ACEOF
+
+
+ac_lbl_c_sizeof_void_p="$ac_cv_sizeof_void_p"
+
+#
+# We only need a C++ compiler for Haiku; all code except for its
+# pcap module is in C.
+#
+case "$host_os" in
+haiku*)
+	ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if ${ac_cv_prog_cxx_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+	#
+	# Make sure C and C++ have the same pointer sizes with the flags
+	# they're given; if they don't, it means that the compilers for the
+	# languages will, with those flags, not produce code that can be
+	# linked together.
+	#
+	# We have to use different data types, because the results of
+	# a test are cached, so if we test for the size of a given type
+	# in C, the subsequent test in C++ will use the cached variable.
+	# We trick autoconf by testing the size of a "void *" in C and a
+	# "const void *" in C++.
+	#
+	ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of const void *" >&5
+$as_echo_n "checking size of const void *... " >&6; }
+if ${ac_cv_sizeof_const_void_p+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (const void *))" "ac_cv_sizeof_const_void_p"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_const_void_p" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (const void *)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_const_void_p=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_const_void_p" >&5
+$as_echo "$ac_cv_sizeof_const_void_p" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_CONST_VOID_P $ac_cv_sizeof_const_void_p
+_ACEOF
+
+
+	ac_lbl_cxx_sizeof_void_p="$ac_cv_sizeof_const_void_p"
+	ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+	if test "$ac_lbl_cxx_sizeof_void_p" -eq 0; then
+		as_fn_error $? "No C++ compiler was found" "$LINENO" 5
+	fi
+	if test "$ac_lbl_c_sizeof_void_p" -ne "$ac_lbl_cxx_sizeof_void_p"; then
+		as_fn_error $? "C compiler $CC produces code with $ac_lbl_c_sizeof_void_p-byte pointers
+while C++ compiler $CXX produces code with $ac_lbl_cxx_sizeof_void_p-byte pointers.  This prevents
+code in those languages from being combined." "$LINENO" 5
+	fi
+	;;
+esac
+
+
+
+
+
+    if test "$GCC" = yes ; then
+	    #
+	    # -Werror forces warnings to be errors.
+	    #
+	    ac_lbl_cc_force_warning_errors=-Werror
+
+	    #
+	    # Try to have the compiler default to hiding symbols,
+	    # so that only symbols explicitly exported with
+	    # PCAP_API will be visible outside (shared) libraries.
+	    #
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -fvisibility=hidden option" >&5
+$as_echo_n "checking whether the compiler supports the -fvisibility=hidden option... " >&6; }
+	save_CFLAGS="$CFLAGS"
+	CFLAGS="$CFLAGS -fvisibility=hidden"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int main(void) { return 0; }
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+		can_add_to_cflags=yes
+		#
+		# The compile supports this; do we have some C code for
+		# which the warning should *not* appear?
+		# We test the fourth argument because the third argument
+		# could contain quotes, breaking the test.
+		#
+		if test "x" != "x"
+		then
+		    CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fvisibility=hidden " >&5
+$as_echo_n "checking whether -fvisibility=hidden ... " >&6; }
+		    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+			#
+			# Not a problem.
+			#
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+else
+
+			#
+			# A problem.
+			#
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+			can_add_to_cflags=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+		fi
+		CFLAGS="$save_CFLAGS"
+		if test x"$can_add_to_cflags" = "xyes"
+		then
+		    V_CCOPT="$V_CCOPT -fvisibility=hidden"
+		fi
+
+else
+
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+		CFLAGS="$save_CFLAGS"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
+
+    else
+	    V_INCLS="$V_INCLS -I/usr/local/include"
+	    LDFLAGS="$LDFLAGS -L/usr/local/lib"
+
+	    case "$host_os" in
+
+	    darwin*)
+		    #
+		    # This is assumed either to be GCC or clang, both
+		    # of which use -Werror to force warnings to be errors.
+		    #
+		    ac_lbl_cc_force_warning_errors=-Werror
+
+		    #
+		    # Try to have the compiler default to hiding symbols,
+		    # so that only symbols explicitly exported with
+		    # PCAP_API will be visible outside (shared) libraries.
+		    #
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -fvisibility=hidden option" >&5
+$as_echo_n "checking whether the compiler supports the -fvisibility=hidden option... " >&6; }
+	save_CFLAGS="$CFLAGS"
+	CFLAGS="$CFLAGS -fvisibility=hidden"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int main(void) { return 0; }
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+		can_add_to_cflags=yes
+		#
+		# The compile supports this; do we have some C code for
+		# which the warning should *not* appear?
+		# We test the fourth argument because the third argument
+		# could contain quotes, breaking the test.
+		#
+		if test "x" != "x"
+		then
+		    CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fvisibility=hidden " >&5
+$as_echo_n "checking whether -fvisibility=hidden ... " >&6; }
+		    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+			#
+			# Not a problem.
+			#
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+else
+
+			#
+			# A problem.
+			#
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+			can_add_to_cflags=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+		fi
+		CFLAGS="$save_CFLAGS"
+		if test x"$can_add_to_cflags" = "xyes"
+		then
+		    V_CCOPT="$V_CCOPT -fvisibility=hidden"
+		fi
+
+else
+
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+		CFLAGS="$save_CFLAGS"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
+
+		    ;;
+
+	    hpux*)
+		    #
+		    # HP C, which is what we presume we're using, doesn't
+		    # exit with a non-zero exit status if we hand it an
+		    # invalid -W flag, can't be forced to do so even with
+		    # +We, and doesn't handle GCC-style -W flags, so we
+		    # don't want to try using GCC-style -W flags.
+		    #
+		    ac_lbl_cc_dont_try_gcc_dashW=yes
+		    ;;
+
+	    irix*)
+		    #
+		    # MIPS C, which is what we presume we're using, doesn't
+		    # necessarily exit with a non-zero exit status if we
+		    # hand it an invalid -W flag, can't be forced to do
+		    # so, and doesn't handle GCC-style -W flags, so we
+		    # don't want to try using GCC-style -W flags.
+		    #
+		    ac_lbl_cc_dont_try_gcc_dashW=yes
+		    #
+		    # It also, apparently, defaults to "char" being
+		    # unsigned, unlike most other C implementations;
+		    # I suppose we could say "signed char" whenever
+		    # we want to guarantee a signed "char", but let's
+		    # just force signed chars.
+		    #
+		    # -xansi is normally the default, but the
+		    # configure script was setting it; perhaps -cckr
+		    # was the default in the Old Days.  (Then again,
+		    # that would probably be for backwards compatibility
+		    # in the days when ANSI C was Shiny and New, i.e.
+		    # 1989 and the early '90's, so maybe we can just
+		    # drop support for those compilers.)
+		    #
+		    # -g is equivalent to -g2, which turns off
+		    # optimization; we choose -g3, which generates
+		    # debugging information but doesn't turn off
+		    # optimization (even if the optimization would
+		    # cause inaccuracies in debugging).
+		    #
+		    V_CCOPT="$V_CCOPT -xansi -signed -g3"
+		    ;;
+
+	    osf*)
+		    #
+		    # Presumed to be DEC OSF/1, Digital UNIX, or
+		    # Tru64 UNIX.
+		    #
+		    # The DEC C compiler, which is what we presume we're
+		    # using, doesn't exit with a non-zero exit status if we
+		    # hand it an invalid -W flag, can't be forced to do
+		    # so, and doesn't handle GCC-style -W flags, so we
+		    # don't want to try using GCC-style -W flags.
+		    #
+		    ac_lbl_cc_dont_try_gcc_dashW=yes
+		    #
+		    # -g is equivalent to -g2, which turns off
+		    # optimization; we choose -g3, which generates
+		    # debugging information but doesn't turn off
+		    # optimization (even if the optimization would
+		    # cause inaccuracies in debugging).
+		    #
+		    V_CCOPT="$V_CCOPT -g3"
+		    ;;
+
+	    solaris*)
+		    #
+		    # Assumed to be Sun C, which requires -errwarn to force
+		    # warnings to be treated as errors.
+		    #
+		    ac_lbl_cc_force_warning_errors=-errwarn
+
+		    #
+		    # Try to have the compiler default to hiding symbols,
+		    # so that only symbols explicitly exported with
+		    # PCAP_API will be visible outside (shared) libraries.
+		    #
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -xldscope=hidden option" >&5
+$as_echo_n "checking whether the compiler supports the -xldscope=hidden option... " >&6; }
+	save_CFLAGS="$CFLAGS"
+	CFLAGS="$CFLAGS -xldscope=hidden"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int main(void) { return 0; }
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+		can_add_to_cflags=yes
+		#
+		# The compile supports this; do we have some C code for
+		# which the warning should *not* appear?
+		# We test the fourth argument because the third argument
+		# could contain quotes, breaking the test.
+		#
+		if test "x" != "x"
+		then
+		    CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -xldscope=hidden " >&5
+$as_echo_n "checking whether -xldscope=hidden ... " >&6; }
+		    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+			#
+			# Not a problem.
+			#
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+else
+
+			#
+			# A problem.
+			#
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+			can_add_to_cflags=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+		fi
+		CFLAGS="$save_CFLAGS"
+		if test x"$can_add_to_cflags" = "xyes"
+		then
+		    V_CCOPT="$V_CCOPT -xldscope=hidden"
+		fi
+
+else
+
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+		CFLAGS="$save_CFLAGS"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
+
+		    ;;
+
+	    ultrix*)
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: checking that Ultrix $CC hacks const in prototypes" >&5
+$as_echo_n "checking that Ultrix $CC hacks const in prototypes... " >&6; }
+		    if ${ac_cv_lbl_cc_const_proto+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+int
+main ()
+{
+struct a { int b; };
+			    void c(const struct a *)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_lbl_cc_const_proto=yes
+else
+  ac_cv_lbl_cc_const_proto=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lbl_cc_const_proto" >&5
+$as_echo "$ac_cv_lbl_cc_const_proto" >&6; }
+		    if test $ac_cv_lbl_cc_const_proto = no ; then
+
+$as_echo "#define const /**/" >>confdefs.h
+
+		    fi
+		    ;;
+	    esac
+	    V_CCOPT="$V_CCOPT -O"
+    fi
+
+
+    if test "$GCC" = yes ; then
+	    #
+	    # On platforms where we build a shared library:
+	    #
+	    #	add options to generate position-independent code,
+	    #	if necessary (it's the default in AIX and Darwin/macOS);
+	    #
+	    #	define option to set the soname of the shared library,
+	    #	if the OS supports that;
+	    #
+	    #	add options to specify, at link time, a directory to
+	    #	add to the run-time search path, if that's necessary.
+	    #
+	    V_SHLIB_CMD="\$(CC)"
+	    V_SHLIB_OPT="-shared"
+	    case "$host_os" in
+
+	    aix*)
+		    ;;
+
+	    freebsd*|netbsd*|openbsd*|dragonfly*|linux*|osf*|haiku*|midipix*)
+		    #
+		    # Platforms where the C compiler is GCC or accepts
+		    # compatible command-line arguments, and the linker
+		    # is the GNU linker or accepts compatible command-line
+		    # arguments.
+		    #
+		    # Some instruction sets require -fPIC on some
+		    # operating systems.  Check for them.  If you
+		    # have a combination that requires it, add it
+		    # here.
+		    #
+		    PIC_OPT=-fpic
+		    case "$host_cpu" in
+
+		    sparc64*)
+			case "$host_os" in
+
+			freebsd*|openbsd*|linux*)
+			    PIC_OPT=-fPIC
+			    ;;
+			esac
+			;;
+		    esac
+		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT $PIC_OPT"
+		    V_SONAME_OPT="-Wl,-soname,"
+		    ;;
+
+	    hpux*)
+		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
+		    #
+		    # XXX - this assumes GCC is using the HP linker,
+		    # rather than the GNU linker, and that the "+h"
+		    # option is used on all HP-UX platforms, both .sl
+		    # and .so.
+		    #
+		    V_SONAME_OPT="-Wl,+h,"
+		    #
+		    # By default, directories specified with -L
+		    # are added to the run-time search path, so
+		    # we don't add them in pcap-config.
+		    #
+		    ;;
+
+	    solaris*)
+		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
+		    #
+		    # Sun/Oracle's C compiler, GCC, and GCC-compatible
+		    # compilers support -Wl,{comma-separated list of options},
+		    # and we use the C compiler, not ld, for all linking,
+		    # including linking to produce a shared library.
+		    #
+		    V_SONAME_OPT="-Wl,-h,"
+		    ;;
+	    esac
+    else
+	    #
+	    # Set the appropriate compiler flags and, on platforms
+	    # where we build a shared library:
+	    #
+	    #	add options to generate position-independent code,
+	    #	if necessary (it's the default in Darwin/macOS);
+	    #
+	    #	if we generate ".so" shared libraries, define the
+	    #	appropriate options for building the shared library;
+	    #
+	    #	add options to specify, at link time, a directory to
+	    #	add to the run-time search path, if that's necessary.
+	    #
+	    # Note: spaces after V_SONAME_OPT are significant; on
+	    # some platforms the soname is passed with a GCC-like
+	    # "-Wl,-soname,{soname}" option, with the soname part
+	    # of the option, while on other platforms the C compiler
+	    # driver takes it as a regular option with the soname
+	    # following the option.
+	    #
+	    case "$host_os" in
+
+	    aix*)
+		    V_SHLIB_CMD="\$(CC)"
+		    V_SHLIB_OPT="-G -bnoentry -bexpall"
+		    ;;
+
+	    freebsd*|netbsd*|openbsd*|dragonfly*|linux*)
+		    #
+		    # Platforms where the C compiler is GCC or accepts
+		    # compatible command-line arguments, and the linker
+		    # is the GNU linker or accepts compatible command-line
+		    # arguments.
+		    #
+		    # XXX - does 64-bit SPARC require -fPIC?
+		    #
+		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
+		    V_SHLIB_CMD="\$(CC)"
+		    V_SHLIB_OPT="-shared"
+		    V_SONAME_OPT="-Wl,-soname,"
+		    ;;
+
+	    hpux*)
+		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT +z"
+		    V_SHLIB_CMD="\$(LD)"
+		    V_SHLIB_OPT="-b"
+		    V_SONAME_OPT="+h "
+		    #
+		    # By default, directories specified with -L
+		    # are added to the run-time search path, so
+		    # we don't add them in pcap-config.
+		    #
+		    ;;
+
+	    osf*)
+		    #
+		    # Presumed to be DEC OSF/1, Digital UNIX, or
+		    # Tru64 UNIX.
+		    #
+		    V_SHLIB_CMD="\$(CC)"
+		    V_SHLIB_OPT="-shared"
+		    V_SONAME_OPT="-soname "
+		    ;;
+
+	    solaris*)
+		    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -Kpic"
+		    V_SHLIB_CMD="\$(CC)"
+		    V_SHLIB_OPT="-G"
+		    #
+		    # Sun/Oracle's C compiler, GCC, and GCC-compatible
+		    # compilers support -Wl,{comma-separated list of options},
+		    # and we use the C compiler, not ld, for all linking,
+		    # including linking to produce a shared library.
+		    #
+		    V_SONAME_OPT="-Wl,-h,"
+		    ;;
+	    esac
+    fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$V_CCOPT"
+    if ${ac_cv_lbl_inline+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+	ac_cv_lbl_inline=""
+	ac_lbl_cc_inline=no
+	for ac_lbl_inline in inline __inline__ __inline
+	do
+	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define inline $ac_lbl_inline
+		static inline struct iltest *foo(void);
+		struct iltest {
+		    int iltest1;
+		    int iltest2;
+		};
+
+		static inline struct iltest *
+		foo()
+		{
+		    static struct iltest xxx;
+
+		    return &xxx;
+		}
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lbl_cc_inline=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	    if test "$ac_lbl_cc_inline" = yes ; then
+		break;
+	    fi
+	done
+	if test "$ac_lbl_cc_inline" = yes ; then
+	    ac_cv_lbl_inline=$ac_lbl_inline
+	fi
+fi
+
+    CFLAGS="$save_CFLAGS"
+    if test ! -z "$ac_cv_lbl_inline" ; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lbl_inline" >&5
+$as_echo "$ac_cv_lbl_inline" >&6; }
+    else
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+
+cat >>confdefs.h <<_ACEOF
+#define inline $ac_cv_lbl_inline
+_ACEOF
+
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load_n" >&5
+$as_echo_n "checking for __atomic_load_n... " >&6; }
+	if ${ac_cv_have___atomic_load_n+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+		    int i = 17;
+		    int j;
+		    j = __atomic_load_n(&i, __ATOMIC_RELAXED);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_have___atomic_load_n=yes
+else
+  ac_have___atomic_load_n=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_have___atomic_load_n" >&5
+$as_echo "$ac_have___atomic_load_n" >&6; }
+	if test $ac_have___atomic_load_n = yes ; then
+
+$as_echo "#define HAVE___ATOMIC_LOAD_N 1" >>confdefs.h
+
+	fi
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_store_n" >&5
+$as_echo_n "checking for __atomic_store_n... " >&6; }
+	if ${ac_cv_have___atomic_store_n+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+		    int i;
+		    __atomic_store_n(&i, 17, __ATOMIC_RELAXED);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_have___atomic_store_n=yes
+else
+  ac_have___atomic_store_n=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_have___atomic_store_n" >&5
+$as_echo "$ac_have___atomic_store_n" >&6; }
+	if test $ac_have___atomic_store_n = yes ; then
+
+$as_echo "#define HAVE___ATOMIC_STORE_N 1" >>confdefs.h
+
+	fi
+
+#
+# Try to arrange for large file support.
+#
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+  enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+	 # IRIX 6.2 and later do not support large files by default,
+	 # so use the C compiler's -n32 option if that helps.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 CC="$CC -n32"
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if ${ac_cv_sys_file_offset_bits+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_file_offset_bits=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if ${ac_cv_sys_large_files+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_large_files=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  fi
+
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
+$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_source+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_sys_largefile_source=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _LARGEFILE_SOURCE 1
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_sys_largefile_source=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  ac_cv_sys_largefile_source=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
+$as_echo "$ac_cv_sys_largefile_source" >&6; }
+case $ac_cv_sys_largefile_source in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
+_ACEOF
+;;
+esac
+rm -rf conftest*
+
+# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
+# in glibc 2.1.3, but that breaks too many other things.
+# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
+if test $ac_cv_sys_largefile_source != unknown; then
+
+$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
+
+fi
+
+
 for ac_header in sys/ioccom.h sys/sockio.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -5270,55 +5957,11 @@
 
 done
 
-for ac_header in net/pfvar.h
-do :
-  ac_fn_c_check_header_compile "$LINENO" "net/pfvar.h" "ac_cv_header_net_pfvar_h" "#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-"
-if test "x$ac_cv_header_net_pfvar_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_NET_PFVAR_H 1
-_ACEOF
-
-fi
-
-done
-
-if test "$ac_cv_header_net_pfvar_h" = yes; then
-	#
-	# Check for various PF actions.
-	#
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether net/pfvar.h defines PF_NAT through PF_NORDR" >&5
-$as_echo_n "checking whether net/pfvar.h defines PF_NAT through PF_NORDR... " >&6; }
-	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-	    #include <sys/socket.h>
-	    #include <net/if.h>
-	    #include <net/pfvar.h>
-int
-main ()
-{
-return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-$as_echo "#define HAVE_PF_NAT_THROUGH_PF_NORDR 1" >>confdefs.h
 
 
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
 
 case "$host_os" in
 haiku*)
@@ -5326,6 +5969,54 @@
 	# Haiku needs _BSD_SOURCE for the _IO* macros because it doesn't use them.
 	#
 	CFLAGS="$CFLAGS -D_BSD_SOURCE"
+	#
+	# Haiku has getpass in libbsd.
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpass in -lbsd" >&5
+$as_echo_n "checking for getpass in -lbsd... " >&6; }
+if ${ac_cv_lib_bsd_getpass+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbsd  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char getpass ();
+int
+main ()
+{
+return getpass ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_bsd_getpass=yes
+else
+  ac_cv_lib_bsd_getpass=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_getpass" >&5
+$as_echo "$ac_cv_lib_bsd_getpass" >&6; }
+if test "x$ac_cv_lib_bsd_getpass" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBBSD 1
+_ACEOF
+
+  LIBS="-lbsd $LIBS"
+
+fi
+
 	;;
 esac
 
@@ -5375,6 +6066,11 @@
 	    fi
     fi
 
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
+
 for ac_func in strerror
 do :
   ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror"
@@ -5676,7 +6372,11 @@
 
 else
 
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -lnetwork" >&5
+	    #
+	    # Not found in libsocket; test for it in libnetwork, which
+	    # is where it is in Haiku.
+	    #
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -lnetwork" >&5
 $as_echo_n "checking for getaddrinfo in -lnetwork... " >&6; }
 if ${ac_cv_lib_network_getaddrinfo+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -5714,17 +6414,17 @@
 $as_echo "$ac_cv_lib_network_getaddrinfo" >&6; }
 if test "x$ac_cv_lib_network_getaddrinfo" = xyes; then :
 
-		    #
-		    # OK, we found it in libnetwork on Haiku.
-		    #
-		    LIBS="-lnetwork $LIBS"
+		#
+		# OK, we found it in libnetwork.
+		#
+		LIBS="-lnetwork $LIBS"
 
 else
 
-		    #
-		    # We didn't find it.
-		    #
-		    as_fn_error $? "getaddrinfo is required, but wasn't found" "$LINENO" 5
+		#
+		# We didn't find it.
+		#
+		as_fn_error $? "getaddrinfo is required, but wasn't found" "$LINENO" 5
 
 fi
 
@@ -6205,7 +6905,7 @@
 		# This test fails if we don't have <arpa/inet.h>
 		# (if we have ether_hostton(), we should have
 		# networking, and if we have networking, we should
-		# have <arapa/inet.h>) or if we do but it doesn't
+		# have <arpa/inet.h>) or if we do but it doesn't
 		# declare ether_hostton().
 		#
 		# Unset ac_cv_have_decl_ether_hostton so we don't
@@ -6684,8 +7384,8 @@
 		V_PCAP=null
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine packet capture interface" >&5
 $as_echo "$as_me: WARNING: cannot determine packet capture interface" >&2;}
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: (see the INSTALL doc for more info)" >&5
-$as_echo "$as_me: WARNING: (see the INSTALL doc for more info)" >&2;}
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: (see the INSTALL.md file for more info)" >&5
+$as_echo "$as_me: WARNING: (see the INSTALL.md file for more info)" >&2;}
 	fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking packet capture type" >&5
@@ -6697,24 +7397,35 @@
 #
 # Do we have pkg-config?
 #
-# Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_PKGCONFIG+:} false; then :
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$PKGCONFIG"; then
-  ac_cv_prog_PKGCONFIG="$PKGCONFIG" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_PKGCONFIG="pkg-config"
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6722,19 +7433,191 @@
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_prog_PKGCONFIG" && ac_cv_prog_PKGCONFIG="no"
+  ;;
+esac
 fi
-fi
-PKGCONFIG=$ac_cv_prog_PKGCONFIG
-if test -n "$PKGCONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5
-$as_echo "$PKGCONFIG" >&6; }
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=0.9.0
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+		PKG_CONFIG=""
+	fi
+fi
+
+#
+# Do we have the brew command from Homebrew?
+#
+# Extract the first word of "brew", so it can be a program name with args.
+set dummy brew; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BREW+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BREW in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BREW="$BREW" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BREW="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+BREW=$ac_cv_path_BREW
+if test -n "$BREW"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BREW" >&5
+$as_echo "$BREW" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+#
+# Solaris pkg-config is annoying.  For at least one package (D-Bus, I'm
+# looking at *you*!), there are separate include files for 32-bit and
+# 64-bit builds (I guess using "unsigned long long" as a 64-bit integer
+# type on a 64-bit build is like crossing the beams or soething), and
+# there are two separate .pc files, so if we're doing a 32-bit build we
+# should make sure we look in /usr/lib/pkgconfig for .pc files and if
+# we're doing a 64-bit build we should make sure we look in
+# /usr/lib/amd64/pkgconfig for .pc files.
+#
+case "$host_os" in
+
+solaris*)
+	if test "$ac_cv_sizeof_void_p" -eq 8; then
+		#
+		# 64-bit build.  If the path is empty, set it to
+                # /usr/lib/amd64/pkgconfig; otherwise, if
+                # /usr/lib/pkgconfig appears in the path, prepend
+		# /usr/lib/amd64/pkgconfig to it; otherwise, put
+		# /usr/lib/amd64/pkgconfig at the end.
+		#
+		if test -z "$PKG_CONFIG_PATH"; then
+			#
+			# Not set, or empty.  Set it to
+			# /usr/lib/amd64/pkgconfig.
+			#
+			PKG_CONFIG_PATH=/usr/lib/amd64/pkgconfig
+		elif test ! -z `echo "$PKG_CONFIG_PATH" | grep "/usr/lib/pkgconfig"`; then
+			#
+			# It contains /usr/lib/pkgconfig.  Prepend
+			# /usr/lib/amd64/pkgconfig to /usr/lib/pkgconfig.
+			#
+			PKG_CONFIG_PATH=`echo "$PKG_CONFIG_PATH" | sed "s;/usr/lib/pkgconfig;/usr/lib/amd64/pkgconfig:/usr/lib/pkgconfig;"`
+		else
+			#
+			# Not empty, but doesn't contain /usr/lib/pkgconfig.
+			# Append /usr/lib/amd64/pkgconfig to it.
+			#
+			PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/amd64/pkgconfig"
+		fi
+		export PKG_CONFIG_PATH
+	elif test "$ac_cv_sizeof_void_p" -eq 4; then
+		#
+		# 32-bit build.  If /usr/amd64/lib/pkgconfig appears
+		# in the path, prepend /usr/lib/pkgconfig to it.
+		#
+		if test ! -z `echo "$PKG_CONFIG_PATH" | grep "/usr/lib/amd64/pkgconfig"`; then
+			#
+			# It contains /usr/lib/amd64/pkgconfig.  Prepend
+			# /usr/lib/pkgconfig to /usr/lib/amd64/pkgconfig.
+			#
+			PKG_CONFIG_PATH=`echo "$PKG_CONFIG_PATH" | sed "s;/usr/lib/amd64/pkgconfig;/usr/lib/pkgconfig:/usr/lib/amd64/pkgconfig;"`
+			export PKG_CONFIG_PATH
+		fi
+	fi
+esac
 
 #
 # Handle each capture type.
@@ -6810,6 +7693,8 @@
 if test "x$ac_cv_lib_dlpi_dlpi_walk" = xyes; then :
 
 			LIBS="-ldlpi $LIBS"
+			LIBS_STATIC="-ldlpi $LIBS_STATIC"
+			LIBS_PRIVATE="-ldlpi $LIBS_PRIVATE"
 			V_PCAP=libdlpi
 
 			#
@@ -6972,29 +7857,150 @@
 
 
 	if test x$with_libnl != xno ; then
-		if test "x$PKGCONFIG" != "xno"; then
-			#
-			# We have pkg-config; see if we have libnl-genl-3.0
-			# as a package.
-			#
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libnl-genl-3.0 with pkg-config" >&5
+		#
+		# Check for libnl-genl-3.0 with pkg-config.
+		#
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libnl-genl-3.0 with pkg-config" >&5
 $as_echo_n "checking for libnl-genl-3.0 with pkg-config... " >&6; }
-			if "$PKGCONFIG" libnl-genl-3.0; then
-				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-genl-3.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnl-genl-3.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+
+	#
+	# The package was found, so try to get its C flags and
+	# libraries.
+	#
+	if test -n "$LIBNL_CFLAGS"; then
+    pkg_cv_LIBNL_CFLAGS="$LIBNL_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-genl-3.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnl-genl-3.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBNL_CFLAGS=`$PKG_CONFIG --cflags "libnl-genl-3.0" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+	if test -n "$LIBNL_LIBS"; then
+    pkg_cv_LIBNL_LIBS="$LIBNL_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-genl-3.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnl-genl-3.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBNL_LIBS=`$PKG_CONFIG --libs "libnl-genl-3.0" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+	if test -n "$LIBNL_LIBS_STATIC"; then
+    pkg_cv_LIBNL_LIBS_STATIC="$LIBNL_LIBS_STATIC"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-genl-3.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnl-genl-3.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBNL_LIBS_STATIC=`$PKG_CONFIG --libs --static "libnl-genl-3.0" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+	if test $pkg_failed = yes; then
+		#
+		# That failed - report an error.
+		#
+	   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: error" >&5
+$as_echo "error" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+	        if test $_pkg_short_errors_supported = yes; then
+		        LIBNL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnl-genl-3.0" 2>&1`
+	        else
+		        LIBNL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnl-genl-3.0" 2>&1`
+	        fi
+		# Put the nasty error message in config.log where it belongs
+		echo "$LIBNL_PKG_ERRORS" >&5
+
+		as_fn_error $? "Package requirements (libnl-genl-3.0) were not met:
+
+$LIBNL_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+
+Alternatively, you may set the environment variables LIBNL_CFLAGS
+and LIBNL_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+	elif test $pkg_failed = untried; then
+		#
+		# We don't have pkg-config, so it didn't work.
+		#
+	     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found (pkg-config not found)" >&5
+$as_echo "not found (pkg-config not found)" >&6; }
+	else
+		#
+		# We found the package.
+		#
+		LIBNL_CFLAGS=$pkg_cv_LIBNL_CFLAGS
+		LIBNL_LIBS=$pkg_cv_LIBNL_LIBS
+		LIBNL_LIBS_STATIC=$pkg_cv_LIBNL_LIBS_STATIC
+	        { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
 $as_echo "found" >&6; }
-				pkg_config_found_libnl=yes
-				libnl_genl_cflags=`"$PKGCONFIG" --cflags libnl-genl-3.0`
-				V_INCLS="$V_INCLS ${libnl_genl_cflags}"
-				libnl_genl_libs=`"$PKGCONFIG" --libs libnl-genl-3.0`
-				LIBS="${libnl_genl_libs} $LIBS"
+
+			pkg_config_found_libnl=yes
+			V_INCLS="$V_INCLS $LIBNL_CFLAGS"
+			ADDITIONAL_LIBS="$LIBNL_LIBS $ADDITIONAL_LIBS"
+			ADDITIONAL_LIBS_STATIC="$LIBNL_LIBS_STATIC $ADDITIONAL_LIBS_STATIC"
+			REQUIRES_PRIVATE="libnl-genl-3.0 $REQUIRES_PRIVATE"
 
 $as_echo "#define HAVE_LIBNL 1" >>confdefs.h
 
-			else
-				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+
+	fi
+else
+
+	#
+	# The package isn't present.
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 $as_echo "not found" >&6; }
-			fi
-		fi
+
+fi
+
 
 		if test x$pkg_config_found_libnl != xyes; then
 			#
@@ -7057,7 +8063,9 @@
 				#
 				# Yes, we have libnl 3.x.
 				#
-				LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
+				ADDITIONAL_LIBS="${libnldir} -lnl-genl-3 -lnl-3 $ADDITIONAL_LIBS"
+				ADDITIONAL_LIBS_STATIC="${libnldir} -lnl-genl-3 -lnl-3 $ADDITIONAL_LIBS_STATIC"
+				LIBS_PRIVATE="${libnldir} -lnl-genl-3 -lnl-3 $LIBS_PRIVATE"
 
 $as_echo "#define HAVE_LIBNL 1" >>confdefs.h
 
@@ -7454,7 +8462,11 @@
 		fi
 	fi
 
+
 	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
 	CFLAGS="$CFLAGS -I$dag_include_dir"
 	for ac_header in dagapi.h
 do :
@@ -7469,6 +8481,11 @@
 done
 
 
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
+
 	if test "$ac_cv_header_dagapi_h" = yes; then
 
 		V_INCLS="$V_INCLS -I$dag_include_dir"
@@ -7480,7 +8497,11 @@
 		# Check for various DAG API functions.
 		# Don't need to save and restore LIBS to prevent -ldag being
 		# included if there's a found-action (arg 3).
-		save_LDFLAGS="$LDFLAGS"
+
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
 		LDFLAGS="-L$dag_lib_dir"
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dag_attach_stream in -ldag" >&5
 $as_echo_n "checking for dag_attach_stream in -ldag... " >&6; }
@@ -7519,11 +8540,15 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dag_dag_attach_stream" >&5
 $as_echo "$ac_cv_lib_dag_dag_attach_stream" >&6; }
 if test "x$ac_cv_lib_dag_dag_attach_stream" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDAG 1
-_ACEOF
 
-  LIBS="-ldag $LIBS"
+			#
+			# We assume that if we have libdag we have
+			# libdagconf, as they're installed at the
+			# same time from the same package.
+			#
+			ADDITIONAL_LIBS="-L$dag_lib_dir $ADDITIONAL_LIBS -ldag -ldagconf"
+			ADDITIONAL_LIBS_STATIC="-L$dag_lib_dir $ADDITIONAL_LIBS_STATIC -ldag -ldagconf"
+			LIBS_PRIVATE="-L$dag_lib_dir $LIBS_PRIVATE -ldag -ldagconf"
 
 else
   as_fn_error $? "DAG library lacks streams support" "$LINENO" 5
@@ -7658,20 +8683,27 @@
 fi
 
 
-		LDFLAGS="$save_LDFLAGS"
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
 
 		#
 		# We assume that if we have libdag we have libdagconf,
 		# as they're installed at the same time from the same
 		# package.
 		#
-		LIBS="$LIBS -ldag -ldagconf"
-		LDFLAGS="$LDFLAGS -L$dag_lib_dir"
-
 		if test "$dag_large_streams" = 1; then
 
 $as_echo "#define HAVE_DAG_LARGE_STREAMS_API 1" >>confdefs.h
 
+
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
+			LIBS="$LIBS -ldag -ldagconf"
+			LDFLAGS="$LDFLAGS -L$dag_lib_dir"
 			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for vdag_set_device_info in -lvdag" >&5
 $as_echo_n "checking for vdag_set_device_info in -lvdag... " >&6; }
 if ${ac_cv_lib_vdag_vdag_set_device_info+:} false; then :
@@ -7714,6 +8746,11 @@
   ac_dag_have_vdag="0"
 fi
 
+
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
 			if test "$ac_dag_have_vdag" = 1; then
 
 $as_echo "#define HAVE_DAG_VDAG 1" >>confdefs.h
@@ -7721,7 +8758,9 @@
 				if test "$ac_lbl_have_pthreads" != "found"; then
 					as_fn_error $? "DAG requires pthreads, but we didn't find them" "$LINENO" 5
 				fi
-				LIBS="$LIBS $PTHREAD_LIBS"
+				ADDITIONAL_LIBS="$ADDITIONAL_LIBS $PTHREAD_LIBS"
+				ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $PTHREAD_LIBS"
+				LIBS_PRIVATE="$LIBS_PRIVATE $PTHREAD_LIBS"
 			fi
 		fi
 
@@ -7729,7 +8768,6 @@
 $as_echo "#define HAVE_DAG_API 1" >>confdefs.h
 
 	else
-
 		if test "$V_PCAP" = dag; then
 			# User requested "dag" capture type but we couldn't
 			# find the DAG API support.
@@ -7919,7 +8957,11 @@
 
 	if test -f "$snf_include_dir/snf.h"; then
 		# We found a header; make sure we can link with the library
-		save_LDFLAGS="$LDFLAGS"
+
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
 		LDFLAGS="$LDFLAGS -L$snf_lib_dir"
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snf_init in -lsnf" >&5
 $as_echo_n "checking for snf_init in -lsnf... " >&6; }
@@ -7961,7 +9003,11 @@
   ac_cv_lbl_snf_api="yes"
 fi
 
-		LDFLAGS="$save_LDFLAGS"
+
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
 		if test "$ac_cv_lbl_snf_api" = no; then
 			as_fn_error $? "SNF API cannot correctly be linked; check config.log" "$LINENO" 5
 		fi
@@ -7972,8 +9018,9 @@
 $as_echo "yes ($snf_root)" >&6; }
 
 		V_INCLS="$V_INCLS -I$snf_include_dir"
-		LIBS="$LIBS -lsnf"
-		LDFLAGS="$LDFLAGS -L$snf_lib_dir"
+		ADDITIONAL_LIBS="$ADDITIONAL_LIBS -L$snf_lib_dir -lsnf"
+		ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC -L$snf_lib_dir -lsnf"
+		LIBS_PRIVATE="$LIBS_PRIVATE -L$snf_lib_dir -lsnf"
 
 		if test "$V_PCAP" != snf ; then
 			MODULE_C_SRC="$MODULE_C_SRC pcap-snf.c"
@@ -8039,12 +9086,16 @@
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether TurboCap is supported" >&5
 $as_echo_n "checking whether TurboCap is supported... " >&6; }
 
+
 	save_CFLAGS="$CFLAGS"
 	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
 	if test ! -z "$turbocap_root"; then
 		TURBOCAP_CFLAGS="-I$turbocap_root/include"
-		TURBOCAP_LIBS="-L$turbocap_root/lib"
+		TURBOCAP_LDFLAGS="-L$turbocap_root/lib"
 		CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
+		LDFLAGS="$LDFLAGS $TURBOCAP_LDFLAGS"
 	fi
 
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -8069,14 +9120,20 @@
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+
 	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
 	if test $ac_cv_lbl_turbocap_api = yes; then
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
 		MODULE_C_SRC="$MODULE_C_SRC pcap-tc.c"
 		V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
-		LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
+		ADDITIONAL_LIBS="$ADDITIONAL_LIBS $TURBOCAP_LDFLAGS -lTcApi -lpthread -lstdc++"
+		ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $TURBOCAP_LDFLAGS -lTcApi -lpthread -lstdc++"
+		LIBS_PRIVATE="$LIBS_PRIVATE $TURBOCAP_LDFLAGS -lTcApi -lpthread -lstdc++"
 
 
 $as_echo "#define HAVE_TC_API 1" >>confdefs.h
@@ -8230,86 +9287,229 @@
 	# Optionally, we may want to support SSL.
 	# Check for OpenSSL/libressl.
 	#
-	# First, try looking for it as a regular system library.
-	# Make sure we can find SSL_library_init() using the
-	# standard headers, just in case we're running a version
-	# of macOS that ships with the OpenSSL library but not
-	# the OpenSSL headers, and have also installed another
-	# version of OpenSSL with headers.
+	# First, try looking for it with pkg-config, if we have it.
 	#
-	save_LIBS="$LIBS"
-	LIBS="-lssl -lcrypto"
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have a system OpenSSL/libressl that we can use" >&5
-$as_echo_n "checking whether we have a system OpenSSL/libressl that we can use... " >&6; }
-	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+	# Homebrew's pkg-config does not, by default, look for
+	# pkg-config files for packages it has installed.
+	# Furthermore, at least for OpenSSL, they appear to be
+	# dumped in package-specific directories whose paths are
+	# not only package-specific but package-version-specific.
+	#
+	# So the only way to find openssl is to get the value of
+	# PKG_CONFIG_PATH from "brew --env openssl" and add that
+	# to PKG_CONFIG_PATH.  (No, we can't just assume it's under
+	# /usr/local; Homebrew have conveniently chosen to put it
+	# under /opt/homebrew on ARM.)
+	#
+	# That's the nice thing about Homebrew - it makes things easier!
+	# Thanks!
+	#
+	save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
+	if test -n "$BREW"; then
+		openssl_pkgconfig_dir=`$BREW --env --plain openssl | sed -n 's/PKG_CONFIG_PATH: //p'`
+		PKG_CONFIG_PATH="$openssl_pkgconfig_dir:$PKG_CONFIG_PATH"
+	fi
 
-#include <openssl/ssl.h>
 
-int
-main ()
-{
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl with pkg-config" >&5
+$as_echo_n "checking for openssl with pkg-config... " >&6; }
 
-SSL_library_init();
-return 0;
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+	#
+	# The package was found, so try to get its C flags and
+	# libraries.
+	#
+	if test -n "$OPENSSL_CFLAGS"; then
+    pkg_cv_OPENSSL_CFLAGS="$OPENSSL_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
 
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-		HAVE_OPENSSL=yes
-		OPENSSL_LIBS="-lssl -lcrypto"
-
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OPENSSL_CFLAGS=`$PKG_CONFIG --cflags "openssl" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  pkg_failed=yes
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-	LIBS="$save_LIBS"
+ else
+    pkg_failed=untried
+fi
+	if test -n "$OPENSSL_LIBS"; then
+    pkg_cv_OPENSSL_LIBS="$OPENSSL_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OPENSSL_LIBS=`$PKG_CONFIG --libs "openssl" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+	if test -n "$OPENSSL_LIBS_STATIC"; then
+    pkg_cv_OPENSSL_LIBS_STATIC="$OPENSSL_LIBS_STATIC"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OPENSSL_LIBS_STATIC=`$PKG_CONFIG --libs --static "openssl" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+	if test $pkg_failed = yes; then
+		#
+		# That failed - report an error.
+		#
+	   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: error" >&5
+$as_echo "error" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+	        if test $_pkg_short_errors_supported = yes; then
+		        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl" 2>&1`
+	        else
+		        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl" 2>&1`
+	        fi
+		# Put the nasty error message in config.log where it belongs
+		echo "$OPENSSL_PKG_ERRORS" >&5
+
+		as_fn_error $? "Package requirements (openssl) were not met:
+
+$OPENSSL_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+
+Alternatively, you may set the environment variables OPENSSL_CFLAGS
+and OPENSSL_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+	elif test $pkg_failed = untried; then
+		#
+		# We don't have pkg-config, so it didn't work.
+		#
+	     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found (pkg-config not found)" >&5
+$as_echo "not found (pkg-config not found)" >&6; }
+	else
+		#
+		# We found the package.
+		#
+		OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
+		OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
+		OPENSSL_LIBS_STATIC=$pkg_cv_OPENSSL_LIBS_STATIC
+	        { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+
+		#
+		# We found OpenSSL/libressl.
+		#
+		HAVE_OPENSSL=yes
+		REQUIRES_PRIVATE="$REQUIRES_PRIVATE openssl"
+
+	fi
+else
 
 	#
-	# If we didn't find it, check for it with pkg-config.
+	# The package isn't present.
 	#
-	if test "x$HAVE_OPENSSL" != "xyes"; then
-		if test "x$PKGCONFIG" != "xno"; then
-			#
-			# We have pkg-config; see if we have OpenSSL/
-			# libressl installed as a package.
-			#
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL/libressl with pkg-config" >&5
-$as_echo_n "checking for OpenSSL/libressl with pkg-config... " >&6; }
-			if "$PKGCONFIG" openssl; then
-				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
-$as_echo "found" >&6; }
-				HAVE_OPENSSL=yes
-				OPENSSL_CFLAGS=`"$PKGCONFIG" --cflags openssl`
-				OPENSSL_LIBS=`"$PKGCONFIG" --libs openssl`
-			else
-				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 $as_echo "not found" >&6; }
-			fi
+
+fi
+
+	PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
+
+	#
+	# If it wasn't found, and we have Homebrew installed, see
+	# if it's in Homebrew.
+	#
+	if test "x$HAVE_OPENSSL" != "xyes" -a -n "$BREW"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl in Homebrew" >&5
+$as_echo_n "checking for openssl in Homebrew... " >&6; }
+		#
+		# The brew man page lies when it speaks of
+		# $BREW --prefix --installed <formula>
+		# outputting nothing.  In Homebrew 3.3.16,
+		# it produces output regardless of whether
+		# the formula is installed or not, so we
+		# send the standard output and error to
+		# the bit bucket.
+		#
+		if $BREW --prefix --installed openssl >/dev/null 2>&1; then
+			#
+			# Yes.  Get the include directory and library
+			# directory.  (No, we can't just assume it's
+			# under /usr/local; Homebrew have conveniently
+			# chosen to put it under /opt/homebrew on ARM.)
+			#
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+			HAVE_OPENSSL=yes
+			openssl_path=`$BREW --prefix openssl`
+			OPENSSL_CFLAGS="-I$openssl_path/include"
+			OPENSSL_LIBS="-L$openssl_path/lib -lssl -lcrypto"
+			OPENSSL_LIBS_STATIC="-L$openssl_path/lib -lssl -lcrypto"
+			OPENSSL_LIBS_PRIVATE="-L$openssl_path/lib -lssl -lcrypto"
+		else
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 		fi
 	fi
 
 	#
-	# If we didn't find it, check for it under /usr/local/opt/openssl;
-	# that's where Homebrew puts it on macOS.  Feel free to add other
-	# -L directories as necessary; the "system library" check should
-	# also handle "add-on library under /usr/local", so that shouldn't
-	# be necessary here.
+	# If it wasn't found, and /usr/local/include and /usr/local/lib
+	# exist, check if it's in /usr/local.  (We check whether they
+	# exist because, if they don't exist, the compiler will warn
+	# about that and then ignore the argument, so they test
+	# using just the system header files and libraries.)
 	#
-	if test "x$HAVE_OPENSSL" != "xyes"; then
-		save_CFLAGS="$CFLAGS"
-		save_LIBS="$LIBS"
-		CFLAGS="$CFLAGS -L/usr/local/opt/openssl/include"
-		LIBS="$LIBS -L/usr/local/opt/openssl/lib -lssl -lcrypto"
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have OpenSSL/libressl in /usr/local/opt that we can use" >&5
-$as_echo_n "checking whether we have OpenSSL/libressl in /usr/local/opt that we can use... " >&6; }
+	# We include the standard include file to 1) make sure that
+	# it's installed (if it's just a shared library for the
+	# benefit of existing programs, that's not useful) and 2)
+	# because SSL_library_init() is a library routine in some
+	# versions and a #defined wrapper around OPENSSL_init_ssl()
+	# in others.
+	#
+	if test "x$HAVE_OPENSSL" != "xyes" -a -d "/usr/local/include" -a -d "/usr/local/lib"; then
+
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
+		CFLAGS="$CFLAGS -I/usr/local/include"
+		LIBS="$LIBS -L/usr/local/lib -lssl -lcrypto"
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have OpenSSL/libressl in /usr/local that we can use" >&5
+$as_echo_n "checking whether we have OpenSSL/libressl in /usr/local that we can use... " >&6; }
 		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -8331,8 +9531,10 @@
 			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 			HAVE_OPENSSL=yes
-			OPENSSL_CFLAGS="-I/usr/local/opt/openssl/include"
-			OPENSSL_LIBS="-L/usr/local/opt/openssl/lib -lssl -lcrypto"
+			OPENSSL_CFLAGS="-I/usr/local/include"
+			OPENSSL_LIBS="-L/usr/local/lib -lssl -lcrypto"
+			OPENSSL_LIBS_STATIC="-L/usr/local/lib -lssl -lcrypto"
+			OPENSSL_LIBS_PRIVATE="-L/usr/local/lib -lssl -lcrypto"
 
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -8340,8 +9542,68 @@
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-		CFLAGS="$save_CFLAGS"
-		LIBS="$save_LIBS"
+
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
+	fi
+
+	#
+	# If it wasn't found, check if it's a system library.
+	#
+	# We include the standard include file to 1) make sure that
+	# it's installed (if it's just a shared library for the
+	# benefit of existing programs, that's not useful) and 2)
+	# because SSL_library_init() is a library routine in some
+	# versions and a #defined wrapper around OPENSSL_init_ssl()
+	# in others.
+	#
+	if test "x$HAVE_OPENSSL" != "xyes"; then
+
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
+		LIBS="$LIBS -lssl -lcrypto"
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have a system OpenSSL/libressl that we can use" >&5
+$as_echo_n "checking whether we have a system OpenSSL/libressl that we can use... " >&6; }
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <openssl/ssl.h>
+
+int
+main ()
+{
+
+SSL_library_init();
+return 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+			HAVE_OPENSSL=yes
+			OPENSSL_LIBS="-lssl -lcrypto"
+			OPENSSL_LIBS_STATIC="-lssl -lcrypto"
+			OPENSSL_LIBS_PRIVATE="-lssl -lcrypto"
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
 	fi
 
 	#
@@ -8351,8 +9613,11 @@
 
 $as_echo "#define HAVE_OPENSSL 1" >>confdefs.h
 
-		CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
-		LIBS="$LIBS $OPENSSL_LIBS"
+		V_INCLS="$V_INCLS $OPENSSL_CFLAGS"
+		ADDITIONAL_LIBS="$ADDITIONAL_LIBS $OPENSSL_LIBS"
+		ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $OPENSSL_LIBS_STATIC"
+		LIBS_PRIVATE="$LIBS_PRIVATE $OPENSSL_LIBS_PRIVATE"
+		REQUIRES_PRIVATE="$REQUIRES_PRIVATE $OPENSSL_REQUIRES_PRIVATE"
 	else
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: OpenSSL not found" >&5
 $as_echo "$as_me: OpenSSL not found" >&6;}
@@ -8585,7 +9850,13 @@
 $as_echo "$tcpdump_cv_capable_lex" >&6; }
 if test $tcpdump_cv_capable_lex = insufficient ; then
 	as_fn_error $? "$LEX is insufficient to compile libpcap.
- libpcap requires Flex 2.5.31 or later, or a compatible version of lex." "$LINENO" 5
+ libpcap requires Flex 2.5.31 or later, or a compatible version of lex.
+ If a suitable version of Lex/Flex is available as a non-standard command
+ and/or not in the PATH, you can specify it using the LEX environment
+ variable. That said, on some systems the error can mean that Flex/Lex is
+ actually acceptable, but m4 is not. Likewise, if a suitable version of
+ m4 (such as GNU M4) is available but has not been detected, you can
+ specify it using the M4 environment variable." "$LINENO" 5
 fi
 
 #
@@ -8732,7 +10003,7 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcpdump_cv_capable_yacc" >&5
 $as_echo "$tcpdump_cv_capable_yacc" >&6; }
 		if test $tcpdump_cv_capable_yacc = insufficient ; then
-		    as_fn_error $? "$YACC is insufficient to compile libpcap.
+		    as_fn_error $? "$BISON_BYACC is insufficient to compile libpcap.
  libpcap requires Bison, a newer version of Berkeley YACC with support
  for reentrant parsers, or another YACC compatible with them." "$LINENO" 5
 		fi
@@ -8851,7 +10122,7 @@
 			V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
 			;;
 
-		darwin8.[456]|darwin.[456].*)
+		darwin8.[456]|darwin8.[456].*)
 			#
 			# Tiger, subsequent to Intel support but prior
 			# to x86-64 support.  Build libraries and
@@ -8916,26 +10187,26 @@
 			V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
 			;;
 
-		darwin*)
+		darwin1[1-8]*)
 			#
-			# Post-Snow Leopard.  Build libraries for x86-64
-			# and 32-bit x86, with x86-64 first, and build
-			# executables only for x86-64.  (That's what
-			# Apple does.)  This requires no special flags
-			# for programs.
-			# XXX - update if and when Apple drops support
-			# for 32-bit x86 code and if and when Apple adds
-			# ARM-based Macs.  (You're on your own for iOS
-			# etc.)
+			# Post-Snow Leopard, pre-Catalina.  Build
+			# libraries for x86-64 and 32-bit x86, with
+			# x86-64 first, and build executables only for
+			# x86-64.  (That's what Apple does.)  This
+			# requires no special flags for programs.
 			#
-			# XXX - check whether we *can* build for
-			# i386 and, if not, suggest that the user
-			# install the /usr/include headers if they
-			# want to build fat.
+			# We check whether we *can* build for i386 and,
+			# if not, suggest that the user install the
+			# /usr/include headers if they want to build
+			# fat.
 			#
 			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether building for 32-bit x86 is supported" >&5
 $as_echo_n "checking whether building for 32-bit x86 is supported... " >&6; }
-			save_CFLAGS="$CFLAGS"
+
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
 			CFLAGS="$CFLAGS -arch i386"
 			cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -8999,7 +10270,95 @@
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-			CFLAGS="$save_CFLAGS"
+
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
+			;;
+
+		darwin19*)
+			#
+			# Catalina.  Build libraries and executables
+			# only for x86-64.  (That's what Apple does;
+			# 32-bit x86 binaries are not supported on
+			# Catalina.)
+			#
+			V_LIB_CCOPT_FAT="-arch x86_64"
+			V_LIB_LDFLAGS_FAT="-arch x86_64"
+			V_PROG_CCOPT_FAT="-arch x86_64"
+			V_PROG_LDFLAGS_FAT="-arch x86_64"
+			;;
+
+		darwin*)
+			#
+			# Post-Catalina.  Build libraries and
+			# executables for x86-64 and ARM64.
+			# (That's what Apple does, except they
+			# build for arm64e, which may include
+			# some of the pointer-checking extensions.)
+			#
+			# If we're building with libssl, make sure
+			# we can build fat with it (i.e., that it
+			# was built fat); if we can't, don't set
+			# the target architectures, and just
+			# build for the host we're on.
+			#
+			# Otherwise, just add both of them.
+			#
+			if test "$HAVE_OPENSSL" = yes; then
+				{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether building fat with libssl is supported" >&5
+$as_echo_n "checking whether building fat with libssl is supported... " >&6; }
+
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
+				CFLAGS="$CFLAGS -arch x86_64 -arch arm64"
+				LDFLAGS="$LDFLAGS $OPENSSL_LIBS"
+				cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+					#include <openssl/ssl.h>
+
+int
+main ()
+{
+
+					SSL_library_init();
+					return 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+					{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+					V_LIB_CCOPT_FAT="-arch x86_64 -arch arm64"
+					V_LIB_LDFLAGS_FAT="-arch x86_64 -arch arm64"
+					V_PROG_CCOPT_FAT="-arch x86_64 -arch arm64"
+					V_PROG_LDFLAGS_FAT="-arch x86_64 -arch arm64"
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
+			else
+				V_LIB_CCOPT_FAT="-arch x86_64 -arch arm64"
+				V_LIB_LDFLAGS_FAT="-arch x86_64 -arch arm64"
+				V_PROG_CCOPT_FAT="-arch x86_64 -arch arm64"
+				V_PROG_LDFLAGS_FAT="-arch x86_64 -arch arm64"
+			fi
 			;;
 		esac
 	fi
@@ -9073,21 +10432,13 @@
 
 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*|haiku*|midipix*)
 	DYEXT="so"
-
-	#
-	# Compiler assumed to be GCC; run-time linker may require a -R
-	# flag.
-	#
-	if test "$libdir" != "/usr/lib"; then
-		V_RFLAGS=-Wl,-R$libdir
-	fi
 	;;
 
 osf*)
 	DYEXT="so"
 
 	#
-	# DEC OSF/1, a/k/a Digial UNIX, a/k/a Tru64 UNIX.
+	# DEC OSF/1, a/k/a Digital UNIX, a/k/a Tru64 UNIX.
 	# Use Tru64 UNIX conventions for man pages; they're the same as
 	# the System V conventions except that they use section 8 for
 	# administrative commands and daemons.
@@ -9165,6 +10516,15 @@
 	;;
 esac
 
+
+
+
+
+
+
+
+
+
 # Check whether --enable-shared was given.
 if test "${enable_shared+set}" = set; then :
   enableval=$enable_shared;
@@ -9380,67 +10740,39 @@
 	    #
 	    if test "$ac_lbl_cc_dont_try_gcc_dashW" != yes; then
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler fails when given an unknown warning option" >&5
-$as_echo_n "checking whether the compiler fails when given an unknown warning option... " >&6; }
-	save_CFLAGS="$CFLAGS"
-	CFLAGS="$CFLAGS -Wxyzzy-this-will-never-succeed-xyzzy"
-	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-		#
-		# We're assuming this is clang, where
-		# -Werror=unknown-warning-option is the appropriate
-		# option to force the compiler to fail.
-		#
-		ac_lbl_unknown_warning_option_error="-Werror=unknown-warning-option"
-
-else
-
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-	CFLAGS="$save_CFLAGS"
-
-
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -W option" >&5
 $as_echo_n "checking whether the compiler supports the -W option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-W" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -W"
-	elif expr "x-W" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -W"
-	elif expr "x-W" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -W"
-	else
-	    CFLAGS="$CFLAGS -W"
-	fi
+	CFLAGS="$CFLAGS -W"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -9496,33 +10828,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wall option" >&5
 $as_echo_n "checking whether the compiler supports the -Wall option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wall" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wall"
-	elif expr "x-Wall" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wall"
-	elif expr "x-Wall" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wall"
-	else
-	    CFLAGS="$CFLAGS -Wall"
-	fi
+	CFLAGS="$CFLAGS -Wall"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -9578,33 +10919,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wcomma option" >&5
 $as_echo_n "checking whether the compiler supports the -Wcomma option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wcomma" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wcomma"
-	elif expr "x-Wcomma" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wcomma"
-	elif expr "x-Wcomma" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wcomma"
-	else
-	    CFLAGS="$CFLAGS -Wcomma"
-	fi
+	CFLAGS="$CFLAGS -Wcomma"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -9660,33 +11010,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wdocumentation option" >&5
 $as_echo_n "checking whether the compiler supports the -Wdocumentation option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wdocumentation" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wdocumentation"
-	elif expr "x-Wdocumentation" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wdocumentation"
-	elif expr "x-Wdocumentation" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wdocumentation"
-	else
-	    CFLAGS="$CFLAGS -Wdocumentation"
-	fi
+	CFLAGS="$CFLAGS -Wdocumentation"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -9742,33 +11101,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wformat-nonliteral option" >&5
 $as_echo_n "checking whether the compiler supports the -Wformat-nonliteral option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wformat-nonliteral" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wformat-nonliteral"
-	elif expr "x-Wformat-nonliteral" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wformat-nonliteral"
-	elif expr "x-Wformat-nonliteral" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wformat-nonliteral"
-	else
-	    CFLAGS="$CFLAGS -Wformat-nonliteral"
-	fi
+	CFLAGS="$CFLAGS -Wformat-nonliteral"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -9824,33 +11192,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wmissing-noreturn option" >&5
 $as_echo_n "checking whether the compiler supports the -Wmissing-noreturn option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wmissing-noreturn" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wmissing-noreturn"
-	elif expr "x-Wmissing-noreturn" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wmissing-noreturn"
-	elif expr "x-Wmissing-noreturn" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wmissing-noreturn"
-	else
-	    CFLAGS="$CFLAGS -Wmissing-noreturn"
-	fi
+	CFLAGS="$CFLAGS -Wmissing-noreturn"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -9906,33 +11283,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wmissing-prototypes option" >&5
 $as_echo_n "checking whether the compiler supports the -Wmissing-prototypes option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wmissing-prototypes" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wmissing-prototypes"
-	elif expr "x-Wmissing-prototypes" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wmissing-prototypes"
-	elif expr "x-Wmissing-prototypes" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wmissing-prototypes"
-	else
-	    CFLAGS="$CFLAGS -Wmissing-prototypes"
-	fi
+	CFLAGS="$CFLAGS -Wmissing-prototypes"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -9988,33 +11374,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wmissing-variable-declarations option" >&5
 $as_echo_n "checking whether the compiler supports the -Wmissing-variable-declarations option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wmissing-variable-declarations" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wmissing-variable-declarations"
-	elif expr "x-Wmissing-variable-declarations" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wmissing-variable-declarations"
-	elif expr "x-Wmissing-variable-declarations" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wmissing-variable-declarations"
-	else
-	    CFLAGS="$CFLAGS -Wmissing-variable-declarations"
-	fi
+	CFLAGS="$CFLAGS -Wmissing-variable-declarations"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -10070,33 +11465,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wpointer-arith option" >&5
 $as_echo_n "checking whether the compiler supports the -Wpointer-arith option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wpointer-arith" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wpointer-arith"
-	elif expr "x-Wpointer-arith" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wpointer-arith"
-	elif expr "x-Wpointer-arith" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wpointer-arith"
-	else
-	    CFLAGS="$CFLAGS -Wpointer-arith"
-	fi
+	CFLAGS="$CFLAGS -Wpointer-arith"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -10152,33 +11556,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wpointer-sign option" >&5
 $as_echo_n "checking whether the compiler supports the -Wpointer-sign option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wpointer-sign" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wpointer-sign"
-	elif expr "x-Wpointer-sign" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wpointer-sign"
-	elif expr "x-Wpointer-sign" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wpointer-sign"
-	else
-	    CFLAGS="$CFLAGS -Wpointer-sign"
-	fi
+	CFLAGS="$CFLAGS -Wpointer-sign"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -10234,33 +11647,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wshadow option" >&5
 $as_echo_n "checking whether the compiler supports the -Wshadow option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wshadow" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wshadow"
-	elif expr "x-Wshadow" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wshadow"
-	elif expr "x-Wshadow" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wshadow"
-	else
-	    CFLAGS="$CFLAGS -Wshadow"
-	fi
+	CFLAGS="$CFLAGS -Wshadow"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -10316,33 +11738,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wsign-compare option" >&5
 $as_echo_n "checking whether the compiler supports the -Wsign-compare option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wsign-compare" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wsign-compare"
-	elif expr "x-Wsign-compare" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wsign-compare"
-	elif expr "x-Wsign-compare" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wsign-compare"
-	else
-	    CFLAGS="$CFLAGS -Wsign-compare"
-	fi
+	CFLAGS="$CFLAGS -Wsign-compare"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -10398,33 +11829,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wstrict-prototypes option" >&5
 $as_echo_n "checking whether the compiler supports the -Wstrict-prototypes option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wstrict-prototypes" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wstrict-prototypes"
-	elif expr "x-Wstrict-prototypes" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wstrict-prototypes"
-	elif expr "x-Wstrict-prototypes" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wstrict-prototypes"
-	else
-	    CFLAGS="$CFLAGS -Wstrict-prototypes"
-	fi
+	CFLAGS="$CFLAGS -Wstrict-prototypes"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -10480,33 +11920,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wunused-parameter option" >&5
 $as_echo_n "checking whether the compiler supports the -Wunused-parameter option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wunused-parameter" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wunused-parameter"
-	elif expr "x-Wunused-parameter" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wunused-parameter"
-	elif expr "x-Wunused-parameter" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wunused-parameter"
-	else
-	    CFLAGS="$CFLAGS -Wunused-parameter"
-	fi
+	CFLAGS="$CFLAGS -Wunused-parameter"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -10562,33 +12011,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wused-but-marked-unused option" >&5
 $as_echo_n "checking whether the compiler supports the -Wused-but-marked-unused option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wused-but-marked-unused" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wused-but-marked-unused"
-	elif expr "x-Wused-but-marked-unused" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wused-but-marked-unused"
-	elif expr "x-Wused-but-marked-unused" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wused-but-marked-unused"
-	else
-	    CFLAGS="$CFLAGS -Wused-but-marked-unused"
-	fi
+	CFLAGS="$CFLAGS -Wused-but-marked-unused"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -10644,6 +12102,7 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 		    # Warns about safeguards added in case the enums are
 		    # extended
@@ -10676,28 +12135,36 @@
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wunreachable-code option" >&5
 $as_echo_n "checking whether the compiler supports the -Wunreachable-code option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wunreachable-code" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wunreachable-code"
-	elif expr "x-Wunreachable-code" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wunreachable-code"
-	elif expr "x-Wunreachable-code" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wunreachable-code"
-	else
-	    CFLAGS="$CFLAGS -Wunreachable-code"
-	fi
+	CFLAGS="$CFLAGS -Wunreachable-code"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -10760,33 +12227,42 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wshorten-64-to-32 option" >&5
 $as_echo_n "checking whether the compiler supports the -Wshorten-64-to-32 option... " >&6; }
 	save_CFLAGS="$CFLAGS"
-	if expr "x-Wshorten-64-to-32" : "x-W.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wshorten-64-to-32"
-	elif expr "x-Wshorten-64-to-32" : "x-f.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wshorten-64-to-32"
-	elif expr "x-Wshorten-64-to-32" : "x-m.*" >/dev/null
-	then
-	    CFLAGS="$CFLAGS -Werror -Wshorten-64-to-32"
-	else
-	    CFLAGS="$CFLAGS -Wshorten-64-to-32"
-	fi
+	CFLAGS="$CFLAGS -Wshorten-64-to-32"
+	#
+	# XXX - yes, this depends on the way AC_LANG_WERROR works,
+	# but no mechanism is provided to turn AC_LANG_WERROR on
+	# *and then turn it back off*, so that we *only* do it when
+	# testing compiler options - 15 years after somebody asked
+	# for it:
+	#
+	#     https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+	#
+	save_ac_c_werror_flag="$ac_c_werror_flag"
+	ac_c_werror_flag=yes
+	#
+	# We use AC_LANG_SOURCE() so that we can control the complete
+	# content of the program being compiled.  We do not, for example,
+	# want the default "int main()" that AC_LANG_PROGRAM() generates,
+	# as it will generate a warning with -Wold-style-definition, meaning
+	# that we would treat it as not working, as the test will fail if
+	# *any* error output, including a warning due to the flag we're
+	# testing, is generated; see
+	#
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#    https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+	#
+	# This may, as per those two messages, be fixed in autoconf 2.70,
+	# but we only require 2.64 or newer for now.
+	#
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-int
-main ()
-{
-return 0
-  ;
-  return 0;
-}
+int main(void) { return 0; }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
@@ -10842,6 +12318,7 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_c_werror_flag="$save_ac_c_werror_flag"
 
 	    fi
 
@@ -11030,37 +12507,6 @@
 fi
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #
 # Various Linux-specific mechanisms.
 #
@@ -11088,17 +12534,17 @@
       MODULE_C_SRC="$MODULE_C_SRC pcap-usb-linux.c"
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-      ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
-      if test $? -ne 0 ; then
-        ac_usb_dev_name="usbmon"
-      fi
-
-cat >>confdefs.h <<_ACEOF
-#define LINUX_USB_MON_DEV "/dev/$ac_usb_dev_name"
-_ACEOF
-
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Device for USB sniffing is /dev/$ac_usb_dev_name" >&5
-$as_echo "$as_me: Device for USB sniffing is /dev/$ac_usb_dev_name" >&6;}
+      #
+      # Note: if the directory for special files is *EVER* somewhere
+      # other than the UN*X standard of /dev (which will break any
+      # software that looks for /dev/null or /dev/tty, for example,
+      # so doing that is *REALLY* not a good idea), please provide
+      # some mechanism to determine that directory at *run time*,
+      # rather than *configure time*, so that it works when doinga
+      # a cross-build, and that works with *multiple* distributions,
+      # with our without udev, and with multiple versions of udev,
+      # with udevinfo or udevadm or any other mechanism to get the
+      # special files directory.
       #
       # Do we have a version of <linux/compiler.h> available?
       # If so, we might need it for <linux/usbdevice_fs.h>.
@@ -11326,192 +12772,216 @@
 
 
 if test "$want_dpdk" != no; then
-	if test "x$PKGCONFIG" != "xno"
-	then
+	#
+	# The user didn't explicitly say they don't want DPDK,
+	# so see if we have it.
+	#
+	# We only try to find it using pkg-config; DPDK is *SO*
+	# complicated - DPDK 19.02, for example, has about 117(!)
+	# libraries, and the precise set of libraries required has
+	# changed over time - so attempting to guess which libraries
+	# you need, and hardcoding that in an attempt to find the
+	# libraries without DPDK, rather than relying on DPDK to
+	# tell you, with a .pc file, what libraries are needed,
+	# is *EXTREMELY* fragile and has caused some bug reports,
+	# so we're just not going to do it.
+	#
+	# If that causes a problem, the only thing we will do is
+	# accept an alternative way of finding the appropriate
+	# library set for the installed version of DPDK that is
+	# as robust as pkg-config (i.e., it had better work as well
+	# as pkg-config with *ALL* versions of DPDK that provide a
+	# libdpdk.pc file).
+	#
+	# If --with-dpdk={path} was specified, add {path}/pkgconfig
+	# to PKG_CONFIG_PATH, so we look for the .pc file there,
+	# first.
+	#
+	save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
+	if test -n "$dpdk_dir"; then
+		PKG_CONFIG_PATH="$dpdk_dir:$PKG_CONFIG_PATH"
+	fi
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdpdk with pkg-config" >&5
+$as_echo_n "checking for libdpdk with pkg-config... " >&6; }
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdpdk\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libdpdk") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+
+	#
+	# The package was found, so try to get its C flags and
+	# libraries.
+	#
+	if test -n "$DPDK_CFLAGS"; then
+    pkg_cv_DPDK_CFLAGS="$DPDK_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdpdk\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libdpdk") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DPDK_CFLAGS=`$PKG_CONFIG --cflags "libdpdk" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+	if test -n "$DPDK_LIBS"; then
+    pkg_cv_DPDK_LIBS="$DPDK_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdpdk\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libdpdk") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DPDK_LIBS=`$PKG_CONFIG --libs "libdpdk" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+	if test -n "$DPDK_LIBS_STATIC"; then
+    pkg_cv_DPDK_LIBS_STATIC="$DPDK_LIBS_STATIC"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdpdk\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libdpdk") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DPDK_LIBS_STATIC=`$PKG_CONFIG --libs --static "libdpdk" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+	if test $pkg_failed = yes; then
 		#
-		# We have pkg-config; see if we have DPDK installed
-		# as a package.
+		# That failed - report an error.
 		#
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPDK with pkg-config" >&5
-$as_echo_n "checking for DPDK with pkg-config... " >&6; }
-		if "$PKGCONFIG" libdpdk
-		then
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+	   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: error" >&5
+$as_echo "error" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+	        if test $_pkg_short_errors_supported = yes; then
+		        DPDK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdpdk" 2>&1`
+	        else
+		        DPDK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdpdk" 2>&1`
+	        fi
+		# Put the nasty error message in config.log where it belongs
+		echo "$DPDK_PKG_ERRORS" >&5
+
+		as_fn_error $? "Package requirements (libdpdk) were not met:
+
+$DPDK_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+
+Alternatively, you may set the environment variables DPDK_CFLAGS
+and DPDK_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+	elif test $pkg_failed = untried; then
+		#
+		# We don't have pkg-config, so it didn't work.
+		#
+	     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found (pkg-config not found)" >&5
+$as_echo "not found (pkg-config not found)" >&6; }
+	else
+		#
+		# We found the package.
+		#
+		DPDK_CFLAGS=$pkg_cv_DPDK_CFLAGS
+		DPDK_LIBS=$pkg_cv_DPDK_LIBS
+		DPDK_LIBS_STATIC=$pkg_cv_DPDK_LIBS_STATIC
+	        { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
 $as_echo "found" >&6; }
-			found_dpdk_with_pkg_config=yes
-			DPDK_CFLAGS=`"$PKGCONFIG" --cflags libdpdk`
-			DPDK_LDFLAGS=`"$PKGCONFIG" --libs libdpdk`
-		else
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+
+		found_dpdk=yes
+
+	fi
+else
+
+	#
+	# The package isn't present.
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 $as_echo "not found" >&6; }
-		fi
-	fi
+
+fi
+
+	PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
 
 	#
-	# If we didn't find it with pkg-config, try checking for
-	# it manually.
+	# Did we find DPDK?
 	#
-	if test "x$found_dpdk_with_pkg_config" != "xyes"
-	then
-		if test -z "$dpdk_dir"; then
-			#
-			# The user didn't specify a directory containing
-			# the DPDK headers and libraries.  If we find
-			# a /usr/local/include/dpdk directory, assume
-			# it's /usr/local, otherwise assume it's /usr.
-			#
-			if test -d "/usr/local/include/dpdk"; then
-				dpdk_dir="/usr/local"
-			else
-				dpdk_dir="/usr"
-			fi
-		fi
+	if test "$found_dpdk" = yes; then
 		#
-		# The convention appears to be that 1) there's a "dpdk"
-		# subdirectory of the include directory, containing DPDK
-		# headers (at least in the installation on Ubuntu with
-		# the system DPDK packages) and 2) includes of DPDK
-		# headers don't use "dpdk/{header}" (at least from the
-		# way the DPDK documentation is written).
+		# Found it.
 		#
-		# So we add "/dpdk" to the include directory, and always
-		# add that to the list of include directories to search.
+		# We call rte_eth_dev_count_avail(), and older versions
+		# of DPDK didn't have it, so check for it.
 		#
-		dpdk_inc_dir="$dpdk_dir/include/dpdk"
-		dpdk_inc_flags="-I$dpdk_inc_dir"
-		dpdk_lib_dir="$dpdk_dir/lib"
-		#
-		# Handle multiarch systems.
-		#
-		# Step 1: run the C compiler with the -dumpmachine option;
-		# if it succeeds, the output would be the multiarch directory
-		# name if your system has multiarch directories.
-		#
-		multiarch_dir=`$CC -dumpmachine 2>/dev/null`
-		if test ! -z "$multiarch_dir"
-		then
-			#
-			# OK, we have a multiarch directory.
-			#
-			# Now deal with includes.  On Ubuntu 20.04, for
-			# example, we have /usr/include/dpdk *and*
-			# /usr/include/$multiarch_dir/dpdk, and must
-			# search both.
-			#
-			if test -d "$dpdk_dir/include/$multiarch_dir/dpdk"
-			then
-				dpdk_inc_flags="-I$dpdk_dir/include/$multiarch_dir/dpdk $dpdk_inc_flags"
-			fi
-
-			#
-			# Now deal with libraries.
-			#
-			if test -d "$dpdk_lib_dir/$multiarch_dir"
-			then
-				dpdk_lib_dir="$dpdk_lib_dir/$multiarch_dir"
-			fi
-		fi
-		DPDK_MACHINE_CFLAGS="-march=native"
-		DPDK_CFLAGS="$DPDK_MACHINE_CFLAGS $dpdk_inc_flags"
-		DPDK_LDFLAGS="-L$dpdk_lib_dir -ldpdk -lrt -lm -lnuma -ldl -pthread"
-	fi
 
 	save_CFLAGS="$CFLAGS"
 	save_LIBS="$LIBS"
 	save_LDFLAGS="$LDFLAGS"
-	CFLAGS="$CFLAGS $DPDK_CFLAGS"
-	LIBS="$LIBS $DPDK_LDFLAGS"
-	LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can compile the DPDK support" >&5
-$as_echo_n "checking whether we can compile the DPDK support... " >&6; }
-	if ${ac_cv_dpdk_can_compile+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-$ac_includes_default
-#include <rte_common.h>
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_dpdk_can_compile=yes
-else
-  ac_cv_dpdk_can_compile=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_dpdk_can_compile" >&5
-$as_echo "$ac_cv_dpdk_can_compile" >&6; }
-
-	#
-	# We include rte_bus.h, and older versions of DPDK
-	# didn't have it, so check for it.
-	#
-	if test "$ac_cv_dpdk_can_compile" = yes; then
-		#
-		# This runs the preprocessor, so make sure it
-		# looks in the DPDK directories.  Instead of
-		# including dpdk/XXX.h, we include just XXX.h
-		# and assume DPDK_CFLAGS is the directory
-		# containing the DPDK headers (that's how
-		# pkg-config sets it, at least on Ubuntu),
-		# so just looking under /usr/include won't
-		# find it.
-		#
-		save_CPPFLAGS="$CPPFLAGS"
-		CPPFLAGS="$CPPFLAGS $DPDK_CFLAGS"
-		ac_fn_c_check_header_mongrel "$LINENO" "rte_bus.h" "ac_cv_header_rte_bus_h" "$ac_includes_default"
-if test "x$ac_cv_header_rte_bus_h" = xyes; then :
-
-fi
-
-
-		CPPFLAGS="$save_CPPFLAGS"
-	fi
-
-	#
-	# We call rte_eth_dev_count_avail(), and older versions
-	# of DPDK didn't have it, so check for it.
-	#
-	if test "$ac_cv_header_rte_bus_h" = yes; then
+		CFLAGS="$CFLAGS $DPDK_CFLAGS"
+		LIBS="$LIBS $DPDK_LIBS"
 		ac_fn_c_check_func "$LINENO" "rte_eth_dev_count_avail" "ac_cv_func_rte_eth_dev_count_avail"
 if test "x$ac_cv_func_rte_eth_dev_count_avail" = xyes; then :
 
 fi
 
-	fi
 
 	CFLAGS="$save_CFLAGS"
 	LIBS="$save_LIBS"
 	LDFLAGS="$save_LDFLAGS"
 
+	fi
+
 	if test "$ac_cv_func_rte_eth_dev_count_avail" = yes; then
-		CFLAGS="$CFLAGS $DPDK_CFLAGS"
-		LIBS="$LIBS $DPDK_LDFLAGS"
-		LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
-		V_INCLS="$V_INCLS $DPDK_CFLAGS"
-
-$as_echo "#define PCAP_SUPPORT_DPDK 1" >>confdefs.h
-
-		if test $V_PCAP != dpdk ; then
-			MODULE_C_SRC="$MODULE_C_SRC pcap-dpdk.c"
-		fi
-
+		#
+		# We found a usable DPDK.
 		#
 		# Check whether the rte_ether.h file defines
 		# struct ether_addr or struct rte_ether_addr.
 		#
 		# ("API compatibility?  That's for losers!")
 		#
+
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
+		CFLAGS="$CFLAGS $DPDK_CFLAGS"
+		LIBS="$LIBS $DPDK_LIBS"
 		ac_fn_c_check_type "$LINENO" "struct rte_ether_addr" "ac_cv_type_struct_rte_ether_addr" "
 			#include <rte_ether.h>
 
@@ -11525,47 +12995,108 @@
 
 fi
 
-	else
-		if test "$V_PCAP" = dpdk; then
-			# User requested DPDK-only capture support, but
-			# we couldn't the DPDK API support at all, or we
-			# found it but it wasn't a sufficiently recent
-			# version.
-			if test "$ac_cv_dpdk_can_compile" != yes; then
-				#
-				# Couldn't even find the headers.
-				#
-				as_fn_error $? "DPDK support requested with --with-pcap=dpdk, but the DPDK headers weren't found at $dpdk_inc_dir: make sure the DPDK support is installed, specify a different path or paths if necessary, or don't request DPDK support" "$LINENO" 5
-			else
-				#
-				# Found the headers, but we couldn't find
-				# rte_bus.h or rte_eth_dev_count_avail(),
-				# we don't have a sufficiently recent
-				# version of DPDK.
-				#
-				as_fn_error $? "DPDK support requested with --with-pcap=dpdk, but we require DPDK 18.x or later; install a newer version of DPDK, or don't request DPDK support" "$LINENO" 5
-			fi
-		fi
 
-		if test "$want_dpdk" = yes; then
-			# User requested DPDK-only capture support, but
-			# we couldn't the DPDK API support at all, or we
-			# found it but it wasn't a sufficiently recent
-			# version.
-			if test "$ac_cv_dpdk_can_compile" != yes; then
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
+
+		#
+		# We can build with DPDK.
+		#
+		V_INCLS="$V_INCLS $DPDK_CFLAGS"
+		ADDITIONAL_LIBS="$ADDITIONAL_LIBS $DPDK_LIBS"
+		ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $DPDK_LIBS_STATIC"
+		REQUIRES_PRIVATE="$REQUIRES_PRIVATE libdpdk"
+
+$as_echo "#define PCAP_SUPPORT_DPDK 1" >>confdefs.h
+
+		if test $V_PCAP != dpdk ; then
+			MODULE_C_SRC="$MODULE_C_SRC pcap-dpdk.c"
+		fi
+	else
+		#
+		# We didn't find a usable DPDK.
+		# If we required it (with --with-dpdk or --with-pcap=dpdk),
+		# fail with an appropriate message telling the user what
+		# the problem was, otherwise note the problem with a
+		# warning.
+		#
+		if test "$found_dpdk" != yes; then
+			#
+			# Not found with pkg-config.  Note that we
+			# require that DPDK must be findable with
+			# pkg-config.
+			#
+			if test "$V_PCAP" = dpdk; then
 				#
-				# Couldn't even find the headers.
+				# User requested DPDK-only capture support.
 				#
-				as_fn_error $? "DPDK support requested with --with-pcap=dpdk, but the DPDK headers weren't found at $dpdk_inc_dir: make sure the DPDK support is installed, specify a different path or paths if necessary, or don't request DPDK support" "$LINENO" 5
-			else
-				#
-				# Found the headers, but we couldn't find
-				# rte_bus.h or rte_eth_dev_count_avail(),
-				# we don't have a sufficiently recent
-				# version of DPDK.
-				#
-				as_fn_error $? "DPDK support requested with --with-pcap=dpdk, but we require DPDK 18.x or later: install a newer version of DPDK, or don't request DPDK support" "$LINENO" 5
+				as_fn_error $? "DPDK support requested with --with-pcap=dpdk, but
+we couldn't find DPDK with pkg-config.  Make sure that pkg-config is
+installed, that DPDK 18.02.2 or later is installed, and that DPDK
+provides a .pc file." "$LINENO" 5
 			fi
+
+			if test "$want_dpdk" = yes; then
+				#
+				# User requested that libpcap include
+				# DPDK capture support.
+				#
+				as_fn_error $? "DPDK support requested with --with-dpdk, but we
+couldn't find DPDK with pkg-config.  Make sure that pkg-config
+is installed, that DPDK 18.02.2 or later is installed, and that
+DPDK provides .pc file." "$LINENO" 5
+			fi
+
+			#
+			# User didn't indicate whether they wanted DPDK
+			# or not; just warn why we didn't find it.
+			#
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: We couldn't find DPDK with pkg-config.  If
+you want DPDK support, make sure that pkg-config is installed,
+that DPDK 18.02.2 or later is installed, and that DPDK provides a
+.pc file." >&5
+$as_echo "$as_me: WARNING: We couldn't find DPDK with pkg-config.  If
+you want DPDK support, make sure that pkg-config is installed,
+that DPDK 18.02.2 or later is installed, and that DPDK provides a
+.pc file." >&2;}
+		elif test "$ac_cv_func_rte_eth_dev_count_avail" != yes; then
+			#
+			# Found with pkg-config, but we couldn't compile
+			# a program that calls rte_eth_dev_count(); we
+			# probably have the developer package installed,
+			# but don't have a sufficiently recent version
+			# of DPDK.  Note that we need a sufficiently
+			# recent version of DPDK.
+			#
+			if test "$V_PCAP" = dpdk; then
+				#
+				# User requested DPDK-only capture support.
+				#
+				as_fn_error $? "DPDK support requested with --with-pcap=dpdk, but we
+can't compile libpcap with DPDK.  Make sure that DPDK 18.02.2 or later
+is installed." "$LINENO" 5
+			fi
+
+			if test "$want_dpdk" = yes; then
+				#
+				# User requested that libpcap include
+				# DPDK capture support.
+				#
+				as_fn_error $? "DPDK support requested with --with-dpdk, but
+we can't compile libpcap with DPDK.  Make sure that DPDK 18.02.2
+or later is DPDK is installed." "$LINENO" 5
+			fi
+
+			#
+			# User didn't indicate whether they wanted DPDK
+			# or not; just warn why we didn't find it.
+			#
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DPDK was found, but we can't compile libpcap with it.
+Make sure that DPDK 18.02.2 or later is installed." >&5
+$as_echo "$as_me: WARNING: DPDK was found, but we can't compile libpcap with it.
+Make sure that DPDK 18.02.2 or later is installed." >&2;}
 		fi
 	fi
 fi
@@ -11741,28 +13272,138 @@
 fi
 
 if test "x$enable_dbus" != "xno"; then
-	if test "x$PKGCONFIG" != "xno"; then
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for D-Bus" >&5
-$as_echo_n "checking for D-Bus... " >&6; }
-		if "$PKGCONFIG" dbus-1; then
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-			DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
-			DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
-			save_CFLAGS="$CFLAGS"
-			save_LIBS="$LIBS"
-			CFLAGS="$CFLAGS $DBUS_CFLAGS"
-			LIBS="$LIBS $DBUS_LIBS"
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the D-Bus library defines dbus_connection_read_write" >&5
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbus-1 with pkg-config" >&5
+$as_echo_n "checking for dbus-1 with pkg-config... " >&6; }
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+
+	#
+	# The package was found, so try to get its C flags and
+	# libraries.
+	#
+	if test -n "$DBUS_CFLAGS"; then
+    pkg_cv_DBUS_CFLAGS="$DBUS_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+	if test -n "$DBUS_LIBS"; then
+    pkg_cv_DBUS_LIBS="$DBUS_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+	if test -n "$DBUS_LIBS_STATIC"; then
+    pkg_cv_DBUS_LIBS_STATIC="$DBUS_LIBS_STATIC"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DBUS_LIBS_STATIC=`$PKG_CONFIG --libs --static "dbus-1" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+	if test $pkg_failed = yes; then
+		#
+		# That failed - report an error.
+		#
+	   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: error" >&5
+$as_echo "error" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+	        if test $_pkg_short_errors_supported = yes; then
+		        DBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dbus-1" 2>&1`
+	        else
+		        DBUS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dbus-1" 2>&1`
+	        fi
+		# Put the nasty error message in config.log where it belongs
+		echo "$DBUS_PKG_ERRORS" >&5
+
+
+		if test "x$enable_dbus" = "xyes"; then
+			as_fn_error $? "--enable-dbus was given, but the dbus-1 package is not installed" "$LINENO" 5
+		fi
+
+	elif test $pkg_failed = untried; then
+		#
+		# We don't have pkg-config, so it didn't work.
+		#
+	     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found (pkg-config not found)" >&5
+$as_echo "not found (pkg-config not found)" >&6; }
+	else
+		#
+		# We found the package.
+		#
+		DBUS_CFLAGS=$pkg_cv_DBUS_CFLAGS
+		DBUS_LIBS=$pkg_cv_DBUS_LIBS
+		DBUS_LIBS_STATIC=$pkg_cv_DBUS_LIBS_STATIC
+	        { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+
+
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
+		CFLAGS="$CFLAGS $DBUS_CFLAGS"
+		LIBS="$LIBS $DBUS_LIBS"
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the D-Bus library defines dbus_connection_read_write" >&5
 $as_echo_n "checking whether the D-Bus library defines dbus_connection_read_write... " >&6; }
-			cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <string.h>
 
-			     #include <time.h>
-			     #include <sys/time.h>
+		     #include <time.h>
+		     #include <sys/time.h>
 
-			     #include <dbus/dbus.h>
+		     #include <dbus/dbus.h>
 int
 main ()
 {
@@ -11773,35 +13414,45 @@
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 
-				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
 $as_echo "#define PCAP_SUPPORT_DBUS 1" >>confdefs.h
 
-				MODULE_C_SRC="$MODULE_C_SRC pcap-dbus.c"
-				V_INCLS="$V_INCLS $DBUS_CFLAGS"
+			MODULE_C_SRC="$MODULE_C_SRC pcap-dbus.c"
+			V_INCLS="$V_INCLS $DBUS_CFLAGS"
+			ADDITIONAL_LIBS="$ADDITIONAL_LIBS $DBUS_LIBS"
+			ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $DBUS_LIBS_STATIC"
+			REQUIRES_PRIVATE="$REQUIRES_PRIVATE dbus-1"
 
 else
 
-				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-				if test "x$enable_dbus" = "xyes"; then
-				    as_fn_error $? "--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()" "$LINENO" 5
-				fi
-				LIBS="$save_LIBS"
+			if test "x$enable_dbus" = "xyes"; then
+			    as_fn_error $? "--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()" "$LINENO" 5
+			fi
 
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-			CFLAGS="$save_CFLAGS"
-		else
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-			if test "x$enable_dbus" = "xyes"; then
-				as_fn_error $? "--enable-dbus was given, but the dbus-1 package is not installed" "$LINENO" 5
-			fi
-		fi
+
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
+
 	fi
+else
+
+	#
+	# The package isn't present.
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+
+fi
+
 
 fi
 
@@ -11820,7 +13471,144 @@
 fi
 
 if test "x$enable_rdma" != "xno"; then
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ibv_get_device_list in -libverbs" >&5
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libibverbs with pkg-config" >&5
+$as_echo_n "checking for libibverbs with pkg-config... " >&6; }
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libibverbs\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libibverbs") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+
+	#
+	# The package was found, so try to get its C flags and
+	# libraries.
+	#
+	if test -n "$LIBIBVERBS_CFLAGS"; then
+    pkg_cv_LIBIBVERBS_CFLAGS="$LIBIBVERBS_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libibverbs\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libibverbs") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBIBVERBS_CFLAGS=`$PKG_CONFIG --cflags "libibverbs" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+	if test -n "$LIBIBVERBS_LIBS"; then
+    pkg_cv_LIBIBVERBS_LIBS="$LIBIBVERBS_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libibverbs\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libibverbs") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBIBVERBS_LIBS=`$PKG_CONFIG --libs "libibverbs" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+	if test -n "$LIBIBVERBS_LIBS_STATIC"; then
+    pkg_cv_LIBIBVERBS_LIBS_STATIC="$LIBIBVERBS_LIBS_STATIC"
+ elif test -n "$PKG_CONFIG"; then
+
+if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libibverbs\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libibverbs") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBIBVERBS_LIBS_STATIC=`$PKG_CONFIG --libs --static "libibverbs" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+	if test $pkg_failed = yes; then
+		#
+		# That failed - report an error.
+		#
+	   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: error" >&5
+$as_echo "error" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+	        if test $_pkg_short_errors_supported = yes; then
+		        LIBIBVERBS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libibverbs" 2>&1`
+	        else
+		        LIBIBVERBS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libibverbs" 2>&1`
+	        fi
+		# Put the nasty error message in config.log where it belongs
+		echo "$LIBIBVERBS_PKG_ERRORS" >&5
+
+		as_fn_error $? "Package requirements (libibverbs) were not met:
+
+$LIBIBVERBS_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+
+Alternatively, you may set the environment variables LIBIBVERBS_CFLAGS
+and LIBIBVERBS_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+	elif test $pkg_failed = untried; then
+		#
+		# We don't have pkg-config, so it didn't work.
+		#
+	     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found (pkg-config not found)" >&5
+$as_echo "not found (pkg-config not found)" >&6; }
+	else
+		#
+		# We found the package.
+		#
+		LIBIBVERBS_CFLAGS=$pkg_cv_LIBIBVERBS_CFLAGS
+		LIBIBVERBS_LIBS=$pkg_cv_LIBIBVERBS_LIBS
+		LIBIBVERBS_LIBS_STATIC=$pkg_cv_LIBIBVERBS_LIBS_STATIC
+	        { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+
+		found_libibverbs=yes
+		LIBIBVERBS_REQUIRES_PRIVATE="libibverbs"
+
+	fi
+else
+
+	#
+	# The package isn't present.
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+
+fi
+
+
+	if test "x$found_libibverbs" != "xyes"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ibv_get_device_list in -libverbs" >&5
 $as_echo_n "checking for ibv_get_device_list in -libverbs... " >&6; }
 if ${ac_cv_lib_ibverbs_ibv_get_device_list+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -11858,6 +13646,30 @@
 $as_echo "$ac_cv_lib_ibverbs_ibv_get_device_list" >&6; }
 if test "x$ac_cv_lib_ibverbs_ibv_get_device_list" = xyes; then :
 
+			found_libibverbs=yes
+			LIBIBVERBS_CFLAGS=""
+			LIBIBVERBS_LIBS="-libverbs"
+			# XXX - at least on Ubuntu 20.04, there are many more
+			# libraries needed; is there any platform where
+			# libibverbs is available but where pkg-config isn't
+			# available or libibverbs doesn't use it?  If not,
+			# we should only use pkg-config for it.
+			LIBIBVERBS_LIBS_STATIC="-libverbs"
+			LIBIBVERBS_LIBS_PRIVATE="-libverbs"
+
+
+fi
+
+	fi
+
+	if test "x$found_libibverbs" = "xyes"; then
+
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_LDFLAGS="$LDFLAGS"
+
+		CFLAGS="$CFLAGS $LIBIBVERBS_CFLAGS"
+		LIBS="$LIBS $LIBIBVERBS_LIBS"
 		ac_fn_c_check_header_mongrel "$LINENO" "infiniband/verbs.h" "ac_cv_header_infiniband_verbs_h" "$ac_includes_default"
 if test "x$ac_cv_header_infiniband_verbs_h" = xyes; then :
 
@@ -11894,11 +13706,7 @@
 
 					{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-
-$as_echo "#define PCAP_SUPPORT_RDMASNIFF /**/" >>confdefs.h
-
-					MODULE_C_SRC="$MODULE_C_SRC pcap-rdmasniff.c"
-					LIBS="-libverbs $LIBS"
+					found_usable_libibverbs=yes
 
 else
 
@@ -11914,9 +13722,80 @@
 
 
 
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	LDFLAGS="$save_LDFLAGS"
+
+	fi
+
+	if test "x$found_usable_libibverbs" = "xyes"
+	then
+
+$as_echo "#define PCAP_SUPPORT_RDMASNIFF /**/" >>confdefs.h
+
+		MODULE_C_SRC="$MODULE_C_SRC pcap-rdmasniff.c"
+		CFLAGS="$LIBIBVERBS_CFLAGS $CFLAGS"
+		ADDITIONAL_LIBS="$LIBIBVERBS_LIBS $ADDITIONAL_LIBS"
+		ADDITIONAL_LIBS_STATIC="$LIBIBVERBS_LIBS_STATIC $ADDITIONAL_LIBS_STATIC"
+		LIBS_PRIVATE="$LIBIBVERBS_LIBS_PRIVATE $LIBS_PRIVATE"
+		REQUIRES_PRIVATE="$REQUIRES_PRIVATE $LIBIBVERBS_REQUIRES_PRIVATE"
+	fi
+
 fi
 
+#
+# If this is a platform where we need to have the .pc file and
+# pcap-config script supply an rpath option to specify the directory
+# in which the libpcap shared library is installed, and the install
+# prefix /usr (meaning we're not installing a system library), provide
+# the rpath option.
+#
+# (We must check $prefix, as $libdir isn't necessarily /usr/lib in this
+# case - for example, Linux distributions for 64-bit platforms that
+# also provide support for binaries for a 32-bit version of the
+# platform may put the 64-bit libraries, the 32-bit libraries, or both
+# in directories other than /usr/lib.)
+#
+# In AIX, do we have to do this?
+#
+# In Darwin-based OSes, the full paths of the shared libraries with
+# which the program was linked are stored in the executable, so we don't
+# need to provide an rpath option.
+#
+# With the HP-UX linker, directories specified with -L are, by default,
+# added to the run-time search path, so we don't need to supply them.
+#
+# For Tru64 UNIX, "-rpath" works with DEC's^WCompaq's^WHP's C compiler
+# for Alpha, but isn't documented as working with GCC, and no GCC-
+# compatible option is documented as working with the DEC compiler.
+# If anybody needs this on Tru64/Alpha, they're welcome to figure out a
+# way to make it work.
+#
+# This must *not* depend on the compiler, as, on platforms where there's
+# a GCC-compatible compiler and a vendor compiler, we need to work with
+# both.
+#
+if test "$prefix" != "/usr"; then
+	case "$host_os" in
 
+	freebsd*|netbsd*|openbsd*|dragonfly*|linux*|haiku*|midipix*|gnu*)
+		#
+		# Platforms where the "native" C compiler is GCC or
+		# accepts compatible command-line arguments, and the
+		# "native" linker is the GNU linker or accepts
+		# compatible command-line arguments.
+		#
+		RPATH="-Wl,-rpath,\${libdir}"
+		;;
+
+	solaris*)
+		#
+		# Sun/Oracle's linker, the GNU linker, and
+		# GNU-compatible linkers all support -R.
+		#
+		RPATH="-Wl,-R,\${libdir}"
+		;;
+	esac
 fi
 
 # Find a good install program.  We prefer a C program (faster),
@@ -12016,6 +13895,29 @@
 ac_config_headers="$ac_config_headers config.h"
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# We're done with configuration operations; add ADDITIONAL_LIBS and
+# ADDITIONAL_LIBS_STATIC to LIBS and LIBS_STATIC, respectively.
+#
+LIBS="$ADDITIONAL_LIBS $LIBS"
+LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $LIBS_STATIC"
+
 ac_config_commands="$ac_config_commands default-1"
 
 ac_config_files="$ac_config_files Makefile grammar.y pcap-filter.manmisc pcap-linktype.manmisc pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap pcap_open_offline.3pcap pcap_set_immediate_mode.3pcap pcap_set_tstamp_precision.3pcap pcap_set_tstamp_type.3pcap rpcapd/Makefile rpcapd/rpcapd.manadmin rpcapd/rpcapd-config.manfile testprogs/Makefile"
@@ -12526,7 +14428,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by pcap $as_me 1.10.1, which was
+This file was extended by pcap $as_me 1.10.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -12592,7 +14494,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-pcap config.status 1.10.1
+pcap config.status 1.10.3
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -13301,7 +15203,7 @@
     "default-1":C) if test -f .devel; then
 	echo timestamp > stamp-h
 	cat $srcdir/Makefile-devel-adds >> Makefile
-	make depend
+	make depend || exit 1
 fi ;;
 
   esac
diff --git a/configure.ac b/configure.ac
index edb25ae..ff7e490 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,86 @@
 AC_CONFIG_SRCDIR(pcap.c)
 AC_SUBST(PACKAGE_NAME)
 
+#
+# These are the variables that are used in Makefile, pcap-config, and
+# libpcap.pc.
+#
+# CFLAGS: inherited from the environment, not modified by us (except
+# temporarily during tests that involve compilation).  Used only when
+# compiling C source.
+#
+# CXXFLAGS: inherited from the environment, not modified by us.  Used only
+# when compiling C++ source.
+#
+# LDFLAGS: inherited from the environment, not modified by us.
+#
+# LIBS: inherited from the environment; we add libraries required by
+# libpcap.  Librares that the core libpcap code requires are added
+# first; libraries required by additional pcap modules are first
+# added to ADDITIONAL_LIBS, and only added to LIBS at the end, after
+# we're finished doing configuration tests for the modules.
+#
+# LIBS_STATIC: libraries with which a program using the libpcap *static*
+# library needs to be linked.  This is a superset of LIBS, used in
+# pcap-config, so that "pcap-config --libs --static" will report them.
+# Initialized to LIBS.
+#
+# REQUIRES_PRIVATE: pkg-config package names for additional libraries
+# with which a program using the libpcap *static* library needs to be
+# linked and for which a .pc file exists.  This is used in libpcap.pc,
+# so that "pkg-config --libs --static" will report them, and so that
+# those libraries will be determined using the library's .pc file, not
+# from our .pc file.  Initialized to an empty string.
+#
+# V_CCOPT: additional compiler flags other than -I and -D flags
+# needed when compiling libpcap.  Used in Makefile for both C and
+# C++ source.
+#
+# V_DEFS: additional -D compiler flags needed when compiling
+# libpcap.  Used in Makefile for both C and C++ source.
+#
+# V_INCLS: additional -I compiler flags needed when compiling
+# libpcap.  Used in Makefile for both C and C++ source.
+#
+# ADDITIONAL_LIBS: additional libraries with which the libpcap dynamic
+# library needs to be linked.  Used in Makwfile; not used in pcap-config
+# or libpcap.pc, as, in all platforms on which we run, if a dynamic
+# library is linked with other dynamic libraries, a program using
+# that dynamic library doesn't have to link with those libraries -
+# they will be automatically loaded at run time.  Initialized to an
+# empty string.
+#
+# ADDITIONAL_LIBS_STATIC: additional libraries with which a program
+# using the libpcap *static* library needs to be linked.  This is used
+# in pcap-config, so that "pcap-config --libs --static" will report
+# them.  Initialized to an empty string.
+#
+# REQUIRES_PRIVATE: pkg-config package names for additional libraries
+# with which a program using the libpcap *static* library needs to be
+# linked and for which a .pc file exists.  This is used in libpcap.pc,
+# so that "pkg-config --libs --static" will report them, and so that
+# those libraries will be determined using the library's .pc file, not
+# from our .pc file.  Initialized to an empty string.
+#
+# LIBS_PRIVATE: pkg-config package names for additional libraries with
+# which a program using the libpcap *static* library needs to be linked
+# and for which a .pc file does not exist.  This is used in libpcap.pc,
+# so that "pkg-config --libs --static" will report them (those libraries
+# cannot be determined using the library's .pc file, as there is no such
+# file, so it has to come from our .pc file.  Initialized to an empty
+# string.
+#
+LIBS_STATIC=""
+REQUIRES_PRIVATE=""
+LIBS_PRIVATE=""
+
+AC_SUBST(V_CCOPT)
+AC_SUBST(V_DEFS)
+AC_SUBST(V_INCLS)
+AC_SUBST(LIBS_STATIC)
+AC_SUBST(REQUIRES_PRIVATE)
+AC_SUBST(LIBS_PRIVATE)
+
 AC_CANONICAL_SYSTEM
 
 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
@@ -32,12 +112,46 @@
 if test "$ac_cv_prog_cc_c99" = "no"; then
 	AC_MSG_ERROR([The C compiler does not support C99])
 fi
+
+#
+# Get the size of a void *, to determine whether this is a 32-bit
+# or 64-bit build.
+#
+AC_CHECK_SIZEOF([void *])
+ac_lbl_c_sizeof_void_p="$ac_cv_sizeof_void_p"
+
+#
+# We only need a C++ compiler for Haiku; all code except for its
+# pcap module is in C.
+#
 case "$host_os" in
 haiku*)
-	#
-	# Haiku's platform file is in C++.
-	#
 	AC_PROG_CXX
+
+	#
+	# Make sure C and C++ have the same pointer sizes with the flags
+	# they're given; if they don't, it means that the compilers for the
+	# languages will, with those flags, not produce code that can be
+	# linked together.
+	#
+	# We have to use different data types, because the results of
+	# a test are cached, so if we test for the size of a given type
+	# in C, the subsequent test in C++ will use the cached variable.
+	# We trick autoconf by testing the size of a "void *" in C and a
+	# "const void *" in C++.
+	#
+	AC_LANG_PUSH([C++])
+	AC_CHECK_SIZEOF([const void *])
+	ac_lbl_cxx_sizeof_void_p="$ac_cv_sizeof_const_void_p"
+	AC_LANG_POP([C++])
+	if test "$ac_lbl_cxx_sizeof_void_p" -eq 0; then
+		AC_MSG_ERROR([No C++ compiler was found])
+	fi
+	if test "$ac_lbl_c_sizeof_void_p" -ne "$ac_lbl_cxx_sizeof_void_p"; then
+		AC_MSG_ERROR([C compiler $CC produces code with $ac_lbl_c_sizeof_void_p-byte pointers
+while C++ compiler $CXX produces code with $ac_lbl_cxx_sizeof_void_p-byte pointers.  This prevents
+code in those languages from being combined.])
+	fi
 	;;
 esac
 
@@ -63,38 +177,23 @@
 dnl
 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h)
 AC_CHECK_HEADERS(netpacket/packet.h)
-AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>])
-if test "$ac_cv_header_net_pfvar_h" = yes; then
-	#
-	# Check for various PF actions.
-	#
-	AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
-	AC_TRY_COMPILE(
-	    [#include <sys/types.h>
-	    #include <sys/socket.h>
-	    #include <net/if.h>
-	    #include <net/pfvar.h>],
-	    [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
-	    [
-		AC_MSG_RESULT(yes)
-		AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
-		    [define if net/pfvar.h defines PF_NAT through PF_NORDR])
-	    ],
-	    AC_MSG_RESULT(no))
-fi
 
+AC_LBL_SAVE_CHECK_STATE
 case "$host_os" in
 haiku*)
 	#
 	# Haiku needs _BSD_SOURCE for the _IO* macros because it doesn't use them.
 	#
 	CFLAGS="$CFLAGS -D_BSD_SOURCE"
+	#
+	# Haiku has getpass in libbsd.
+	#
+	AC_CHECK_LIB(bsd, getpass)
 	;;
 esac
 
 AC_LBL_FIXINCLUDES
+AC_LBL_RESTORE_CHECK_STATE
 
 AC_CHECK_FUNCS(strerror)
 AC_CHECK_FUNC(strerror_r,
@@ -437,7 +536,7 @@
 		# This test fails if we don't have <arpa/inet.h>
 		# (if we have ether_hostton(), we should have
 		# networking, and if we have networking, we should
-		# have <arapa/inet.h>) or if we do but it doesn't
+		# have <arpa/inet.h>) or if we do but it doesn't
 		# declare ether_hostton().
 		#
 		# Unset ac_cv_have_decl_ether_hostton so we don't
@@ -572,7 +671,7 @@
 dnl to pacify those who hate protochain insn
 AC_MSG_CHECKING(if --disable-protochain option is specified)
 AC_ARG_ENABLE(protochain,
-AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
+AS_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
 case "x$enable_protochain" in
 xyes)	enable_protochain=enabled	;;
 xno)	enable_protochain=disabled	;;
@@ -592,7 +691,7 @@
 VALGRINDTEST_SRC=
 
 AC_ARG_WITH(pcap,
-AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
+AS_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
 if test ! -z "$with_pcap" ; then
 	V_PCAP="$withval"
 else
@@ -724,7 +823,7 @@
 		#
 		V_PCAP=null
 		AC_MSG_WARN(cannot determine packet capture interface)
-		AC_MSG_WARN((see the INSTALL doc for more info))
+		AC_MSG_WARN((see the INSTALL.md file for more info))
 	fi
 fi
 AC_MSG_CHECKING(packet capture type)
@@ -734,7 +833,69 @@
 #
 # Do we have pkg-config?
 #
-AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
+PKG_PROG_PKG_CONFIG
+
+#
+# Do we have the brew command from Homebrew?
+#
+AC_PATH_PROG([BREW], [brew])
+
+#
+# Solaris pkg-config is annoying.  For at least one package (D-Bus, I'm
+# looking at *you*!), there are separate include files for 32-bit and
+# 64-bit builds (I guess using "unsigned long long" as a 64-bit integer
+# type on a 64-bit build is like crossing the beams or soething), and
+# there are two separate .pc files, so if we're doing a 32-bit build we
+# should make sure we look in /usr/lib/pkgconfig for .pc files and if
+# we're doing a 64-bit build we should make sure we look in
+# /usr/lib/amd64/pkgconfig for .pc files.
+#
+case "$host_os" in
+
+solaris*)
+	if test "$ac_cv_sizeof_void_p" -eq 8; then
+		#
+		# 64-bit build.  If the path is empty, set it to
+                # /usr/lib/amd64/pkgconfig; otherwise, if
+                # /usr/lib/pkgconfig appears in the path, prepend
+		# /usr/lib/amd64/pkgconfig to it; otherwise, put
+		# /usr/lib/amd64/pkgconfig at the end.
+		#
+		if test -z "$PKG_CONFIG_PATH"; then
+			#
+			# Not set, or empty.  Set it to
+			# /usr/lib/amd64/pkgconfig.
+			#
+			PKG_CONFIG_PATH=/usr/lib/amd64/pkgconfig
+		elif test ! -z `echo "$PKG_CONFIG_PATH" | grep "/usr/lib/pkgconfig"`; then
+			#
+			# It contains /usr/lib/pkgconfig.  Prepend
+			# /usr/lib/amd64/pkgconfig to /usr/lib/pkgconfig.
+			#
+			PKG_CONFIG_PATH=`echo "$PKG_CONFIG_PATH" | sed "s;/usr/lib/pkgconfig;/usr/lib/amd64/pkgconfig:/usr/lib/pkgconfig;"`
+		else
+			#
+			# Not empty, but doesn't contain /usr/lib/pkgconfig.
+			# Append /usr/lib/amd64/pkgconfig to it.
+			#
+			PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/amd64/pkgconfig"
+		fi
+		export PKG_CONFIG_PATH
+	elif test "$ac_cv_sizeof_void_p" -eq 4; then
+		#
+		# 32-bit build.  If /usr/amd64/lib/pkgconfig appears
+		# in the path, prepend /usr/lib/pkgconfig to it.
+		#
+		if test ! -z `echo "$PKG_CONFIG_PATH" | grep "/usr/lib/amd64/pkgconfig"`; then
+			#
+			# It contains /usr/lib/amd64/pkgconfig.  Prepend
+			# /usr/lib/pkgconfig to /usr/lib/amd64/pkgconfig.
+			#
+			PKG_CONFIG_PATH=`echo "$PKG_CONFIG_PATH" | sed "s;/usr/lib/amd64/pkgconfig;/usr/lib/pkgconfig:/usr/lib/amd64/pkgconfig;"`
+			export PKG_CONFIG_PATH
+		fi
+	fi
+esac
 
 #
 # Handle each capture type.
@@ -762,6 +923,8 @@
 	AC_CHECK_LIB(dlpi, dlpi_walk,
 		[
 			LIBS="-ldlpi $LIBS"
+			LIBS_STATIC="-ldlpi $LIBS_STATIC"
+			LIBS_PRIVATE="-ldlpi $LIBS_PRIVATE"
 			V_PCAP=libdlpi
 
 			#
@@ -860,28 +1023,22 @@
 	# let's drop support for older versions of libnl, too.
 	#
 	AC_ARG_WITH(libnl,
-	AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
+	AS_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
 		with_libnl=$withval,with_libnl=if_available)
 
 	if test x$with_libnl != xno ; then
-		if test "x$PKGCONFIG" != "xno"; then
-			#
-			# We have pkg-config; see if we have libnl-genl-3.0
-			# as a package.
-			#
-			AC_MSG_CHECKING([for libnl-genl-3.0 with pkg-config])
-			if "$PKGCONFIG" libnl-genl-3.0; then
-				AC_MSG_RESULT([found])
-				pkg_config_found_libnl=yes
-				libnl_genl_cflags=`"$PKGCONFIG" --cflags libnl-genl-3.0`
-				V_INCLS="$V_INCLS ${libnl_genl_cflags}"
-				libnl_genl_libs=`"$PKGCONFIG" --libs libnl-genl-3.0`
-				LIBS="${libnl_genl_libs} $LIBS"
-				AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
-			else
-				AC_MSG_RESULT([not found])
-			fi
-		fi
+		#
+		# Check for libnl-genl-3.0 with pkg-config.
+		#
+		PKG_CHECK_MODULES(LIBNL, libnl-genl-3.0,
+		    [
+			pkg_config_found_libnl=yes
+			V_INCLS="$V_INCLS $LIBNL_CFLAGS"
+			ADDITIONAL_LIBS="$LIBNL_LIBS $ADDITIONAL_LIBS"
+			ADDITIONAL_LIBS_STATIC="$LIBNL_LIBS_STATIC $ADDITIONAL_LIBS_STATIC"
+			REQUIRES_PRIVATE="libnl-genl-3.0 $REQUIRES_PRIVATE"
+			AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
+		    ])
 
 		if test x$pkg_config_found_libnl != xyes; then
 			#
@@ -908,7 +1065,9 @@
 				#
 				# Yes, we have libnl 3.x.
 				#
-				LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
+				ADDITIONAL_LIBS="${libnldir} -lnl-genl-3 -lnl-3 $ADDITIONAL_LIBS"
+				ADDITIONAL_LIBS_STATIC="${libnldir} -lnl-genl-3 -lnl-3 $ADDITIONAL_LIBS_STATIC"
+				LIBS_PRIVATE="${libnldir} -lnl-genl-3 -lnl-3 $LIBS_PRIVATE"
 				AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
 				V_INCLS="$V_INCLS ${incdir}"
 			],[
@@ -1125,7 +1284,7 @@
     ])
 
 AC_ARG_ENABLE(ipv6,
-AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes@:>@]),
+AS_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes@:>@]),
     [],
     [enable_ipv6=yes])
 if test "$enable_ipv6" != "no"; then
@@ -1138,7 +1297,7 @@
 
 # Check for Endace DAG card support.
 AC_ARG_WITH([dag],
-AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
+AS_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
 [
 	if test "$withval" = no
 	then
@@ -1171,7 +1330,7 @@
 ])
 
 AC_ARG_WITH([dag-includes],
-AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
+AS_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
 [
 	# User wants DAG support and has specified a header directory, so use the provided value.
 	want_dag=yes
@@ -1179,7 +1338,7 @@
 ],[])
 
 AC_ARG_WITH([dag-libraries],
-AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
+AS_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
 [
 	# User wants DAG support and has specified a library directory, so use the provided value.
 	want_dag=yes
@@ -1208,9 +1367,10 @@
 		fi
 	fi
 
-	save_CFLAGS="$CFLAGS"
+	AC_LBL_SAVE_CHECK_STATE
 	CFLAGS="$CFLAGS -I$dag_include_dir"
 	AC_CHECK_HEADERS([dagapi.h])
+	AC_LBL_RESTORE_CHECK_STATE
 
 	if test "$ac_cv_header_dagapi_h" = yes; then
 
@@ -1223,42 +1383,52 @@
 		# Check for various DAG API functions.
 		# Don't need to save and restore LIBS to prevent -ldag being
 		# included if there's a found-action (arg 3).
-		save_LDFLAGS="$LDFLAGS"
+		AC_LBL_SAVE_CHECK_STATE
 		LDFLAGS="-L$dag_lib_dir"
 		AC_CHECK_LIB([dag], [dag_attach_stream],
-		    [],
+		    [
+			#
+			# We assume that if we have libdag we have
+			# libdagconf, as they're installed at the
+			# same time from the same package.
+			#
+			ADDITIONAL_LIBS="-L$dag_lib_dir $ADDITIONAL_LIBS -ldag -ldagconf"
+			ADDITIONAL_LIBS_STATIC="-L$dag_lib_dir $ADDITIONAL_LIBS_STATIC -ldag -ldagconf"
+			LIBS_PRIVATE="-L$dag_lib_dir $LIBS_PRIVATE -ldag -ldagconf"
+		    ],
 		    [AC_MSG_ERROR(DAG library lacks streams support)])
 		AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
 		AC_CHECK_LIB([dag],[dag_get_erf_types], [
 			AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
 		AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
 			AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
-
-		LDFLAGS="$save_LDFLAGS"
+		AC_LBL_RESTORE_CHECK_STATE
 
 		#
 		# We assume that if we have libdag we have libdagconf,
 		# as they're installed at the same time from the same
 		# package.
 		#
-		LIBS="$LIBS -ldag -ldagconf"
-		LDFLAGS="$LDFLAGS -L$dag_lib_dir"
-
 		if test "$dag_large_streams" = 1; then
 			AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
+			AC_LBL_SAVE_CHECK_STATE
+			LIBS="$LIBS -ldag -ldagconf"
+			LDFLAGS="$LDFLAGS -L$dag_lib_dir"
 			AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
+			AC_LBL_RESTORE_CHECK_STATE
 			if test "$ac_dag_have_vdag" = 1; then
 				AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
 				if test "$ac_lbl_have_pthreads" != "found"; then
 					AC_MSG_ERROR([DAG requires pthreads, but we didn't find them])
 				fi
-				LIBS="$LIBS $PTHREAD_LIBS"
+				ADDITIONAL_LIBS="$ADDITIONAL_LIBS $PTHREAD_LIBS"
+				ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $PTHREAD_LIBS"
+				LIBS_PRIVATE="$LIBS_PRIVATE $PTHREAD_LIBS"
 			fi
 		fi
 
 		AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
 	else
-
 		if test "$V_PCAP" = dag; then
 			# User requested "dag" capture type but we couldn't
 			# find the DAG API support.
@@ -1274,7 +1444,7 @@
 fi
 
 AC_ARG_WITH(septel,
-AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
+AS_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
 [
 	if test "$withval" = no
 	then
@@ -1351,7 +1521,7 @@
 
 # Check for Myricom SNF support.
 AC_ARG_WITH([snf],
-AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
+AS_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
 [
 	if test "$withval" = no
 	then
@@ -1384,7 +1554,7 @@
 ])
 
 AC_ARG_WITH([snf-includes],
-AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
+AS_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
 [
 	# User wants SNF with specific header directory
 	want_snf=yes
@@ -1392,7 +1562,7 @@
 ],[])
 
 AC_ARG_WITH([snf-libraries],
-AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
+AS_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
 [
 	# User wants SNF with specific lib directory
 	want_snf=yes
@@ -1426,10 +1596,10 @@
 
 	if test -f "$snf_include_dir/snf.h"; then
 		# We found a header; make sure we can link with the library
-		save_LDFLAGS="$LDFLAGS"
+		AC_LBL_SAVE_CHECK_STATE
 		LDFLAGS="$LDFLAGS -L$snf_lib_dir"
 		AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
-		LDFLAGS="$save_LDFLAGS"
+		AC_LBL_RESTORE_CHECK_STATE
 		if test "$ac_cv_lbl_snf_api" = no; then
 			AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
 		fi
@@ -1439,8 +1609,9 @@
 		AC_MSG_RESULT([yes ($snf_root)])
 
 		V_INCLS="$V_INCLS -I$snf_include_dir"
-		LIBS="$LIBS -lsnf"
-		LDFLAGS="$LDFLAGS -L$snf_lib_dir"
+		ADDITIONAL_LIBS="$ADDITIONAL_LIBS -L$snf_lib_dir -lsnf"
+		ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC -L$snf_lib_dir -lsnf"
+		LIBS_PRIVATE="$LIBS_PRIVATE -L$snf_lib_dir -lsnf"
 
 		if test "$V_PCAP" != snf ; then
 			MODULE_C_SRC="$MODULE_C_SRC pcap-snf.c"
@@ -1464,7 +1635,7 @@
 
 # Check for Riverbed TurboCap support.
 AC_ARG_WITH([turbocap],
-AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
+AS_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
 [
 	if test "$withval" = no
 	then
@@ -1497,12 +1668,12 @@
 
 	AC_MSG_CHECKING(whether TurboCap is supported)
 
-	save_CFLAGS="$CFLAGS"
-	save_LIBS="$LIBS"
+	AC_LBL_SAVE_CHECK_STATE
 	if test ! -z "$turbocap_root"; then
 		TURBOCAP_CFLAGS="-I$turbocap_root/include"
-		TURBOCAP_LIBS="-L$turbocap_root/lib"
+		TURBOCAP_LDFLAGS="-L$turbocap_root/lib"
 		CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
+		LDFLAGS="$LDFLAGS $TURBOCAP_LDFLAGS"
 	fi
 
 	AC_TRY_COMPILE(
@@ -1516,13 +1687,15 @@
 	],
 	ac_cv_lbl_turbocap_api=yes)
 
-	CFLAGS="$save_CFLAGS"
+	AC_LBL_RESTORE_CHECK_STATE
 	if test $ac_cv_lbl_turbocap_api = yes; then
 		AC_MSG_RESULT(yes)
 
 		MODULE_C_SRC="$MODULE_C_SRC pcap-tc.c"
 		V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
-		LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
+		ADDITIONAL_LIBS="$ADDITIONAL_LIBS $TURBOCAP_LDFLAGS -lTcApi -lpthread -lstdc++"
+		ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $TURBOCAP_LDFLAGS -lTcApi -lpthread -lstdc++"
+		LIBS_PRIVATE="$LIBS_PRIVATE $TURBOCAP_LDFLAGS -lTcApi -lpthread -lstdc++"
 
 		AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
 	else
@@ -1541,10 +1714,11 @@
 dnl libpcap, exposing it to malicious servers.
 dnl
 AC_MSG_CHECKING([whether to enable remote packet capture])
-AC_ARG_ENABLE(remote,
-[  --enable-remote         enable remote packet capture @<:@default=no@:>@
-  --disable-remote        disable remote packet capture],,
-   enableval=no)
+AC_ARG_ENABLE([remote],
+   [AS_HELP_STRING([--enable-remote],
+     [enable remote packet capture @<:@default=no@:>@])],
+   [],
+   [enableval=no])
 case "$enableval" in
 yes)	AC_MSG_RESULT(yes)
 	AC_WARN([Remote packet capture may expose libpcap-based applications])
@@ -1599,66 +1773,91 @@
 	# Optionally, we may want to support SSL.
 	# Check for OpenSSL/libressl.
 	#
-	# First, try looking for it as a regular system library.
-	# Make sure we can find SSL_library_init() using the
-	# standard headers, just in case we're running a version
-	# of macOS that ships with the OpenSSL library but not
-	# the OpenSSL headers, and have also installed another
-	# version of OpenSSL with headers.
+	# First, try looking for it with pkg-config, if we have it.
 	#
-	save_LIBS="$LIBS"
-	LIBS="-lssl -lcrypto"
-	AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
-	AC_TRY_LINK(
+	# Homebrew's pkg-config does not, by default, look for
+	# pkg-config files for packages it has installed.
+	# Furthermore, at least for OpenSSL, they appear to be
+	# dumped in package-specific directories whose paths are
+	# not only package-specific but package-version-specific.
+	#
+	# So the only way to find openssl is to get the value of
+	# PKG_CONFIG_PATH from "brew --env openssl" and add that
+	# to PKG_CONFIG_PATH.  (No, we can't just assume it's under
+	# /usr/local; Homebrew have conveniently chosen to put it
+	# under /opt/homebrew on ARM.)
+	#
+	# That's the nice thing about Homebrew - it makes things easier!
+	# Thanks!
+	#
+	save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
+	if test -n "$BREW"; then
+		openssl_pkgconfig_dir=`$BREW --env --plain openssl | sed -n 's/PKG_CONFIG_PATH: //p'`
+		PKG_CONFIG_PATH="$openssl_pkgconfig_dir:$PKG_CONFIG_PATH"
+	fi
+	PKG_CHECK_MODULES(OPENSSL, openssl,
 	    [
-#include <openssl/ssl.h>
-	    ],
-	    [
-SSL_library_init();
-return 0;
-	    ],
-	    [
-		AC_MSG_RESULT(yes)
+		#
+		# We found OpenSSL/libressl.
+		#
 		HAVE_OPENSSL=yes
-		OPENSSL_LIBS="-lssl -lcrypto"
-	    ],
-	    AC_MSG_RESULT(no))
-	LIBS="$save_LIBS"
+		REQUIRES_PRIVATE="$REQUIRES_PRIVATE openssl"
+	    ])
+	PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
 
 	#
-	# If we didn't find it, check for it with pkg-config.
+	# If it wasn't found, and we have Homebrew installed, see
+	# if it's in Homebrew.
 	#
-	if test "x$HAVE_OPENSSL" != "xyes"; then
-		if test "x$PKGCONFIG" != "xno"; then
+	if test "x$HAVE_OPENSSL" != "xyes" -a -n "$BREW"; then
+		AC_MSG_CHECKING(for openssl in Homebrew)
+		#
+		# The brew man page lies when it speaks of
+		# $BREW --prefix --installed <formula>
+		# outputting nothing.  In Homebrew 3.3.16,
+		# it produces output regardless of whether
+		# the formula is installed or not, so we
+		# send the standard output and error to
+		# the bit bucket.
+		#
+		if $BREW --prefix --installed openssl >/dev/null 2>&1; then
 			#
-			# We have pkg-config; see if we have OpenSSL/
-			# libressl installed as a package.
+			# Yes.  Get the include directory and library
+			# directory.  (No, we can't just assume it's
+			# under /usr/local; Homebrew have conveniently
+			# chosen to put it under /opt/homebrew on ARM.)
 			#
-			AC_MSG_CHECKING([for OpenSSL/libressl with pkg-config])
-			if "$PKGCONFIG" openssl; then
-				AC_MSG_RESULT([found])
-				HAVE_OPENSSL=yes
-				OPENSSL_CFLAGS=`"$PKGCONFIG" --cflags openssl`
-				OPENSSL_LIBS=`"$PKGCONFIG" --libs openssl`
-			else
-				AC_MSG_RESULT([not found])
-			fi
+			AC_MSG_RESULT(yes)
+			HAVE_OPENSSL=yes
+			openssl_path=`$BREW --prefix openssl`
+			OPENSSL_CFLAGS="-I$openssl_path/include"
+			OPENSSL_LIBS="-L$openssl_path/lib -lssl -lcrypto"
+			OPENSSL_LIBS_STATIC="-L$openssl_path/lib -lssl -lcrypto"
+			OPENSSL_LIBS_PRIVATE="-L$openssl_path/lib -lssl -lcrypto"
+		else
+			AC_MSG_RESULT(no)
 		fi
 	fi
 
 	#
-	# If we didn't find it, check for it under /usr/local/opt/openssl;
-	# that's where Homebrew puts it on macOS.  Feel free to add other
-	# -L directories as necessary; the "system library" check should
-	# also handle "add-on library under /usr/local", so that shouldn't
-	# be necessary here.
+	# If it wasn't found, and /usr/local/include and /usr/local/lib
+	# exist, check if it's in /usr/local.  (We check whether they
+	# exist because, if they don't exist, the compiler will warn
+	# about that and then ignore the argument, so they test
+	# using just the system header files and libraries.)
 	#
-	if test "x$HAVE_OPENSSL" != "xyes"; then
-		save_CFLAGS="$CFLAGS"
-		save_LIBS="$LIBS"
-		CFLAGS="$CFLAGS -L/usr/local/opt/openssl/include"
-		LIBS="$LIBS -L/usr/local/opt/openssl/lib -lssl -lcrypto"
-		AC_MSG_CHECKING(whether we have OpenSSL/libressl in /usr/local/opt that we can use)
+	# We include the standard include file to 1) make sure that
+	# it's installed (if it's just a shared library for the
+	# benefit of existing programs, that's not useful) and 2)
+	# because SSL_library_init() is a library routine in some
+	# versions and a #defined wrapper around OPENSSL_init_ssl()
+	# in others.
+	#
+	if test "x$HAVE_OPENSSL" != "xyes" -a -d "/usr/local/include" -a -d "/usr/local/lib"; then
+		AC_LBL_SAVE_CHECK_STATE
+		CFLAGS="$CFLAGS -I/usr/local/include"
+		LIBS="$LIBS -L/usr/local/lib -lssl -lcrypto"
+		AC_MSG_CHECKING(whether we have OpenSSL/libressl in /usr/local that we can use)
 		AC_TRY_LINK(
 		    [
 #include <openssl/ssl.h>
@@ -1670,12 +1869,46 @@
 		    [
 			AC_MSG_RESULT(yes)
 			HAVE_OPENSSL=yes
-			OPENSSL_CFLAGS="-I/usr/local/opt/openssl/include"
-			OPENSSL_LIBS="-L/usr/local/opt/openssl/lib -lssl -lcrypto"
+			OPENSSL_CFLAGS="-I/usr/local/include"
+			OPENSSL_LIBS="-L/usr/local/lib -lssl -lcrypto"
+			OPENSSL_LIBS_STATIC="-L/usr/local/lib -lssl -lcrypto"
+			OPENSSL_LIBS_PRIVATE="-L/usr/local/lib -lssl -lcrypto"
 		    ],
 		    AC_MSG_RESULT(no))
-		CFLAGS="$save_CFLAGS"
-		LIBS="$save_LIBS"
+		AC_LBL_RESTORE_CHECK_STATE
+	fi
+
+	#
+	# If it wasn't found, check if it's a system library.
+	#
+	# We include the standard include file to 1) make sure that
+	# it's installed (if it's just a shared library for the
+	# benefit of existing programs, that's not useful) and 2)
+	# because SSL_library_init() is a library routine in some
+	# versions and a #defined wrapper around OPENSSL_init_ssl()
+	# in others.
+	#
+	if test "x$HAVE_OPENSSL" != "xyes"; then
+		AC_LBL_SAVE_CHECK_STATE
+		LIBS="$LIBS -lssl -lcrypto"
+		AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
+		AC_TRY_LINK(
+		    [
+#include <openssl/ssl.h>
+		    ],
+		    [
+SSL_library_init();
+return 0;
+		    ],
+		    [
+			AC_MSG_RESULT(yes)
+			HAVE_OPENSSL=yes
+			OPENSSL_LIBS="-lssl -lcrypto"
+			OPENSSL_LIBS_STATIC="-lssl -lcrypto"
+			OPENSSL_LIBS_PRIVATE="-lssl -lcrypto"
+		    ],
+		    AC_MSG_RESULT(no))
+		AC_LBL_RESTORE_CHECK_STATE
 	fi
 
 	#
@@ -1683,8 +1916,11 @@
 	#
 	if test "x$HAVE_OPENSSL" = "xyes"; then
 		AC_DEFINE([HAVE_OPENSSL], [1], [Use OpenSSL])
-		CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
-		LIBS="$LIBS $OPENSSL_LIBS"
+		V_INCLS="$V_INCLS $OPENSSL_CFLAGS"
+		ADDITIONAL_LIBS="$ADDITIONAL_LIBS $OPENSSL_LIBS"
+		ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $OPENSSL_LIBS_STATIC"
+		LIBS_PRIVATE="$LIBS_PRIVATE $OPENSSL_LIBS_PRIVATE"
+		REQUIRES_PRIVATE="$REQUIRES_PRIVATE $OPENSSL_REQUIRES_PRIVATE"
 	else
 		AC_MSG_NOTICE(OpenSSL not found)
 	fi
@@ -1701,7 +1937,7 @@
 
 AC_MSG_CHECKING(whether to build optimizer debugging code)
 AC_ARG_ENABLE(optimizer-dbg,
-AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
+AS_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
 if test "$enable_optimizer_dbg" = "yes"; then
 	AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
 fi
@@ -1709,7 +1945,7 @@
 
 AC_MSG_CHECKING(whether to build parser debugging code)
 AC_ARG_ENABLE(yydebug,
-AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
+AS_HELP_STRING([--enable-yydebug],[build parser debugging code]))
 if test "$enable_yydebug" = "yes"; then
 	AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
 fi
@@ -1735,7 +1971,13 @@
 	fi)
 if test $tcpdump_cv_capable_lex = insufficient ; then
 	AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
- libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
+ libpcap requires Flex 2.5.31 or later, or a compatible version of lex.
+ If a suitable version of Lex/Flex is available as a non-standard command
+ and/or not in the PATH, you can specify it using the LEX environment
+ variable. That said, on some systems the error can mean that Flex/Lex is
+ actually acceptable, but m4 is not. Likewise, if a suitable version of
+ m4 (such as GNU M4) is available but has not been detected, you can
+ specify it using the M4 environment variable.])
 fi
 
 #
@@ -1793,7 +2035,7 @@
 			tcpdump_cv_capable_yacc=insufficient
 		    fi)
 		if test $tcpdump_cv_capable_yacc = insufficient ; then
-		    AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
+		    AC_MSG_ERROR([$BISON_BYACC is insufficient to compile libpcap.
  libpcap requires Bison, a newer version of Berkeley YACC with support
  for reentrant parsers, or another YACC compatible with them.])
 		fi
@@ -1876,7 +2118,7 @@
 	DYEXT="dylib"
 	V_CCOPT="$V_CCOPT -fno-common"
 	AC_ARG_ENABLE(universal,
-	AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
+	AS_HELP_STRING([--disable-universal],[don't build universal on macOS]))
 	if test "$enable_universal" != "no"; then
 		case "$host_os" in
 
@@ -1906,7 +2148,7 @@
 			V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
 			;;
 
-		darwin8.[[456]]|darwin.[[456]].*)
+		darwin8.[[456]]|darwin8.[[456]].*)
 			#
 			# Tiger, subsequent to Intel support but prior
 			# to x86-64 support.  Build libraries and
@@ -1971,25 +2213,21 @@
 			V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
 			;;
 
-		darwin*)
+		darwin1[[1-8]]*)
 			#
-			# Post-Snow Leopard.  Build libraries for x86-64
-			# and 32-bit x86, with x86-64 first, and build
-			# executables only for x86-64.  (That's what
-			# Apple does.)  This requires no special flags
-			# for programs.
-			# XXX - update if and when Apple drops support
-			# for 32-bit x86 code and if and when Apple adds
-			# ARM-based Macs.  (You're on your own for iOS
-			# etc.)
+			# Post-Snow Leopard, pre-Catalina.  Build
+			# libraries for x86-64 and 32-bit x86, with
+			# x86-64 first, and build executables only for
+			# x86-64.  (That's what Apple does.)  This
+			# requires no special flags for programs.
 			#
-			# XXX - check whether we *can* build for
-			# i386 and, if not, suggest that the user
-			# install the /usr/include headers if they
-			# want to build fat.
+			# We check whether we *can* build for i386 and,
+			# if not, suggest that the user install the
+			# /usr/include headers if they want to build
+			# fat.
 			#
 			AC_MSG_CHECKING(whether building for 32-bit x86 is supported)
-			save_CFLAGS="$CFLAGS"
+			AC_LBL_SAVE_CHECK_STATE
 			CFLAGS="$CFLAGS -arch i386"
 			AC_TRY_LINK(
 			    [],
@@ -2036,7 +2274,67 @@
 					;;
 				esac
 			    ])
-			CFLAGS="$save_CFLAGS"
+			AC_LBL_RESTORE_CHECK_STATE
+			;;
+
+		darwin19*)
+			#
+			# Catalina.  Build libraries and executables
+			# only for x86-64.  (That's what Apple does;
+			# 32-bit x86 binaries are not supported on
+			# Catalina.)
+			#
+			V_LIB_CCOPT_FAT="-arch x86_64"
+			V_LIB_LDFLAGS_FAT="-arch x86_64"
+			V_PROG_CCOPT_FAT="-arch x86_64"
+			V_PROG_LDFLAGS_FAT="-arch x86_64"
+			;;
+
+		darwin*)
+			#
+			# Post-Catalina.  Build libraries and
+			# executables for x86-64 and ARM64.
+			# (That's what Apple does, except they
+			# build for arm64e, which may include
+			# some of the pointer-checking extensions.)
+			#
+			# If we're building with libssl, make sure
+			# we can build fat with it (i.e., that it
+			# was built fat); if we can't, don't set
+			# the target architectures, and just
+			# build for the host we're on.
+			#
+			# Otherwise, just add both of them.
+			#
+			if test "$HAVE_OPENSSL" = yes; then
+				AC_MSG_CHECKING(whether building fat with libssl is supported)
+				AC_LBL_SAVE_CHECK_STATE
+				CFLAGS="$CFLAGS -arch x86_64 -arch arm64"
+				LDFLAGS="$LDFLAGS $OPENSSL_LIBS"
+				AC_TRY_LINK(
+				    [
+					#include <openssl/ssl.h>
+				    ],
+				    [
+					SSL_library_init();
+					return 0;
+				    ],
+				    [
+					AC_MSG_RESULT(yes)
+					V_LIB_CCOPT_FAT="-arch x86_64 -arch arm64"
+					V_LIB_LDFLAGS_FAT="-arch x86_64 -arch arm64"
+					V_PROG_CCOPT_FAT="-arch x86_64 -arch arm64"
+					V_PROG_LDFLAGS_FAT="-arch x86_64 -arch arm64"
+				    ],
+				    [AC_MSG_RESULT(no)]
+				)
+				AC_LBL_RESTORE_CHECK_STATE
+			else
+				V_LIB_CCOPT_FAT="-arch x86_64 -arch arm64"
+				V_LIB_LDFLAGS_FAT="-arch x86_64 -arch arm64"
+				V_PROG_CCOPT_FAT="-arch x86_64 -arch arm64"
+				V_PROG_LDFLAGS_FAT="-arch x86_64 -arch arm64"
+			fi
 			;;
 		esac
 	fi
@@ -2112,21 +2410,13 @@
 
 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*|haiku*|midipix*)
 	DYEXT="so"
-
-	#
-	# Compiler assumed to be GCC; run-time linker may require a -R
-	# flag.
-	#
-	if test "$libdir" != "/usr/lib"; then
-		V_RFLAGS=-Wl,-R$libdir
-	fi
 	;;
 
 osf*)
 	DYEXT="so"
 
 	#
-	# DEC OSF/1, a/k/a Digial UNIX, a/k/a Tru64 UNIX.
+	# DEC OSF/1, a/k/a Digital UNIX, a/k/a Tru64 UNIX.
 	# Use Tru64 UNIX conventions for man pages; they're the same as
 	# the System V conventions except that they use section 8 for
 	# administrative commands and daemons.
@@ -2181,9 +2471,18 @@
 	esac
 	;;
 esac
+AC_SUBST(V_LIB_CCOPT_FAT)
+AC_SUBST(V_LIB_LDFLAGS_FAT)
+AC_SUBST(V_PROG_CCOPT_FAT)
+AC_SUBST(V_PROG_LDFLAGS_FAT)
+AC_SUBST(DYEXT)
+AC_SUBST(MAN_DEVICES)
+AC_SUBST(MAN_FILE_FORMATS)
+AC_SUBST(MAN_MISC_INFO)
+AC_SUBST(MAN_ADMIN_COMMANDS)
 
 AC_ARG_ENABLE(shared,
-AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
+AS_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
 test "x$enable_shared" = "xno" && DYEXT="none"
 
 AC_PROG_RANLIB
@@ -2230,42 +2529,11 @@
 	#include <sys/dlpi_ext.h>
     ])
 
-AC_SUBST(V_CCOPT)
-AC_SUBST(V_LIB_CCOPT_FAT)
-AC_SUBST(V_LIB_LDFLAGS_FAT)
-AC_SUBST(V_PROG_CCOPT_FAT)
-AC_SUBST(V_PROG_LDFLAGS_FAT)
-AC_SUBST(V_DEFS)
-AC_SUBST(V_INCLS)
-AC_SUBST(V_LEX)
-AC_SUBST(V_SHLIB_CCOPT)
-AC_SUBST(V_SHLIB_CMD)
-AC_SUBST(V_SHLIB_OPT)
-AC_SUBST(V_SONAME_OPT)
-AC_SUBST(V_RPATH_OPT)
-AC_SUBST(V_YACC)
-AC_SUBST(ADDLOBJS)
-AC_SUBST(ADDLARCHIVEOBJS)
-AC_SUBST(PLATFORM_C_SRC)
-AC_SUBST(PLATFORM_CXX_SRC)
-AC_SUBST(MODULE_C_SRC)
-AC_SUBST(REMOTE_C_SRC)
-AC_SUBST(DYEXT)
-AC_SUBST(MAN_DEVICES)
-AC_SUBST(MAN_FILE_FORMATS)
-AC_SUBST(MAN_MISC_INFO)
-AC_SUBST(MAN_ADMIN_COMMANDS)
-AC_SUBST(PTHREAD_LIBS)
-AC_SUBST(BUILD_RPCAPD)
-AC_SUBST(INSTALL_RPCAPD)
-AC_SUBST(RPCAPD_LIBS)
-AC_SUBST(EXTRA_NETWORK_LIBS)
-
 #
 # Various Linux-specific mechanisms.
 #
 AC_ARG_ENABLE([usb],
-[AC_HELP_STRING([--enable-usb],[enable Linux usbmon USB capture support @<:@default=yes, if support available@:>@])],
+[AS_HELP_STRING([--enable-usb],[enable Linux usbmon USB capture support @<:@default=yes, if support available@:>@])],
     [],
     [enable_usb=yes])
 
@@ -2282,12 +2550,17 @@
       AC_DEFINE(PCAP_SUPPORT_LINUX_USBMON, 1, [target host supports Linux usbmon for USB sniffing])
       MODULE_C_SRC="$MODULE_C_SRC pcap-usb-linux.c"
       AC_MSG_RESULT(yes)
-      ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
-      if test $? -ne 0 ; then
-        ac_usb_dev_name="usbmon"
-      fi
-      AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
-      AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
+      #
+      # Note: if the directory for special files is *EVER* somewhere
+      # other than the UN*X standard of /dev (which will break any
+      # software that looks for /dev/null or /dev/tty, for example,
+      # so doing that is *REALLY* not a good idea), please provide
+      # some mechanism to determine that directory at *run time*,
+      # rather than *configure time*, so that it works when doinga
+      # a cross-build, and that works with *multiple* distributions,
+      # with our without udev, and with multiple versions of udev,
+      # with udevinfo or udevadm or any other mechanism to get the
+      # special files directory.
       #
       # Do we have a version of <linux/compiler.h> available?
       # If so, we might need it for <linux/usbdevice_fs.h>.
@@ -2358,7 +2631,7 @@
 AC_SUBST(PCAP_SUPPORT_NETFILTER)
 
 AC_ARG_ENABLE([netmap],
-[AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
+[AS_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
     [],
     [enable_netmap=yes])
 
@@ -2389,7 +2662,7 @@
 
 # Check for DPDK support.
 AC_ARG_WITH([dpdk],
-AC_HELP_STRING([--with-dpdk@<:@=DIR@:>@],[include DPDK support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
+AS_HELP_STRING([--with-dpdk@<:@=DIR@:>@],[include DPDK support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
 [
 	if test "$withval" = no
 	then
@@ -2423,211 +2696,177 @@
 ])
 
 if test "$want_dpdk" != no; then
-	if test "x$PKGCONFIG" != "xno"
-	then
-		#
-		# We have pkg-config; see if we have DPDK installed
-		# as a package.
-		#
-		AC_MSG_CHECKING([for DPDK with pkg-config])
-		if "$PKGCONFIG" libdpdk
-		then
-			AC_MSG_RESULT([found])
-			found_dpdk_with_pkg_config=yes
-			DPDK_CFLAGS=`"$PKGCONFIG" --cflags libdpdk`
-			DPDK_LDFLAGS=`"$PKGCONFIG" --libs libdpdk`
-		else
-			AC_MSG_RESULT([not found])
-		fi
+	#
+	# The user didn't explicitly say they don't want DPDK,
+	# so see if we have it.
+	#
+	# We only try to find it using pkg-config; DPDK is *SO*
+	# complicated - DPDK 19.02, for example, has about 117(!)
+	# libraries, and the precise set of libraries required has
+	# changed over time - so attempting to guess which libraries
+	# you need, and hardcoding that in an attempt to find the
+	# libraries without DPDK, rather than relying on DPDK to
+	# tell you, with a .pc file, what libraries are needed,
+	# is *EXTREMELY* fragile and has caused some bug reports,
+	# so we're just not going to do it.
+	#
+	# If that causes a problem, the only thing we will do is
+	# accept an alternative way of finding the appropriate
+	# library set for the installed version of DPDK that is
+	# as robust as pkg-config (i.e., it had better work as well
+	# as pkg-config with *ALL* versions of DPDK that provide a
+	# libdpdk.pc file).
+	#
+	# If --with-dpdk={path} was specified, add {path}/pkgconfig
+	# to PKG_CONFIG_PATH, so we look for the .pc file there,
+	# first.
+	#
+	save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
+	if test -n "$dpdk_dir"; then
+		PKG_CONFIG_PATH="$dpdk_dir:$PKG_CONFIG_PATH"
 	fi
+	PKG_CHECK_MODULES(DPDK, libdpdk,
+	    [
+		found_dpdk=yes
+	    ])
+	PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
 
 	#
-	# If we didn't find it with pkg-config, try checking for
-	# it manually.
+	# Did we find DPDK?
 	#
-	if test "x$found_dpdk_with_pkg_config" != "xyes"
-	then
-		if test -z "$dpdk_dir"; then
-			#
-			# The user didn't specify a directory containing
-			# the DPDK headers and libraries.  If we find
-			# a /usr/local/include/dpdk directory, assume
-			# it's /usr/local, otherwise assume it's /usr.
-			#
-			if test -d "/usr/local/include/dpdk"; then
-				dpdk_dir="/usr/local"
-			else
-				dpdk_dir="/usr"
-			fi
-		fi
+	if test "$found_dpdk" = yes; then
 		#
-		# The convention appears to be that 1) there's a "dpdk"
-		# subdirectory of the include directory, containing DPDK
-		# headers (at least in the installation on Ubuntu with
-		# the system DPDK packages) and 2) includes of DPDK
-		# headers don't use "dpdk/{header}" (at least from the
-		# way the DPDK documentation is written).
+		# Found it.
 		#
-		# So we add "/dpdk" to the include directory, and always
-		# add that to the list of include directories to search.
+		# We call rte_eth_dev_count_avail(), and older versions
+		# of DPDK didn't have it, so check for it.
 		#
-		dpdk_inc_dir="$dpdk_dir/include/dpdk"
-		dpdk_inc_flags="-I$dpdk_inc_dir"
-		dpdk_lib_dir="$dpdk_dir/lib"
-		#
-		# Handle multiarch systems.
-		#
-		# Step 1: run the C compiler with the -dumpmachine option;
-		# if it succeeds, the output would be the multiarch directory
-		# name if your system has multiarch directories.
-		#
-		multiarch_dir=`$CC -dumpmachine 2>/dev/null`
-		if test ! -z "$multiarch_dir"
-		then
-			#
-			# OK, we have a multiarch directory.
-			#
-			# Now deal with includes.  On Ubuntu 20.04, for
-			# example, we have /usr/include/dpdk *and*
-			# /usr/include/$multiarch_dir/dpdk, and must
-			# search both.
-			#
-			if test -d "$dpdk_dir/include/$multiarch_dir/dpdk"
-			then
-				dpdk_inc_flags="-I$dpdk_dir/include/$multiarch_dir/dpdk $dpdk_inc_flags"
-			fi
-
-			#
-			# Now deal with libraries.
-			#
-			if test -d "$dpdk_lib_dir/$multiarch_dir"
-			then
-				dpdk_lib_dir="$dpdk_lib_dir/$multiarch_dir"
-			fi
-		fi
-		DPDK_MACHINE_CFLAGS="-march=native"
-		DPDK_CFLAGS="$DPDK_MACHINE_CFLAGS $dpdk_inc_flags"
-		DPDK_LDFLAGS="-L$dpdk_lib_dir -ldpdk -lrt -lm -lnuma -ldl -pthread"
-	fi
-
-	save_CFLAGS="$CFLAGS"
-	save_LIBS="$LIBS"
-	save_LDFLAGS="$LDFLAGS"
-	CFLAGS="$CFLAGS $DPDK_CFLAGS"
-	LIBS="$LIBS $DPDK_LDFLAGS"
-	LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
-
-	AC_MSG_CHECKING(whether we can compile the DPDK support)
-	AC_CACHE_VAL(ac_cv_dpdk_can_compile,
-	AC_TRY_COMPILE([
-AC_INCLUDES_DEFAULT
-#include <rte_common.h>],
-	    [],
-	    ac_cv_dpdk_can_compile=yes,
-	    ac_cv_dpdk_can_compile=no))
-	AC_MSG_RESULT($ac_cv_dpdk_can_compile)
-
-	#
-	# We include rte_bus.h, and older versions of DPDK
-	# didn't have it, so check for it.
-	#
-	if test "$ac_cv_dpdk_can_compile" = yes; then
-		#
-		# This runs the preprocessor, so make sure it
-		# looks in the DPDK directories.  Instead of
-		# including dpdk/XXX.h, we include just XXX.h
-		# and assume DPDK_CFLAGS is the directory
-		# containing the DPDK headers (that's how
-		# pkg-config sets it, at least on Ubuntu),
-		# so just looking under /usr/include won't
-		# find it.
-		#
-		save_CPPFLAGS="$CPPFLAGS"
-		CPPFLAGS="$CPPFLAGS $DPDK_CFLAGS"
-		AC_CHECK_HEADER(rte_bus.h)
-		CPPFLAGS="$save_CPPFLAGS"
-	fi
-
-	#
-	# We call rte_eth_dev_count_avail(), and older versions
-	# of DPDK didn't have it, so check for it.
-	#
-	if test "$ac_cv_header_rte_bus_h" = yes; then
+		AC_LBL_SAVE_CHECK_STATE
+		CFLAGS="$CFLAGS $DPDK_CFLAGS"
+		LIBS="$LIBS $DPDK_LIBS"
 		AC_CHECK_FUNC(rte_eth_dev_count_avail)
+		AC_LBL_RESTORE_CHECK_STATE
 	fi
 
-	CFLAGS="$save_CFLAGS"
-	LIBS="$save_LIBS"
-	LDFLAGS="$save_LDFLAGS"
-
 	if test "$ac_cv_func_rte_eth_dev_count_avail" = yes; then
-		CFLAGS="$CFLAGS $DPDK_CFLAGS"
-		LIBS="$LIBS $DPDK_LDFLAGS"
-		LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
-		V_INCLS="$V_INCLS $DPDK_CFLAGS"
-		AC_DEFINE(PCAP_SUPPORT_DPDK, 1, [target host supports DPDK])
-		if test $V_PCAP != dpdk ; then
-			MODULE_C_SRC="$MODULE_C_SRC pcap-dpdk.c"
-		fi
-
+		#
+		# We found a usable DPDK.
 		#
 		# Check whether the rte_ether.h file defines
 		# struct ether_addr or struct rte_ether_addr.
 		#
 		# ("API compatibility?  That's for losers!")
 		#
+		AC_LBL_SAVE_CHECK_STATE
+		CFLAGS="$CFLAGS $DPDK_CFLAGS"
+		LIBS="$LIBS $DPDK_LIBS"
 		AC_CHECK_TYPES(struct rte_ether_addr,,,
 		    [
 			#include <rte_ether.h>
 		    ])
-	else
-		if test "$V_PCAP" = dpdk; then
-			# User requested DPDK-only capture support, but
-			# we couldn't the DPDK API support at all, or we
-			# found it but it wasn't a sufficiently recent
-			# version.
-			if test "$ac_cv_dpdk_can_compile" != yes; then
-				#
-				# Couldn't even find the headers.
-				#
-				AC_MSG_ERROR([DPDK support requested with --with-pcap=dpdk, but the DPDK headers weren't found at $dpdk_inc_dir: make sure the DPDK support is installed, specify a different path or paths if necessary, or don't request DPDK support])
-			else
-				#
-				# Found the headers, but we couldn't find
-				# rte_bus.h or rte_eth_dev_count_avail(),
-				# we don't have a sufficiently recent
-				# version of DPDK.
-				#
-				AC_MSG_ERROR([DPDK support requested with --with-pcap=dpdk, but we require DPDK 18.x or later; install a newer version of DPDK, or don't request DPDK support])
-			fi
-		fi
+		AC_LBL_RESTORE_CHECK_STATE
 
-		if test "$want_dpdk" = yes; then
-			# User requested DPDK-only capture support, but
-			# we couldn't the DPDK API support at all, or we
-			# found it but it wasn't a sufficiently recent
-			# version.
-			if test "$ac_cv_dpdk_can_compile" != yes; then
+		#
+		# We can build with DPDK.
+		#
+		V_INCLS="$V_INCLS $DPDK_CFLAGS"
+		ADDITIONAL_LIBS="$ADDITIONAL_LIBS $DPDK_LIBS"
+		ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $DPDK_LIBS_STATIC"
+		REQUIRES_PRIVATE="$REQUIRES_PRIVATE libdpdk"
+		AC_DEFINE(PCAP_SUPPORT_DPDK, 1, [target host supports DPDK])
+		if test $V_PCAP != dpdk ; then
+			MODULE_C_SRC="$MODULE_C_SRC pcap-dpdk.c"
+		fi
+	else
+		#
+		# We didn't find a usable DPDK.
+		# If we required it (with --with-dpdk or --with-pcap=dpdk),
+		# fail with an appropriate message telling the user what
+		# the problem was, otherwise note the problem with a
+		# warning.
+		#
+		if test "$found_dpdk" != yes; then
+			#
+			# Not found with pkg-config.  Note that we
+			# require that DPDK must be findable with
+			# pkg-config.
+			#
+			if test "$V_PCAP" = dpdk; then
 				#
-				# Couldn't even find the headers.
+				# User requested DPDK-only capture support.
 				#
-				AC_MSG_ERROR([DPDK support requested with --with-pcap=dpdk, but the DPDK headers weren't found at $dpdk_inc_dir: make sure the DPDK support is installed, specify a different path or paths if necessary, or don't request DPDK support])
-			else
-				#
-				# Found the headers, but we couldn't find
-				# rte_bus.h or rte_eth_dev_count_avail(),
-				# we don't have a sufficiently recent
-				# version of DPDK.
-				#
-				AC_MSG_ERROR([DPDK support requested with --with-pcap=dpdk, but we require DPDK 18.x or later: install a newer version of DPDK, or don't request DPDK support])
+				AC_MSG_ERROR(
+[DPDK support requested with --with-pcap=dpdk, but
+we couldn't find DPDK with pkg-config.  Make sure that pkg-config is
+installed, that DPDK 18.02.2 or later is installed, and that DPDK
+provides a .pc file.])
 			fi
+
+			if test "$want_dpdk" = yes; then
+				#
+				# User requested that libpcap include
+				# DPDK capture support.
+				#
+				AC_MSG_ERROR(
+[DPDK support requested with --with-dpdk, but we
+couldn't find DPDK with pkg-config.  Make sure that pkg-config
+is installed, that DPDK 18.02.2 or later is installed, and that
+DPDK provides .pc file.])
+			fi
+
+			#
+			# User didn't indicate whether they wanted DPDK
+			# or not; just warn why we didn't find it.
+			#
+			AC_MSG_WARN(
+[We couldn't find DPDK with pkg-config.  If
+you want DPDK support, make sure that pkg-config is installed,
+that DPDK 18.02.2 or later is installed, and that DPDK provides a
+.pc file.])
+		elif test "$ac_cv_func_rte_eth_dev_count_avail" != yes; then
+			#
+			# Found with pkg-config, but we couldn't compile
+			# a program that calls rte_eth_dev_count(); we
+			# probably have the developer package installed,
+			# but don't have a sufficiently recent version
+			# of DPDK.  Note that we need a sufficiently
+			# recent version of DPDK.
+			#
+			if test "$V_PCAP" = dpdk; then
+				#
+				# User requested DPDK-only capture support.
+				#
+				AC_MSG_ERROR(
+[DPDK support requested with --with-pcap=dpdk, but we
+can't compile libpcap with DPDK.  Make sure that DPDK 18.02.2 or later
+is installed.])
+			fi
+
+			if test "$want_dpdk" = yes; then
+				#
+				# User requested that libpcap include
+				# DPDK capture support.
+				#
+				AC_MSG_ERROR(
+[DPDK support requested with --with-dpdk, but
+we can't compile libpcap with DPDK.  Make sure that DPDK 18.02.2
+or later is DPDK is installed.])
+			fi
+
+			#
+			# User didn't indicate whether they wanted DPDK
+			# or not; just warn why we didn't find it.
+			#
+			AC_MSG_WARN(
+[DPDK was found, but we can't compile libpcap with it.
+Make sure that DPDK 18.02.2 or later is installed.])
 		fi
 	fi
 fi
 AC_SUBST(PCAP_SUPPORT_DPDK)
 
 AC_ARG_ENABLE([bluetooth],
-[AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
+[AS_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
     [],
     [enable_bluetooth=ifsupportavailable])
 
@@ -2710,7 +2949,7 @@
 fi
 
 AC_ARG_ENABLE([dbus],
-[AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
+[AS_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
     [],
     [enable_dbus=ifavailable])
 
@@ -2753,51 +2992,47 @@
 fi
 
 if test "x$enable_dbus" != "xno"; then
-	if test "x$PKGCONFIG" != "xno"; then
-		AC_MSG_CHECKING([for D-Bus])
-		if "$PKGCONFIG" dbus-1; then
+	PKG_CHECK_MODULES(DBUS, dbus-1,
+	    [
+		AC_LBL_SAVE_CHECK_STATE
+		CFLAGS="$CFLAGS $DBUS_CFLAGS"
+		LIBS="$LIBS $DBUS_LIBS"
+		AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
+		AC_TRY_LINK(
+		    [#include <string.h>
+
+		     #include <time.h>
+		     #include <sys/time.h>
+
+		     #include <dbus/dbus.h>],
+		    [return dbus_connection_read_write(NULL, 0);],
+		    [
 			AC_MSG_RESULT([yes])
-			DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
-			DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
-			save_CFLAGS="$CFLAGS"
-			save_LIBS="$LIBS"
-			CFLAGS="$CFLAGS $DBUS_CFLAGS"
-			LIBS="$LIBS $DBUS_LIBS"
-			AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
-			AC_TRY_LINK(
-			    [#include <string.h>
-
-			     #include <time.h>
-			     #include <sys/time.h>
-
-			     #include <dbus/dbus.h>],
-			    [return dbus_connection_read_write(NULL, 0);],
-			    [
-				AC_MSG_RESULT([yes])
-				AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
-				MODULE_C_SRC="$MODULE_C_SRC pcap-dbus.c"
-				V_INCLS="$V_INCLS $DBUS_CFLAGS"
-			    ],
-			    [
-				AC_MSG_RESULT([no])
-				if test "x$enable_dbus" = "xyes"; then
-				    AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
-				fi
-				LIBS="$save_LIBS"
-			     ])
-			CFLAGS="$save_CFLAGS"
-		else
+			AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
+			MODULE_C_SRC="$MODULE_C_SRC pcap-dbus.c"
+			V_INCLS="$V_INCLS $DBUS_CFLAGS"
+			ADDITIONAL_LIBS="$ADDITIONAL_LIBS $DBUS_LIBS"
+			ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $DBUS_LIBS_STATIC"
+			REQUIRES_PRIVATE="$REQUIRES_PRIVATE dbus-1"
+		    ],
+		    [
 			AC_MSG_RESULT([no])
 			if test "x$enable_dbus" = "xyes"; then
-				AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
+			    AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
 			fi
+		     ])
+		AC_LBL_RESTORE_CHECK_STATE
+	    ],
+	    [
+		if test "x$enable_dbus" = "xyes"; then
+			AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
 		fi
-	fi
+	    ])
 	AC_SUBST(PCAP_SUPPORT_DBUS)
 fi
 
 AC_ARG_ENABLE([rdma],
-[AC_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
+[AS_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
     [],
     [enable_rdma=ifavailable])
 
@@ -2808,7 +3043,33 @@
 fi
 
 if test "x$enable_rdma" != "xno"; then
-	AC_CHECK_LIB(ibverbs, ibv_get_device_list, [
+	PKG_CHECK_MODULES(LIBIBVERBS, libibverbs,
+	    [
+		found_libibverbs=yes
+		LIBIBVERBS_REQUIRES_PRIVATE="libibverbs"
+	    ])
+
+	if test "x$found_libibverbs" != "xyes"; then
+		AC_CHECK_LIB(ibverbs, ibv_get_device_list,
+		    [
+			found_libibverbs=yes
+			LIBIBVERBS_CFLAGS=""
+			LIBIBVERBS_LIBS="-libverbs"
+			# XXX - at least on Ubuntu 20.04, there are many more
+			# libraries needed; is there any platform where
+			# libibverbs is available but where pkg-config isn't
+			# available or libibverbs doesn't use it?  If not,
+			# we should only use pkg-config for it.
+			LIBIBVERBS_LIBS_STATIC="-libverbs"
+			LIBIBVERBS_LIBS_PRIVATE="-libverbs"
+		    ]
+		)
+	fi
+
+	if test "x$found_libibverbs" = "xyes"; then
+		AC_LBL_SAVE_CHECK_STATE
+		CFLAGS="$CFLAGS $LIBIBVERBS_CFLAGS"
+		LIBS="$LIBS $LIBIBVERBS_LIBS"
 		AC_CHECK_HEADER(infiniband/verbs.h, [
 			#
 			# ibv_create_flow may be defined as a static inline
@@ -2832,27 +3093,115 @@
 				],
 				[
 					AC_MSG_RESULT([yes])
-					AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing])
-					MODULE_C_SRC="$MODULE_C_SRC pcap-rdmasniff.c"
-					LIBS="-libverbs $LIBS"
+					found_usable_libibverbs=yes
 				],
 				[
 					AC_MSG_RESULT([no])
 				]
 			)
 		])
-	])
+		AC_LBL_RESTORE_CHECK_STATE
+	fi
+
+	if test "x$found_usable_libibverbs" = "xyes"
+	then
+		AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing])
+		MODULE_C_SRC="$MODULE_C_SRC pcap-rdmasniff.c"
+		CFLAGS="$LIBIBVERBS_CFLAGS $CFLAGS"
+		ADDITIONAL_LIBS="$LIBIBVERBS_LIBS $ADDITIONAL_LIBS"
+		ADDITIONAL_LIBS_STATIC="$LIBIBVERBS_LIBS_STATIC $ADDITIONAL_LIBS_STATIC"
+		LIBS_PRIVATE="$LIBIBVERBS_LIBS_PRIVATE $LIBS_PRIVATE"
+		REQUIRES_PRIVATE="$REQUIRES_PRIVATE $LIBIBVERBS_REQUIRES_PRIVATE"
+	fi
 	AC_SUBST(PCAP_SUPPORT_RDMASNIFF)
 fi
 
+#
+# If this is a platform where we need to have the .pc file and
+# pcap-config script supply an rpath option to specify the directory
+# in which the libpcap shared library is installed, and the install
+# prefix /usr (meaning we're not installing a system library), provide
+# the rpath option.
+#
+# (We must check $prefix, as $libdir isn't necessarily /usr/lib in this
+# case - for example, Linux distributions for 64-bit platforms that
+# also provide support for binaries for a 32-bit version of the
+# platform may put the 64-bit libraries, the 32-bit libraries, or both
+# in directories other than /usr/lib.)
+#
+# In AIX, do we have to do this?
+#
+# In Darwin-based OSes, the full paths of the shared libraries with
+# which the program was linked are stored in the executable, so we don't
+# need to provide an rpath option.
+#
+# With the HP-UX linker, directories specified with -L are, by default,
+# added to the run-time search path, so we don't need to supply them.
+#
+# For Tru64 UNIX, "-rpath" works with DEC's^WCompaq's^WHP's C compiler
+# for Alpha, but isn't documented as working with GCC, and no GCC-
+# compatible option is documented as working with the DEC compiler.
+# If anybody needs this on Tru64/Alpha, they're welcome to figure out a
+# way to make it work.
+#
+# This must *not* depend on the compiler, as, on platforms where there's
+# a GCC-compatible compiler and a vendor compiler, we need to work with
+# both.
+#
+if test "$prefix" != "/usr"; then
+	case "$host_os" in
+
+	freebsd*|netbsd*|openbsd*|dragonfly*|linux*|haiku*|midipix*|gnu*)
+		#
+		# Platforms where the "native" C compiler is GCC or
+		# accepts compatible command-line arguments, and the
+		# "native" linker is the GNU linker or accepts
+		# compatible command-line arguments.
+		#
+		RPATH="-Wl,-rpath,\${libdir}"
+		;;
+
+	solaris*)
+		#
+		# Sun/Oracle's linker, the GNU linker, and
+		# GNU-compatible linkers all support -R.
+		#
+		RPATH="-Wl,-R,\${libdir}"
+		;;
+	esac
+fi
+
 AC_PROG_INSTALL
 
 AC_CONFIG_HEADER(config.h)
 
+AC_SUBST(V_SHLIB_CCOPT)
+AC_SUBST(V_SHLIB_CMD)
+AC_SUBST(V_SHLIB_OPT)
+AC_SUBST(V_SONAME_OPT)
+AC_SUBST(RPATH)
+AC_SUBST(ADDLOBJS)
+AC_SUBST(ADDLARCHIVEOBJS)
+AC_SUBST(PLATFORM_C_SRC)
+AC_SUBST(PLATFORM_CXX_SRC)
+AC_SUBST(MODULE_C_SRC)
+AC_SUBST(REMOTE_C_SRC)
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(BUILD_RPCAPD)
+AC_SUBST(INSTALL_RPCAPD)
+AC_SUBST(RPCAPD_LIBS)
+
+#
+# We're done with configuration operations; add ADDITIONAL_LIBS and
+# ADDITIONAL_LIBS_STATIC to LIBS and LIBS_STATIC, respectively.
+#
+LIBS="$ADDITIONAL_LIBS $LIBS"
+LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $LIBS_STATIC"
+
 AC_OUTPUT_COMMANDS([if test -f .devel; then
 	echo timestamp > stamp-h
 	cat $srcdir/Makefile-devel-adds >> Makefile
-	make depend
+	make depend || exit 1
 fi])
 AC_OUTPUT(Makefile grammar.y pcap-filter.manmisc pcap-linktype.manmisc
 	pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
diff --git a/diag-control.h b/diag-control.h
index 47d31b9..ae2641b 100644
--- a/diag-control.h
+++ b/diag-control.h
@@ -37,12 +37,12 @@
 
 #include "pcap/compiler-tests.h"
 
-#ifndef _MSC_VER
+#if PCAP_IS_AT_LEAST_CLANG_VERSION(2,8) || PCAP_IS_AT_LEAST_GNUC_VERSION(4,6)
   /*
    * Clang and GCC both support this way of putting pragmas into #defines.
-   * We don't use it unless we have a compiler that supports it; the
-   * warning-suppressing pragmas differ between Clang and GCC, so we test
-   * for both of those separately.
+   * We use it only if we have a compiler that supports it; see below
+   * for the code that uses it and the #defines that control whether
+   * that code is used.
    */
   #define PCAP_DO_PRAGMA(x) _Pragma (#x)
 #endif
@@ -86,7 +86,51 @@
 /*
  * Suppress Flex, narrowing, and deprecation warnings.
  */
-#if defined(_MSC_VER)
+#if PCAP_IS_AT_LEAST_CLANG_VERSION(2,8)
+  /*
+   * This is Clang 2.8 or later; we can use "clang diagnostic
+   * ignored -Wxxx" and "clang diagnostic push/pop".
+   *
+   * Suppress -Wdocumentation warnings; GCC doesn't support -Wdocumentation,
+   * at least according to the GCC 7.3 documentation.  Apparently, Flex
+   * generates code that upsets at least some versions of Clang's
+   * -Wdocumentation.
+   *
+   * (This could be clang-cl, which defines _MSC_VER, so test this
+   * before testing _MSC_VER.)
+   */
+  #define DIAG_OFF_FLEX \
+    PCAP_DO_PRAGMA(clang diagnostic push) \
+    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wsign-compare") \
+    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wdocumentation") \
+    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshorten-64-to-32") \
+    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wmissing-noreturn") \
+    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunused-parameter") \
+    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
+  #define DIAG_ON_FLEX \
+    PCAP_DO_PRAGMA(clang diagnostic pop)
+
+  /*
+   * Suppress the only narrowing warnings you get from Clang.
+   */
+  #define DIAG_OFF_NARROWING \
+    PCAP_DO_PRAGMA(clang diagnostic push) \
+    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshorten-64-to-32")
+
+  #define DIAG_ON_NARROWING \
+    PCAP_DO_PRAGMA(clang diagnostic pop)
+
+  /*
+   * Suppress deprecation warnings.
+   */
+  #define DIAG_OFF_DEPRECATION \
+    PCAP_DO_PRAGMA(clang diagnostic push) \
+    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wdeprecated-declarations")
+  #define DIAG_ON_DEPRECATION \
+    PCAP_DO_PRAGMA(clang diagnostic pop)
+  #define DIAG_OFF_FORMAT_TRUNCATION
+  #define DIAG_ON_FORMAT_TRUNCATION
+#elif defined(_MSC_VER)
   /*
    * This is Microsoft Visual Studio; we can use __pragma(warning(disable:XXXX))
    * and __pragma(warning(push/pop)).
@@ -121,45 +165,8 @@
     __pragma(warning(disable:4996))
   #define DIAG_ON_DEPRECATION \
     __pragma(warning(pop))
-#elif PCAP_IS_AT_LEAST_CLANG_VERSION(2,8)
-  /*
-   * This is Clang 2.8 or later; we can use "clang diagnostic
-   * ignored -Wxxx" and "clang diagnostic push/pop".
-   *
-   * Suppress -Wdocumentation warnings; GCC doesn't support -Wdocumentation,
-   * at least according to the GCC 7.3 documentation.  Apparently, Flex
-   * generates code that upsets at least some versions of Clang's
-   * -Wdocumentation.
-   */
-  #define DIAG_OFF_FLEX \
-    PCAP_DO_PRAGMA(clang diagnostic push) \
-    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wsign-compare") \
-    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wdocumentation") \
-    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshorten-64-to-32") \
-    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wmissing-noreturn") \
-    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunused-parameter") \
-    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
-  #define DIAG_ON_FLEX \
-    PCAP_DO_PRAGMA(clang diagnostic pop)
-
-  /*
-   * Suppress the only narrowing warnings you get from Clang.
-   */
-  #define DIAG_OFF_NARROWING \
-    PCAP_DO_PRAGMA(clang diagnostic push) \
-    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshorten-64-to-32")
-
-  #define DIAG_ON_NARROWING \
-    PCAP_DO_PRAGMA(clang diagnostic pop)
-
-  /*
-   * Suppress deprecation warnings.
-   */
-  #define DIAG_OFF_DEPRECATION \
-    PCAP_DO_PRAGMA(clang diagnostic push) \
-    PCAP_DO_PRAGMA(clang diagnostic ignored "-Wdeprecated-declarations")
-  #define DIAG_ON_DEPRECATION \
-    PCAP_DO_PRAGMA(clang diagnostic pop)
+  #define DIAG_OFF_FORMAT_TRUNCATION
+  #define DIAG_ON_FORMAT_TRUNCATION
 #elif PCAP_IS_AT_LEAST_GNUC_VERSION(4,6)
   /*
    * This is GCC 4.6 or later, or a compiler claiming to be that.
@@ -188,6 +195,22 @@
     PCAP_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
   #define DIAG_ON_DEPRECATION \
     PCAP_DO_PRAGMA(GCC diagnostic pop)
+
+  /*
+   * Suppress format-truncation= warnings.
+   * GCC 7.1 had introduced this warning option. Earlier versions (at least
+   * one particular copy of GCC 4.6.4) treat the request as a warning.
+   */
+  #if PCAP_IS_AT_LEAST_GNUC_VERSION(7,1)
+    #define DIAG_OFF_FORMAT_TRUNCATION \
+      PCAP_DO_PRAGMA(GCC diagnostic push) \
+      PCAP_DO_PRAGMA(GCC diagnostic ignored "-Wformat-truncation=")
+    #define DIAG_ON_FORMAT_TRUNCATION \
+      PCAP_DO_PRAGMA(GCC diagnostic pop)
+  #else
+   #define DIAG_OFF_FORMAT_TRUNCATION
+   #define DIAG_ON_FORMAT_TRUNCATION
+  #endif
 #else
   /*
    * Neither Visual Studio, nor Clang 2.8 or later, nor GCC 4.6 or later
@@ -200,6 +223,8 @@
   #define DIAG_ON_NARROWING
   #define DIAG_OFF_DEPRECATION
   #define DIAG_ON_DEPRECATION
+  #define DIAG_OFF_FORMAT_TRUNCATION
+  #define DIAG_ON_FORMAT_TRUNCATION
 #endif
 
 #ifdef YYBYACC
@@ -219,21 +244,21 @@
    * In addition, the generated code may have functions with unreachable
    * code, so suppress warnings about those.
    */
-  #if defined(_MSC_VER)
+  #if PCAP_IS_AT_LEAST_CLANG_VERSION(2,8)
+    /*
+     * This is Clang 2.8 or later (including clang-cl, so test this
+     * before _MSC_VER); we can use "clang diagnostic ignored -Wxxx".
+     */
+    #define DIAG_OFF_BISON_BYACC \
+      PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshadow") \
+      PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
+  #elif defined(_MSC_VER)
     /*
      * This is Microsoft Visual Studio; we can use
      * __pragma(warning(disable:XXXX)).
      */
     #define DIAG_OFF_BISON_BYACC \
       __pragma(warning(disable:4702))
-  #elif PCAP_IS_AT_LEAST_CLANG_VERSION(2,8)
-    /*
-     * This is Clang 2.8 or later; we can use "clang diagnostic
-     * ignored -Wxxx".
-     */
-    #define DIAG_OFF_BISON_BYACC \
-      PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshadow") \
-      PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
   #elif PCAP_IS_AT_LEAST_GNUC_VERSION(4,6)
     /*
      * This is GCC 4.6 or later, or a compiler claiming to be that.
@@ -257,7 +282,14 @@
    * The generated code may have functions with unreachable code and
    * switches with only a default case, so suppress warnings about those.
    */
-  #if defined(_MSC_VER)
+  #if PCAP_IS_AT_LEAST_CLANG_VERSION(2,8)
+    /*
+     * This is Clang 2.8 or later (including clang-cl, so test this
+     * before _MSC_VER); we can use "clang diagnostic ignored -Wxxx".
+     */
+    #define DIAG_OFF_BISON_BYACC \
+      PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
+  #elif defined(_MSC_VER)
     /*
      * This is Microsoft Visual Studio; we can use
      * __pragma(warning(disable:XXXX)).
@@ -270,13 +302,6 @@
       __pragma(warning(disable:4242)) \
       __pragma(warning(disable:4244)) \
       __pragma(warning(disable:4702))
-  #elif PCAP_IS_AT_LEAST_CLANG_VERSION(2,8)
-    /*
-     * This is Clang 2.8 or later; we can use "clang diagnostic
-     * ignored -Wxxx".
-     */
-    #define DIAG_OFF_BISON_BYACC \
-      PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
   #elif PCAP_IS_AT_LEAST_GNUC_VERSION(4,6)
     /*
      * This is GCC 4.6 or later, or a compiler claiming to be that.
@@ -294,4 +319,20 @@
   #endif
 #endif
 
+/*
+ * GCC needs this on AIX for longjmp().
+ */
+#if PCAP_IS_AT_LEAST_GNUC_VERSION(5,1)
+  /*
+   * Beware that the effect of this builtin is more than just squelching the
+   * warning! GCC trusts it enough for the process to segfault if the control
+   * flow reaches the builtin (an infinite empty loop in the same context would
+   * squelch the warning and ruin the process too, albeit in a different way).
+   * So please remember to use this very carefully.
+   */
+  #define PCAP_UNREACHABLE __builtin_unreachable();
+#else
+  #define PCAP_UNREACHABLE
+#endif
+
 #endif /* _diag_control_h */
diff --git a/dlpisubs.c b/dlpisubs.c
index 2ef0931..6815b0e 100644
--- a/dlpisubs.c
+++ b/dlpisubs.c
@@ -146,7 +146,12 @@
 #endif
 #endif
 
-	/* Loop through packets */
+	/*
+	 * Loop through packets.
+	 *
+	 * This assumes that a single buffer of packets will have
+	 * <= INT_MAX packets, so the packet count doesn't overflow.
+	 */
 	ep = bufp + len;
 	n = 0;
 
diff --git a/doc/DLT_ALLOCATE_HOWTO.md b/doc/DLT_ALLOCATE_HOWTO.md
deleted file mode 100644
index ff77128..0000000
--- a/doc/DLT_ALLOCATE_HOWTO.md
+++ /dev/null
@@ -1,29 +0,0 @@
-DLT and LINKTYPE allocation
-===========================
-
-DLT_ types live in pcap/dlt.h.  They can be requested by the community on a
-First-Come First-Served basis [i.e. https://tools.ietf.org/html/rfc8126#section-4.4 ]
-(Although libpcap is not at this time an IETF specification, there have been
-some as yet-incomplete efforts to do this).
-
-The Tcpdump Group prefers to link to an open specification on the new DLT_
-type,  but they are available for closed, proprietary projects as well.
-In that case, a stable email address suffices so that someone who finds
-an unknown DLT_ type can investigate.
-We prefer to give out unambiguous numbers, and we try to do it as quickly
-as possible, but DLT_USERx is available while you wait.
-
-Note that DLT_ types are, in theory, private to the capture mechanism and can
-in some cases be operating system specific, and so a second set of values,
-LINKTYPE_ is allocated for actually writing to pcap files.  As much as
-possible going forward, the DLT_ and LINKTYPE_ value are identical, however,
-this was not always the case.  See pcap-common.c.
-
-The LINKTYPE_ values are not exported, but are in pcap-common.c only.
-
-DEVELOPER NOTES
----------------
-
-When allocating a new DLT_ value, a corresponding value needs to be
-added to pcap-common.c.
-It is not necessary to copy the comments from dlt.h to pcap-common.c.
diff --git a/doc/README.Win32.md b/doc/README.Win32.md
index 626f89b..0187965 100644
--- a/doc/README.Win32.md
+++ b/doc/README.Win32.md
@@ -28,7 +28,7 @@
 
 Npcap and its SDK can be downloaded from its home page:
 
-  https://npcap.org
+  https://npcap.com
 
 The SDK is a ZIP archive; create a folder on your C: drive, e.g.
 C:\npcap-sdk, and put the contents of the ZIP archive into that folder.
@@ -101,7 +101,7 @@
 
 For Visual Studio 2017, make sure "Visual C++ tools for CMake" is
 installed; for Visual Studio 2019, make sure "C++ CMake tools for
-Windows" is intalled.
+Windows" is installed.
 
 ### winflexbison ###
 
diff --git a/doc/README.aix b/doc/README.aix
index 9e9a23d..8689994 100644
--- a/doc/README.aix
+++ b/doc/README.aix
@@ -1,3 +1,25 @@
+# Compiling libpcap on AIX
+
+* Autoconf is expected to work everywhere.
+* Neither AIX lex nor AIX yacc nor AIX m4 are suitable.
+
+## AIX 7.1
+
+* libpcap build fails with rpcapd enabled.
+* GNU M4 1.4.17 works.
+* flex 2.6.4 and GNU Bison 3.5.1 work.
+* CMake 3.16.0 works.
+* GCC 8.3.0 works, XL C 12.1.0 works.
+
+## AIX 7.2
+
+* libpcap build fails with rpcapd enabled.
+* GNU M4 1.4.17 works.
+* flex 2.5.35 and GNU Bison 3.0.4 work.
+* GCC 7.2.0 works, XL C 13.1.3 works.
+
+## Other AIX-related information
+
 Using BPF:
 
 (1) AIX 4.x's version of BPF is undocumented and somewhat unstandard; the
diff --git a/doc/README.capture-module b/doc/README.capture-module
deleted file mode 100644
index e13eaf3..0000000
--- a/doc/README.capture-module
+++ /dev/null
@@ -1,353 +0,0 @@
-		    How to write a libpcap module
-
-WARNING: this document describes an unstable interface; future releases
-of libpcap may, and some probably will, change the interface in an
-incompatible fashion.  If you submit your module to the libpcap
-developers for inclusion in libpcap, not only does that make it more
-likely that it will be available in the libpcap provided by operating
-system vendors (such as Linux distributions), but it also means that we
-will attempt to update it to handle future changes to this interface.
-If we add new capabilities, we may have to ask you how to provide those
-additional capabilities if you're using an underlying mechanism for
-which we have neither the source code nor the documentation.
-
-NOTE: this document assumes familiarity with the entire libpcap API.
-
-TODO: more routines, more stuff that the activate routine has to do
-(such as setting the list of DLT_s), convert to Markdown?
-
-On Linux, *BSD, macOS, Solaris, AIX, HP-UX, IRIX, and Tru64 UNIX,
-Libpcap supports capturing on network interfaces as supported by the
-operating system networking stack, using the native packet capture
-mechanism provided by the OS.  On Windows, it supports it with the help
-of the driver and library supplied by WinPcap and Npcap.
-
-In addition, it also supports capturing on other types of devices, such
-as:
-
-	specialized capture cards, such as Endace DAG cards;
-
-	network adapters that provide special high-performance code
-	paths, such as CSPI Myricom adapters;
-
-	buses such as USB;
-
-	software communication channels such as D-Bus and Linux netlink;
-
-	etc..
-
-Support for those devices is provided by modules compiled into libpcap.
-
-If you want to add such a module, you would first have to check the list
-of link-layer header types supported by libpcap, to see if one of those
-would be sufficient for your device.  The current version of the list
-can be found at
-
-	https://www.tcpdump.org/linktypes.html
-
-If none of those would work for your device, please read
-doc/DLT_ALLOCATE_HOWTO.md and the introductory paragraphs on the Web
-page mentioned above, and then send a request for the new link-layer
-header type to tcpdump-workers@lists.tcpdump.org.
-
-Once you have a link-layer header type value or values that you can use,
-you can add new module.
-
-The module should be a C source file, with a name of the form
-pcap-{MOD}.c, where {MOD} is a name appropriate for your device; for
-example, the support for DAG cards is in pcap-dag.c, and the support for
-capturing USB traffic on Linux is pcap-usb-linux.c.
-
-Your module is assumed to support one or more named devices.  The names
-should be relatively short names, containing only lower-case
-alphanumeric characters, consisting of a prefix that ends with an
-alphabetic character and, if there can be more than one device instance,
-possibly followed by a numerical device ID, such as "mydevice" or
-"mydevice0"/"mydevice1"/....  If you have more than one type of device
-that you can support, you can have more than one prefix, each of which
-can be followed by a numerical device ID.
-
-The two exported functions that your module must provide are routines to
-provide a list of device instances and a program to initialize a
-created-but-not-activated pcap_t for an instance of one of your devices.
-
-The "list of device instances" routine takes, as arguments:
-
-	a pointer to a pcap_if_list_t;
-
-	a pointer to an error message buffer.
-
-The error message buffer may be assumed to be PCAP_ERRBUF_SIZE bytes
-large, but must not be assumed to be larger.  By convention, the routine
-typically has a name containing "findalldevs".
-
-The routine should attempt to determine what device instances are
-available and add them to the list pointed to by the first argument;
-this may be impossible for some modules, but, for those modules, it may
-be difficult to capture on the devices using Wirehshark (although it
-should be possible to capture on them using tcpdump, TShark, or other
-programs that take a device name on the command line), so we recommend
-that your routine provide the list of devices if possible.  If it
-cannot, it should just immediately return 0.
-
-The routine should add devices to the list by calling the add_dev()
-routine in libpcap, declared in the pcap-int.h header.  It takes, as
-arguments:
-
-	the pointer to the pcap_if_list_t passed as an argument to the
-	routine;
-
-	the device name, as described above;
-
-	a 32-bit word of flags, as provided by pcap_findalldevs();
-
-	a text description of the device, or NULL if there is no
-	description;
-
-	the error message buffer pointer provided to the routine.
-
-add_dev() will, if it succeeds, return a pointer to a pcap_if_t that was
-added to the list of devices.  If it fails, it will return NULL; in this
-case, the error message buffer has been filled in with an error string,
-and your routine must return -1 to indicate the error.
-
-If your routine succeeds, it must return 0.  If it fails, it must fill
-in the error message buffer with an error string and return -1.
-
-The "initialize the pcap_t" routine takes, as arguments:
-
-	a pointer to a device name;
-
-	a pointer to an error message buffer;
-
-	a pointer to an int.
-
-It returns a pointer to a pcap_t.
-
-Your module will probably need, for each pcap_t for an opened device, a
-private data structure to maintain its own information about the opened
-device.  These should be allocated per opened instance, not per device;
-if, for example, mydevice0 can be captured on by more than one program
-at the same time, there will be more than one pcap_t opened for
-mydevice0, and so there will be separate private data structures for
-each pcap_t.  If you need to maintain per-device, rather than per-opened
-instance information, you will have to maintain that yourself.
-
-The routine should first check the device to see whether it looks like a
-device that this module would handle; for example, it should begin with
-one of the device name prefixes for your module and, if your devices
-have instance numbers, be followed by a number.  If it is not one of
-those devices, you must set the integer pointed to by the third
-argument to 0, to indicate that this is *not* one of the devices for
-your module, and return NULL.
-
-If it *is* one of those devices, it should call pcap_create_common,
-passing to it the error message buffer as the first argument and the
-size of the per-opened instance data structure as the second argument.
-If it fails, it will return NULL; you must return NULL in this case.
-
-If it succeeds, the pcap_t pointed to by the return value has been
-partially initialized, but you will need to complete the process.  It
-has a "priv" member, which is a void * that points to the private data
-structure attached to it; that structure has been initialized to zeroes.
-
-What you need to set are some function pointers to your routines to
-handle certain operations:
-
-	activate_op
-		the routine called when pcap_activate() is done on the
-		pcap_t
-
-	can_set_rfmon_op
-		the routine called when pcap_can_set_rfmon() is done on
-		the pcap_t - if your device doesn't support 802.11
-		monitor mode, you can leave this as initialized by
-		pcap_create_common(), as that routine will return "no,
-		monitor mode isn't supported".
-
-Once you've set the activate_op and, if necessary, the can_set_rfmon_op,
-you must return the pcap_t * that was returned to you.
-
-Your activate routine takes, as an argument, a pointer to the pcap_t
-being activated, and returns an int.
-
-The perameters set for the device in the pcap_create() call, and after
-that call(), are mostly in the opt member of the pcap_t:
-
-	device
-		the name of the device
-
-	timeout
-		the buffering timeout, in milliseconds
-
-	buffer_size
-		the buffer size to use
-
-	promisc
-		1 if promiscuous mode is to be used, 0 otherwise
-
-	rfmon
-		1 if monitor mode is to be used, 0 otherwise
-
-	immediate
-		1 if the device should be in immediate mode, 0 otherwise
-
-	nonblock
-		1 if the device should be in non-blocking mode, 0
-		otherwise
-
-	tstamp_type
-		the type of time stamp to supply
-
-	tstamp_precision
-		the time stamp precision to supply
-
-The snapshot member of the pcap_t structure will contain the snapshot
-length to be used.
-
-Your routine should attempt to set up the device for capturing.  If it
-fails, it must return an error indication which is one of the PCAP_ERROR
-values.  For PCAP_ERROR, it must also set the errbuf member of the
-pcap_t to an error string.  For PCAP_ERROR_NO_SUCH_DEVICE and
-PCAP_ERROR_PERM_DENIED, it may set it to an error string providing
-additional information that may be useful for debugging, or may just
-leave it as a null string.
-
-If it succeeds, it must set certain function pointers in the pcap_t
-structure:
-
-	read_op
-		called whenever packets are to be read
-
-	inject_op
-		called whenever packets are to be injected
-
-	setfilter_op
-		called whenever pcap_setfilter() is called
-
-	setdirection_op
-		called whenever pcap_setdirection() is called
-
-	set_datalink_op
-		called whnever pcap_set_datalink() is called
-
-	getnonblock_op
-		called whenever pcap_getnonblock() is called
-
-	setnonblock_op
-		called whenever pcap_setnonblock() is called
-
-	stats_op
-		called whenever pcap_stats() is called
-
-	cleanup_op
-		called if the activate routine fails or pcap_close() is
-		called
-
-and must also set the linktype member to the DLT_ value for the device.
-
-On UN*Xes, if the device supports waiting for packets to arrive with
-select()/poll()/epoll()/kqueues etc., it should set the selectable_fd
-member of the structure to the descriptor you would use with those
-calls.  If it does not, then, if that's because the device polls for
-packets rather than receiving interrupts or other signals when packets
-arrive, it should have a struct timeval in the private data structure,
-set the value of that struct timeval to the poll timeout, and set the
-required_select_timeout member of the pcap_t to point to the struct
-timeval.
-
-The read_op routine is called when pcap_dispatch(), pcap_loop(),
-pcap_next(), or pcap_next_ex() is called.  It is passed the same
-arguments as pcap_dispatch() is called.
-
-The routine should first check if the break_loop member of the pcap_t is
-non-zero and, if so, set that member to zero and return
-PCAP_ERROR_BREAK.
-
-Then, if the pcap_t is in blocking mode (as opposed to non-blocking
-mode), and there are no packets immediately available to be passed to
-the callback, it should block waiting for packets to arrive, using the
-buffering timeout, first, and read packets from the device if necessary.
-
-Then it should loop through the available packets, calling the callback
-routine for each packet:
-
-	If the PACKET_COUNT_IS_UNLIMITED() macro evaluates to true when
-	passed the packet count argument, the loop should continue until
-	there are no more packets immediately available or the
-	break_loop member of the pcap_t is non-zero.  If the break_loop
-	member is fount to be non-zero, it should set that member to
-	zero and return PCAP_ERROR_BREAK.
-
-	If it doesn't evaluat to true, then the loop should also
-	terminate if the specified number of packets have been delivered
-	to the callback.
-
-Note that there is *NO* requirement that the packet header or data
-provided to the callback remain available, or valid, after the callback
-routine returns; if the callback needs to save the data for other code
-to use, it must make a copy of that data.  This means that the module is
-free to, for example, overwrite the buffer into which it read the
-packet, or release back to the kernel a packet in a memory-mapped
-buffer shared between the kernel and userland, after the callback
-returns.
-
-If an error occurs when reading packets from the device, it must set the
-errbuf member of the pcap_t to an error string and return PCAP_ERROR.
-
-If no error occurs, it must return the number of packets that were
-supplied to the callback routine.
-
-The inject routine is passed a pointer to the pcap_t, a buffer
-containing the contents of the packet to inject, and the number of bytes
-in the packet.  If the device doesn't support packet injection, the
-routine must set the errbuf member of the pcap_t to a message indicating
-that packet injection isn't supported and return PCAP_ERROR.  Otherwise,
-it should attempt to inject the packet; if the attempt fails, it must
-set the errbuf member of the pcap_t to an error message and return
-PCAP_ERROR.  Otherwise, it should return the number of bytes injected.
-
-The setfilter routine is passed a pointer to the pcap_t and a pointer
-to a struct bpf_program containing a BPF program to be used as a filter.
-If the mechanism used by your module can perform filtering with a BPF
-program, it would attempt to set that filter to the specified program.
-
-If that failed because the program was too large, or used BPF features
-not supported by that mechanism, the module should fall back on
-filtering in userland by saving a copy of the filter with a call to
-install_bpf_program(), setting a flag in the private data instructure
-indicating that filtering is being done by the module and, in the read
-routine's main loop, checking the flag and, if it's set, calling
-pcap_filter(), passing it the fcode.bf_insns member of the pcap_t, the
-raw packet data, the on-the-wire length of the packet, and the captured
-length of the packet, and only passing the packet to the callback
-routine, and counting it, if pcap_filter() returns a non-zero value.
-(If the flag is not set, all packets should be passed to the callback
-routine and counted, as the filtering is being done by the mechanism
-used by the module.)  If install_bpf_program() returns a negative value,
-the routine should return PCAP_ERROR.
-
-If the attempt to set the filter failed for any other reason, the
-routine must set the errbuf member of the pcap_t to an error message and
-return PCAP_ERROR.
-
-If the attempt to set the filter succeeded, or it failed because the
-mechanism used by the module rejected it and the call to
-install_bpf_program() succeeded, the routine should return 0.
-
-If the mechanism the module uses doesn't support filtering, the pointer
-to the setfilter routine can just be set to point to
-install_bpf_program; the module does not need a routine of its own to
-handle that.
-
-The setdirection routine is passed a pointer to the pcap_t and a
-pcap_direction_t indicating which packet directions should be accepted.
-If the module can't arrange to handle only incoming packets or only
-outgoing packets, it can set the pointer to the setdirection routine to
-NULL, and calls to pcap_setdirection() will fail with an error message
-indicating that setting the direction isn't supported.
-
-XXX describe set_datalink, including what the activate routine has to do
-XXX
-
-XXX describe the rest of the routines XXX
diff --git a/doc/README.dag b/doc/README.dag
index 13332c6..fd2c4b7 100644
--- a/doc/README.dag
+++ b/doc/README.dag
@@ -22,7 +22,7 @@
 incorrectly specified or the DAG software was not built before configuring
 libpcap.
 
-See also the libpcap INSTALL.txt file for further libpcap configuration
+See also the libpcap INSTALL.md file for further libpcap configuration
 options.
 
 Building libpcap at this stage will include support for both the native packet
diff --git a/doc/README.hpux b/doc/README.hpux
index b995eee..4b3801b 100644
--- a/doc/README.hpux
+++ b/doc/README.hpux
@@ -195,7 +195,7 @@
 -----------------------------------Cut Here-------------------------------------
 #!/sbin/sh
 #
-# nettune:  hack kernel parms for safety
+# nettune:  hack kernel params for safety
 
 OKAY=0
 ERROR=-1
diff --git a/doc/README.linux b/doc/README.linux
index 143dff6..eba43ae 100644
--- a/doc/README.linux
+++ b/doc/README.linux
@@ -1,7 +1,7 @@
 Currently, libpcap supports packet capturing on Linux 2.6.27 and later;
 earlier versions are not supported.
 
-You must configure 2.26.x kernels with the CONFIG_PACKET_MMAP option for
+You must configure 2.6.x kernels with the CONFIG_PACKET_MMAP option for
 this protocol.  3.x and later kernels do not require that.
 
 Note that, by default, libpcap will, if libnl is present, build with it;
diff --git a/doc/README.septel b/doc/README.septel
index 203ec1a..d7fb5c7 100644
--- a/doc/README.septel
+++ b/doc/README.septel
@@ -25,7 +25,7 @@
 incorrectly specified or the Septel software was not built before configuring
 libpcap.
 
-See also the libpcap INSTALL.txt file for further libpcap configuration
+See also the libpcap INSTALL.md file for further libpcap configuration
 options.
 
 Building libpcap at this stage will include support for both the native
diff --git a/doc/README.sita b/doc/README.sita
index 37003f5..c85e0d8 100644
--- a/doc/README.sita
+++ b/doc/README.sita
@@ -12,7 +12,7 @@
 This might also work on non-Linux Unix-compatible platforms, but that
 has not been tested.
 
-See also the libpcap INSTALL.txt file for further libpcap configuration
+See also the libpcap INSTALL.md file for further libpcap configuration
 options.
 
 These additions/extensions have been made to PCAP to allow it to
diff --git a/doc/README.solaris.md b/doc/README.solaris.md
new file mode 100644
index 0000000..06ba789
--- /dev/null
+++ b/doc/README.solaris.md
@@ -0,0 +1,58 @@
+# Compiling libpcap on Solaris and related OSes
+
+* Autoconf works everywhere.
+* Neither Solaris lex nor Solaris yacc are suitable.
+* Neither illumos lex nor illumos yacc are suitable.
+* Solaris m4 and illumos m4 are suitable.
+
+## OmniOS r151042/AMD64
+
+* flex 2.6.4 and GNU Bison 3.8.2 work.
+* CMake 3.23.1 works.
+* GCC 11.2.0 and Clang 14.0.3 work.
+
+## OpenIndiana 2021.04/AMD64
+
+* flex 2.6.4 and GNU Bison 3.7.6 work.
+* CMake 3.21.1 works.
+* GCC 7.5.0 and GCC 10.3.0 work, Clang 9.0.1 works.
+
+For reference, the tests were done using a system installed from
+`OI-hipster-text-20210430.iso` plus the following packages:
+```shell
+xargs -L1 pkg install <<ENDOFTEXT
+developer/build/autoconf
+developer/parser/bison
+developer/lexer/flex
+developer/build/cmake
+developer/gcc-10
+developer/clang-90
+ENDOFTEXT
+```
+
+## Solaris 11/AMD64
+
+* flex 2.6.4 and GNU Bison 3.7.3 work.
+* CMake 3.21.0 works.
+* Clang 11.0 works, GCC 11.2 works.
+
+For reference, the tests were done using Oracle Solaris 11.4.42.111.0.
+
+## Solaris 11/SPARC
+
+* flex 2.6.4 and GNU Bison 3.7.1 work.
+* CMake 3.14.3 works.
+* Sun C 5.13, Sun C 5.14 and Sun C 5.15 work; GCC 5.5.0 and GCC 7.3.0 work.
+
+## Solaris 10/SPARC
+
+* libpcap build fails with rpcapd enabled.
+* flex 2.6.4 and GNU Bison 3.7.1 work.
+* CMake 3.14.3 works.
+* Sun C 5.13 works, GCC 5.5.0 works.
+
+## Solaris 9/SPARC
+
+* flex 2.5.35 and GNU Bison 3.0.2 work.
+* CMake 2.8.9 does not work.
+* Neither Sun C 5.8 nor Sun C 5.9 work, GCC 4.6.4 works.
diff --git a/doc/README.tru64 b/doc/README.tru64
deleted file mode 100644
index 2420d9e..0000000
--- a/doc/README.tru64
+++ /dev/null
@@ -1,49 +0,0 @@
-The following instructions are applicable to Tru64 UNIX
-(formerly Digital UNIX (formerly DEC OSF/1)) version 4.0, and
-probably to later versions as well; at least some options apply to
-Digital UNIX 3.2 - perhaps all do.
-
-In order to use kernel packet filtering on this system, you have
-to configure it in such a way:
-
-Kernel configuration
---------------------
-
-The packet filtering kernel option must be enabled at kernel
-installation.  If it was not the case, you can rebuild the kernel with
-"doconfig -c" after adding the following line in the kernel
-configuration file (/sys/conf/<HOSTNAME>):
-
-	option PACKETFILTER
-
-or use "doconfig" without any arguments to add the packet filter driver
-option via the kernel option menu (see the system administration
-documentation for information on how to do this).
-
-Device configuration
---------------------
-
-Devices used for packet filtering must be created thanks to
-the following command (executed in the /dev directory):
-
-	./MAKEDEV pfilt
-
-Interface configuration
------------------------
-
-In order to capture all packets on a network, you may want to allow
-applications to put the interface on that network into "local copy"
-mode, so that tcpdump can see packets sent by the host on which it's
-running as well as packets received by that host, and to put the
-interface into "promiscuous" mode, so that tcpdump can see packets on
-the network segment not sent to the host on which it's running, by using
-the pfconfig(1) command:
-
-	pfconfig +c +p <network_device>
-
-or allow application to put any interface into "local copy" or
-"promiscuous" mode by using the command:
-
-	pfconfig +c +p -a
-
-Note: all instructions given require root privileges.
diff --git a/extract.h b/extract.h
index e776a9e..33579b1 100644
--- a/extract.h
+++ b/extract.h
@@ -127,7 +127,7 @@
  * cast the pointer to point to one of those, and fetch through it;
  * the GCC manual doesn't appear to explicitly say that
  * __attribute__((packed)) causes the compiler to generate unaligned-safe
- * code, but it apppears to do so.
+ * code, but it appears to do so.
  *
  * We do this in case the compiler can generate code using those
  * instructions to do an unaligned load and pass stuff to "ntohs()" or
diff --git a/fmtutils.c b/fmtutils.c
index 5c7ddad..2d35762 100644
--- a/fmtutils.c
+++ b/fmtutils.c
@@ -270,13 +270,21 @@
     const char *fmt, ...)
 {
 	va_list ap;
+
+	va_start(ap, fmt);
+	pcap_vfmt_errmsg_for_errno(errbuf, errbuflen, errnum, fmt, ap);
+	va_end(ap);
+}
+
+void
+pcap_vfmt_errmsg_for_errno(char *errbuf, size_t errbuflen, int errnum,
+    const char *fmt, va_list ap)
+{
 	size_t msglen;
 	char *p;
 	size_t errbuflen_remaining;
 
-	va_start(ap, fmt);
-	vsnprintf(errbuf, errbuflen, fmt, ap);
-	va_end(ap);
+	(void)vsnprintf(errbuf, errbuflen, fmt, ap);
 	msglen = strlen(errbuf);
 
 	/*
@@ -378,6 +386,16 @@
     const char *fmt, ...)
 {
 	va_list ap;
+
+	va_start(ap, fmt);
+	pcap_vfmt_errmsg_for_win32_err(errbuf, errbuflen, errnum, fmt, ap);
+	va_end(ap);
+}
+
+void
+pcap_vfmt_errmsg_for_win32_err(char *errbuf, size_t errbuflen, DWORD errnum,
+    const char *fmt, va_list ap)
+{
 	size_t msglen;
 	char *p;
 	size_t errbuflen_remaining;
@@ -385,9 +403,7 @@
 	wchar_t utf_16_errbuf[PCAP_ERRBUF_SIZE];
 	size_t utf_8_len;
 
-	va_start(ap, fmt);
 	vsnprintf(errbuf, errbuflen, fmt, ap);
-	va_end(ap);
 	msglen = strlen(errbuf);
 
 	/*
diff --git a/fmtutils.h b/fmtutils.h
index ba0f66c..4fa3448 100644
--- a/fmtutils.h
+++ b/fmtutils.h
@@ -34,6 +34,8 @@
 #ifndef fmtutils_h
 #define	fmtutils_h
 
+#include <stdarg.h>	/* we declare varargs functions */
+
 #include "pcap/funcattrs.h"
 
 #ifdef __cplusplus
@@ -44,10 +46,14 @@
 
 void	pcap_fmt_errmsg_for_errno(char *, size_t, int,
     PCAP_FORMAT_STRING(const char *), ...) PCAP_PRINTFLIKE(4, 5);
+void	pcap_vfmt_errmsg_for_errno(char *, size_t, int,
+    PCAP_FORMAT_STRING(const char *), va_list) PCAP_PRINTFLIKE(4, 0);
 
 #ifdef _WIN32
 void	pcap_fmt_errmsg_for_win32_err(char *, size_t, DWORD,
     PCAP_FORMAT_STRING(const char *), ...) PCAP_PRINTFLIKE(4, 5);
+void	pcap_vfmt_errmsg_for_win32_err(char *, size_t, DWORD,
+    PCAP_FORMAT_STRING(const char *), va_list) PCAP_PRINTFLIKE(4, 0);
 #endif
 
 #ifdef __cplusplus
diff --git a/ftmacros.h b/ftmacros.h
index 3cd7505..7975463 100644
--- a/ftmacros.h
+++ b/ftmacros.h
@@ -45,7 +45,12 @@
  * namespace to the maximum extent possible"?
  */
 #if defined(sun) || defined(__sun)
-  #define __EXTENSIONS__
+  /*
+   * On Solaris Clang defines __EXTENSIONS__ automatically.
+   */
+  #ifndef __EXTENSIONS__
+    #define __EXTENSIONS__
+  #endif
 
   /*
    * We also need to define _XPG4_2 in order to get
diff --git a/gencode.c b/gencode.c
index efdcb98..87a6e96 100644
--- a/gencode.c
+++ b/gencode.c
@@ -1,4 +1,3 @@
-/*#define CHASE_CHAIN*/
 /*
  * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998
  *	The Regents of the University of California.  All rights reserved.
@@ -24,7 +23,6 @@
 #include <config.h>
 #endif
 
-#include <pcap-types.h>
 #ifdef _WIN32
   #include <ws2tcpip.h>
 #else
@@ -43,25 +41,12 @@
 #include <memory.h>
 #include <setjmp.h>
 #include <stdarg.h>
+#include <stdio.h>
 
 #ifdef MSDOS
 #include "pcap-dos.h"
 #endif
 
-#ifdef HAVE_NET_PFVAR_H
-/*
- * In NetBSD <net/if.h> includes <net/dlt.h>, which is an older version of
- * "pcap/dlt.h" with a lower value of DLT_MATCHING_MAX. Include the headers
- * below before "pcap-int.h", which eventually includes "pcap/dlt.h", which
- * redefines DLT_MATCHING_MAX from what this version of NetBSD has to what
- * this version of libpcap has.
- */
-#include <sys/socket.h>
-#include <net/if.h>
-#include <net/pfvar.h>
-#include <net/if_pflog.h>
-#endif /* HAVE_NET_PFVAR_H */
-
 #include "pcap-int.h"
 
 #include "extract.h"
@@ -73,12 +58,13 @@
 #include "ieee80211.h"
 #include "atmuni31.h"
 #include "sunatmpos.h"
+#include "pflog.h"
 #include "ppp.h"
 #include "pcap/sll.h"
 #include "pcap/ipnet.h"
 #include "arcnet.h"
+#include "diag-control.h"
 
-#include "grammar.h"
 #include "scanner.h"
 
 #if defined(linux)
@@ -475,6 +461,9 @@
 	va_end(ap);
 	longjmp(cstate->top_ctx, 1);
 	/*NOTREACHED*/
+#ifdef _AIX
+	PCAP_UNREACHABLE
+#endif /* _AIX */
 }
 
 static int init_linktype(compiler_state_t *, pcap_t *);
@@ -521,6 +510,7 @@
 static struct block *gen_ether_linktype(compiler_state_t *, bpf_u_int32);
 static struct block *gen_ipnet_linktype(compiler_state_t *, bpf_u_int32);
 static struct block *gen_linux_sll_linktype(compiler_state_t *, bpf_u_int32);
+static struct slist *gen_load_pflog_llprefixlen(compiler_state_t *);
 static struct slist *gen_load_prism_llprefixlen(compiler_state_t *);
 static struct slist *gen_load_avs_llprefixlen(compiler_state_t *);
 static struct slist *gen_load_radiotap_llprefixlen(compiler_state_t *);
@@ -574,7 +564,9 @@
     bpf_u_int32, int);
 static struct block *gen_portrange6(compiler_state_t *, u_int, u_int, int, int);
 static int lookup_proto(compiler_state_t *, const char *, int);
+#if !defined(NO_PROTOCHAIN)
 static struct block *gen_protochain(compiler_state_t *, bpf_u_int32, int);
+#endif /* !defined(NO_PROTOCHAIN) */
 static struct block *gen_proto(compiler_state_t *, bpf_u_int32, int, int);
 static struct slist *xfer_to_x(compiler_state_t *, struct arth *);
 static struct slist *xfer_to_a(compiler_state_t *, struct arth *);
@@ -741,7 +733,7 @@
 	if (!p->activated) {
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
 		    "not-yet-activated pcap_t passed to pcap_compile");
-		return (-1);
+		return (PCAP_ERROR);
 	}
 
 #ifdef _WIN32
@@ -789,7 +781,7 @@
 	if (cstate.snaplen == 0) {
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
 			 "snaplen of 0 rejects all packets");
-		rc = -1;
+		rc = PCAP_ERROR;
 		goto quit;
 	}
 
@@ -805,7 +797,7 @@
 	pcap_set_extra(&cstate, scanner);
 
 	if (init_linktype(&cstate, p) == -1) {
-		rc = -1;
+		rc = PCAP_ERROR;
 		goto quit;
 	}
 	if (pcap_parse(scanner, &cstate) != 0) {
@@ -815,7 +807,7 @@
 #endif
 		if (cstate.e != NULL)
 			free(cstate.e);
-		rc = -1;
+		rc = PCAP_ERROR;
 		goto quit;
 	}
 
@@ -824,7 +816,7 @@
 		 * Catch errors reported by gen_retblk().
 		 */
 		if (setjmp(cstate.top_ctx)) {
-			rc = -1;
+			rc = PCAP_ERROR;
 			goto quit;
 		}
 		cstate.ic.root = gen_retblk(&cstate, cstate.snaplen);
@@ -833,14 +825,14 @@
 	if (optimize && !cstate.no_optimize) {
 		if (bpf_optimize(&cstate.ic, p->errbuf) == -1) {
 			/* Failure */
-			rc = -1;
+			rc = PCAP_ERROR;
 			goto quit;
 		}
 		if (cstate.ic.root == NULL ||
 		    (cstate.ic.root->s.code == (BPF_RET|BPF_K) && cstate.ic.root->s.k == 0)) {
 			(void)snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
 			    "expression rejects all packets");
-			rc = -1;
+			rc = PCAP_ERROR;
 			goto quit;
 		}
 	}
@@ -848,7 +840,7 @@
 	    cstate.ic.root, &len, p->errbuf);
 	if (program->bf_insns == NULL) {
 		/* Failure */
-		rc = -1;
+		rc = PCAP_ERROR;
 		goto quit;
 	}
 	program->bf_len = len;
@@ -886,7 +878,7 @@
 
 	p = pcap_open_dead(linktype_arg, snaplen_arg);
 	if (p == NULL)
-		return (-1);
+		return (PCAP_ERROR);
 	ret = pcap_compile(p, program, buf, optimize, mask);
 	pcap_close(p);
 	return (ret);
@@ -1265,6 +1257,7 @@
 	case DLT_PPP:
 	case DLT_PPP_PPPD:
 	case DLT_C_HDLC:		/* BSD/OS Cisco HDLC */
+	case DLT_HDLC:			/* NetBSD (Cisco) HDLC */
 	case DLT_PPP_SERIAL:		/* NetBSD sync/async serial PPP */
 		cstate->off_linktype.constant_part = 2;	/* skip HDLC-like framing */
 		cstate->off_linkpl.constant_part = 4;	/* skip HDLC-like framing and protocol field */
@@ -1513,14 +1506,13 @@
 		cstate->off_nl_nosnap = 0;	/* XXX - what does it do with 802.3 packets? */
 		break;
 
-#ifdef HAVE_NET_PFVAR_H
 	case DLT_PFLOG:
 		cstate->off_linktype.constant_part = 0;
-		cstate->off_linkpl.constant_part = PFLOG_HDRLEN;
+		cstate->off_linkpl.constant_part = 0;	/* link-layer header is variable-length */
+		cstate->off_linkpl.is_variable = 1;
 		cstate->off_nl = 0;
 		cstate->off_nl_nosnap = 0;	/* no 802.2 LLC */
 		break;
-#endif
 
         case DLT_JUNIPER_MFR:
         case DLT_JUNIPER_MLFR:
@@ -1722,7 +1714,8 @@
 			cstate->off_nl = OFFSET_NOT_SET;
 			cstate->off_nl_nosnap = OFFSET_NOT_SET;
 		} else {
-			bpf_set_error(cstate, "unknown data link type %d", cstate->linktype);
+			bpf_set_error(cstate, "unknown data link type %d (min %d, max %d)",
+			    cstate->linktype, DLT_MATCHING_MIN, DLT_MATCHING_MAX);
 			return (-1);
 		}
 		break;
@@ -2344,6 +2337,59 @@
 	}
 }
 
+/*
+ * Load a value relative to the beginning of the link-layer header after the
+ * pflog header.
+ */
+static struct slist *
+gen_load_pflog_llprefixlen(compiler_state_t *cstate)
+{
+	struct slist *s1, *s2;
+
+	/*
+	 * Generate code to load the length of the pflog header into
+	 * the register assigned to hold that length, if one has been
+	 * assigned.  (If one hasn't been assigned, no code we've
+	 * generated uses that prefix, so we don't need to generate any
+	 * code to load it.)
+	 */
+	if (cstate->off_linkpl.reg != -1) {
+		/*
+		 * The length is in the first byte of the header.
+		 */
+		s1 = new_stmt(cstate, BPF_LD|BPF_B|BPF_ABS);
+		s1->s.k = 0;
+
+		/*
+		 * Round it up to a multiple of 4.
+		 * Add 3, and clear the lower 2 bits.
+		 */
+		s2 = new_stmt(cstate, BPF_ALU|BPF_ADD|BPF_K);
+		s2->s.k = 3;
+		sappend(s1, s2);
+		s2 = new_stmt(cstate, BPF_ALU|BPF_AND|BPF_K);
+		s2->s.k = 0xfffffffc;
+		sappend(s1, s2);
+
+		/*
+		 * Now allocate a register to hold that value and store
+		 * it.
+		 */
+		s2 = new_stmt(cstate, BPF_ST);
+		s2->s.k = cstate->off_linkpl.reg;
+		sappend(s1, s2);
+
+		/*
+		 * Now move it into the X register.
+		 */
+		s2 = new_stmt(cstate, BPF_MISC|BPF_TAX);
+		sappend(s1, s2);
+
+		return (s1);
+	} else
+		return (NULL);
+}
+
 static struct slist *
 gen_load_prism_llprefixlen(compiler_state_t *cstate)
 {
@@ -2931,6 +2977,10 @@
 	case DLT_PPI:
 		s = gen_load_802_11_header_len(cstate, s, b->stmts);
 		break;
+
+	case DLT_PFLOG:
+		s = gen_load_pflog_llprefixlen(cstate);
+		break;
 	}
 
 	/*
@@ -3166,6 +3216,7 @@
 		/*NOTREACHED*/
 
 	case DLT_C_HDLC:
+	case DLT_HDLC:
 		switch (ll_proto) {
 
 		case LLCSAP_ISONS:
@@ -3395,7 +3446,6 @@
 			return gen_false(cstate);
 		}
 
-#ifdef HAVE_NET_PFVAR_H
 	case DLT_PFLOG:
 		/*
 		 * af field is host byte order in contrast to the rest of
@@ -3410,7 +3460,6 @@
 		else
 			return gen_false(cstate);
 		/*NOTREACHED*/
-#endif /* HAVE_NET_PFVAR_H */
 
 	case DLT_ARCNET:
 	case DLT_ARCNET_LINUX:
@@ -5310,21 +5359,15 @@
 	switch (proto) {
 
 	case Q_SCTP:
-		b1 = gen_proto(cstate, IPPROTO_SCTP, Q_IP, Q_DEFAULT);
-		b0 = gen_proto(cstate, IPPROTO_SCTP, Q_IPV6, Q_DEFAULT);
-		gen_or(b0, b1);
+		b1 = gen_proto(cstate, IPPROTO_SCTP, Q_DEFAULT, Q_DEFAULT);
 		break;
 
 	case Q_TCP:
-		b1 = gen_proto(cstate, IPPROTO_TCP, Q_IP, Q_DEFAULT);
-		b0 = gen_proto(cstate, IPPROTO_TCP, Q_IPV6, Q_DEFAULT);
-		gen_or(b0, b1);
+		b1 = gen_proto(cstate, IPPROTO_TCP, Q_DEFAULT, Q_DEFAULT);
 		break;
 
 	case Q_UDP:
-		b1 = gen_proto(cstate, IPPROTO_UDP, Q_IP, Q_DEFAULT);
-		b0 = gen_proto(cstate, IPPROTO_UDP, Q_IPV6, Q_DEFAULT);
-		gen_or(b0, b1);
+		b1 = gen_proto(cstate, IPPROTO_UDP, Q_DEFAULT, Q_DEFAULT);
 		break;
 
 	case Q_ICMP:
@@ -5351,9 +5394,7 @@
 #endif
 
 	case Q_PIM:
-		b1 = gen_proto(cstate, IPPROTO_PIM, Q_IP, Q_DEFAULT);
-		b0 = gen_proto(cstate, IPPROTO_PIM, Q_IPV6, Q_DEFAULT);
-		gen_or(b0, b1);
+		b1 = gen_proto(cstate, IPPROTO_PIM, Q_DEFAULT, Q_DEFAULT);
 		break;
 
 #ifndef IPPROTO_VRRP
@@ -5430,18 +5471,14 @@
 #define IPPROTO_AH	51
 #endif
 	case Q_AH:
-		b1 = gen_proto(cstate, IPPROTO_AH, Q_IP, Q_DEFAULT);
-		b0 = gen_proto(cstate, IPPROTO_AH, Q_IPV6, Q_DEFAULT);
-		gen_or(b0, b1);
+		b1 = gen_proto(cstate, IPPROTO_AH, Q_DEFAULT, Q_DEFAULT);
 		break;
 
 #ifndef IPPROTO_ESP
 #define IPPROTO_ESP	50
 #endif
 	case Q_ESP:
-		b1 = gen_proto(cstate, IPPROTO_ESP, Q_IP, Q_DEFAULT);
-		b0 = gen_proto(cstate, IPPROTO_ESP, Q_IPV6, Q_DEFAULT);
-		gen_or(b0, b1);
+		b1 = gen_proto(cstate, IPPROTO_ESP, Q_DEFAULT, Q_DEFAULT);
 		break;
 
 	case Q_ISO:
@@ -6035,20 +6072,10 @@
 	return v;
 }
 
-#if 0
-struct stmt *
-gen_joinsp(struct stmt **s, int n)
-{
-	return NULL;
-}
-#endif
-
+#if !defined(NO_PROTOCHAIN)
 static struct block *
 gen_protochain(compiler_state_t *cstate, bpf_u_int32 v, int proto)
 {
-#ifdef NO_PROTOCHAIN
-	return gen_proto(cstate, v, proto);
-#else
 	struct block *b0, *b;
 	struct slist *s[100];
 	int fix2, fix3, fix4, fix5;
@@ -6342,8 +6369,8 @@
 
 	gen_and(b0, b);
 	return b;
-#endif
 }
+#endif /* !defined(NO_PROTOCHAIN) */
 
 static struct block *
 gen_check_802_11_data_frame(compiler_state_t *cstate)
@@ -6384,9 +6411,7 @@
 gen_proto(compiler_state_t *cstate, bpf_u_int32 v, int proto, int dir)
 {
 	struct block *b0, *b1;
-#ifndef CHASE_CHAIN
 	struct block *b2;
-#endif
 
 	if (dir != Q_DEFAULT)
 		bpf_error(cstate, "direction applied to 'proto'");
@@ -6418,11 +6443,7 @@
 		 * So we always check for ETHERTYPE_IP.
 		 */
 		b0 = gen_linktype(cstate, ETHERTYPE_IP);
-#ifndef CHASE_CHAIN
 		b1 = gen_cmp(cstate, OR_LINKPL, 9, BPF_B, v);
-#else
-		b1 = gen_protochain(cstate, v, Q_IP);
-#endif
 		gen_and(b0, b1);
 		return b1;
 
@@ -6484,7 +6505,6 @@
 
 	case Q_IPV6:
 		b0 = gen_linktype(cstate, ETHERTYPE_IPV6);
-#ifndef CHASE_CHAIN
 		/*
 		 * Also check for a fragment header before the final
 		 * header.
@@ -6494,9 +6514,6 @@
 		gen_and(b2, b1);
 		b2 = gen_cmp(cstate, OR_LINKPL, 6, BPF_B, v);
 		gen_or(b2, b1);
-#else
-		b1 = gen_protochain(cstate, v, Q_IPV6);
-#endif
 		gen_and(b0, b1);
 		return b1;
 
@@ -6550,6 +6567,7 @@
 			/*NOTREACHED*/
 
 		case DLT_C_HDLC:
+		case DLT_HDLC:
 			/*
 			 * Cisco uses an Ethertype lookalike - for OSI,
 			 * it's 0xfefe.
@@ -6935,12 +6953,14 @@
 		else
 			bpf_error(cstate, "unknown protocol: %s", name);
 
+#if !defined(NO_PROTOCHAIN)
 	case Q_PROTOCHAIN:
 		real_proto = lookup_proto(cstate, name, proto);
 		if (real_proto >= 0)
 			return gen_protochain(cstate, real_proto, proto);
 		else
 			bpf_error(cstate, "unknown protocol: %s", name);
+#endif /* !defined(NO_PROTOCHAIN) */
 
 	case Q_UNDEF:
 		syntax(cstate);
@@ -7113,8 +7133,10 @@
 	case Q_PROTO:
 		return gen_proto(cstate, v, proto, dir);
 
+#if !defined(NO_PROTOCHAIN)
 	case Q_PROTOCHAIN:
 		return gen_protochain(cstate, v, proto);
+#endif
 
 	case Q_UNDEF:
 		syntax(cstate);
@@ -8300,12 +8322,10 @@
 		}
 		break;
 
-#ifdef HAVE_NET_PFVAR_H
 	case DLT_PFLOG:
 		b0 = gen_cmp(cstate, OR_LINKHDR, offsetof(struct pfloghdr, dir), BPF_B,
 		    ((dir == 0) ? PF_IN : PF_OUT));
 		break;
-#endif
 
 	case DLT_PPP_PPPD:
 		if (dir) {
@@ -8396,7 +8416,6 @@
 	return (b0);
 }
 
-#ifdef HAVE_NET_PFVAR_H
 /* PF firewall log matched interface */
 struct block *
 gen_pf_ifname(compiler_state_t *cstate, const char *ifname)
@@ -8547,91 +8566,6 @@
 	    (bpf_u_int32)action);
 	return (b0);
 }
-#else /* !HAVE_NET_PFVAR_H */
-struct block *
-gen_pf_ifname(compiler_state_t *cstate, const char *ifname _U_)
-{
-	/*
-	 * Catch errors reported by us and routines below us, and return NULL
-	 * on an error.
-	 */
-	if (setjmp(cstate->top_ctx))
-		return (NULL);
-
-	bpf_error(cstate, "libpcap was compiled without pf support");
-	/*NOTREACHED*/
-}
-
-struct block *
-gen_pf_ruleset(compiler_state_t *cstate, char *ruleset _U_)
-{
-	/*
-	 * Catch errors reported by us and routines below us, and return NULL
-	 * on an error.
-	 */
-	if (setjmp(cstate->top_ctx))
-		return (NULL);
-
-	bpf_error(cstate, "libpcap was compiled on a machine without pf support");
-	/*NOTREACHED*/
-}
-
-struct block *
-gen_pf_rnr(compiler_state_t *cstate, int rnr _U_)
-{
-	/*
-	 * Catch errors reported by us and routines below us, and return NULL
-	 * on an error.
-	 */
-	if (setjmp(cstate->top_ctx))
-		return (NULL);
-
-	bpf_error(cstate, "libpcap was compiled on a machine without pf support");
-	/*NOTREACHED*/
-}
-
-struct block *
-gen_pf_srnr(compiler_state_t *cstate, int srnr _U_)
-{
-	/*
-	 * Catch errors reported by us and routines below us, and return NULL
-	 * on an error.
-	 */
-	if (setjmp(cstate->top_ctx))
-		return (NULL);
-
-	bpf_error(cstate, "libpcap was compiled on a machine without pf support");
-	/*NOTREACHED*/
-}
-
-struct block *
-gen_pf_reason(compiler_state_t *cstate, int reason _U_)
-{
-	/*
-	 * Catch errors reported by us and routines below us, and return NULL
-	 * on an error.
-	 */
-	if (setjmp(cstate->top_ctx))
-		return (NULL);
-
-	bpf_error(cstate, "libpcap was compiled on a machine without pf support");
-	/*NOTREACHED*/
-}
-
-struct block *
-gen_pf_action(compiler_state_t *cstate, int action _U_)
-{
-	/*
-	 * Catch errors reported by us and routines below us, and return NULL
-	 * on an error.
-	 */
-	if (setjmp(cstate->top_ctx))
-		return (NULL);
-
-	bpf_error(cstate, "libpcap was compiled on a machine without pf support");
-	/*NOTREACHED*/
-}
-#endif /* HAVE_NET_PFVAR_H */
 
 /* IEEE 802.11 wireless header */
 struct block *
@@ -8788,7 +8722,7 @@
 {
 	struct block *b0, *b1;
 
-	/* check for VLAN, including QinQ */
+	/* check for VLAN, including 802.1ad and QinQ */
 	b0 = gen_linktype(cstate, ETHERTYPE_8021Q);
 	b1 = gen_linktype(cstate, ETHERTYPE_8021AD);
 	gen_or(b0,b1);
@@ -9095,6 +9029,7 @@
             switch (cstate->linktype) {
 
             case DLT_C_HDLC: /* fall through */
+            case DLT_HDLC:
             case DLT_EN10MB:
             case DLT_NETANALYZER:
             case DLT_NETANALYZER_TRANSPARENT:
diff --git a/gencode.h b/gencode.h
index 053e85f..93ca521 100644
--- a/gencode.h
+++ b/gencode.h
@@ -19,7 +19,19 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
+#ifndef gencode_h
+#define gencode_h
+
 #include "pcap/funcattrs.h"
+/*
+ * pcap/bpf.h (a public header) needs u_char, u_short and u_int, which can be
+ * made available via either pcap-types.h (a private header) or pcap/pcap.h
+ * (a public header), none of which pcap/bpf.h includes.  Include the private
+ * header to keep things simple, this way this private header should compile
+ * even if included early from another file.
+ */
+#include "pcap-types.h"
+#include "pcap/bpf.h" /* bpf_u_int32 and BPF_MEMWORDS */
 
 /*
  * ATM support:
@@ -400,3 +412,5 @@
 /* XXX */
 #define JT(b)  ((b)->et.succ)
 #define JF(b)  ((b)->ef.succ)
+
+#endif /* gencode_h */
diff --git a/grammar.c b/grammar.c
index f7697e2..c5c0976 100644
--- a/grammar.c
+++ b/grammar.c
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 3.5.1.  */
+/* A Bison parser, made by GNU Bison 3.8.2.  */
 
 /* Bison implementation for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -34,6 +34,10 @@
 /* C LALR(1) parser skeleton written by Richard Stallman, by
    simplifying the original so-called "semantic" parser.  */
 
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+   especially those whose name start with YY_ or yy_.  They are
+   private implementation details that can be changed or removed.  */
+
 /* All symbols defined below should begin with yy or YY, to avoid
    infringing on user name space.  This should be done even for local
    variables, as they might otherwise be expanded by user macros.
@@ -41,14 +45,11 @@
    define necessary library symbols; they are noted "INFRINGES ON
    USER NAME SPACE" below.  */
 
-/* Undocumented macros, especially those whose name start with YY_,
-   are private implementation details.  Do not rely on them.  */
+/* Identify Bison output, and Bison version.  */
+#define YYBISON 30802
 
-/* Identify Bison output.  */
-#define YYBISON 1
-
-/* Bison version.  */
-#define YYBISON_VERSION "3.5.1"
+/* Bison version string.  */
+#define YYBISON_VERSION "3.8.2"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -71,7 +72,7 @@
 #define yynerrs         pcap_nerrs
 
 /* First part of user prologue.  */
-#line 26 "grammar.y"
+#line 47 "grammar.y"
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
@@ -99,6 +100,13 @@
 #include <config.h>
 #endif
 
+/*
+ * grammar.h requires gencode.h and sometimes breaks in a polluted namespace
+ * (see ftmacros.h), so include it early.
+ */
+#include "gencode.h"
+#include "grammar.h"
+
 #include <stdlib.h>
 
 #ifndef _WIN32
@@ -120,17 +128,11 @@
 
 #include "pcap-int.h"
 
-#include "gencode.h"
-#include "grammar.h"
 #include "scanner.h"
 
-#ifdef HAVE_NET_PFVAR_H
-#include <net/if.h>
-#include <net/pfvar.h>
-#include <net/if_pflog.h>
-#endif
 #include "llc.h"
 #include "ieee80211.h"
+#include "pflog.h"
 #include <pcap/namedb.h>
 
 #ifdef HAVE_OS_PROTO_H
@@ -259,8 +261,17 @@
 	int i;
 
 	for (i = 0; toks[i].s != NULL; i++) {
-		if (pcap_strcasecmp(toks[i].s, str) == 0)
+		if (pcap_strcasecmp(toks[i].s, str) == 0) {
+			/*
+			 * Just in case somebody is using this to
+			 * generate values of -1/0xFFFFFFFF.
+			 * That won't work, as it's indistinguishable
+			 * from an error.
+			 */
+			if (toks[i].v == -1)
+				abort();
 			return (toks[i].v);
+		}
 	}
 	return (-1);
 }
@@ -273,60 +284,87 @@
 	bpf_set_error(cstate, "can't parse filter expression: %s", msg);
 }
 
-#ifdef HAVE_NET_PFVAR_H
+static const struct tok pflog_reasons[] = {
+	{ PFRES_MATCH,		"match" },
+	{ PFRES_BADOFF,		"bad-offset" },
+	{ PFRES_FRAG,		"fragment" },
+	{ PFRES_SHORT,		"short" },
+	{ PFRES_NORM,		"normalize" },
+	{ PFRES_MEMORY,		"memory" },
+	{ PFRES_TS,		"bad-timestamp" },
+	{ PFRES_CONGEST,	"congestion" },
+	{ PFRES_IPOPTIONS,	"ip-option" },
+	{ PFRES_PROTCKSUM,	"proto-cksum" },
+	{ PFRES_BADSTATE,	"state-mismatch" },
+	{ PFRES_STATEINS,	"state-insert" },
+	{ PFRES_MAXSTATES,	"state-limit" },
+	{ PFRES_SRCLIMIT,	"src-limit" },
+	{ PFRES_SYNPROXY,	"synproxy" },
+#if defined(__FreeBSD__)
+	{ PFRES_MAPFAILED,	"map-failed" },
+#elif defined(__NetBSD__)
+	{ PFRES_STATELOCKED,	"state-locked" },
+#elif defined(__OpenBSD__)
+	{ PFRES_TRANSLATE,	"translate" },
+	{ PFRES_NOROUTE,	"no-route" },
+#elif defined(__APPLE__)
+	{ PFRES_DUMMYNET,	"dummynet" },
+#endif
+	{ 0, NULL }
+};
+
 static int
 pfreason_to_num(compiler_state_t *cstate, const char *reason)
 {
-	const char *reasons[] = PFRES_NAMES;
 	int i;
 
-	for (i = 0; reasons[i]; i++) {
-		if (pcap_strcasecmp(reason, reasons[i]) == 0)
-			return (i);
-	}
-	bpf_set_error(cstate, "unknown PF reason");
-	return (-1);
+	i = str2tok(reason, pflog_reasons);
+	if (i == -1)
+		bpf_set_error(cstate, "unknown PF reason \"%s\"", reason);
+	return (i);
 }
 
+static const struct tok pflog_actions[] = {
+	{ PF_PASS,		"pass" },
+	{ PF_PASS,		"accept" },	/* alias for "pass" */
+	{ PF_DROP,		"drop" },
+	{ PF_DROP,		"block" },	/* alias for "drop" */
+	{ PF_SCRUB,		"scrub" },
+	{ PF_NOSCRUB,		"noscrub" },
+	{ PF_NAT,		"nat" },
+	{ PF_NONAT,		"nonat" },
+	{ PF_BINAT,		"binat" },
+	{ PF_NOBINAT,		"nobinat" },
+	{ PF_RDR,		"rdr" },
+	{ PF_NORDR,		"nordr" },
+	{ PF_SYNPROXY_DROP,	"synproxy-drop" },
+#if defined(__FreeBSD__)
+	{ PF_DEFER,		"defer" },
+#elif defined(__OpenBSD__)
+	{ PF_DEFER,		"defer" },
+	{ PF_MATCH,		"match" },
+	{ PF_DIVERT,		"divert" },
+	{ PF_RT,		"rt" },
+	{ PF_AFRT,		"afrt" },
+#elif defined(__APPLE__)
+	{ PF_DUMMYNET,		"dummynet" },
+	{ PF_NODUMMYNET,	"nodummynet" },
+	{ PF_NAT64,		"nat64" },
+	{ PF_NONAT64,		"nonat64" },
+#endif
+	{ 0, NULL },
+};
+
 static int
 pfaction_to_num(compiler_state_t *cstate, const char *action)
 {
-	if (pcap_strcasecmp(action, "pass") == 0 ||
-	    pcap_strcasecmp(action, "accept") == 0)
-		return (PF_PASS);
-	else if (pcap_strcasecmp(action, "drop") == 0 ||
-		pcap_strcasecmp(action, "block") == 0)
-		return (PF_DROP);
-#if HAVE_PF_NAT_THROUGH_PF_NORDR
-	else if (pcap_strcasecmp(action, "rdr") == 0)
-		return (PF_RDR);
-	else if (pcap_strcasecmp(action, "nat") == 0)
-		return (PF_NAT);
-	else if (pcap_strcasecmp(action, "binat") == 0)
-		return (PF_BINAT);
-	else if (pcap_strcasecmp(action, "nordr") == 0)
-		return (PF_NORDR);
-#endif
-	else {
-		bpf_set_error(cstate, "unknown PF action");
-		return (-1);
-	}
-}
-#else /* !HAVE_NET_PFVAR_H */
-static int
-pfreason_to_num(compiler_state_t *cstate, const char *reason _U_)
-{
-	bpf_set_error(cstate, "libpcap was compiled on a machine without pf support");
-	return (-1);
-}
+	int i;
 
-static int
-pfaction_to_num(compiler_state_t *cstate, const char *action _U_)
-{
-	bpf_set_error(cstate, "libpcap was compiled on a machine without pf support");
-	return (-1);
+	i = str2tok(action, pflog_actions);
+	if (i == -1)
+		bpf_set_error(cstate, "unknown PF action \"%s\"", action);
+	return (i);
 }
-#endif /* HAVE_NET_PFVAR_H */
 
 /*
  * For calls that might return an "an error occurred" value.
@@ -336,7 +374,7 @@
 
 DIAG_OFF_BISON_BYACC
 
-#line 340 "grammar.c"
+#line 378 "grammar.c"
 
 # ifndef YY_CAST
 #  ifdef __cplusplus
@@ -359,309 +397,204 @@
 #  endif
 # endif
 
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* Use api.header.include to #include this header
-   instead of duplicating it here.  */
-#ifndef YY_PCAP_GRAMMAR_H_INCLUDED
-# define YY_PCAP_GRAMMAR_H_INCLUDED
-/* Debug traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int pcap_debug;
-#endif
-
-/* Token type.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-  enum yytokentype
-  {
-    DST = 258,
-    SRC = 259,
-    HOST = 260,
-    GATEWAY = 261,
-    NET = 262,
-    NETMASK = 263,
-    PORT = 264,
-    PORTRANGE = 265,
-    LESS = 266,
-    GREATER = 267,
-    PROTO = 268,
-    PROTOCHAIN = 269,
-    CBYTE = 270,
-    ARP = 271,
-    RARP = 272,
-    IP = 273,
-    SCTP = 274,
-    TCP = 275,
-    UDP = 276,
-    ICMP = 277,
-    IGMP = 278,
-    IGRP = 279,
-    PIM = 280,
-    VRRP = 281,
-    CARP = 282,
-    ATALK = 283,
-    AARP = 284,
-    DECNET = 285,
-    LAT = 286,
-    SCA = 287,
-    MOPRC = 288,
-    MOPDL = 289,
-    TK_BROADCAST = 290,
-    TK_MULTICAST = 291,
-    NUM = 292,
-    INBOUND = 293,
-    OUTBOUND = 294,
-    PF_IFNAME = 295,
-    PF_RSET = 296,
-    PF_RNR = 297,
-    PF_SRNR = 298,
-    PF_REASON = 299,
-    PF_ACTION = 300,
-    TYPE = 301,
-    SUBTYPE = 302,
-    DIR = 303,
-    ADDR1 = 304,
-    ADDR2 = 305,
-    ADDR3 = 306,
-    ADDR4 = 307,
-    RA = 308,
-    TA = 309,
-    LINK = 310,
-    GEQ = 311,
-    LEQ = 312,
-    NEQ = 313,
-    ID = 314,
-    EID = 315,
-    HID = 316,
-    HID6 = 317,
-    AID = 318,
-    LSH = 319,
-    RSH = 320,
-    LEN = 321,
-    IPV6 = 322,
-    ICMPV6 = 323,
-    AH = 324,
-    ESP = 325,
-    VLAN = 326,
-    MPLS = 327,
-    PPPOED = 328,
-    PPPOES = 329,
-    GENEVE = 330,
-    ISO = 331,
-    ESIS = 332,
-    CLNP = 333,
-    ISIS = 334,
-    L1 = 335,
-    L2 = 336,
-    IIH = 337,
-    LSP = 338,
-    SNP = 339,
-    CSNP = 340,
-    PSNP = 341,
-    STP = 342,
-    IPX = 343,
-    NETBEUI = 344,
-    LANE = 345,
-    LLC = 346,
-    METAC = 347,
-    BCC = 348,
-    SC = 349,
-    ILMIC = 350,
-    OAMF4EC = 351,
-    OAMF4SC = 352,
-    OAM = 353,
-    OAMF4 = 354,
-    CONNECTMSG = 355,
-    METACONNECT = 356,
-    VPI = 357,
-    VCI = 358,
-    RADIO = 359,
-    FISU = 360,
-    LSSU = 361,
-    MSU = 362,
-    HFISU = 363,
-    HLSSU = 364,
-    HMSU = 365,
-    SIO = 366,
-    OPC = 367,
-    DPC = 368,
-    SLS = 369,
-    HSIO = 370,
-    HOPC = 371,
-    HDPC = 372,
-    HSLS = 373,
-    LEX_ERROR = 374,
-    OR = 375,
-    AND = 376,
-    UMINUS = 377
-  };
-#endif
-/* Tokens.  */
-#define DST 258
-#define SRC 259
-#define HOST 260
-#define GATEWAY 261
-#define NET 262
-#define NETMASK 263
-#define PORT 264
-#define PORTRANGE 265
-#define LESS 266
-#define GREATER 267
-#define PROTO 268
-#define PROTOCHAIN 269
-#define CBYTE 270
-#define ARP 271
-#define RARP 272
-#define IP 273
-#define SCTP 274
-#define TCP 275
-#define UDP 276
-#define ICMP 277
-#define IGMP 278
-#define IGRP 279
-#define PIM 280
-#define VRRP 281
-#define CARP 282
-#define ATALK 283
-#define AARP 284
-#define DECNET 285
-#define LAT 286
-#define SCA 287
-#define MOPRC 288
-#define MOPDL 289
-#define TK_BROADCAST 290
-#define TK_MULTICAST 291
-#define NUM 292
-#define INBOUND 293
-#define OUTBOUND 294
-#define PF_IFNAME 295
-#define PF_RSET 296
-#define PF_RNR 297
-#define PF_SRNR 298
-#define PF_REASON 299
-#define PF_ACTION 300
-#define TYPE 301
-#define SUBTYPE 302
-#define DIR 303
-#define ADDR1 304
-#define ADDR2 305
-#define ADDR3 306
-#define ADDR4 307
-#define RA 308
-#define TA 309
-#define LINK 310
-#define GEQ 311
-#define LEQ 312
-#define NEQ 313
-#define ID 314
-#define EID 315
-#define HID 316
-#define HID6 317
-#define AID 318
-#define LSH 319
-#define RSH 320
-#define LEN 321
-#define IPV6 322
-#define ICMPV6 323
-#define AH 324
-#define ESP 325
-#define VLAN 326
-#define MPLS 327
-#define PPPOED 328
-#define PPPOES 329
-#define GENEVE 330
-#define ISO 331
-#define ESIS 332
-#define CLNP 333
-#define ISIS 334
-#define L1 335
-#define L2 336
-#define IIH 337
-#define LSP 338
-#define SNP 339
-#define CSNP 340
-#define PSNP 341
-#define STP 342
-#define IPX 343
-#define NETBEUI 344
-#define LANE 345
-#define LLC 346
-#define METAC 347
-#define BCC 348
-#define SC 349
-#define ILMIC 350
-#define OAMF4EC 351
-#define OAMF4SC 352
-#define OAM 353
-#define OAMF4 354
-#define CONNECTMSG 355
-#define METACONNECT 356
-#define VPI 357
-#define VCI 358
-#define RADIO 359
-#define FISU 360
-#define LSSU 361
-#define MSU 362
-#define HFISU 363
-#define HLSSU 364
-#define HMSU 365
-#define SIO 366
-#define OPC 367
-#define DPC 368
-#define SLS 369
-#define HSIO 370
-#define HOPC 371
-#define HDPC 372
-#define HSLS 373
-#define LEX_ERROR 374
-#define OR 375
-#define AND 376
-#define UMINUS 377
-
-/* Value type.  */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-union YYSTYPE
+#include "grammar.h"
+/* Symbol kind.  */
+enum yysymbol_kind_t
 {
-#line 291 "grammar.y"
-
-	int i;
-	bpf_u_int32 h;
-	char *s;
-	struct stmt *stmt;
-	struct arth *a;
-	struct {
-		struct qual q;
-		int atmfieldtype;
-		int mtp3fieldtype;
-		struct block *b;
-	} blk;
-	struct block *rblk;
-
-#line 651 "grammar.c"
-
+  YYSYMBOL_YYEMPTY = -2,
+  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
+  YYSYMBOL_YYerror = 1,                    /* error  */
+  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
+  YYSYMBOL_DST = 3,                        /* DST  */
+  YYSYMBOL_SRC = 4,                        /* SRC  */
+  YYSYMBOL_HOST = 5,                       /* HOST  */
+  YYSYMBOL_GATEWAY = 6,                    /* GATEWAY  */
+  YYSYMBOL_NET = 7,                        /* NET  */
+  YYSYMBOL_NETMASK = 8,                    /* NETMASK  */
+  YYSYMBOL_PORT = 9,                       /* PORT  */
+  YYSYMBOL_PORTRANGE = 10,                 /* PORTRANGE  */
+  YYSYMBOL_LESS = 11,                      /* LESS  */
+  YYSYMBOL_GREATER = 12,                   /* GREATER  */
+  YYSYMBOL_PROTO = 13,                     /* PROTO  */
+  YYSYMBOL_PROTOCHAIN = 14,                /* PROTOCHAIN  */
+  YYSYMBOL_CBYTE = 15,                     /* CBYTE  */
+  YYSYMBOL_ARP = 16,                       /* ARP  */
+  YYSYMBOL_RARP = 17,                      /* RARP  */
+  YYSYMBOL_IP = 18,                        /* IP  */
+  YYSYMBOL_SCTP = 19,                      /* SCTP  */
+  YYSYMBOL_TCP = 20,                       /* TCP  */
+  YYSYMBOL_UDP = 21,                       /* UDP  */
+  YYSYMBOL_ICMP = 22,                      /* ICMP  */
+  YYSYMBOL_IGMP = 23,                      /* IGMP  */
+  YYSYMBOL_IGRP = 24,                      /* IGRP  */
+  YYSYMBOL_PIM = 25,                       /* PIM  */
+  YYSYMBOL_VRRP = 26,                      /* VRRP  */
+  YYSYMBOL_CARP = 27,                      /* CARP  */
+  YYSYMBOL_ATALK = 28,                     /* ATALK  */
+  YYSYMBOL_AARP = 29,                      /* AARP  */
+  YYSYMBOL_DECNET = 30,                    /* DECNET  */
+  YYSYMBOL_LAT = 31,                       /* LAT  */
+  YYSYMBOL_SCA = 32,                       /* SCA  */
+  YYSYMBOL_MOPRC = 33,                     /* MOPRC  */
+  YYSYMBOL_MOPDL = 34,                     /* MOPDL  */
+  YYSYMBOL_TK_BROADCAST = 35,              /* TK_BROADCAST  */
+  YYSYMBOL_TK_MULTICAST = 36,              /* TK_MULTICAST  */
+  YYSYMBOL_NUM = 37,                       /* NUM  */
+  YYSYMBOL_INBOUND = 38,                   /* INBOUND  */
+  YYSYMBOL_OUTBOUND = 39,                  /* OUTBOUND  */
+  YYSYMBOL_IFINDEX = 40,                   /* IFINDEX  */
+  YYSYMBOL_PF_IFNAME = 41,                 /* PF_IFNAME  */
+  YYSYMBOL_PF_RSET = 42,                   /* PF_RSET  */
+  YYSYMBOL_PF_RNR = 43,                    /* PF_RNR  */
+  YYSYMBOL_PF_SRNR = 44,                   /* PF_SRNR  */
+  YYSYMBOL_PF_REASON = 45,                 /* PF_REASON  */
+  YYSYMBOL_PF_ACTION = 46,                 /* PF_ACTION  */
+  YYSYMBOL_TYPE = 47,                      /* TYPE  */
+  YYSYMBOL_SUBTYPE = 48,                   /* SUBTYPE  */
+  YYSYMBOL_DIR = 49,                       /* DIR  */
+  YYSYMBOL_ADDR1 = 50,                     /* ADDR1  */
+  YYSYMBOL_ADDR2 = 51,                     /* ADDR2  */
+  YYSYMBOL_ADDR3 = 52,                     /* ADDR3  */
+  YYSYMBOL_ADDR4 = 53,                     /* ADDR4  */
+  YYSYMBOL_RA = 54,                        /* RA  */
+  YYSYMBOL_TA = 55,                        /* TA  */
+  YYSYMBOL_LINK = 56,                      /* LINK  */
+  YYSYMBOL_GEQ = 57,                       /* GEQ  */
+  YYSYMBOL_LEQ = 58,                       /* LEQ  */
+  YYSYMBOL_NEQ = 59,                       /* NEQ  */
+  YYSYMBOL_ID = 60,                        /* ID  */
+  YYSYMBOL_EID = 61,                       /* EID  */
+  YYSYMBOL_HID = 62,                       /* HID  */
+  YYSYMBOL_HID6 = 63,                      /* HID6  */
+  YYSYMBOL_AID = 64,                       /* AID  */
+  YYSYMBOL_LSH = 65,                       /* LSH  */
+  YYSYMBOL_RSH = 66,                       /* RSH  */
+  YYSYMBOL_LEN = 67,                       /* LEN  */
+  YYSYMBOL_IPV6 = 68,                      /* IPV6  */
+  YYSYMBOL_ICMPV6 = 69,                    /* ICMPV6  */
+  YYSYMBOL_AH = 70,                        /* AH  */
+  YYSYMBOL_ESP = 71,                       /* ESP  */
+  YYSYMBOL_VLAN = 72,                      /* VLAN  */
+  YYSYMBOL_MPLS = 73,                      /* MPLS  */
+  YYSYMBOL_PPPOED = 74,                    /* PPPOED  */
+  YYSYMBOL_PPPOES = 75,                    /* PPPOES  */
+  YYSYMBOL_GENEVE = 76,                    /* GENEVE  */
+  YYSYMBOL_ISO = 77,                       /* ISO  */
+  YYSYMBOL_ESIS = 78,                      /* ESIS  */
+  YYSYMBOL_CLNP = 79,                      /* CLNP  */
+  YYSYMBOL_ISIS = 80,                      /* ISIS  */
+  YYSYMBOL_L1 = 81,                        /* L1  */
+  YYSYMBOL_L2 = 82,                        /* L2  */
+  YYSYMBOL_IIH = 83,                       /* IIH  */
+  YYSYMBOL_LSP = 84,                       /* LSP  */
+  YYSYMBOL_SNP = 85,                       /* SNP  */
+  YYSYMBOL_CSNP = 86,                      /* CSNP  */
+  YYSYMBOL_PSNP = 87,                      /* PSNP  */
+  YYSYMBOL_STP = 88,                       /* STP  */
+  YYSYMBOL_IPX = 89,                       /* IPX  */
+  YYSYMBOL_NETBEUI = 90,                   /* NETBEUI  */
+  YYSYMBOL_LANE = 91,                      /* LANE  */
+  YYSYMBOL_LLC = 92,                       /* LLC  */
+  YYSYMBOL_METAC = 93,                     /* METAC  */
+  YYSYMBOL_BCC = 94,                       /* BCC  */
+  YYSYMBOL_SC = 95,                        /* SC  */
+  YYSYMBOL_ILMIC = 96,                     /* ILMIC  */
+  YYSYMBOL_OAMF4EC = 97,                   /* OAMF4EC  */
+  YYSYMBOL_OAMF4SC = 98,                   /* OAMF4SC  */
+  YYSYMBOL_OAM = 99,                       /* OAM  */
+  YYSYMBOL_OAMF4 = 100,                    /* OAMF4  */
+  YYSYMBOL_CONNECTMSG = 101,               /* CONNECTMSG  */
+  YYSYMBOL_METACONNECT = 102,              /* METACONNECT  */
+  YYSYMBOL_VPI = 103,                      /* VPI  */
+  YYSYMBOL_VCI = 104,                      /* VCI  */
+  YYSYMBOL_RADIO = 105,                    /* RADIO  */
+  YYSYMBOL_FISU = 106,                     /* FISU  */
+  YYSYMBOL_LSSU = 107,                     /* LSSU  */
+  YYSYMBOL_MSU = 108,                      /* MSU  */
+  YYSYMBOL_HFISU = 109,                    /* HFISU  */
+  YYSYMBOL_HLSSU = 110,                    /* HLSSU  */
+  YYSYMBOL_HMSU = 111,                     /* HMSU  */
+  YYSYMBOL_SIO = 112,                      /* SIO  */
+  YYSYMBOL_OPC = 113,                      /* OPC  */
+  YYSYMBOL_DPC = 114,                      /* DPC  */
+  YYSYMBOL_SLS = 115,                      /* SLS  */
+  YYSYMBOL_HSIO = 116,                     /* HSIO  */
+  YYSYMBOL_HOPC = 117,                     /* HOPC  */
+  YYSYMBOL_HDPC = 118,                     /* HDPC  */
+  YYSYMBOL_HSLS = 119,                     /* HSLS  */
+  YYSYMBOL_LEX_ERROR = 120,                /* LEX_ERROR  */
+  YYSYMBOL_OR = 121,                       /* OR  */
+  YYSYMBOL_AND = 122,                      /* AND  */
+  YYSYMBOL_123_ = 123,                     /* '!'  */
+  YYSYMBOL_124_ = 124,                     /* '|'  */
+  YYSYMBOL_125_ = 125,                     /* '&'  */
+  YYSYMBOL_126_ = 126,                     /* '+'  */
+  YYSYMBOL_127_ = 127,                     /* '-'  */
+  YYSYMBOL_128_ = 128,                     /* '*'  */
+  YYSYMBOL_129_ = 129,                     /* '/'  */
+  YYSYMBOL_UMINUS = 130,                   /* UMINUS  */
+  YYSYMBOL_131_ = 131,                     /* ')'  */
+  YYSYMBOL_132_ = 132,                     /* '('  */
+  YYSYMBOL_133_ = 133,                     /* '>'  */
+  YYSYMBOL_134_ = 134,                     /* '='  */
+  YYSYMBOL_135_ = 135,                     /* '<'  */
+  YYSYMBOL_136_ = 136,                     /* '['  */
+  YYSYMBOL_137_ = 137,                     /* ']'  */
+  YYSYMBOL_138_ = 138,                     /* ':'  */
+  YYSYMBOL_139_ = 139,                     /* '%'  */
+  YYSYMBOL_140_ = 140,                     /* '^'  */
+  YYSYMBOL_YYACCEPT = 141,                 /* $accept  */
+  YYSYMBOL_prog = 142,                     /* prog  */
+  YYSYMBOL_null = 143,                     /* null  */
+  YYSYMBOL_expr = 144,                     /* expr  */
+  YYSYMBOL_and = 145,                      /* and  */
+  YYSYMBOL_or = 146,                       /* or  */
+  YYSYMBOL_id = 147,                       /* id  */
+  YYSYMBOL_nid = 148,                      /* nid  */
+  YYSYMBOL_not = 149,                      /* not  */
+  YYSYMBOL_paren = 150,                    /* paren  */
+  YYSYMBOL_pid = 151,                      /* pid  */
+  YYSYMBOL_qid = 152,                      /* qid  */
+  YYSYMBOL_term = 153,                     /* term  */
+  YYSYMBOL_head = 154,                     /* head  */
+  YYSYMBOL_rterm = 155,                    /* rterm  */
+  YYSYMBOL_pqual = 156,                    /* pqual  */
+  YYSYMBOL_dqual = 157,                    /* dqual  */
+  YYSYMBOL_aqual = 158,                    /* aqual  */
+  YYSYMBOL_ndaqual = 159,                  /* ndaqual  */
+  YYSYMBOL_pname = 160,                    /* pname  */
+  YYSYMBOL_other = 161,                    /* other  */
+  YYSYMBOL_pfvar = 162,                    /* pfvar  */
+  YYSYMBOL_p80211 = 163,                   /* p80211  */
+  YYSYMBOL_type = 164,                     /* type  */
+  YYSYMBOL_subtype = 165,                  /* subtype  */
+  YYSYMBOL_type_subtype = 166,             /* type_subtype  */
+  YYSYMBOL_pllc = 167,                     /* pllc  */
+  YYSYMBOL_dir = 168,                      /* dir  */
+  YYSYMBOL_reason = 169,                   /* reason  */
+  YYSYMBOL_action = 170,                   /* action  */
+  YYSYMBOL_relop = 171,                    /* relop  */
+  YYSYMBOL_irelop = 172,                   /* irelop  */
+  YYSYMBOL_arth = 173,                     /* arth  */
+  YYSYMBOL_narth = 174,                    /* narth  */
+  YYSYMBOL_byteop = 175,                   /* byteop  */
+  YYSYMBOL_pnum = 176,                     /* pnum  */
+  YYSYMBOL_atmtype = 177,                  /* atmtype  */
+  YYSYMBOL_atmmultitype = 178,             /* atmmultitype  */
+  YYSYMBOL_atmfield = 179,                 /* atmfield  */
+  YYSYMBOL_atmvalue = 180,                 /* atmvalue  */
+  YYSYMBOL_atmfieldvalue = 181,            /* atmfieldvalue  */
+  YYSYMBOL_atmlistvalue = 182,             /* atmlistvalue  */
+  YYSYMBOL_mtp2type = 183,                 /* mtp2type  */
+  YYSYMBOL_mtp3field = 184,                /* mtp3field  */
+  YYSYMBOL_mtp3value = 185,                /* mtp3value  */
+  YYSYMBOL_mtp3fieldvalue = 186,           /* mtp3fieldvalue  */
+  YYSYMBOL_mtp3listvalue = 187             /* mtp3listvalue  */
 };
-typedef union YYSTYPE YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
-#endif
+typedef enum yysymbol_kind_t yysymbol_kind_t;
 
 
 
-int pcap_parse (void *yyscanner, compiler_state_t *cstate);
-
-#endif /* !YY_PCAP_GRAMMAR_H_INCLUDED  */
-
-
 
 #ifdef short
 # undef short
@@ -700,6 +633,18 @@
 typedef short yytype_int16;
 #endif
 
+/* Work around bug in HP-UX 11.23, which defines these macros
+   incorrectly for preprocessor constants.  This workaround can likely
+   be removed in 2023, as HPE has promised support for HP-UX 11.23
+   (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
+   <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
+#ifdef __hpux
+# undef UINT_LEAST8_MAX
+# undef UINT_LEAST16_MAX
+# define UINT_LEAST8_MAX 255
+# define UINT_LEAST16_MAX 65535
+#endif
+
 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
@@ -759,6 +704,7 @@
 
 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
 
+
 /* Stored state numbers (used for stacks). */
 typedef yytype_int16 yy_state_t;
 
@@ -777,6 +723,7 @@
 # endif
 #endif
 
+
 #ifndef YY_ATTRIBUTE_PURE
 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
 #  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
@@ -795,17 +742,23 @@
 
 /* Suppress unused-variable warnings by "using" E.  */
 #if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
+# define YY_USE(E) ((void) (E))
 #else
-# define YYUSE(E) /* empty */
+# define YY_USE(E) /* empty */
 #endif
 
-#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
+#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
+# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
+#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
+    _Pragma ("GCC diagnostic push")                                     \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
+# else
+#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
     _Pragma ("GCC diagnostic push")                                     \
     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# endif
 # define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
     _Pragma ("GCC diagnostic pop")
 #else
@@ -834,7 +787,7 @@
 
 #define YY_ASSERT(E) ((void) (0 && (E)))
 
-#if ! defined yyoverflow || YYERROR_VERBOSE
+#if !defined yyoverflow
 
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
 
@@ -899,8 +852,7 @@
 #   endif
 #  endif
 # endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
+#endif /* !defined yyoverflow */
 
 #if (! defined yyoverflow \
      && (! defined __cplusplus \
@@ -965,25 +917,27 @@
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  3
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   775
+#define YYLAST   800
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  140
+#define YYNTOKENS  141
 /* YYNNTS -- Number of nonterminals.  */
 #define YYNNTS  47
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  220
+#define YYNRULES  221
 /* YYNSTATES -- Number of states.  */
-#define YYNSTATES  294
+#define YYNSTATES  296
 
-#define YYUNDEFTOK  2
-#define YYMAXUTOK   377
+/* YYMAXUTOK -- Last valid token kind.  */
+#define YYMAXUTOK   378
 
 
 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
    as returned by yylex, with out-of-bounds checking.  */
-#define YYTRANSLATE(YYX)                                                \
-  (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+#define YYTRANSLATE(YYX)                                \
+  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
+   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
+   : YYSYMBOL_YYUNDEF)
 
 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
    as returned by yylex.  */
@@ -992,16 +946,16 @@
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,   122,     2,     2,     2,   138,   124,     2,
-     131,   130,   127,   125,     2,   126,     2,   128,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,   137,     2,
-     134,   133,   132,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,   123,     2,     2,     2,   139,   125,     2,
+     132,   131,   128,   126,     2,   127,     2,   129,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,   138,     2,
+     135,   134,   133,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,   135,     2,   136,   139,     2,     2,     2,     2,     2,
+       2,   136,     2,   137,   140,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,   123,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,   124,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -1026,94 +980,86 @@
       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
       95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
      105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
-     115,   116,   117,   118,   119,   120,   121,   129
+     115,   116,   117,   118,   119,   120,   121,   122,   130
 };
 
 #if YYDEBUG
-  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_int16 yyrline[] =
 {
-       0,   362,   362,   366,   368,   370,   371,   372,   373,   374,
-     376,   378,   380,   381,   383,   385,   386,   388,   390,   409,
-     420,   431,   432,   433,   435,   437,   439,   440,   441,   443,
-     445,   447,   448,   450,   451,   452,   453,   454,   462,   464,
-     465,   466,   467,   469,   471,   472,   473,   474,   475,   476,
-     479,   480,   483,   484,   485,   486,   487,   488,   489,   490,
-     491,   492,   493,   494,   497,   498,   499,   500,   503,   505,
-     506,   507,   508,   509,   510,   511,   512,   513,   514,   515,
-     516,   517,   518,   519,   520,   521,   522,   523,   524,   525,
-     526,   527,   528,   529,   530,   531,   532,   533,   534,   535,
-     536,   537,   538,   539,   540,   541,   542,   543,   545,   546,
-     547,   548,   549,   550,   551,   552,   553,   554,   555,   556,
-     557,   558,   559,   560,   561,   562,   563,   566,   567,   568,
-     569,   570,   571,   574,   579,   582,   586,   589,   590,   599,
-     600,   623,   640,   641,   665,   668,   669,   685,   686,   689,
-     692,   693,   694,   696,   697,   698,   700,   701,   703,   704,
-     705,   706,   707,   708,   709,   710,   711,   712,   713,   714,
-     715,   716,   717,   719,   720,   721,   722,   723,   725,   726,
-     728,   729,   730,   731,   732,   733,   734,   736,   737,   738,
-     739,   742,   743,   745,   746,   747,   748,   750,   757,   758,
-     761,   762,   763,   764,   765,   766,   769,   770,   771,   772,
-     773,   774,   775,   776,   778,   779,   780,   781,   783,   796,
-     797
+       0,   423,   423,   427,   429,   431,   432,   433,   434,   435,
+     437,   439,   441,   442,   444,   446,   447,   449,   451,   470,
+     481,   492,   493,   494,   496,   498,   500,   501,   502,   504,
+     506,   508,   509,   511,   512,   513,   514,   515,   523,   525,
+     526,   527,   528,   530,   532,   533,   534,   535,   536,   537,
+     540,   541,   544,   545,   546,   547,   548,   549,   550,   551,
+     552,   553,   554,   555,   558,   559,   560,   561,   564,   566,
+     567,   568,   569,   570,   571,   572,   573,   574,   575,   576,
+     577,   578,   579,   580,   581,   582,   583,   584,   585,   586,
+     587,   588,   589,   590,   591,   592,   593,   594,   595,   596,
+     597,   598,   599,   600,   601,   602,   603,   604,   606,   607,
+     608,   609,   610,   611,   612,   613,   614,   615,   616,   617,
+     618,   619,   620,   621,   622,   623,   624,   625,   628,   629,
+     630,   631,   632,   633,   636,   641,   644,   648,   651,   657,
+     666,   672,   695,   712,   713,   737,   740,   741,   757,   758,
+     761,   764,   765,   766,   768,   769,   770,   772,   773,   775,
+     776,   777,   778,   779,   780,   781,   782,   783,   784,   785,
+     786,   787,   788,   789,   791,   792,   793,   794,   795,   797,
+     798,   800,   801,   802,   803,   804,   805,   806,   808,   809,
+     810,   811,   814,   815,   817,   818,   819,   820,   822,   829,
+     830,   833,   834,   835,   836,   837,   838,   841,   842,   843,
+     844,   845,   846,   847,   848,   850,   851,   852,   853,   855,
+     868,   869
 };
 #endif
 
-#if YYDEBUG || YYERROR_VERBOSE || 0
+/** Accessing symbol of state STATE.  */
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
+
+#if YYDEBUG || 0
+/* The user-facing name of the symbol whose (internal) number is
+   YYSYMBOL.  No bounds checking.  */
+static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
+
 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
 static const char *const yytname[] =
 {
-  "$end", "error", "$undefined", "DST", "SRC", "HOST", "GATEWAY", "NET",
-  "NETMASK", "PORT", "PORTRANGE", "LESS", "GREATER", "PROTO", "PROTOCHAIN",
-  "CBYTE", "ARP", "RARP", "IP", "SCTP", "TCP", "UDP", "ICMP", "IGMP",
-  "IGRP", "PIM", "VRRP", "CARP", "ATALK", "AARP", "DECNET", "LAT", "SCA",
-  "MOPRC", "MOPDL", "TK_BROADCAST", "TK_MULTICAST", "NUM", "INBOUND",
-  "OUTBOUND", "PF_IFNAME", "PF_RSET", "PF_RNR", "PF_SRNR", "PF_REASON",
-  "PF_ACTION", "TYPE", "SUBTYPE", "DIR", "ADDR1", "ADDR2", "ADDR3",
-  "ADDR4", "RA", "TA", "LINK", "GEQ", "LEQ", "NEQ", "ID", "EID", "HID",
-  "HID6", "AID", "LSH", "RSH", "LEN", "IPV6", "ICMPV6", "AH", "ESP",
-  "VLAN", "MPLS", "PPPOED", "PPPOES", "GENEVE", "ISO", "ESIS", "CLNP",
-  "ISIS", "L1", "L2", "IIH", "LSP", "SNP", "CSNP", "PSNP", "STP", "IPX",
-  "NETBEUI", "LANE", "LLC", "METAC", "BCC", "SC", "ILMIC", "OAMF4EC",
-  "OAMF4SC", "OAM", "OAMF4", "CONNECTMSG", "METACONNECT", "VPI", "VCI",
-  "RADIO", "FISU", "LSSU", "MSU", "HFISU", "HLSSU", "HMSU", "SIO", "OPC",
-  "DPC", "SLS", "HSIO", "HOPC", "HDPC", "HSLS", "LEX_ERROR", "OR", "AND",
-  "'!'", "'|'", "'&'", "'+'", "'-'", "'*'", "'/'", "UMINUS", "')'", "'('",
-  "'>'", "'='", "'<'", "'['", "']'", "':'", "'%'", "'^'", "$accept",
-  "prog", "null", "expr", "and", "or", "id", "nid", "not", "paren", "pid",
-  "qid", "term", "head", "rterm", "pqual", "dqual", "aqual", "ndaqual",
-  "pname", "other", "pfvar", "p80211", "type", "subtype", "type_subtype",
-  "pllc", "dir", "reason", "action", "relop", "irelop", "arth", "narth",
-  "byteop", "pnum", "atmtype", "atmmultitype", "atmfield", "atmvalue",
-  "atmfieldvalue", "atmlistvalue", "mtp2type", "mtp3field", "mtp3value",
-  "mtp3fieldvalue", "mtp3listvalue", YY_NULLPTR
+  "\"end of file\"", "error", "\"invalid token\"", "DST", "SRC", "HOST",
+  "GATEWAY", "NET", "NETMASK", "PORT", "PORTRANGE", "LESS", "GREATER",
+  "PROTO", "PROTOCHAIN", "CBYTE", "ARP", "RARP", "IP", "SCTP", "TCP",
+  "UDP", "ICMP", "IGMP", "IGRP", "PIM", "VRRP", "CARP", "ATALK", "AARP",
+  "DECNET", "LAT", "SCA", "MOPRC", "MOPDL", "TK_BROADCAST", "TK_MULTICAST",
+  "NUM", "INBOUND", "OUTBOUND", "IFINDEX", "PF_IFNAME", "PF_RSET",
+  "PF_RNR", "PF_SRNR", "PF_REASON", "PF_ACTION", "TYPE", "SUBTYPE", "DIR",
+  "ADDR1", "ADDR2", "ADDR3", "ADDR4", "RA", "TA", "LINK", "GEQ", "LEQ",
+  "NEQ", "ID", "EID", "HID", "HID6", "AID", "LSH", "RSH", "LEN", "IPV6",
+  "ICMPV6", "AH", "ESP", "VLAN", "MPLS", "PPPOED", "PPPOES", "GENEVE",
+  "ISO", "ESIS", "CLNP", "ISIS", "L1", "L2", "IIH", "LSP", "SNP", "CSNP",
+  "PSNP", "STP", "IPX", "NETBEUI", "LANE", "LLC", "METAC", "BCC", "SC",
+  "ILMIC", "OAMF4EC", "OAMF4SC", "OAM", "OAMF4", "CONNECTMSG",
+  "METACONNECT", "VPI", "VCI", "RADIO", "FISU", "LSSU", "MSU", "HFISU",
+  "HLSSU", "HMSU", "SIO", "OPC", "DPC", "SLS", "HSIO", "HOPC", "HDPC",
+  "HSLS", "LEX_ERROR", "OR", "AND", "'!'", "'|'", "'&'", "'+'", "'-'",
+  "'*'", "'/'", "UMINUS", "')'", "'('", "'>'", "'='", "'<'", "'['", "']'",
+  "':'", "'%'", "'^'", "$accept", "prog", "null", "expr", "and", "or",
+  "id", "nid", "not", "paren", "pid", "qid", "term", "head", "rterm",
+  "pqual", "dqual", "aqual", "ndaqual", "pname", "other", "pfvar",
+  "p80211", "type", "subtype", "type_subtype", "pllc", "dir", "reason",
+  "action", "relop", "irelop", "arth", "narth", "byteop", "pnum",
+  "atmtype", "atmmultitype", "atmfield", "atmvalue", "atmfieldvalue",
+  "atmlistvalue", "mtp2type", "mtp3field", "mtp3value", "mtp3fieldvalue",
+  "mtp3listvalue", YY_NULLPTR
 };
+
+static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
+{
+  return yytname[yysymbol];
+}
 #endif
 
-# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
-   (internal) symbol number NUM (which must be that of a token).  */
-static const yytype_int16 yytoknum[] =
-{
-       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
-     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
-     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
-     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
-     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
-     325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
-     335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
-     345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
-     355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
-     365,   366,   367,   368,   369,   370,   371,   372,   373,   374,
-     375,   376,    33,   124,    38,    43,    45,    42,    47,   377,
-      41,    40,    62,    61,    60,    91,    93,    58,    37,    94
-};
-# endif
-
-#define YYPACT_NINF (-216)
+#define YYPACT_NINF (-217)
 
 #define yypact_value_is_default(Yyn) \
   ((Yyn) == YYPACT_NINF)
@@ -1123,331 +1069,337 @@
 #define yytable_value_is_error(Yyn) \
   0
 
-  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-     STATE-NUM.  */
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
 static const yytype_int16 yypact[] =
 {
-    -216,    32,   257,  -216,    -1,    12,    28,  -216,  -216,  -216,
-    -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,
-    -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,    25,
-      37,    31,    43,   -25,    48,  -216,  -216,  -216,  -216,  -216,
-    -216,   -36,   -36,  -216,   -36,   -36,  -216,  -216,  -216,  -216,
-    -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,
-    -216,   -24,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,
-    -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,
-    -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,
-     607,  -216,    54,   491,   491,  -216,   -34,  -216,   721,     2,
-    -216,  -216,  -216,   105,  -216,  -216,  -216,  -216,    17,  -216,
-      21,  -216,  -216,    33,  -216,  -216,  -216,  -216,  -216,  -216,
-    -216,  -216,  -216,   -36,  -216,  -216,  -216,  -216,  -216,  -216,
-     607,     6,    38,  -216,  -216,   374,   374,  -216,  -100,   -20,
-      29,  -216,  -216,    11,     8,  -216,  -216,  -216,   -34,   -34,
-    -216,    60,    65,  -216,  -216,  -216,  -216,  -216,  -216,  -216,
-    -216,  -216,    -6,   109,     1,  -216,  -216,  -216,  -216,  -216,
-    -216,    80,  -216,  -216,  -216,   607,  -216,  -216,  -216,   607,
-     607,   607,   607,   607,   607,   607,   607,  -216,  -216,  -216,
-     607,   607,   607,   607,  -216,   127,   135,   147,  -216,  -216,
-    -216,   156,   157,   158,  -216,  -216,  -216,  -216,  -216,  -216,
-    -216,   159,    29,   181,  -216,   374,   374,  -216,    10,  -216,
-    -216,  -216,  -216,  -216,   136,   161,   162,  -216,  -216,    74,
-      54,    29,   201,   202,   204,   205,  -216,  -216,   163,  -216,
-    -216,  -216,  -216,  -216,  -216,    64,   -56,   -56,   578,   582,
-     -77,   -77,    38,    38,   181,   181,   181,   181,  -216,   -97,
-    -216,  -216,  -216,   -83,  -216,  -216,  -216,   -54,  -216,  -216,
-    -216,  -216,   -34,   -34,  -216,  -216,  -216,  -216,     4,  -216,
-     172,  -216,   127,  -216,   156,  -216,  -216,  -216,  -216,  -216,
-      75,  -216,  -216,  -216
+    -217,    28,   223,  -217,    13,    18,    21,  -217,  -217,  -217,
+    -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,
+    -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,    41,
+     -30,    24,    51,    79,   -25,    26,  -217,  -217,  -217,  -217,
+    -217,  -217,   -24,   -24,  -217,   -24,   -24,  -217,  -217,  -217,
+    -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,
+    -217,  -217,   -23,  -217,  -217,  -217,  -217,  -217,  -217,  -217,
+    -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,
+    -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,
+    -217,   576,  -217,   -50,   459,   459,  -217,    19,  -217,   745,
+       3,  -217,  -217,  -217,   558,  -217,  -217,  -217,  -217,    -5,
+    -217,    39,  -217,  -217,   -14,  -217,  -217,  -217,  -217,  -217,
+    -217,  -217,  -217,  -217,  -217,   -24,  -217,  -217,  -217,  -217,
+    -217,  -217,   576,  -103,   -49,  -217,  -217,   341,   341,  -217,
+    -100,     2,    12,  -217,  -217,    -7,    -3,  -217,  -217,  -217,
+      19,    19,  -217,    -4,    31,  -217,  -217,  -217,  -217,  -217,
+    -217,  -217,  -217,  -217,   -22,    78,   -18,  -217,  -217,  -217,
+    -217,  -217,  -217,    60,  -217,  -217,  -217,   576,  -217,  -217,
+    -217,   576,   576,   576,   576,   576,   576,   576,   576,  -217,
+    -217,  -217,   576,   576,   576,   576,  -217,   125,   126,   127,
+    -217,  -217,  -217,   132,   133,   144,  -217,  -217,  -217,  -217,
+    -217,  -217,  -217,   145,    12,   602,  -217,   341,   341,  -217,
+      10,  -217,  -217,  -217,  -217,  -217,   123,   149,   150,  -217,
+    -217,    63,   -50,    12,   191,   192,   194,   195,  -217,  -217,
+     151,  -217,  -217,  -217,  -217,  -217,  -217,   585,    64,    64,
+     607,    49,   -66,   -66,   -49,   -49,   602,   602,   602,   602,
+    -217,   -97,  -217,  -217,  -217,   -92,  -217,  -217,  -217,   -95,
+    -217,  -217,  -217,  -217,    19,    19,  -217,  -217,  -217,  -217,
+     -12,  -217,   163,  -217,   125,  -217,   132,  -217,  -217,  -217,
+    -217,  -217,    65,  -217,  -217,  -217
 };
 
-  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
-     Performed when YYTABLE does not specify something else to do.  Zero
-     means the default is an error.  */
+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+   Performed when YYTABLE does not specify something else to do.  Zero
+   means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
        4,     0,    51,     1,     0,     0,     0,    71,    72,    70,
       73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
-      83,    84,    85,    86,    88,    87,   178,   113,   114,     0,
-       0,     0,     0,     0,     0,    69,   172,    89,    90,    91,
-      92,   116,   118,   119,   121,   123,    93,    94,   103,    95,
-      96,    97,    98,    99,   100,   102,   101,   104,   105,   106,
-     180,   142,   181,   182,   185,   186,   183,   184,   187,   188,
-     189,   190,   191,   192,   107,   200,   201,   202,   203,   204,
-     205,   206,   207,   208,   209,   210,   211,   212,   213,    24,
-       0,    25,     2,    51,    51,     5,     0,    31,     0,    50,
-      44,   124,   126,     0,   157,   156,    45,    46,     0,    48,
-       0,   110,   111,     0,   127,   128,   129,   130,   147,   148,
-     131,   149,   132,     0,   115,   117,   120,   122,   144,   143,
-       0,     0,   170,    11,    10,    51,    51,    32,     0,   157,
-     156,    15,    21,    18,    20,    22,    39,    12,     0,     0,
-      13,    53,    52,    64,    68,    65,    66,    67,    36,    37,
-     108,   109,     0,     0,     0,    58,    59,    60,    61,    62,
-      63,    34,    35,    38,   125,     0,   151,   153,   155,     0,
-       0,     0,     0,     0,     0,     0,     0,   150,   152,   154,
-       0,     0,     0,     0,   197,     0,     0,     0,    47,   193,
-     218,     0,     0,     0,    49,   214,   174,   173,   176,   177,
-     175,     0,     0,     0,     7,    51,    51,     6,   156,     9,
-       8,    40,   171,   179,     0,     0,     0,    23,    26,    30,
-       0,    29,     0,     0,     0,     0,   137,   138,   134,   141,
-     135,   145,   146,   136,    33,     0,   168,   169,   166,   165,
-     160,   161,   162,   163,   164,   167,    42,    43,   198,     0,
-     194,   195,   219,     0,   215,   216,   112,   156,    17,    16,
-      19,    14,     0,     0,    55,    57,    54,    56,     0,   158,
-       0,   196,     0,   217,     0,    27,    28,   139,   140,   133,
-       0,   199,   220,   159
+      83,    84,    85,    86,    88,    87,   179,   113,   114,     0,
+       0,     0,     0,     0,     0,     0,    69,   173,    89,    90,
+      91,    92,   117,   119,   120,   122,   124,    93,    94,   103,
+      95,    96,    97,    98,    99,   100,   102,   101,   104,   105,
+     106,   181,   143,   182,   183,   186,   187,   184,   185,   188,
+     189,   190,   191,   192,   193,   107,   201,   202,   203,   204,
+     205,   206,   207,   208,   209,   210,   211,   212,   213,   214,
+      24,     0,    25,     2,    51,    51,     5,     0,    31,     0,
+      50,    44,   125,   127,     0,   158,   157,    45,    46,     0,
+      48,     0,   110,   111,     0,   115,   128,   129,   130,   131,
+     148,   149,   132,   150,   133,     0,   116,   118,   121,   123,
+     145,   144,     0,     0,   171,    11,    10,    51,    51,    32,
+       0,   158,   157,    15,    21,    18,    20,    22,    39,    12,
+       0,     0,    13,    53,    52,    64,    68,    65,    66,    67,
+      36,    37,   108,   109,     0,     0,     0,    58,    59,    60,
+      61,    62,    63,    34,    35,    38,   126,     0,   152,   154,
+     156,     0,     0,     0,     0,     0,     0,     0,     0,   151,
+     153,   155,     0,     0,     0,     0,   198,     0,     0,     0,
+      47,   194,   219,     0,     0,     0,    49,   215,   175,   174,
+     177,   178,   176,     0,     0,     0,     7,    51,    51,     6,
+     157,     9,     8,    40,   172,   180,     0,     0,     0,    23,
+      26,    30,     0,    29,     0,     0,     0,     0,   138,   139,
+     135,   142,   136,   146,   147,   137,    33,     0,   169,   170,
+     167,   166,   161,   162,   163,   164,   165,   168,    42,    43,
+     199,     0,   195,   196,   220,     0,   216,   217,   112,   157,
+      17,    16,    19,    14,     0,     0,    55,    57,    54,    56,
+       0,   159,     0,   197,     0,   218,     0,    27,    28,   140,
+     141,   134,     0,   200,   221,   160
 };
 
-  /* YYPGOTO[NTERM-NUM].  */
+/* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -216,  -216,  -216,   210,   -15,  -215,   -90,  -135,     7,    -2,
-    -216,  -216,   -80,  -216,  -216,  -216,  -216,    45,  -216,     9,
-    -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,
-      50,    63,   -66,   -78,  -216,   -37,  -216,  -216,  -216,  -216,
-    -178,  -216,  -216,  -216,  -216,  -179,  -216
+    -217,  -217,  -217,   199,   -26,  -216,   -91,  -133,     7,    -2,
+    -217,  -217,   -77,  -217,  -217,  -217,  -217,    32,  -217,     9,
+    -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,  -217,
+     -43,   -34,   -27,   -81,  -217,   -38,  -217,  -217,  -217,  -217,
+    -195,  -217,  -217,  -217,  -217,  -180,  -217
 };
 
-  /* YYDEFGOTO[NTERM-NUM].  */
+/* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -1,     1,     2,   138,   135,   136,   227,   147,   148,   130,
-     229,   230,    95,    96,    97,    98,   171,   172,   173,   131,
-     100,   101,   174,   238,   289,   240,   102,   243,   120,   122,
-     192,   193,   103,   104,   211,   105,   106,   107,   108,   198,
-     199,   259,   109,   110,   204,   205,   263
+       0,     1,     2,   140,   137,   138,   229,   149,   150,   132,
+     231,   232,    96,    97,    98,    99,   173,   174,   175,   133,
+     101,   102,   176,   240,   291,   242,   103,   245,   122,   124,
+     194,   195,   104,   105,   213,   106,   107,   108,   109,   200,
+     201,   261,   110,   111,   206,   207,   265
 };
 
-  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
-     positive, shift that token.  If negative, reduce the rule whose
-     number is the opposite.  If YYTABLE_NINF, syntax error.  */
+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule whose
+   number is the opposite.  If YYTABLE_NINF, syntax error.  */
 static const yytype_int16 yytable[] =
 {
-      94,    26,   -41,    26,   124,   125,   146,   126,   127,    93,
-     -13,    99,   118,   137,   228,   273,   139,   258,   128,   224,
-     133,   134,   262,   133,   132,   141,   142,   143,   144,   145,
-     221,   236,     3,   281,   119,   129,   111,   133,   241,   123,
-     123,   287,   123,   123,   282,   214,   219,   283,   284,   112,
-     185,   186,   139,   237,   194,   217,   220,   140,   200,   150,
-     242,   190,   191,   288,   213,   113,   -29,   -29,   116,   183,
-     184,   185,   186,   176,   177,   178,   223,   176,   177,   178,
-     117,   228,   190,   191,   114,   153,   212,   155,    89,   156,
-     157,    94,    94,   140,   149,    91,   115,    91,   218,   218,
-      93,    93,    99,    99,   291,   292,   195,   121,   201,   245,
-     222,   150,   231,   246,   247,   248,   249,   250,   251,   252,
-     253,   123,   -41,   -41,   254,   255,   256,   257,   179,   180,
-     -13,   -13,   -41,   216,   216,   137,   226,   175,   139,   225,
-     -13,   175,   215,   215,    99,    99,   149,   123,    91,   187,
-     188,   189,    91,   187,   188,   189,   206,   207,   196,   223,
-     202,   176,   177,   178,   194,   208,   209,   210,   239,   179,
-     180,   197,   260,   203,   133,   134,   190,   191,   218,   267,
-     232,   233,   285,   286,   261,   234,   235,   181,   182,   183,
-     184,   185,   186,   200,   264,   265,   266,   268,   269,   270,
-     279,   280,   190,   191,   271,   274,   275,   276,   277,   290,
-     278,   293,    92,   216,    94,   272,   244,     0,     0,     0,
-       0,     0,   215,   215,    99,    99,     0,     0,   181,   182,
-     183,   184,   185,   186,     0,   150,   150,   187,   188,   189,
-       0,     0,     0,   190,   191,   179,   180,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    -3,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     4,     5,
-     149,   149,     6,     7,     8,     9,    10,    11,    12,    13,
-      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
-      24,    25,     0,     0,    26,    27,    28,    29,    30,    31,
-      32,    33,    34,     0,   181,   182,   183,   184,   185,   186,
-       0,     0,    35,     0,     0,     0,     0,     0,     0,   190,
-     191,     0,     0,    36,    37,    38,    39,    40,    41,    42,
-      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
-      53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
-      63,    64,    65,    66,    67,    68,    69,    70,    71,    72,
-      73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
-      83,    84,    85,    86,    87,    88,     0,     0,     0,    89,
-       0,     0,     0,    90,     0,     4,     5,     0,    91,     6,
-       7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
-      17,    18,    19,    20,    21,    22,    23,    24,    25,     0,
-       0,    26,    27,    28,    29,    30,    31,    32,    33,    34,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,    35,
-       0,     0,     0,   141,   142,   143,   144,   145,     0,     0,
-      36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
-      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
-      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
-      66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
-      76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
-      86,    87,    88,     0,     0,     0,    89,     0,     0,     0,
-      90,     0,     4,     5,     0,    91,     6,     7,     8,     9,
+      95,   226,   260,   -41,   126,   127,   148,   128,   129,    94,
+     -13,   100,   120,    26,   141,   238,   275,   139,   230,   243,
+     130,   135,   136,   264,   135,   289,   -29,   -29,     3,   135,
+     116,   223,   196,   177,   283,   121,   225,   131,   239,   285,
+     125,   125,   244,   125,   125,   284,   216,   221,   290,   286,
+     112,   141,   178,   179,   180,   113,    26,   142,   114,   152,
+     219,   222,   187,   188,   134,   155,   198,   157,   204,   158,
+     159,   135,   136,   192,   193,   199,   202,   205,   115,   143,
+     144,   145,   146,   147,   117,   230,   123,   214,   118,   293,
+     192,   193,    95,    95,   142,   151,   178,   179,   180,   220,
+     220,    94,    94,   100,   100,   215,   294,   197,    92,   203,
+     208,   209,   152,   233,   181,   182,   119,   234,   235,   210,
+     211,   212,   227,   125,   -41,   -41,   228,    92,   189,   190,
+     191,   -13,   -13,   224,   -41,   218,   218,   141,   241,   177,
+     139,   -13,    90,   225,   217,   217,   100,   100,   151,   125,
+     247,    92,   236,   237,   248,   249,   250,   251,   252,   253,
+     254,   255,   196,   262,   263,   256,   257,   258,   259,   202,
+     266,    92,   189,   190,   191,   185,   186,   187,   188,   220,
+     269,   267,   268,   287,   288,   270,   271,   272,   192,   193,
+     185,   186,   187,   188,   273,   276,   277,   278,   279,   280,
+     292,    93,   295,   192,   193,   246,   274,     0,     0,     0,
+       0,     0,     0,     0,     0,   218,    95,     0,     0,     0,
+       0,     0,     0,    -3,   217,   217,   100,   100,     0,     0,
+       0,     0,     0,     0,     4,     5,   152,   152,     6,     7,
+       8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
+      18,    19,    20,    21,    22,    23,    24,    25,     0,     0,
+      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
+       0,     0,   151,   151,     0,     0,     0,     0,     0,    36,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+      37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
+      47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
+      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
+      67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
+      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
+      87,    88,    89,     0,     0,     0,    90,     0,     0,     0,
+      91,     0,     4,     5,     0,    92,     6,     7,     8,     9,
       10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
       20,    21,    22,    23,    24,    25,     0,     0,    26,    27,
-      28,    29,    30,    31,    32,    33,    34,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,    35,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    36,    37,    38,
+      28,    29,    30,    31,    32,    33,    34,    35,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,    36,     0,     0,
+       0,   143,   144,   145,   146,   147,     0,     0,    37,    38,
       39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
       49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
       59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
       69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
       79,    80,    81,    82,    83,    84,    85,    86,    87,    88,
-       0,     0,     0,    89,     0,     0,     0,    90,     0,     0,
-       0,     0,    91,     7,     8,     9,    10,    11,    12,    13,
-      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
-      24,    25,   179,   180,    26,     0,   179,   180,     0,     0,
+      89,     0,     0,     0,    90,     0,     0,     0,    91,     0,
+       4,     5,     0,    92,     6,     7,     8,     9,    10,    11,
+      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
+      22,    23,    24,    25,     0,     0,    26,    27,    28,    29,
+      30,    31,    32,    33,    34,    35,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,    36,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,    37,    38,    39,    40,
+      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
+      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
+      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
+      71,    72,    73,    74,    75,    76,    77,    78,    79,    80,
+      81,    82,    83,    84,    85,    86,    87,    88,    89,     0,
+       0,     0,    90,     0,     0,     0,    91,     0,     0,     0,
+       0,    92,     7,     8,     9,    10,    11,    12,    13,    14,
+      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
+      25,     0,     0,    26,     0,   178,   179,   180,     0,     0,
+       0,     0,     0,   181,   182,     0,     0,     0,     0,     0,
+       0,     0,    36,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,    37,    38,    39,    40,    41,     0,     0,
+     181,   182,     0,    47,    48,    49,    50,    51,    52,    53,
+      54,    55,    56,    57,    58,    59,    60,   181,   182,     0,
+       0,     0,   181,   182,     0,     0,     0,     0,     0,     0,
+       0,    75,   183,   184,   185,   186,   187,   188,     0,     0,
+       0,   189,   190,   191,     0,     0,     0,   192,   193,     0,
+       0,     0,     0,    91,     0,     0,     0,     0,    92,   183,
+     184,   185,   186,   187,   188,     0,     0,     0,     0,     0,
+       0,     0,   281,   282,   192,   193,   183,   184,   185,   186,
+     187,   188,   184,   185,   186,   187,   188,     0,     0,     0,
+       0,   192,   193,     0,     0,     0,   192,   193,   153,   154,
+     155,   156,   157,     0,   158,   159,     0,     0,   160,   161,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,    35,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,    36,    37,    38,    39,    40,     0,     0,
-       0,     0,     0,    46,    47,    48,    49,    50,    51,    52,
-      53,    54,    55,    56,    57,    58,    59,     0,     0,     0,
-       0,     0,   182,   183,   184,   185,   186,   183,   184,   185,
-     186,    74,     0,     0,     0,     0,   190,   191,     0,     0,
-     190,   191,     0,     0,   151,   152,   153,   154,   155,     0,
-     156,   157,     0,    90,   158,   159,     0,     0,    91,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   160,   161,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,   162,   163,   164,
-     165,   166,   167,   168,   169,   170
+     162,   163,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,   164,   165,   166,   167,   168,   169,   170,   171,
+     172
 };
 
 static const yytype_int16 yycheck[] =
 {
-       2,    37,     0,    37,    41,    42,    96,    44,    45,     2,
-       0,     2,    37,    93,   149,   230,    94,   195,    42,     8,
-     120,   121,   201,   120,    90,    59,    60,    61,    62,    63,
-     130,    37,     0,   130,    59,    59,    37,   120,    37,    41,
-      42,    37,    44,    45,   259,   135,   136,   130,   263,    37,
-     127,   128,   130,    59,    37,   135,   136,    94,    37,    96,
-      59,   138,   139,    59,   130,    37,   120,   121,    37,   125,
-     126,   127,   128,    56,    57,    58,   130,    56,    57,    58,
-      37,   216,   138,   139,    59,     5,   123,     7,   122,     9,
-      10,    93,    94,   130,    96,   131,    59,   131,   135,   136,
-      93,    94,    93,    94,   282,   284,   108,    59,   110,   175,
-     130,   148,   149,   179,   180,   181,   182,   183,   184,   185,
-     186,   123,   120,   121,   190,   191,   192,   193,    64,    65,
-     120,   121,   130,   135,   136,   215,   128,   135,   216,   128,
-     130,   135,   135,   136,   135,   136,   148,   149,   131,   132,
-     133,   134,   131,   132,   133,   134,   123,   124,   108,   130,
-     110,    56,    57,    58,    37,   132,   133,   134,    59,    64,
-      65,   108,    37,   110,   120,   121,   138,   139,   215,   216,
-     120,   121,   272,   273,    37,   120,   121,   123,   124,   125,
-     126,   127,   128,    37,    37,    37,    37,    61,    37,    37,
-     136,   137,   138,   139,   130,     4,     4,     3,     3,    37,
-      47,   136,     2,   215,   216,   230,   171,    -1,    -1,    -1,
-      -1,    -1,   215,   216,   215,   216,    -1,    -1,   123,   124,
-     125,   126,   127,   128,    -1,   272,   273,   132,   133,   134,
-      -1,    -1,    -1,   138,   139,    64,    65,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,     0,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    11,    12,
-     272,   273,    15,    16,    17,    18,    19,    20,    21,    22,
-      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
-      33,    34,    -1,    -1,    37,    38,    39,    40,    41,    42,
-      43,    44,    45,    -1,   123,   124,   125,   126,   127,   128,
-      -1,    -1,    55,    -1,    -1,    -1,    -1,    -1,    -1,   138,
-     139,    -1,    -1,    66,    67,    68,    69,    70,    71,    72,
-      73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
-      83,    84,    85,    86,    87,    88,    89,    90,    91,    92,
-      93,    94,    95,    96,    97,    98,    99,   100,   101,   102,
-     103,   104,   105,   106,   107,   108,   109,   110,   111,   112,
-     113,   114,   115,   116,   117,   118,    -1,    -1,    -1,   122,
-      -1,    -1,    -1,   126,    -1,    11,    12,    -1,   131,    15,
-      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
-      26,    27,    28,    29,    30,    31,    32,    33,    34,    -1,
-      -1,    37,    38,    39,    40,    41,    42,    43,    44,    45,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    55,
-      -1,    -1,    -1,    59,    60,    61,    62,    63,    -1,    -1,
-      66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
-      76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
-      86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
-      96,    97,    98,    99,   100,   101,   102,   103,   104,   105,
-     106,   107,   108,   109,   110,   111,   112,   113,   114,   115,
-     116,   117,   118,    -1,    -1,    -1,   122,    -1,    -1,    -1,
-     126,    -1,    11,    12,    -1,   131,    15,    16,    17,    18,
+       2,     8,   197,     0,    42,    43,    97,    45,    46,     2,
+       0,     2,    37,    37,    95,    37,   232,    94,   151,    37,
+      43,   121,   122,   203,   121,    37,   121,   122,     0,   121,
+      60,   131,    37,   136,   131,    60,   131,    60,    60,   131,
+      42,    43,    60,    45,    46,   261,   137,   138,    60,   265,
+      37,   132,    57,    58,    59,    37,    37,    95,    37,    97,
+     137,   138,   128,   129,    91,     5,   109,     7,   111,     9,
+      10,   121,   122,   139,   140,   109,    37,   111,    37,    60,
+      61,    62,    63,    64,    60,   218,    60,   125,    37,   284,
+     139,   140,    94,    95,   132,    97,    57,    58,    59,   137,
+     138,    94,    95,    94,    95,   132,   286,   109,   132,   111,
+     124,   125,   150,   151,    65,    66,    37,   121,   122,   133,
+     134,   135,   129,   125,   121,   122,   129,   132,   133,   134,
+     135,   121,   122,   131,   131,   137,   138,   218,    60,   136,
+     217,   131,   123,   131,   137,   138,   137,   138,   150,   151,
+     177,   132,   121,   122,   181,   182,   183,   184,   185,   186,
+     187,   188,    37,    37,    37,   192,   193,   194,   195,    37,
+      37,   132,   133,   134,   135,   126,   127,   128,   129,   217,
+     218,    37,    37,   274,   275,    62,    37,    37,   139,   140,
+     126,   127,   128,   129,   131,     4,     4,     3,     3,    48,
+      37,     2,   137,   139,   140,   173,   232,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   217,   218,    -1,    -1,    -1,
+      -1,    -1,    -1,     0,   217,   218,   217,   218,    -1,    -1,
+      -1,    -1,    -1,    -1,    11,    12,   274,   275,    15,    16,
+      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
+      27,    28,    29,    30,    31,    32,    33,    34,    -1,    -1,
+      37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
+      -1,    -1,   274,   275,    -1,    -1,    -1,    -1,    -1,    56,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
+      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
+      87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
+      97,    98,    99,   100,   101,   102,   103,   104,   105,   106,
+     107,   108,   109,   110,   111,   112,   113,   114,   115,   116,
+     117,   118,   119,    -1,    -1,    -1,   123,    -1,    -1,    -1,
+     127,    -1,    11,    12,    -1,   132,    15,    16,    17,    18,
       19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
       29,    30,    31,    32,    33,    34,    -1,    -1,    37,    38,
-      39,    40,    41,    42,    43,    44,    45,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    55,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    66,    67,    68,
+      39,    40,    41,    42,    43,    44,    45,    46,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    56,    -1,    -1,
+      -1,    60,    61,    62,    63,    64,    -1,    -1,    67,    68,
       69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
       79,    80,    81,    82,    83,    84,    85,    86,    87,    88,
       89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
       99,   100,   101,   102,   103,   104,   105,   106,   107,   108,
      109,   110,   111,   112,   113,   114,   115,   116,   117,   118,
-      -1,    -1,    -1,   122,    -1,    -1,    -1,   126,    -1,    -1,
-      -1,    -1,   131,    16,    17,    18,    19,    20,    21,    22,
-      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
-      33,    34,    64,    65,    37,    -1,    64,    65,    -1,    -1,
+     119,    -1,    -1,    -1,   123,    -1,    -1,    -1,   127,    -1,
+      11,    12,    -1,   132,    15,    16,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
+      31,    32,    33,    34,    -1,    -1,    37,    38,    39,    40,
+      41,    42,    43,    44,    45,    46,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    56,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    67,    68,    69,    70,
+      71,    72,    73,    74,    75,    76,    77,    78,    79,    80,
+      81,    82,    83,    84,    85,    86,    87,    88,    89,    90,
+      91,    92,    93,    94,    95,    96,    97,    98,    99,   100,
+     101,   102,   103,   104,   105,   106,   107,   108,   109,   110,
+     111,   112,   113,   114,   115,   116,   117,   118,   119,    -1,
+      -1,    -1,   123,    -1,    -1,    -1,   127,    -1,    -1,    -1,
+      -1,   132,    16,    17,    18,    19,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
+      34,    -1,    -1,    37,    -1,    57,    58,    59,    -1,    -1,
+      -1,    -1,    -1,    65,    66,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    56,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    67,    68,    69,    70,    71,    -1,    -1,
+      65,    66,    -1,    77,    78,    79,    80,    81,    82,    83,
+      84,    85,    86,    87,    88,    89,    90,    65,    66,    -1,
+      -1,    -1,    65,    66,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,   105,   124,   125,   126,   127,   128,   129,    -1,    -1,
+      -1,   133,   134,   135,    -1,    -1,    -1,   139,   140,    -1,
+      -1,    -1,    -1,   127,    -1,    -1,    -1,    -1,   132,   124,
+     125,   126,   127,   128,   129,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,   137,   138,   139,   140,   124,   125,   126,   127,
+     128,   129,   125,   126,   127,   128,   129,    -1,    -1,    -1,
+      -1,   139,   140,    -1,    -1,    -1,   139,   140,     3,     4,
+       5,     6,     7,    -1,     9,    10,    -1,    -1,    13,    14,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    55,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    66,    67,    68,    69,    70,    -1,    -1,
-      -1,    -1,    -1,    76,    77,    78,    79,    80,    81,    82,
-      83,    84,    85,    86,    87,    88,    89,    -1,    -1,    -1,
-      -1,    -1,   124,   125,   126,   127,   128,   125,   126,   127,
-     128,   104,    -1,    -1,    -1,    -1,   138,   139,    -1,    -1,
-     138,   139,    -1,    -1,     3,     4,     5,     6,     7,    -1,
-       9,    10,    -1,   126,    13,    14,    -1,    -1,   131,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    35,    36,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    46,    47,    48,
-      49,    50,    51,    52,    53,    54
+      35,    36,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    47,    48,    49,    50,    51,    52,    53,    54,
+      55
 };
 
-  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-     symbol of state STATE-NUM.  */
+/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
+   state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,   141,   142,     0,    11,    12,    15,    16,    17,    18,
+       0,   142,   143,     0,    11,    12,    15,    16,    17,    18,
       19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
       29,    30,    31,    32,    33,    34,    37,    38,    39,    40,
-      41,    42,    43,    44,    45,    55,    66,    67,    68,    69,
+      41,    42,    43,    44,    45,    46,    56,    67,    68,    69,
       70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
       80,    81,    82,    83,    84,    85,    86,    87,    88,    89,
       90,    91,    92,    93,    94,    95,    96,    97,    98,    99,
      100,   101,   102,   103,   104,   105,   106,   107,   108,   109,
-     110,   111,   112,   113,   114,   115,   116,   117,   118,   122,
-     126,   131,   143,   148,   149,   152,   153,   154,   155,   159,
-     160,   161,   166,   172,   173,   175,   176,   177,   178,   182,
-     183,    37,    37,    37,    59,    59,    37,    37,    37,    59,
-     168,    59,   169,   149,   175,   175,   175,   175,    42,    59,
-     149,   159,   172,   120,   121,   144,   145,   152,   143,   173,
-     175,    59,    60,    61,    62,    63,   146,   147,   148,   149,
-     175,     3,     4,     5,     6,     7,     9,    10,    13,    14,
-      35,    36,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,   156,   157,   158,   162,   135,    56,    57,    58,    64,
-      65,   123,   124,   125,   126,   127,   128,   132,   133,   134,
-     138,   139,   170,   171,    37,   149,   170,   171,   179,   180,
-      37,   149,   170,   171,   184,   185,   123,   124,   132,   133,
-     134,   174,   175,   172,   146,   148,   149,   152,   175,   146,
-     152,   130,   130,   130,     8,   128,   128,   146,   147,   150,
-     151,   175,   120,   121,   120,   121,    37,    59,   163,    59,
-     165,    37,    59,   167,   157,   172,   172,   172,   172,   172,
-     172,   172,   172,   172,   172,   172,   172,   172,   180,   181,
-      37,    37,   185,   186,    37,    37,    37,   175,    61,    37,
-      37,   130,   144,   145,     4,     4,     3,     3,    47,   136,
-     137,   130,   145,   130,   145,   146,   146,    37,    59,   164,
-      37,   180,   185,   136
+     110,   111,   112,   113,   114,   115,   116,   117,   118,   119,
+     123,   127,   132,   144,   149,   150,   153,   154,   155,   156,
+     160,   161,   162,   167,   173,   174,   176,   177,   178,   179,
+     183,   184,    37,    37,    37,    37,    60,    60,    37,    37,
+      37,    60,   169,    60,   170,   150,   176,   176,   176,   176,
+      43,    60,   150,   160,   173,   121,   122,   145,   146,   153,
+     144,   174,   176,    60,    61,    62,    63,    64,   147,   148,
+     149,   150,   176,     3,     4,     5,     6,     7,     9,    10,
+      13,    14,    35,    36,    47,    48,    49,    50,    51,    52,
+      53,    54,    55,   157,   158,   159,   163,   136,    57,    58,
+      59,    65,    66,   124,   125,   126,   127,   128,   129,   133,
+     134,   135,   139,   140,   171,   172,    37,   150,   171,   172,
+     180,   181,    37,   150,   171,   172,   185,   186,   124,   125,
+     133,   134,   135,   175,   176,   173,   147,   149,   150,   153,
+     176,   147,   153,   131,   131,   131,     8,   129,   129,   147,
+     148,   151,   152,   176,   121,   122,   121,   122,    37,    60,
+     164,    60,   166,    37,    60,   168,   158,   173,   173,   173,
+     173,   173,   173,   173,   173,   173,   173,   173,   173,   173,
+     181,   182,    37,    37,   186,   187,    37,    37,    37,   176,
+      62,    37,    37,   131,   145,   146,     4,     4,     3,     3,
+      48,   137,   138,   131,   146,   131,   146,   147,   147,    37,
+      60,   165,    37,   181,   186,   137
 };
 
-  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,   140,   141,   141,   142,   143,   143,   143,   143,   143,
-     144,   145,   146,   146,   146,   147,   147,   147,   147,   147,
-     147,   147,   147,   147,   148,   149,   150,   150,   150,   151,
-     151,   152,   152,   153,   153,   153,   153,   153,   153,   154,
-     154,   154,   154,   154,   154,   154,   154,   154,   154,   154,
-     155,   155,   156,   156,   156,   156,   156,   156,   156,   156,
-     156,   156,   156,   156,   157,   157,   157,   157,   158,   159,
-     159,   159,   159,   159,   159,   159,   159,   159,   159,   159,
-     159,   159,   159,   159,   159,   159,   159,   159,   159,   159,
-     159,   159,   159,   159,   159,   159,   159,   159,   159,   159,
-     159,   159,   159,   159,   159,   159,   159,   159,   160,   160,
+       0,   141,   142,   142,   143,   144,   144,   144,   144,   144,
+     145,   146,   147,   147,   147,   148,   148,   148,   148,   148,
+     148,   148,   148,   148,   149,   150,   151,   151,   151,   152,
+     152,   153,   153,   154,   154,   154,   154,   154,   154,   155,
+     155,   155,   155,   155,   155,   155,   155,   155,   155,   155,
+     156,   156,   157,   157,   157,   157,   157,   157,   157,   157,
+     157,   157,   157,   157,   158,   158,   158,   158,   159,   160,
      160,   160,   160,   160,   160,   160,   160,   160,   160,   160,
-     160,   160,   160,   160,   160,   160,   160,   161,   161,   161,
-     161,   161,   161,   162,   162,   162,   162,   163,   163,   164,
-     164,   165,   166,   166,   166,   167,   167,   168,   168,   169,
-     170,   170,   170,   171,   171,   171,   172,   172,   173,   173,
-     173,   173,   173,   173,   173,   173,   173,   173,   173,   173,
-     173,   173,   173,   174,   174,   174,   174,   174,   175,   175,
-     176,   176,   176,   176,   176,   176,   176,   177,   177,   177,
-     177,   178,   178,   179,   179,   179,   179,   180,   181,   181,
-     182,   182,   182,   182,   182,   182,   183,   183,   183,   183,
-     183,   183,   183,   183,   184,   184,   184,   184,   185,   186,
-     186
+     160,   160,   160,   160,   160,   160,   160,   160,   160,   160,
+     160,   160,   160,   160,   160,   160,   160,   160,   160,   160,
+     160,   160,   160,   160,   160,   160,   160,   160,   161,   161,
+     161,   161,   161,   161,   161,   161,   161,   161,   161,   161,
+     161,   161,   161,   161,   161,   161,   161,   161,   162,   162,
+     162,   162,   162,   162,   163,   163,   163,   163,   164,   164,
+     165,   165,   166,   167,   167,   167,   168,   168,   169,   169,
+     170,   171,   171,   171,   172,   172,   172,   173,   173,   174,
+     174,   174,   174,   174,   174,   174,   174,   174,   174,   174,
+     174,   174,   174,   174,   175,   175,   175,   175,   175,   176,
+     176,   177,   177,   177,   177,   177,   177,   177,   178,   178,
+     178,   178,   179,   179,   180,   180,   180,   180,   181,   182,
+     182,   183,   183,   183,   183,   183,   183,   184,   184,   184,
+     184,   184,   184,   184,   184,   185,   185,   185,   185,   186,
+     187,   187
 };
 
-  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
 static const yytype_int8 yyr2[] =
 {
        0,     2,     2,     1,     0,     1,     3,     3,     3,     3,
@@ -1461,29 +1413,30 @@
        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     1,     1,     1,     1,     1,     1,     1,     2,     2,
-       2,     2,     4,     1,     1,     2,     1,     2,     1,     1,
-       2,     1,     2,     1,     1,     2,     1,     2,     2,     2,
-       2,     2,     2,     4,     2,     2,     2,     1,     1,     1,
-       1,     1,     1,     2,     2,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     4,     6,
-       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
-       2,     3,     1,     1,     1,     1,     1,     1,     1,     3,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     2,     2,     3,     1,     1,     3,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       2,     2,     4,     1,     1,     2,     2,     1,     2,     1,
+       1,     2,     1,     2,     1,     1,     2,     1,     2,     2,
+       2,     2,     2,     2,     4,     2,     2,     2,     1,     1,
+       1,     1,     1,     1,     2,     2,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     4,
+       6,     3,     3,     3,     3,     3,     3,     3,     3,     3,
+       3,     2,     3,     1,     1,     1,     1,     1,     1,     1,
+       3,     1,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     1,     1,     1,     1,     2,     2,     3,     1,     1,
-       3
+       3,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     2,     2,     3,     1,
+       1,     3
 };
 
 
+enum { YYENOMEM = -2 };
+
 #define yyerrok         (yyerrstatus = 0)
 #define yyclearin       (yychar = YYEMPTY)
-#define YYEMPTY         (-2)
-#define YYEOF           0
 
 #define YYACCEPT        goto yyacceptlab
 #define YYABORT         goto yyabortlab
 #define YYERROR         goto yyerrorlab
+#define YYNOMEM         goto yyexhaustedlab
 
 
 #define YYRECOVERING()  (!!yyerrstatus)
@@ -1505,10 +1458,9 @@
       }                                                           \
   while (0)
 
-/* Error token number */
-#define YYTERROR        1
-#define YYERRCODE       256
-
+/* Backward compatibility with an undocumented macro.
+   Use YYerror or YYUNDEF. */
+#define YYERRCODE YYUNDEF
 
 
 /* Enable debugging if requested.  */
@@ -1525,19 +1477,16 @@
     YYFPRINTF Args;                             \
 } while (0)
 
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
 
 
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
+
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
 do {                                                                      \
   if (yydebug)                                                            \
     {                                                                     \
       YYFPRINTF (stderr, "%s ", Title);                                   \
       yy_symbol_print (stderr,                                            \
-                  Type, Value, yyscanner, cstate); \
+                  Kind, Value, yyscanner, cstate); \
       YYFPRINTF (stderr, "\n");                                           \
     }                                                                     \
 } while (0)
@@ -1548,20 +1497,17 @@
 `-----------------------------------*/
 
 static void
-yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, void *yyscanner, compiler_state_t *cstate)
+yy_symbol_value_print (FILE *yyo,
+                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *yyscanner, compiler_state_t *cstate)
 {
   FILE *yyoutput = yyo;
-  YYUSE (yyoutput);
-  YYUSE (yyscanner);
-  YYUSE (cstate);
+  YY_USE (yyoutput);
+  YY_USE (yyscanner);
+  YY_USE (cstate);
   if (!yyvaluep)
     return;
-# ifdef YYPRINT
-  if (yytype < YYNTOKENS)
-    YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
-# endif
   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  YYUSE (yytype);
+  YY_USE (yykind);
   YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
@@ -1571,12 +1517,13 @@
 `---------------------------*/
 
 static void
-yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, void *yyscanner, compiler_state_t *cstate)
+yy_symbol_print (FILE *yyo,
+                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *yyscanner, compiler_state_t *cstate)
 {
   YYFPRINTF (yyo, "%s %s (",
-             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
 
-  yy_symbol_value_print (yyo, yytype, yyvaluep, yyscanner, cstate);
+  yy_symbol_value_print (yyo, yykind, yyvaluep, yyscanner, cstate);
   YYFPRINTF (yyo, ")");
 }
 
@@ -1609,7 +1556,8 @@
 `------------------------------------------------*/
 
 static void
-yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule, void *yyscanner, compiler_state_t *cstate)
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
+                 int yyrule, void *yyscanner, compiler_state_t *cstate)
 {
   int yylno = yyrline[yyrule];
   int yynrhs = yyr2[yyrule];
@@ -1621,9 +1569,8 @@
     {
       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr,
-                       yystos[+yyssp[yyi + 1 - yynrhs]],
-                       &yyvsp[(yyi + 1) - (yynrhs)]
-                                              , yyscanner, cstate);
+                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+                       &yyvsp[(yyi + 1) - (yynrhs)], yyscanner, cstate);
       YYFPRINTF (stderr, "\n");
     }
 }
@@ -1638,8 +1585,8 @@
    multiple parsers can coexist.  */
 int yydebug;
 #else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YYDPRINTF(Args) ((void) 0)
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
 # define YY_STACK_PRINT(Bottom, Top)
 # define YY_REDUCE_PRINT(Rule)
 #endif /* !YYDEBUG */
@@ -1662,260 +1609,35 @@
 #endif
 
 
-#if YYERROR_VERBOSE
 
-# ifndef yystrlen
-#  if defined __GLIBC__ && defined _STRING_H
-#   define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
-#  else
-/* Return the length of YYSTR.  */
-static YYPTRDIFF_T
-yystrlen (const char *yystr)
-{
-  YYPTRDIFF_T yylen;
-  for (yylen = 0; yystr[yylen]; yylen++)
-    continue;
-  return yylen;
-}
-#  endif
-# endif
 
-# ifndef yystpcpy
-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-#   define yystpcpy stpcpy
-#  else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
-   YYDEST.  */
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-{
-  char *yyd = yydest;
-  const char *yys = yysrc;
 
-  while ((*yyd++ = *yys++) != '\0')
-    continue;
-
-  return yyd - 1;
-}
-#  endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
-   quotes and backslashes, so that it's suitable for yyerror.  The
-   heuristic is that double-quoting is unnecessary unless the string
-   contains an apostrophe, a comma, or backslash (other than
-   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
-   null, do not copy; instead, return the length of what the result
-   would have been.  */
-static YYPTRDIFF_T
-yytnamerr (char *yyres, const char *yystr)
-{
-  if (*yystr == '"')
-    {
-      YYPTRDIFF_T yyn = 0;
-      char const *yyp = yystr;
-
-      for (;;)
-        switch (*++yyp)
-          {
-          case '\'':
-          case ',':
-            goto do_not_strip_quotes;
-
-          case '\\':
-            if (*++yyp != '\\')
-              goto do_not_strip_quotes;
-            else
-              goto append;
-
-          append:
-          default:
-            if (yyres)
-              yyres[yyn] = *yyp;
-            yyn++;
-            break;
-
-          case '"':
-            if (yyres)
-              yyres[yyn] = '\0';
-            return yyn;
-          }
-    do_not_strip_quotes: ;
-    }
-
-  if (yyres)
-    return yystpcpy (yyres, yystr) - yyres;
-  else
-    return yystrlen (yystr);
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
-   about the unexpected token YYTOKEN for the state stack whose top is
-   YYSSP.
-
-   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
-   not large enough to hold the message.  In that case, also set
-   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
-   required number of bytes is too large to store.  */
-static int
-yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
-                yy_state_t *yyssp, int yytoken)
-{
-  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
-  /* Internationalized format string. */
-  const char *yyformat = YY_NULLPTR;
-  /* Arguments of yyformat: reported tokens (one for the "unexpected",
-     one per "expected"). */
-  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-  /* Actual size of YYARG. */
-  int yycount = 0;
-  /* Cumulated lengths of YYARG.  */
-  YYPTRDIFF_T yysize = 0;
-
-  /* There are many possibilities here to consider:
-     - If this state is a consistent state with a default action, then
-       the only way this function was invoked is if the default action
-       is an error action.  In that case, don't check for expected
-       tokens because there are none.
-     - The only way there can be no lookahead present (in yychar) is if
-       this state is a consistent state with a default action.  Thus,
-       detecting the absence of a lookahead is sufficient to determine
-       that there is no unexpected or expected token to report.  In that
-       case, just report a simple "syntax error".
-     - Don't assume there isn't a lookahead just because this state is a
-       consistent state with a default action.  There might have been a
-       previous inconsistent state, consistent state with a non-default
-       action, or user semantic action that manipulated yychar.
-     - Of course, the expected token list depends on states to have
-       correct lookahead information, and it depends on the parser not
-       to perform extra reductions after fetching a lookahead from the
-       scanner and before detecting a syntax error.  Thus, state merging
-       (from LALR or IELR) and default reductions corrupt the expected
-       token list.  However, the list is correct for canonical LR with
-       one exception: it will still contain any token that will not be
-       accepted due to an error action in a later state.
-  */
-  if (yytoken != YYEMPTY)
-    {
-      int yyn = yypact[+*yyssp];
-      YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
-      yysize = yysize0;
-      yyarg[yycount++] = yytname[yytoken];
-      if (!yypact_value_is_default (yyn))
-        {
-          /* Start YYX at -YYN if negative to avoid negative indexes in
-             YYCHECK.  In other words, skip the first -YYN actions for
-             this state because they are default actions.  */
-          int yyxbegin = yyn < 0 ? -yyn : 0;
-          /* Stay within bounds of both yycheck and yytname.  */
-          int yychecklim = YYLAST - yyn + 1;
-          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-          int yyx;
-
-          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
-                && !yytable_value_is_error (yytable[yyx + yyn]))
-              {
-                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
-                  {
-                    yycount = 1;
-                    yysize = yysize0;
-                    break;
-                  }
-                yyarg[yycount++] = yytname[yyx];
-                {
-                  YYPTRDIFF_T yysize1
-                    = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
-                  if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
-                    yysize = yysize1;
-                  else
-                    return 2;
-                }
-              }
-        }
-    }
-
-  switch (yycount)
-    {
-# define YYCASE_(N, S)                      \
-      case N:                               \
-        yyformat = S;                       \
-      break
-    default: /* Avoid compiler warnings. */
-      YYCASE_(0, YY_("syntax error"));
-      YYCASE_(1, YY_("syntax error, unexpected %s"));
-      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
-      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
-      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
-      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
-    }
-
-  {
-    /* Don't count the "%s"s in the final size, but reserve room for
-       the terminator.  */
-    YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
-    if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
-      yysize = yysize1;
-    else
-      return 2;
-  }
-
-  if (*yymsg_alloc < yysize)
-    {
-      *yymsg_alloc = 2 * yysize;
-      if (! (yysize <= *yymsg_alloc
-             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
-        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
-      return 1;
-    }
-
-  /* Avoid sprintf, as that infringes on the user's name space.
-     Don't have undefined behavior even if the translation
-     produced a string with the wrong number of "%s"s.  */
-  {
-    char *yyp = *yymsg;
-    int yyi = 0;
-    while ((*yyp = *yyformat) != '\0')
-      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
-        {
-          yyp += yytnamerr (yyp, yyarg[yyi++]);
-          yyformat += 2;
-        }
-      else
-        {
-          ++yyp;
-          ++yyformat;
-        }
-  }
-  return 0;
-}
-#endif /* YYERROR_VERBOSE */
 
 /*-----------------------------------------------.
 | Release the memory associated to this symbol.  |
 `-----------------------------------------------*/
 
 static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *yyscanner, compiler_state_t *cstate)
+yydestruct (const char *yymsg,
+            yysymbol_kind_t yykind, YYSTYPE *yyvaluep, void *yyscanner, compiler_state_t *cstate)
 {
-  YYUSE (yyvaluep);
-  YYUSE (yyscanner);
-  YYUSE (cstate);
+  YY_USE (yyvaluep);
+  YY_USE (yyscanner);
+  YY_USE (cstate);
   if (!yymsg)
     yymsg = "Deleting";
-  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
 
   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  YYUSE (yytype);
+  YY_USE (yykind);
   YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
 
 
+
+
 /*----------.
 | yyparse.  |
 `----------*/
@@ -1923,7 +1645,7 @@
 int
 yyparse (void *yyscanner, compiler_state_t *cstate)
 {
-/* The lookahead symbol.  */
+/* Lookahead token kind.  */
 int yychar;
 
 
@@ -1934,45 +1656,38 @@
 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
 
     /* Number of syntax errors so far.  */
-    int yynerrs;
+    int yynerrs = 0;
 
-    yy_state_fast_t yystate;
+    yy_state_fast_t yystate = 0;
     /* Number of tokens to shift before error messages enabled.  */
-    int yyerrstatus;
+    int yyerrstatus = 0;
 
-    /* The stacks and their tools:
-       'yyss': related to states.
-       'yyvs': related to semantic values.
-
-       Refer to the stacks through separate pointers, to allow yyoverflow
+    /* Refer to the stacks through separate pointers, to allow yyoverflow
        to reallocate them elsewhere.  */
 
-    /* The state stack.  */
+    /* Their size.  */
+    YYPTRDIFF_T yystacksize = YYINITDEPTH;
+
+    /* The state stack: array, bottom, top.  */
     yy_state_t yyssa[YYINITDEPTH];
-    yy_state_t *yyss;
-    yy_state_t *yyssp;
+    yy_state_t *yyss = yyssa;
+    yy_state_t *yyssp = yyss;
 
-    /* The semantic value stack.  */
+    /* The semantic value stack: array, bottom, top.  */
     YYSTYPE yyvsa[YYINITDEPTH];
-    YYSTYPE *yyvs;
-    YYSTYPE *yyvsp;
-
-    YYPTRDIFF_T yystacksize;
+    YYSTYPE *yyvs = yyvsa;
+    YYSTYPE *yyvsp = yyvs;
 
   int yyn;
+  /* The return value of yyparse.  */
   int yyresult;
-  /* Lookahead token as an internal (translated) token number.  */
-  int yytoken = 0;
+  /* Lookahead symbol kind.  */
+  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
   /* The variables used to return semantic value and location from the
      action routines.  */
   YYSTYPE yyval;
 
-#if YYERROR_VERBOSE
-  /* Buffer for error messages, and its allocated size.  */
-  char yymsgbuf[128];
-  char *yymsg = yymsgbuf;
-  YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
-#endif
+
 
 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
@@ -1980,16 +1695,10 @@
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
-  yyssp = yyss = yyssa;
-  yyvsp = yyvs = yyvsa;
-  yystacksize = YYINITDEPTH;
-
   YYDPRINTF ((stderr, "Starting parse\n"));
 
-  yystate = 0;
-  yyerrstatus = 0;
-  yynerrs = 0;
   yychar = YYEMPTY; /* Cause a token to be read.  */
+
   goto yysetstate;
 
 
@@ -2011,10 +1720,11 @@
   YY_IGNORE_USELESS_CAST_BEGIN
   *yyssp = YY_CAST (yy_state_t, yystate);
   YY_IGNORE_USELESS_CAST_END
+  YY_STACK_PRINT (yyss, yyssp);
 
   if (yyss + yystacksize - 1 <= yyssp)
 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
-    goto yyexhaustedlab;
+    YYNOMEM;
 #else
     {
       /* Get the current used size of the three stacks, in elements.  */
@@ -2042,7 +1752,7 @@
 # else /* defined YYSTACK_RELOCATE */
       /* Extend the stack our own way.  */
       if (YYMAXDEPTH <= yystacksize)
-        goto yyexhaustedlab;
+        YYNOMEM;
       yystacksize *= 2;
       if (YYMAXDEPTH < yystacksize)
         yystacksize = YYMAXDEPTH;
@@ -2053,10 +1763,10 @@
           YY_CAST (union yyalloc *,
                    YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
         if (! yyptr)
-          goto yyexhaustedlab;
+          YYNOMEM;
         YYSTACK_RELOCATE (yyss_alloc, yyss);
         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
+#  undef YYSTACK_RELOCATE
         if (yyss1 != yyssa)
           YYSTACK_FREE (yyss1);
       }
@@ -2075,6 +1785,7 @@
     }
 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
 
+
   if (yystate == YYFINAL)
     YYACCEPT;
 
@@ -2095,18 +1806,29 @@
 
   /* Not known => get a lookahead token if don't already have one.  */
 
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
+  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
   if (yychar == YYEMPTY)
     {
-      YYDPRINTF ((stderr, "Reading a token: "));
+      YYDPRINTF ((stderr, "Reading a token\n"));
       yychar = yylex (&yylval, yyscanner);
     }
 
   if (yychar <= YYEOF)
     {
-      yychar = yytoken = YYEOF;
+      yychar = YYEOF;
+      yytoken = YYSYMBOL_YYEOF;
       YYDPRINTF ((stderr, "Now at end of input.\n"));
     }
+  else if (yychar == YYerror)
+    {
+      /* The scanner already issued an error message, process directly
+         to error recovery.  But do not keep the error token as
+         lookahead, it is too special and may lead us to an endless
+         loop in error recovery. */
+      yychar = YYUNDEF;
+      yytoken = YYSYMBOL_YYerror;
+      goto yyerrlab1;
+    }
   else
     {
       yytoken = YYTRANSLATE (yychar);
@@ -2175,119 +1897,119 @@
   YY_REDUCE_PRINT (yyn);
   switch (yyn)
     {
-  case 2:
-#line 363 "grammar.y"
+  case 2: /* prog: null expr  */
+#line 424 "grammar.y"
 {
 	CHECK_INT_VAL(finish_parse(cstate, (yyvsp[0].blk).b));
 }
-#line 2184 "grammar.c"
+#line 1906 "grammar.c"
     break;
 
-  case 4:
-#line 368 "grammar.y"
+  case 4: /* null: %empty  */
+#line 429 "grammar.y"
                                 { (yyval.blk).q = qerr; }
-#line 2190 "grammar.c"
+#line 1912 "grammar.c"
     break;
 
-  case 6:
-#line 371 "grammar.y"
+  case 6: /* expr: expr and term  */
+#line 432 "grammar.y"
                                 { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
-#line 2196 "grammar.c"
+#line 1918 "grammar.c"
     break;
 
-  case 7:
-#line 372 "grammar.y"
+  case 7: /* expr: expr and id  */
+#line 433 "grammar.y"
                                 { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
-#line 2202 "grammar.c"
+#line 1924 "grammar.c"
     break;
 
-  case 8:
-#line 373 "grammar.y"
+  case 8: /* expr: expr or term  */
+#line 434 "grammar.y"
                                 { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
-#line 2208 "grammar.c"
+#line 1930 "grammar.c"
     break;
 
-  case 9:
-#line 374 "grammar.y"
+  case 9: /* expr: expr or id  */
+#line 435 "grammar.y"
                                 { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
-#line 2214 "grammar.c"
+#line 1936 "grammar.c"
     break;
 
-  case 10:
-#line 376 "grammar.y"
+  case 10: /* and: AND  */
+#line 437 "grammar.y"
                                 { (yyval.blk) = (yyvsp[-1].blk); }
-#line 2220 "grammar.c"
+#line 1942 "grammar.c"
     break;
 
-  case 11:
-#line 378 "grammar.y"
+  case 11: /* or: OR  */
+#line 439 "grammar.y"
                                 { (yyval.blk) = (yyvsp[-1].blk); }
-#line 2226 "grammar.c"
+#line 1948 "grammar.c"
     break;
 
-  case 13:
-#line 381 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_ncode(cstate, NULL, (bpf_u_int32)(yyvsp[0].i),
+  case 13: /* id: pnum  */
+#line 442 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_ncode(cstate, NULL, (yyvsp[0].h),
 						   (yyval.blk).q = (yyvsp[-1].blk).q))); }
-#line 2233 "grammar.c"
+#line 1955 "grammar.c"
     break;
 
-  case 14:
-#line 383 "grammar.y"
+  case 14: /* id: paren pid ')'  */
+#line 444 "grammar.y"
                                 { (yyval.blk) = (yyvsp[-1].blk); }
-#line 2239 "grammar.c"
+#line 1961 "grammar.c"
     break;
 
-  case 15:
-#line 385 "grammar.y"
+  case 15: /* nid: ID  */
+#line 446 "grammar.y"
                                 { CHECK_PTR_VAL((yyvsp[0].s)); CHECK_PTR_VAL(((yyval.blk).b = gen_scode(cstate, (yyvsp[0].s), (yyval.blk).q = (yyvsp[-1].blk).q))); }
-#line 2245 "grammar.c"
+#line 1967 "grammar.c"
     break;
 
-  case 16:
-#line 386 "grammar.y"
-                                { CHECK_PTR_VAL((yyvsp[-2].s)); CHECK_PTR_VAL(((yyval.blk).b = gen_mcode(cstate, (yyvsp[-2].s), NULL, (yyvsp[0].i),
+  case 16: /* nid: HID '/' NUM  */
+#line 447 "grammar.y"
+                                { CHECK_PTR_VAL((yyvsp[-2].s)); CHECK_PTR_VAL(((yyval.blk).b = gen_mcode(cstate, (yyvsp[-2].s), NULL, (yyvsp[0].h),
 				    (yyval.blk).q = (yyvsp[-3].blk).q))); }
-#line 2252 "grammar.c"
+#line 1974 "grammar.c"
     break;
 
-  case 17:
-#line 388 "grammar.y"
+  case 17: /* nid: HID NETMASK HID  */
+#line 449 "grammar.y"
                                 { CHECK_PTR_VAL((yyvsp[-2].s)); CHECK_PTR_VAL(((yyval.blk).b = gen_mcode(cstate, (yyvsp[-2].s), (yyvsp[0].s), 0,
 				    (yyval.blk).q = (yyvsp[-3].blk).q))); }
-#line 2259 "grammar.c"
+#line 1981 "grammar.c"
     break;
 
-  case 18:
-#line 390 "grammar.y"
+  case 18: /* nid: HID  */
+#line 451 "grammar.y"
                                 {
 				  CHECK_PTR_VAL((yyvsp[0].s));
 				  /* Decide how to parse HID based on proto */
 				  (yyval.blk).q = (yyvsp[-1].blk).q;
 				  if ((yyval.blk).q.addr == Q_PORT) {
-				  	bpf_set_error(cstate, "'port' modifier applied to ip host");
-				  	YYABORT;
+					bpf_set_error(cstate, "'port' modifier applied to ip host");
+					YYABORT;
 				  } else if ((yyval.blk).q.addr == Q_PORTRANGE) {
-				  	bpf_set_error(cstate, "'portrange' modifier applied to ip host");
-				  	YYABORT;
+					bpf_set_error(cstate, "'portrange' modifier applied to ip host");
+					YYABORT;
 				  } else if ((yyval.blk).q.addr == Q_PROTO) {
-				  	bpf_set_error(cstate, "'proto' modifier applied to ip host");
-				  	YYABORT;
+					bpf_set_error(cstate, "'proto' modifier applied to ip host");
+					YYABORT;
 				  } else if ((yyval.blk).q.addr == Q_PROTOCHAIN) {
-				  	bpf_set_error(cstate, "'protochain' modifier applied to ip host");
-				  	YYABORT;
+					bpf_set_error(cstate, "'protochain' modifier applied to ip host");
+					YYABORT;
 				  }
 				  CHECK_PTR_VAL(((yyval.blk).b = gen_ncode(cstate, (yyvsp[0].s), 0, (yyval.blk).q)));
 				}
-#line 2283 "grammar.c"
+#line 2005 "grammar.c"
     break;
 
-  case 19:
-#line 409 "grammar.y"
+  case 19: /* nid: HID6 '/' NUM  */
+#line 470 "grammar.y"
                                 {
 				  CHECK_PTR_VAL((yyvsp[-2].s));
 #ifdef INET6
-				  CHECK_PTR_VAL(((yyval.blk).b = gen_mcode6(cstate, (yyvsp[-2].s), NULL, (yyvsp[0].i),
+				  CHECK_PTR_VAL(((yyval.blk).b = gen_mcode6(cstate, (yyvsp[-2].s), NULL, (yyvsp[0].h),
 				    (yyval.blk).q = (yyvsp[-3].blk).q)));
 #else
 				  bpf_set_error(cstate, "'ip6addr/prefixlen' not supported "
@@ -2295,11 +2017,11 @@
 				  YYABORT;
 #endif /*INET6*/
 				}
-#line 2299 "grammar.c"
+#line 2021 "grammar.c"
     break;
 
-  case 20:
-#line 420 "grammar.y"
+  case 20: /* nid: HID6  */
+#line 481 "grammar.y"
                                 {
 				  CHECK_PTR_VAL((yyvsp[0].s));
 #ifdef INET6
@@ -2311,90 +2033,90 @@
 				  YYABORT;
 #endif /*INET6*/
 				}
-#line 2315 "grammar.c"
+#line 2037 "grammar.c"
     break;
 
-  case 21:
-#line 431 "grammar.y"
+  case 21: /* nid: EID  */
+#line 492 "grammar.y"
                                 { CHECK_PTR_VAL((yyvsp[0].s)); CHECK_PTR_VAL(((yyval.blk).b = gen_ecode(cstate, (yyvsp[0].s), (yyval.blk).q = (yyvsp[-1].blk).q))); }
-#line 2321 "grammar.c"
+#line 2043 "grammar.c"
     break;
 
-  case 22:
-#line 432 "grammar.y"
+  case 22: /* nid: AID  */
+#line 493 "grammar.y"
                                 { CHECK_PTR_VAL((yyvsp[0].s)); CHECK_PTR_VAL(((yyval.blk).b = gen_acode(cstate, (yyvsp[0].s), (yyval.blk).q = (yyvsp[-1].blk).q))); }
-#line 2327 "grammar.c"
+#line 2049 "grammar.c"
     break;
 
-  case 23:
-#line 433 "grammar.y"
+  case 23: /* nid: not id  */
+#line 494 "grammar.y"
                                 { gen_not((yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
-#line 2333 "grammar.c"
+#line 2055 "grammar.c"
     break;
 
-  case 24:
-#line 435 "grammar.y"
+  case 24: /* not: '!'  */
+#line 496 "grammar.y"
                                 { (yyval.blk) = (yyvsp[-1].blk); }
-#line 2339 "grammar.c"
+#line 2061 "grammar.c"
     break;
 
-  case 25:
-#line 437 "grammar.y"
+  case 25: /* paren: '('  */
+#line 498 "grammar.y"
                                 { (yyval.blk) = (yyvsp[-1].blk); }
-#line 2345 "grammar.c"
+#line 2067 "grammar.c"
     break;
 
-  case 27:
-#line 440 "grammar.y"
+  case 27: /* pid: qid and id  */
+#line 501 "grammar.y"
                                 { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
-#line 2351 "grammar.c"
+#line 2073 "grammar.c"
     break;
 
-  case 28:
-#line 441 "grammar.y"
+  case 28: /* pid: qid or id  */
+#line 502 "grammar.y"
                                 { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
-#line 2357 "grammar.c"
+#line 2079 "grammar.c"
     break;
 
-  case 29:
-#line 443 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_ncode(cstate, NULL, (bpf_u_int32)(yyvsp[0].i),
+  case 29: /* qid: pnum  */
+#line 504 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_ncode(cstate, NULL, (yyvsp[0].h),
 						   (yyval.blk).q = (yyvsp[-1].blk).q))); }
-#line 2364 "grammar.c"
+#line 2086 "grammar.c"
     break;
 
-  case 32:
-#line 448 "grammar.y"
+  case 32: /* term: not term  */
+#line 509 "grammar.y"
                                 { gen_not((yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
-#line 2370 "grammar.c"
+#line 2092 "grammar.c"
     break;
 
-  case 33:
-#line 450 "grammar.y"
+  case 33: /* head: pqual dqual aqual  */
+#line 511 "grammar.y"
                                 { QSET((yyval.blk).q, (yyvsp[-2].i), (yyvsp[-1].i), (yyvsp[0].i)); }
-#line 2376 "grammar.c"
+#line 2098 "grammar.c"
     break;
 
-  case 34:
-#line 451 "grammar.y"
+  case 34: /* head: pqual dqual  */
+#line 512 "grammar.y"
                                 { QSET((yyval.blk).q, (yyvsp[-1].i), (yyvsp[0].i), Q_DEFAULT); }
-#line 2382 "grammar.c"
+#line 2104 "grammar.c"
     break;
 
-  case 35:
-#line 452 "grammar.y"
+  case 35: /* head: pqual aqual  */
+#line 513 "grammar.y"
                                 { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, (yyvsp[0].i)); }
-#line 2388 "grammar.c"
+#line 2110 "grammar.c"
     break;
 
-  case 36:
-#line 453 "grammar.y"
+  case 36: /* head: pqual PROTO  */
+#line 514 "grammar.y"
                                 { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, Q_PROTO); }
-#line 2394 "grammar.c"
+#line 2116 "grammar.c"
     break;
 
-  case 37:
-#line 454 "grammar.y"
+  case 37: /* head: pqual PROTOCHAIN  */
+#line 515 "grammar.y"
                                 {
 #ifdef NO_PROTOCHAIN
 				  bpf_set_error(cstate, "protochain not supported");
@@ -2403,627 +2125,655 @@
 				  QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, Q_PROTOCHAIN);
 #endif
 				}
+#line 2129 "grammar.c"
+    break;
+
+  case 38: /* head: pqual ndaqual  */
+#line 523 "grammar.y"
+                                { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, (yyvsp[0].i)); }
+#line 2135 "grammar.c"
+    break;
+
+  case 39: /* rterm: head id  */
+#line 525 "grammar.y"
+                                { (yyval.blk) = (yyvsp[0].blk); }
+#line 2141 "grammar.c"
+    break;
+
+  case 40: /* rterm: paren expr ')'  */
+#line 526 "grammar.y"
+                                { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = (yyvsp[-2].blk).q; }
+#line 2147 "grammar.c"
+    break;
+
+  case 41: /* rterm: pname  */
+#line 527 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_proto_abbrev(cstate, (yyvsp[0].i)))); (yyval.blk).q = qerr; }
+#line 2153 "grammar.c"
+    break;
+
+  case 42: /* rterm: arth relop arth  */
+#line 528 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_relation(cstate, (yyvsp[-1].i), (yyvsp[-2].a), (yyvsp[0].a), 0)));
+				  (yyval.blk).q = qerr; }
+#line 2160 "grammar.c"
+    break;
+
+  case 43: /* rterm: arth irelop arth  */
+#line 530 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_relation(cstate, (yyvsp[-1].i), (yyvsp[-2].a), (yyvsp[0].a), 1)));
+				  (yyval.blk).q = qerr; }
+#line 2167 "grammar.c"
+    break;
+
+  case 44: /* rterm: other  */
+#line 532 "grammar.y"
+                                { (yyval.blk).b = (yyvsp[0].rblk); (yyval.blk).q = qerr; }
+#line 2173 "grammar.c"
+    break;
+
+  case 45: /* rterm: atmtype  */
+#line 533 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_atmtype_abbrev(cstate, (yyvsp[0].i)))); (yyval.blk).q = qerr; }
+#line 2179 "grammar.c"
+    break;
+
+  case 46: /* rterm: atmmultitype  */
+#line 534 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_atmmulti_abbrev(cstate, (yyvsp[0].i)))); (yyval.blk).q = qerr; }
+#line 2185 "grammar.c"
+    break;
+
+  case 47: /* rterm: atmfield atmvalue  */
+#line 535 "grammar.y"
+                                { (yyval.blk).b = (yyvsp[0].blk).b; (yyval.blk).q = qerr; }
+#line 2191 "grammar.c"
+    break;
+
+  case 48: /* rterm: mtp2type  */
+#line 536 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_mtp2type_abbrev(cstate, (yyvsp[0].i)))); (yyval.blk).q = qerr; }
+#line 2197 "grammar.c"
+    break;
+
+  case 49: /* rterm: mtp3field mtp3value  */
+#line 537 "grammar.y"
+                                { (yyval.blk).b = (yyvsp[0].blk).b; (yyval.blk).q = qerr; }
+#line 2203 "grammar.c"
+    break;
+
+  case 51: /* pqual: %empty  */
+#line 541 "grammar.y"
+                                { (yyval.i) = Q_DEFAULT; }
+#line 2209 "grammar.c"
+    break;
+
+  case 52: /* dqual: SRC  */
+#line 544 "grammar.y"
+                                { (yyval.i) = Q_SRC; }
+#line 2215 "grammar.c"
+    break;
+
+  case 53: /* dqual: DST  */
+#line 545 "grammar.y"
+                                { (yyval.i) = Q_DST; }
+#line 2221 "grammar.c"
+    break;
+
+  case 54: /* dqual: SRC OR DST  */
+#line 546 "grammar.y"
+                                { (yyval.i) = Q_OR; }
+#line 2227 "grammar.c"
+    break;
+
+  case 55: /* dqual: DST OR SRC  */
+#line 547 "grammar.y"
+                                { (yyval.i) = Q_OR; }
+#line 2233 "grammar.c"
+    break;
+
+  case 56: /* dqual: SRC AND DST  */
+#line 548 "grammar.y"
+                                { (yyval.i) = Q_AND; }
+#line 2239 "grammar.c"
+    break;
+
+  case 57: /* dqual: DST AND SRC  */
+#line 549 "grammar.y"
+                                { (yyval.i) = Q_AND; }
+#line 2245 "grammar.c"
+    break;
+
+  case 58: /* dqual: ADDR1  */
+#line 550 "grammar.y"
+                                { (yyval.i) = Q_ADDR1; }
+#line 2251 "grammar.c"
+    break;
+
+  case 59: /* dqual: ADDR2  */
+#line 551 "grammar.y"
+                                { (yyval.i) = Q_ADDR2; }
+#line 2257 "grammar.c"
+    break;
+
+  case 60: /* dqual: ADDR3  */
+#line 552 "grammar.y"
+                                { (yyval.i) = Q_ADDR3; }
+#line 2263 "grammar.c"
+    break;
+
+  case 61: /* dqual: ADDR4  */
+#line 553 "grammar.y"
+                                { (yyval.i) = Q_ADDR4; }
+#line 2269 "grammar.c"
+    break;
+
+  case 62: /* dqual: RA  */
+#line 554 "grammar.y"
+                                { (yyval.i) = Q_RA; }
+#line 2275 "grammar.c"
+    break;
+
+  case 63: /* dqual: TA  */
+#line 555 "grammar.y"
+                                { (yyval.i) = Q_TA; }
+#line 2281 "grammar.c"
+    break;
+
+  case 64: /* aqual: HOST  */
+#line 558 "grammar.y"
+                                { (yyval.i) = Q_HOST; }
+#line 2287 "grammar.c"
+    break;
+
+  case 65: /* aqual: NET  */
+#line 559 "grammar.y"
+                                { (yyval.i) = Q_NET; }
+#line 2293 "grammar.c"
+    break;
+
+  case 66: /* aqual: PORT  */
+#line 560 "grammar.y"
+                                { (yyval.i) = Q_PORT; }
+#line 2299 "grammar.c"
+    break;
+
+  case 67: /* aqual: PORTRANGE  */
+#line 561 "grammar.y"
+                                { (yyval.i) = Q_PORTRANGE; }
+#line 2305 "grammar.c"
+    break;
+
+  case 68: /* ndaqual: GATEWAY  */
+#line 564 "grammar.y"
+                                { (yyval.i) = Q_GATEWAY; }
+#line 2311 "grammar.c"
+    break;
+
+  case 69: /* pname: LINK  */
+#line 566 "grammar.y"
+                                { (yyval.i) = Q_LINK; }
+#line 2317 "grammar.c"
+    break;
+
+  case 70: /* pname: IP  */
+#line 567 "grammar.y"
+                                { (yyval.i) = Q_IP; }
+#line 2323 "grammar.c"
+    break;
+
+  case 71: /* pname: ARP  */
+#line 568 "grammar.y"
+                                { (yyval.i) = Q_ARP; }
+#line 2329 "grammar.c"
+    break;
+
+  case 72: /* pname: RARP  */
+#line 569 "grammar.y"
+                                { (yyval.i) = Q_RARP; }
+#line 2335 "grammar.c"
+    break;
+
+  case 73: /* pname: SCTP  */
+#line 570 "grammar.y"
+                                { (yyval.i) = Q_SCTP; }
+#line 2341 "grammar.c"
+    break;
+
+  case 74: /* pname: TCP  */
+#line 571 "grammar.y"
+                                { (yyval.i) = Q_TCP; }
+#line 2347 "grammar.c"
+    break;
+
+  case 75: /* pname: UDP  */
+#line 572 "grammar.y"
+                                { (yyval.i) = Q_UDP; }
+#line 2353 "grammar.c"
+    break;
+
+  case 76: /* pname: ICMP  */
+#line 573 "grammar.y"
+                                { (yyval.i) = Q_ICMP; }
+#line 2359 "grammar.c"
+    break;
+
+  case 77: /* pname: IGMP  */
+#line 574 "grammar.y"
+                                { (yyval.i) = Q_IGMP; }
+#line 2365 "grammar.c"
+    break;
+
+  case 78: /* pname: IGRP  */
+#line 575 "grammar.y"
+                                { (yyval.i) = Q_IGRP; }
+#line 2371 "grammar.c"
+    break;
+
+  case 79: /* pname: PIM  */
+#line 576 "grammar.y"
+                                { (yyval.i) = Q_PIM; }
+#line 2377 "grammar.c"
+    break;
+
+  case 80: /* pname: VRRP  */
+#line 577 "grammar.y"
+                                { (yyval.i) = Q_VRRP; }
+#line 2383 "grammar.c"
+    break;
+
+  case 81: /* pname: CARP  */
+#line 578 "grammar.y"
+                                { (yyval.i) = Q_CARP; }
+#line 2389 "grammar.c"
+    break;
+
+  case 82: /* pname: ATALK  */
+#line 579 "grammar.y"
+                                { (yyval.i) = Q_ATALK; }
+#line 2395 "grammar.c"
+    break;
+
+  case 83: /* pname: AARP  */
+#line 580 "grammar.y"
+                                { (yyval.i) = Q_AARP; }
+#line 2401 "grammar.c"
+    break;
+
+  case 84: /* pname: DECNET  */
+#line 581 "grammar.y"
+                                { (yyval.i) = Q_DECNET; }
 #line 2407 "grammar.c"
     break;
 
-  case 38:
-#line 462 "grammar.y"
-                                { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, (yyvsp[0].i)); }
+  case 85: /* pname: LAT  */
+#line 582 "grammar.y"
+                                { (yyval.i) = Q_LAT; }
 #line 2413 "grammar.c"
     break;
 
-  case 39:
-#line 464 "grammar.y"
-                                { (yyval.blk) = (yyvsp[0].blk); }
+  case 86: /* pname: SCA  */
+#line 583 "grammar.y"
+                                { (yyval.i) = Q_SCA; }
 #line 2419 "grammar.c"
     break;
 
-  case 40:
-#line 465 "grammar.y"
-                                { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = (yyvsp[-2].blk).q; }
+  case 87: /* pname: MOPDL  */
+#line 584 "grammar.y"
+                                { (yyval.i) = Q_MOPDL; }
 #line 2425 "grammar.c"
     break;
 
-  case 41:
-#line 466 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_proto_abbrev(cstate, (yyvsp[0].i)))); (yyval.blk).q = qerr; }
+  case 88: /* pname: MOPRC  */
+#line 585 "grammar.y"
+                                { (yyval.i) = Q_MOPRC; }
 #line 2431 "grammar.c"
     break;
 
-  case 42:
-#line 467 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_relation(cstate, (yyvsp[-1].i), (yyvsp[-2].a), (yyvsp[0].a), 0)));
-				  (yyval.blk).q = qerr; }
-#line 2438 "grammar.c"
-    break;
-
-  case 43:
-#line 469 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_relation(cstate, (yyvsp[-1].i), (yyvsp[-2].a), (yyvsp[0].a), 1)));
-				  (yyval.blk).q = qerr; }
-#line 2445 "grammar.c"
-    break;
-
-  case 44:
-#line 471 "grammar.y"
-                                { (yyval.blk).b = (yyvsp[0].rblk); (yyval.blk).q = qerr; }
-#line 2451 "grammar.c"
-    break;
-
-  case 45:
-#line 472 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_atmtype_abbrev(cstate, (yyvsp[0].i)))); (yyval.blk).q = qerr; }
-#line 2457 "grammar.c"
-    break;
-
-  case 46:
-#line 473 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_atmmulti_abbrev(cstate, (yyvsp[0].i)))); (yyval.blk).q = qerr; }
-#line 2463 "grammar.c"
-    break;
-
-  case 47:
-#line 474 "grammar.y"
-                                { (yyval.blk).b = (yyvsp[0].blk).b; (yyval.blk).q = qerr; }
-#line 2469 "grammar.c"
-    break;
-
-  case 48:
-#line 475 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_mtp2type_abbrev(cstate, (yyvsp[0].i)))); (yyval.blk).q = qerr; }
-#line 2475 "grammar.c"
-    break;
-
-  case 49:
-#line 476 "grammar.y"
-                                { (yyval.blk).b = (yyvsp[0].blk).b; (yyval.blk).q = qerr; }
-#line 2481 "grammar.c"
-    break;
-
-  case 51:
-#line 480 "grammar.y"
-                                { (yyval.i) = Q_DEFAULT; }
-#line 2487 "grammar.c"
-    break;
-
-  case 52:
-#line 483 "grammar.y"
-                                { (yyval.i) = Q_SRC; }
-#line 2493 "grammar.c"
-    break;
-
-  case 53:
-#line 484 "grammar.y"
-                                { (yyval.i) = Q_DST; }
-#line 2499 "grammar.c"
-    break;
-
-  case 54:
-#line 485 "grammar.y"
-                                { (yyval.i) = Q_OR; }
-#line 2505 "grammar.c"
-    break;
-
-  case 55:
-#line 486 "grammar.y"
-                                { (yyval.i) = Q_OR; }
-#line 2511 "grammar.c"
-    break;
-
-  case 56:
-#line 487 "grammar.y"
-                                { (yyval.i) = Q_AND; }
-#line 2517 "grammar.c"
-    break;
-
-  case 57:
-#line 488 "grammar.y"
-                                { (yyval.i) = Q_AND; }
-#line 2523 "grammar.c"
-    break;
-
-  case 58:
-#line 489 "grammar.y"
-                                { (yyval.i) = Q_ADDR1; }
-#line 2529 "grammar.c"
-    break;
-
-  case 59:
-#line 490 "grammar.y"
-                                { (yyval.i) = Q_ADDR2; }
-#line 2535 "grammar.c"
-    break;
-
-  case 60:
-#line 491 "grammar.y"
-                                { (yyval.i) = Q_ADDR3; }
-#line 2541 "grammar.c"
-    break;
-
-  case 61:
-#line 492 "grammar.y"
-                                { (yyval.i) = Q_ADDR4; }
-#line 2547 "grammar.c"
-    break;
-
-  case 62:
-#line 493 "grammar.y"
-                                { (yyval.i) = Q_RA; }
-#line 2553 "grammar.c"
-    break;
-
-  case 63:
-#line 494 "grammar.y"
-                                { (yyval.i) = Q_TA; }
-#line 2559 "grammar.c"
-    break;
-
-  case 64:
-#line 497 "grammar.y"
-                                { (yyval.i) = Q_HOST; }
-#line 2565 "grammar.c"
-    break;
-
-  case 65:
-#line 498 "grammar.y"
-                                { (yyval.i) = Q_NET; }
-#line 2571 "grammar.c"
-    break;
-
-  case 66:
-#line 499 "grammar.y"
-                                { (yyval.i) = Q_PORT; }
-#line 2577 "grammar.c"
-    break;
-
-  case 67:
-#line 500 "grammar.y"
-                                { (yyval.i) = Q_PORTRANGE; }
-#line 2583 "grammar.c"
-    break;
-
-  case 68:
-#line 503 "grammar.y"
-                                { (yyval.i) = Q_GATEWAY; }
-#line 2589 "grammar.c"
-    break;
-
-  case 69:
-#line 505 "grammar.y"
-                                { (yyval.i) = Q_LINK; }
-#line 2595 "grammar.c"
-    break;
-
-  case 70:
-#line 506 "grammar.y"
-                                { (yyval.i) = Q_IP; }
-#line 2601 "grammar.c"
-    break;
-
-  case 71:
-#line 507 "grammar.y"
-                                { (yyval.i) = Q_ARP; }
-#line 2607 "grammar.c"
-    break;
-
-  case 72:
-#line 508 "grammar.y"
-                                { (yyval.i) = Q_RARP; }
-#line 2613 "grammar.c"
-    break;
-
-  case 73:
-#line 509 "grammar.y"
-                                { (yyval.i) = Q_SCTP; }
-#line 2619 "grammar.c"
-    break;
-
-  case 74:
-#line 510 "grammar.y"
-                                { (yyval.i) = Q_TCP; }
-#line 2625 "grammar.c"
-    break;
-
-  case 75:
-#line 511 "grammar.y"
-                                { (yyval.i) = Q_UDP; }
-#line 2631 "grammar.c"
-    break;
-
-  case 76:
-#line 512 "grammar.y"
-                                { (yyval.i) = Q_ICMP; }
-#line 2637 "grammar.c"
-    break;
-
-  case 77:
-#line 513 "grammar.y"
-                                { (yyval.i) = Q_IGMP; }
-#line 2643 "grammar.c"
-    break;
-
-  case 78:
-#line 514 "grammar.y"
-                                { (yyval.i) = Q_IGRP; }
-#line 2649 "grammar.c"
-    break;
-
-  case 79:
-#line 515 "grammar.y"
-                                { (yyval.i) = Q_PIM; }
-#line 2655 "grammar.c"
-    break;
-
-  case 80:
-#line 516 "grammar.y"
-                                { (yyval.i) = Q_VRRP; }
-#line 2661 "grammar.c"
-    break;
-
-  case 81:
-#line 517 "grammar.y"
-                                { (yyval.i) = Q_CARP; }
-#line 2667 "grammar.c"
-    break;
-
-  case 82:
-#line 518 "grammar.y"
-                                { (yyval.i) = Q_ATALK; }
-#line 2673 "grammar.c"
-    break;
-
-  case 83:
-#line 519 "grammar.y"
-                                { (yyval.i) = Q_AARP; }
-#line 2679 "grammar.c"
-    break;
-
-  case 84:
-#line 520 "grammar.y"
-                                { (yyval.i) = Q_DECNET; }
-#line 2685 "grammar.c"
-    break;
-
-  case 85:
-#line 521 "grammar.y"
-                                { (yyval.i) = Q_LAT; }
-#line 2691 "grammar.c"
-    break;
-
-  case 86:
-#line 522 "grammar.y"
-                                { (yyval.i) = Q_SCA; }
-#line 2697 "grammar.c"
-    break;
-
-  case 87:
-#line 523 "grammar.y"
-                                { (yyval.i) = Q_MOPDL; }
-#line 2703 "grammar.c"
-    break;
-
-  case 88:
-#line 524 "grammar.y"
-                                { (yyval.i) = Q_MOPRC; }
-#line 2709 "grammar.c"
-    break;
-
-  case 89:
-#line 525 "grammar.y"
+  case 89: /* pname: IPV6  */
+#line 586 "grammar.y"
                                 { (yyval.i) = Q_IPV6; }
-#line 2715 "grammar.c"
+#line 2437 "grammar.c"
     break;
 
-  case 90:
-#line 526 "grammar.y"
+  case 90: /* pname: ICMPV6  */
+#line 587 "grammar.y"
                                 { (yyval.i) = Q_ICMPV6; }
-#line 2721 "grammar.c"
+#line 2443 "grammar.c"
     break;
 
-  case 91:
-#line 527 "grammar.y"
+  case 91: /* pname: AH  */
+#line 588 "grammar.y"
                                 { (yyval.i) = Q_AH; }
-#line 2727 "grammar.c"
+#line 2449 "grammar.c"
     break;
 
-  case 92:
-#line 528 "grammar.y"
+  case 92: /* pname: ESP  */
+#line 589 "grammar.y"
                                 { (yyval.i) = Q_ESP; }
-#line 2733 "grammar.c"
+#line 2455 "grammar.c"
     break;
 
-  case 93:
-#line 529 "grammar.y"
+  case 93: /* pname: ISO  */
+#line 590 "grammar.y"
                                 { (yyval.i) = Q_ISO; }
-#line 2739 "grammar.c"
+#line 2461 "grammar.c"
     break;
 
-  case 94:
-#line 530 "grammar.y"
+  case 94: /* pname: ESIS  */
+#line 591 "grammar.y"
                                 { (yyval.i) = Q_ESIS; }
-#line 2745 "grammar.c"
+#line 2467 "grammar.c"
     break;
 
-  case 95:
-#line 531 "grammar.y"
+  case 95: /* pname: ISIS  */
+#line 592 "grammar.y"
                                 { (yyval.i) = Q_ISIS; }
-#line 2751 "grammar.c"
+#line 2473 "grammar.c"
     break;
 
-  case 96:
-#line 532 "grammar.y"
+  case 96: /* pname: L1  */
+#line 593 "grammar.y"
                                 { (yyval.i) = Q_ISIS_L1; }
-#line 2757 "grammar.c"
+#line 2479 "grammar.c"
     break;
 
-  case 97:
-#line 533 "grammar.y"
+  case 97: /* pname: L2  */
+#line 594 "grammar.y"
                                 { (yyval.i) = Q_ISIS_L2; }
-#line 2763 "grammar.c"
+#line 2485 "grammar.c"
     break;
 
-  case 98:
-#line 534 "grammar.y"
+  case 98: /* pname: IIH  */
+#line 595 "grammar.y"
                                 { (yyval.i) = Q_ISIS_IIH; }
-#line 2769 "grammar.c"
+#line 2491 "grammar.c"
     break;
 
-  case 99:
-#line 535 "grammar.y"
+  case 99: /* pname: LSP  */
+#line 596 "grammar.y"
                                 { (yyval.i) = Q_ISIS_LSP; }
-#line 2775 "grammar.c"
+#line 2497 "grammar.c"
     break;
 
-  case 100:
-#line 536 "grammar.y"
+  case 100: /* pname: SNP  */
+#line 597 "grammar.y"
                                 { (yyval.i) = Q_ISIS_SNP; }
-#line 2781 "grammar.c"
+#line 2503 "grammar.c"
     break;
 
-  case 101:
-#line 537 "grammar.y"
+  case 101: /* pname: PSNP  */
+#line 598 "grammar.y"
                                 { (yyval.i) = Q_ISIS_PSNP; }
-#line 2787 "grammar.c"
+#line 2509 "grammar.c"
     break;
 
-  case 102:
-#line 538 "grammar.y"
+  case 102: /* pname: CSNP  */
+#line 599 "grammar.y"
                                 { (yyval.i) = Q_ISIS_CSNP; }
-#line 2793 "grammar.c"
+#line 2515 "grammar.c"
     break;
 
-  case 103:
-#line 539 "grammar.y"
+  case 103: /* pname: CLNP  */
+#line 600 "grammar.y"
                                 { (yyval.i) = Q_CLNP; }
-#line 2799 "grammar.c"
+#line 2521 "grammar.c"
     break;
 
-  case 104:
-#line 540 "grammar.y"
+  case 104: /* pname: STP  */
+#line 601 "grammar.y"
                                 { (yyval.i) = Q_STP; }
-#line 2805 "grammar.c"
+#line 2527 "grammar.c"
     break;
 
-  case 105:
-#line 541 "grammar.y"
+  case 105: /* pname: IPX  */
+#line 602 "grammar.y"
                                 { (yyval.i) = Q_IPX; }
-#line 2811 "grammar.c"
+#line 2533 "grammar.c"
     break;
 
-  case 106:
-#line 542 "grammar.y"
+  case 106: /* pname: NETBEUI  */
+#line 603 "grammar.y"
                                 { (yyval.i) = Q_NETBEUI; }
-#line 2817 "grammar.c"
+#line 2539 "grammar.c"
     break;
 
-  case 107:
-#line 543 "grammar.y"
+  case 107: /* pname: RADIO  */
+#line 604 "grammar.y"
                                 { (yyval.i) = Q_RADIO; }
-#line 2823 "grammar.c"
+#line 2545 "grammar.c"
     break;
 
-  case 108:
-#line 545 "grammar.y"
+  case 108: /* other: pqual TK_BROADCAST  */
+#line 606 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_broadcast(cstate, (yyvsp[-1].i)))); }
-#line 2829 "grammar.c"
+#line 2551 "grammar.c"
     break;
 
-  case 109:
-#line 546 "grammar.y"
+  case 109: /* other: pqual TK_MULTICAST  */
+#line 607 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_multicast(cstate, (yyvsp[-1].i)))); }
-#line 2835 "grammar.c"
+#line 2557 "grammar.c"
     break;
 
-  case 110:
-#line 547 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.rblk) = gen_less(cstate, (yyvsp[0].i)))); }
-#line 2841 "grammar.c"
+  case 110: /* other: LESS NUM  */
+#line 608 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.rblk) = gen_less(cstate, (yyvsp[0].h)))); }
+#line 2563 "grammar.c"
     break;
 
-  case 111:
-#line 548 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.rblk) = gen_greater(cstate, (yyvsp[0].i)))); }
-#line 2847 "grammar.c"
+  case 111: /* other: GREATER NUM  */
+#line 609 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.rblk) = gen_greater(cstate, (yyvsp[0].h)))); }
+#line 2569 "grammar.c"
     break;
 
-  case 112:
-#line 549 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.rblk) = gen_byteop(cstate, (yyvsp[-1].i), (yyvsp[-2].i), (yyvsp[0].i)))); }
-#line 2853 "grammar.c"
+  case 112: /* other: CBYTE NUM byteop NUM  */
+#line 610 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.rblk) = gen_byteop(cstate, (yyvsp[-1].i), (yyvsp[-2].h), (yyvsp[0].h)))); }
+#line 2575 "grammar.c"
     break;
 
-  case 113:
-#line 550 "grammar.y"
+  case 113: /* other: INBOUND  */
+#line 611 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_inbound(cstate, 0))); }
-#line 2859 "grammar.c"
+#line 2581 "grammar.c"
     break;
 
-  case 114:
-#line 551 "grammar.y"
+  case 114: /* other: OUTBOUND  */
+#line 612 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_inbound(cstate, 1))); }
-#line 2865 "grammar.c"
+#line 2587 "grammar.c"
     break;
 
-  case 115:
-#line 552 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.rblk) = gen_vlan(cstate, (bpf_u_int32)(yyvsp[0].i), 1))); }
-#line 2871 "grammar.c"
+  case 115: /* other: IFINDEX NUM  */
+#line 613 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.rblk) = gen_ifindex(cstate, (yyvsp[0].h)))); }
+#line 2593 "grammar.c"
     break;
 
-  case 116:
-#line 553 "grammar.y"
+  case 116: /* other: VLAN pnum  */
+#line 614 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.rblk) = gen_vlan(cstate, (yyvsp[0].h), 1))); }
+#line 2599 "grammar.c"
+    break;
+
+  case 117: /* other: VLAN  */
+#line 615 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_vlan(cstate, 0, 0))); }
-#line 2877 "grammar.c"
+#line 2605 "grammar.c"
     break;
 
-  case 117:
-#line 554 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.rblk) = gen_mpls(cstate, (bpf_u_int32)(yyvsp[0].i), 1))); }
-#line 2883 "grammar.c"
+  case 118: /* other: MPLS pnum  */
+#line 616 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.rblk) = gen_mpls(cstate, (yyvsp[0].h), 1))); }
+#line 2611 "grammar.c"
     break;
 
-  case 118:
-#line 555 "grammar.y"
+  case 119: /* other: MPLS  */
+#line 617 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_mpls(cstate, 0, 0))); }
-#line 2889 "grammar.c"
+#line 2617 "grammar.c"
     break;
 
-  case 119:
-#line 556 "grammar.y"
+  case 120: /* other: PPPOED  */
+#line 618 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_pppoed(cstate))); }
-#line 2895 "grammar.c"
+#line 2623 "grammar.c"
     break;
 
-  case 120:
-#line 557 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.rblk) = gen_pppoes(cstate, (bpf_u_int32)(yyvsp[0].i), 1))); }
-#line 2901 "grammar.c"
+  case 121: /* other: PPPOES pnum  */
+#line 619 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.rblk) = gen_pppoes(cstate, (yyvsp[0].h), 1))); }
+#line 2629 "grammar.c"
     break;
 
-  case 121:
-#line 558 "grammar.y"
+  case 122: /* other: PPPOES  */
+#line 620 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_pppoes(cstate, 0, 0))); }
-#line 2907 "grammar.c"
+#line 2635 "grammar.c"
     break;
 
-  case 122:
-#line 559 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.rblk) = gen_geneve(cstate, (bpf_u_int32)(yyvsp[0].i), 1))); }
-#line 2913 "grammar.c"
+  case 123: /* other: GENEVE pnum  */
+#line 621 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.rblk) = gen_geneve(cstate, (yyvsp[0].h), 1))); }
+#line 2641 "grammar.c"
     break;
 
-  case 123:
-#line 560 "grammar.y"
+  case 124: /* other: GENEVE  */
+#line 622 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_geneve(cstate, 0, 0))); }
-#line 2919 "grammar.c"
+#line 2647 "grammar.c"
     break;
 
-  case 124:
-#line 561 "grammar.y"
+  case 125: /* other: pfvar  */
+#line 623 "grammar.y"
                                 { (yyval.rblk) = (yyvsp[0].rblk); }
-#line 2925 "grammar.c"
+#line 2653 "grammar.c"
     break;
 
-  case 125:
-#line 562 "grammar.y"
+  case 126: /* other: pqual p80211  */
+#line 624 "grammar.y"
                                 { (yyval.rblk) = (yyvsp[0].rblk); }
-#line 2931 "grammar.c"
+#line 2659 "grammar.c"
     break;
 
-  case 126:
-#line 563 "grammar.y"
+  case 127: /* other: pllc  */
+#line 625 "grammar.y"
                                 { (yyval.rblk) = (yyvsp[0].rblk); }
-#line 2937 "grammar.c"
+#line 2665 "grammar.c"
     break;
 
-  case 127:
-#line 566 "grammar.y"
+  case 128: /* pfvar: PF_IFNAME ID  */
+#line 628 "grammar.y"
                                 { CHECK_PTR_VAL((yyvsp[0].s)); CHECK_PTR_VAL(((yyval.rblk) = gen_pf_ifname(cstate, (yyvsp[0].s)))); }
-#line 2943 "grammar.c"
+#line 2671 "grammar.c"
     break;
 
-  case 128:
-#line 567 "grammar.y"
+  case 129: /* pfvar: PF_RSET ID  */
+#line 629 "grammar.y"
                                 { CHECK_PTR_VAL((yyvsp[0].s)); CHECK_PTR_VAL(((yyval.rblk) = gen_pf_ruleset(cstate, (yyvsp[0].s)))); }
-#line 2949 "grammar.c"
+#line 2677 "grammar.c"
     break;
 
-  case 129:
-#line 568 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.rblk) = gen_pf_rnr(cstate, (yyvsp[0].i)))); }
-#line 2955 "grammar.c"
+  case 130: /* pfvar: PF_RNR NUM  */
+#line 630 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.rblk) = gen_pf_rnr(cstate, (yyvsp[0].h)))); }
+#line 2683 "grammar.c"
     break;
 
-  case 130:
-#line 569 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.rblk) = gen_pf_srnr(cstate, (yyvsp[0].i)))); }
-#line 2961 "grammar.c"
+  case 131: /* pfvar: PF_SRNR NUM  */
+#line 631 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.rblk) = gen_pf_srnr(cstate, (yyvsp[0].h)))); }
+#line 2689 "grammar.c"
     break;
 
-  case 131:
-#line 570 "grammar.y"
+  case 132: /* pfvar: PF_REASON reason  */
+#line 632 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_pf_reason(cstate, (yyvsp[0].i)))); }
-#line 2967 "grammar.c"
+#line 2695 "grammar.c"
     break;
 
-  case 132:
-#line 571 "grammar.y"
+  case 133: /* pfvar: PF_ACTION action  */
+#line 633 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_pf_action(cstate, (yyvsp[0].i)))); }
-#line 2973 "grammar.c"
+#line 2701 "grammar.c"
     break;
 
-  case 133:
-#line 575 "grammar.y"
+  case 134: /* p80211: TYPE type SUBTYPE subtype  */
+#line 637 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_p80211_type(cstate, (yyvsp[-2].i) | (yyvsp[0].i),
 					IEEE80211_FC0_TYPE_MASK |
 					IEEE80211_FC0_SUBTYPE_MASK)));
 				}
-#line 2982 "grammar.c"
+#line 2710 "grammar.c"
     break;
 
-  case 134:
-#line 579 "grammar.y"
+  case 135: /* p80211: TYPE type  */
+#line 641 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_p80211_type(cstate, (yyvsp[0].i),
 					IEEE80211_FC0_TYPE_MASK)));
 				}
-#line 2990 "grammar.c"
+#line 2718 "grammar.c"
     break;
 
-  case 135:
-#line 582 "grammar.y"
+  case 136: /* p80211: SUBTYPE type_subtype  */
+#line 644 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_p80211_type(cstate, (yyvsp[0].i),
 					IEEE80211_FC0_TYPE_MASK |
 					IEEE80211_FC0_SUBTYPE_MASK)));
 				}
-#line 2999 "grammar.c"
+#line 2727 "grammar.c"
     break;
 
-  case 136:
-#line 586 "grammar.y"
+  case 137: /* p80211: DIR dir  */
+#line 648 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_p80211_fcdir(cstate, (yyvsp[0].i)))); }
-#line 3005 "grammar.c"
+#line 2733 "grammar.c"
     break;
 
-  case 138:
-#line 590 "grammar.y"
+  case 138: /* type: NUM  */
+#line 651 "grammar.y"
+                                { if (((yyvsp[0].h) & (~IEEE80211_FC0_TYPE_MASK)) != 0) {
+					bpf_set_error(cstate, "invalid 802.11 type value 0x%02x", (yyvsp[0].h));
+					YYABORT;
+				  }
+				  (yyval.i) = (int)(yyvsp[0].h);
+				}
+#line 2744 "grammar.c"
+    break;
+
+  case 139: /* type: ID  */
+#line 657 "grammar.y"
                                 { CHECK_PTR_VAL((yyvsp[0].s));
 				  (yyval.i) = str2tok((yyvsp[0].s), ieee80211_types);
 				  if ((yyval.i) == -1) {
-				  	bpf_set_error(cstate, "unknown 802.11 type name");
-				  	YYABORT;
+					bpf_set_error(cstate, "unknown 802.11 type name \"%s\"", (yyvsp[0].s));
+					YYABORT;
 				  }
 				}
-#line 3017 "grammar.c"
+#line 2756 "grammar.c"
     break;
 
-  case 140:
-#line 600 "grammar.y"
+  case 140: /* subtype: NUM  */
+#line 666 "grammar.y"
+                                { if (((yyvsp[0].h) & (~IEEE80211_FC0_SUBTYPE_MASK)) != 0) {
+					bpf_set_error(cstate, "invalid 802.11 subtype value 0x%02x", (yyvsp[0].h));
+					YYABORT;
+				  }
+				  (yyval.i) = (int)(yyvsp[0].h);
+				}
+#line 2767 "grammar.c"
+    break;
+
+  case 141: /* subtype: ID  */
+#line 672 "grammar.y"
                                 { const struct tok *types = NULL;
 				  int i;
 				  CHECK_PTR_VAL((yyvsp[0].s));
 				  for (i = 0;; i++) {
-				  	if (ieee80211_type_subtypes[i].tok == NULL) {
-				  		/* Ran out of types */
+					if (ieee80211_type_subtypes[i].tok == NULL) {
+						/* Ran out of types */
 						bpf_set_error(cstate, "unknown 802.11 type");
 						YYABORT;
 					}
@@ -3035,20 +2785,20 @@
 
 				  (yyval.i) = str2tok((yyvsp[0].s), types);
 				  if ((yyval.i) == -1) {
-					bpf_set_error(cstate, "unknown 802.11 subtype name");
+					bpf_set_error(cstate, "unknown 802.11 subtype name \"%s\"", (yyvsp[0].s));
 					YYABORT;
 				  }
 				}
-#line 3043 "grammar.c"
+#line 2793 "grammar.c"
     break;
 
-  case 141:
-#line 623 "grammar.y"
+  case 142: /* type_subtype: ID  */
+#line 695 "grammar.y"
                                 { int i;
 				  CHECK_PTR_VAL((yyvsp[0].s));
 				  for (i = 0;; i++) {
-				  	if (ieee80211_type_subtypes[i].tok == NULL) {
-				  		/* Ran out of types */
+					if (ieee80211_type_subtypes[i].tok == NULL) {
+						/* Ran out of types */
 						bpf_set_error(cstate, "unknown 802.11 type name");
 						YYABORT;
 					}
@@ -3059,17 +2809,17 @@
 					}
 				  }
 				}
-#line 3063 "grammar.c"
+#line 2813 "grammar.c"
     break;
 
-  case 142:
-#line 640 "grammar.y"
+  case 143: /* pllc: LLC  */
+#line 712 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_llc(cstate))); }
-#line 3069 "grammar.c"
+#line 2819 "grammar.c"
     break;
 
-  case 143:
-#line 641 "grammar.y"
+  case 144: /* pllc: LLC ID  */
+#line 713 "grammar.y"
                                 { CHECK_PTR_VAL((yyvsp[0].s));
 				  if (pcap_strcasecmp((yyvsp[0].s), "i") == 0) {
 					CHECK_PTR_VAL(((yyval.rblk) = gen_llc_i(cstate)));
@@ -3086,24 +2836,30 @@
 					} else {
 						subtype = str2tok((yyvsp[0].s), llc_u_subtypes);
 						if (subtype == -1) {
-					  		bpf_set_error(cstate, "unknown LLC type name \"%s\"", (yyvsp[0].s));
-					  		YYABORT;
-					  	}
+							bpf_set_error(cstate, "unknown LLC type name \"%s\"", (yyvsp[0].s));
+							YYABORT;
+						}
 						CHECK_PTR_VAL(((yyval.rblk) = gen_llc_u_subtype(cstate, subtype)));
 					}
 				  }
 				}
-#line 3097 "grammar.c"
+#line 2847 "grammar.c"
     break;
 
-  case 144:
-#line 665 "grammar.y"
+  case 145: /* pllc: LLC PF_RNR  */
+#line 737 "grammar.y"
                                 { CHECK_PTR_VAL(((yyval.rblk) = gen_llc_s_subtype(cstate, LLC_RNR))); }
-#line 3103 "grammar.c"
+#line 2853 "grammar.c"
     break;
 
-  case 146:
-#line 669 "grammar.y"
+  case 146: /* dir: NUM  */
+#line 740 "grammar.y"
+                                { (yyval.i) = (int)(yyvsp[0].h); }
+#line 2859 "grammar.c"
+    break;
+
+  case 147: /* dir: ID  */
+#line 741 "grammar.y"
                                 { CHECK_PTR_VAL((yyvsp[0].s));
 				  if (pcap_strcasecmp((yyvsp[0].s), "nods") == 0)
 					(yyval.i) = IEEE80211_FC1_DIR_NODS;
@@ -3118,412 +2874,412 @@
 					YYABORT;
 				  }
 				}
-#line 3122 "grammar.c"
+#line 2878 "grammar.c"
     break;
 
-  case 147:
-#line 685 "grammar.y"
-                                { (yyval.i) = (yyvsp[0].i); }
-#line 3128 "grammar.c"
+  case 148: /* reason: NUM  */
+#line 757 "grammar.y"
+                                { (yyval.i) = (yyvsp[0].h); }
+#line 2884 "grammar.c"
     break;
 
-  case 148:
-#line 686 "grammar.y"
+  case 149: /* reason: ID  */
+#line 758 "grammar.y"
                                 { CHECK_PTR_VAL((yyvsp[0].s)); CHECK_INT_VAL(((yyval.i) = pfreason_to_num(cstate, (yyvsp[0].s)))); }
-#line 3134 "grammar.c"
+#line 2890 "grammar.c"
     break;
 
-  case 149:
-#line 689 "grammar.y"
+  case 150: /* action: ID  */
+#line 761 "grammar.y"
                                 { CHECK_PTR_VAL((yyvsp[0].s)); CHECK_INT_VAL(((yyval.i) = pfaction_to_num(cstate, (yyvsp[0].s)))); }
-#line 3140 "grammar.c"
+#line 2896 "grammar.c"
     break;
 
-  case 150:
-#line 692 "grammar.y"
+  case 151: /* relop: '>'  */
+#line 764 "grammar.y"
                                 { (yyval.i) = BPF_JGT; }
-#line 3146 "grammar.c"
+#line 2902 "grammar.c"
     break;
 
-  case 151:
-#line 693 "grammar.y"
+  case 152: /* relop: GEQ  */
+#line 765 "grammar.y"
                                 { (yyval.i) = BPF_JGE; }
-#line 3152 "grammar.c"
+#line 2908 "grammar.c"
     break;
 
-  case 152:
-#line 694 "grammar.y"
+  case 153: /* relop: '='  */
+#line 766 "grammar.y"
                                 { (yyval.i) = BPF_JEQ; }
-#line 3158 "grammar.c"
+#line 2914 "grammar.c"
     break;
 
-  case 153:
-#line 696 "grammar.y"
+  case 154: /* irelop: LEQ  */
+#line 768 "grammar.y"
                                 { (yyval.i) = BPF_JGT; }
-#line 3164 "grammar.c"
+#line 2920 "grammar.c"
     break;
 
-  case 154:
-#line 697 "grammar.y"
+  case 155: /* irelop: '<'  */
+#line 769 "grammar.y"
                                 { (yyval.i) = BPF_JGE; }
-#line 3170 "grammar.c"
+#line 2926 "grammar.c"
     break;
 
-  case 155:
-#line 698 "grammar.y"
+  case 156: /* irelop: NEQ  */
+#line 770 "grammar.y"
                                 { (yyval.i) = BPF_JEQ; }
-#line 3176 "grammar.c"
+#line 2932 "grammar.c"
     break;
 
-  case 156:
-#line 700 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.a) = gen_loadi(cstate, (yyvsp[0].i)))); }
-#line 3182 "grammar.c"
+  case 157: /* arth: pnum  */
+#line 772 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.a) = gen_loadi(cstate, (yyvsp[0].h)))); }
+#line 2938 "grammar.c"
     break;
 
-  case 158:
-#line 703 "grammar.y"
+  case 159: /* narth: pname '[' arth ']'  */
+#line 775 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_load(cstate, (yyvsp[-3].i), (yyvsp[-1].a), 1))); }
-#line 3188 "grammar.c"
+#line 2944 "grammar.c"
     break;
 
-  case 159:
-#line 704 "grammar.y"
-                                        { CHECK_PTR_VAL(((yyval.a) = gen_load(cstate, (yyvsp[-5].i), (yyvsp[-3].a), (yyvsp[-1].i)))); }
-#line 3194 "grammar.c"
+  case 160: /* narth: pname '[' arth ':' NUM ']'  */
+#line 776 "grammar.y"
+                                        { CHECK_PTR_VAL(((yyval.a) = gen_load(cstate, (yyvsp[-5].i), (yyvsp[-3].a), (yyvsp[-1].h)))); }
+#line 2950 "grammar.c"
     break;
 
-  case 160:
-#line 705 "grammar.y"
+  case 161: /* narth: arth '+' arth  */
+#line 777 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_arth(cstate, BPF_ADD, (yyvsp[-2].a), (yyvsp[0].a)))); }
-#line 3200 "grammar.c"
+#line 2956 "grammar.c"
     break;
 
-  case 161:
-#line 706 "grammar.y"
+  case 162: /* narth: arth '-' arth  */
+#line 778 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_arth(cstate, BPF_SUB, (yyvsp[-2].a), (yyvsp[0].a)))); }
-#line 3206 "grammar.c"
+#line 2962 "grammar.c"
     break;
 
-  case 162:
-#line 707 "grammar.y"
+  case 163: /* narth: arth '*' arth  */
+#line 779 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_arth(cstate, BPF_MUL, (yyvsp[-2].a), (yyvsp[0].a)))); }
-#line 3212 "grammar.c"
+#line 2968 "grammar.c"
     break;
 
-  case 163:
-#line 708 "grammar.y"
+  case 164: /* narth: arth '/' arth  */
+#line 780 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_arth(cstate, BPF_DIV, (yyvsp[-2].a), (yyvsp[0].a)))); }
-#line 3218 "grammar.c"
+#line 2974 "grammar.c"
     break;
 
-  case 164:
-#line 709 "grammar.y"
+  case 165: /* narth: arth '%' arth  */
+#line 781 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_arth(cstate, BPF_MOD, (yyvsp[-2].a), (yyvsp[0].a)))); }
-#line 3224 "grammar.c"
+#line 2980 "grammar.c"
     break;
 
-  case 165:
-#line 710 "grammar.y"
+  case 166: /* narth: arth '&' arth  */
+#line 782 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_arth(cstate, BPF_AND, (yyvsp[-2].a), (yyvsp[0].a)))); }
-#line 3230 "grammar.c"
+#line 2986 "grammar.c"
     break;
 
-  case 166:
-#line 711 "grammar.y"
+  case 167: /* narth: arth '|' arth  */
+#line 783 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_arth(cstate, BPF_OR, (yyvsp[-2].a), (yyvsp[0].a)))); }
-#line 3236 "grammar.c"
+#line 2992 "grammar.c"
     break;
 
-  case 167:
-#line 712 "grammar.y"
+  case 168: /* narth: arth '^' arth  */
+#line 784 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_arth(cstate, BPF_XOR, (yyvsp[-2].a), (yyvsp[0].a)))); }
-#line 3242 "grammar.c"
+#line 2998 "grammar.c"
     break;
 
-  case 168:
-#line 713 "grammar.y"
+  case 169: /* narth: arth LSH arth  */
+#line 785 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_arth(cstate, BPF_LSH, (yyvsp[-2].a), (yyvsp[0].a)))); }
-#line 3248 "grammar.c"
+#line 3004 "grammar.c"
     break;
 
-  case 169:
-#line 714 "grammar.y"
+  case 170: /* narth: arth RSH arth  */
+#line 786 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_arth(cstate, BPF_RSH, (yyvsp[-2].a), (yyvsp[0].a)))); }
-#line 3254 "grammar.c"
+#line 3010 "grammar.c"
     break;
 
-  case 170:
-#line 715 "grammar.y"
+  case 171: /* narth: '-' arth  */
+#line 787 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_neg(cstate, (yyvsp[0].a)))); }
-#line 3260 "grammar.c"
+#line 3016 "grammar.c"
     break;
 
-  case 171:
-#line 716 "grammar.y"
+  case 172: /* narth: paren narth ')'  */
+#line 788 "grammar.y"
                                         { (yyval.a) = (yyvsp[-1].a); }
-#line 3266 "grammar.c"
+#line 3022 "grammar.c"
     break;
 
-  case 172:
-#line 717 "grammar.y"
+  case 173: /* narth: LEN  */
+#line 789 "grammar.y"
                                         { CHECK_PTR_VAL(((yyval.a) = gen_loadlen(cstate))); }
-#line 3272 "grammar.c"
+#line 3028 "grammar.c"
     break;
 
-  case 173:
-#line 719 "grammar.y"
+  case 174: /* byteop: '&'  */
+#line 791 "grammar.y"
                                 { (yyval.i) = '&'; }
-#line 3278 "grammar.c"
+#line 3034 "grammar.c"
     break;
 
-  case 174:
-#line 720 "grammar.y"
+  case 175: /* byteop: '|'  */
+#line 792 "grammar.y"
                                 { (yyval.i) = '|'; }
-#line 3284 "grammar.c"
+#line 3040 "grammar.c"
     break;
 
-  case 175:
-#line 721 "grammar.y"
+  case 176: /* byteop: '<'  */
+#line 793 "grammar.y"
                                 { (yyval.i) = '<'; }
-#line 3290 "grammar.c"
+#line 3046 "grammar.c"
     break;
 
-  case 176:
-#line 722 "grammar.y"
+  case 177: /* byteop: '>'  */
+#line 794 "grammar.y"
                                 { (yyval.i) = '>'; }
-#line 3296 "grammar.c"
+#line 3052 "grammar.c"
     break;
 
-  case 177:
-#line 723 "grammar.y"
+  case 178: /* byteop: '='  */
+#line 795 "grammar.y"
                                 { (yyval.i) = '='; }
-#line 3302 "grammar.c"
+#line 3058 "grammar.c"
     break;
 
-  case 179:
-#line 726 "grammar.y"
-                                { (yyval.i) = (yyvsp[-1].i); }
-#line 3308 "grammar.c"
+  case 180: /* pnum: paren pnum ')'  */
+#line 798 "grammar.y"
+                                { (yyval.h) = (yyvsp[-1].h); }
+#line 3064 "grammar.c"
     break;
 
-  case 180:
-#line 728 "grammar.y"
+  case 181: /* atmtype: LANE  */
+#line 800 "grammar.y"
                                 { (yyval.i) = A_LANE; }
-#line 3314 "grammar.c"
+#line 3070 "grammar.c"
     break;
 
-  case 181:
-#line 729 "grammar.y"
+  case 182: /* atmtype: METAC  */
+#line 801 "grammar.y"
                                 { (yyval.i) = A_METAC;	}
-#line 3320 "grammar.c"
+#line 3076 "grammar.c"
     break;
 
-  case 182:
-#line 730 "grammar.y"
+  case 183: /* atmtype: BCC  */
+#line 802 "grammar.y"
                                 { (yyval.i) = A_BCC; }
-#line 3326 "grammar.c"
+#line 3082 "grammar.c"
     break;
 
-  case 183:
-#line 731 "grammar.y"
+  case 184: /* atmtype: OAMF4EC  */
+#line 803 "grammar.y"
                                 { (yyval.i) = A_OAMF4EC; }
-#line 3332 "grammar.c"
+#line 3088 "grammar.c"
     break;
 
-  case 184:
-#line 732 "grammar.y"
+  case 185: /* atmtype: OAMF4SC  */
+#line 804 "grammar.y"
                                 { (yyval.i) = A_OAMF4SC; }
-#line 3338 "grammar.c"
+#line 3094 "grammar.c"
     break;
 
-  case 185:
-#line 733 "grammar.y"
+  case 186: /* atmtype: SC  */
+#line 805 "grammar.y"
                                 { (yyval.i) = A_SC; }
-#line 3344 "grammar.c"
+#line 3100 "grammar.c"
     break;
 
-  case 186:
-#line 734 "grammar.y"
+  case 187: /* atmtype: ILMIC  */
+#line 806 "grammar.y"
                                 { (yyval.i) = A_ILMIC; }
-#line 3350 "grammar.c"
+#line 3106 "grammar.c"
     break;
 
-  case 187:
-#line 736 "grammar.y"
+  case 188: /* atmmultitype: OAM  */
+#line 808 "grammar.y"
                                 { (yyval.i) = A_OAM; }
-#line 3356 "grammar.c"
+#line 3112 "grammar.c"
     break;
 
-  case 188:
-#line 737 "grammar.y"
+  case 189: /* atmmultitype: OAMF4  */
+#line 809 "grammar.y"
                                 { (yyval.i) = A_OAMF4; }
-#line 3362 "grammar.c"
+#line 3118 "grammar.c"
     break;
 
-  case 189:
-#line 738 "grammar.y"
+  case 190: /* atmmultitype: CONNECTMSG  */
+#line 810 "grammar.y"
                                 { (yyval.i) = A_CONNECTMSG; }
-#line 3368 "grammar.c"
+#line 3124 "grammar.c"
     break;
 
-  case 190:
-#line 739 "grammar.y"
+  case 191: /* atmmultitype: METACONNECT  */
+#line 811 "grammar.y"
                                 { (yyval.i) = A_METACONNECT; }
-#line 3374 "grammar.c"
+#line 3130 "grammar.c"
     break;
 
-  case 191:
-#line 742 "grammar.y"
+  case 192: /* atmfield: VPI  */
+#line 814 "grammar.y"
                                 { (yyval.blk).atmfieldtype = A_VPI; }
-#line 3380 "grammar.c"
+#line 3136 "grammar.c"
     break;
 
-  case 192:
-#line 743 "grammar.y"
+  case 193: /* atmfield: VCI  */
+#line 815 "grammar.y"
                                 { (yyval.blk).atmfieldtype = A_VCI; }
-#line 3386 "grammar.c"
+#line 3142 "grammar.c"
     break;
 
-  case 194:
-#line 746 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_atmfield_code(cstate, (yyvsp[-2].blk).atmfieldtype, (bpf_int32)(yyvsp[0].i), (bpf_u_int32)(yyvsp[-1].i), 0))); }
-#line 3392 "grammar.c"
+  case 195: /* atmvalue: relop NUM  */
+#line 818 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_atmfield_code(cstate, (yyvsp[-2].blk).atmfieldtype, (yyvsp[0].h), (yyvsp[-1].i), 0))); }
+#line 3148 "grammar.c"
     break;
 
-  case 195:
-#line 747 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_atmfield_code(cstate, (yyvsp[-2].blk).atmfieldtype, (bpf_int32)(yyvsp[0].i), (bpf_u_int32)(yyvsp[-1].i), 1))); }
-#line 3398 "grammar.c"
+  case 196: /* atmvalue: irelop NUM  */
+#line 819 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_atmfield_code(cstate, (yyvsp[-2].blk).atmfieldtype, (yyvsp[0].h), (yyvsp[-1].i), 1))); }
+#line 3154 "grammar.c"
     break;
 
-  case 196:
-#line 748 "grammar.y"
+  case 197: /* atmvalue: paren atmlistvalue ')'  */
+#line 820 "grammar.y"
                                  { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = qerr; }
-#line 3404 "grammar.c"
+#line 3160 "grammar.c"
     break;
 
-  case 197:
-#line 750 "grammar.y"
+  case 198: /* atmfieldvalue: NUM  */
+#line 822 "grammar.y"
                    {
 	(yyval.blk).atmfieldtype = (yyvsp[-1].blk).atmfieldtype;
 	if ((yyval.blk).atmfieldtype == A_VPI ||
 	    (yyval.blk).atmfieldtype == A_VCI)
-		CHECK_PTR_VAL(((yyval.blk).b = gen_atmfield_code(cstate, (yyval.blk).atmfieldtype, (bpf_int32) (yyvsp[0].i), BPF_JEQ, 0)));
+		CHECK_PTR_VAL(((yyval.blk).b = gen_atmfield_code(cstate, (yyval.blk).atmfieldtype, (yyvsp[0].h), BPF_JEQ, 0)));
 	}
-#line 3415 "grammar.c"
+#line 3171 "grammar.c"
     break;
 
-  case 199:
-#line 758 "grammar.y"
+  case 200: /* atmlistvalue: atmlistvalue or atmfieldvalue  */
+#line 830 "grammar.y"
                                         { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
-#line 3421 "grammar.c"
+#line 3177 "grammar.c"
     break;
 
-  case 200:
-#line 761 "grammar.y"
+  case 201: /* mtp2type: FISU  */
+#line 833 "grammar.y"
                                 { (yyval.i) = M_FISU; }
-#line 3427 "grammar.c"
+#line 3183 "grammar.c"
     break;
 
-  case 201:
-#line 762 "grammar.y"
+  case 202: /* mtp2type: LSSU  */
+#line 834 "grammar.y"
                                 { (yyval.i) = M_LSSU; }
-#line 3433 "grammar.c"
+#line 3189 "grammar.c"
     break;
 
-  case 202:
-#line 763 "grammar.y"
+  case 203: /* mtp2type: MSU  */
+#line 835 "grammar.y"
                                 { (yyval.i) = M_MSU; }
-#line 3439 "grammar.c"
+#line 3195 "grammar.c"
     break;
 
-  case 203:
-#line 764 "grammar.y"
+  case 204: /* mtp2type: HFISU  */
+#line 836 "grammar.y"
                                 { (yyval.i) = MH_FISU; }
-#line 3445 "grammar.c"
+#line 3201 "grammar.c"
     break;
 
-  case 204:
-#line 765 "grammar.y"
+  case 205: /* mtp2type: HLSSU  */
+#line 837 "grammar.y"
                                 { (yyval.i) = MH_LSSU; }
-#line 3451 "grammar.c"
+#line 3207 "grammar.c"
     break;
 
-  case 205:
-#line 766 "grammar.y"
+  case 206: /* mtp2type: HMSU  */
+#line 838 "grammar.y"
                                 { (yyval.i) = MH_MSU; }
-#line 3457 "grammar.c"
+#line 3213 "grammar.c"
     break;
 
-  case 206:
-#line 769 "grammar.y"
+  case 207: /* mtp3field: SIO  */
+#line 841 "grammar.y"
                                 { (yyval.blk).mtp3fieldtype = M_SIO; }
-#line 3463 "grammar.c"
+#line 3219 "grammar.c"
     break;
 
-  case 207:
-#line 770 "grammar.y"
+  case 208: /* mtp3field: OPC  */
+#line 842 "grammar.y"
                                 { (yyval.blk).mtp3fieldtype = M_OPC; }
-#line 3469 "grammar.c"
+#line 3225 "grammar.c"
     break;
 
-  case 208:
-#line 771 "grammar.y"
+  case 209: /* mtp3field: DPC  */
+#line 843 "grammar.y"
                                 { (yyval.blk).mtp3fieldtype = M_DPC; }
-#line 3475 "grammar.c"
+#line 3231 "grammar.c"
     break;
 
-  case 209:
-#line 772 "grammar.y"
+  case 210: /* mtp3field: SLS  */
+#line 844 "grammar.y"
                                 { (yyval.blk).mtp3fieldtype = M_SLS; }
-#line 3481 "grammar.c"
+#line 3237 "grammar.c"
     break;
 
-  case 210:
-#line 773 "grammar.y"
+  case 211: /* mtp3field: HSIO  */
+#line 845 "grammar.y"
                                 { (yyval.blk).mtp3fieldtype = MH_SIO; }
-#line 3487 "grammar.c"
+#line 3243 "grammar.c"
     break;
 
-  case 211:
-#line 774 "grammar.y"
+  case 212: /* mtp3field: HOPC  */
+#line 846 "grammar.y"
                                 { (yyval.blk).mtp3fieldtype = MH_OPC; }
-#line 3493 "grammar.c"
+#line 3249 "grammar.c"
     break;
 
-  case 212:
-#line 775 "grammar.y"
+  case 213: /* mtp3field: HDPC  */
+#line 847 "grammar.y"
                                 { (yyval.blk).mtp3fieldtype = MH_DPC; }
-#line 3499 "grammar.c"
+#line 3255 "grammar.c"
     break;
 
-  case 213:
-#line 776 "grammar.y"
+  case 214: /* mtp3field: HSLS  */
+#line 848 "grammar.y"
                                 { (yyval.blk).mtp3fieldtype = MH_SLS; }
-#line 3505 "grammar.c"
+#line 3261 "grammar.c"
     break;
 
-  case 215:
-#line 779 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_mtp3field_code(cstate, (yyvsp[-2].blk).mtp3fieldtype, (u_int)(yyvsp[0].i), (u_int)(yyvsp[-1].i), 0))); }
-#line 3511 "grammar.c"
+  case 216: /* mtp3value: relop NUM  */
+#line 851 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_mtp3field_code(cstate, (yyvsp[-2].blk).mtp3fieldtype, (yyvsp[0].h), (yyvsp[-1].i), 0))); }
+#line 3267 "grammar.c"
     break;
 
-  case 216:
-#line 780 "grammar.y"
-                                { CHECK_PTR_VAL(((yyval.blk).b = gen_mtp3field_code(cstate, (yyvsp[-2].blk).mtp3fieldtype, (u_int)(yyvsp[0].i), (u_int)(yyvsp[-1].i), 1))); }
-#line 3517 "grammar.c"
+  case 217: /* mtp3value: irelop NUM  */
+#line 852 "grammar.y"
+                                { CHECK_PTR_VAL(((yyval.blk).b = gen_mtp3field_code(cstate, (yyvsp[-2].blk).mtp3fieldtype, (yyvsp[0].h), (yyvsp[-1].i), 1))); }
+#line 3273 "grammar.c"
     break;
 
-  case 217:
-#line 781 "grammar.y"
+  case 218: /* mtp3value: paren mtp3listvalue ')'  */
+#line 853 "grammar.y"
                                   { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = qerr; }
-#line 3523 "grammar.c"
+#line 3279 "grammar.c"
     break;
 
-  case 218:
-#line 783 "grammar.y"
+  case 219: /* mtp3fieldvalue: NUM  */
+#line 855 "grammar.y"
                     {
 	(yyval.blk).mtp3fieldtype = (yyvsp[-1].blk).mtp3fieldtype;
 	if ((yyval.blk).mtp3fieldtype == M_SIO ||
@@ -3534,19 +3290,19 @@
 	    (yyval.blk).mtp3fieldtype == MH_OPC ||
 	    (yyval.blk).mtp3fieldtype == MH_DPC ||
 	    (yyval.blk).mtp3fieldtype == MH_SLS)
-		CHECK_PTR_VAL(((yyval.blk).b = gen_mtp3field_code(cstate, (yyval.blk).mtp3fieldtype, (u_int) (yyvsp[0].i), BPF_JEQ, 0)));
+		CHECK_PTR_VAL(((yyval.blk).b = gen_mtp3field_code(cstate, (yyval.blk).mtp3fieldtype, (yyvsp[0].h), BPF_JEQ, 0)));
 	}
-#line 3540 "grammar.c"
+#line 3296 "grammar.c"
     break;
 
-  case 220:
-#line 797 "grammar.y"
+  case 221: /* mtp3listvalue: mtp3listvalue or mtp3fieldvalue  */
+#line 869 "grammar.y"
                                           { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
-#line 3546 "grammar.c"
+#line 3302 "grammar.c"
     break;
 
 
-#line 3550 "grammar.c"
+#line 3306 "grammar.c"
 
       default: break;
     }
@@ -3561,11 +3317,10 @@
      case of YYERROR or YYBACKUP, subsequent parser actions might lead
      to an incorrect destructor call or verbose syntax error message
      before the lookahead is translated.  */
-  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
 
   YYPOPSTACK (yylen);
   yylen = 0;
-  YY_STACK_PRINT (yyss, yyssp);
 
   *++yyvsp = yyval;
 
@@ -3589,50 +3344,14 @@
 yyerrlab:
   /* Make sure we have latest lookahead translation.  See comments at
      user semantic actions for why this is necessary.  */
-  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
+  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
   /* If not already recovering from an error, report this error.  */
   if (!yyerrstatus)
     {
       ++yynerrs;
-#if ! YYERROR_VERBOSE
       yyerror (yyscanner, cstate, YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
-                                        yyssp, yytoken)
-      {
-        char const *yymsgp = YY_("syntax error");
-        int yysyntax_error_status;
-        yysyntax_error_status = YYSYNTAX_ERROR;
-        if (yysyntax_error_status == 0)
-          yymsgp = yymsg;
-        else if (yysyntax_error_status == 1)
-          {
-            if (yymsg != yymsgbuf)
-              YYSTACK_FREE (yymsg);
-            yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
-            if (!yymsg)
-              {
-                yymsg = yymsgbuf;
-                yymsg_alloc = sizeof yymsgbuf;
-                yysyntax_error_status = 2;
-              }
-            else
-              {
-                yysyntax_error_status = YYSYNTAX_ERROR;
-                yymsgp = yymsg;
-              }
-          }
-        yyerror (yyscanner, cstate, yymsgp);
-        if (yysyntax_error_status == 2)
-          goto yyexhaustedlab;
-      }
-# undef YYSYNTAX_ERROR
-#endif
     }
 
-
-
   if (yyerrstatus == 3)
     {
       /* If just tried and failed to reuse lookahead token after an
@@ -3665,6 +3384,7 @@
      label yyerrorlab therefore never appears in user code.  */
   if (0)
     YYERROR;
+  ++yynerrs;
 
   /* Do not reclaim the symbols of the rule whose action triggered
      this YYERROR.  */
@@ -3681,13 +3401,14 @@
 yyerrlab1:
   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
+  /* Pop stack until we find a state that shifts the error token.  */
   for (;;)
     {
       yyn = yypact[yystate];
       if (!yypact_value_is_default (yyn))
         {
-          yyn += YYTERROR;
-          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+          yyn += YYSYMBOL_YYerror;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
             {
               yyn = yytable[yyn];
               if (0 < yyn)
@@ -3701,7 +3422,7 @@
 
 
       yydestruct ("Error: popping",
-                  yystos[yystate], yyvsp, yyscanner, cstate);
+                  YY_ACCESSING_SYMBOL (yystate), yyvsp, yyscanner, cstate);
       YYPOPSTACK (1);
       yystate = *yyssp;
       YY_STACK_PRINT (yyss, yyssp);
@@ -3713,7 +3434,7 @@
 
 
   /* Shift the error token.  */
-  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
 
   yystate = yyn;
   goto yynewstate;
@@ -3724,7 +3445,7 @@
 `-------------------------------------*/
 yyacceptlab:
   yyresult = 0;
-  goto yyreturn;
+  goto yyreturnlab;
 
 
 /*-----------------------------------.
@@ -3732,24 +3453,22 @@
 `-----------------------------------*/
 yyabortlab:
   yyresult = 1;
-  goto yyreturn;
+  goto yyreturnlab;
 
 
-#if !defined yyoverflow || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here.  |
-`-------------------------------------------------*/
+/*-----------------------------------------------------------.
+| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
+`-----------------------------------------------------------*/
 yyexhaustedlab:
   yyerror (yyscanner, cstate, YY_("memory exhausted"));
   yyresult = 2;
-  /* Fall through.  */
-#endif
+  goto yyreturnlab;
 
 
-/*-----------------------------------------------------.
-| yyreturn -- parsing is finished, return the result.  |
-`-----------------------------------------------------*/
-yyreturn:
+/*----------------------------------------------------------.
+| yyreturnlab -- parsing is finished, clean up and return.  |
+`----------------------------------------------------------*/
+yyreturnlab:
   if (yychar != YYEMPTY)
     {
       /* Make sure we have latest lookahead translation.  See comments at
@@ -3765,18 +3484,16 @@
   while (yyssp != yyss)
     {
       yydestruct ("Cleanup: popping",
-                  yystos[+*yyssp], yyvsp, yyscanner, cstate);
+                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yyscanner, cstate);
       YYPOPSTACK (1);
     }
 #ifndef yyoverflow
   if (yyss != yyssa)
     YYSTACK_FREE (yyss);
 #endif
-#if YYERROR_VERBOSE
-  if (yymsg != yymsgbuf)
-    YYSTACK_FREE (yymsg);
-#endif
+
   return yyresult;
 }
-#line 799 "grammar.y"
+
+#line 871 "grammar.y"
 
diff --git a/grammar.h b/grammar.h
index b4cfd19..97f546a 100644
--- a/grammar.h
+++ b/grammar.h
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 3.5.1.  */
+/* A Bison parser, made by GNU Bison 3.8.2.  */
 
 /* Bison interface for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -31,8 +31,9 @@
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
-/* Undocumented macros, especially those whose name start with YY_,
-   are private implementation details.  Do not rely on them.  */
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+   especially those whose name start with YY_ or yy_.  They are
+   private implementation details that can be changed or removed.  */
 
 #ifndef YY_PCAP_GRAMMAR_H_INCLUDED
 # define YY_PCAP_GRAMMAR_H_INCLUDED
@@ -44,260 +45,145 @@
 extern int pcap_debug;
 #endif
 
-/* Token type.  */
+/* Token kinds.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
   enum yytokentype
   {
-    DST = 258,
-    SRC = 259,
-    HOST = 260,
-    GATEWAY = 261,
-    NET = 262,
-    NETMASK = 263,
-    PORT = 264,
-    PORTRANGE = 265,
-    LESS = 266,
-    GREATER = 267,
-    PROTO = 268,
-    PROTOCHAIN = 269,
-    CBYTE = 270,
-    ARP = 271,
-    RARP = 272,
-    IP = 273,
-    SCTP = 274,
-    TCP = 275,
-    UDP = 276,
-    ICMP = 277,
-    IGMP = 278,
-    IGRP = 279,
-    PIM = 280,
-    VRRP = 281,
-    CARP = 282,
-    ATALK = 283,
-    AARP = 284,
-    DECNET = 285,
-    LAT = 286,
-    SCA = 287,
-    MOPRC = 288,
-    MOPDL = 289,
-    TK_BROADCAST = 290,
-    TK_MULTICAST = 291,
-    NUM = 292,
-    INBOUND = 293,
-    OUTBOUND = 294,
-    PF_IFNAME = 295,
-    PF_RSET = 296,
-    PF_RNR = 297,
-    PF_SRNR = 298,
-    PF_REASON = 299,
-    PF_ACTION = 300,
-    TYPE = 301,
-    SUBTYPE = 302,
-    DIR = 303,
-    ADDR1 = 304,
-    ADDR2 = 305,
-    ADDR3 = 306,
-    ADDR4 = 307,
-    RA = 308,
-    TA = 309,
-    LINK = 310,
-    GEQ = 311,
-    LEQ = 312,
-    NEQ = 313,
-    ID = 314,
-    EID = 315,
-    HID = 316,
-    HID6 = 317,
-    AID = 318,
-    LSH = 319,
-    RSH = 320,
-    LEN = 321,
-    IPV6 = 322,
-    ICMPV6 = 323,
-    AH = 324,
-    ESP = 325,
-    VLAN = 326,
-    MPLS = 327,
-    PPPOED = 328,
-    PPPOES = 329,
-    GENEVE = 330,
-    ISO = 331,
-    ESIS = 332,
-    CLNP = 333,
-    ISIS = 334,
-    L1 = 335,
-    L2 = 336,
-    IIH = 337,
-    LSP = 338,
-    SNP = 339,
-    CSNP = 340,
-    PSNP = 341,
-    STP = 342,
-    IPX = 343,
-    NETBEUI = 344,
-    LANE = 345,
-    LLC = 346,
-    METAC = 347,
-    BCC = 348,
-    SC = 349,
-    ILMIC = 350,
-    OAMF4EC = 351,
-    OAMF4SC = 352,
-    OAM = 353,
-    OAMF4 = 354,
-    CONNECTMSG = 355,
-    METACONNECT = 356,
-    VPI = 357,
-    VCI = 358,
-    RADIO = 359,
-    FISU = 360,
-    LSSU = 361,
-    MSU = 362,
-    HFISU = 363,
-    HLSSU = 364,
-    HMSU = 365,
-    SIO = 366,
-    OPC = 367,
-    DPC = 368,
-    SLS = 369,
-    HSIO = 370,
-    HOPC = 371,
-    HDPC = 372,
-    HSLS = 373,
-    LEX_ERROR = 374,
-    OR = 375,
-    AND = 376,
-    UMINUS = 377
+    YYEMPTY = -2,
+    YYEOF = 0,                     /* "end of file"  */
+    YYerror = 256,                 /* error  */
+    YYUNDEF = 257,                 /* "invalid token"  */
+    DST = 258,                     /* DST  */
+    SRC = 259,                     /* SRC  */
+    HOST = 260,                    /* HOST  */
+    GATEWAY = 261,                 /* GATEWAY  */
+    NET = 262,                     /* NET  */
+    NETMASK = 263,                 /* NETMASK  */
+    PORT = 264,                    /* PORT  */
+    PORTRANGE = 265,               /* PORTRANGE  */
+    LESS = 266,                    /* LESS  */
+    GREATER = 267,                 /* GREATER  */
+    PROTO = 268,                   /* PROTO  */
+    PROTOCHAIN = 269,              /* PROTOCHAIN  */
+    CBYTE = 270,                   /* CBYTE  */
+    ARP = 271,                     /* ARP  */
+    RARP = 272,                    /* RARP  */
+    IP = 273,                      /* IP  */
+    SCTP = 274,                    /* SCTP  */
+    TCP = 275,                     /* TCP  */
+    UDP = 276,                     /* UDP  */
+    ICMP = 277,                    /* ICMP  */
+    IGMP = 278,                    /* IGMP  */
+    IGRP = 279,                    /* IGRP  */
+    PIM = 280,                     /* PIM  */
+    VRRP = 281,                    /* VRRP  */
+    CARP = 282,                    /* CARP  */
+    ATALK = 283,                   /* ATALK  */
+    AARP = 284,                    /* AARP  */
+    DECNET = 285,                  /* DECNET  */
+    LAT = 286,                     /* LAT  */
+    SCA = 287,                     /* SCA  */
+    MOPRC = 288,                   /* MOPRC  */
+    MOPDL = 289,                   /* MOPDL  */
+    TK_BROADCAST = 290,            /* TK_BROADCAST  */
+    TK_MULTICAST = 291,            /* TK_MULTICAST  */
+    NUM = 292,                     /* NUM  */
+    INBOUND = 293,                 /* INBOUND  */
+    OUTBOUND = 294,                /* OUTBOUND  */
+    IFINDEX = 295,                 /* IFINDEX  */
+    PF_IFNAME = 296,               /* PF_IFNAME  */
+    PF_RSET = 297,                 /* PF_RSET  */
+    PF_RNR = 298,                  /* PF_RNR  */
+    PF_SRNR = 299,                 /* PF_SRNR  */
+    PF_REASON = 300,               /* PF_REASON  */
+    PF_ACTION = 301,               /* PF_ACTION  */
+    TYPE = 302,                    /* TYPE  */
+    SUBTYPE = 303,                 /* SUBTYPE  */
+    DIR = 304,                     /* DIR  */
+    ADDR1 = 305,                   /* ADDR1  */
+    ADDR2 = 306,                   /* ADDR2  */
+    ADDR3 = 307,                   /* ADDR3  */
+    ADDR4 = 308,                   /* ADDR4  */
+    RA = 309,                      /* RA  */
+    TA = 310,                      /* TA  */
+    LINK = 311,                    /* LINK  */
+    GEQ = 312,                     /* GEQ  */
+    LEQ = 313,                     /* LEQ  */
+    NEQ = 314,                     /* NEQ  */
+    ID = 315,                      /* ID  */
+    EID = 316,                     /* EID  */
+    HID = 317,                     /* HID  */
+    HID6 = 318,                    /* HID6  */
+    AID = 319,                     /* AID  */
+    LSH = 320,                     /* LSH  */
+    RSH = 321,                     /* RSH  */
+    LEN = 322,                     /* LEN  */
+    IPV6 = 323,                    /* IPV6  */
+    ICMPV6 = 324,                  /* ICMPV6  */
+    AH = 325,                      /* AH  */
+    ESP = 326,                     /* ESP  */
+    VLAN = 327,                    /* VLAN  */
+    MPLS = 328,                    /* MPLS  */
+    PPPOED = 329,                  /* PPPOED  */
+    PPPOES = 330,                  /* PPPOES  */
+    GENEVE = 331,                  /* GENEVE  */
+    ISO = 332,                     /* ISO  */
+    ESIS = 333,                    /* ESIS  */
+    CLNP = 334,                    /* CLNP  */
+    ISIS = 335,                    /* ISIS  */
+    L1 = 336,                      /* L1  */
+    L2 = 337,                      /* L2  */
+    IIH = 338,                     /* IIH  */
+    LSP = 339,                     /* LSP  */
+    SNP = 340,                     /* SNP  */
+    CSNP = 341,                    /* CSNP  */
+    PSNP = 342,                    /* PSNP  */
+    STP = 343,                     /* STP  */
+    IPX = 344,                     /* IPX  */
+    NETBEUI = 345,                 /* NETBEUI  */
+    LANE = 346,                    /* LANE  */
+    LLC = 347,                     /* LLC  */
+    METAC = 348,                   /* METAC  */
+    BCC = 349,                     /* BCC  */
+    SC = 350,                      /* SC  */
+    ILMIC = 351,                   /* ILMIC  */
+    OAMF4EC = 352,                 /* OAMF4EC  */
+    OAMF4SC = 353,                 /* OAMF4SC  */
+    OAM = 354,                     /* OAM  */
+    OAMF4 = 355,                   /* OAMF4  */
+    CONNECTMSG = 356,              /* CONNECTMSG  */
+    METACONNECT = 357,             /* METACONNECT  */
+    VPI = 358,                     /* VPI  */
+    VCI = 359,                     /* VCI  */
+    RADIO = 360,                   /* RADIO  */
+    FISU = 361,                    /* FISU  */
+    LSSU = 362,                    /* LSSU  */
+    MSU = 363,                     /* MSU  */
+    HFISU = 364,                   /* HFISU  */
+    HLSSU = 365,                   /* HLSSU  */
+    HMSU = 366,                    /* HMSU  */
+    SIO = 367,                     /* SIO  */
+    OPC = 368,                     /* OPC  */
+    DPC = 369,                     /* DPC  */
+    SLS = 370,                     /* SLS  */
+    HSIO = 371,                    /* HSIO  */
+    HOPC = 372,                    /* HOPC  */
+    HDPC = 373,                    /* HDPC  */
+    HSLS = 374,                    /* HSLS  */
+    LEX_ERROR = 375,               /* LEX_ERROR  */
+    OR = 376,                      /* OR  */
+    AND = 377,                     /* AND  */
+    UMINUS = 378                   /* UMINUS  */
   };
+  typedef enum yytokentype yytoken_kind_t;
 #endif
-/* Tokens.  */
-#define DST 258
-#define SRC 259
-#define HOST 260
-#define GATEWAY 261
-#define NET 262
-#define NETMASK 263
-#define PORT 264
-#define PORTRANGE 265
-#define LESS 266
-#define GREATER 267
-#define PROTO 268
-#define PROTOCHAIN 269
-#define CBYTE 270
-#define ARP 271
-#define RARP 272
-#define IP 273
-#define SCTP 274
-#define TCP 275
-#define UDP 276
-#define ICMP 277
-#define IGMP 278
-#define IGRP 279
-#define PIM 280
-#define VRRP 281
-#define CARP 282
-#define ATALK 283
-#define AARP 284
-#define DECNET 285
-#define LAT 286
-#define SCA 287
-#define MOPRC 288
-#define MOPDL 289
-#define TK_BROADCAST 290
-#define TK_MULTICAST 291
-#define NUM 292
-#define INBOUND 293
-#define OUTBOUND 294
-#define PF_IFNAME 295
-#define PF_RSET 296
-#define PF_RNR 297
-#define PF_SRNR 298
-#define PF_REASON 299
-#define PF_ACTION 300
-#define TYPE 301
-#define SUBTYPE 302
-#define DIR 303
-#define ADDR1 304
-#define ADDR2 305
-#define ADDR3 306
-#define ADDR4 307
-#define RA 308
-#define TA 309
-#define LINK 310
-#define GEQ 311
-#define LEQ 312
-#define NEQ 313
-#define ID 314
-#define EID 315
-#define HID 316
-#define HID6 317
-#define AID 318
-#define LSH 319
-#define RSH 320
-#define LEN 321
-#define IPV6 322
-#define ICMPV6 323
-#define AH 324
-#define ESP 325
-#define VLAN 326
-#define MPLS 327
-#define PPPOED 328
-#define PPPOES 329
-#define GENEVE 330
-#define ISO 331
-#define ESIS 332
-#define CLNP 333
-#define ISIS 334
-#define L1 335
-#define L2 336
-#define IIH 337
-#define LSP 338
-#define SNP 339
-#define CSNP 340
-#define PSNP 341
-#define STP 342
-#define IPX 343
-#define NETBEUI 344
-#define LANE 345
-#define LLC 346
-#define METAC 347
-#define BCC 348
-#define SC 349
-#define ILMIC 350
-#define OAMF4EC 351
-#define OAMF4SC 352
-#define OAM 353
-#define OAMF4 354
-#define CONNECTMSG 355
-#define METACONNECT 356
-#define VPI 357
-#define VCI 358
-#define RADIO 359
-#define FISU 360
-#define LSSU 361
-#define MSU 362
-#define HFISU 363
-#define HLSSU 364
-#define HMSU 365
-#define SIO 366
-#define OPC 367
-#define DPC 368
-#define SLS 369
-#define HSIO 370
-#define HOPC 371
-#define HDPC 372
-#define HSLS 373
-#define LEX_ERROR 374
-#define OR 375
-#define AND 376
-#define UMINUS 377
 
 /* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 union YYSTYPE
 {
-#line 291 "grammar.y"
+#line 349 "grammar.y"
 
 	int i;
 	bpf_u_int32 h;
@@ -312,7 +198,7 @@
 	} blk;
 	struct block *rblk;
 
-#line 316 "grammar.h"
+#line 202 "grammar.h"
 
 };
 typedef union YYSTYPE YYSTYPE;
@@ -322,6 +208,8 @@
 
 
 
+
 int pcap_parse (void *yyscanner, compiler_state_t *cstate);
 
+
 #endif /* !YY_PCAP_GRAMMAR_H_INCLUDED  */
diff --git a/grammar.y.in b/grammar.y.in
index 2fbd861..b6a3d18 100644
--- a/grammar.y.in
+++ b/grammar.y.in
@@ -71,6 +71,13 @@
 #include <config.h>
 #endif
 
+/*
+ * grammar.h requires gencode.h and sometimes breaks in a polluted namespace
+ * (see ftmacros.h), so include it early.
+ */
+#include "gencode.h"
+#include "grammar.h"
+
 #include <stdlib.h>
 
 #ifndef _WIN32
@@ -92,17 +99,11 @@
 
 #include "pcap-int.h"
 
-#include "gencode.h"
-#include "grammar.h"
 #include "scanner.h"
 
-#ifdef HAVE_NET_PFVAR_H
-#include <net/if.h>
-#include <net/pfvar.h>
-#include <net/if_pflog.h>
-#endif
 #include "llc.h"
 #include "ieee80211.h"
+#include "pflog.h"
 #include <pcap/namedb.h>
 
 #ifdef HAVE_OS_PROTO_H
@@ -254,60 +255,87 @@
 	bpf_set_error(cstate, "can't parse filter expression: %s", msg);
 }
 
-#ifdef HAVE_NET_PFVAR_H
+static const struct tok pflog_reasons[] = {
+	{ PFRES_MATCH,		"match" },
+	{ PFRES_BADOFF,		"bad-offset" },
+	{ PFRES_FRAG,		"fragment" },
+	{ PFRES_SHORT,		"short" },
+	{ PFRES_NORM,		"normalize" },
+	{ PFRES_MEMORY,		"memory" },
+	{ PFRES_TS,		"bad-timestamp" },
+	{ PFRES_CONGEST,	"congestion" },
+	{ PFRES_IPOPTIONS,	"ip-option" },
+	{ PFRES_PROTCKSUM,	"proto-cksum" },
+	{ PFRES_BADSTATE,	"state-mismatch" },
+	{ PFRES_STATEINS,	"state-insert" },
+	{ PFRES_MAXSTATES,	"state-limit" },
+	{ PFRES_SRCLIMIT,	"src-limit" },
+	{ PFRES_SYNPROXY,	"synproxy" },
+#if defined(__FreeBSD__)
+	{ PFRES_MAPFAILED,	"map-failed" },
+#elif defined(__NetBSD__)
+	{ PFRES_STATELOCKED,	"state-locked" },
+#elif defined(__OpenBSD__)
+	{ PFRES_TRANSLATE,	"translate" },
+	{ PFRES_NOROUTE,	"no-route" },
+#elif defined(__APPLE__)
+	{ PFRES_DUMMYNET,	"dummynet" },
+#endif
+	{ 0, NULL }
+};
+
 static int
 pfreason_to_num(compiler_state_t *cstate, const char *reason)
 {
-	const char *reasons[] = PFRES_NAMES;
 	int i;
 
-	for (i = 0; reasons[i]; i++) {
-		if (pcap_strcasecmp(reason, reasons[i]) == 0)
-			return (i);
-	}
-	bpf_set_error(cstate, "unknown PF reason \"%s\"", reason);
-	return (-1);
+	i = str2tok(reason, pflog_reasons);
+	if (i == -1)
+		bpf_set_error(cstate, "unknown PF reason \"%s\"", reason);
+	return (i);
 }
 
+static const struct tok pflog_actions[] = {
+	{ PF_PASS,		"pass" },
+	{ PF_PASS,		"accept" },	/* alias for "pass" */
+	{ PF_DROP,		"drop" },
+	{ PF_DROP,		"block" },	/* alias for "drop" */
+	{ PF_SCRUB,		"scrub" },
+	{ PF_NOSCRUB,		"noscrub" },
+	{ PF_NAT,		"nat" },
+	{ PF_NONAT,		"nonat" },
+	{ PF_BINAT,		"binat" },
+	{ PF_NOBINAT,		"nobinat" },
+	{ PF_RDR,		"rdr" },
+	{ PF_NORDR,		"nordr" },
+	{ PF_SYNPROXY_DROP,	"synproxy-drop" },
+#if defined(__FreeBSD__)
+	{ PF_DEFER,		"defer" },
+#elif defined(__OpenBSD__)
+	{ PF_DEFER,		"defer" },
+	{ PF_MATCH,		"match" },
+	{ PF_DIVERT,		"divert" },
+	{ PF_RT,		"rt" },
+	{ PF_AFRT,		"afrt" },
+#elif defined(__APPLE__)
+	{ PF_DUMMYNET,		"dummynet" },
+	{ PF_NODUMMYNET,	"nodummynet" },
+	{ PF_NAT64,		"nat64" },
+	{ PF_NONAT64,		"nonat64" },
+#endif
+	{ 0, NULL },
+};
+
 static int
 pfaction_to_num(compiler_state_t *cstate, const char *action)
 {
-	if (pcap_strcasecmp(action, "pass") == 0 ||
-	    pcap_strcasecmp(action, "accept") == 0)
-		return (PF_PASS);
-	else if (pcap_strcasecmp(action, "drop") == 0 ||
-		pcap_strcasecmp(action, "block") == 0)
-		return (PF_DROP);
-#if HAVE_PF_NAT_THROUGH_PF_NORDR
-	else if (pcap_strcasecmp(action, "rdr") == 0)
-		return (PF_RDR);
-	else if (pcap_strcasecmp(action, "nat") == 0)
-		return (PF_NAT);
-	else if (pcap_strcasecmp(action, "binat") == 0)
-		return (PF_BINAT);
-	else if (pcap_strcasecmp(action, "nordr") == 0)
-		return (PF_NORDR);
-#endif
-	else {
-		bpf_set_error(cstate, "unknown PF action \"%s\"", action);
-		return (-1);
-	}
-}
-#else /* !HAVE_NET_PFVAR_H */
-static int
-pfreason_to_num(compiler_state_t *cstate, const char *reason _U_)
-{
-	bpf_set_error(cstate, "libpcap was compiled on a machine without pf support");
-	return (-1);
-}
+	int i;
 
-static int
-pfaction_to_num(compiler_state_t *cstate, const char *action _U_)
-{
-	bpf_set_error(cstate, "libpcap was compiled on a machine without pf support");
-	return (-1);
+	i = str2tok(action, pflog_actions);
+	if (i == -1)
+		bpf_set_error(cstate, "unknown PF action \"%s\"", action);
+	return (i);
 }
-#endif /* HAVE_NET_PFVAR_H */
 
 /*
  * For calls that might return an "an error occurred" value.
diff --git a/libpcap.pc.in b/libpcap.pc.in
index d74cbc5..629e662 100644
--- a/libpcap.pc.in
+++ b/libpcap.pc.in
@@ -13,6 +13,7 @@
 Name: libpcap
 Description: Platform-independent network traffic capture library
 Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -l@PACKAGE_NAME@
-Libs.private: @LIBS@
+Requires.private: @REQUIRES_PRIVATE@
+Libs: -L${libdir} @RPATH@ -l@PACKAGE_NAME@
+Libs.private: @LIBS_PRIVATE@
 Cflags: -I${includedir}
diff --git a/missing/asprintf.c b/missing/asprintf.c
index 3aa55ed..b65310e 100644
--- a/missing/asprintf.c
+++ b/missing/asprintf.c
@@ -20,7 +20,7 @@
 	int ret;
 
 	/*
-	 * XXX - the C99 standard says, in section 7.19.6.5 "Thes
+	 * XXX - the C99 standard says, in section 7.19.6.5 "The
 	 * nprintf function":
 	 *
 	 *    The snprintf function is equivalent to fprintf, except that
diff --git a/mkdep b/mkdep
index 6e8dbd6..ef120bd 100755
--- a/mkdep
+++ b/mkdep
@@ -108,26 +108,7 @@
 $CC $DEPENDENCY_CFLAG $flags $sources |
 sed "
 	s; \./; ;g
-	$SED" |
-awk '{
-	if ($1 != prev) {
-		if (rec != "")
-			print rec;
-		rec = $0;
-		prev = $1;
-	}
-	else {
-		if (length(rec $2) > 78) {
-			print rec;
-			rec = $0;
-		}
-		else
-			rec = rec " " $2
-	}
-}
-END {
-	print rec
-}' >> $TMP
+	$SED" >> $TMP
 
 cat << _EOF_ >> $TMP
 
diff --git a/nametoaddr.c b/nametoaddr.c
index c944ad3..55f9389 100644
--- a/nametoaddr.c
+++ b/nametoaddr.c
@@ -785,9 +785,14 @@
 {
 	register u_char *ap;
 	u_char a[6];
+	char namebuf[1024];
 
+	/*
+	 * In AIX 7.1 and 7.2: int ether_hostton(char *, struct ether_addr *);
+	 */
+	pcap_strlcpy(namebuf, name, sizeof(namebuf));
 	ap = NULL;
-	if (ether_hostton(name, (struct ether_addr *)a) == 0) {
+	if (ether_hostton(namebuf, (struct ether_addr *)a) == 0) {
 		ap = (u_char *)malloc(6);
 		if (ap != NULL)
 			memcpy((char *)ap, (char *)a, 6);
diff --git a/optimize.c b/optimize.c
index 610a030..0ad0c41 100644
--- a/optimize.c
+++ b/optimize.c
@@ -32,13 +32,14 @@
 #include <memory.h>
 #include <setjmp.h>
 #include <string.h>
-
+#include <limits.h> /* for SIZE_MAX */
 #include <errno.h>
 
 #include "pcap-int.h"
 
 #include "gencode.h"
 #include "optimize.h"
+#include "diag-control.h"
 
 #ifdef HAVE_OS_PROTO_H
 #include "os-proto.h"
@@ -2098,7 +2099,7 @@
 		 * versions of the machine code, eventually returning
 		 * to the first version.  (We're really not doing a
 		 * full loop detection, we're just testing for two
-		 * passes in a row where where we do nothing but
+		 * passes in a row where we do nothing but
 		 * move branches.)
 		 */
 		return;
@@ -2421,6 +2422,9 @@
 	}
 	longjmp(opt_state->top_ctx, 1);
 	/* NOTREACHED */
+#ifdef _AIX
+	PCAP_UNREACHABLE
+#endif /* _AIX */
 }
 
 /*
@@ -2606,7 +2610,7 @@
 	}
 
 	/*
-	 * Make sure the total memory required for both of them dosn't
+	 * Make sure the total memory required for both of them doesn't
 	 * overflow.
 	 */
 	if (block_memsize > SIZE_MAX - edge_memsize) {
@@ -2895,7 +2899,6 @@
 	    if (fp == NULL) {
 		(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
 		    "malloc");
-		free(fp);
 		return NULL;
 	    }
 	    memset((char *)fp, 0, sizeof(*fp) * n);
@@ -2925,6 +2928,9 @@
 	va_end(ap);
 	longjmp(conv_state->top_ctx, 1);
 	/* NOTREACHED */
+#ifdef _AIX
+	PCAP_UNREACHABLE
+#endif /* _AIX */
 }
 
 /*
diff --git a/pcap-airpcap.c b/pcap-airpcap.c
index d986ad9..510e4c4 100644
--- a/pcap-airpcap.c
+++ b/pcap-airpcap.c
@@ -627,6 +627,9 @@
 
 	/*
 	 * Loop through each packet.
+	 *
+	 * This assumes that a single buffer of packets will have
+	 * <= INT_MAX packets, so the packet count doesn't overflow.
 	 */
 #define bhp ((AirpcapBpfHeader *)bp)
 	n = 0;
diff --git a/pcap-bpf.c b/pcap-bpf.c
index f0ccb96..2898e59 100644
--- a/pcap-bpf.c
+++ b/pcap-bpf.c
@@ -478,7 +478,7 @@
 {
 	int fd = -1;
 	static const char cloning_device[] = "/dev/bpf";
-	int n = 0;
+	u_int n = 0;
 	char device[sizeof "/dev/bpf0000000000"];
 	static int no_cloning_bpf = 0;
 
@@ -503,12 +503,17 @@
 	    ((errno != EACCES && errno != ENOENT) ||
 	     (fd = open(cloning_device, O_RDONLY)) == -1)) {
 		if (errno != ENOENT) {
-			if (errno == EACCES)
+			if (errno == EACCES) {
 				fd = PCAP_ERROR_PERM_DENIED;
-			else
+				snprintf(errbuf, PCAP_ERRBUF_SIZE,
+				    "Attempt to open %s failed - root privileges may be required",
+				    cloning_device);
+			} else {
 				fd = PCAP_ERROR;
-			pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
-			    errno, "(cannot open device) %s", cloning_device);
+				pcap_fmt_errmsg_for_errno(errbuf,
+				    PCAP_ERRBUF_SIZE, errno,
+				    "(cannot open device) %s", cloning_device);
+			}
 			return (fd);
 		}
 		no_cloning_bpf = 1;
@@ -521,7 +526,7 @@
 		 * that isn't in use.
 		 */
 		do {
-			(void)snprintf(device, sizeof(device), "/dev/bpf%d", n++);
+			(void)snprintf(device, sizeof(device), "/dev/bpf%u", n++);
 			/*
 			 * Initially try a read/write open (to allow the inject
 			 * method to work).  If that fails due to permission
@@ -577,8 +582,9 @@
 			 * if any.
 			 */
 			fd = PCAP_ERROR_PERM_DENIED;
-			pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
-			    errno, "(cannot open BPF device) %s", device);
+			snprintf(errbuf, PCAP_ERRBUF_SIZE,
+			    "Attempt to open %s failed - root privileges may be required",
+			    device);
 			break;
 
 		default:
@@ -655,7 +661,11 @@
 		case ENXIO:
 			/*
 			 * There's no such device.
+			 *
+			 * There's nothing more to say, so clear out the
+			 * error message.
 			 */
+			errbuf[0] = '\0';
 			return (PCAP_ERROR_NO_SUCH_DEVICE);
 
 		case ENETDOWN:
@@ -1177,6 +1187,9 @@
 
 	/*
 	 * Loop through each packet.
+	 *
+	 * This assumes that a single buffer of packets will have
+	 * <= INT_MAX packets, so the packet count doesn't overflow.
 	 */
 #ifdef BIOCSTSTAMP
 #define bhp ((struct bpf_xhdr *)bp)
@@ -2191,7 +2204,7 @@
 				 *
 				 * Otherwise, fail.
 				 */
-				if (errno != BPF_BIND_BUFFER_TOO_BIG) {
+				if (status != BPF_BIND_BUFFER_TOO_BIG) {
 					/*
 					 * Special checks on macOS to deal
 					 * with the way monitor mode was
@@ -2968,7 +2981,7 @@
 }
 #else
 static int
-get_if_flags(const char *name _U_, bpf_u_int32 *flags _U_, char *errbuf _U_)
+get_if_flags(const char *name _U_, bpf_u_int32 *flags, char *errbuf _U_)
 {
 	/*
 	 * Nothing we can do other than mark loopback devices as "the
@@ -3043,7 +3056,11 @@
 		case ENXIO:
 			/*
 			 * There's no such device.
+			 *
+			 * There's nothing more to say, so clear the
+			 * error message.
 			 */
+			p->errbuf[0] = '\0';
 			close(sock);
 			return (PCAP_ERROR_NO_SUCH_DEVICE);
 
diff --git a/pcap-bt-linux.c b/pcap-bt-linux.c
index 8e70feb..37c8056 100644
--- a/pcap-bt-linux.c
+++ b/pcap-bt-linux.c
@@ -98,6 +98,14 @@
 		goto done;
 	}
 
+	/*
+	 * Zero the complete header, which is larger than dev_num because of tail
+	 * padding, to silence Valgrind, which overshoots validating that dev_num
+	 * has been set.
+	 * https://github.com/the-tcpdump-group/libpcap/issues/1083
+	 * https://bugs.kde.org/show_bug.cgi?id=448464
+	 */
+	memset(dev_list, 0, sizeof(*dev_list));
 	dev_list->dev_num = HCI_MAX_DEV;
 
 	if (ioctl(sock, HCIGETDEVLIST, (void *) dev_list) < 0)
diff --git a/pcap-common.c b/pcap-common.c
index 51d0666..4f12d8a 100644
--- a/pcap-common.c
+++ b/pcap-common.c
@@ -28,11 +28,6 @@
 #include <pcap-types.h>
 
 #include "pcap-int.h"
-#include "extract.h"
-#include "pcap/sll.h"
-#include "pcap/usb.h"
-#include "pcap/nflog.h"
-#include "pcap/can_socketcan.h"
 
 #include "pcap-common.h"
 
@@ -168,11 +163,20 @@
 #define LINKTYPE_ENC		109		/* OpenBSD IPSEC enc */
 
 /*
- * These three types are reserved for future use.
+ * These two types are reserved for future use.
  */
 #define LINKTYPE_LANE8023	110		/* ATM LANE + 802.3 */
 #define LINKTYPE_HIPPI		111		/* NetBSD HIPPI */
-#define LINKTYPE_HDLC		112		/* NetBSD HDLC framing */
+
+/*
+ * Used for NetBSD DLT_HDLC; from looking at the one driver in NetBSD
+ * that uses it, it's Cisco HDLC, so it's the same as DLT_C_HDLC/
+ * LINKTYPE_C_HDLC, but we define a separate value to avoid some
+ * compatibility issues with programs on NetBSD.
+ *
+ * All code should treat LINKTYPE_NETBSD_HDLC and LINKTYPE_C_HDLC the same.
+ */
+#define LINKTYPE_NETBSD_HDLC	112		/* NetBSD HDLC framing */
 
 #define LINKTYPE_LINUX_SLL	113		/* Linux cooked socket capture */
 #define LINKTYPE_LTALK		114		/* Apple LocalTalk hardware */
@@ -405,7 +409,7 @@
  * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
  * Every frame contains a 32bit A429 label.
  * More documentation on Arinc 429 can be found at
- * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
+ * https://web.archive.org/web/20040616233302/https://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
  */
 #define LINKTYPE_A429           184
 
@@ -956,13 +960,15 @@
 /*
  * Link-layer header type for upper-protocol layer PDU saves from wireshark.
  *
- * the actual contents are determined by two TAGs stored with each
- * packet:
- *   EXP_PDU_TAG_LINKTYPE          the link type (LINKTYPE_ value) of the
- *				   original packet.
+ * the actual contents are determined by two TAGs, one or more of
+ * which is stored with each packet:
  *
- *   EXP_PDU_TAG_PROTO_NAME        the name of the wireshark dissector
- * 				   that can make sense of the data stored.
+ *   EXP_PDU_TAG_DISSECTOR_NAME      the name of the Wireshark dissector
+ * 				     that can make sense of the data stored.
+ *
+ *   EXP_PDU_TAG_HEUR_DISSECTOR_NAME the name of the Wireshark heuristic
+ *				     dissector that can make sense of the
+ *				     data stored.
  */
 #define LINKTYPE_WIRESHARK_UPPER_PDU	252
 
@@ -1238,6 +1244,7 @@
 	{ DLT_RAW,		LINKTYPE_RAW },
 	{ DLT_SLIP_BSDOS,	LINKTYPE_SLIP_BSDOS },
 	{ DLT_PPP_BSDOS,	LINKTYPE_PPP_BSDOS },
+	{ DLT_HDLC,		LINKTYPE_NETBSD_HDLC },
 
 	/* BSD/OS Cisco HDLC */
 	{ DLT_C_HDLC,		LINKTYPE_C_HDLC },
@@ -1391,286 +1398,3 @@
 		return MAXIMUM_SNAPLEN;
 	}
 }
-
-/*
- * DLT_LINUX_SLL packets with a protocol type of LINUX_SLL_P_CAN or
- * LINUX_SLL_P_CANFD have SocketCAN headers in front of the payload,
- * with the CAN ID being in host byte order.
- *
- * When reading a DLT_LINUX_SLL capture file, we need to check for those
- * packets and convert the CAN ID from the byte order of the host that
- * wrote the file to this host's byte order.
- */
-static void
-swap_linux_sll_header(const struct pcap_pkthdr *hdr, u_char *buf)
-{
-	u_int caplen = hdr->caplen;
-	u_int length = hdr->len;
-	struct sll_header *shdr = (struct sll_header *)buf;
-	uint16_t protocol;
-	pcap_can_socketcan_hdr *chdr;
-
-	if (caplen < (u_int) sizeof(struct sll_header) ||
-	    length < (u_int) sizeof(struct sll_header)) {
-		/* Not enough data to have the protocol field */
-		return;
-	}
-
-	protocol = EXTRACT_BE_U_2(&shdr->sll_protocol);
-	if (protocol != LINUX_SLL_P_CAN && protocol != LINUX_SLL_P_CANFD)
-		return;
-
-	/*
-	 * SocketCAN packet; fix up the packet's header.
-	 */
-	chdr = (pcap_can_socketcan_hdr *)(buf + sizeof(struct sll_header));
-	if (caplen < (u_int) sizeof(struct sll_header) + sizeof(chdr->can_id) ||
-	    length < (u_int) sizeof(struct sll_header) + sizeof(chdr->can_id)) {
-		/* Not enough data to have the CAN ID */
-		return;
-	}
-	chdr->can_id = SWAPLONG(chdr->can_id);
-}
-
-/*
- * The DLT_USB_LINUX and DLT_USB_LINUX_MMAPPED headers are in host
- * byte order when capturing (it's supplied directly from a
- * memory-mapped buffer shared by the kernel).
- *
- * When reading a DLT_USB_LINUX or DLT_USB_LINUX_MMAPPED capture file,
- * we need to convert it from the byte order of the host that wrote
- * the file to this host's byte order.
- */
-static void
-swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf,
-    int header_len_64_bytes)
-{
-	pcap_usb_header_mmapped *uhdr = (pcap_usb_header_mmapped *)buf;
-	bpf_u_int32 offset = 0;
-
-	/*
-	 * "offset" is the offset *past* the field we're swapping;
-	 * we skip the field *before* checking to make sure
-	 * the captured data length includes the entire field.
-	 */
-
-	/*
-	 * The URB id is a totally opaque value; do we really need to
-	 * convert it to the reading host's byte order???
-	 */
-	offset += 8;			/* skip past id */
-	if (hdr->caplen < offset)
-		return;
-	uhdr->id = SWAPLL(uhdr->id);
-
-	offset += 4;			/* skip past various 1-byte fields */
-
-	offset += 2;			/* skip past bus_id */
-	if (hdr->caplen < offset)
-		return;
-	uhdr->bus_id = SWAPSHORT(uhdr->bus_id);
-
-	offset += 2;			/* skip past various 1-byte fields */
-
-	offset += 8;			/* skip past ts_sec */
-	if (hdr->caplen < offset)
-		return;
-	uhdr->ts_sec = SWAPLL(uhdr->ts_sec);
-
-	offset += 4;			/* skip past ts_usec */
-	if (hdr->caplen < offset)
-		return;
-	uhdr->ts_usec = SWAPLONG(uhdr->ts_usec);
-
-	offset += 4;			/* skip past status */
-	if (hdr->caplen < offset)
-		return;
-	uhdr->status = SWAPLONG(uhdr->status);
-
-	offset += 4;			/* skip past urb_len */
-	if (hdr->caplen < offset)
-		return;
-	uhdr->urb_len = SWAPLONG(uhdr->urb_len);
-
-	offset += 4;			/* skip past data_len */
-	if (hdr->caplen < offset)
-		return;
-	uhdr->data_len = SWAPLONG(uhdr->data_len);
-
-	if (uhdr->transfer_type == URB_ISOCHRONOUS) {
-		offset += 4;			/* skip past s.iso.error_count */
-		if (hdr->caplen < offset)
-			return;
-		uhdr->s.iso.error_count = SWAPLONG(uhdr->s.iso.error_count);
-
-		offset += 4;			/* skip past s.iso.numdesc */
-		if (hdr->caplen < offset)
-			return;
-		uhdr->s.iso.numdesc = SWAPLONG(uhdr->s.iso.numdesc);
-	} else
-		offset += 8;			/* skip USB setup header */
-
-	/*
-	 * With the old header, there are no isochronous descriptors
-	 * after the header.
-	 *
-	 * With the new header, the actual number of descriptors in
-	 * the header is not s.iso.numdesc, it's ndesc - only the
-	 * first N descriptors, for some value of N, are put into
-	 * the header, and ndesc is set to the actual number copied.
-	 * In addition, if s.iso.numdesc is negative, no descriptors
-	 * are captured, and ndesc is set to 0.
-	 */
-	if (header_len_64_bytes) {
-		/*
-		 * This is either the "version 1" header, with
-		 * 16 bytes of additional fields at the end, or
-		 * a "version 0" header from a memory-mapped
-		 * capture, with 16 bytes of zeroed-out padding
-		 * at the end.  Byte swap them as if this were
-		 * a "version 1" header.
-		 */
-		offset += 4;			/* skip past interval */
-		if (hdr->caplen < offset)
-			return;
-		uhdr->interval = SWAPLONG(uhdr->interval);
-
-		offset += 4;			/* skip past start_frame */
-		if (hdr->caplen < offset)
-			return;
-		uhdr->start_frame = SWAPLONG(uhdr->start_frame);
-
-		offset += 4;			/* skip past xfer_flags */
-		if (hdr->caplen < offset)
-			return;
-		uhdr->xfer_flags = SWAPLONG(uhdr->xfer_flags);
-
-		offset += 4;			/* skip past ndesc */
-		if (hdr->caplen < offset)
-			return;
-		uhdr->ndesc = SWAPLONG(uhdr->ndesc);
-
-		if (uhdr->transfer_type == URB_ISOCHRONOUS) {
-			/* swap the values in struct linux_usb_isodesc */
-			usb_isodesc *pisodesc;
-			uint32_t i;
-
-			pisodesc = (usb_isodesc *)(void *)(buf+offset);
-			for (i = 0; i < uhdr->ndesc; i++) {
-				offset += 4;		/* skip past status */
-				if (hdr->caplen < offset)
-					return;
-				pisodesc->status = SWAPLONG(pisodesc->status);
-
-				offset += 4;		/* skip past offset */
-				if (hdr->caplen < offset)
-					return;
-				pisodesc->offset = SWAPLONG(pisodesc->offset);
-
-				offset += 4;		/* skip past len */
-				if (hdr->caplen < offset)
-					return;
-				pisodesc->len = SWAPLONG(pisodesc->len);
-
-				offset += 4;		/* skip past padding */
-
-				pisodesc++;
-			}
-		}
-	}
-}
-
-/*
- * The DLT_NFLOG "packets" have a mixture of big-endian and host-byte-order
- * data.  They begin with a fixed-length header with big-endian fields,
- * followed by a set of TLVs, where the type and length are in host
- * byte order but the values are either big-endian or are a raw byte
- * sequence that's the same regardless of the host's byte order.
- *
- * When reading a DLT_NFLOG capture file, we need to convert the type
- * and length values from the byte order of the host that wrote the
- * file to the byte order of this host.
- */
-static void
-swap_nflog_header(const struct pcap_pkthdr *hdr, u_char *buf)
-{
-	u_char *p = buf;
-	nflog_hdr_t *nfhdr = (nflog_hdr_t *)buf;
-	nflog_tlv_t *tlv;
-	u_int caplen = hdr->caplen;
-	u_int length = hdr->len;
-	uint16_t size;
-
-	if (caplen < (u_int) sizeof(nflog_hdr_t) ||
-	    length < (u_int) sizeof(nflog_hdr_t)) {
-		/* Not enough data to have any TLVs. */
-		return;
-	}
-
-	if (nfhdr->nflog_version != 0) {
-		/* Unknown NFLOG version */
-		return;
-	}
-
-	length -= sizeof(nflog_hdr_t);
-	caplen -= sizeof(nflog_hdr_t);
-	p += sizeof(nflog_hdr_t);
-
-	while (caplen >= sizeof(nflog_tlv_t)) {
-		tlv = (nflog_tlv_t *) p;
-
-		/* Swap the type and length. */
-		tlv->tlv_type = SWAPSHORT(tlv->tlv_type);
-		tlv->tlv_length = SWAPSHORT(tlv->tlv_length);
-
-		/* Get the length of the TLV. */
-		size = tlv->tlv_length;
-		if (size % 4 != 0)
-			size += 4 - size % 4;
-
-		/* Is the TLV's length less than the minimum? */
-		if (size < sizeof(nflog_tlv_t)) {
-			/* Yes. Give up now. */
-			return;
-		}
-
-		/* Do we have enough data for the full TLV? */
-		if (caplen < size || length < size) {
-			/* No. */
-			return;
-		}
-
-		/* Skip over the TLV. */
-		length -= size;
-		caplen -= size;
-		p += size;
-	}
-}
-
-void
-swap_pseudo_headers(int linktype, struct pcap_pkthdr *hdr, u_char *data)
-{
-	/*
-	 * Convert pseudo-headers from the byte order of
-	 * the host on which the file was saved to our
-	 * byte order, as necessary.
-	 */
-	switch (linktype) {
-
-	case DLT_LINUX_SLL:
-		swap_linux_sll_header(hdr, data);
-		break;
-
-	case DLT_USB_LINUX:
-		swap_linux_usb_header(hdr, data, 0);
-		break;
-
-	case DLT_USB_LINUX_MMAPPED:
-		swap_linux_usb_header(hdr, data, 1);
-		break;
-
-	case DLT_NFLOG:
-		swap_nflog_header(hdr, data);
-		break;
-	}
-}
diff --git a/pcap-common.h b/pcap-common.h
index 8795a82..d765c94 100644
--- a/pcap-common.h
+++ b/pcap-common.h
@@ -21,33 +21,8 @@
  * pcap-common.h - common code for pcap and pcapng files
  */
 
-/*
- * We use the "receiver-makes-right" approach to byte order,
- * because time is at a premium when we are writing the file.
- * In other words, the pcap_file_header and pcap_pkthdr,
- * records are written in host byte order.
- * Note that the bytes of packet data are written out in the order in
- * which they were received, so multi-byte fields in packets are not
- * written in host byte order, they're written in whatever order the
- * sending machine put them in.
- *
- * ntoh[ls] aren't sufficient because we might need to swap on a big-endian
- * machine (if the file was written in little-end order).
- */
-#define	SWAPLONG(y) \
-    (((((u_int)(y))&0xff)<<24) | \
-     ((((u_int)(y))&0xff00)<<8) | \
-     ((((u_int)(y))&0xff0000)>>8) | \
-     ((((u_int)(y))>>24)&0xff))
-#define	SWAPSHORT(y) \
-     ((u_short)(((((u_int)(y))&0xff)<<8) | \
-                ((((u_int)(y))&0xff00)>>8)))
-
 extern int dlt_to_linktype(int dlt);
 
 extern int linktype_to_dlt(int linktype);
 
-extern void swap_pseudo_headers(int linktype, struct pcap_pkthdr *hdr,
-    u_char *data);
-
 extern u_int max_snaplen_for_dlt(int dlt);
diff --git a/pcap-config.1 b/pcap-config.1
index fe8d799..87ab0ac 100644
--- a/pcap-config.1
+++ b/pcap-config.1
@@ -68,5 +68,5 @@
 .B \-\-static
 flag causes it to write flags appropriate for compiling with a
 statically-linked version of libpcap.
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR pcap (3PCAP)
diff --git a/pcap-config.in b/pcap-config.in
index 54ca42f..6039ef3 100644
--- a/pcap-config.in
+++ b/pcap-config.in
@@ -12,13 +12,15 @@
 exec_prefix="@exec_prefix@"
 includedir="@includedir@"
 libdir="@libdir@"
-V_RPATH_OPT="@V_RPATH_OPT@"
 LIBS="@LIBS@"
-PACKAGE_NAME="@PACKAGE_NAME@"
+LIBS_STATIC="@LIBS_STATIC@"
+VERSION="@PACKAGE_VERSION@"
 
 static=0
+static_pcap_only=0
 show_cflags=0
 show_libs=0
+show_additional_libs=0
 while [ "$#" != 0 ]
 do
 	case "$1" in
@@ -27,6 +29,10 @@
 		static=1
 		;;
 
+	--static-pcap-only)
+		static_pcap_only=1
+		;;
+
 	--cflags)
 		show_cflags=1
 		;;
@@ -38,49 +44,107 @@
 	--additional-libs)
 		show_additional_libs=1
 		;;
+
+	-h|--help)
+		echo "Usage: pcap-config [ --help ] [--version] [ --static | --static-pcap-only ] [ --libs | --additional-libs ]"
+		exit 0
+		;;
+
+	--version)
+		echo "$VERSION"
+		exit 0
+		;;
+
+	*)
+		echo "pcap-config: Invalid command-line option $1 specified" 1>&2
+		echo "Usage: pcap-config [ --help ] [ --static | --static-pcap-only ] [ --libs | --additional-libs ]" 1>&2
+		exit 1
+		;;
 	esac
 	shift
 done
-if [ "$V_RPATH_OPT" != "" ]
+
+#
+# If we aren't installing in /usr, then provide a -L flag to let build
+# processes find our library.
+#
+# (We must check $prefix, as $libdir isn't necessarily /usr/lib in this
+# case - for example, Linux distributions for 64-bit platforms that
+# also provide support for binaries for a 32-bit version of the
+# platform may put the 64-bit libraries, the 32-bit libraries, or both
+# in directories other than /usr/lib.)
+#
+if [ "$prefix" != "/usr" ]
 then
-	#
-	# If libdir isn't /usr/lib, add it to the run-time linker path.
-	#
-	if [ "$libdir" != "/usr/lib" ]
-	then
-		RPATH=$V_RPATH_OPT$libdir
-	fi
+	LPATH=-L$libdir
 fi
 if [ "$static" = 1 ]
 then
 	#
-	# Include LIBS so that the flags include libraries containing
-	# routines that libpcap uses.
+	# Include LIBS_STATIC so that the flags include libraries
+	# containing routines that libpcap uses, and libraries
+	# containing routines those libraries use, etc., so that a
+	# completely statically linked program - i.e., linked only with
+	# static libraries - will be linked with all necessary
+	# libraries.
 	#
 	if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
 	then
-		echo "-I$includedir -L$libdir -lpcap $LIBS"
+		echo "-I$includedir $LPATH -l@PACKAGE_NAME@ $LIBS_STATIC"
 	elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
 	then
-		echo "-I$includedir -L$libdir $LIBS"
+		echo "-I$includedir $LPATH $LIBS_STATIC"
 	elif [ "$show_cflags" = 1 ]
 	then
 		echo "-I$includedir"
 	elif [ "$show_libs" = 1 ]
 	then
-		echo "-L$libdir -lpcap $LIBS"
+		echo "$LPATH -l@PACKAGE_NAME@ $LIBS_STATIC"
+	elif [ "$show_additional_libs" = 1 ]
+	then
+		echo "$LIBS_STATIC"
+	fi
+elif [ "$static_pcap_only" = 1 ]
+then
+	#
+	# Include LIBS so that the flags include libraries
+	# containing routines that libpcap uses, but not the libraries
+	# on which libpcap depends, so that an otherwise
+	# dynamically-linked program, linked statically only with
+	# libpcap - i.e., linked with a static libpcap and dynamic
+	# versions of other libraries - will be linked with all
+	# necessary libraries.
+	#
+	if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
+	then
+		echo "-I$includedir $LPATH -l@PACKAGE_NAME@ $LIBS"
+	elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
+	then
+		echo "-I$includedir $LPATH $LIBS"
+	elif [ "$show_cflags" = 1 ]
+	then
+		echo "-I$includedir"
+	elif [ "$show_libs" = 1 ]
+	then
+		echo "$LPATH -l@PACKAGE_NAME@ $LIBS"
 	elif [ "$show_additional_libs" = 1 ]
 	then
 		echo "$LIBS"
 	fi
 else
 	#
-	# Omit LIBS - libpcap is assumed to be linked with those
-	# libraries, so there's no need to do so explicitly.
+	# Don't included LIBS or LIBS_STATIC, for building a program
+	# with a dynamic libpcap; libpcap, being a dynamic library, will
+	# cause all of its dynamic-library dependencies to be pulled in
+	# at run time.
+	#
+	# Do, however, include RPATH, to make sure that, on platforms
+	# that require this, programs built with this version of
+	# libpcap can find it at run time.
 	#
 	if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
 	then
-		echo "-I$includedir -L$libdir $RPATH -l$PACKAGE_NAME"
+		echo "-I$includedir $LPATH @RPATH@ -l@PACKAGE_NAME@"
 	elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
 	then
 		echo "-I$includedir"
@@ -89,6 +153,6 @@
 		echo "-I$includedir"
 	elif [ "$show_libs" = 1 ]
 	then
-		echo "-L$libdir $RPATH -l$PACKAGE_NAME"
+		echo "$LPATH @RPATH@ -l@PACKAGE_NAME@"
 	fi
 fi
diff --git a/pcap-dag.c b/pcap-dag.c
index b207dd8..f261ead 100644
--- a/pcap-dag.c
+++ b/pcap-dag.c
@@ -213,7 +213,7 @@
 static int dag_setnonblock(pcap_t *p, int nonblock);
 
 static void
-delete_pcap_dag(pcap_t *p)
+delete_pcap_dag(const pcap_t *p)
 {
 	pcap_dag_node_t *curr = NULL, *prev = NULL;
 
@@ -299,7 +299,7 @@
 }
 
 static unsigned int
-dag_erf_ext_header_count(uint8_t * erf, size_t len)
+dag_erf_ext_header_count(const uint8_t *erf, size_t len)
 {
 	uint32_t hdr_num = 0;
 	uint8_t  hdr_type;
@@ -391,7 +391,12 @@
 
 	}
 
-	/* Process the packets. */
+	/*
+	 * Process the packets.
+	 *
+	 * This assumes that a single buffer of packets will have
+	 * <= INT_MAX packets, so the packet count doesn't overflow.
+	 */
 	while (pd->dag_mem_top - pd->dag_mem_bottom >= dag_record_size) {
 
 		unsigned short packet_len = 0;
@@ -731,7 +736,7 @@
  *  API polling parameters.
  *
  *  snaplen is now also ignored, until we get per-stream slen support. Set
- *  slen with approprite DAG tool BEFORE pcap_activate().
+ *  slen with appropriate DAG tool BEFORE pcap_activate().
  *
  *  See also pcap(3).
  */
@@ -788,14 +793,23 @@
 		/*
 		 * XXX - does this reliably set errno?
 		 */
-		if (errno == ENOENT)
+		if (errno == ENOENT) {
+			/*
+			 * There's nothing more to say, so clear
+			 * the error message.
+			 */
 			ret = PCAP_ERROR_NO_SUCH_DEVICE;
-		else if (errno == EPERM || errno == EACCES)
+			p->errbuf[0] = '\0';
+		} else if (errno == EPERM || errno == EACCES) {
 			ret = PCAP_ERROR_PERM_DENIED;
-		else
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "Attempt to open %s failed with %s - additional privileges may be required",
+			    device, (errno == EPERM) ? "EPERM" : "EACCES");
+		} else {
 			ret = PCAP_ERROR;
-		pcap_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-		    errno, "dag_config_init %s", device);
+			pcap_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
+			    errno, "dag_config_init %s", device);
+		}
 		goto fail;
 	}
 
@@ -945,7 +959,7 @@
 		 * Did the user request that they not be stripped?
 		 */
 		if ((s = getenv("ERF_DONT_STRIP_FCS")) != NULL) {
-			/* Yes.  Note the number of bytes that will be
+			/* Yes.  Note the number of 16-bit words that will be
 			   supplied. */
 			p->linktype_ext = LT_FCS_DATALINK_EXT(pd->dag_fcs_bits/16);
 
diff --git a/pcap-dll.rc b/pcap-dll.rc
index fc4f42b..85de542 100644
--- a/pcap-dll.rc
+++ b/pcap-dll.rc
@@ -20,12 +20,12 @@
         VALUE "Comments",         "https://github.com/the-tcpdump-group/libpcap/"
         VALUE "CompanyName",      "The TCPdump Group"
         VALUE "FileDescription",  "System-Independent Interface for User-Level Packet Capture"
-        VALUE "FileVersion",      "PACKAGE_VERSION_DLL"
+        VALUE "FileVersion",      PACKAGE_VERSION
         VALUE "InternalName",     PACKAGE_NAME
         VALUE "LegalCopyright",   "Copyright (c) The TCPdump Group"
         VALUE "LegalTrademarks",  ""
-        VALUE "OriginalFilename", "wpcap.dll"
-        VALUE "ProductName",      PACKAGE_NAME
+        VALUE "OriginalFilename", PACKAGE_NAME ".dll"
+        VALUE "ProductName",      "libpcap"
         VALUE "ProductVersion",   PACKAGE_VERSION
       END
     END
diff --git a/pcap-dlpi.c b/pcap-dlpi.c
index 208a63b..16ed52d 100644
--- a/pcap-dlpi.c
+++ b/pcap-dlpi.c
@@ -146,7 +146,7 @@
 static int dlpromiscon(pcap_t *, bpf_u_int32);
 static int dlbindreq(int, bpf_u_int32, char *);
 static int dlbindack(int, char *, char *, int *);
-static int dlokack(int, const char *, char *, char *);
+static int dlokack(int, const char *, char *, char *, int *);
 static int dlinforeq(int, char *);
 static int dlinfoack(int, char *, char *);
 
@@ -366,8 +366,12 @@
 	 * chop off the unit number, so "dname" is just a device type name.
 	 */
 	cp = split_dname(dname, &unit, errbuf);
-	if (cp == NULL)
+	if (cp == NULL) {
+		/*
+		 * split_dname() has filled in the error message.
+		 */
 		return (PCAP_ERROR_NO_SUCH_DEVICE);
+	}
 	*cp = '\0';
 
 	/*
@@ -383,12 +387,16 @@
 	 */
 	cp = "/dev/dlpi";
 	if ((fd = open(cp, O_RDWR)) < 0) {
-		if (errno == EPERM || errno == EACCES)
+		if (errno == EPERM || errno == EACCES) {
 			status = PCAP_ERROR_PERM_DENIED;
-		else
+			snprintf(errbuf, PCAP_ERRBUF_SIZE,
+			    "Attempt to open %s failed with %s - root privilege may be required",
+			    cp, (errno == EPERM) ? "EPERM" : "EACCES");
+		} else {
 			status = PCAP_ERROR;
-		pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
-		    errno, "%s", cp);
+			pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
+			    errno, "Attempt to open %s failed", cp);
+		}
 		return (status);
 	}
 
@@ -419,8 +427,12 @@
 	 * type name.
 	 */
 	cp = split_dname(dname, ppa, errbuf);
-	if (cp == NULL)
+	if (cp == NULL) {
+		/*
+		 * split_dname() has filled in the error message.
+		 */
 		return (PCAP_ERROR_NO_SUCH_DEVICE);
+	}
 
 	/*
 	 * Make a copy of the device pathname, and then remove the unit
@@ -432,12 +444,18 @@
 	/* Try device without unit number */
 	if ((fd = open(dname, O_RDWR)) < 0) {
 		if (errno != ENOENT) {
-			if (errno == EPERM || errno == EACCES)
+			if (errno == EPERM || errno == EACCES) {
 				status = PCAP_ERROR_PERM_DENIED;
-			else
+				snprintf(errbuf, PCAP_ERRBUF_SIZE,
+				    "Attempt to open %s failed with %s - root privilege may be required",
+				    dname,
+				    (errno == EPERM) ? "EPERM" : "EACCES");
+			} else {
 				status = PCAP_ERROR;
-			pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
-			    errno, "%s", dname);
+				pcap_fmt_errmsg_for_errno(errbuf,
+				    PCAP_ERRBUF_SIZE, errno,
+				    "Attempt to open %s failed", dname);
+			}
 			return (status);
 		}
 
@@ -472,12 +490,19 @@
 				snprintf(errbuf, PCAP_ERRBUF_SIZE,
 				    "%s: No DLPI device found", name);
 			} else {
-				if (errno == EPERM || errno == EACCES)
+				if (errno == EPERM || errno == EACCES) {
 					status = PCAP_ERROR_PERM_DENIED;
-				else
+					snprintf(errbuf, PCAP_ERRBUF_SIZE,
+					    "Attempt to open %s failed with %s - root privilege may be required",
+					    dname2,
+					    (errno == EPERM) ? "EPERM" : "EACCES");
+				} else {
 					status = PCAP_ERROR;
-				pcap_fmt_errmsg_for_errno(errbuf,
-				    PCAP_ERRBUF_SIZE, errno, "%s", dname2);
+					pcap_fmt_errmsg_for_errno(errbuf,
+					    PCAP_ERRBUF_SIZE, errno,
+					    "Attempt to open %s failed",
+					    dname2);
+				}
 			}
 			return (status);
 		}
@@ -915,7 +940,7 @@
 	if (send_request(fd, (char *)&req, sizeof(req), "attach", ebuf) < 0)
 		return (PCAP_ERROR);
 
-	err = dlokack(fd, "attach", (char *)buf, ebuf);
+	err = dlokack(fd, "attach", (char *)buf, ebuf, NULL);
 	if (err < 0)
 		return (err);
 	return (0);
@@ -980,6 +1005,7 @@
 	dl_promiscon_req_t req;
 	bpf_u_int32 buf[MAXDLBUF];
 	int err;
+	int uerror;
 
 	req.dl_primitive = DL_PROMISCON_REQ;
 	req.dl_level = level;
@@ -987,9 +1013,16 @@
 	    p->errbuf) < 0)
 		return (PCAP_ERROR);
 	err = dlokack(p->fd, "promiscon" STRINGIFY(level), (char *)buf,
-	    p->errbuf);
-	if (err < 0)
+	    p->errbuf, &uerror);
+	if (err < 0) {
+		if (err == PCAP_ERROR_PERM_DENIED) {
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "Attempt to set promiscuous mode failed with %s - root privilege may be required",
+			    (uerror == EPERM) ? "EPERM" : "EACCES");
+			err = PCAP_ERROR_PROMISC_PERM_DENIED;
+		}
 		return (err);
+	}
 	return (0);
 }
 
@@ -1196,6 +1229,9 @@
 			break;
 
 		default:
+			/*
+			 * Neither EPERM nor EACCES.
+			 */
 			snprintf(ebuf, PCAP_ERRBUF_SIZE,
 			    "recv_ack: %s: %s", what,
 			    dlstrerror(errmsgbuf, sizeof (errmsgbuf), dlp->error_ack.dl_errno));
@@ -1452,10 +1488,10 @@
 }
 
 static int
-dlokack(int fd, const char *what, char *bufp, char *ebuf)
+dlokack(int fd, const char *what, char *bufp, char *ebuf, int *uerror)
 {
 
-	return (recv_ack(fd, DL_OK_ACK_SIZE, what, bufp, ebuf, NULL));
+	return (recv_ack(fd, DL_OK_ACK_SIZE, what, bufp, ebuf, uerror));
 }
 
 
@@ -1490,7 +1526,7 @@
 	req.dl_primitive = DL_PASSIVE_REQ;
 
 	if (send_request(fd, (char *)&req, sizeof(req), "dlpassive", ebuf) == 0)
-	    (void) dlokack(fd, "dlpassive", (char *)buf, ebuf);
+	    (void) dlokack(fd, "dlpassive", (char *)buf, ebuf, NULL);
 }
 #endif
 
diff --git a/pcap-dos.c b/pcap-dos.c
index cdd60ea..897118b 100644
--- a/pcap-dos.c
+++ b/pcap-dos.c
@@ -12,6 +12,7 @@
 #include <signal.h>
 #include <float.h>
 #include <fcntl.h>
+#include <limits.h> /* for INT_MAX */
 #include <io.h>
 
 #if defined(USE_32BIT_DRIVERS)
@@ -355,7 +356,22 @@
 {
   int rc, num = 0;
 
-  while (num <= cnt || PACKET_COUNT_IS_UNLIMITED(cnt))
+  /*
+   * This can conceivably process more than INT_MAX packets,
+   * which would overflow the packet count, causing it either
+   * to look like a negative number, and thus cause us to
+   * return a value that looks like an error, or overflow
+   * back into positive territory, and thus cause us to
+   * return a too-low count.
+   *
+   * Therefore, if the packet count is unlimited, we clip
+   * it at INT_MAX; this routine is not expected to
+   * process packets indefinitely, so that's not an issue.
+   */
+  if (PACKET_COUNT_IS_UNLIMITED(cnt))
+    cnt = INT_MAX;
+
+  while (num <= cnt)
   {
     if (p->fd <= 0)
        return (-1);
@@ -553,7 +569,7 @@
 /*
  * Get a list of all interfaces that are present and that we probe okay.
  * Returns -1 on error, 0 otherwise.
- * The list may be NULL epty if no interfaces were up and could be opened.
+ * The list may be NULL empty if no interfaces were up and could be opened.
  */
 int pcap_platform_finddevs  (pcap_if_list_t *devlistp, char *errbuf)
 {
@@ -1188,14 +1204,14 @@
 
 static int ndis_open (struct device *dev)
 {
-  int promis = (dev->flags & IFF_PROMISC);
+  int promisc = (dev->flags & IFF_PROMISC);
 
 #ifdef USE_NDIS2
-  if (!NdisInit(promis))
+  if (!NdisInit(promisc))
      return (0);
   return (1);
 #else
-  ARGSUSED (promis);
+  ARGSUSED (promisc);
   return (0);
 #endif
 }
diff --git a/pcap-dpdk.c b/pcap-dpdk.c
index 765abe5..025a674 100644
--- a/pcap-dpdk.c
+++ b/pcap-dpdk.c
@@ -50,7 +50,7 @@
 You shall learn how to bind nic with DPDK-compatible driver by $RTE_SDK/usertools/dpdk-devbind.py, such as igb_uio.
 And enable hugepages by dpdk-setup.sh
 
-Then launch the l2fwd with dynamic dirver support. For example:
+Then launch the l2fwd with dynamic driver support. For example:
 $RTE_SDK/examples/l2fwd/$RTE_TARGET/l2fwd -dlibrte_pmd_e1000.so -dlibrte_pmd_ixgbe.so -dlibrte_mempool_ring.so -- -p 0x1
 
 3. Compile libpcap with dpdk options.
@@ -85,6 +85,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <limits.h> /* for INT_MAX */
 #include <time.h>
 
 #include <sys/time.h>
@@ -331,13 +332,28 @@
 	u_char *large_buffer=NULL;
 	int timeout_ms = p->opt.timeout;
 
-	if ( !PACKET_COUNT_IS_UNLIMITED(max_cnt) && max_cnt < MAX_PKT_BURST){
+	/*
+	 * This can conceivably process more than INT_MAX packets,
+	 * which would overflow the packet count, causing it either
+	 * to look like a negative number, and thus cause us to
+	 * return a value that looks like an error, or overflow
+	 * back into positive territory, and thus cause us to
+	 * return a too-low count.
+	 *
+	 * Therefore, if the packet count is unlimited, we clip
+	 * it at INT_MAX; this routine is not expected to
+	 * process packets indefinitely, so that's not an issue.
+	 */
+	if (PACKET_COUNT_IS_UNLIMITED(max_cnt))
+		max_cnt = INT_MAX;
+
+	if (max_cnt < MAX_PKT_BURST){
 		burst_cnt = max_cnt;
 	}else{
 		burst_cnt = MAX_PKT_BURST;
 	}
 
-	while( PACKET_COUNT_IS_UNLIMITED(max_cnt) || pkt_cnt < max_cnt){
+	while( pkt_cnt < max_cnt){
 		if (p->break_loop){
 			p->break_loop = 0;
 			return PCAP_ERROR_BREAK;
diff --git a/pcap-filter.manmisc.in b/pcap-filter.manmisc.in
index b429690..4b44cee 100644
--- a/pcap-filter.manmisc.in
+++ b/pcap-filter.manmisc.in
@@ -18,14 +18,14 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP-FILTER @MAN_MISC_INFO@ "6 February 2021"
+.TH PCAP-FILTER @MAN_MISC_INFO@ "19 November 2022"
 .SH NAME
 pcap-filter \- packet filter syntax
 .br
 .ad
 .SH DESCRIPTION
 .LP
-.BR pcap_compile ()
+.BR pcap_compile (3PCAP)
 is used to compile a string into a filter program.
 The resulting filter program can then be applied to
 some stream of packets to determine which packets will be supplied to
@@ -88,7 +88,7 @@
 .I proto
 qualifiers restrict the match to a particular protocol.
 Possible
-protos are:
+protocols are:
 .BR ether ,
 .BR fddi ,
 .BR tr ,
@@ -98,18 +98,19 @@
 .BR arp ,
 .BR rarp ,
 .BR decnet ,
+.BR sctp ,
 .B tcp
 and
 .BR udp .
 E.g., `\fBether src\fP foo', `\fBarp net\fP 128.3', `\fBtcp port\fP 21',
 `\fBudp portrange\fP 7000-7009', `\fBwlan addr2\fP 0:2:3:4:5:6'.
-If there is
-no proto qualifier, all protocols consistent with the type are
-assumed.
-E.g., `\fBsrc\fP foo' means `\fB(ip or arp or rarp) src\fP foo'
-(except the latter is not legal syntax), `\fBnet\fP bar' means `\fB(ip or
-arp or rarp) net\fP bar' and `\fBport\fP 53' means `\fB(tcp or udp)
-port\fP 53'.
+If there is no
+.I proto
+qualifier, all protocols consistent with the type are assumed.
+E.g., `\fBsrc\fP foo' means `\fB(ip or arp or rarp) src\fP foo',
+`\fBnet\fP bar' means `\fB(ip or arp or rarp) net\fP bar' and
+`\fBport\fP 53' means `\fB(tcp or udp or sctp) port\fP 53'
+(note that these examples use invalid syntax to illustrate the principle).
 .LP
 [\fBfddi\fP is actually an alias for \fBether\fP; the parser treats them
 identically as meaning ``the data link level used on the specified
@@ -149,40 +150,40 @@
 `\fBtcp dst port\fP ftp \fBor tcp dst port\fP ftp-data \fBor tcp dst port\fP domain'.
 .LP
 Allowable primitives are:
-.IP "\fBdst host \fIhost\fR"
-True if the IPv4/v6 destination field of the packet is \fIhost\fP,
+.IP "\fBdst host \fIhostnameaddr\fR"
+True if the IPv4/v6 destination field of the packet is \fIhostnameaddr\fP,
 which may be either an address or a name.
-.IP "\fBsrc host \fIhost\fR"
-True if the IPv4/v6 source field of the packet is \fIhost\fP.
-.IP "\fBhost \fIhost\fP"
-True if either the IPv4/v6 source or destination of the packet is \fIhost\fP.
+.IP "\fBsrc host \fIhostnameaddr\fR"
+True if the IPv4/v6 source field of the packet is \fIhostnameaddr\fP.
+.IP "\fBhost \fIhostnameaddr\fP"
+True if either the IPv4/v6 source or destination of the packet is \fIhostnameaddr\fP.
 .IP
 Any of the above host expressions can be prepended with the keywords,
 \fBip\fP, \fBarp\fP, \fBrarp\fP, or \fBip6\fP as in:
 .in +.5i
 .nf
-\fBip host \fIhost\fR
+\fBip host \fIhostnameaddr\fR
 .fi
 .in -.5i
 which is equivalent to:
 .in +.5i
 .nf
-\fBether proto \\ip and host \fIhost\fR
+\fBether proto \\\fRip \fBand host \fIhostnameaddr\fR
 .fi
 .in -.5i
-If \fIhost\fR is a name with multiple IPv4 addresses, each address will
+If \fIhostnameaddr\fR is a name with multiple IPv4/v6 addresses, each address will
 be checked for a match.
-.IP "\fBether dst \fIehost\fP"
-True if the Ethernet destination address is \fIehost\fP.
-\fIEhost\fP
+.IP "\fBether dst \fIethernameaddr\fP"
+True if the Ethernet destination address is \fIethernameaddr\fP.
+\fIethernameaddr\fP
 may be either a name from /etc/ethers or a numerical MAC address of the
 form "xx:xx:xx:xx:xx:xx", "xx.xx.xx.xx.xx.xx", "xx-xx-xx-xx-xx-xx",
 "xxxx.xxxx.xxxx", "xxxxxxxxxxxx", or various mixes of ':', '.', and '-',
 where each "x" is a hex digit (0-9, a-f, or A-F).
-.IP "\fBether src \fIehost\fP"
-True if the Ethernet source address is \fIehost\fP.
-.IP "\fBether host \fIehost\fP"
-True if either the Ethernet source or destination address is \fIehost\fP.
+.IP "\fBether src \fIethernameaddr\fP"
+True if the Ethernet source address is \fIethernameaddr\fP.
+.IP "\fBether host \fIethernameaddr\fP"
+True if either the Ethernet source or destination address is \fIethernameaddr\fP.
 .IP "\fBgateway\fP \fIhost\fP"
 True if the packet used \fIhost\fP as a gateway.
 I.e., the Ethernet
@@ -195,14 +196,14 @@
 (An equivalent expression is
 .in +.5i
 .nf
-\fBether host \fIehost \fBand not host \fIhost\fR
+\fBether host \fIethernameaddr \fBand not host \fIhostnameaddr\fR
 .fi
 .in -.5i
-which can be used with either names or numbers for \fIhost / ehost\fP.)
+which can be used with either names or numbers for \fIhostnameaddr / ethernameaddr\fP.)
 This syntax does not work in IPv6-enabled configuration at this moment.
-.IP "\fBdst net \fInet\fR"
+.IP "\fBdst net \fInetnameaddr\fR"
 True if the IPv4/v6 destination address of the packet has a network
-number of \fInet\fP.
+number of \fInetnameaddr\fP.
 \fINet\fP may be either a name from the networks database
 (/etc/networks, etc.) or a network number.
 An IPv4 network number can be written as a dotted quad (e.g., 192.168.1.0),
@@ -213,24 +214,24 @@
 An IPv6 network number must be written out fully; the netmask is
 ff:ff:ff:ff:ff:ff:ff:ff, so IPv6 "network" matches are really always
 host matches, and a network match requires a netmask length.
-.IP "\fBsrc net \fInet\fR"
+.IP "\fBsrc net \fInetnameaddr\fR"
 True if the IPv4/v6 source address of the packet has a network
-number of \fInet\fP.
-.IP "\fBnet \fInet\fR"
+number of \fInetnameaddr\fP.
+.IP "\fBnet \fInetnameaddr\fR"
 True if either the IPv4/v6 source or destination address of the packet has a network
-number of \fInet\fP.
-.IP "\fBnet \fInet\fR \fBmask \fInetmask\fR"
-True if the IPv4 address matches \fInet\fR with the specific \fInetmask\fR.
+number of \fInetnameaddr\fP.
+.IP "\fBnet \fInetaddr\fR \fBmask \fInetmask\fR"
+True if the IPv4 address matches \fInetaddr\fR with the specific \fInetmask\fR.
 May be qualified with \fBsrc\fR or \fBdst\fR.
-Note that this syntax is not valid for IPv6 \fInet\fR.
-.IP "\fBnet \fInet\fR/\fIlen\fR"
-True if the IPv4/v6 address matches \fInet\fR with a netmask \fIlen\fR
+Note that this syntax is not valid for IPv6 \fInetaddr\fR.
+.IP "\fBnet \fInetaddr\fR/\fIlen\fR"
+True if the IPv4/v6 address matches \fInetaddr\fR with a netmask \fIlen\fR
 bits wide.
 May be qualified with \fBsrc\fR or \fBdst\fR.
-.IP "\fBdst port \fIport\fR"
-True if the packet is IPv4 TCP, IPv4 UDP, IPv6 TCP or IPv6 UDP and has a
-destination port value of \fIport\fP.
-The \fIport\fP can be a number or a name used in /etc/services (see
+.IP "\fBdst port \fIportnamenum\fR"
+True if the packet is IPv4/v6 TCP, UDP or SCTP and has a
+destination port value of \fIportnamenum\fP.
+The \fIportnamenum\fP can be a number or a name used in /etc/services (see
 .BR tcp (4P)
 and
 .BR udp (4P)).
@@ -238,37 +239,37 @@
 number and protocol are checked.
 If a number or ambiguous name is used,
 only the port number is checked (e.g., `\fBdst port\fR 513' will print both
-tcp/login traffic and udp/who traffic, and `\fBport domain\fR' will print
+tcp/login traffic and udp/who traffic, and `\fBport\fR domain' will print
 both tcp/domain and udp/domain traffic).
-.IP "\fBsrc port \fIport\fR"
-True if the packet has a source port value of \fIport\fP.
-.IP "\fBport \fIport\fR"
-True if either the source or destination port of the packet is \fIport\fP.
-.IP "\fBdst portrange \fIport1-port2\fR"
-True if the packet is IPv4 TCP, IPv4 UDP, IPv6 TCP or IPv6 UDP and has a
-destination port value between \fIport1\fP and \fIport2\fP (both inclusive).
-.I port1
+.IP "\fBsrc port \fIportnamenum\fR"
+True if the packet has a source port value of \fIportnamenum\fP.
+.IP "\fBport \fIportnamenum\fR"
+True if either the source or destination port of the packet is \fIportnamenum\fP.
+.IP "\fBdst portrange \fIportnamenum1-portnamenum2\fR"
+True if the packet is IPv4/v6 TCP, UDP or SCTP and has a
+destination port value between \fIportnamenum1\fP and \fIportnamenum2\fP (both inclusive).
+.I portnamenum1
 and
-.I port2
+.I portnamenum2
 are interpreted in the same fashion as the
-.I port
+.I portnamenum
 parameter for
 .BR port .
-.IP "\fBsrc portrange \fIport1-port2\fR"
-True if the packet has a source port value between \fIport1\fP and
-\fIport2\fP (both inclusive).
-.IP "\fBportrange \fIport1-port2\fR"
+.IP "\fBsrc portrange \fIportnamenum1-portnamenum2\fR"
+True if the packet has a source port value between \fIportnamenum1\fP and
+\fIportnamenum2\fP (both inclusive).
+.IP "\fBportrange \fIportnamenum1-portnamenum2\fR"
 True if either the source or destination port of the packet is between
-\fIport1\fP and \fIport2\fP (both inclusive).
+\fIportnamenum1\fP and \fIportnamenum2\fP (both inclusive).
 .IP
 Any of the above port or port range expressions can be prepended with
-the keywords, \fBtcp\fP or \fBudp\fP, as in:
+the keywords, \fBtcp\fP, \fBudp\fP or \fBsctp\fP, as in:
 .in +.5i
 .nf
-\fBtcp src port \fIport\fR
+\fBtcp src port \fIportnamenum\fR
 .fi
 .in -.5i
-which matches only TCP packets whose source port is \fIport\fP.
+which matches only TCP packets whose source port is \fIportnamenum\fP.
 .IP "\fBless \fIlength\fR"
 True if the packet has a length less than or equal to \fIlength\fP.
 This is equivalent to:
@@ -289,24 +290,59 @@
 True if the packet is an IPv4 packet (see
 .BR ip (4P))
 of protocol type \fIprotocol\fP.
-\fIProtocol\fP can be a number or one of the names
-\fBicmp\fP, \fBicmp6\fP, \fBigmp\fP, \fBigrp\fP, \fBpim\fP, \fBah\fP,
-\fBesp\fP, \fBvrrp\fP, \fBudp\fP, or \fBtcp\fP.
-Note that the identifiers \fBtcp\fP, \fBudp\fP, and \fBicmp\fP are also
-keywords and must be escaped via backslash (\\).
+\fIProtocol\fP can be a number or one of the names recognized by
+.BR getprotobyname (3)
+(as in e.g. `\fBgetent\fR(1) protocols'), typically from an entry in
+.IR \%/etc/protocols ,
+for example:
+.BR ah ,
+.BR esp ,
+.B eigrp
+(only in Linux, FreeBSD, NetBSD, DragonFly BSD, and macOS),
+.BR icmp ,
+.BR igmp ,
+.B igrp
+(only in OpenBSD),
+.BR pim ,
+.BR sctp ,
+.BR tcp ,
+.B udp
+or
+.BR vrrp .
+Note that most of these example identifiers
+are also keywords and must be escaped via backslash (\\).
 Note that this primitive does not chase the protocol header chain.
+.IP "\fBicmp\fR"
+Abbreviation for:
+.in +.5i
+.nf
+\fBip proto\fR 1
+.fi
+.in -.5i
 .IP "\fBip6 proto \fIprotocol\fR"
 True if the packet is an IPv6 packet of protocol type \fIprotocol\fP.
+(See `\fBip proto\fP' above for the meaning of \fIprotocol\fR.)
+Note that the IPv6 variant of ICMP uses a different protocol number, named
+.B \%ipv6-icmp
+in AIX, FreeBSD, illumos, Linux, macOS, NetBSD, OpenBSD, Solaris and Windows.
 Note that this primitive does not chase the protocol header chain.
+.IP "\fBicmp6\fR"
+Abbreviation for:
+.in +.5i
+.nf
+\fBip6 proto\fR 58
+.fi
+.in -.5i
 .IP "\fBproto \fIprotocol\fR"
 True if the packet is an IPv4 or IPv6 packet of protocol type
-\fIprotocol\fP.  Note that this primitive does not chase the protocol
+\fIprotocol\fP.  (See `\fBip proto\fP' above for the meaning of
+\fIprotocol\fP.)  Note that this primitive does not chase the protocol
 header chain.
-.IP  "\fBtcp\fR, \fBudp\fR, \fBicmp\fR"
+.IP  "\fBah\fR, \fBesp\fR, \fBpim\fR, \fBsctp\fR, \fBtcp\fR, \fBudp\fR"
 Abbreviations for:
 .in +.5i
 .nf
-\fBproto \\\fIprotocol\fR\fB
+\fBproto \\\fIprotocol\fR
 .fi
 .in -.5i
 where \fIprotocol\fR is one of the above protocols.
@@ -314,6 +350,7 @@
 True if the packet is IPv6 packet,
 and contains protocol header with type \fIprotocol\fR
 in its protocol header chain.
+(See `\fBip proto\fP' above for the meaning of \fIprotocol\fP.)
 For example,
 .in +.5i
 .nf
@@ -330,9 +367,11 @@
 cause more packets to be dropped.
 .IP "\fBip protochain \fIprotocol\fR"
 Equivalent to \fBip6 protochain \fIprotocol\fR, but this is for IPv4.
+(See `\fBip proto\fP' above for the meaning of \fIprotocol\fP.)
 .IP "\fBprotochain \fIprotocol\fR"
 True if the packet is an IPv4 or IPv6 packet of protocol type
-\fIprotocol\fP.  Note that this primitive chases the protocol
+\fIprotocol\fP.  (See `\fBip proto\fP' above for the meaning of
+\fIprotocol\fP.)  Note that this primitive chases the protocol
 header chain.
 .IP "\fBether broadcast\fR"
 True if the packet is an Ethernet broadcast packet.
@@ -434,19 +473,19 @@
 Note that not all applications using
 .BR pcap (3PCAP)
 currently know how to parse these protocols.
-.IP "\fBdecnet src \fIhost\fR"
+.IP "\fBdecnet src \fIdecnetaddr\fR"
 True if the DECnet source address is
-.IR host ,
+.IR decnetaddr ,
 which may be an address of the form ``10.123'', or a DECnet host
 name.
 [DECnet host name support is only available on ULTRIX systems
 that are configured to run DECnet.]
-.IP "\fBdecnet dst \fIhost\fR"
+.IP "\fBdecnet dst \fIdecnetaddr\fR"
 True if the DECnet destination address is
-.IR host .
-.IP "\fBdecnet host \fIhost\fR"
+.IR decnetaddr .
+.IP "\fBdecnet host \fIdecnetaddr\fR"
 True if either the DECnet source or destination address is
-.IR host .
+.IR decnetaddr .
 .IP \fBllc\fP
 True if the packet has an 802.2 LLC header.  This includes:
 .IP
@@ -535,11 +574,11 @@
 .IP "\fBreason \fIcode\fR"
 True if the packet was logged with the specified PF reason code.  The known
 codes are:
-.BR match ,
-.BR bad-offset ,
-.BR fragment ,
-.BR short ,
-.BR normalize ,
+.BR \%match ,
+.BR \%bad-offset ,
+.BR \%fragment ,
+.BR \%short ,
+.BR \%normalize ,
 and
 .B memory
 (applies only to packets logged by OpenBSD's or FreeBSD's
@@ -639,27 +678,28 @@
 .IP
 If the specified \fIwlan_type\fR is \fBdata\fP,
 then valid \fIwlan_subtype\fRs are:
-\fBdata\fP,
-\fBdata-cf-ack\fP,
-\fBdata-cf-poll\fP,
-\fBdata-cf-ack-poll\fP,
-\fBnull\fP,
-\fBcf-ack\fP,
-\fBcf-poll\fP,
-\fBcf-ack-poll\fP,
-\fBqos-data\fP,
-\fBqos-data-cf-ack\fP,
-\fBqos-data-cf-poll\fP,
-\fBqos-data-cf-ack-poll\fP,
-\fBqos\fP,
-\fBqos-cf-poll\fP and
-\fBqos-cf-ack-poll\fP.
+.BR \%data ,
+.BR \%data-cf-ack ,
+.BR \%data-cf-poll ,
+.BR \%data-cf-ack-poll ,
+.BR \%null ,
+.BR \%cf-ack ,
+.BR \%cf-poll ,
+.BR \%cf-ack-poll ,
+.BR \%qos-data ,
+.BR \%qos-data-cf-ack ,
+.BR \%qos-data-cf-poll ,
+.BR \%qos-data-cf-ack-poll ,
+.BR \%qos ,
+.B \%qos-cf-poll
+and
+.BR \%qos-cf-ack-poll .
 .IP "\fBsubtype \fIwlan_subtype\fR"
 True if the IEEE 802.11 frame subtype matches the specified \fIwlan_subtype\fR
 and frame has the type to which the specified \fIwlan_subtype\fR belongs.
-.IP "\fBdir \fIdir\fR"
+.IP "\fBdir \fIdirection\fR"
 True if the IEEE 802.11 frame direction matches the specified
-.IR dir .
+.IR direction .
 Valid directions are:
 .BR nods ,
 .BR tods ,
@@ -815,30 +855,98 @@
 True if the packet is an ATM packet, for SunATM on Solaris, and is
 on a meta signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect,
 Release, or Release Done message.
-.IP  "\fIexpr relop expr\fR"
-True if the relation holds, where \fIrelop\fR is one of >, <, >=, <=, =,
-!=, and \fIexpr\fR is an arithmetic expression composed of integer
-constants (expressed in standard C syntax), the normal binary operators
-[+, -, *, /, %, &, |, ^, <<, >>], a length operator, and special packet data
+.IP  "\fIexpr1 relop expr2\fR"
+True if the relation holds.  \fIRelop\fR is one of
+.RB { > ,
+.BR < ,
+.BR >= ,
+.BR <= ,
+.BR = ,
+.BR == ,
+.BR != }
+(where
+.B =
+means the same as
+.BR == ).
+Each of \fIexpr1\fR and \fIexpr2\fR is an arithmetic expression composed of
+integer constants (expressed in standard C syntax), the normal binary operators
+.RB { + ,
+.BR - ,
+.BR * ,
+.BR / ,
+.BR % ,
+.BR & ,
+.BR | ,
+.BR ^ ,
+.BR << ,
+.BR >> },
+a length operator, and special packet data
 accessors.  Note that all comparisons are unsigned, so that, for example,
 0x80000000 and 0xffffffff are > 0.
 .IP
-The % and ^ operators are currently only supported for filtering in the
-kernel on Linux with 3.7 and later kernels; on all other systems, if
+The
+.B %
+and
+.B ^
+operators are currently only supported for filtering in the kernel on
+particular operating systems (for example: FreeBSD, Linux with 3.7 and later
+kernels, NetBSD); on all other systems (for example: AIX, illumos, Solaris,
+OpenBSD), if
 those operators are used, filtering will be done in user mode, which
 will increase the overhead of capturing packets and may cause more
 packets to be dropped.
 .IP
+The length operator, indicated by the keyword \fBlen\fP, gives the
+length of the packet.
+.IP
 To access data inside the packet, use the following syntax:
 .in +.5i
 .nf
 \fIproto\fB [ \fIexpr\fB : \fIsize\fB ]\fR
 .fi
 .in -.5i
-\fIProto\fR is one of \fBether, fddi, tr, wlan, ppp, slip, link,
-ip, arp, rarp, tcp, udp, icmp, ip6\fR or \fBradio\fR, and
+.I Proto
+is one of
+.BR arp ,
+.BR atalk ,
+.BR carp ,
+.BR decnet ,
+.BR ether ,
+.BR fddi ,
+.BR icmp ,
+.BR icmp6 ,
+.BR igmp ,
+.BR igrp ,
+.BR ip ,
+.BR ip6 ,
+.BR lat ,
+.BR link ,
+.BR mopdl ,
+.BR moprc ,
+.BR pim ,
+.BR ppp ,
+.BR radio ,
+.BR rarp ,
+.BR sca ,
+.BR sctp ,
+.BR slip ,
+.BR tcp ,
+.BR tr ,
+.BR udp ,
+.B vrrp
+or
+.BR wlan ,
+and
 indicates the protocol layer for the index operation.
-(\fBether, fddi, wlan, tr, ppp, slip\fR and \fBlink\fR all refer to the
+.RB ( ether ,
+.BR fddi ,
+.BR link ,
+.BR ppp ,
+.BR slip ,
+.B tr
+and
+.BR wlan
+all refer to the
 link layer. \fBradio\fR refers to the "radio header" added to some
 802.11 captures.)
 Note that \fBtcp\fR, \fBudp\fR and other upper-layer protocol types only
@@ -847,8 +955,6 @@
 given by \fIexpr\fR.
 \fISize\fR is optional and indicates the number of bytes in the
 field of interest; it can be either one, two, or four, and defaults to one.
-The length operator, indicated by the keyword \fBlen\fP, gives the
-length of the packet.
 
 For example, `\fBether[\fP0\fB] &\fP 1 \fB!=\fP 0' catches all multicast traffic.
 The expression `\fBip[\fP0\fB] &\fP 0xf \fB!=\fP 5'
@@ -862,37 +968,62 @@
 For instance, \fBtcp[\fP0\fB]\fP always means the first
 byte of the TCP \fIheader\fP, and never means the first byte of an
 intervening fragment.
-
+.IP
 Some offsets and field values may be expressed as names rather than
 as numeric values.
 The following protocol header field offsets are
 available: \fBicmptype\fP (ICMP type field), \fBicmp6type\fP (ICMPv6 type field),
 \fBicmpcode\fP (ICMP code field), \fBicmp6code\fP (ICMPv6 code field) and
 \fBtcpflags\fP (TCP flags field).
-
-The following ICMP type field values are available: \fBicmp-echoreply\fP,
-\fBicmp-unreach\fP, \fBicmp-sourcequench\fP, \fBicmp-redirect\fP,
-\fBicmp-echo\fP, \fBicmp-routeradvert\fP, \fBicmp-routersolicit\fP,
-\fBicmp-timxceed\fP, \fBicmp-paramprob\fP, \fBicmp-tstamp\fP,
-\fBicmp-tstampreply\fP, \fBicmp-ireq\fP, \fBicmp-ireqreply\fP,
-\fBicmp-maskreq\fP, \fBicmp-maskreply\fP.
-
-The following ICMPv6 type fields are available: \fBicmp6-destinationrunreach\fP,
-\fBicmp6-packettoobig\fP, \fBicmp6-timeexceeded\fP,
-\fBicmp6-parameterproblem\fP, \fBicmp6-echo\fP,
-\fBicmp6-echoreply\fP, \fBicmp6-multicastlistenerquery\fP,
-\fBicmp6-multicastlistenerreportv1\fP, \fBicmp6-multicastlistenerdone\fP,
-\fBicmp6-routersolicit\fP, \fBicmp6-routeradvert\fP,
-\fBicmp6-neighborsolicit\fP, \fBicmp6-neighboradvert\fP, \fBicmp6-redirect\fP,
-\fBicmp6-routerrenum\fP, \fBicmp6-nodeinformationquery\fP,
-\fBicmp6-nodeinformationresponse\fP, \fBicmp6-ineighbordiscoverysolicit\fP,
-\fBicmp6-ineighbordiscoveryadvert\fP, \fBicmp6-multicastlistenerreportv2\fP,
-\fBicmp6-homeagentdiscoveryrequest\fP, \fBicmp6-homeagentdiscoveryreply\fP,
-\fBicmp6-mobileprefixsolicit\fP, \fBicmp6-mobileprefixadvert\fP,
-\fBicmp6-certpathsolicit\fP, \fBicmp6-certpathadvert\fP,
-\fBicmp6-multicastrouteradvert\fP, \fBicmp6-multicastroutersolicit\fP,
-\fBicmp6-multicastrouterterm\fP.
-
+.IP
+The following ICMP type field values are available:
+.BR \%icmp-echoreply ,
+.BR \%icmp-unreach ,
+.BR \%icmp-sourcequench ,
+.BR \%icmp-redirect ,
+.BR \%icmp-echo ,
+.BR \%icmp-routeradvert ,
+.BR \%icmp-routersolicit ,
+.BR \%icmp-timxceed ,
+.BR \%icmp-paramprob ,
+.BR \%icmp-tstamp ,
+.BR \%icmp-tstampreply ,
+.BR \%icmp-ireq ,
+.BR \%icmp-ireqreply ,
+.BR \%icmp-maskreq ,
+.BR \%icmp-maskreply .
+.IP
+The following ICMPv6 type field values are available:
+.BR \%icmp6-destinationunreach ,
+.BR \%icmp6-packettoobig ,
+.BR \%icmp6-timeexceeded ,
+.BR \%icmp6-parameterproblem ,
+.BR \%icmp6-echo ,
+.BR \%icmp6-echoreply ,
+.BR \%icmp6-multicastlistenerquery ,
+.BR \%icmp6-multicastlistenerreportv1 ,
+.BR \%icmp6-multicastlistenerdone ,
+.BR \%icmp6-routersolicit ,
+.BR \%icmp6-routeradvert ,
+.BR \%icmp6-neighborsolicit ,
+.BR \%icmp6-neighboradvert ,
+.BR \%icmp6-redirect ,
+.BR \%icmp6-routerrenum ,
+.BR \%icmp6-nodeinformationquery ,
+.BR \%icmp6-nodeinformationresponse ,
+.BR \%icmp6-ineighbordiscoverysolicit ,
+.BR \%icmp6-ineighbordiscoveryadvert ,
+.BR \%icmp6-multicastlistenerreportv2 ,
+.BR \%icmp6-homeagentdiscoveryrequest ,
+.BR \%icmp6-homeagentdiscoveryreply ,
+.BR \%icmp6-mobileprefixsolicit ,
+.BR \%icmp6-mobileprefixadvert ,
+.BR \%icmp6-certpathsolicit ,
+.BR \%icmp6-certpathadvert ,
+.BR \%icmp6-multicastrouteradvert ,
+.BR \%icmp6-multicastroutersolicit ,
+.BR \%icmp6-multicastrouterterm .
+.IP
 The following TCP flags field values are available: \fBtcp-fin\fP,
 \fBtcp-syn\fP, \fBtcp-rst\fP, \fBtcp-push\fP,
 \fBtcp-ack\fP, \fBtcp-urg\fP, \fBtcp-ece\fP,
@@ -1033,10 +1164,20 @@
 icmp6[icmp6type] != icmp6-echo and icmp6[icmp6type] != icmp6-echoreply
 .fi
 .RE
-.SH "SEE ALSO"
+.SH BACKWARD COMPATIBILITY
+The ICMPv6 type code names, as well as the
+.B tcp-ece
+and
+.B tcp-cwr
+TCP flag names became available in libpcap 1.9.0.
+.PP
+The
+.B geneve
+keyword became available in libpcap 1.8.0.
+.SH SEE ALSO
 .BR pcap (3PCAP)
 .SH BUGS
-To report a security issue please send an e-mail to security@tcpdump.org.
+To report a security issue please send an e-mail to \%security@tcpdump.org.
 .LP
 To report bugs and other problems, contribute patches, request a
 feature, provide generic feedback etc please see the file
diff --git a/pcap-haiku.cpp b/pcap-haiku.cpp
index 701cac3..8ae9119 100644
--- a/pcap-haiku.cpp
+++ b/pcap-haiku.cpp
@@ -47,12 +47,11 @@
 
 
 static int
-pcap_read_haiku(pcap_t* handle, int maxPackets, pcap_handler callback,
+pcap_read_haiku(pcap_t* handle, int maxPackets _U_, pcap_handler callback,
 	u_char* userdata)
 {
 	// Receive a single packet
 
-	struct pcap_haiku* handlep = (struct pcap_haiku*)handle->priv;
 	u_char* buffer = (u_char*)handle->buffer + handle->offset;
 	struct sockaddr_dl from;
 	ssize_t bytesReceived;
@@ -160,6 +159,17 @@
 	handle->getnonblock_op = pcap_getnonblock_fd;
 	handle->setnonblock_op = pcap_setnonblock_fd;
 
+	/*
+	 * Turn a negative snapshot value (invalid), a snapshot value of
+	 * 0 (unspecified), or a value bigger than the normal maximum
+	 * value, into the maximum allowed value.
+	 *
+	 * If some application really *needs* a bigger snapshot
+	 * length, we should just increase MAXIMUM_SNAPLEN.
+	 */
+	if (handle->snapshot <= 0 || handle->snapshot > MAXIMUM_SNAPLEN)
+		handle->snapshot = MAXIMUM_SNAPLEN;
+
 	handlep->device	= strdup(device);
 	if (handlep->device == NULL) {
 		pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
@@ -238,7 +248,11 @@
 		return NULL;
 	}
 
-	pcap_t* handle = PCAP_CREATE_COMMON(errorBuffer, struct pcap_haiku);
+	struct wrapper_struct { pcap_t __common; struct pcap_haiku __private; };
+	pcap_t* handle = pcap_create_common(errorBuffer,
+		sizeof (struct wrapper_struct),
+		offsetof (struct wrapper_struct, __private));
+
 	if (handle == NULL) {
 		snprintf(errorBuffer, PCAP_ERRBUF_SIZE, "malloc: %s", strerror(errno));
 		close(socket);
@@ -254,7 +268,7 @@
 }
 
 static int
-can_be_bound(const char *name)
+can_be_bound(const char *name _U_)
 {
 	return 1;
 }
@@ -280,3 +294,12 @@
 	return pcap_findalldevs_interfaces(_allDevices, errorBuffer, can_be_bound,
 		get_if_flags);
 }
+
+/*
+ * Libpcap version string.
+ */
+extern "C" const char *
+pcap_lib_version(void)
+{
+	return (PCAP_VERSION_STRING);
+}
diff --git a/pcap-int.h b/pcap-int.h
index dc18d50..894e74a 100644
--- a/pcap-int.h
+++ b/pcap-int.h
@@ -53,6 +53,24 @@
 #include "portability.h"
 
 /*
+ * If we're compiling with Visual Studio, make sure we have at least
+ * VS 2015 or later, so we have sufficient C99 support.
+ *
+ * XXX - verify that we have at least C99 support on UN*Xes?
+ *
+ * What about MinGW or various DOS toolchains?  We're currently assuming
+ * sufficient C99 support there.
+ */
+#if defined(_MSC_VER)
+  /*
+   * Compiler is MSVC.  Make sure we have VS 2015 or later.
+   */
+  #if _MSC_VER < 1900
+    #error "Building libpcap requires VS 2015 or later"
+  #endif
+#endif
+
+/*
  * Version string.
  * Uses PACKAGE_VERSION from config.h.
  */
@@ -467,7 +485,7 @@
 /*
  * This wrapper takes an error buffer pointer and a type to use for the
  * private data, and calls pcap_create_common(), passing it the error
- * buffer pointer, the size fo the private data type, in bytes, and the
+ * buffer pointer, the size for the private data type, in bytes, and the
  * offset of the private data from the beginning of the structure, in
  * bytes.
  */
@@ -551,7 +569,7 @@
 /*
  * This wrapper takes an error buffer pointer and a type to use for the
  * private data, and calls pcap_create_common(), passing it the error
- * buffer pointer, the size fo the private data type, in bytes, and the
+ * buffer pointer, the size for the private data type, in bytes, and the
  * offset of the private data from the beginning of the structure, in
  * bytes.
  */
diff --git a/pcap-libdlpi.c b/pcap-libdlpi.c
index ef3fdac..70cb5d4 100644
--- a/pcap-libdlpi.c
+++ b/pcap-libdlpi.c
@@ -108,15 +108,24 @@
 	 */
 	retv = dlpi_open(p->opt.device, &dh, DLPI_RAW|DLPI_PASSIVE);
 	if (retv != DLPI_SUCCESS) {
-		if (retv == DLPI_ELINKNAMEINVAL || retv == DLPI_ENOLINK)
+		if (retv == DLPI_ELINKNAMEINVAL || retv == DLPI_ENOLINK) {
+			/*
+			 * There's nothing more to say, so clear the
+			 * error message.
+			 */
 			status = PCAP_ERROR_NO_SUCH_DEVICE;
-		else if (retv == DL_SYSERR &&
-		    (errno == EPERM || errno == EACCES))
+			p->errbuf[0] = '\0';
+		} else if (retv == DL_SYSERR &&
+		    (errno == EPERM || errno == EACCES)) {
 			status = PCAP_ERROR_PERM_DENIED;
-		else
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "Attempt to open DLPI device failed with %s - root privilege may be required",
+			    (errno == EPERM) ? "EPERM" : "EACCES");
+		} else {
 			status = PCAP_ERROR;
-		pcap_libdlpi_err(p->opt.device, "dlpi_open", retv,
-		    p->errbuf);
+			pcap_libdlpi_err(p->opt.device, "dlpi_open", retv,
+			    p->errbuf);
+		}
 		return (status);
 	}
 	pd->dlpi_hd = dh;
@@ -265,12 +274,25 @@
 	retv = dlpi_promiscon(pd->dlpi_hd, level);
 	if (retv != DLPI_SUCCESS) {
 		if (retv == DL_SYSERR &&
-		    (errno == EPERM || errno == EACCES))
-			err = PCAP_ERROR_PERM_DENIED;
-		else
+		    (errno == EPERM || errno == EACCES)) {
+			if (level == DL_PROMISC_PHYS) {
+				err = PCAP_ERROR_PROMISC_PERM_DENIED;
+				snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+				    "Attempt to set promiscuous mode failed with %s - root privilege may be required",
+				    (errno == EPERM) ? "EPERM" : "EACCES");
+			} else {
+				err = PCAP_ERROR_PERM_DENIED;
+				snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+				    "Attempt to set %s mode failed with %s - root privilege may be required",
+				    (level == DL_PROMISC_MULTI) ? "multicast" : "SAP promiscuous",
+				    (errno == EPERM) ? "EPERM" : "EACCES");
+			}
+		} else {
 			err = PCAP_ERROR;
-		pcap_libdlpi_err(p->opt.device, "dlpi_promiscon" STRINGIFY(level),
-		    retv, p->errbuf);
+			pcap_libdlpi_err(p->opt.device,
+			    "dlpi_promiscon" STRINGIFY(level),
+			    retv, p->errbuf);
+		}
 		return (err);
 	}
 	return (0);
diff --git a/pcap-linux.c b/pcap-linux.c
index 878f27f..43d2a9f 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -100,6 +100,7 @@
 #include "pcap-int.h"
 #include "pcap/sll.h"
 #include "pcap/vlan.h"
+#include "pcap/can_socketcan.h"
 
 #include "diag-control.h"
 
@@ -222,7 +223,7 @@
 static int is_wifi(const char *);
 static void map_arphrd_to_dlt(pcap_t *, int, const char *, int);
 static int pcap_activate_linux(pcap_t *);
-static int activate_pf_packet(pcap_t *, int);
+static int setup_socket(pcap_t *, int);
 static int setup_mmapped(pcap_t *, int *);
 static int pcap_can_set_rfmon_linux(pcap_t *);
 static int pcap_inject_linux(pcap_t *, const void *, int);
@@ -318,10 +319,8 @@
 static int 	iface_bind(int fd, int ifindex, char *ebuf, int protocol);
 static int	enter_rfmon_mode(pcap_t *handle, int sock_fd,
     const char *device);
-#if defined(HAVE_LINUX_NET_TSTAMP_H) && defined(PACKET_TIMESTAMP)
-static int	iface_ethtool_get_ts_info(const char *device, pcap_t *handle,
+static int	iface_get_ts_types(const char *device, pcap_t *handle,
     char *ebuf);
-#endif
 static int	iface_get_offload(pcap_t *handle);
 
 static int	fix_program(pcap_t *handle, struct sock_fprog *fcode);
@@ -348,15 +347,13 @@
 	handle->activate_op = pcap_activate_linux;
 	handle->can_set_rfmon_op = pcap_can_set_rfmon_linux;
 
-#if defined(HAVE_LINUX_NET_TSTAMP_H) && defined(PACKET_TIMESTAMP)
 	/*
 	 * See what time stamp types we support.
 	 */
-	if (iface_ethtool_get_ts_info(device, handle, ebuf) == -1) {
+	if (iface_get_ts_types(device, handle, ebuf) == -1) {
 		pcap_close(handle);
 		return NULL;
 	}
-#endif
 
 	/*
 	 * We claim that we support microsecond and nanosecond time
@@ -845,7 +842,10 @@
 		handlep->device = NULL;
 	}
 
-	close(handlep->poll_breakloop_fd);
+	if (handlep->poll_breakloop_fd != -1) {
+		close(handlep->poll_breakloop_fd);
+		handlep->poll_breakloop_fd = -1;
+	}
 	pcap_cleanup_live_common(handle);
 }
 
@@ -944,7 +944,41 @@
 
 	uint64_t value = 1;
 	/* XXX - what if this fails? */
-	(void)write(handlep->poll_breakloop_fd, &value, sizeof(value));
+	if (handlep->poll_breakloop_fd != -1)
+		(void)write(handlep->poll_breakloop_fd, &value, sizeof(value));
+}
+
+/*
+ * Set the offset at which to insert VLAN tags.
+ * That should be the offset of the type field.
+ */
+static void
+set_vlan_offset(pcap_t *handle)
+{
+	struct pcap_linux *handlep = handle->priv;
+
+	switch (handle->linktype) {
+
+	case DLT_EN10MB:
+		/*
+		 * The type field is after the destination and source
+		 * MAC address.
+		 */
+		handlep->vlan_offset = 2 * ETH_ALEN;
+		break;
+
+	case DLT_LINUX_SLL:
+		/*
+		 * The type field is in the last 2 bytes of the
+		 * DLT_LINUX_SLL header.
+		 */
+		handlep->vlan_offset = SLL_HDR_LEN - 2;
+		break;
+
+	default:
+		handlep->vlan_offset = -1; /* unknown */
+		break;
+	}
 }
 
 /*
@@ -980,6 +1014,11 @@
 	 * we'll be copying it, that won't fit.
 	 */
 	if (strlen(device) >= sizeof(ifr.ifr_name)) {
+		/*
+		 * There's nothing more to say, so clear the error
+		 * message.
+		 */
+		handle->errbuf[0] = '\0';
 		status = PCAP_ERROR_NO_SUCH_DEVICE;
 		goto fail;
 	}
@@ -1035,7 +1074,7 @@
 	 * If the "any" device is specified, try to open a SOCK_DGRAM.
 	 * Otherwise, open a SOCK_RAW.
 	 */
-	ret = activate_pf_packet(handle, is_any_device);
+	ret = setup_socket(handle, is_any_device);
 	if (ret < 0) {
 		/*
 		 * Fatal error; the return value is the error code,
@@ -1111,6 +1150,13 @@
 pcap_set_datalink_linux(pcap_t *handle, int dlt)
 {
 	handle->linktype = dlt;
+
+	/*
+	 * Update the offset at which to insert VLAN tags for the
+	 * new link-layer type.
+	 */
+	set_vlan_offset(handle);
+
 	return 0;
 }
 
@@ -1144,9 +1190,12 @@
 		 * easily distinguish packets looped back by the CAN
 		 * layer than those received by the CAN layer, so we
 		 * eliminate this packet instead.
+		 *
+		 * We check whether this is a CAN or CAN FD frame
+		 * by checking whether the device's hardware type
+		 * is ARPHRD_CAN.
 		 */
-		if ((sll->sll_protocol == LINUX_SLL_P_CAN ||
-		     sll->sll_protocol == LINUX_SLL_P_CANFD) &&
+		if (sll->sll_hatype == ARPHRD_CAN &&
 		     handle->direction != PCAP_D_OUT)
 			return 0;
 
@@ -1440,7 +1489,7 @@
 	 * capture on them, "why do no interfaces show up?" - when the
 	 * real problem is a permissions problem.  Error reports of that
 	 * type require a lot more back-and-forth to debug, as evidenced
-	 * by many Wireshark bugs/mailing list questions/Q&A questoins.)
+	 * by many Wireshark bugs/mailing list questions/Q&A questions.)
 	 *
 	 * So:
 	 *
@@ -1612,8 +1661,8 @@
 				}
 			}
 			fclose(fh);
-			free(pathstr);
 		}
+		free(pathstr);
 	}
 
 #ifdef ETHTOOL_GLINK
@@ -1815,7 +1864,7 @@
 		 * XXX - are there any other sorts of "fake Ethernet" that
 		 * have ARPHRD_ETHER but that shouldn't offer DLT_DOCSIS as
 		 * a Cisco CMTS won't put traffic onto it or get traffic
-		 * bridged onto it?  ISDN is handled in "activate_pf_packet()",
+		 * bridged onto it?  ISDN is handled in "setup_socket()",
 		 * as we fall back on cooked mode there, and we use
 		 * is_wifi() to check for 802.11 devices; are there any
 		 * others?
@@ -1882,14 +1931,7 @@
 #define ARPHRD_CAN 280
 #endif
 	case ARPHRD_CAN:
-		/*
-		 * Map this to DLT_LINUX_SLL; that way, CAN frames will
-		 * have ETH_P_CAN/LINUX_SLL_P_CAN as the protocol and
-		 * CAN FD frames will have ETH_P_CANFD/LINUX_SLL_P_CANFD
-		 * as the protocol, so they can be distinguished by the
-		 * protocol in the SLL header.
-		 */
-		handle->linktype = DLT_LINUX_SLL;
+		handle->linktype = DLT_CAN_SOCKETCAN;
 		break;
 
 #ifndef ARPHRD_IEEE802_TR
@@ -2171,7 +2213,7 @@
 		/* We need to save packet direction for IrDA decoding,
 		 * so let's use "Linux-cooked" mode. Jean II
 		 *
-		 * XXX - this is handled in activate_pf_packet(). */
+		 * XXX - this is handled in setup_socket(). */
 		/* handlep->cooked = 1; */
 		break;
 
@@ -2213,7 +2255,7 @@
 		 * pick up the netlink protocol type such as NETLINK_ROUTE,
 		 * NETLINK_GENERIC, NETLINK_FIB_LOOKUP, etc.
 		 *
-		 * XXX - this is handled in activate_pf_packet().
+		 * XXX - this is handled in setup_socket().
 		 */
 		/* handlep->cooked = 1; */
 		break;
@@ -2231,59 +2273,36 @@
 	}
 }
 
-#ifdef PACKET_RESERVE
 static void
-set_dlt_list_cooked(pcap_t *handle, int sock_fd)
+set_dlt_list_cooked(pcap_t *handle)
 {
-	socklen_t		len;
-	unsigned int		tp_reserve;
+	/*
+	 * Support both DLT_LINUX_SLL and DLT_LINUX_SLL2.
+	 */
+	handle->dlt_list = (u_int *) malloc(sizeof(u_int) * 2);
 
 	/*
-	 * If we can't do PACKET_RESERVE, we can't reserve extra space
-	 * for a DLL_LINUX_SLL2 header, so we can't support DLT_LINUX_SLL2.
+	 * If that failed, just leave the list empty.
 	 */
-	len = sizeof(tp_reserve);
-	if (getsockopt(sock_fd, SOL_PACKET, PACKET_RESERVE, &tp_reserve,
-	    &len) == 0) {
-		/*
-		 * Yes, we can do DLL_LINUX_SLL2.
-		 */
-		handle->dlt_list = (u_int *) malloc(sizeof(u_int) * 2);
-		/*
-		 * If that fails, just leave the list empty.
-		 */
-		if (handle->dlt_list != NULL) {
-			handle->dlt_list[0] = DLT_LINUX_SLL;
-			handle->dlt_list[1] = DLT_LINUX_SLL2;
-			handle->dlt_count = 2;
-		}
+	if (handle->dlt_list != NULL) {
+		handle->dlt_list[0] = DLT_LINUX_SLL;
+		handle->dlt_list[1] = DLT_LINUX_SLL2;
+		handle->dlt_count = 2;
 	}
 }
-#else/* PACKET_RESERVE */
-/*
- * The build environment doesn't define PACKET_RESERVE, so we can't reserve
- * extra space for a DLL_LINUX_SLL2 header, so we can't support DLT_LINUX_SLL2.
- */
-static void
-set_dlt_list_cooked(pcap_t *handle _U_, int sock_fd _U_)
-{
-}
-#endif /* PACKET_RESERVE */
 
 /*
  * Try to set up a PF_PACKET socket.
  * Returns 0 on success and a PCAP_ERROR_ value on failure.
  */
 static int
-activate_pf_packet(pcap_t *handle, int is_any_device)
+setup_socket(pcap_t *handle, int is_any_device)
 {
 	struct pcap_linux *handlep = handle->priv;
 	const char		*device = handle->opt.device;
 	int			status = 0;
 	int			sock_fd, arptype;
-#ifdef HAVE_PACKET_AUXDATA
 	int			val;
-#endif
 	int			err = 0;
 	struct packet_mreq	mr;
 #if defined(SO_BPF_EXTENSIONS) && defined(SKF_AD_VLAN_TAG_PRESENT)
@@ -2312,6 +2331,8 @@
 			 * socket.
 			 */
 			status = PCAP_ERROR_PERM_DENIED;
+			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+			    "Attempt to create packet socket failed - CAP_NET_RAW may be required");
 		} else {
 			/*
 			 * Other error.
@@ -2439,7 +2460,7 @@
 				free(handle->dlt_list);
 				handle->dlt_list = NULL;
 				handle->dlt_count = 0;
-				set_dlt_list_cooked(handle, sock_fd);
+				set_dlt_list_cooked(handle);
 			}
 
 			if (handle->linktype == -1) {
@@ -2505,7 +2526,7 @@
 		handle->linktype = DLT_LINUX_SLL;
 		handle->dlt_list = NULL;
 		handle->dlt_count = 0;
-		set_dlt_list_cooked(handle, sock_fd);
+		set_dlt_list_cooked(handle);
 
 		/*
 		 * We're not bound to a device.
@@ -2552,9 +2573,15 @@
 		}
 	}
 
-	/* Enable auxiliary data if supported and reserve room for
-	 * reconstructing VLAN headers. */
-#ifdef HAVE_PACKET_AUXDATA
+	/*
+	 * Enable auxiliary data and reserve room for reconstructing
+	 * VLAN headers.
+	 *
+	 * XXX - is enabling auxiliary data necessary, now that we
+	 * only support memory-mapped capture?  The kernel's memory-mapped
+	 * capture code doesn't seem to check whether auxiliary data
+	 * is enabled, it seems to provide it whether it is or not.
+	 */
 	val = 1;
 	if (setsockopt(sock_fd, SOL_PACKET, PACKET_AUXDATA, &val,
 		       sizeof(val)) == -1 && errno != ENOPROTOOPT) {
@@ -2564,7 +2591,6 @@
 		return PCAP_ERROR;
 	}
 	handle->offset += VLAN_TAG_LEN;
-#endif /* HAVE_PACKET_AUXDATA */
 
 	/*
 	 * If we're in cooked mode, make the snapshot length
@@ -2584,30 +2610,8 @@
 
 	/*
 	 * Set the offset at which to insert VLAN tags.
-	 * That should be the offset of the type field.
 	 */
-	switch (handle->linktype) {
-
-	case DLT_EN10MB:
-		/*
-		 * The type field is after the destination and source
-		 * MAC address.
-		 */
-		handlep->vlan_offset = 2 * ETH_ALEN;
-		break;
-
-	case DLT_LINUX_SLL:
-		/*
-		 * The type field is in the last 2 bytes of the
-		 * DLT_LINUX_SLL header.
-		 */
-		handlep->vlan_offset = SLL_HDR_LEN - 2;
-		break;
-
-	default:
-		handlep->vlan_offset = -1; /* unknown */
-		break;
-	}
+	set_vlan_offset(handle);
 
 	if (handle->opt.tstamp_precision == PCAP_TSTAMP_PRECISION_NANO) {
 		int nsec_tstamps = 1;
@@ -2678,6 +2682,7 @@
 	ret = prepare_tpacket_socket(handle);
 	if (ret == -1) {
 		free(handlep->oneshot_buffer);
+		handlep->oneshot_buffer = NULL;
 		*status = PCAP_ERROR;
 		return ret;
 	}
@@ -2688,6 +2693,7 @@
 		 * fail.  create_ring() has set *status.
 		 */
 		free(handlep->oneshot_buffer);
+		handlep->oneshot_buffer = NULL;
 		return -1;
 	}
 
@@ -2889,40 +2895,30 @@
 	tp_reserve = VLAN_TAG_LEN;
 
 	/*
-	 * If we're using DLT_LINUX_SLL2, reserve space for a
-	 * DLT_LINUX_SLL2 header.
+	 * If we're capturing in cooked mode, reserve space for
+	 * a DLT_LINUX_SLL2 header; we don't know yet whether
+	 * we'll be using DLT_LINUX_SLL or DLT_LINUX_SLL2, as
+	 * that can be changed on an open device, so we reserve
+	 * space for the larger of the two.
 	 *
 	 * XXX - we assume that the kernel is still adding
-	 * 16 bytes of extra space; that happens to
-	 * correspond to SLL_HDR_LEN (whether intentionally
-	 * or not - the kernel code has a raw "16" in
-	 * the expression), so we subtract SLL_HDR_LEN
-	 * from SLL2_HDR_LEN to get the additional space
-	 * needed.  That also means we don't bother reserving
-	 * any additional space if we're using DLT_LINUX_SLL.
+	 * 16 bytes of extra space, so we subtract 16 from
+	 * SLL2_HDR_LEN to get the additional space needed.
+	 * (Are they doing that for DLT_LINUX_SLL, the link-
+	 * layer header for which is 16 bytes?)
 	 *
-	 * XXX - should we use TPACKET_ALIGN(SLL2_HDR_LEN - SLL_HDR_LEN)?
+	 * XXX - should we use TPACKET_ALIGN(SLL2_HDR_LEN - 16)?
 	 */
-	if (handle->linktype == DLT_LINUX_SLL2)
-		tp_reserve += SLL2_HDR_LEN - SLL_HDR_LEN;
+	if (handlep->cooked)
+		tp_reserve += SLL2_HDR_LEN - 16;
 
 	/*
 	 * Try to request that amount of reserve space.
 	 * This must be done before creating the ring buffer.
-	 * If PACKET_RESERVE is supported, creating the ring
-	 * buffer should be, although if creating the ring
-	 * buffer fails, the PACKET_RESERVE call has no effect,
-	 * so falling back on read-from-the-socket capturing
-	 * won't be affected.
 	 */
 	len = sizeof(tp_reserve);
 	if (setsockopt(handle->fd, SOL_PACKET, PACKET_RESERVE,
 	    &tp_reserve, len) < 0) {
-		/*
-		 * We treat ENOPROTOOPT as an error, as we
-		 * already determined that we support
-		 * TPACKET_V2 and later; see above.
-		 */
 		pcap_fmt_errmsg_for_errno(handle->errbuf,
 		    PCAP_ERRBUF_SIZE, errno,
 		    "setsockopt (PACKET_RESERVE)");
@@ -3118,6 +3114,9 @@
 		pcap_strlcpy(ifr.ifr_name, handle->opt.device, sizeof(ifr.ifr_name));
 		ifr.ifr_data = (void *)&hwconfig;
 
+		/*
+		 * This may require CAP_NET_ADMIN.
+		 */
 		if (ioctl(handle->fd, SIOCSHWTSTAMP, &ifr) < 0) {
 			switch (errno) {
 
@@ -3130,6 +3129,8 @@
 				 * try requesting hardware time stamps.
 				 */
 				*status = PCAP_ERROR_PERM_DENIED;
+				snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+				    "Attempt to set hardware timestamp failed - CAP_NET_ADMIN may be required");
 				return -1;
 
 			case EOPNOTSUPP:
@@ -3378,7 +3379,23 @@
 			 */
 			handlep->timeout = ~handlep->timeout;
 		}
+		if (handlep->poll_breakloop_fd != -1) {
+			/* Close the eventfd; we do not need it in nonblock mode. */
+			close(handlep->poll_breakloop_fd);
+			handlep->poll_breakloop_fd = -1;
+		}
 	} else {
+		if (handlep->poll_breakloop_fd == -1) {
+			/* If we did not have an eventfd, open one now that we are blocking. */
+			if ( ( handlep->poll_breakloop_fd = eventfd(0, EFD_NONBLOCK) ) == -1 ) {
+				int save_errno = errno;
+				snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+						"Could not open eventfd: %s",
+						strerror(errno));
+				errno = save_errno;
+				return -1;
+			}
+		}
 		if (handlep->timeout < 0) {
 			handlep->timeout = ~handlep->timeout;
 		}
@@ -3422,10 +3439,24 @@
 	struct ifreq ifr;
 	int ret;
 	struct pollfd pollinfo[2];
+	int numpollinfo;
 	pollinfo[0].fd = handle->fd;
 	pollinfo[0].events = POLLIN;
-	pollinfo[1].fd = handlep->poll_breakloop_fd;
-	pollinfo[1].events = POLLIN;
+	if ( handlep->poll_breakloop_fd == -1 ) {
+		numpollinfo = 1;
+		pollinfo[1].revents = 0;
+		/*
+		 * We set pollinfo[1].revents to zero, even though
+		 * numpollinfo = 1 meaning that poll() doesn't see
+		 * pollinfo[1], so that we do not have to add a
+		 * conditional of numpollinfo > 1 below when we
+		 * test pollinfo[1].revents.
+		 */
+	} else {
+		pollinfo[1].fd = handlep->poll_breakloop_fd;
+		pollinfo[1].events = POLLIN;
+		numpollinfo = 2;
+	}
 
 	/*
 	 * Keep polling until we either get some packets to read, see
@@ -3490,7 +3521,7 @@
 			if (timeout != 0)
 				timeout = 1;
 		}
-		ret = poll(pollinfo, 2, timeout);
+		ret = poll(pollinfo, numpollinfo, timeout);
 		if (ret < 0) {
 			/*
 			 * Error.  If it's not EINTR, report it.
@@ -3772,6 +3803,7 @@
 	unsigned char *bp;
 	struct sockaddr_ll *sll;
 	struct pcap_pkthdr pcaphdr;
+	pcap_can_socketcan_hdr *canhdr;
 	unsigned int snaplen = tp_snaplen;
 	struct utsname utsname;
 
@@ -3890,6 +3922,68 @@
 
 			snaplen += sizeof(struct sll_header);
 		}
+	} else {
+		/*
+		 * If this is a packet from a CAN device, so that
+		 * sll->sll_hatype is ARPHRD_CAN, then, as we're
+		 * not capturing in cooked mode, its link-layer
+		 * type is DLT_CAN_SOCKETCAN.  Fix up the header
+		 * provided by the code below us to match what
+		 * DLT_CAN_SOCKETCAN is expected to provide.
+		 */
+		if (sll->sll_hatype == ARPHRD_CAN) {
+			/*
+			 * DLT_CAN_SOCKETCAN is specified as having the
+			 * CAN ID and flags in network byte order, but
+			 * capturing on a CAN device provides it in host
+			 * byte order.  Convert it to network byte order.
+			 */
+			canhdr = (pcap_can_socketcan_hdr *)bp;
+			canhdr->can_id = htonl(canhdr->can_id);
+
+			/*
+			 * In addition, set the CANFD_FDF flag if
+			 * the protocol is LINUX_SLL_P_CANFD, as
+			 * the protocol field itself isn't in
+			 * the packet to indicate that it's a
+			 * CAN FD packet.
+			 */
+			uint16_t protocol = ntohs(sll->sll_protocol);
+			if (protocol == LINUX_SLL_P_CANFD) {
+				canhdr->fd_flags |= CANFD_FDF;
+
+				/*
+				 * Zero out all the unknown bits in
+				 * fd_flags and clear the reserved
+				 * fields, so that a program reading
+				 * this can assume that CANFD_FDF
+				 * is set because we set it, not
+				 * because some uninitialized crap
+				 * was provided in the fd_flags
+				 * field.
+				 *
+				 * (At least some LINKTYPE_CAN_SOCKETCAN
+				 * files attached to Wireshark bugs
+				 * had uninitialized junk there, so it
+				 * does happen.)
+				 *
+				 * Update this if Linux adds more flag
+				 * bits to the fd_flags field or uses
+				 * either of the reserved fields for
+				 * FD frames.
+				 */
+				canhdr->fd_flags &= ~(CANFD_FDF|CANFD_ESI|CANFD_BRS);
+				canhdr->reserved1 = 0;
+				canhdr->reserved2 = 0;
+			} else {
+				/*
+				 * Clear CANFD_FDF if it's set (probably
+				 * again meaning that this field is
+				 * uninitialized junk).
+				 */
+				canhdr->fd_flags &= ~CANFD_FDF;
+			}
+		}
 	}
 
 	if (handlep->filter_in_userland && handle->fcode.bf_insns) {
@@ -4002,9 +4096,22 @@
 		}
 	}
 
-	/* non-positive values of max_packets are used to require all
-	 * packets currently available in the ring */
-	while ((pkts < max_packets) || PACKET_COUNT_IS_UNLIMITED(max_packets)) {
+	/*
+	 * This can conceivably process more than INT_MAX packets,
+	 * which would overflow the packet count, causing it either
+	 * to look like a negative number, and thus cause us to
+	 * return a value that looks like an error, or overflow
+	 * back into positive territory, and thus cause us to
+	 * return a too-low count.
+	 *
+	 * Therefore, if the packet count is unlimited, we clip
+	 * it at INT_MAX; this routine is not expected to
+	 * process packets indefinitely, so that's not an issue.
+	 */
+	if (PACKET_COUNT_IS_UNLIMITED(max_packets))
+		max_packets = INT_MAX;
+
+	while (pkts < max_packets) {
 		/*
 		 * Get the current ring buffer frame, and break if
 		 * it's still owned by the kernel.
@@ -4097,9 +4204,22 @@
 		return pkts;
 	}
 
-	/* non-positive values of max_packets are used to require all
-	 * packets currently available in the ring */
-	while ((pkts < max_packets) || PACKET_COUNT_IS_UNLIMITED(max_packets)) {
+	/*
+	 * This can conceivably process more than INT_MAX packets,
+	 * which would overflow the packet count, causing it either
+	 * to look like a negative number, and thus cause us to
+	 * return a value that looks like an error, or overflow
+	 * back into positive territory, and thus cause us to
+	 * return a too-low count.
+	 *
+	 * Therefore, if the packet count is unlimited, we clip
+	 * it at INT_MAX; this routine is not expected to
+	 * process packets indefinitely, so that's not an issue.
+	 */
+	if (PACKET_COUNT_IS_UNLIMITED(max_packets))
+		max_packets = INT_MAX;
+
+	while (pkts < max_packets) {
 		int packets_to_read;
 
 		if (handlep->current_packet == NULL) {
@@ -4112,12 +4232,12 @@
 		}
 		packets_to_read = handlep->packets_left;
 
-		if (!PACKET_COUNT_IS_UNLIMITED(max_packets) &&
-		    packets_to_read > (max_packets - pkts)) {
+		if (packets_to_read > (max_packets - pkts)) {
 			/*
-			 * We've been given a maximum number of packets
-			 * to process, and there are more packets in
-			 * this buffer than that.  Only process enough
+			 * There are more packets in the buffer than
+			 * the number of packets we have left to
+			 * process to get up to the maximum number
+			 * of packets to process.  Only process enough
 			 * of them to get us up to that maximum.
 			 */
 			packets_to_read = max_packets - pkts;
@@ -4322,7 +4442,18 @@
 			 * the filter for a reason other than "this kernel
 			 * isn't configured to support socket filters.
 			 */
-			if (errno != ENOPROTOOPT && errno != EOPNOTSUPP) {
+			if (errno == ENOMEM) {
+				/*
+				 * Either a kernel memory allocation
+				 * failure occurred, or there's too
+				 * much "other/option memory" allocated
+				 * for this socket.  Suggest that they
+				 * increase the "other/option memory"
+				 * limit.
+				 */
+				fprintf(stderr,
+				    "Warning: Couldn't allocate kernel memory for filter: try increasing net.core.optmem_max with sysctl\n");
+			} else if (errno != ENOPROTOOPT && errno != EOPNOTSUPP) {
 				fprintf(stderr,
 				    "Warning: Kernel filter failed: %s\n",
 					pcap_strerror(errno));
@@ -4465,12 +4596,18 @@
 			 */
 			return PCAP_ERROR_IFACE_NOT_UP;
 		}
-		if (errno == ENODEV)
+		if (errno == ENODEV) {
+			/*
+			 * There's nothing more to say, so clear the
+			 * error message.
+			 */
+			ebuf[0] = '\0';
 			ret = PCAP_ERROR_NO_SUCH_DEVICE;
-		else
+		} else {
 			ret = PCAP_ERROR;
-		pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
-		    errno, "bind");
+			pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
+			    errno, "bind");
+		}
 		return ret;
 	}
 
@@ -4681,12 +4818,12 @@
 	return 0;
 }
 
-#ifdef ETHTOOL_GET_TS_INFO
 /*
- * Get a list of time stamping capabilities.
+ * Get a list of time stamp types.
  */
+#ifdef ETHTOOL_GET_TS_INFO
 static int
-iface_ethtool_get_ts_info(const char *device, pcap_t *handle, char *ebuf)
+iface_get_ts_types(const char *device, pcap_t *handle, char *ebuf)
 {
 	int fd;
 	struct ifreq ifr;
@@ -4773,6 +4910,8 @@
 		 * report HWTSTAMP_FILTER_ALL but map it to only
 		 * time stamping a few PTP packets.  See
 		 * http://marc.info/?l=linux-netdev&m=146318183529571&w=2
+		 *
+		 * Maybe that got fixed later.
 		 */
 		handle->tstamp_type_list = NULL;
 		return 0;
@@ -4804,7 +4943,7 @@
 }
 #else /* ETHTOOL_GET_TS_INFO */
 static int
-iface_ethtool_get_ts_info(const char *device, pcap_t *handle, char *ebuf)
+iface_get_ts_types(const char *device, pcap_t *handle, char *ebuf)
 {
 	/*
 	 * This doesn't apply to the "any" device; you can't say "turn on
@@ -4827,7 +4966,15 @@
 	return 0;
 }
 #endif /* ETHTOOL_GET_TS_INFO */
-
+#else  /* defined(HAVE_LINUX_NET_TSTAMP_H) && defined(PACKET_TIMESTAMP) */
+static int
+iface_get_ts_types(const char *device _U_, pcap_t *p _U_, char *ebuf _U_)
+{
+	/*
+	 * Nothing to fetch, so it always "succeeds".
+	 */
+	return 0;
+}
 #endif /* defined(HAVE_LINUX_NET_TSTAMP_H) && defined(PACKET_TIMESTAMP) */
 
 /*
@@ -5093,12 +5240,17 @@
 		if (errno == ENODEV) {
 			/*
 			 * No such device.
+			 *
+			 * There's nothing more to say, so clear
+			 * the error message.
 			 */
 			ret = PCAP_ERROR_NO_SUCH_DEVICE;
-		} else
+			ebuf[0] = '\0';
+		} else {
 			ret = PCAP_ERROR;
-		pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
-		    errno, "SIOCGIFHWADDR");
+			pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
+			    errno, "SIOCGIFHWADDR");
+		}
 		return ret;
 	}
 
diff --git a/pcap-netfilter-linux.c b/pcap-netfilter-linux.c
index 17f528f..33204a5 100644
--- a/pcap-netfilter-linux.c
+++ b/pcap-netfilter-linux.c
@@ -33,6 +33,7 @@
 #endif
 
 #include "pcap-int.h"
+#include "diag-control.h"
 
 #ifdef NEED_STRERROR_H
 #include "strerror.h"
@@ -135,6 +136,13 @@
 		bp = (unsigned char *)handle->buffer;
 	} else
 		bp = handle->bp;
+
+	/*
+	 * Loop through each message.
+	 *
+	 * This assumes that a single buffer of message will have
+	 * <= INT_MAX packets, so the message count doesn't overflow.
+	 */
 	ep = bp + len;
 	while (bp < ep) {
 		const struct nlmsghdr *nlh = (const struct nlmsghdr *) bp;
@@ -343,7 +351,9 @@
 	static unsigned int seq_id;
 
 	if (!seq_id)
+DIAG_OFF_NARROWING
 		seq_id = time(NULL);
+DIAG_ON_NARROWING
 	++seq_id;
 
 	nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nfgenmsg));
diff --git a/pcap-new.c b/pcap-new.c
index 7c00659..76388a9 100644
--- a/pcap-new.c
+++ b/pcap-new.c
@@ -36,6 +36,7 @@
 #endif
 
 #include "ftmacros.h"
+#include "diag-control.h"
 
 /*
  * sockutils.h may include <crtdbg.h> on Windows, and pcap-int.h will
@@ -237,7 +238,10 @@
 
 		if (filedata == NULL)
 		{
+			DIAG_OFF_FORMAT_TRUNCATION
 			snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' exist?", path);
+			DIAG_ON_FORMAT_TRUNCATION
+			closedir(unixdir);
 			return -1;
 		}
 #endif
@@ -253,7 +257,9 @@
 #else
 			if (pathlen + strlen(filedata->d_name) >= sizeof(filename))
 				continue;
+			DIAG_OFF_FORMAT_TRUNCATION
 			snprintf(filename, sizeof(filename), "%s%s", path, filedata->d_name);
+			DIAG_ON_FORMAT_TRUNCATION
 #endif
 
 			fp = pcap_open_offline(filename, errbuf);
@@ -268,6 +274,11 @@
 					    PCAP_ERRBUF_SIZE, errno,
 					    "malloc() failed");
 					pcap_freealldevs(*alldevs);
+#ifdef _WIN32
+					FindClose(filehandle);
+#else
+					closedir(unixdir);
+#endif
 					return -1;
 				}
 
@@ -297,6 +308,11 @@
 				if (pcap_createsrcstr(tmpstring, PCAP_SRC_FILE, NULL, NULL, filename, errbuf) == -1)
 				{
 					pcap_freealldevs(*alldevs);
+#ifdef _WIN32
+					FindClose(filehandle);
+#else
+					closedir(unixdir);
+#endif
 					return -1;
 				}
 
@@ -307,6 +323,11 @@
 					    PCAP_ERRBUF_SIZE, errno,
 					    "malloc() failed");
 					pcap_freealldevs(*alldevs);
+#ifdef _WIN32
+					FindClose(filehandle);
+#else
+					closedir(unixdir);
+#endif
 					return -1;
 				}
 
@@ -321,6 +342,11 @@
 					    PCAP_ERRBUF_SIZE, errno,
 					    "malloc() failed");
 					pcap_freealldevs(*alldevs);
+#ifdef _WIN32
+					FindClose(filehandle);
+#else
+					closedir(unixdir);
+#endif
 					return -1;
 				}
 
@@ -334,9 +360,11 @@
 #endif
 
 
-#ifdef _WIN32
 		/* Close the search handle. */
+#ifdef _WIN32
 		FindClose(filehandle);
+#else
+		closedir(unixdir);
 #endif
 
 		return 0;
@@ -444,6 +472,7 @@
 	return fp;
 
 fail:
+	DIAG_OFF_FORMAT_TRUNCATION
 	if (status == PCAP_ERROR)
 		snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
 		    name, fp->errbuf);
@@ -455,6 +484,7 @@
 	else
 		snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
 		    name, pcap_statustostr(status));
+	DIAG_ON_FORMAT_TRUNCATION
 	pcap_close(fp);
 	return NULL;
 }
diff --git a/pcap-nit.c b/pcap-nit.c
index cfd9519..6f4f8dd 100644
--- a/pcap-nit.c
+++ b/pcap-nit.c
@@ -125,6 +125,9 @@
 	 * Loop through each packet.  The increment expression
 	 * rounds up to the next int boundary past the end of
 	 * the previous packet.
+	 *
+	 * This assumes that a single buffer of packets will have
+	 * <= INT_MAX packets, so the packet count doesn't overflow.
 	 */
 	n = 0;
 	ep = bp + cc;
diff --git a/pcap-npf.c b/pcap-npf.c
index 52aee78..62c526d 100644
--- a/pcap-npf.c
+++ b/pcap-npf.c
@@ -36,6 +36,7 @@
 #endif
 
 #include <errno.h>
+#include <limits.h> /* for INT_MAX */
 #define PCAP_DONT_INCLUDE_PCAP_BPF_H
 #include <Packet32.h>
 #include <pcap-int.h>
@@ -445,6 +446,31 @@
 	return (0);
 }
 
+#ifdef HAVE_NPCAP_PACKET_API
+/*
+ * Kernel dump mode isn't supported in Npcap; calls to PacketSetDumpName(),
+ * PacketSetDumpLimits(), and PacketIsDumpEnded() will get compile-time
+ * deprecation warnings.
+ *
+ * Avoid calling them; just return errors indicating that kernel dump
+ * mode isn't supported in Npcap.
+ */
+static int
+pcap_live_dump_npf(pcap_t *p, char *filename _U_, int maxsize _U_,
+    int maxpacks _U_)
+{
+	snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+	    "Npcap doesn't support kernel dump mode");
+	return (-1);
+}
+static int
+pcap_live_dump_ended_npf(pcap_t *p, int sync)
+{
+	snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+	    "Npcap doesn't support kernel dump mode");
+	return (-1);
+}
+#else /* HAVE_NPCAP_PACKET_API */
 static int
 pcap_live_dump_npf(pcap_t *p, char *filename, int maxsize, int maxpacks)
 {
@@ -485,6 +511,7 @@
 
 	return (PacketIsDumpEnded(pw->adapter, (BOOLEAN)sync));
 }
+#endif /* HAVE_NPCAP_PACKET_API */
 
 #ifdef HAVE_AIRPCAP_API
 static PAirpcapHandle
@@ -607,6 +634,9 @@
 
 	/*
 	 * Loop through each packet.
+	 *
+	 * This assumes that a single buffer of packets will have
+	 * <= INT_MAX packets, so the packet count doesn't overflow.
 	 */
 #define bhp ((struct bpf_hdr *)bp)
 	n = 0;
@@ -767,6 +797,21 @@
 	endofbuf = (char*)header + cc;
 
 	/*
+	 * This can conceivably process more than INT_MAX packets,
+	 * which would overflow the packet count, causing it either
+	 * to look like a negative number, and thus cause us to
+	 * return a value that looks like an error, or overflow
+	 * back into positive territory, and thus cause us to
+	 * return a too-low count.
+	 *
+	 * Therefore, if the packet count is unlimited, we clip
+	 * it at INT_MAX; this routine is not expected to
+	 * process packets indefinitely, so that's not an issue.
+	 */
+	if (PACKET_COUNT_IS_UNLIMITED(cnt))
+		cnt = INT_MAX;
+
+	/*
 	 * Cycle through the packets
 	 */
 	do
@@ -856,7 +901,7 @@
 			}
 		}
 
-		/* No underlaying filtering system. We need to filter on our own */
+		/* No underlying filtering system. We need to filter on our own */
 		if (p->fcode.bf_insns)
 		{
 			if (pcap_filter(p->fcode.bf_insns, dp, packet_len, caplen) == 0)
@@ -867,7 +912,7 @@
 			}
 		}
 
-		/* Fill the header for the user suppplied callback function */
+		/* Fill the header for the user supplied callback function */
 		pcap_header.caplen = caplen;
 		pcap_header.len = packet_len;
 
@@ -940,8 +985,6 @@
 }
 
 /*
- * Vendor-specific error codes.
- *
  * These are NTSTATUS values:
  *
  *    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781
@@ -950,15 +993,28 @@
  * mapped to Windows error values in userland; they're returned by
  * GetLastError().
  *
- * Attempting to set non-promiscuous mode on a Microsoft Surface Pro's
- * Mobile Broadband Adapter returns an error; that error can safely be
- * ignored, as it's always in non-promiscuous mode.
+ * Note that "driver" here includes the Npcap NPF driver, as various
+ * versions would take NT status values and set the "Customer" bit
+ * before returning the status code.  The commit message for the
+ * change that started doing that is
+ *
+ *    Returned a customer-defined NTSTATUS in OID requests to avoid
+ *    NTSTATUS-to-Win32 Error code translation.
+ *
+ * but I don't know why the goal was to avoid that translation.
+ *
+ * Attempting to set the hardware filter on a Microsoft Surface Pro's
+ * Mobile Broadband Adapter returns an error that appears to be
+ * NDIS_STATUS_NOT_SUPPORTED ORed with the "Customer" bit, so it's
+ * probably indicating that it doesn't support that.
  *
  * It is likely that there are other devices which throw spurious errors,
  * at which point this will need refactoring to efficiently check against
- * a list, but for now we can just check this one value.
+ * a list, but for now we can just check this one value.  Perhaps the
+ * right way to do this is compare against various NDIS errors with
+ * the "customer" bit ORed in.
  */
-#define NPF_SURFACE_MOBILE_NONPROMISC	0xe00000bb
+#define NT_STATUS_CUSTOMER_DEFINED	0x20000000
 
 static int
 pcap_activate_npf(pcap_t *p)
@@ -1017,14 +1073,22 @@
 		case ERROR_BAD_UNIT:
 			/*
 			 * There's no such device.
+			 * There's nothing to add, so clear the error
+			 * message.
 			 */
+			p->errbuf[0] = '\0';
 			return (PCAP_ERROR_NO_SUCH_DEVICE);
 
 		case ERROR_ACCESS_DENIED:
 			/*
 			 * There is, but we don't have permission to
 			 * use it.
+			 *
+			 * XXX - we currently get ERROR_BAD_UNIT if the
+			 * user says "no" to the UAC prompt.
 			 */
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "The helper program for \"Admin-only Mode\" must be allowed to make changes to your device");
 			return (PCAP_ERROR_PERM_DENIED);
 
 		default:
@@ -1052,10 +1116,9 @@
 	/*Set the linktype*/
 	switch (type.LinkType)
 	{
-	case NdisMediumWan:
-		p->linktype = DLT_EN10MB;
-		break;
-
+	/*
+	 * NDIS-defined medium types.
+	 */
 	case NdisMedium802_3:
 		p->linktype = DLT_EN10MB;
 		/*
@@ -1079,12 +1142,19 @@
 		}
 		break;
 
+	case NdisMedium802_5:
+		/*
+		 * Token Ring.
+		 */
+		p->linktype = DLT_IEEE802;
+		break;
+
 	case NdisMediumFddi:
 		p->linktype = DLT_FDDI;
 		break;
 
-	case NdisMedium802_5:
-		p->linktype = DLT_IEEE802;
+	case NdisMediumWan:
+		p->linktype = DLT_EN10MB;
 		break;
 
 	case NdisMediumArcnetRaw:
@@ -1099,6 +1169,21 @@
 		p->linktype = DLT_ATM_RFC1483;
 		break;
 
+	case NdisMediumWirelessWan:
+		p->linktype = DLT_RAW;
+		break;
+
+	case NdisMediumIP:
+		p->linktype = DLT_RAW;
+		break;
+
+	/*
+	 * Npcap-defined medium types.
+	 */
+	case NdisMediumNull:
+		p->linktype = DLT_NULL;
+		break;
+
 	case NdisMediumCHDLC:
 		p->linktype = DLT_CHDLC;
 		break;
@@ -1107,10 +1192,6 @@
 		p->linktype = DLT_PPP_SERIAL;
 		break;
 
-	case NdisMediumNull:
-		p->linktype = DLT_NULL;
-		break;
-
 	case NdisMediumBare80211:
 		p->linktype = DLT_IEEE802_11;
 		break;
@@ -1123,10 +1204,6 @@
 		p->linktype = DLT_PPI;
 		break;
 
-	case NdisMediumWirelessWan:
-		p->linktype = DLT_RAW;
-		break;
-
 	default:
 		/*
 		 * An unknown medium type is assumed to supply Ethernet
@@ -1227,7 +1304,13 @@
 
 			/*
 			 * Suppress spurious error generated by non-compiant
-			 * MS Surface mobile adapters.
+			 * MS Surface mobile adapters that appear to
+			 * return NDIS_STATUS_NOT_SUPPORTED for attempts
+			 * to set the hardware filter.
+			 *
+			 * It appears to be reporting NDIS_STATUS_NOT_SUPPORTED,
+			 * but with the NT status value "Customer" bit set;
+			 * the Npcap NPF driver sets that bit in some cases.
 			 *
 			 * If we knew that this meant "promiscuous mode
 			 * isn't supported", we could add a "promiscuous
@@ -1249,8 +1332,17 @@
 			 * and rejecting it with an error could disrupt
 			 * attempts to capture, as many programs (tcpdump,
 			 * *shark) default to promiscuous mode.
+			 *
+			 * Alternatively, we could return the "promiscuous
+			 * mode not supported" *warning* value, so that
+			 * correct code will either ignore it or report
+			 * it and continue capturing.  (This may require
+			 * a pcap_init() flag to request that return
+			 * value, so that old incorrect programs that
+			 * assume a non-zero return from pcap_activate()
+			 * is an error don't break.)
 			 */
-			if (errcode != NPF_SURFACE_MOBILE_NONPROMISC)
+			if (errcode != (NDIS_STATUS_NOT_SUPPORTED|NT_STATUS_CUSTOMER_DEFINED))
 			{
 				pcap_fmt_errmsg_for_win32_err(p->errbuf,
 				    PCAP_ERRBUF_SIZE, errcode,
@@ -1281,7 +1373,7 @@
 			 * Suppress spurious error generated by non-compiant
 			 * MS Surface mobile adapters.
 			 */
-			if (errcode != NPF_SURFACE_MOBILE_NONPROMISC)
+			if (errcode != (NDIS_STATUS_NOT_SUPPORTED|NT_STATUS_CUSTOMER_DEFINED))
 			{
 				pcap_fmt_errmsg_for_win32_err(p->errbuf,
 				    PCAP_ERRBUF_SIZE, errcode,
@@ -1498,40 +1590,84 @@
 	return (PacketIsMonitorModeSupported(p->opt.device) == 1);
 }
 
-pcap_t *
-pcap_create_interface(const char *device _U_, char *ebuf)
-{
-	pcap_t *p;
+/*
+ * Get a list of time stamp types.
+ */
 #ifdef HAVE_PACKET_GET_TIMESTAMP_MODES
-	char *device_copy;
-	ADAPTER *adapter;
+static int
+get_ts_types(const char *device, pcap_t *p, char *ebuf)
+{
+	char *device_copy = NULL;
+	ADAPTER *adapter = NULL;
 	ULONG num_ts_modes;
 	BOOL ret;
-	DWORD error;
-	ULONG *modes;
-#endif
+	DWORD error = ERROR_SUCCESS;
+	ULONG *modes = NULL;
+	int status = 0;
 
-	p = PCAP_CREATE_COMMON(ebuf, struct pcap_win);
-	if (p == NULL)
-		return (NULL);
+	do {
+		/*
+		 * First, find out how many time stamp modes we have.
+		 * To do that, we have to open the adapter.
+		 *
+		 * XXX - PacketOpenAdapter() takes a non-const pointer
+		 * as an argument, so we make a copy of the argument and
+		 * pass that to it.
+		 */
+		device_copy = strdup(device);
+		if (device_copy == NULL) {
+			pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE, errno, "malloc");
+			status = -1;
+			break;
+		}
 
-	p->activate_op = pcap_activate_npf;
-	p->can_set_rfmon_op = pcap_can_set_rfmon_npf;
+		adapter = PacketOpenAdapter(device_copy);
+		if (adapter == NULL)
+		{
+			error = GetLastError();
+			/*
+			 * If we can't open the device now, we won't be
+			 * able to later, either.
+			 *
+			 * If the error is something that indicates
+			 * that the device doesn't exist, or that they
+			 * don't have permission to open the device - or
+			 * perhaps that they don't have permission to get
+			 * a list of devices, if PacketOpenAdapter() does
+			 * that - the user will find that out when they try
+			 * to activate the device; just return an empty
+			 * list of time stamp types.
+			 *
+			 * Treating either of those as errors will, for
+			 * example, cause "tcpdump -i <number>" to fail,
+			 * because it first tries to pass the interface
+			 * name to pcap_create() and pcap_activate(),
+			 * in order to handle OSes where interfaces can
+			 * have names that are just numbers (stand up
+			 * and say hello, Linux!), and, if pcap_activate()
+			 * fails with a "no such device" error, checks
+			 * whether the interface name is a valid number
+			 * and, if so, tries to use it as an index in
+			 * the list of interfaces.
+			 *
+			 * That means pcap_create() must succeed even
+			 * for interfaces that don't exist, with the
+			 * failure occurring at pcap_activate() time.
+			 */
+			if (error == ERROR_BAD_UNIT ||
+			    error == ERROR_ACCESS_DENIED) {
+				p->tstamp_type_count = 0;
+				p->tstamp_type_list = NULL;
+				status = 0;
+			} else {
+				pcap_fmt_errmsg_for_win32_err(ebuf,
+				    PCAP_ERRBUF_SIZE, error,
+				    "Error opening adapter");
+				status = -1;
+			}
+			break;
+		}
 
-#ifdef HAVE_PACKET_GET_TIMESTAMP_MODES
-	/*
-	 * First, find out how many time stamp modes we have.
-	 * To do that, we have to open the adapter.
-	 *
-	 * XXX - PacketOpenAdapter() takes a non-const pointer
-	 * as an argument, so we make a copy of the argument and
-	 * pass that to it.
-	 */
-	device_copy = strdup(device);
-	adapter = PacketOpenAdapter(device_copy);
-	free(device_copy);
-	if (adapter != NULL)
-	{
 		/*
 		 * Get the total number of time stamp modes.
 		 *
@@ -1564,115 +1700,185 @@
 			error = GetLastError();
 			if (error != ERROR_MORE_DATA) {
 				/*
+				 * No, did it fail with ERROR_INVALID_FUNCTION?
+				 */
+				if (error == ERROR_INVALID_FUNCTION) {
+					/*
+					 * This is probably due to
+					 * the driver with which Packet.dll
+					 * communicates being older, or
+					 * being a WinPcap driver, so
+					 * that it doesn't support
+					 * BIOCGTIMESTAMPMODES.
+					 *
+					 * Tell the user to try uninstalling
+					 * Npcap - and WinPcap if installed -
+					 * and re-installing it, to flush
+					 * out all older drivers.
+					 */
+					snprintf(ebuf, PCAP_ERRBUF_SIZE,
+					    "PacketGetTimestampModes() failed with ERROR_INVALID_FUNCTION; try uninstalling Npcap, and WinPcap if installed, and re-installing it from npcap.com");
+					status = -1;
+					break;
+				}
+
+				/*
 				 * No, some other error.  Fail.
 				 */
 				pcap_fmt_errmsg_for_win32_err(ebuf,
-				    PCAP_ERRBUF_SIZE, GetLastError(),
+				    PCAP_ERRBUF_SIZE, error,
 				    "Error calling PacketGetTimestampModes");
-				pcap_close(p);
-				return (NULL);
-			}
-
-			/*
-			 * Yes, so we now know how many types to fetch.
-			 *
-		    	 * The buffer needs to have one ULONG for the
-		    	 * count and num_ts_modes ULONGs for the
-		    	 * num_ts_modes time stamp types.
-		    	 */
-			modes = (ULONG *)malloc((1 + num_ts_modes) * sizeof(ULONG));
-			if (modes == NULL) {
-				/* Out of memory. */
-				/* XXX SET ebuf */
-				pcap_close(p);
-				return (NULL);
-			}
-			modes[0] = 1 + num_ts_modes;
-			if (!PacketGetTimestampModes(adapter, modes)) {
-				pcap_fmt_errmsg_for_win32_err(ebuf,
-				    PCAP_ERRBUF_SIZE, GetLastError(),
-				    "Error calling PacketGetTimestampModes");
-				free(modes);
-				pcap_close(p);
-				return (NULL);
-			}
-			if (modes[0] != num_ts_modes) {
-				snprintf(ebuf, PCAP_ERRBUF_SIZE,
-				    "First PacketGetTimestampModes() call gives %lu modes, second call gives %lu modes",
-				    num_ts_modes, modes[0]);
-				free(modes);
-				pcap_close(p);
-				return (NULL);
-			}
-			if (num_ts_modes != 0) {
-				u_int num_ts_types;
-
-				/*
-				 * Allocate a buffer big enough for
-				 * PCAP_TSTAMP_HOST (default) plus
-				 * the explicitly specified modes.
-				 */
-				p->tstamp_type_list = malloc((1 + modes[0]) * sizeof(u_int));
-				if (p->tstamp_type_list == NULL) {
-					/* XXX SET ebuf */
-					free(modes);
-					pcap_close(p);
-					return (NULL);
-				}
-				num_ts_types = 0;
-				p->tstamp_type_list[num_ts_types] =
-				    PCAP_TSTAMP_HOST;
-				num_ts_types++;
-				for (ULONG i = 0; i < modes[0]; i++) {
-					switch (modes[i + 1]) {
-
-					case TIMESTAMPMODE_SINGLE_SYNCHRONIZATION:
-						/*
-						 * Better than low-res,
-						 * but *not* synchronized
-						 * with the OS clock.
-						 */
-						p->tstamp_type_list[num_ts_types] =
-						    PCAP_TSTAMP_HOST_HIPREC_UNSYNCED;
-						num_ts_types++;
-						break;
-
-					case TIMESTAMPMODE_QUERYSYSTEMTIME:
-						/*
-						 * Low-res, but synchronized
-						 * with the OS clock.
-						 */
-						p->tstamp_type_list[num_ts_types] =
-						    PCAP_TSTAMP_HOST_LOWPREC;
-						num_ts_types++;
-						break;
-
-					case TIMESTAMPMODE_QUERYSYSTEMTIME_PRECISE:
-						/*
-						 * High-res, and synchronized
-						 * with the OS clock.
-						 */
-						p->tstamp_type_list[num_ts_types] =
-						    PCAP_TSTAMP_HOST_HIPREC;
-						num_ts_types++;
-						break;
-
-					default:
-						/*
-						 * Unknown, so we can't
-						 * report it.
-						 */
-						break;
-					}
-				}
-				p->tstamp_type_count = num_ts_types;
-				free(modes);
+				status = -1;
+				break;
 			}
 		}
+		/* else (ret == TRUE)
+		 * Unexpected success. Let's act like we got ERROR_MORE_DATA.
+		 * If it doesn't work, we'll hit some other error condition farther on.
+		 */
+
+		/* If the driver reports no modes supported *and*
+		 * ERROR_MORE_DATA, something is seriously wrong.
+		 * We *could* ignore the error and continue without supporting
+		 * settable timestamp modes, but that would hide a bug.
+		 */
+		if (num_ts_modes == 0) {
+			snprintf(ebuf, PCAP_ERRBUF_SIZE,
+			    "PacketGetTimestampModes() reports 0 modes supported.");
+			status = -1;
+			break;
+		}
+
+		/*
+		 * Yes, so we now know how many types to fetch.
+		 *
+		 * The buffer needs to have one ULONG for the
+		 * count and num_ts_modes ULONGs for the
+		 * num_ts_modes time stamp types.
+		 */
+		modes = (ULONG *)malloc((1 + num_ts_modes) * sizeof(ULONG));
+		if (modes == NULL) {
+			/* Out of memory. */
+			pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE, errno, "malloc");
+			status = -1;
+			break;
+		}
+		modes[0] = 1 + num_ts_modes;
+		if (!PacketGetTimestampModes(adapter, modes)) {
+			pcap_fmt_errmsg_for_win32_err(ebuf,
+			    PCAP_ERRBUF_SIZE, GetLastError(),
+			    "Error calling PacketGetTimestampModes");
+			status = -1;
+			break;
+		}
+		if (modes[0] != num_ts_modes) {
+			snprintf(ebuf, PCAP_ERRBUF_SIZE,
+			    "First PacketGetTimestampModes() call gives %lu modes, second call gives %lu modes",
+			    num_ts_modes, modes[0]);
+			status = -1;
+			break;
+		}
+
+		/*
+		 * Allocate a buffer big enough for
+		 * PCAP_TSTAMP_HOST (default) plus
+		 * the explicitly specified modes.
+		 */
+		p->tstamp_type_list = malloc((1 + num_ts_modes) * sizeof(u_int));
+		if (p->tstamp_type_list == NULL) {
+			pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE, errno, "malloc");
+			status = -1;
+			break;
+		}
+		u_int num_ts_types = 0;
+		p->tstamp_type_list[num_ts_types] =
+		    PCAP_TSTAMP_HOST;
+		num_ts_types++;
+		for (ULONG i = 0; i < num_ts_modes; i++) {
+			switch (modes[i + 1]) {
+
+			case TIMESTAMPMODE_SINGLE_SYNCHRONIZATION:
+				/*
+				 * Better than low-res,
+				 * but *not* synchronized
+				 * with the OS clock.
+				 */
+				p->tstamp_type_list[num_ts_types] =
+				    PCAP_TSTAMP_HOST_HIPREC_UNSYNCED;
+				num_ts_types++;
+				break;
+
+			case TIMESTAMPMODE_QUERYSYSTEMTIME:
+				/*
+				 * Low-res, but synchronized
+				 * with the OS clock.
+				 */
+				p->tstamp_type_list[num_ts_types] =
+				    PCAP_TSTAMP_HOST_LOWPREC;
+				num_ts_types++;
+				break;
+
+			case TIMESTAMPMODE_QUERYSYSTEMTIME_PRECISE:
+				/*
+				 * High-res, and synchronized
+				 * with the OS clock.
+				 */
+				p->tstamp_type_list[num_ts_types] =
+				    PCAP_TSTAMP_HOST_HIPREC;
+				num_ts_types++;
+				break;
+
+			default:
+				/*
+				 * Unknown, so we can't
+				 * report it.
+				 */
+				break;
+			}
+		}
+		p->tstamp_type_count = num_ts_types;
+	} while (0);
+
+	/* Clean up temporary allocations */
+	if (device_copy != NULL) {
+		free(device_copy);
+	}
+	if (modes != NULL) {
+		free(modes);
+	}
+	if (adapter != NULL) {
 		PacketCloseAdapter(adapter);
 	}
+
+	return status;
+}
+#else /* HAVE_PACKET_GET_TIMESTAMP_MODES */
+static int
+get_ts_types(const char *device _U_, pcap_t *p _U_, char *ebuf _U_)
+{
+	/*
+	 * Nothing to fetch, so it always "succeeds".
+	 */
+	return 0;
+}
 #endif /* HAVE_PACKET_GET_TIMESTAMP_MODES */
 
+pcap_t *
+pcap_create_interface(const char *device _U_, char *ebuf)
+{
+	pcap_t *p;
+
+	p = PCAP_CREATE_COMMON(ebuf, struct pcap_win);
+	if (p == NULL)
+		return (NULL);
+
+	p->activate_op = pcap_activate_npf;
+	p->can_set_rfmon_op = pcap_can_set_rfmon_npf;
+
+	if (get_ts_types(device, p, ebuf) == -1) {
+		pcap_close(p);
+		return (NULL);
+	}
 	return (p);
 }
 
@@ -1933,7 +2139,7 @@
 		*flags |= PCAP_IF_WIRELESS;
 
 		/*
-		 * A "network assosiation state" makes no sense for airpcap.
+		 * A "network association state" makes no sense for airpcap.
 		 */
 		*flags |= PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE;
 		PacketCloseAdapter(adapter);
diff --git a/pcap-pf.c b/pcap-pf.c
index 4563a22..bd27933 100644
--- a/pcap-pf.c
+++ b/pcap-pf.c
@@ -133,6 +133,9 @@
 		bp = pc->bp;
 	/*
 	 * Loop through each packet.
+	 *
+	 * This assumes that a single buffer of packets will have
+	 * <= INT_MAX packets, so the packet count doesn't overflow.
 	 */
 	n = 0;
 	pad = pc->fddipad;
diff --git a/pcap-rdmasniff.c b/pcap-rdmasniff.c
index 224821d..d63ca89 100644
--- a/pcap-rdmasniff.c
+++ b/pcap-rdmasniff.c
@@ -38,6 +38,7 @@
 #include <infiniband/verbs.h>
 #include <stdlib.h>
 #include <string.h>
+#include <limits.h> /* for INT_MAX */
 #include <sys/time.h>
 
 #if !defined(IBV_FLOW_ATTR_SNIFFER)
@@ -136,15 +137,30 @@
 		priv->cq_event = 1;
 	}
 
-	while (count < max_packets || PACKET_COUNT_IS_UNLIMITED(max_packets)) {
+	/*
+	 * This can conceivably process more than INT_MAX packets,
+	 * which would overflow the packet count, causing it either
+	 * to look like a negative number, and thus cause us to
+	 * return a value that looks like an error, or overflow
+	 * back into positive territory, and thus cause us to
+	 * return a too-low count.
+	 *
+	 * Therefore, if the packet count is unlimited, we clip
+	 * it at INT_MAX; this routine is not expected to
+	 * process packets indefinitely, so that's not an issue.
+	 */
+	if (PACKET_COUNT_IS_UNLIMITED(max_packets))
+		max_packets = INT_MAX;
+
+	while (count < max_packets) {
 		if (ibv_poll_cq(priv->cq, 1, &wc) != 1) {
 			priv->cq_event = 0;
 			break;
 		}
 
 		if (wc.status != IBV_WC_SUCCESS) {
-			fprintf(stderr, "failed WC wr_id %lld status %d/%s\n",
-				(unsigned long long) wc.wr_id,
+			fprintf(stderr, "failed WC wr_id %" PRIu64 " status %d/%s\n",
+				wc.wr_id,
 				wc.status, ibv_wc_status_str(wc.status));
 			continue;
 		}
diff --git a/pcap-rpcap.c b/pcap-rpcap.c
index 0c6c558..22fc736 100644
--- a/pcap-rpcap.c
+++ b/pcap-rpcap.c
@@ -36,13 +36,16 @@
 #endif
 
 #include "ftmacros.h"
+#include "diag-control.h"
 
 #include <string.h>		/* for strlen(), ... */
 #include <stdlib.h>		/* for malloc(), free(), ... */
 #include <stdarg.h>		/* for functions with variable number of arguments */
 #include <errno.h>		/* for the errno variable */
+#include <limits.h>		/* for INT_MAX */
 #include "sockutils.h"
 #include "pcap-int.h"
+#include "pcap-util.h"
 #include "rpcap-protocol.h"
 #include "pcap-rpcap.h"
 
@@ -93,6 +96,7 @@
 	SOCKET sockctrl;
 	SSL *ssl;
 	uint8 protocol_version;
+	int byte_swapped;
 	struct activehosts *next;
 };
 
@@ -128,6 +132,7 @@
 
 	uint8 protocol_version;		/* negotiated protocol version */
 	uint8 uses_ssl;				/* User asked for rpcaps scheme */
+	int byte_swapped;		/* Server byte order is swapped from ours */
 
 	unsigned int TotNetDrops;	/* keeps the number of packets that have been dropped by the network */
 
@@ -432,7 +437,8 @@
 				return 0;
 			}
 #endif
-			sock_geterror("select()", p->errbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "select() failed");
 			return -1;
 		}
 	}
@@ -644,6 +650,21 @@
 		}
 	}
 
+	/*
+	 * This can conceivably process more than INT_MAX packets,
+	 * which would overflow the packet count, causing it either
+	 * to look like a negative number, and thus cause us to
+	 * return a value that looks like an error, or overflow
+	 * back into positive territory, and thus cause us to
+	 * return a too-low count.
+	 *
+	 * Therefore, if the packet count is unlimited, we clip
+	 * it at INT_MAX; this routine is not expected to
+	 * process packets indefinitely, so that's not an issue.
+	 */
+	if (PACKET_COUNT_IS_UNLIMITED(cnt))
+		cnt = INT_MAX;
+
 	while (n < cnt || PACKET_COUNT_IS_UNLIMITED(cnt))
 	{
 		/*
@@ -666,9 +687,14 @@
 		if (ret == 1)
 		{
 			/*
-			 * We got a packet.  Hand it to the callback
-			 * and count it so we can return the count.
+			 * We got a packet.
+			 *
+			 * Do whatever post-processing is necessary, hand
+			 * it to the callback, and count it so we can
+			 * return the count.
 			 */
+			pcap_post_process(p->linktype, pr->byte_swapped,
+			    &pkt_header, pkt_data);
 			(*callback)(user, &pkt_header, pkt_data);
 			n++;
 		}
@@ -1003,7 +1029,7 @@
 	hints.ai_family = PF_UNSPEC;
 	hints.ai_socktype = SOCK_STREAM;
 
-	retval = sock_initaddress(host, "0", &hints, &addrinfo, errbuf,
+	retval = sock_initaddress(host, NULL, &hints, &addrinfo, errbuf,
 	    PCAP_ERRBUF_SIZE);
 	if (retval != 0)
 	{
@@ -1059,7 +1085,7 @@
 	struct pcap_rpcap *pr = fp->priv;	/* structure used when doing a remote live capture */
 	char sendbuf[RPCAP_NETBUF_SIZE];	/* temporary buffer in which data to be sent is buffered */
 	int sendbufidx = 0;			/* index which keeps the number of bytes currently buffered */
-	char portdata[PCAP_BUF_SIZE];		/* temp variable needed to keep the network port for the data connection */
+	uint16 portdata = 0;			/* temp variable needed to keep the network port for the data connection */
 	uint32 plen;
 	int active = 0;				/* '1' if we're in active mode */
 	struct activehosts *temp;		/* temp var needed to scan the host list chain, to detect if we're in active mode */
@@ -1072,6 +1098,8 @@
 	struct sockaddr_storage saddr;		/* temp, needed to retrieve the network data port chosen on the local machine */
 	socklen_t saddrlen;			/* temp, needed to retrieve the network data port chosen on the local machine */
 	int ai_family;				/* temp, keeps the address family used by the control connection */
+	struct sockaddr_in *sin4;
+	struct sockaddr_in6 *sin6;
 
 	/* RPCAP-related variables*/
 	struct rpcap_header header;			/* header of the RPCAP packet */
@@ -1085,7 +1113,9 @@
 	uint32 server_sockbufsize;
 
 	// Take the opportunity to clear pr->data_ssl before any goto error,
-	// as it seems pr->priv is not zeroed after its malloced.
+	// as it seems p->priv is not zeroed after its malloced.
+	// XXX - it now should be, as it's allocated by pcap_alloc_pcap_t(),
+	// which does a calloc().
 	pr->data_ssl = NULL;
 
 	/*
@@ -1119,7 +1149,8 @@
 	saddrlen = sizeof(struct sockaddr_storage);
 	if (getpeername(pr->rmt_sockctrl, (struct sockaddr *) &saddr, &saddrlen) == -1)
 	{
-		sock_geterror("getsockname()", fp->errbuf, PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(fp->errbuf, PCAP_ERRBUF_SIZE,
+		    "getsockname() failed");
 		goto error_nodiscard;
 	}
 	ai_family = ((struct sockaddr_storage *) &saddr)->ss_family;
@@ -1128,7 +1159,8 @@
 	if (getnameinfo((struct sockaddr *) &saddr, saddrlen, host,
 		sizeof(host), NULL, 0, NI_NUMERICHOST))
 	{
-		sock_geterror("getnameinfo()", fp->errbuf, PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(fp->errbuf, PCAP_ERRBUF_SIZE,
+		    "getnameinfo() failed");
 		goto error_nodiscard;
 	}
 
@@ -1151,10 +1183,10 @@
 		hints.ai_flags = AI_PASSIVE;	/* Data connection is opened by the server toward the client */
 
 		/* Let's the server pick up a free network port for us */
-		if (sock_initaddress(NULL, "0", &hints, &addrinfo, fp->errbuf, PCAP_ERRBUF_SIZE) == -1)
+		if (sock_initaddress(NULL, NULL, &hints, &addrinfo, fp->errbuf, PCAP_ERRBUF_SIZE) == -1)
 			goto error_nodiscard;
 
-		if ((sockdata = sock_open(addrinfo, SOCKOPEN_SERVER,
+		if ((sockdata = sock_open(NULL, addrinfo, SOCKOPEN_SERVER,
 			1 /* max 1 connection in queue */, fp->errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
 			goto error_nodiscard;
 
@@ -1166,15 +1198,27 @@
 		saddrlen = sizeof(struct sockaddr_storage);
 		if (getsockname(sockdata, (struct sockaddr *) &saddr, &saddrlen) == -1)
 		{
-			sock_geterror("getsockname()", fp->errbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(fp->errbuf, PCAP_ERRBUF_SIZE,
+			    "getsockname() failed");
 			goto error_nodiscard;
 		}
 
-		/* Get the local port the system picked up */
-		if (getnameinfo((struct sockaddr *) &saddr, saddrlen, NULL,
-			0, portdata, sizeof(portdata), NI_NUMERICSERV))
-		{
-			sock_geterror("getnameinfo()", fp->errbuf, PCAP_ERRBUF_SIZE);
+		switch (saddr.ss_family) {
+
+		case AF_INET:
+			sin4 = (struct sockaddr_in *)&saddr;
+			portdata = sin4->sin_port;
+			break;
+
+		case AF_INET6:
+			sin6 = (struct sockaddr_in6 *)&saddr;
+			portdata = sin6->sin6_port;
+			break;
+
+		default:
+			snprintf(fp->errbuf, PCAP_ERRBUF_SIZE,
+			    "Local address has unknown address family %u",
+			    saddr.ss_family);
 			goto error_nodiscard;
 		}
 	}
@@ -1207,8 +1251,7 @@
 	/* portdata on the openreq is meaningful only if we're in active mode */
 	if ((active) || (pr->rmt_flags & PCAP_OPENFLAG_DATATX_UDP))
 	{
-		sscanf(portdata, "%d", (int *)&(startcapreq->portdata));	/* cast to avoid a compiler warning */
-		startcapreq->portdata = htons(startcapreq->portdata);
+		startcapreq->portdata = portdata;
 	}
 
 	startcapreq->snaplen = htonl(fp->snapshot);
@@ -1257,16 +1300,18 @@
 	{
 		if (!active)
 		{
+			char portstring[PCAP_BUF_SIZE];
+
 			memset(&hints, 0, sizeof(struct addrinfo));
 			hints.ai_family = ai_family;		/* Use the same address family of the control socket */
 			hints.ai_socktype = (pr->rmt_flags & PCAP_OPENFLAG_DATATX_UDP) ? SOCK_DGRAM : SOCK_STREAM;
-			snprintf(portdata, PCAP_BUF_SIZE, "%d", ntohs(startcapreply.portdata));
+			snprintf(portstring, PCAP_BUF_SIZE, "%d", ntohs(startcapreply.portdata));
 
 			/* Let's the server pick up a free network port for us */
-			if (sock_initaddress(host, portdata, &hints, &addrinfo, fp->errbuf, PCAP_ERRBUF_SIZE) == -1)
+			if (sock_initaddress(host, portstring, &hints, &addrinfo, fp->errbuf, PCAP_ERRBUF_SIZE) == -1)
 				goto error;
 
-			if ((sockdata = sock_open(addrinfo, SOCKOPEN_CLIENT, 0, fp->errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
+			if ((sockdata = sock_open(host, addrinfo, SOCKOPEN_CLIENT, 0, fp->errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
 				goto error;
 
 			/* addrinfo is no longer used */
@@ -1284,7 +1329,8 @@
 
 			if (socktemp == INVALID_SOCKET)
 			{
-				sock_geterror("accept()", fp->errbuf, PCAP_ERRBUF_SIZE);
+				sock_geterrmsg(fp->errbuf, PCAP_ERRBUF_SIZE,
+				    "accept() failed");
 				goto error;
 			}
 
@@ -1318,7 +1364,8 @@
 	res = getsockopt(sockdata, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, &itemp);
 	if (res == -1)
 	{
-		sock_geterror("pcap_startcapture_remote(): getsockopt() failed", fp->errbuf, PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(fp->errbuf, PCAP_ERRBUF_SIZE,
+		    "pcap_startcapture_remote(): getsockopt() failed");
 		goto error;
 	}
 
@@ -1697,14 +1744,16 @@
 		saddrlen = sizeof(struct sockaddr_storage);
 		if (getpeername(pr->rmt_sockctrl, (struct sockaddr *) &saddr, &saddrlen) == -1)
 		{
-			sock_geterror("getpeername()", fp->errbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(fp->errbuf, PCAP_ERRBUF_SIZE,
+			    "getpeername() failed");
 			return -1;
 		}
 
 		if (getnameinfo((struct sockaddr *) &saddr, saddrlen, peeraddress,
 			sizeof(peeraddress), peerctrlport, sizeof(peerctrlport), NI_NUMERICHOST | NI_NUMERICSERV))
 		{
-			sock_geterror("getnameinfo()", fp->errbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(fp->errbuf, PCAP_ERRBUF_SIZE,
+			    "getnameinfo() failed");
 			return -1;
 		}
 
@@ -1712,7 +1761,8 @@
 		/* Get the name/port of the current host */
 		if (getsockname(pr->rmt_sockctrl, (struct sockaddr *) &saddr, &saddrlen) == -1)
 		{
-			sock_geterror("getsockname()", fp->errbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(fp->errbuf, PCAP_ERRBUF_SIZE,
+			    "getsockname() failed");
 			return -1;
 		}
 
@@ -1720,21 +1770,24 @@
 		if (getnameinfo((struct sockaddr *) &saddr, saddrlen, myaddress,
 			sizeof(myaddress), myctrlport, sizeof(myctrlport), NI_NUMERICHOST | NI_NUMERICSERV))
 		{
-			sock_geterror("getnameinfo()", fp->errbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(fp->errbuf, PCAP_ERRBUF_SIZE,
+			    "getnameinfo() failed");
 			return -1;
 		}
 
 		/* Let's now check the data port */
 		if (getsockname(pr->rmt_sockdata, (struct sockaddr *) &saddr, &saddrlen) == -1)
 		{
-			sock_geterror("getsockname()", fp->errbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(fp->errbuf, PCAP_ERRBUF_SIZE,
+			    "getsockname() failed");
 			return -1;
 		}
 
 		/* Get the local port the system picked up */
 		if (getnameinfo((struct sockaddr *) &saddr, saddrlen, NULL, 0, mydataport, sizeof(mydataport), NI_NUMERICSERV))
 		{
-			sock_geterror("getnameinfo()", fp->errbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(fp->errbuf, PCAP_ERRBUF_SIZE,
+			    "getnameinfo() failed");
 			return -1;
 		}
 
@@ -1900,6 +1953,10 @@
  * \param ver: pointer to variable to which to set the protocol version
  * number we selected.
  *
+ * \param byte_swapped: pointer to variable to which to set 1 if the
+ * byte order the server says it has is byte-swapped from ours, 0
+ * otherwise (whether it's the same as ours or is unknown).
+ *
  * \param auth: authentication parameters that have to be sent.
  *
  * \param errbuf: a pointer to a user-allocated buffer (of size
@@ -1910,7 +1967,8 @@
  * \return '0' if everything is fine, '-1' for an error.  For errors,
  * an error message string is returned in the 'errbuf' variable.
  */
-static int rpcap_doauth(SOCKET sockctrl, SSL *ssl, uint8 *ver, struct pcap_rmtauth *auth, char *errbuf)
+static int rpcap_doauth(SOCKET sockctrl, SSL *ssl, uint8 *ver,
+    int *byte_swapped, struct pcap_rmtauth *auth, char *errbuf)
 {
 	char sendbuf[RPCAP_NETBUF_SIZE];	/* temporary buffer in which data that has to be sent is buffered */
 	int sendbufidx = 0;			/* index which keeps the number of bytes currently buffered */
@@ -1922,6 +1980,8 @@
 	uint32 plen;
 	struct rpcap_authreply authreply;	/* authentication reply message */
 	uint8 ourvers;
+	int has_byte_order;			/* The server sent its version of the byte-order magic number */
+	u_int their_byte_order_magic;		/* Here's what it is */
 
 	if (auth)
 	{
@@ -2026,17 +2086,46 @@
 	plen = header.plen;
 	if (plen != 0)
 	{
-		/* Yes - is it big enough to be version information? */
-		if (plen < sizeof(struct rpcap_authreply))
+		size_t reply_len;
+
+		/* Yes - is it big enough to include version information? */
+		if (plen < sizeof(struct rpcap_authreply_old))
 		{
 			/* No - discard it and fail. */
+			snprintf(errbuf, PCAP_ERRBUF_SIZE,
+			    "Authenticaton reply from server is too short");
+			(void)rpcap_discard(sockctrl, ssl, plen, NULL);
+			return -1;
+		}
+
+		/* Yes - does it include server byte order information? */
+		if (plen == sizeof(struct rpcap_authreply_old))
+		{
+			/* No - just read the version information */
+			has_byte_order = 0;
+			reply_len = sizeof(struct rpcap_authreply_old);
+		}
+		else if (plen >= sizeof(struct rpcap_authreply_old))
+		{
+			/* Yes - read it all. */
+			has_byte_order = 1;
+			reply_len = sizeof(struct rpcap_authreply);
+		}
+		else
+		{
+			/*
+			 * Too long for old reply, too short for new reply.
+			 * Discard it and fail.
+			 */
+			snprintf(errbuf, PCAP_ERRBUF_SIZE,
+			    "Authenticaton reply from server is too short");
 			(void)rpcap_discard(sockctrl, ssl, plen, NULL);
 			return -1;
 		}
 
 		/* Read the reply body */
 		if (rpcap_recv(sockctrl, ssl, (char *)&authreply,
-		    sizeof(struct rpcap_authreply), &plen, errbuf) == -1)
+		    reply_len, &plen, errbuf) == -1)
 		{
 			(void)rpcap_discard(sockctrl, ssl, plen, NULL);
 			return -1;
@@ -2059,12 +2148,32 @@
 			    "The server's minimum supported protocol version is greater than its maximum supported protocol version");
 			return -1;
 		}
+
+		if (has_byte_order)
+		{
+			their_byte_order_magic = authreply.byte_order_magic;
+		}
+		else
+		{
+			/*
+			 * The server didn't tell us what its byte
+			 * order is; assume it's ours.
+			 */
+			their_byte_order_magic = RPCAP_BYTE_ORDER_MAGIC;
+		}
 	}
 	else
 	{
 		/* No - it supports only version 0. */
 		authreply.minvers = 0;
 		authreply.maxvers = 0;
+
+		/*
+		 * And it didn't tell us what its byte order is; assume
+		 * it's ours.
+		 */
+		has_byte_order = 0;
+		their_byte_order_magic = RPCAP_BYTE_ORDER_MAGIC;
 	}
 
 	/*
@@ -2097,6 +2206,27 @@
 			goto novers;
 	}
 
+	/*
+	 * Is the server byte order the opposite of ours?
+	 */
+	if (their_byte_order_magic == RPCAP_BYTE_ORDER_MAGIC)
+	{
+		/* No, it's the same. */
+		*byte_swapped = 0;
+	}
+	else if (their_byte_order_magic == RPCAP_BYTE_ORDER_MAGIC_SWAPPED)
+	{
+		/* Yes, it's the opposite of ours. */
+		*byte_swapped = 1;
+	}
+	else
+	{
+		/* They sent us something bogus. */
+		snprintf(errbuf, PCAP_ERRBUF_SIZE,
+		    "The server did not send us a valid byte order value");
+		return -1;
+	}
+
 	*ver = ourvers;
 	return 0;
 
@@ -2129,8 +2259,8 @@
 static int
 rpcap_setup_session(const char *source, struct pcap_rmtauth *auth,
     int *activep, SOCKET *sockctrlp, uint8 *uses_sslp, SSL **sslp,
-    int rmt_flags, uint8 *protocol_versionp, char *host, char *port,
-    char *iface, char *errbuf)
+    int rmt_flags, uint8 *protocol_versionp, int *byte_swappedp,
+    char *host, char *port, char *iface, char *errbuf)
 {
 	int type;
 	struct activehosts *activeconn;		/* active connection, if there is one */
@@ -2180,6 +2310,7 @@
 		*sockctrlp = activeconn->sockctrl;
 		*sslp = activeconn->ssl;
 		*protocol_versionp = activeconn->protocol_version;
+		*byte_swappedp = activeconn->byte_swapped;
 	}
 	else
 	{
@@ -2217,7 +2348,7 @@
 				return -1;
 		}
 
-		if ((*sockctrlp = sock_open(addrinfo, SOCKOPEN_CLIENT, 0,
+		if ((*sockctrlp = sock_open(host, addrinfo, SOCKOPEN_CLIENT, 0,
 		    errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
 		{
 			freeaddrinfo(addrinfo);
@@ -2246,8 +2377,8 @@
 #endif
 		}
 
-		if (rpcap_doauth(*sockctrlp, *sslp, protocol_versionp, auth,
-		    errbuf) == -1)
+		if (rpcap_doauth(*sockctrlp, *sslp, protocol_versionp,
+		    byte_swappedp, auth, errbuf) == -1)
 		{
 #ifdef HAVE_OPENSSL
 			if (*sslp)
@@ -2313,6 +2444,7 @@
 	SOCKET sockctrl;
 	SSL *ssl = NULL;
 	uint8 protocol_version;			/* negotiated protocol version */
+	int byte_swapped;			/* server is known to be byte-swapped */
 	int active;
 	uint32 plen;
 	char sendbuf[RPCAP_NETBUF_SIZE];	/* temporary buffer in which data to be sent is buffered */
@@ -2358,8 +2490,8 @@
 	 * Attempt to set up the session with the server.
 	 */
 	if (rpcap_setup_session(fp->opt.device, auth, &active, &sockctrl,
-	    &pr->uses_ssl, &ssl, flags, &protocol_version, host, ctrlport,
-	    iface, errbuf) == -1)
+	    &pr->uses_ssl, &ssl, flags, &protocol_version, &byte_swapped,
+	    host, ctrlport, iface, errbuf) == -1)
 	{
 		/* Session setup failed. */
 		pcap_close(fp);
@@ -2408,6 +2540,7 @@
 	pr->rmt_sockctrl = sockctrl;
 	pr->ctrl_ssl = ssl;
 	pr->protocol_version = protocol_version;
+	pr->byte_swapped = byte_swapped;
 	pr->rmt_clientside = 1;
 
 	/* This code is duplicated from the end of this function */
@@ -2479,6 +2612,7 @@
 pcap_findalldevs_ex_remote(const char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf)
 {
 	uint8 protocol_version;		/* protocol version */
+	int byte_swapped;		/* Server byte order is swapped from ours */
 	SOCKET sockctrl;		/* socket descriptor of the control connection */
 	SSL *ssl = NULL;		/* optional SSL handler for sockctrl */
 	uint32 plen;
@@ -2500,7 +2634,8 @@
 	 * Attempt to set up the session with the server.
 	 */
 	if (rpcap_setup_session(source, auth, &active, &sockctrl, &uses_ssl,
-	    &ssl, 0, &protocol_version, host, port, NULL, errbuf) == -1)
+	    &ssl, 0, &protocol_version, &byte_swapped, host, port, NULL,
+	    errbuf) == -1)
 	{
 		/* Session setup failed. */
 		return -1;
@@ -2792,6 +2927,7 @@
 	SOCKET sockctrl;				/* keeps the main socket identifier */
 	SSL *ssl = NULL;				/* Optional SSL handler for sockctrl */
 	uint8 protocol_version;			/* negotiated protocol version */
+	int byte_swapped;			/* 1 if server byte order is known to be the reverse of ours */
 	struct activehosts *temp, *prev;	/* temp var needed to scan he host list chain */
 
 	*connectinghost = 0;		/* just in case */
@@ -2825,7 +2961,7 @@
 	}
 
 
-	if ((sockmain = sock_open(addrinfo, SOCKOPEN_SERVER, 1, errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
+	if ((sockmain = sock_open(NULL, addrinfo, SOCKOPEN_SERVER, 1, errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
 	{
 		freeaddrinfo(addrinfo);
 		return (SOCKET)-2;
@@ -2844,7 +2980,7 @@
 
 	if (sockctrl == INVALID_SOCKET)
 	{
-		sock_geterror("accept()", errbuf, PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE, "accept() failed");
 		return (SOCKET)-2;
 	}
 
@@ -2868,7 +3004,8 @@
 	/* Get the numeric for of the name of the connecting host */
 	if (getnameinfo((struct sockaddr *) &from, fromlen, connectinghost, RPCAP_HOSTLIST_SIZE, NULL, 0, NI_NUMERICHOST))
 	{
-		sock_geterror("getnameinfo()", errbuf, PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+		    "getnameinfo() failed");
 		rpcap_senderror(sockctrl, ssl, 0, PCAP_ERR_REMOTEACCEPT, errbuf, NULL);
 #ifdef HAVE_OPENSSL
 		if (ssl)
@@ -2901,7 +3038,8 @@
 	/*
 	 * Send authentication to the remote machine.
 	 */
-	if (rpcap_doauth(sockctrl, ssl, &protocol_version, auth, errbuf) == -1)
+	if (rpcap_doauth(sockctrl, ssl, &protocol_version, &byte_swapped,
+	    auth, errbuf) == -1)
 	{
 		/* Unrecoverable error. */
 		rpcap_senderror(sockctrl, ssl, 0, PCAP_ERR_REMOTEACCEPT, errbuf, NULL);
@@ -2966,6 +3104,7 @@
 	temp->sockctrl = sockctrl;
 	temp->ssl = ssl;
 	temp->protocol_version = protocol_version;
+	temp->byte_swapped = byte_swapped;
 	temp->next = NULL;
 
 	return sockctrl;
@@ -2991,7 +3130,7 @@
 	hints.ai_family = PF_UNSPEC;
 	hints.ai_socktype = SOCK_STREAM;
 
-	retval = sock_initaddress(host, "0", &hints, &addrinfo, errbuf,
+	retval = sock_initaddress(host, NULL, &hints, &addrinfo, errbuf,
 	    PCAP_ERRBUF_SIZE);
 	if (retval != 0)
 	{
@@ -3134,7 +3273,8 @@
 			/*	if (getnameinfo( (struct sockaddr *) &temp->host, sizeof (struct sockaddr_storage), hoststr, */
 			/*		RPCAP_HOSTLIST_SIZE, NULL, 0, NI_NUMERICHOST) ) */
 		{
-			/*	sock_geterror("getnameinfo()", errbuf, PCAP_ERRBUF_SIZE); */
+			/*	sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE, */
+			/*	    "getnameinfo() failed");             */
 			return -1;
 		}
 
@@ -3351,7 +3491,9 @@
 		    PCAP_ERRBUF_SIZE) == -1)
 		{
 			// Network error.
+			DIAG_OFF_FORMAT_TRUNCATION
 			snprintf(remote_errbuf, PCAP_ERRBUF_SIZE, "Read of error message from client failed: %s", errbuf);
+			DIAG_ON_FORMAT_TRUNCATION
 			return;
 		}
 
@@ -3386,7 +3528,9 @@
 		    PCAP_ERRBUF_SIZE) == -1)
 		{
 			// Network error.
+			DIAG_OFF_FORMAT_TRUNCATION
 			snprintf(remote_errbuf, PCAP_ERRBUF_SIZE, "Read of error message from client failed: %s", errbuf);
+			DIAG_ON_FORMAT_TRUNCATION
 			return;
 		}
 
diff --git a/pcap-septel.c b/pcap-septel.c
index e917edd..6d1d904 100644
--- a/pcap-septel.c
+++ b/pcap-septel.c
@@ -93,7 +93,7 @@
       h = GCT_grab(id);
 
       m = (MSG*)h;
-      /* a couter is added here to avoid an infinite loop
+      /* a counter is added here to avoid an infinite loop
        * that will cause our capture program GUI to freeze while waiting
        * for a packet*/
       counter++ ;
@@ -105,7 +105,7 @@
 
       t = h->type ;
 
-      /* catch only messages with type = 0xcf00 or 0x8f01 corrsponding to ss7 messages*/
+      /* catch only messages with type = 0xcf00 or 0x8f01 corresponding to ss7 messages*/
       /* XXX = why not use API_MSG_TX_REQ for 0xcf00 and API_MSG_RX_IND
        * for 0x8f01? */
       if ((t != 0xcf00) && (t != 0x8f01)) {
diff --git a/pcap-sita.c b/pcap-sita.c
index c53f323..2e5d442 100644
--- a/pcap-sita.c
+++ b/pcap-sita.c
@@ -441,7 +441,7 @@
 
 	iface->iftype = iftype;					/* remember the interface type of this interface */
 
-	iface->IOPname = strdup(IOPnam);			/* copy it and stick it into the structure */
+	iface->IOPname = strdup(IOPname);			/* copy it and stick it into the structure */
         if (iface->IOPname == NULL) {    /* oops, we didn't get the memory requested     */
                 fprintf(stderr, "Error...couldn't allocate memory for IOPname...value of errno is: %d\n", errno);
                 return NULL;
@@ -492,7 +492,7 @@
 		u->iface = iface;					/* stick this entry at the head of the list */
 	} else {
 		iface_ptr = u->iface;
-		while (iface_ptr->next) {			/* othewise scan the list */
+		while (iface_ptr->next) {			/* otherwise scan the list */
 			iface_ptr = iface_ptr->next;	/* till we're at the last entry */
 		}
 		iface_ptr->next = iface;			/* then tack this entry on the end of the list */
diff --git a/pcap-snf.c b/pcap-snf.c
index a9162eb..b885e02 100644
--- a/pcap-snf.c
+++ b/pcap-snf.c
@@ -9,6 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <limits.h> /* for INT_MAX */
 
 #ifndef _WIN32
 #include <netinet/in.h>
@@ -139,9 +140,24 @@
 	if (!p)
 		return -1;
 
+	/*
+	 * This can conceivably process more than INT_MAX packets,
+	 * which would overflow the packet count, causing it either
+	 * to look like a negative number, and thus cause us to
+	 * return a value that looks like an error, or overflow
+	 * back into positive territory, and thus cause us to
+	 * return a too-low count.
+	 *
+	 * Therefore, if the packet count is unlimited, we clip
+	 * it at INT_MAX; this routine is not expected to
+	 * process packets indefinitely, so that's not an issue.
+	 */
+	if (PACKET_COUNT_IS_UNLIMITED(cnt))
+		cnt = INT_MAX;
+
 	n = 0;
 	timeout = ps->snf_timeout;
-	while (n < cnt || PACKET_COUNT_IS_UNLIMITED(cnt)) {
+	while (n < cnt) {
 		/*
 		 * Has "pcap_breakloop()" been called?
 		 */
diff --git a/pcap-snit.c b/pcap-snit.c
index ca6222c..3f4e69d 100644
--- a/pcap-snit.c
+++ b/pcap-snit.c
@@ -139,6 +139,9 @@
 
 	/*
 	 * loop through each snapshot in the chunk
+	 *
+	 * This assumes that a single buffer of packets will have
+	 * <= INT_MAX packets, so the packet count doesn't overflow.
 	 */
 	n = 0;
 	ep = bp + cc;
@@ -331,12 +334,16 @@
 	if (fd < 0 && errno == EACCES)
 		p->fd = fd = open(dev, O_RDONLY);
 	if (fd < 0) {
-		if (errno == EACCES)
+		if (errno == EACCES) {
 			err = PCAP_ERROR_PERM_DENIED;
-		else
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "Attempt to open %s failed with EACCES - root privileges may be required",
+			    dev);
+		} else {
 			err = PCAP_ERROR;
-		pcap_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-		    errno, "%s", dev);
+			pcap_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
+			    errno, "%s", dev);
+		}
 		goto bad;
 	}
 
diff --git a/pcap-tc.c b/pcap-tc.c
index 9902633..1d753b5 100644
--- a/pcap-tc.c
+++ b/pcap-tc.c
@@ -914,7 +914,7 @@
 			return -1;
 		}
 
-		/* No underlaying filtering system. We need to filter on our own */
+		/* No underlying filtering system. We need to filter on our own */
 		if (p->fcode.bf_insns)
 		{
 			filterResult = pcap_filter(p->fcode.bf_insns, data, tcHeader.Length, tcHeader.CapturedLength);
@@ -1124,7 +1124,7 @@
 {
 	if (mode != MODE_CAPT)
 	{
-		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Mode %u not supported by TurboCap devices. TurboCap only supports capture.", mode);
+		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Mode %d not supported by TurboCap devices. TurboCap only supports capture.", mode);
 		return -1;
 	}
 
diff --git a/pcap-usb-linux-common.c b/pcap-usb-linux-common.c
new file mode 100644
index 0000000..fb4a8c1
--- /dev/null
+++ b/pcap-usb-linux-common.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 1993, 1994, 1995, 1996, 1997
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * pcap-usb-linux-common.c - common code for everything that needs to
+ * deal with Linux USB captures.
+ */
+
+#include "pcap/pcap.h"
+#include "pcap/usb.h"
+
+#include "pcap-usb-linux-common.h"
+
+/*
+ * Compute, from the data provided by the Linux USB memory-mapped capture
+ * mechanism, the amount of packet data that would have been provided
+ * had the capture mechanism not chopped off any data at the end, if, in
+ * fact, it did so.
+ *
+ * Set the "unsliced length" field of the packet header to that value.
+ */
+void
+fix_linux_usb_mmapped_length(struct pcap_pkthdr *pkth, const u_char *bp)
+{
+	const pcap_usb_header_mmapped *hdr;
+	u_int bytes_left;
+
+	/*
+	 * All callers of this routine must ensure that pkth->caplen is
+	 * >= sizeof (pcap_usb_header_mmapped).
+	 */
+	bytes_left = pkth->caplen;
+	bytes_left -= sizeof (pcap_usb_header_mmapped);
+
+	hdr = (const pcap_usb_header_mmapped *) bp;
+	if (!hdr->data_flag && hdr->transfer_type == URB_ISOCHRONOUS &&
+	    hdr->event_type == URB_COMPLETE &&
+	    (hdr->endpoint_number & URB_TRANSFER_IN) &&
+	    pkth->len == sizeof(pcap_usb_header_mmapped) +
+	                 (hdr->ndesc * sizeof (usb_isodesc)) + hdr->urb_len) {
+		usb_isodesc *descs;
+		u_int pre_truncation_data_len, pre_truncation_len;
+
+		descs = (usb_isodesc *) (bp + sizeof(pcap_usb_header_mmapped));
+
+		/*
+		 * We have data (yes, data_flag is 0 if we *do* have data),
+		 * and this is a "this is complete" incoming isochronous
+		 * transfer event, and the length was calculated based
+		 * on the URB length.
+		 *
+		 * That's not correct, because the data isn't contiguous,
+		 * and the isochronous descriptos show how it's scattered.
+		 *
+		 * Find the end of the last chunk of data in the buffer
+		 * referred to by the isochronous descriptors; that indicates
+		 * how far into the buffer the data would have gone.
+		 *
+		 * Make sure we don't run past the end of the captured data
+		 * while processing the isochronous descriptors.
+		 */
+		pre_truncation_data_len = 0;
+		for (uint32_t desc = 0;
+		    desc < hdr->ndesc && bytes_left >= sizeof (usb_isodesc);
+		    desc++, bytes_left -= sizeof (usb_isodesc)) {
+			u_int desc_end;
+
+			if (descs[desc].len != 0) {
+				desc_end = descs[desc].offset + descs[desc].len;
+				if (desc_end > pre_truncation_data_len)
+					pre_truncation_data_len = desc_end;
+			}
+		}
+
+		/*
+		 * Now calculate the total length based on that data
+		 * length.
+		 */
+		pre_truncation_len = sizeof(pcap_usb_header_mmapped) +
+		    (hdr->ndesc * sizeof (usb_isodesc)) +
+		    pre_truncation_data_len;
+
+		/*
+		 * If that's greater than or equal to the captured length,
+		 * use that as the length.
+		 */
+		if (pre_truncation_len >= pkth->caplen)
+			pkth->len = pre_truncation_len;
+
+		/*
+		 * If the captured length is greater than the length,
+		 * use the captured length.
+		 *
+		 * For completion events for incoming isochronous transfers,
+		 * it's based on data_len, which is calculated the same way
+		 * we calculated pre_truncation_data_len above, except that
+		 * it has access to all the isochronous descriptors, not
+		 * just the ones that the kernel were able to provide us or,
+		 * for a capture file, that weren't sliced off by a snapshot
+		 * length.
+		 *
+		 * However, it might have been reduced by the USB capture
+		 * mechanism arbitrarily limiting the amount of data it
+		 * provides to userland, or by the libpcap capture code
+		 * limiting it to being no more than the snapshot, so
+		 * we don't want to just use it all the time; we only
+		 * do so to try to get a better estimate of the actual
+		 * length - and to make sure the on-the-network length
+		 * is always >= the captured length.
+		 */
+		if (pkth->caplen > pkth->len)
+			pkth->len = pkth->caplen;
+	}
+}
diff --git a/pcap-usb-linux-common.h b/pcap-usb-linux-common.h
new file mode 100644
index 0000000..8cff7ba
--- /dev/null
+++ b/pcap-usb-linux-common.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 1993, 1994, 1995, 1996, 1997
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * pcap-usb-linux-common.h - common code for everything that needs to
+ * deal with Linux USB captures.
+ */
+
+extern void fix_linux_usb_mmapped_length(struct pcap_pkthdr *pkth,
+    const u_char *bp);
diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c
index ee8834f..7020577 100644
--- a/pcap-usb-linux.c
+++ b/pcap-usb-linux.c
@@ -39,6 +39,7 @@
 
 #include "pcap-int.h"
 #include "pcap-usb-linux.h"
+#include "pcap-usb-linux-common.h"
 #include "pcap/usb.h"
 
 #include "extract.h"
@@ -70,7 +71,12 @@
 #include <linux/usbdevice_fs.h>
 #endif /* HAVE_LINUX_USBDEVICE_FS_H */
 
+#include "diag-control.h"
+
 #define USB_IFACE "usbmon"
+
+#define USBMON_DEV_PREFIX "usbmon"
+#define USBMON_DEV_PREFIX_LEN	(sizeof USBMON_DEV_PREFIX - 1)
 #define USB_LINE_LEN 4096
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -173,9 +179,6 @@
 int
 usb_findalldevs(pcap_if_list_t *devlistp, char *err_str)
 {
-	char usb_mon_dir[PATH_MAX];
-	char *usb_mon_prefix;
-	size_t usb_mon_prefix_len;
 	struct dirent* data;
 	int ret = 0;
 	DIR* dir;
@@ -184,26 +187,10 @@
 
 	/*
 	 * We require 2.6.27 or later kernels, so we have binary-mode support.
-	 * What do the device names look like?
-	 * Split LINUX_USB_MON_DEV into a directory that we'll
-	 * scan and a file name prefix that we'll check for.
+	 * The devices are of the form /dev/usbmon{N}.
+	 * Open /dev and scan it.
 	 */
-	pcap_strlcpy(usb_mon_dir, LINUX_USB_MON_DEV, sizeof usb_mon_dir);
-	usb_mon_prefix = strrchr(usb_mon_dir, '/');
-	if (usb_mon_prefix == NULL) {
-		/*
-		 * This "shouldn't happen".  Just give up if it
-		 * does.
-		 */
-		return 0;
-	}
-	*usb_mon_prefix++ = '\0';
-	usb_mon_prefix_len = strlen(usb_mon_prefix);
-
-	/*
-	 * Open the directory and scan it.
-	 */
-	dir = opendir(usb_mon_dir);
+	dir = opendir("/dev");
 	if (dir != NULL) {
 		while ((ret == 0) && ((data = readdir(dir)) != 0)) {
 			name = data->d_name;
@@ -211,13 +198,14 @@
 			/*
 			 * Is this a usbmon device?
 			 */
-			if (strncmp(name, usb_mon_prefix, usb_mon_prefix_len) != 0)
+			if (strncmp(name, USBMON_DEV_PREFIX,
+			    USBMON_DEV_PREFIX_LEN) != 0)
 				continue;	/* no */
 
 			/*
 			 * What's the device number?
 			 */
-			if (sscanf(&name[usb_mon_prefix_len], "%d", &n) == 0)
+			if (sscanf(&name[USBMON_DEV_PREFIX_LEN], "%d", &n) == 0)
 				continue;	/* failed */
 
 			ret = usb_dev_add(devlistp, n, err_str);
@@ -512,7 +500,8 @@
 	 * We require 2.6.27 or later kernels, so we have binary-mode support.
 	 * Try to open the binary interface.
 	 */
-	snprintf(full_path, USB_LINE_LEN, LINUX_USB_MON_DEV"%d", handlep->bus_index);
+	snprintf(full_path, USB_LINE_LEN, "/dev/"USBMON_DEV_PREFIX"%d",
+	    handlep->bus_index);
 	handle->fd = open(full_path, O_RDONLY, 0);
 	if (handle->fd < 0)
 	{
@@ -532,13 +521,23 @@
 			 * doesn't exist (no "scan all buses"
 			 * device if the bus index is 0, no
 			 * such bus if the bus index isn't 0).
+			 *
+			 * For now, don't provide an error message;
+			 * if we can determine what the particular
+			 * problem is, we should report that.
 			 */
+			handle->errbuf[0] = '\0';
 			return PCAP_ERROR_NO_SUCH_DEVICE;
 
 		case EACCES:
 			/*
 			 * We didn't have permission to open it.
 			 */
+DIAG_OFF_FORMAT_TRUNCATION
+			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+			    "Attempt to open %s failed with EACCES - root privileges may be required",
+			    full_path);
+DIAG_ON_FORMAT_TRUNCATION
 			return PCAP_ERROR_PERM_DENIED;
 
 		default:
@@ -758,6 +757,7 @@
 	struct mon_bin_mfetch fetch;
 	int32_t vec[VEC_SIZE];
 	struct pcap_pkthdr pkth;
+	u_char *bp;
 	pcap_usb_header_mmapped* hdr;
 	int nflush = 0;
 	int packets = 0;
@@ -767,13 +767,40 @@
 
 	for (;;) {
 		int i, ret;
-		int limit = max_packets - packets;
-		if (limit <= 0)
-			limit = VEC_SIZE;
-		if (limit > VEC_SIZE)
-			limit = VEC_SIZE;
+		int limit;
 
-		/* try to fetch as many events as possible*/
+		if (PACKET_COUNT_IS_UNLIMITED(max_packets)) {
+			/*
+			 * There's no limit on the number of packets
+			 * to process, so try to fetch VEC_SIZE packets.
+			 */
+			limit = VEC_SIZE;
+		} else {
+			/*
+			 * Try to fetch as many packets as we have left
+			 * to process, or VEC_SIZE packets, whichever
+			 * is less.
+			 *
+			 * At this point, max_packets > 0 (otherwise,
+			 * PACKET_COUNT_IS_UNLIMITED(max_packets)
+			 * would be true) and max_packets > packets
+			 * (packet starts out as 0, and the test
+			 * at the bottom of the loop exits if
+			 * max_packets <= packets), so limit is
+			 * guaranteed to be > 0.
+			 */
+			limit = max_packets - packets;
+			if (limit > VEC_SIZE)
+				limit = VEC_SIZE;
+		}
+
+		/*
+		 * Try to fetch as many events as possible, up to
+		 * the limit, and flush the events we've processed
+		 * earlier (nflush) - MON_IOCX_MFETCH does both
+		 * (presumably to reduce the number of system
+		 * calls in loops like this).
+		 */
 		fetch.offvec = vec;
 		fetch.nfetch = limit;
 		fetch.nflush = nflush;
@@ -800,8 +827,27 @@
 		/* keep track of processed events, we will flush them later */
 		nflush = fetch.nfetch;
 		for (i=0; i<fetch.nfetch; ++i) {
+			/*
+			 * XXX - we can't check break_loop here, as
+			 * we read the indices of packets into a
+			 * local variable, so if we're later called
+			 * to fetch more packets, those packets will
+			 * not be seen - and won't be flushed, either.
+			 *
+			 * Instead, we would have to keep the array
+			 * of indices in our private data, along
+			 * with the count of packets to flush - or
+			 * would have to flush the already-processed
+			 * packets if we break out of the loop here.
+			 */
+
+			/* Get a pointer to this packet's buffer */
+			bp = &handlep->mmapbuf[vec[i]];
+
+			/* That begins with a metadata header */
+			hdr = (pcap_usb_header_mmapped*) bp;
+
 			/* discard filler */
-			hdr = (pcap_usb_header_mmapped*) &handlep->mmapbuf[vec[i]];
 			if (hdr->event_type == '@')
 				continue;
 
@@ -846,6 +892,13 @@
 				 */
 				pkth.len = sizeof(pcap_usb_header_mmapped) +
 				    (hdr->ndesc * sizeof (usb_isodesc)) + hdr->urb_len;
+
+				/*
+				 * Now clean it up if it's a completion
+				 * event for an incoming isochronous
+				 * transfer.
+				 */
+				fix_linux_usb_mmapped_length(&pkth, bp);
 			}
 			pkth.ts.tv_sec = (time_t)hdr->ts_sec;
 			pkth.ts.tv_usec = hdr->ts_usec;
@@ -859,8 +912,12 @@
 			}
 		}
 
-		/* with max_packets specifying "unlimited" we stop after the first chunk*/
-		if (PACKET_COUNT_IS_UNLIMITED(max_packets) || (packets == max_packets))
+		/*
+		 * If max_packets specifiesg "unlimited", we stop after
+		 * the first chunk.
+		 */
+		if (PACKET_COUNT_IS_UNLIMITED(max_packets) ||
+		    (packets >= max_packets))
 			break;
 	}
 
diff --git a/pcap-util.c b/pcap-util.c
new file mode 100644
index 0000000..8b5669e
--- /dev/null
+++ b/pcap-util.c
@@ -0,0 +1,474 @@
+/*
+ * Copyright (c) 1993, 1994, 1995, 1996, 1997
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * pcap-common.c - common code for pcap and pcapng files
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <pcap-types.h>
+
+#include "pcap-int.h"
+#include "extract.h"
+#include "pcap-usb-linux-common.h"
+
+#include "pcap-util.h"
+
+#include "pflog.h"
+#include "pcap/can_socketcan.h"
+#include "pcap/sll.h"
+#include "pcap/usb.h"
+#include "pcap/nflog.h"
+
+/*
+ * Most versions of the DLT_PFLOG pseudo-header have UID and PID fields
+ * that are saved in host byte order.
+ *
+ * When reading a DLT_PFLOG packet, we need to convert those fields from
+ * the byte order of the host that wrote the file to this host's byte
+ * order.
+ */
+static void
+swap_pflog_header(const struct pcap_pkthdr *hdr, u_char *buf)
+{
+	u_int caplen = hdr->caplen;
+	u_int length = hdr->len;
+	u_int pfloghdr_length;
+	struct pfloghdr *pflhdr = (struct pfloghdr *)buf;
+
+	if (caplen < (u_int) (offsetof(struct pfloghdr, uid) + sizeof pflhdr->uid) ||
+	    length < (u_int) (offsetof(struct pfloghdr, uid) + sizeof pflhdr->uid)) {
+		/* Not enough data to have the uid field */
+		return;
+	}
+
+	pfloghdr_length = pflhdr->length;
+
+	if (pfloghdr_length < (u_int) (offsetof(struct pfloghdr, uid) + sizeof pflhdr->uid)) {
+		/* Header doesn't include uid field */
+		return;
+	}
+	pflhdr->uid = SWAPLONG(pflhdr->uid);
+
+	if (caplen < (u_int) (offsetof(struct pfloghdr, pid) + sizeof pflhdr->pid) ||
+	    length < (u_int) (offsetof(struct pfloghdr, pid) + sizeof pflhdr->pid)) {
+		/* Not enough data to have the pid field */
+		return;
+	}
+	if (pfloghdr_length < (u_int) (offsetof(struct pfloghdr, pid) + sizeof pflhdr->pid)) {
+		/* Header doesn't include pid field */
+		return;
+	}
+	pflhdr->pid = SWAPLONG(pflhdr->pid);
+
+	if (caplen < (u_int) (offsetof(struct pfloghdr, rule_uid) + sizeof pflhdr->rule_uid) ||
+	    length < (u_int) (offsetof(struct pfloghdr, rule_uid) + sizeof pflhdr->rule_uid)) {
+		/* Not enough data to have the rule_uid field */
+		return;
+	}
+	if (pfloghdr_length < (u_int) (offsetof(struct pfloghdr, rule_uid) + sizeof pflhdr->rule_uid)) {
+		/* Header doesn't include rule_uid field */
+		return;
+	}
+	pflhdr->rule_uid = SWAPLONG(pflhdr->rule_uid);
+
+	if (caplen < (u_int) (offsetof(struct pfloghdr, rule_pid) + sizeof pflhdr->rule_pid) ||
+	    length < (u_int) (offsetof(struct pfloghdr, rule_pid) + sizeof pflhdr->rule_pid)) {
+		/* Not enough data to have the rule_pid field */
+		return;
+	}
+	if (pfloghdr_length < (u_int) (offsetof(struct pfloghdr, rule_pid) + sizeof pflhdr->rule_pid)) {
+		/* Header doesn't include rule_pid field */
+		return;
+	}
+	pflhdr->rule_pid = SWAPLONG(pflhdr->rule_pid);
+}
+
+/*
+ * DLT_LINUX_SLL packets with a protocol type of LINUX_SLL_P_CAN or
+ * LINUX_SLL_P_CANFD have SocketCAN headers in front of the payload,
+ * with the CAN ID being in host byte order.
+ *
+ * When reading a DLT_LINUX_SLL packet, we need to check for those
+ * packets and convert the CAN ID from the byte order of the host that
+ * wrote the file to this host's byte order.
+ */
+static void
+swap_linux_sll_header(const struct pcap_pkthdr *hdr, u_char *buf)
+{
+	u_int caplen = hdr->caplen;
+	u_int length = hdr->len;
+	struct sll_header *shdr = (struct sll_header *)buf;
+	uint16_t protocol;
+	pcap_can_socketcan_hdr *chdr;
+
+	if (caplen < (u_int) sizeof(struct sll_header) ||
+	    length < (u_int) sizeof(struct sll_header)) {
+		/* Not enough data to have the protocol field */
+		return;
+	}
+
+	protocol = EXTRACT_BE_U_2(&shdr->sll_protocol);
+	if (protocol != LINUX_SLL_P_CAN && protocol != LINUX_SLL_P_CANFD)
+		return;
+
+	/*
+	 * SocketCAN packet; fix up the packet's header.
+	 */
+	chdr = (pcap_can_socketcan_hdr *)(buf + sizeof(struct sll_header));
+	if (caplen < (u_int) sizeof(struct sll_header) + sizeof(chdr->can_id) ||
+	    length < (u_int) sizeof(struct sll_header) + sizeof(chdr->can_id)) {
+		/* Not enough data to have the CAN ID */
+		return;
+	}
+	chdr->can_id = SWAPLONG(chdr->can_id);
+}
+
+/*
+ * The same applies for DLT_LINUX_SLL2.
+ */
+static void
+swap_linux_sll2_header(const struct pcap_pkthdr *hdr, u_char *buf)
+{
+	u_int caplen = hdr->caplen;
+	u_int length = hdr->len;
+	struct sll2_header *shdr = (struct sll2_header *)buf;
+	uint16_t protocol;
+	pcap_can_socketcan_hdr *chdr;
+
+	if (caplen < (u_int) sizeof(struct sll2_header) ||
+	    length < (u_int) sizeof(struct sll2_header)) {
+		/* Not enough data to have the protocol field */
+		return;
+	}
+
+	protocol = EXTRACT_BE_U_2(&shdr->sll2_protocol);
+	if (protocol != LINUX_SLL_P_CAN && protocol != LINUX_SLL_P_CANFD)
+		return;
+
+	/*
+	 * SocketCAN packet; fix up the packet's header.
+	 */
+	chdr = (pcap_can_socketcan_hdr *)(buf + sizeof(struct sll2_header));
+	if (caplen < (u_int) sizeof(struct sll2_header) + sizeof(chdr->can_id) ||
+	    length < (u_int) sizeof(struct sll2_header) + sizeof(chdr->can_id)) {
+		/* Not enough data to have the CAN ID */
+		return;
+	}
+	chdr->can_id = SWAPLONG(chdr->can_id);
+}
+
+/*
+ * The DLT_USB_LINUX and DLT_USB_LINUX_MMAPPED headers are in host
+ * byte order when capturing (it's supplied directly from a
+ * memory-mapped buffer shared by the kernel).
+ *
+ * When reading a DLT_USB_LINUX or DLT_USB_LINUX_MMAPPED packet, we
+ * need to convert it from the byte order of the host that wrote the
+ * file to this host's byte order.
+ */
+static void
+swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf,
+    int header_len_64_bytes)
+{
+	pcap_usb_header_mmapped *uhdr = (pcap_usb_header_mmapped *)buf;
+	bpf_u_int32 offset = 0;
+
+	/*
+	 * "offset" is the offset *past* the field we're swapping;
+	 * we skip the field *before* checking to make sure
+	 * the captured data length includes the entire field.
+	 */
+
+	/*
+	 * The URB id is a totally opaque value; do we really need to
+	 * convert it to the reading host's byte order???
+	 */
+	offset += 8;			/* skip past id */
+	if (hdr->caplen < offset)
+		return;
+	uhdr->id = SWAPLL(uhdr->id);
+
+	offset += 4;			/* skip past various 1-byte fields */
+
+	offset += 2;			/* skip past bus_id */
+	if (hdr->caplen < offset)
+		return;
+	uhdr->bus_id = SWAPSHORT(uhdr->bus_id);
+
+	offset += 2;			/* skip past various 1-byte fields */
+
+	offset += 8;			/* skip past ts_sec */
+	if (hdr->caplen < offset)
+		return;
+	uhdr->ts_sec = SWAPLL(uhdr->ts_sec);
+
+	offset += 4;			/* skip past ts_usec */
+	if (hdr->caplen < offset)
+		return;
+	uhdr->ts_usec = SWAPLONG(uhdr->ts_usec);
+
+	offset += 4;			/* skip past status */
+	if (hdr->caplen < offset)
+		return;
+	uhdr->status = SWAPLONG(uhdr->status);
+
+	offset += 4;			/* skip past urb_len */
+	if (hdr->caplen < offset)
+		return;
+	uhdr->urb_len = SWAPLONG(uhdr->urb_len);
+
+	offset += 4;			/* skip past data_len */
+	if (hdr->caplen < offset)
+		return;
+	uhdr->data_len = SWAPLONG(uhdr->data_len);
+
+	if (uhdr->transfer_type == URB_ISOCHRONOUS) {
+		offset += 4;			/* skip past s.iso.error_count */
+		if (hdr->caplen < offset)
+			return;
+		uhdr->s.iso.error_count = SWAPLONG(uhdr->s.iso.error_count);
+
+		offset += 4;			/* skip past s.iso.numdesc */
+		if (hdr->caplen < offset)
+			return;
+		uhdr->s.iso.numdesc = SWAPLONG(uhdr->s.iso.numdesc);
+	} else
+		offset += 8;			/* skip USB setup header */
+
+	/*
+	 * With the old header, there are no isochronous descriptors
+	 * after the header.
+	 *
+	 * With the new header, the actual number of descriptors in
+	 * the header is not s.iso.numdesc, it's ndesc - only the
+	 * first N descriptors, for some value of N, are put into
+	 * the header, and ndesc is set to the actual number copied.
+	 * In addition, if s.iso.numdesc is negative, no descriptors
+	 * are captured, and ndesc is set to 0.
+	 */
+	if (header_len_64_bytes) {
+		/*
+		 * This is either the "version 1" header, with
+		 * 16 bytes of additional fields at the end, or
+		 * a "version 0" header from a memory-mapped
+		 * capture, with 16 bytes of zeroed-out padding
+		 * at the end.  Byte swap them as if this were
+		 * a "version 1" header.
+		 */
+		offset += 4;			/* skip past interval */
+		if (hdr->caplen < offset)
+			return;
+		uhdr->interval = SWAPLONG(uhdr->interval);
+
+		offset += 4;			/* skip past start_frame */
+		if (hdr->caplen < offset)
+			return;
+		uhdr->start_frame = SWAPLONG(uhdr->start_frame);
+
+		offset += 4;			/* skip past xfer_flags */
+		if (hdr->caplen < offset)
+			return;
+		uhdr->xfer_flags = SWAPLONG(uhdr->xfer_flags);
+
+		offset += 4;			/* skip past ndesc */
+		if (hdr->caplen < offset)
+			return;
+		uhdr->ndesc = SWAPLONG(uhdr->ndesc);
+
+		if (uhdr->transfer_type == URB_ISOCHRONOUS) {
+			/* swap the values in struct linux_usb_isodesc */
+			usb_isodesc *pisodesc;
+			uint32_t i;
+
+			pisodesc = (usb_isodesc *)(void *)(buf+offset);
+			for (i = 0; i < uhdr->ndesc; i++) {
+				offset += 4;		/* skip past status */
+				if (hdr->caplen < offset)
+					return;
+				pisodesc->status = SWAPLONG(pisodesc->status);
+
+				offset += 4;		/* skip past offset */
+				if (hdr->caplen < offset)
+					return;
+				pisodesc->offset = SWAPLONG(pisodesc->offset);
+
+				offset += 4;		/* skip past len */
+				if (hdr->caplen < offset)
+					return;
+				pisodesc->len = SWAPLONG(pisodesc->len);
+
+				offset += 4;		/* skip past padding */
+
+				pisodesc++;
+			}
+		}
+	}
+}
+
+/*
+ * The DLT_NFLOG "packets" have a mixture of big-endian and host-byte-order
+ * data.  They begin with a fixed-length header with big-endian fields,
+ * followed by a set of TLVs, where the type and length are in host
+ * byte order but the values are either big-endian or are a raw byte
+ * sequence that's the same regardless of the host's byte order.
+ *
+ * When reading a DLT_NFLOG packet, we need to convert the type and
+ * length values from the byte order of the host that wrote the file
+ * to the byte order of this host.
+ */
+static void
+swap_nflog_header(const struct pcap_pkthdr *hdr, u_char *buf)
+{
+	u_char *p = buf;
+	nflog_hdr_t *nfhdr = (nflog_hdr_t *)buf;
+	nflog_tlv_t *tlv;
+	u_int caplen = hdr->caplen;
+	u_int length = hdr->len;
+	uint16_t size;
+
+	if (caplen < (u_int) sizeof(nflog_hdr_t) ||
+	    length < (u_int) sizeof(nflog_hdr_t)) {
+		/* Not enough data to have any TLVs. */
+		return;
+	}
+
+	if (nfhdr->nflog_version != 0) {
+		/* Unknown NFLOG version */
+		return;
+	}
+
+	length -= sizeof(nflog_hdr_t);
+	caplen -= sizeof(nflog_hdr_t);
+	p += sizeof(nflog_hdr_t);
+
+	while (caplen >= sizeof(nflog_tlv_t)) {
+		tlv = (nflog_tlv_t *) p;
+
+		/* Swap the type and length. */
+		tlv->tlv_type = SWAPSHORT(tlv->tlv_type);
+		tlv->tlv_length = SWAPSHORT(tlv->tlv_length);
+
+		/* Get the length of the TLV. */
+		size = tlv->tlv_length;
+		if (size % 4 != 0)
+			size += 4 - size % 4;
+
+		/* Is the TLV's length less than the minimum? */
+		if (size < sizeof(nflog_tlv_t)) {
+			/* Yes. Give up now. */
+			return;
+		}
+
+		/* Do we have enough data for the full TLV? */
+		if (caplen < size || length < size) {
+			/* No. */
+			return;
+		}
+
+		/* Skip over the TLV. */
+		length -= size;
+		caplen -= size;
+		p += size;
+	}
+}
+
+static void
+swap_pseudo_headers(int linktype, struct pcap_pkthdr *hdr, u_char *data)
+{
+	/*
+	 * Convert pseudo-headers from the byte order of
+	 * the host on which the file was saved to our
+	 * byte order, as necessary.
+	 */
+	switch (linktype) {
+
+	case DLT_PFLOG:
+		swap_pflog_header(hdr, data);
+		break;
+
+	case DLT_LINUX_SLL:
+		swap_linux_sll_header(hdr, data);
+		break;
+
+	case DLT_LINUX_SLL2:
+		swap_linux_sll2_header(hdr, data);
+		break;
+
+	case DLT_USB_LINUX:
+		swap_linux_usb_header(hdr, data, 0);
+		break;
+
+	case DLT_USB_LINUX_MMAPPED:
+		swap_linux_usb_header(hdr, data, 1);
+		break;
+
+	case DLT_NFLOG:
+		swap_nflog_header(hdr, data);
+		break;
+	}
+}
+
+void
+pcap_post_process(int linktype, int swapped, struct pcap_pkthdr *hdr,
+    u_char *data)
+{
+	if (swapped)
+		swap_pseudo_headers(linktype, hdr, data);
+
+	fixup_pcap_pkthdr(linktype, hdr, data);
+}
+
+void
+fixup_pcap_pkthdr(int linktype, struct pcap_pkthdr *hdr, const u_char *data)
+{
+	const pcap_usb_header_mmapped *usb_hdr;
+
+	usb_hdr = (const pcap_usb_header_mmapped *) data;
+	if (linktype == DLT_USB_LINUX_MMAPPED &&
+	    hdr->caplen >= sizeof (pcap_usb_header_mmapped)) {
+		/*
+		 * In older versions of libpcap, in memory-mapped captures,
+		 * the "on-the-bus length" for completion events for
+		 * incoming isochronous transfers was miscalculated; it
+		 * needed to be calculated based on the* offsets and lengths
+		 * in the descriptors, not on the raw URB length, but it
+		 * wasn't.
+		 *
+		 * If this packet contains transferred data (yes, data_flag
+		 * is 0 if we *do* have data), and the total on-the-network
+		 * length is equal to the value calculated from the raw URB
+		 * length, then it might be one of those transfers.
+		 *
+		 * We only do this if we have the full USB pseudo-header.
+		 */
+		if (!usb_hdr->data_flag &&
+		    hdr->len == sizeof(pcap_usb_header_mmapped) +
+		      (usb_hdr->ndesc * sizeof (usb_isodesc)) + usb_hdr->urb_len) {
+			/*
+			 * It might need fixing; fix it if it's a completion
+			 * event for an incoming isochronous transfer.
+			 */
+			fix_linux_usb_mmapped_length(hdr, data);
+		}
+	}
+}
diff --git a/pcap-util.h b/pcap-util.h
new file mode 100644
index 0000000..de95819
--- /dev/null
+++ b/pcap-util.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1993, 1994, 1995, 1996, 1997
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * pcap-util.h - common code for various files
+ */
+
+/*
+ * We use the "receiver-makes-right" approach to byte order;
+ * because time is at a premium when we are writing the file.
+ * In other words, the pcap_file_header and pcap_pkthdr,
+ * records are written in host byte order.
+ * Note that the bytes of packet data are written out in the order in
+ * which they were received, so multi-byte fields in packets are not
+ * written in host byte order, they're written in whatever order the
+ * sending machine put them in.
+ *
+ * We also use this for fixing up packet data headers from a remote
+ * capture, where the server may have a different byte order from the
+ * client.
+ *
+ * ntoh[ls] aren't sufficient because we might need to swap on a big-endian
+ * machine (if the file was written in little-end order).
+ */
+#define	SWAPLONG(y) \
+    (((((u_int)(y))&0xff)<<24) | \
+     ((((u_int)(y))&0xff00)<<8) | \
+     ((((u_int)(y))&0xff0000)>>8) | \
+     ((((u_int)(y))>>24)&0xff))
+#define	SWAPSHORT(y) \
+     ((u_short)(((((u_int)(y))&0xff)<<8) | \
+                ((((u_int)(y))&0xff00)>>8)))
+
+extern void pcap_post_process(int linktype, int swapped,
+    struct pcap_pkthdr *hdr, u_char *data);
+
+extern void fixup_pcap_pkthdr(int linktype, struct pcap_pkthdr *hdr,
+    const u_char *data);
+
diff --git a/pcap.3pcap.in b/pcap.3pcap.in
index 492c227..e98932d 100644
--- a/pcap.3pcap.in
+++ b/pcap.3pcap.in
@@ -272,7 +272,7 @@
 come from different sources that can have different resolutions or that
 can have different relationships to the time values for the current time
 supplied by routines on the native operating system.  See
-.BR pcap-tstamp (@MAN_MISC_INFO@)
+.BR \%pcap-tstamp (@MAN_MISC_INFO@)
 for a list of time stamp types.
 .IP
 The time stamp type is set with
@@ -720,7 +720,7 @@
 will return a pointer to a
 .B struct timeval
 whose value can be used as a timeout in those routines.  When the
-routine returns, an attmept should be made to read packets from the
+routine returns, an attempt should be made to read packets from the
 device.  If
 .BR pcap_get_required_select_timeout ()
 returns
@@ -784,17 +784,17 @@
 attempt to get a descriptor for a
 .B pcap_t
 that can be used in calls such as
-.BR select (2)
+.BR select ()
 and
-.BR poll (2)
+.BR poll ()
 .TP
 .BR pcap_get_required_select_timeout (3PCAP)
 attempt to get a timeout required for using a
 .B pcap_t
 in calls such as
-.BR select (2)
+.BR select ()
 and
-.BR poll (2)
+.BR poll ()
 .RE
 .SS Filters
 In order to cause only certain packets to be returned when reading
@@ -804,7 +804,7 @@
 .PP
 A filter can be specified as a text string; the syntax and semantics of
 the string are as described by
-.BR pcap-filter (@MAN_MISC_INFO@).
+.BR \%pcap-filter (@MAN_MISC_INFO@).
 A filter string is compiled into a program in a pseudo-machine-language
 by
 .BR pcap_compile ()
@@ -894,13 +894,19 @@
 .BR pcap_dump_open (3PCAP)
 open a
 .B pcap_dumper_t
-for a ``savefile``, given a pathname
+for a ``savefile``, given a pathname, replacing any existing data
+.TP
+.BR pcap_dump_open_append (3PCAP)
+open a
+.B pcap_dumper_t
+for a ``savefile``, given a pathname, appending to the existing data
 .TP
 .BR pcap_dump_fopen (3PCAP)
 open a
 .B pcap_dumper_t
 for a ``savefile``, given a
-.B "FILE\ *"
+.BR "FILE\ *" ,
+assuming an empty file
 .TP
 .BR pcap_dump_close (3PCAP)
 close a
@@ -1027,7 +1033,7 @@
 .BR autoconf (1),
 .BR tcpdump (1),
 .BR tcpslice (1),
-.BR pcap-filter (@MAN_MISC_INFO@),
+.BR \%pcap-filter (@MAN_MISC_INFO@),
 .BR pfconfig (8),
 .BR usermod (@MAN_ADMIN_COMMANDS@)
 .SH AUTHORS
@@ -1044,7 +1050,7 @@
 .I https://www.tcpdump.org/
 .RE
 .SH BUGS
-To report a security issue please send an e-mail to security@tcpdump.org.
+To report a security issue please send an e-mail to \%security@tcpdump.org.
 .LP
 To report bugs and other problems, contribute patches, request a
 feature, provide generic feedback etc please see the file
diff --git a/pcap.c b/pcap.c
index ed8570a..ef1bbb7 100644
--- a/pcap.c
+++ b/pcap.c
@@ -131,8 +131,6 @@
 
 #ifdef _WIN32
 /*
- * DllMain(), required when built as a Windows DLL.
- *
  * To quote the WSAStartup() documentation:
  *
  *   The WSAStartup function typically leads to protocol-specific helper
@@ -147,19 +145,12 @@
  *   be called from the DllMain function in a application DLL. This can
  *   potentially cause deadlocks.
  *
- * So we don't initialize Winsock here.  pcap_init() should be called
- * to initialize pcap on both UN*X and Windows; it will initialize
- * Winsock on Windows.  (It will also be initialized as needed if
- * pcap_init() hasn't been called.)
+ * So we don't initialize Winsock in a DllMain() routine.
+ *
+ * pcap_init() should be called to initialize pcap on both UN*X and
+ * Windows; it will initialize Winsock on Windows.  (It will also be
+ * initialized as needed if pcap_init() hasn't been called.)
  */
-BOOL WINAPI DllMain(
-  HANDLE hinstDLL _U_,
-  DWORD dwReason _U_,
-  LPVOID lpvReserved _U_
-)
-{
-	return (TRUE);
-}
 
 /*
  * Start Winsock.
@@ -259,7 +250,7 @@
 			if (pcap_utf_8_mode) {
 				snprintf(errbuf, PCAP_ERRBUF_SIZE,
 				    "Multiple pcap_init calls with different character encodings");
-				return (-1);
+				return (PCAP_ERROR);
 			}
 		}
 		break;
@@ -270,7 +261,7 @@
 			if (!pcap_utf_8_mode) {
 				snprintf(errbuf, PCAP_ERRBUF_SIZE,
 				    "Multiple pcap_init calls with different character encodings");
-				return (-1);
+				return (PCAP_ERROR);
 			}
 		}
 		pcap_utf_8_mode = 1;
@@ -278,7 +269,7 @@
 
 	default:
 		snprintf(errbuf, PCAP_ERRBUF_SIZE, "Unknown options specified");
-		return (-1);
+		return (PCAP_ERROR);
 	}
 
 	/*
@@ -303,7 +294,7 @@
 	 */
 	if (internal_wsockinit(errbuf) == -1) {
 		/* Failed. */
-		return (-1);
+		return (PCAP_ERROR);
 	}
 #endif
 
@@ -622,7 +613,9 @@
 		 * Return codes for pcap_offline_read() are:
 		 *   -  0: EOF
 		 *   - -1: error
-		 *   - >1: OK
+		 *   - >0: OK - result is number of packets read, so
+		 *         it will be 1 in this case, as we've passed
+		 *         a maximum packet count of 1
 		 * The first one ('0') conflicts with the return code of
 		 * 0 from pcap_read() meaning "no packets arrived before
 		 * the timeout expired", so we map it to -2 so you can
@@ -641,7 +634,9 @@
 	 *   -  0: timeout
 	 *   - -1: error
 	 *   - -2: loop was broken out of with pcap_breakloop()
-	 *   - >1: OK
+	 *   - >0: OK, result is number of packets captured, so
+	 *         it will be 1 in this case, as we've passed
+	 *         a maximum packet count of 1
 	 * The first one ('0') conflicts with the return code of 0 from
 	 * pcap_offline_read() meaning "end of file".
 	*/
@@ -2849,17 +2844,41 @@
 		goto fail;
 	return (p);
 fail:
-	if (status == PCAP_ERROR)
+	if (status == PCAP_ERROR) {
+		/*
+		 * Another buffer is a bit cumbersome, but it avoids
+		 * -Wformat-truncation.
+		 */
+		char trimbuf[PCAP_ERRBUF_SIZE - 5]; /* 2 bytes shorter */
+
+		pcap_strlcpy(trimbuf, p->errbuf, sizeof(trimbuf));
 		snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %.*s", device,
-		    PCAP_ERRBUF_SIZE - 3, p->errbuf);
-	else if (status == PCAP_ERROR_NO_SUCH_DEVICE ||
+		    PCAP_ERRBUF_SIZE - 3, trimbuf);
+	} else if (status == PCAP_ERROR_NO_SUCH_DEVICE ||
 	    status == PCAP_ERROR_PERM_DENIED ||
-	    status == PCAP_ERROR_PROMISC_PERM_DENIED)
-		snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s (%.*s)", device,
-		    pcap_statustostr(status), PCAP_ERRBUF_SIZE - 6, p->errbuf);
-	else
+	    status == PCAP_ERROR_PROMISC_PERM_DENIED) {
+		/*
+		 * Only show the additional message if it's not
+		 * empty.
+		 */
+		if (p->errbuf[0] != '\0') {
+			/*
+			 * Idem.
+			 */
+			char trimbuf[PCAP_ERRBUF_SIZE - 8]; /* 2 bytes shorter */
+
+			pcap_strlcpy(trimbuf, p->errbuf, sizeof(trimbuf));
+			snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s (%.*s)",
+			    device, pcap_statustostr(status),
+			    PCAP_ERRBUF_SIZE - 6, trimbuf);
+		} else {
+			snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
+			    device, pcap_statustostr(status));
+		}
+	} else {
 		snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", device,
 		    pcap_statustostr(status));
+	}
 	pcap_close(p);
 	return (NULL);
 }
@@ -3350,7 +3369,7 @@
         if (description != NULL) {
                 return description;
         } else {
-                (void)snprintf(unkbuf, sizeof(unkbuf), "DLT %u", dlt);
+                (void)snprintf(unkbuf, sizeof(unkbuf), "DLT %d", dlt);
                 return unkbuf;
         }
 }
@@ -3461,14 +3480,14 @@
 		/*
 		 * This is a bogus and now-deprecated API; we
 		 * squelch the narrowing warning for the cast
-		 * from HANDLE to DWORD.  If Windows programmmers
+		 * from HANDLE to intptr_t.  If Windows programmmers
 		 * need to get at the HANDLE for a pcap_t, *if*
 		 * there is one, they should request such a
 		 * routine (and be prepared for it to return
 		 * INVALID_HANDLE_VALUE).
 		 */
 DIAG_OFF_NARROWING
-		return ((int)(DWORD)p->handle);
+		return ((int)(intptr_t)p->handle);
 DIAG_ON_NARROWING
 	} else
 		return (PCAP_ERROR);
@@ -3644,7 +3663,7 @@
 		return ("That operation is supported only in monitor mode");
 
 	case PCAP_ERROR_PERM_DENIED:
-		return ("You don't have permission to capture on that device");
+		return ("You don't have permission to perform this capture on that device");
 
 	case PCAP_ERROR_IFACE_NOT_UP:
 		return ("That device is not up");
@@ -3986,6 +4005,10 @@
 void
 pcap_cleanup_live_common(pcap_t *p)
 {
+	if (p->opt.device != NULL) {
+		free(p->opt.device);
+		p->opt.device = NULL;
+	}
 	if (p->buffer != NULL) {
 		free(p->buffer);
 		p->buffer = NULL;
@@ -4064,14 +4087,12 @@
 void
 pcap_close(pcap_t *p)
 {
-	if (p->opt.device != NULL)
-		free(p->opt.device);
 	p->cleanup_op(p);
 	free(p);
 }
 
 /*
- * Helpers for safely loding code at run time.
+ * Helpers for safely loading code at run time.
  * Currently Windows-only.
  */
 #ifdef _WIN32
@@ -4180,6 +4201,20 @@
 	return (-1);
 }
 
+static void
+pcap_breakloop_dead(pcap_t *p _U_)
+{
+	/*
+	 * A "dead" pcap_t is just a placeholder to use in order to
+	 * compile a filter to BPF code or to open a savefile for
+	 * writing.  It doesn't support any operations, including
+	 * capturing or reading packets, so there will never be a
+	 * get-packets loop in progress to break out *of*.
+	 *
+	 * As such, this routine doesn't need to do anything.
+	 */
+}
+
 static int
 pcap_inject_dead(pcap_t *p, const void *buf _U_, int size _U_)
 {
@@ -4393,6 +4428,7 @@
 	p->live_dump_ended_op = pcap_live_dump_ended_dead;
 	p->get_airpcap_handle_op = pcap_get_airpcap_handle_dead;
 #endif
+	p->breakloop_op = pcap_breakloop_dead;
 	p->cleanup_op = pcap_cleanup_dead;
 
 	/*
diff --git a/pcap/bpf.h b/pcap/bpf.h
index 54373af..a8eb177 100644
--- a/pcap/bpf.h
+++ b/pcap/bpf.h
@@ -80,7 +80,6 @@
 #define lib_pcap_bpf_h
 
 #include <pcap/funcattrs.h>
-
 #include <pcap/dlt.h>
 
 #ifdef __cplusplus
diff --git a/pcap/can_socketcan.h b/pcap/can_socketcan.h
index 332d9ff..0cb3584 100644
--- a/pcap/can_socketcan.h
+++ b/pcap/can_socketcan.h
@@ -48,9 +48,14 @@
 typedef struct {
 	uint32_t can_id;
 	uint8_t payload_length;
-	uint8_t pad;
+	uint8_t fd_flags;
 	uint8_t reserved1;
 	uint8_t reserved2;
 } pcap_can_socketcan_hdr;
 
+/* Bits in the fd_flags field */
+#define CANFD_BRS   0x01 /* bit rate switch (second bitrate for payload data) */
+#define CANFD_ESI   0x02 /* error state indicator of the transmitting node */
+#define CANFD_FDF   0x04 /* mark CAN FD for dual use of CAN format */
+
 #endif
diff --git a/pcap/compiler-tests.h b/pcap/compiler-tests.h
index a69c2b0..2d98a70 100644
--- a/pcap/compiler-tests.h
+++ b/pcap/compiler-tests.h
@@ -80,9 +80,11 @@
  */
 
 #if ! defined(__GNUC__)
-#define PCAP_IS_AT_LEAST_GNUC_VERSION(major, minor) 0
+  /* Not GCC and not "just like GCC" */
+  #define PCAP_IS_AT_LEAST_GNUC_VERSION(major, minor) 0
 #else
-#define PCAP_IS_AT_LEAST_GNUC_VERSION(major, minor) \
+  /* GCC or "just like GCC" */
+  #define PCAP_IS_AT_LEAST_GNUC_VERSION(major, minor) \
 	(__GNUC__ > (major) || \
 	 (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
 #endif
@@ -92,9 +94,11 @@
  */
 
 #if !defined(__clang__)
-#define PCAP_IS_AT_LEAST_CLANG_VERSION(major, minor) 0
+  /* Not Clang */
+  #define PCAP_IS_AT_LEAST_CLANG_VERSION(major, minor) 0
 #else
-#define PCAP_IS_AT_LEAST_CLANG_VERSION(major, minor) \
+  /* Clang */
+  #define PCAP_IS_AT_LEAST_CLANG_VERSION(major, minor) \
 	(__clang_major__ > (major) || \
 	 (__clang_major__ == (major) && __clang_minor__ >= (minor)))
 #endif
@@ -118,13 +122,15 @@
  */
 
 #if ! defined(__SUNPRO_C)
-#define PCAP_IS_AT_LEAST_SUNC_VERSION(major,minor) 0
+  /* Not Sun/Oracle C */
+  #define PCAP_IS_AT_LEAST_SUNC_VERSION(major,minor) 0
 #else
-#define PCAP_SUNPRO_VERSION_TO_BCD(major, minor) \
+  /* Sun/Oracle C */
+  #define PCAP_SUNPRO_VERSION_TO_BCD(major, minor) \
 	(((minor) >= 10) ? \
 	    (((major) << 12) | (((minor)/10) << 8) | (((minor)%10) << 4)) : \
 	    (((major) << 8) | ((minor) << 4)))
-#define PCAP_IS_AT_LEAST_SUNC_VERSION(major,minor) \
+  #define PCAP_IS_AT_LEAST_SUNC_VERSION(major,minor) \
 	(__SUNPRO_C >= PCAP_SUNPRO_VERSION_TO_BCD((major), (minor)))
 #endif
 
@@ -133,13 +139,31 @@
  *
  * The version number in __xlC__ has the major version in the
  * upper 8 bits and the minor version in the lower 8 bits.
+ * On AIX __xlC__ is always defined, __ibmxl__ becomes defined in XL C 16.1.
+ * On Linux since XL C 13.1.6 __xlC__ is not defined by default anymore, but
+ * __ibmxl__ is defined since at least XL C 13.1.1.
  */
 
-#if ! defined(__xlC__)
-#define PCAP_IS_AT_LEAST_XL_C_VERSION(major,minor) 0
+#if ! defined(__xlC__) && ! defined(__ibmxl__)
+  /* Not XL C */
+  #define PCAP_IS_AT_LEAST_XL_C_VERSION(major,minor) 0
 #else
-#define PCAP_IS_AT_LEAST_XL_C_VERSION(major, minor) \
+  /* XL C */
+  #if defined(__ibmxl__)
+    /*
+     * Later Linux version of XL C; use __ibmxl_version__ to test
+     * the version.
+     */
+    #define PCAP_IS_AT_LEAST_XL_C_VERSION(major, minor) \
+	(__ibmxl_version__ > (major) || \
+	 (__ibmxl_version__ == (major) && __ibmxl_release__ >= (minor)))
+  #else /* __ibmxl__ */
+    /*
+     * __ibmxl__ not defined; use __xlC__ to test the version.
+     */
+    #define PCAP_IS_AT_LEAST_XL_C_VERSION(major, minor) \
 	(__xlC__ >= (((major) << 8) | (minor)))
+  #endif /* __ibmxl__ */
 #endif
 
 /*
@@ -154,9 +178,11 @@
  */
 
 #if ! defined(__HP_aCC)
-#define PCAP_IS_AT_LEAST_HP_C_VERSION(major,minor) 0
+  /* Not HP C */
+  #define PCAP_IS_AT_LEAST_HP_C_VERSION(major,minor) 0
 #else
-#define PCAP_IS_AT_LEAST_HP_C_VERSION(major,minor) \
+  /* HP C */
+  #define PCAP_IS_AT_LEAST_HP_C_VERSION(major,minor) \
 	(__HP_aCC >= ((major)*10000 + (minor)*100))
 #endif
 
diff --git a/pcap/dlt.h b/pcap/dlt.h
index eaba34f..ea8a5ba 100644
--- a/pcap/dlt.h
+++ b/pcap/dlt.h
@@ -105,6 +105,67 @@
 #endif
 
 /*
+ * NetBSD uses 15 for HIPPI.
+ *
+ * From a quick look at sys/net/if_hippi.h and sys/net/if_hippisubr.c
+ * in an older version of NetBSD , the header appears to be:
+ *
+ * 	a 1-byte ULP field (ULP-id)?
+ *
+ *	a 1-byte flags field;
+ *
+ *	a 2-byte "offsets" field;
+ *
+ *	a 4-byte "D2 length" field (D2_Size?);
+ *
+ *	a 4-byte "destination switch" field (or a 1-byte field
+ *	containing the Forwarding Class, Double_Wide, and Message_Type
+ *	sub fields, followed by a 3-byte Destination_Switch_Address
+ *	field?, HIPPI-LE 3.4-style?);
+ *
+ *	a 4-byte "source switch" field (or a 1-byte field containing the
+ *	Destination_Address_type and Source_Address_Type fields, followed
+ *	by a 3-byte Source_Switch_Address field, HIPPI-LE 3.4-style?);
+ *
+ *	a 2-byte reserved field;
+ *
+ *	a 6-byte destination address field;
+ *
+ *	a 2-byte "local admin" field;
+ *
+ *	a 6-byte source address field;
+ *
+ * followed by an 802.2 LLC header.
+ *
+ * This looks somewhat like something derived from the HIPPI-FP 4.4
+ * Header_Area, followed an HIPPI-FP 4.4 D1_Area containing a D1 data set
+ * with the header in HIPPI-LE 3.4 (ANSI X3.218-1993), followed by an
+ * HIPPI-FP 4.4 D2_Area (with no Offset) containing the 802.2 LLC header
+ * and payload?  Or does the "offsets" field contain the D2_Offset,
+ * with that many bytes of offset before the payload?
+ *
+ * See http://wotug.org/parallel/standards/hippi/ for an archive of
+ * HIPPI specifications.
+ *
+ * RFC 2067 imposes some additional restrictions.  It says that the
+ * Offset is always zero
+ *
+ * HIPPI is long-gone, and the source files found in an older version
+ * of NetBSD don't appear to be in the main CVS branch, so we may never
+ * see a capture with this link-layer type.
+ */
+#if defined(__NetBSD__)
+#define DLT_HIPPI	15	/* HIPPI */
+#endif
+
+/*
+ * NetBSD uses 16 for DLT_HDLC; see below.
+ * BSD/OS uses it for PPP; see above.
+ * As far as I know, no other OS uses it for anything; don't use it
+ * for anything else.
+ */
+
+/*
  * 17 was used for DLT_PFLOG in OpenBSD; it no longer is.
  *
  * It was DLT_LANE8023 in SuSE 6.3, so we defined LINKTYPE_PFLOG
@@ -219,7 +280,8 @@
  * that the AF_ type in the link-layer header is in network byte order.
  *
  * DLT_LOOP is 12 in OpenBSD, but that's DLT_RAW in other OSes, so
- * we don't use 12 for it in OSes other than OpenBSD.
+ * we don't use 12 for it in OSes other than OpenBSD; instead, we
+ * use the same value as LINKTYPE_LOOP.
  */
 #ifdef __OpenBSD__
 #define DLT_LOOP	12
@@ -230,7 +292,7 @@
 /*
  * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's
  * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other
- * than OpenBSD.
+ * than OpenBSD; instead, we use the same value as LINKTYPE_ENC.
  */
 #ifdef __OpenBSD__
 #define DLT_ENC		13
@@ -239,13 +301,23 @@
 #endif
 
 /*
- * Values between 110 and 112 are reserved for use in capture file headers
+ * Values 110 and 111 are reserved for use in capture file headers
  * as link-layer types corresponding to DLT_ types that might differ
  * between platforms; don't use those values for new DLT_ types
  * other than the corresponding DLT_ types.
  */
 
 /*
+ * NetBSD uses 16 for (Cisco) "HDLC framing".  For other platforms,
+ * we define it to have the same value as LINKTYPE_NETBSD_HDLC.
+ */
+#if defined(__NetBSD__)
+#define DLT_HDLC	16	/* Cisco HDLC */
+#else
+#define DLT_HDLC	112
+#endif
+
+/*
  * Linux cooked sockets.
  */
 #define DLT_LINUX_SLL	113
@@ -651,7 +723,7 @@
  * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
  * Every frame contains a 32bit A429 label.
  * More documentation on Arinc 429 can be found at
- * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
+ * https://web.archive.org/web/20040616233302/https://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
  */
 #define DLT_A429                184
 
@@ -1214,15 +1286,17 @@
 #define DLT_BLUETOOTH_LE_LL	251
 
 /*
- * DLT type for upper-protocol layer PDU saves from wireshark.
+ * DLT type for upper-protocol layer PDU saves from Wireshark.
  *
- * the actual contents are determined by two TAGs stored with each
- * packet:
- *   EXP_PDU_TAG_LINKTYPE          the link type (LINKTYPE_ value) of the
- *				   original packet.
+ * the actual contents are determined by two TAGs, one or more of
+ * which is stored with each packet:
  *
- *   EXP_PDU_TAG_PROTO_NAME        the name of the wireshark dissector
- * 				   that can make sense of the data stored.
+ *   EXP_PDU_TAG_DISSECTOR_NAME      the name of the Wireshark dissector
+ * 				     that can make sense of the data stored.
+ *
+ *   EXP_PDU_TAG_HEUR_DISSECTOR_NAME the name of the Wireshark heuristic
+ *				     dissector that can make sense of the
+ *				     data stored.
  */
 #define DLT_WIRESHARK_UPPER_PDU	252
 
diff --git a/pcap/funcattrs.h b/pcap/funcattrs.h
index a2ca542..3740949 100644
--- a/pcap/funcattrs.h
+++ b/pcap/funcattrs.h
@@ -118,14 +118,14 @@
     #if PCAP_IS_AT_LEAST_GNUC_VERSION(3,4) \
         || PCAP_IS_AT_LEAST_XL_C_VERSION(12,0)
       /*
-       * GCC 3.4 or later, or some compiler asserting compatibility with
-       * GCC 3.4 or later, or XL C 13.0 or later, so we have
+       * GCC 3.4 and later, or some compiler asserting compatibility with
+       * GCC 3.4 and later, or XL C 13.0 and later, so we have
        * __attribute__((visibility()).
        */
       #define PCAP_API_DEF	__attribute__((visibility("default")))
     #elif PCAP_IS_AT_LEAST_SUNC_VERSION(5,5)
       /*
-       * Sun C 5.5 or later, so we have __global.
+       * Sun C 5.5 and later, so we have __global.
        * (Sun C 5.9 and later also have __attribute__((visibility()),
        * but there's no reason to prefer it with Sun C.)
        */
@@ -161,6 +161,15 @@
  * provided by Apple, so each release can come with a version compiled
  * to use the APIs present in that release.)
  *
+ * The non-macOS versioning is based on
+ *
+ *    https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
+ *
+ * If there are any corrections, please submit it upstream to the
+ * libpcap maintainers, preferably as a pull request on
+ *
+ *    https://github.com/the-tcpdump-group/libpcap
+ *
  * We don't define it ourselves because, if you're building and
  * installing libpcap on macOS yourself, the APIs will be available
  * no matter what OS version you're installing it on.
@@ -172,25 +181,32 @@
  * I've never seen earlier releases.
  */
 #ifdef __APPLE__
-#define PCAP_AVAILABLE_MACOS(v)	/* define to say "first appears in v" */
-#define PCAP_AVAILABLE_0_4	PCAP_AVAILABLE_MACOS(10.0) /* Did any version of Mac OS X ship with this? */
-#define PCAP_AVAILABLE_0_5	PCAP_AVAILABLE_MACOS(10.0) /* Did any version of Mac OS X ship with this? */
-#define PCAP_AVAILABLE_0_6	PCAP_AVAILABLE_MACOS(10.1)
-#define PCAP_AVAILABLE_0_7	PCAP_AVAILABLE_MACOS(10.4)
-#define PCAP_AVAILABLE_0_8	PCAP_AVAILABLE_MACOS(10.4)
-#define PCAP_AVAILABLE_0_9	PCAP_AVAILABLE_MACOS(10.5)
-#define PCAP_AVAILABLE_1_0	PCAP_AVAILABLE_MACOS(10.6)
+#include <Availability.h>
+/*
+ * When building as part of macOS, define this as __API_AVAILABLE(__VA_ARGS__).
+ *
+ * XXX - if there's some #define to indicate that this is being built
+ * as part of the macOS build process, we could make that Just Work.
+ */
+#define PCAP_AVAILABLE(...)
+#define PCAP_AVAILABLE_0_4	PCAP_AVAILABLE(macos(10.0)) /* Did any version of Mac OS X ship with this? */
+#define PCAP_AVAILABLE_0_5	PCAP_AVAILABLE(macos(10.0)) /* Did any version of Mac OS X ship with this? */
+#define PCAP_AVAILABLE_0_6	PCAP_AVAILABLE(macos(10.1))
+#define PCAP_AVAILABLE_0_7	PCAP_AVAILABLE(macos(10.4))
+#define PCAP_AVAILABLE_0_8	PCAP_AVAILABLE(macos(10.4))
+#define PCAP_AVAILABLE_0_9	PCAP_AVAILABLE(macos(10.5), ios(1.0))
+#define PCAP_AVAILABLE_1_0	PCAP_AVAILABLE(macos(10.6), ios(4.0))
 /* #define PCAP_AVAILABLE_1_1	no routines added to the API */
-#define PCAP_AVAILABLE_1_2	PCAP_AVAILABLE_MACOS(10.9)
+#define PCAP_AVAILABLE_1_2	PCAP_AVAILABLE(macos(10.9), ios(6.0))
 /* #define PCAP_AVAILABLE_1_3	no routines added to the API */
 /* #define PCAP_AVAILABLE_1_4	no routines added to the API */
-#define PCAP_AVAILABLE_1_5	PCAP_AVAILABLE_MACOS(10.10)
+#define PCAP_AVAILABLE_1_5	PCAP_AVAILABLE(macos(10.10), ios(7.0), watchos(1.0))
 /* #define PCAP_AVAILABLE_1_6	no routines added to the API */
-#define PCAP_AVAILABLE_1_7	PCAP_AVAILABLE_MACOS(10.12)
-#define PCAP_AVAILABLE_1_8	PCAP_AVAILABLE_MACOS(10.13) /* only Windows adds routines to the API; XXX - what version first had it? */
-#define PCAP_AVAILABLE_1_9	PCAP_AVAILABLE_MACOS(10.13)
+#define PCAP_AVAILABLE_1_7	PCAP_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0))
+#define PCAP_AVAILABLE_1_8	PCAP_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) /* only Windows adds routines to the API; XXX - what version first had it? */
+#define PCAP_AVAILABLE_1_9	PCAP_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0))
 #define PCAP_AVAILABLE_1_10	/* not in macOS yet */
-#define PCAP_AVAILABLE_1_11	/* not released yet, so not in macOS yet */ 
+#define PCAP_AVAILABLE_1_11	/* not released yet, so not in macOS yet */
 #else /* __APPLE__ */
 #define PCAP_AVAILABLE_0_4
 #define PCAP_AVAILABLE_0_5
@@ -230,11 +246,11 @@
     || PCAP_IS_AT_LEAST_XL_C_VERSION(10,1) \
     || PCAP_IS_AT_LEAST_HP_C_VERSION(6,10)
   /*
-   * Compiler with support for __attribute((noreturn)), or GCC 2.5 or
-   * later, or some compiler asserting compatibility with GCC 2.5 or
-   * later, or Solaris Studio 12 (Sun C 5.9) or later, or IBM XL C 10.1
-   * or later (do any earlier versions of XL C support this?), or HP aCC
-   * A.06.10 or later.
+   * Compiler with support for __attribute((noreturn)), or GCC 2.5 and
+   * later, or some compiler asserting compatibility with GCC 2.5 and
+   * later, or Solaris Studio 12 (Sun C 5.9) and later, or IBM XL C 10.1
+   * and later (do any earlier versions of XL C support this?), or HP aCC
+   * A.06.10 and later.
    */
   #define PCAP_NORETURN __attribute((noreturn))
   #define PCAP_NORETURN_DEF __attribute((noreturn))
@@ -260,8 +276,8 @@
     || PCAP_IS_AT_LEAST_XL_C_VERSION(10,1) \
     || PCAP_IS_AT_LEAST_HP_C_VERSION(6,10)
   /*
-   * Compiler with support for it, or GCC 2.3 or later, or some compiler
-   * asserting compatibility with GCC 2.3 or later, or IBM XL C 10.1
+   * Compiler with support for it, or GCC 2.3 and later, or some compiler
+   * asserting compatibility with GCC 2.3 and later, or IBM XL C 10.1
    * and later (do any earlier versions of XL C support this?),
    * or HP aCC A.06.10 and later.
    */
@@ -274,23 +290,21 @@
  * PCAP_DEPRECATED(func, msg), after a function declaration, marks the
  * function as deprecated.
  *
- * The first argument is the name of the function; the second argument is
- * a string giving the warning message to use if the compiler supports that.
- *
- * (Thank you, Microsoft, for requiring the function name.)
+ * The argument is a string giving the warning message to use if the
+ * compiler supports that.
  */
 #if __has_attribute(deprecated) \
     || PCAP_IS_AT_LEAST_GNUC_VERSION(4,5) \
     || PCAP_IS_AT_LEAST_SUNC_VERSION(5,13)
   /*
    * Compiler that supports __has_attribute and __attribute__((deprecated)),
-   * or GCC 4.5 or later, or Sun/Oracle C 12.4 (Sun C 5.13) or later.
+   * or GCC 4.5 and later, or Sun/Oracle C 12.4 (Sun C 5.13) and later.
    *
    * Those support __attribute__((deprecated(msg))) (we assume, perhaps
    * incorrectly, that anything that supports __has_attribute() is
    * recent enough to support __attribute__((deprecated(msg)))).
    */
-  #define PCAP_DEPRECATED(func, msg)	__attribute__((deprecated(msg)))
+  #define PCAP_DEPRECATED(msg)	__attribute__((deprecated(msg)))
 #elif PCAP_IS_AT_LEAST_GNUC_VERSION(3,1)
   /*
    * GCC 3.1 through 4.4.
@@ -298,18 +312,18 @@
    * Those support __attribute__((deprecated)) but not
    * __attribute__((deprecated(msg))).
    */
-  #define PCAP_DEPRECATED(func, msg)	__attribute__((deprecated))
+  #define PCAP_DEPRECATED(msg)	__attribute__((deprecated))
 #elif defined(_MSC_VER) && !defined(BUILDING_PCAP)
   /*
    * MSVC, and we're not building libpcap itself; it's VS 2015
-   * or later, so we have the deprecated pragma.
+   * and later, so we have __declspec(deprecated(...)).
    *
    * If we *are* building libpcap, we don't want this, as it'll warn
    * us even if we *define* the function.
    */
-  #define PCAP_DEPRECATED(func, msg)	__pragma(deprecated(func))
+  #define PCAP_DEPRECATED(msg)	_declspec(deprecated(msg))
 #else
-  #define PCAP_DEPRECATED(func, msg)
+  #define PCAP_DEPRECATED(msg)
 #endif
 
 /*
diff --git a/pcap/namedb.h b/pcap/namedb.h
index 34a0ae7..51d1e31 100644
--- a/pcap/namedb.h
+++ b/pcap/namedb.h
@@ -59,8 +59,9 @@
 PCAP_API u_char *pcap_ether_hostton(const char*);
 PCAP_API u_char *pcap_ether_aton(const char *);
 
-PCAP_API bpf_u_int32 **pcap_nametoaddr(const char *)
-PCAP_DEPRECATED(pcap_nametoaddr, "this is not reentrant; use 'pcap_nametoaddrinfo' instead");
+PCAP_API
+PCAP_DEPRECATED("this is not reentrant; use 'pcap_nametoaddrinfo' instead")
+bpf_u_int32 **pcap_nametoaddr(const char *);
 PCAP_API struct addrinfo *pcap_nametoaddrinfo(const char *);
 PCAP_API bpf_u_int32 pcap_nametonetaddr(const char *);
 
diff --git a/pcap/pcap-inttypes.h b/pcap/pcap-inttypes.h
index 1cfa0bf..8c7b4f6 100644
--- a/pcap/pcap-inttypes.h
+++ b/pcap/pcap-inttypes.h
@@ -32,8 +32,8 @@
 #define pcap_pcap_inttypes_h
 
 /*
- * If we're compiling with Visual Studio, make sure we have at least
- * VS 2015 or later, so we have sufficient C99 support.
+ * If we're compiling with Visual Studio, make sure the C99 integer
+ * types are defined, by hook or by crook.
  *
  * XXX - verify that we have at least C99 support on UN*Xes?
  *
@@ -42,39 +42,60 @@
  */
 #if defined(_MSC_VER)
   /*
-   * Compiler is MSVC.  Make sure we have VS 2015 or later.
+   * Compiler is MSVC.
    */
-  #if _MSC_VER < 1900
-    #error "Building libpcap requires VS 2015 or later"
+  #if _MSC_VER >= 1800
+    /*
+     * VS 2013 or newer; we have <inttypes.h>.
+     */
+    #include <inttypes.h>
+  #else
+    /*
+     * Earlier VS; we have to define this stuff ourselves.
+     * We don't support building libpcap with earlier versions of VS,
+     * but SDKs for Npcap have to support building applications using
+     * earlier versions of VS, so we work around this by defining
+     * those types ourselves, as some files use them.
+     */
+    typedef unsigned char uint8_t;
+    typedef signed char int8_t;
+    typedef unsigned short uint16_t;
+    typedef signed short int16_t;
+    typedef unsigned int uint32_t;
+    typedef signed int int32_t;
+    #ifdef _MSC_EXTENSIONS
+      typedef unsigned _int64 uint64_t;
+      typedef _int64 int64_t;
+    #else /* _MSC_EXTENSIONS */
+      typedef unsigned long long uint64_t;
+      typedef long long int64_t;
+    #endif
   #endif
-#endif
+#else /* defined(_MSC_VER) */
+  /*
+   * Not Visual Studio.
+   * Include <inttypes.h> to get the integer types and PRi[doux]64 values
+   * defined.
+   *
+   * If the compiler is MinGW, we assume we have <inttypes.h> - and
+   * support for %zu in the formatted printing functions.
+   *
+   * If the target is UN*X, we assume we have a C99-or-later development
+   * environment, and thus have <inttypes.h> - and support for %zu in
+   * the formatted printing functions.
+   *
+   * If the target is MS-DOS, we assume we have <inttypes.h> - and support
+   * for %zu in the formatted printing functions.
+   *
+   * I.e., assume we have <inttypes.h> and that it suffices.
+   */
 
-/*
- * Include <inttypes.h> to get the integer types and PRi[doux]64 values
- * defined.
- *
- * If the compiler is MSVC, we require VS 2015 or newer, so we
- * have <inttypes.h> - and support for %zu in the formatted
- * printing functions.
- *
- * If the compiler is MinGW, we assume we have <inttypes.h> - and
- * support for %zu in the formatted printing functions.
- *
- * If the target is UN*X, we assume we have a C99-or-later development
- * environment, and thus have <inttypes.h> - and support for %zu in
- * the formatted printing functions.
- *
- * If the target is MS-DOS, we assume we have <inttypes.h> - and support
- * for %zu in the formatted printing functions.
- *
- * I.e., assume we have <inttypes.h> and that it suffices.
- */
+  /*
+   * XXX - somehow make sure we have enough C99 support with other
+   * compilers and support libraries?
+   */
 
-/*
- * XXX - somehow make sure we have enough C99 support with other
- * compilers and support libraries?
- */
-
-#include <inttypes.h>
+  #include <inttypes.h>
+#endif /* defined(_MSC_VER) */
 
 #endif /* pcap/pcap-inttypes.h */
diff --git a/pcap/pcap.h b/pcap/pcap.h
index 8182bef..9fd14f5 100644
--- a/pcap/pcap.h
+++ b/pcap/pcap.h
@@ -71,7 +71,7 @@
 
 /*
  * Some software that uses libpcap/WinPcap/Npcap defines _MSC_VER before
- * includeing pcap.h if it's not defined - and it defines it to 1500.
+ * including pcap.h if it's not defined - and it defines it to 1500.
  * (I'm looking at *you*, lwIP!)
  *
  * Attempt to detect this, and undefine _MSC_VER so that we can *reliably*
@@ -391,8 +391,8 @@
  * should use pcap_findalldevs() and use the first device.
  */
 PCAP_AVAILABLE_0_4
-PCAP_API char	*pcap_lookupdev(char *)
-PCAP_DEPRECATED(pcap_lookupdev, "use 'pcap_findalldevs' and use the first device");
+PCAP_DEPRECATED("use 'pcap_findalldevs' and use the first device")
+PCAP_API char	*pcap_lookupdev(char *);
 
 PCAP_AVAILABLE_0_4
 PCAP_API int	pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);
@@ -614,6 +614,7 @@
 	    bpf_u_int32);
 
 PCAP_AVAILABLE_0_5
+PCAP_DEPRECATED("use pcap_open_dead(), pcap_compile() and pcap_close()")
 PCAP_API int	pcap_compile_nopcap(int, int, struct bpf_program *,
 	    const char *, int, bpf_u_int32);
 
@@ -680,8 +681,8 @@
  * a Windows-only pcap_handle() API that returns the HANDLE.
  */
 PCAP_AVAILABLE_0_4
-PCAP_API int	pcap_fileno(pcap_t *)
-PCAP_DEPRECATED(pcap_fileno, "use 'pcap_handle'");
+PCAP_DEPRECATED("request a 'pcap_handle' that returns a HANDLE if you need it")
+PCAP_API int	pcap_fileno(pcap_t *);
 #else /* _WIN32 */
 PCAP_AVAILABLE_0_4
 PCAP_API int	pcap_fileno(pcap_t *);
@@ -878,7 +879,7 @@
 /*
  * The formats allowed by pcap_open() are the following:
  * - file://path_and_filename [opens a local file]
- * - rpcap://devicename [opens the selected device devices available on the local host, without using the RPCAP protocol]
+ * - rpcap://devicename [opens the selected device available on the local host, without using the RPCAP protocol]
  * - rpcap://host/devicename [opens the selected device available on a remote host]
  * - rpcap://host:port/devicename [opens the selected device available on a remote host, using a non-standard port for RPCAP]
  * - adaptername [to open a local adapter; kept for compatibility, but it is strongly discouraged]
@@ -1013,10 +1014,11 @@
  * authentication is successful (and the user has the right to open network
  * devices) the RPCAP connection will continue; otherwise it will be dropped.
  *
- * *******NOTE********: the username and password are sent over the network
- * to the capture server *IN CLEAR TEXT*.  Don't use this on a network
- * that you don't completely control!  (And be *really* careful in your
- * definition of "completely"!)
+ * *******NOTE********: unless TLS is being used, the username and password
+ * are sent over the network to the capture server *IN CLEAR TEXT*.  Don't
+ * use this, without TLS (i.e., with rpcap:// rather than rpcaps://) on
+ * a network that you don't completely control!  (And be *really* careful
+ * in your definition of "completely"!)
  */
 #define RPCAP_RMTAUTH_PWD 1
 
diff --git a/pcap_breakloop.3pcap b/pcap_breakloop.3pcap
index 996290f..3cd74db 100644
--- a/pcap_breakloop.3pcap
+++ b/pcap_breakloop.3pcap
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_BREAKLOOP 3PCAP "25 July 2018"
+.TH PCAP_BREAKLOOP 3PCAP "8 December 2022"
 .SH NAME
 pcap_breakloop \- force a pcap_dispatch() or pcap_loop() call to return
 .SH SYNOPSIS
@@ -39,11 +39,23 @@
 to return rather than looping; they will return the number of packets
 that have been processed so far, or
 .B PCAP_ERROR_BREAK
-if no packets have been processed so far.
+if no packets have been processed so far.  If the loop is currently
+blocked waiting for packets to arrive,
+.BR pcap_breakloop ()
+will also, on some platforms, wake up the thread that is blocked.  In
+this version of libpcap, the only platforms on which a wakeup is caused
+by
+.BR pcap_breakloop ()
+are Linux and Windows, and the wakeup will only be caused when capturing
+on network interfaces; it will not be caused on other operating systems,
+and will not be caused on any OS when capturing on other types of
+devices.
 .PP
 This routine is safe to use inside a signal handler on UNIX or a console
-control handler on Windows, as it merely sets a flag that is checked
-within the loop.
+control handler on Windows, or in a thread other than the one in which
+the loop is running, as it merely sets a flag that is checked within the
+loop and, on some platforms, performs a signal-safe and thread-safe API
+call.
 .PP
 The flag is checked in loops reading packets from the OS - a signal by
 itself will not necessarily terminate those loops - as well as in loops
@@ -61,23 +73,37 @@
 .PP
 .ft B
 Note also that, in a multi-threaded application, if one thread is
-blocked in pcap_dispatch(), pcap_loop(), pcap_next(3PCAP), or pcap_next_ex(3PCAP),
-a call to pcap_breakloop() in a different thread will not unblock that
-thread.
+blocked in pcap_dispatch(), pcap_loop(), pcap_next(3PCAP), or
+pcap_next_ex(3PCAP), a call to pcap_breakloop() in a different thread
+will only unblock that thread on the platforms and capture devices
+listed above.
+.PP
+If a non-zero packet buffer timeout is set on the
+.BR pcap_t ,
+and you are capturing on a network interface, the thread will be
+unblocked with the timeout expires.  This is not guaranteed to happen
+unless at least one packet has arrived; the only platforms on which it
+happens are macOS, the BSDs, Solaris 11, AIX, Tru64 UNIX, and Windows.
+.PP
+If you want to ensure that the loop will eventually be unblocked on any
+other platforms, or unblocked when capturing on a device other than a
+network interface, you will need to use whatever mechanism the OS
+provides for breaking a thread out of blocking calls in order to unblock
+the thread, such as thread cancellation or thread signalling in systems
+that support POSIX threads.
 .ft R
-You will need to use whatever mechanism the OS provides for
-breaking a thread out of blocking calls in order to unblock the thread,
-such as thread cancellation or thread signalling in systems that support
-POSIX threads, or
-.BR SetEvent ()
-on the result of
-.BR pcap_getevent ()
-on a
-.B pcap_t
-on which the thread is blocked on Windows.  Asynchronous procedure calls
-will not work on Windows, as a thread blocked on a
-.B pcap_t
-will not be in an alertable state.
+.PP
+.ft B
+Note that if pcap_breakloop() unblocks the thread capturing packets, and
+you are running on a platform that supports packet buffering, there may
+be packets in the buffer that arrived before pcap_breakloop() were
+called but that weren't yet provided to libpcap, those packets will not
+have been processed by pcap_dispatch() or pcap_loop().  If
+pcap_breakloop() was called in order to terminate the capture process,
+then, in order to process those packets, you would have to call
+pcap_dispatch() one time in order to process the last batch of packets.
+This may block until the packet buffer timeout expires, so a non-zero
+packet buffer timeout must be used.
 .ft R
 .PP
 Note that
@@ -111,5 +137,12 @@
 subsequent call will return
 .B PCAP_ERROR_BREAK
 and clear the flag.
+.SH BACKWARD COMPATIBILITY
+.PP
+This function became available in libpcap release 0.8.1.
+.PP
+In releases prior to libpcap 1.10.0,
+.BR pcap_breakloop ()
+will not wake up a blocked thread on any platform.
 .SH SEE ALSO
 .BR pcap (3PCAP)
diff --git a/pcap_compile.3pcap.in b/pcap_compile.3pcap.in
index 8238e54..67001fa 100644
--- a/pcap_compile.3pcap.in
+++ b/pcap_compile.3pcap.in
@@ -37,9 +37,9 @@
 is used to compile the string
 .I str
 into a filter program.  See
-.BR pcap-filter (@MAN_MISC_INFO@)
+.BR \%pcap-filter (@MAN_MISC_INFO@)
 for the syntax of that string.
-.I program
+.I fp
 is a pointer to a
 .I bpf_program
 struct and is filled in by
diff --git a/pcap_datalink_val_to_name.3pcap b/pcap_datalink_val_to_name.3pcap
index bbfa3f8..4179095 100644
--- a/pcap_datalink_val_to_name.3pcap
+++ b/pcap_datalink_val_to_name.3pcap
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_DATALINK_VAL_TO_NAME 3PCAP "15 April 2019"
+.TH PCAP_DATALINK_VAL_TO_NAME 3PCAP "4 May 2022"
 .SH NAME
 pcap_datalink_val_to_name, pcap_datalink_val_to_description,
 pcap_datalink_val_to_description_or_dlt \- get a
@@ -66,7 +66,7 @@
 .SH BACKWARD COMPATIBILITY
 The
 .BR pcap_datalink_val_to_description_or_dlt ()
-function first became available in libpcap release 1.10.0.  In previous
+function first became available in libpcap release 1.9.1.  In previous
 releases,
 .BR pcap_datalink_val_to_description ()
 would have to be called and, if it returned
diff --git a/pcap_dump_open.3pcap.in b/pcap_dump_open.3pcap.in
index fddecb8..555484f 100644
--- a/pcap_dump_open.3pcap.in
+++ b/pcap_dump_open.3pcap.in
@@ -81,7 +81,7 @@
 precision, link-layer header type, and snapshot length as
 .IR p ,
 it will write new packets at the end of the file.
-.SH RETURN VALUES
+.SH RETURN VALUE
 A pointer to a
 .B pcap_dumper_t
 structure to use in subsequent
diff --git a/pcap_findalldevs.3pcap b/pcap_findalldevs.3pcap
index 41c98fe..0dcc0af 100644
--- a/pcap_findalldevs.3pcap
+++ b/pcap_findalldevs.3pcap
@@ -204,7 +204,9 @@
 on success and
 .B PCAP_ERROR
 on failure; as indicated, finding no
-devices is considered success, rather than failure, so 0 will be
+devices is considered success, rather than failure, so
+.B 0
+will be
 returned in that case. If
 .B PCAP_ERROR
 is returned,
diff --git a/pcap_get_required_select_timeout.3pcap b/pcap_get_required_select_timeout.3pcap
index 0256a6a..37af180 100644
--- a/pcap_get_required_select_timeout.3pcap
+++ b/pcap_get_required_select_timeout.3pcap
@@ -135,10 +135,11 @@
 .BR epoll_wait (),
 and
 .BR kevent ()
-cannot be used on any capture source for which
+could not be used for devices that don't provide a selectable file
+descriptor (in other words, on any capture source for that
 .BR pcap_get_selectable_fd ()
 returns
-.BR \-1 .
+.BR \-1 ).
 .PP
 In libpcap release 1.10.0 and later, the timeout value can change from
 call to call, so
@@ -160,16 +161,6 @@
 or
 .BR kevent ()
 even if the code must also work with libpcap 1.9.x.
-.SH BACKWARD COMPATIBILITY
-This function became available in libpcap release 1.9.0.  In previous
-releases,
-.BR select (),
-.BR poll (),
-.BR epoll_wait (),
-and
-.BR kevent ()
-could not be used for devices that don't provide a selectable file
-descriptor.
 .SH SEE ALSO
 .BR pcap (3PCAP),
 .BR pcap_get_selectable_fd (3PCAP),
diff --git a/pcap_get_tstamp_precision.3pcap.in b/pcap_get_tstamp_precision.3pcap.in
index 7dbb569..4645144 100644
--- a/pcap_get_tstamp_precision.3pcap.in
+++ b/pcap_get_tstamp_precision.3pcap.in
@@ -53,4 +53,4 @@
 .SH SEE ALSO
 .BR pcap (3PCAP),
 .BR pcap_set_tstamp_precision (3PCAP),
-.BR pcap-tstamp (@MAN_MISC_INFO@)
+.BR \%pcap-tstamp (@MAN_MISC_INFO@)
diff --git a/pcap_init.3pcap b/pcap_init.3pcap
index 543f083..a807d0e 100644
--- a/pcap_init.3pcap
+++ b/pcap_init.3pcap
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_INIT 3PCAP "11 April 2020"
+.TH PCAP_INIT 3PCAP "4 May 2022"
 .SH NAME
 pcap_init \- initialize the library
 .SH SYNOPSIS
@@ -80,10 +80,10 @@
 returns
 .B 0
 on success and
-.B \-1
+.B PCAP_ERROR
 on failure.
 If
-.B \-1
+.B PCAP_ERROR
 is returned,
 .I errbuf
 is filled in with an appropriate error message.
@@ -92,7 +92,7 @@
 .B PCAP_ERRBUF_SIZE
 chars.
 .SH BACKWARD COMPATIBILITY
-This function became available in libpcap release 1.10.0.  In previous
+This function became available in libpcap release 1.9.0.  In previous
 releases, on Windows, all strings supplied as arguments, and all strings
 returned to the caller, are in the local character encoding.
 .SH SEE ALSO
diff --git a/pcap_inject.3pcap b/pcap_inject.3pcap
index 6b4554e..83eae1c 100644
--- a/pcap_inject.3pcap
+++ b/pcap_inject.3pcap
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_INJECT 3PCAP "25 July 2018"
+.TH PCAP_INJECT 3PCAP "5 March 2022"
 .SH NAME
 pcap_inject, pcap_sendpacket \- transmit a packet
 .SH SYNOPSIS
@@ -74,16 +74,20 @@
 comes from WinPcap/Npcap.  Both are provided for compatibility.)
 .SH RETURN VALUE
 .BR pcap_inject ()
-returns the number of bytes written on success and
+returns the number of bytes written on success,
+.B PCAP_ERROR_NOT_ACTIVATED
+if called on a capture handle that has been created but not activated, and
 .B PCAP_ERROR
-on failure.
+on other errors.
 .PP
 .BR pcap_sendpacket ()
 returns
 .B 0
-on success and
+on success,
+.B PCAP_ERROR_NOT_ACTIVATED
+if called on a capture handle that has been created but not activated, and
 .B PCAP_ERROR
-on failure.
+on other errors.
 .PP
 If
 .B PCAP_ERROR
diff --git a/pcap_list_tstamp_types.3pcap.in b/pcap_list_tstamp_types.3pcap.in
index 74ef00a..8b6174f 100644
--- a/pcap_list_tstamp_types.3pcap.in
+++ b/pcap_list_tstamp_types.3pcap.in
@@ -42,7 +42,7 @@
 .I *tstamp_typesp
 to point to the array.
 See
-.BR pcap-tstamp (@MAN_MISC_INFO@)
+.BR \%pcap-tstamp (@MAN_MISC_INFO@)
 for a list of all the time stamp types.
 .PP
 The caller is responsible for freeing the array with
@@ -79,4 +79,4 @@
 .SH SEE ALSO
 .BR pcap (3PCAP),
 .BR pcap_tstamp_type_val_to_name (3PCAP),
-.BR pcap-tstamp (@MAN_MISC_INFO@)
+.BR \%pcap-tstamp (@MAN_MISC_INFO@)
diff --git a/pcap_loop.3pcap b/pcap_loop.3pcap
index 3d741ef..0c59526 100644
--- a/pcap_loop.3pcap
+++ b/pcap_loop.3pcap
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_LOOP 3PCAP "22 August 2020"
+.TH PCAP_LOOP 3PCAP "5 March 2022"
 .SH NAME
 pcap_loop, pcap_dispatch \- process packets from a live capture or savefile
 .SH SYNOPSIS
@@ -164,12 +164,15 @@
 .I cnt
 is exhausted or if, when reading from a ``savefile'', no more packets
 are available.  It returns
-.B PCAP_ERROR
-if an error occurs or
 .B PCAP_ERROR_BREAK
 if the loop terminated due to a call to
 .BR pcap_breakloop ()
-before any packets were processed.
+before any packets were processed,
+.B PCAP_ERROR_NOT_ACTIVATED
+if called on a capture handle that has been created but not activated,
+or
+.B PCAP_ERROR
+if another error occurs.
 It does
 .B not
 return when live packet buffer timeouts occur; instead, it attempts to
@@ -184,12 +187,15 @@
 file descriptor for the capture device is in non-blocking mode and no
 packets were available to be read) or if no more packets are available
 in a ``savefile.'' It returns
-.B PCAP_ERROR
-if an error occurs or
 .B PCAP_ERROR_BREAK
 if the loop terminated due to a call to
 .BR pcap_breakloop ()
-before any packets were processed.
+before any packets were processed,
+.B PCAP_ERROR_NOT_ACTIVATED
+if called on a capture handle that has been created but not activated,
+or
+.B PCAP_ERROR
+if another error occurs.
 .ft B
 If your application uses pcap_breakloop(),
 make sure that you explicitly check for PCAP_ERROR and PCAP_ERROR_BREAK,
diff --git a/pcap_next_ex.3pcap b/pcap_next_ex.3pcap
index 2bd1a42..4d2c43e 100644
--- a/pcap_next_ex.3pcap
+++ b/pcap_next_ex.3pcap
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_NEXT_EX 3PCAP "25 July 2018"
+.TH PCAP_NEXT_EX 3PCAP "5 March 2022"
 .SH NAME
 pcap_next_ex, pcap_next \- read the next packet from a pcap_t
 .SH SYNOPSIS
@@ -120,12 +120,15 @@
 .B 0
 if packets are
 being read from a live capture and the packet buffer timeout expired,
-.B PCAP_ERROR
-if an error occurred while reading the packet, and
 .B PCAP_ERROR_BREAK
 if packets
 are being read from a ``savefile'' and there are no more packets to read
-from the savefile.  If
+from the savefile,
+.B PCAP_ERROR_NOT_ACTIVATED
+if called on a capture handle that has been created but not activated,
+or
+.B PCAP_ERROR
+if an error occurred while reading the packet.  If
 .B PCAP_ERROR
 is returned,
 .BR pcap_geterr (3PCAP)
diff --git a/pcap_open_offline.3pcap.in b/pcap_open_offline.3pcap.in
index 5e878fe..e48bf25 100644
--- a/pcap_open_offline.3pcap.in
+++ b/pcap_open_offline.3pcap.in
@@ -50,7 +50,7 @@
 .I fname
 specifies the name of the file to open. The file can have the pcap file
 format as described in
-.BR pcap-savefile (@MAN_FILE_FORMATS@),
+.BR \%pcap-savefile (@MAN_FILE_FORMATS@),
 which is the file format used by, among other programs,
 .BR tcpdump (1)
 and
@@ -114,4 +114,4 @@
 stamps from a savefile are always given in seconds and microseconds.
 .SH SEE ALSO
 .BR pcap (3PCAP),
-.BR pcap-savefile (@MAN_FILE_FORMATS@)
+.BR \%pcap-savefile (@MAN_FILE_FORMATS@)
diff --git a/pcap_set_datalink.3pcap b/pcap_set_datalink.3pcap
index 14e9d20..fd90791 100644
--- a/pcap_set_datalink.3pcap
+++ b/pcap_set_datalink.3pcap
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_SET_DATALINK 3PCAP "25 July 2018"
+.TH PCAP_SET_DATALINK 3PCAP "5 March 2022"
 .SH NAME
 pcap_set_datalink \- set the link-layer header type to be used by a
 capture device
@@ -40,9 +40,11 @@
 .BR pcap_set_datalink ()
 returns
 .B 0
-on success and
+on success,
+.B PCAP_ERROR_NOT_ACTIVATED
+if called on a capture handle that has been created but not activated, or
 .B PCAP_ERROR
-on failure. If
+on other errors. If
 .B PCAP_ERROR
 is returned,
 .BR pcap_geterr (3PCAP)
diff --git a/pcap_set_immediate_mode.3pcap.in b/pcap_set_immediate_mode.3pcap.in
index e493d55..95c9cff 100644
--- a/pcap_set_immediate_mode.3pcap.in
+++ b/pcap_set_immediate_mode.3pcap.in
@@ -70,7 +70,7 @@
 .IP
 on Digital UNIX/Tru64 UNIX, immediate mode must be turned on by doing a
 .B BIOCMBIC
-.BR ioctl ,
+.BR ioctl (),
 as documented in
 .BR packetfilter (7),
 to clear the
diff --git a/pcap_set_tstamp_precision.3pcap.in b/pcap_set_tstamp_precision.3pcap.in
index eb449d5..1889f43 100644
--- a/pcap_set_tstamp_precision.3pcap.in
+++ b/pcap_set_tstamp_precision.3pcap.in
@@ -65,4 +65,4 @@
 .SH SEE ALSO
 .BR pcap (3PCAP),
 .BR pcap_get_tstamp_precision (3PCAP),
-.BR pcap-tstamp (@MAN_MISC_INFO@)
+.BR \%pcap-tstamp (@MAN_MISC_INFO@)
diff --git a/pcap_set_tstamp_type.3pcap.in b/pcap_set_tstamp_type.3pcap.in
index e19d6e5..cd2dc71 100644
--- a/pcap_set_tstamp_type.3pcap.in
+++ b/pcap_set_tstamp_type.3pcap.in
@@ -45,7 +45,7 @@
 will give a list of the time stamp types supported by a given capture
 device.
 See
-.BR pcap-tstamp (@MAN_MISC_INFO@)
+.BR \%pcap-tstamp (@MAN_MISC_INFO@)
 for a list of all the time stamp types.
 .SH RETURN VALUE
 .BR pcap_set_tstamp_type ()
diff --git a/pcap_setdirection.3pcap b/pcap_setdirection.3pcap
index 7b38845..04278e8 100644
--- a/pcap_setdirection.3pcap
+++ b/pcap_setdirection.3pcap
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_SETDIRECTION 3PCAP "25 July 2018"
+.TH PCAP_SETDIRECTION 3PCAP "5 March 2022"
 .SH NAME
 pcap_setdirection \- set the direction for which packets will be captured
 .SH SYNOPSIS
@@ -59,9 +59,11 @@
 .BR pcap_setdirection ()
 returns
 .B 0
-on success and
+on success,
+.B PCAP_ERROR_NOT_ACTIVATED
+if called on a capture handle that has been created but not activated, or
 .B PCAP_ERROR
-on failure. If
+on other errors. If
 .B PCAP_ERROR
 is returned,
 .BR pcap_geterr (3PCAP)
diff --git a/pcap_setfilter.3pcap b/pcap_setfilter.3pcap
index 1e3c5a5..e063ae0 100644
--- a/pcap_setfilter.3pcap
+++ b/pcap_setfilter.3pcap
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_SETFILTER 3PCAP "25 July 2018"
+.TH PCAP_SETFILTER 3PCAP "5 March 2022"
 .SH NAME
 pcap_setfilter \- set the filter
 .SH SYNOPSIS
@@ -42,9 +42,11 @@
 .BR pcap_setfilter ()
 returns
 .B 0
-on success and
+on success,
+.B PCAP_ERROR_NOT_ACTIVATED
+if called on a capture handle that has been created but not activated, or
 .B PCAP_ERROR
-on failure. If
+on other errors.  If
 .B PCAP_ERROR
 is returned,
 .BR pcap_geterr (3PCAP)
diff --git a/pcap_setnonblock.3pcap b/pcap_setnonblock.3pcap
index 65cfea2..1f33647 100644
--- a/pcap_setnonblock.3pcap
+++ b/pcap_setnonblock.3pcap
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_SETNONBLOCK 3PCAP "25 July 2018"
+.TH PCAP_SETNONBLOCK 3PCAP "5 March 2022"
 .SH NAME
 pcap_setnonblock, pcap_getnonblock \- set or get the state of
 non-blocking mode on a capture device
@@ -64,7 +64,7 @@
 .BR pcap_loop (3PCAP)
 will loop forever, consuming CPU time when no packets are currently
 available;
-.BR pacp_dispatch ()
+.BR pcap_dispatch ()
 should be used instead.
 .BR pcap_next (3PCAP)
 will return
@@ -87,7 +87,10 @@
 always returns
 .B 0
 on ``savefiles''.
-If there is an error,
+If called on a capture handle that has been created but not activated,
+.B PCAP_ERROR_NOT_ACTIVATED
+is returned.
+If there is another error,
 .B PCAP_ERROR
 is returned and
 .I errbuf
diff --git a/pcap_stats.3pcap b/pcap_stats.3pcap
index aa03013..98be9bd 100644
--- a/pcap_stats.3pcap
+++ b/pcap_stats.3pcap
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_STATS 3PCAP "25 July 2018"
+.TH PCAP_STATS 3PCAP "5 March 2022"
 .SH NAME
 pcap_stats \- get capture statistics
 .SH SYNOPSIS
@@ -85,9 +85,12 @@
 .BR pcap_stats ()
 returns
 .B 0
-on success and returns
+on success,
+.B PCAP_ERROR_NOT_ACTIVATED
+if called on a capture handle that has been created but not activated,
+or
 .B PCAP_ERROR
-if there is an error or if
+if there is another error or if
 .I p
 doesn't support packet statistics. If
 .B PCAP_ERROR
diff --git a/pflog.h b/pflog.h
new file mode 100644
index 0000000..b49d04f
--- /dev/null
+++ b/pflog.h
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * pflog headers, at least as they exist now.
+ */
+#define PFLOG_IFNAMSIZ		16
+#define PFLOG_RULESET_NAME_SIZE	16
+
+/*
+ * Direction values.
+ */
+#define PF_INOUT	0
+#define PF_IN		1
+#define PF_OUT		2
+#if defined(__OpenBSD__)
+#define PF_FWD		3
+#endif
+
+/*
+ * Reason values.
+ */
+#define PFRES_MATCH	0
+#define PFRES_BADOFF	1
+#define PFRES_FRAG	2
+#define PFRES_SHORT	3
+#define PFRES_NORM	4
+#define PFRES_MEMORY	5
+#define PFRES_TS	6
+#define PFRES_CONGEST	7
+#define PFRES_IPOPTIONS 8
+#define PFRES_PROTCKSUM 9
+#define PFRES_BADSTATE	10
+#define PFRES_STATEINS	11
+#define PFRES_MAXSTATES	12
+#define PFRES_SRCLIMIT	13
+#define PFRES_SYNPROXY	14
+#if defined(__FreeBSD__)
+#define PFRES_MAPFAILED	15
+#elif defined(__NetBSD__)
+#define PFRES_STATELOCKED 15
+#elif defined(__OpenBSD__)
+#define PFRES_TRANSLATE	15
+#define PFRES_NOROUTE	16
+#elif defined(__APPLE__)
+#define PFRES_DUMMYNET  15
+#endif
+
+/*
+ * Action values.
+ */
+#define PF_PASS			0
+#define PF_DROP			1
+#define PF_SCRUB		2
+#define PF_NOSCRUB		3
+#define PF_NAT			4
+#define PF_NONAT		5
+#define PF_BINAT		6
+#define PF_NOBINAT		7
+#define PF_RDR			8
+#define PF_NORDR		9
+#define PF_SYNPROXY_DROP	10
+#if defined(__FreeBSD__)
+#define PF_DEFER		11
+#elif defined(__OpenBSD__)
+#define PF_DEFER		11
+#define PF_MATCH		12
+#define PF_DIVERT		13
+#define PF_RT			14
+#define PF_AFRT			15
+#elif defined(__APPLE__)
+#define PF_DUMMYNET		11
+#define PF_NODUMMYNET		12
+#define PF_NAT64		13
+#define PF_NONAT64		14
+#endif
+
+struct pf_addr {
+	union {
+		struct in_addr		v4;
+		struct in6_addr		v6;
+		uint8_t			addr8[16];
+		uint16_t		addr16[8];
+		uint32_t		addr32[4];
+	} pfa;		    /* 128-bit address */
+#define v4	pfa.v4
+#define v6	pfa.v6
+#define addr8	pfa.addr8
+#define addr16	pfa.addr16
+#define addr32	pfa.addr32
+};
+
+struct pfloghdr {
+	uint8_t		length;
+	uint8_t		af;
+	uint8_t		action;
+	uint8_t		reason;
+	char		ifname[PFLOG_IFNAMSIZ];
+	char		ruleset[PFLOG_RULESET_NAME_SIZE];
+	uint32_t	rulenr;
+	uint32_t	subrulenr;
+	uint32_t	uid;
+	int32_t		pid;
+	uint32_t	rule_uid;
+	int32_t		rule_pid;
+	uint8_t		dir;
+#if defined(__OpenBSD__)
+	uint8_t		rewritten;
+	uint8_t		naf;
+	uint8_t		pad[1];
+#else
+	uint8_t		pad[3];
+#endif
+#if defined(__FreeBSD__)
+	uint32_t	ridentifier;
+	uint8_t		reserve;
+	uint8_t		pad2[3];
+#elif defined(__OpenBSD__)
+	struct pf_addr	saddr;
+	struct pf_addr	daddr;
+	uint16_t	sport;
+	uint16_t	dport;
+#endif
+};
+
+
+
diff --git a/rpcap-protocol.h b/rpcap-protocol.h
index a69cf80..a93b0a8 100644
--- a/rpcap-protocol.h
+++ b/rpcap-protocol.h
@@ -132,10 +132,12 @@
  * XXX - use the C99 types?  Microsoft's newer versions of Visual Studio
  * support them.
  */
+#ifndef __HAIKU__
 typedef unsigned char uint8;	/* 8-bit unsigned integer */
 typedef unsigned short uint16;	/* 16-bit unsigned integer */
 typedef unsigned int uint32;	/* 32-bit unsigned integer */
 typedef int int32;		/* 32-bit signed integer */
+#endif
 
 /* Common header for all the RPCAP messages */
 struct rpcap_header
@@ -155,6 +157,25 @@
  */
 struct rpcap_authreply
 {
+	uint8 minvers;			/* Minimum version supported */
+	uint8 maxvers;			/* Maximum version supported */
+	uint8 pad[2];			/* Pad to 4-byte boundary **/
+	uint32 byte_order_magic;	/* RPCAP_BYTE_ORDER_MAGIC, in server byte order */
+};
+
+/*
+ * Any resemblance between this and the pcap file magic number
+ * is purely coincidental, trust me.
+ */
+#define RPCAP_BYTE_ORDER_MAGIC		0xa1b2c3d4U
+#define RPCAP_BYTE_ORDER_MAGIC_SWAPPED	0xd4c3b2a1U
+
+/*
+ * Older version of authentication reply, without byte order indication
+ * and padding.
+ */
+struct rpcap_authreply_old
+{
 	uint8 minvers;	/* Minimum version supported */
 	uint8 maxvers;	/* Maximum version supported */
 };
diff --git a/rpcapd/CMakeLists.txt b/rpcapd/CMakeLists.txt
index f2bd12d..8b30be3 100644
--- a/rpcapd/CMakeLists.txt
+++ b/rpcapd/CMakeLists.txt
@@ -135,15 +135,32 @@
 
   set(MANFILE_EXPAND rpcapd-config.manfile.in)
 
-  if(NOT MSVC)
-    install(TARGETS rpcapd DESTINATION sbin)
-  else(NOT MSVC)
+  if(WIN32)
+    #
+    # XXX - where should the install target put rpcapd on Windows?
+    #
+    # Note that if an installer package is being produced
+    # from the results of the build, the installer package
+    # will determine where it goes.
+    #
     if(CMAKE_SIZEOF_VOID_P EQUAL 8)
       install(TARGETS rpcapd DESTINATION bin/amd64)
     else(CMAKE_SIZEOF_VOID_P EQUAL 8)
       install(TARGETS rpcapd DESTINATION bin)
     endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
-  endif(NOT MSVC)
+  else(WIN32)
+    #
+    # On UN*X, we put it in the sbin directory.
+    #
+    # XXX - the Linux Filesystem Hierarchy Standard says /usr/sbin
+    # is for daemons, but some other systems use /usr/libexec instead.
+    # However, since some users might, instead of having rpcapd be
+    # launched by inetd/xinetd/launchd/systemd, just run it on a
+    # machine when remote capture is to be done, a case can be made
+    # for the sbin directory even on systems with /usr/libexec.
+    #
+    install(TARGETS rpcapd DESTINATION ${CMAKE_INSTALL_SBINDIR})
+  endif(WIN32)
 
   # On UN*X, and on Windows when not using MSVC, generate process man
   # pages and arrange that they be installed.
diff --git a/rpcapd/daemon.c b/rpcapd/daemon.c
index e2b20a9..9b0f828 100644
--- a/rpcapd/daemon.c
+++ b/rpcapd/daemon.c
@@ -449,7 +449,8 @@
 		if (getpeername(pars.sockctrl, (struct sockaddr *)&from,
 		    &fromlen) == -1)
 		{
-			sock_geterror("getpeername()", errmsgbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(errmsgbuf, PCAP_ERRBUF_SIZE,
+			    "getpeername() failed");
 			if (rpcap_senderror(pars.sockctrl, pars.ssl, 0, PCAP_ERR_NETW, errmsgbuf, errbuf) == -1)
 				rpcapd_log(LOGPRIO_ERROR, "Send to client failed: %s", errbuf);
 			goto end;
@@ -523,7 +524,8 @@
 			retval = select((int)pars.sockctrl + 1, &rfds, NULL, NULL, &tv);
 			if (retval == -1)
 			{
-				sock_geterror("select() failed", errmsgbuf, PCAP_ERRBUF_SIZE);
+				sock_geterrmsg(errmsgbuf, PCAP_ERRBUF_SIZE,
+				    "select() failed");
 				if (rpcap_senderror(pars.sockctrl, pars.ssl, 0, PCAP_ERR_NETW, errmsgbuf, errbuf) == -1)
 					rpcapd_log(LOGPRIO_ERROR, "Send to client failed: %s", errbuf);
 				goto end;
@@ -763,7 +765,8 @@
 #endif
 			if (retval == -1)
 			{
-				sock_geterror("select() failed", errmsgbuf, PCAP_ERRBUF_SIZE);
+				sock_geterrmsg(errmsgbuf, PCAP_ERRBUF_SIZE,
+				    "select() failed");
 				if (rpcap_senderror(pars.sockctrl, pars.ssl,
 				    0, PCAP_ERR_NETW,
 				    errmsgbuf, errbuf) == -1)
@@ -1368,11 +1371,16 @@
 		goto error;
 
 	//
-	// Indicate to our peer what versions we support.
+	// Indicate to our peer what versions we support and what our
+	// version of the byte-order magic is (which will tell the
+	// client whether our byte order differs from theirs, in which
+	// case they will need to byte-swap some fields in some
+	// link-layer types' headers).
 	//
 	memset(authreply, 0, sizeof(struct rpcap_authreply));
 	authreply->minvers = RPCAP_MIN_VERSION;
 	authreply->maxvers = RPCAP_MAX_VERSION;
+	authreply->byte_order_magic = RPCAP_BYTE_ORDER_MAGIC;
 
 	// Send the reply.
 	if (sock_send(pars->sockctrl, pars->ssl, sendbuf, sendbufidx, errbuf, PCAP_ERRBUF_SIZE) == -1)
@@ -1602,7 +1610,6 @@
 	pcap_if_t *alldevs = NULL;		// pointer to the header of the interface chain
 	pcap_if_t *d;				// temp pointer needed to scan the interface chain
 	struct pcap_addr *address;		// pcap structure that keeps a network address of an interface
-	struct rpcap_findalldevs_if *findalldevs_if;// rpcap structure that packet all the data of an interface together
 	uint32 replylen;			// length of reply payload
 	uint16 nif = 0;				// counts the number of interface listed
 
@@ -1703,13 +1710,17 @@
 	{
 		uint16 lname, ldescr;
 
-		findalldevs_if = (struct rpcap_findalldevs_if *) &sendbuf[sendbufidx];
-
-		if (sock_bufferize(NULL, sizeof(struct rpcap_findalldevs_if), NULL,
-		    &sendbufidx, RPCAP_NETBUF_SIZE, SOCKBUF_CHECKONLY, errmsgbuf, PCAP_ERRBUF_SIZE) == -1)
-			goto error;
-
-		memset(findalldevs_if, 0, sizeof(struct rpcap_findalldevs_if));
+		// Note: the findalldevs_if entries are *not* neatly
+		// aligned on 4-byte boundaries, because they're
+		// preceded by strings that aren't padded to 4-byte
+		// boundaries, so we cannot just cast output buffer
+		// boundaries to struct rpcap_findalldevs_if pointers
+		// and store into them - we must fill in a structure and
+		// then copy the structure to the buffer, as not all
+		// systems support unaligned access (some, such as
+		// SPARC, crash; others, such as Arm, may just ignore
+		// the lower-order bits).
+		struct rpcap_findalldevs_if findalldevs_if;
 
 		/*
 		 * We've already established that the string lengths
@@ -1724,10 +1735,11 @@
 		else
 			lname = 0;
 
-		findalldevs_if->desclen = htons(ldescr);
-		findalldevs_if->namelen = htons(lname);
-		findalldevs_if->flags = htonl(d->flags);
+		findalldevs_if.desclen = htons(ldescr);
+		findalldevs_if.namelen = htons(lname);
+		findalldevs_if.flags = htonl(d->flags);
 
+		uint16_t naddrs = 0;
 		for (address = d->addresses; address != NULL; address = address->next)
 		{
 			/*
@@ -1739,14 +1751,20 @@
 #ifdef AF_INET6
 			case AF_INET6:
 #endif
-				findalldevs_if->naddr++;
+				naddrs++;
 				break;
 
 			default:
 				break;
 			}
 		}
-		findalldevs_if->naddr = htons(findalldevs_if->naddr);
+		findalldevs_if.naddr = htons(naddrs);
+		findalldevs_if.dummy = 0;
+
+		if (sock_bufferize(&findalldevs_if, sizeof(struct rpcap_findalldevs_if), sendbuf,
+		    &sendbufidx, RPCAP_NETBUF_SIZE, SOCKBUF_BUFFERIZE, errmsgbuf,
+		    PCAP_ERRBUF_SIZE) == -1)
+			goto error;
 
 		if (sock_bufferize(d->name, lname, sendbuf, &sendbufidx,
 		    RPCAP_NETBUF_SIZE, SOCKBUF_BUFFERIZE, errmsgbuf,
@@ -1872,7 +1890,7 @@
 	// This is a fake open, since we do that only to get the needed parameters, then we close the device again
 	if ((fp = pcap_open_live(source,
 			1500 /* fake snaplen */,
-			0 /* no promis */,
+			0 /* no promisc */,
 			1000 /* fake timeout */,
 			errmsgbuf)) == NULL)
 		goto error;
@@ -2044,7 +2062,8 @@
 	saddrlen = sizeof(struct sockaddr_storage);
 	if (getpeername(pars->sockctrl, (struct sockaddr *) &saddr, &saddrlen) == -1)
 	{
-		sock_geterror("getpeername()", errmsgbuf, PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(errmsgbuf, PCAP_ERRBUF_SIZE,
+		    "getpeername() failed");
 		goto error;
 	}
 
@@ -2061,32 +2080,34 @@
 		if (getnameinfo((struct sockaddr *) &saddr, saddrlen, peerhost,
 				sizeof(peerhost), NULL, 0, NI_NUMERICHOST))
 		{
-			sock_geterror("getnameinfo()", errmsgbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(errmsgbuf, PCAP_ERRBUF_SIZE,
+			    "getnameinfo() failed");
 			goto error;
 		}
 
 		if (sock_initaddress(peerhost, portdata, &hints, &addrinfo, errmsgbuf, PCAP_ERRBUF_SIZE) == -1)
 			goto error;
 
-		if ((session->sockdata = sock_open(addrinfo, SOCKOPEN_CLIENT, 0, errmsgbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
+		if ((session->sockdata = sock_open(peerhost, addrinfo, SOCKOPEN_CLIENT, 0, errmsgbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
 			goto error;
 	}
 	else		// Data connection is opened by the client toward the server
 	{
 		hints.ai_flags = AI_PASSIVE;
 
-		// Let's the server socket pick up a free network port for us
-		if (sock_initaddress(NULL, "0", &hints, &addrinfo, errmsgbuf, PCAP_ERRBUF_SIZE) == -1)
+		// Make the server socket pick up a free network port for us
+		if (sock_initaddress(NULL, NULL, &hints, &addrinfo, errmsgbuf, PCAP_ERRBUF_SIZE) == -1)
 			goto error;
 
-		if ((session->sockdata = sock_open(addrinfo, SOCKOPEN_SERVER, 1 /* max 1 connection in queue */, errmsgbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
+		if ((session->sockdata = sock_open(NULL, addrinfo, SOCKOPEN_SERVER, 1 /* max 1 connection in queue */, errmsgbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
 			goto error;
 
 		// get the complete sockaddr structure used in the data connection
 		saddrlen = sizeof(struct sockaddr_storage);
 		if (getsockname(session->sockdata, (struct sockaddr *) &saddr, &saddrlen) == -1)
 		{
-			sock_geterror("getsockname()", errmsgbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(errmsgbuf, PCAP_ERRBUF_SIZE,
+			    "getsockname() failed");
 			goto error;
 		}
 
@@ -2094,7 +2115,8 @@
 		if (getnameinfo((struct sockaddr *) &saddr, saddrlen, NULL,
 				0, portdata, sizeof(portdata), NI_NUMERICSERV))
 		{
-			sock_geterror("getnameinfo()", errmsgbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(errmsgbuf, PCAP_ERRBUF_SIZE,
+			    "getnameinfo() failed");
 			goto error;
 		}
 	}
@@ -2162,7 +2184,8 @@
 
 		if (socktemp == INVALID_SOCKET)
 		{
-			sock_geterror("accept()", errbuf, PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+			   "accept() failed");
 			rpcapd_log(LOGPRIO_ERROR, "Accept of data connection failed: %s",
 			    errbuf);
 			goto error;
@@ -2337,7 +2360,7 @@
 	if (bf_prog.bf_len > RPCAP_BPF_MAXINSNS)
 	{
 		snprintf(errmsgbuf, PCAP_ERRBUF_SIZE,
-		    "Filter program is larger than the maximum size of %u instructions",
+		    "Filter program is larger than the maximum size of %d instructions",
 		    RPCAP_BPF_MAXINSNS);
 		return -2;
 	}
@@ -2818,19 +2841,25 @@
 	if (sockaddrin == NULL) return;
 
 	// Warning: we support only AF_INET and AF_INET6
+	//
+	// Note: as noted above, the output structures are not
+	// neatly aligned on 4-byte boundaries, so we must fill
+	// in an aligned structure and then copy it to the output
+	// buffer with memcpy().
 	switch (sockaddrin->ss_family)
 	{
 	case AF_INET:
 		{
 		struct sockaddr_in *sockaddrin_ipv4;
-		struct rpcap_sockaddr_in *sockaddrout_ipv4;
+		struct rpcap_sockaddr_in sockaddrout_ipv4;
 
 		sockaddrin_ipv4 = (struct sockaddr_in *) sockaddrin;
-		sockaddrout_ipv4 = (struct rpcap_sockaddr_in *) sockaddrout;
-		sockaddrout_ipv4->family = htons(RPCAP_AF_INET);
-		sockaddrout_ipv4->port = htons(sockaddrin_ipv4->sin_port);
-		memcpy(&sockaddrout_ipv4->addr, &sockaddrin_ipv4->sin_addr, sizeof(sockaddrout_ipv4->addr));
-		memset(sockaddrout_ipv4->zero, 0, sizeof(sockaddrout_ipv4->zero));
+
+		sockaddrout_ipv4.family = htons(RPCAP_AF_INET);
+		sockaddrout_ipv4.port = htons(sockaddrin_ipv4->sin_port);
+		memcpy(&sockaddrout_ipv4.addr, &sockaddrin_ipv4->sin_addr, sizeof(sockaddrout_ipv4.addr));
+		memset(sockaddrout_ipv4.zero, 0, sizeof(sockaddrout_ipv4.zero));
+		memcpy(sockaddrout, &sockaddrout_ipv4, sizeof(struct rpcap_sockaddr_in));
 		break;
 		}
 
@@ -2838,15 +2867,16 @@
 	case AF_INET6:
 		{
 		struct sockaddr_in6 *sockaddrin_ipv6;
-		struct rpcap_sockaddr_in6 *sockaddrout_ipv6;
+		struct rpcap_sockaddr_in6 sockaddrout_ipv6;
 
 		sockaddrin_ipv6 = (struct sockaddr_in6 *) sockaddrin;
-		sockaddrout_ipv6 = (struct rpcap_sockaddr_in6 *) sockaddrout;
-		sockaddrout_ipv6->family = htons(RPCAP_AF_INET6);
-		sockaddrout_ipv6->port = htons(sockaddrin_ipv6->sin6_port);
-		sockaddrout_ipv6->flowinfo = htonl(sockaddrin_ipv6->sin6_flowinfo);
-		memcpy(&sockaddrout_ipv6->addr, &sockaddrin_ipv6->sin6_addr, sizeof(sockaddrout_ipv6->addr));
-		sockaddrout_ipv6->scope_id = htonl(sockaddrin_ipv6->sin6_scope_id);
+
+		sockaddrout_ipv6.family = htons(RPCAP_AF_INET6);
+		sockaddrout_ipv6.port = htons(sockaddrin_ipv6->sin6_port);
+		sockaddrout_ipv6.flowinfo = htonl(sockaddrin_ipv6->sin6_flowinfo);
+		memcpy(&sockaddrout_ipv6.addr, &sockaddrin_ipv6->sin6_addr, sizeof(sockaddrout_ipv6.addr));
+		sockaddrout_ipv6.scope_id = htonl(sockaddrin_ipv6->sin6_scope_id);
+		memcpy(sockaddrout, &sockaddrout_ipv6, sizeof(struct rpcap_sockaddr_in6));
 		break;
 		}
 #endif
diff --git a/rpcapd/fileconf.c b/rpcapd/fileconf.c
index b79dda1..c051f88 100644
--- a/rpcapd/fileconf.c
+++ b/rpcapd/fileconf.c
@@ -386,7 +386,7 @@
 
 				//
 				// Append this to the host list.
-				// Save the curren end-of-string for the
+				// Save the current end-of-string for the
 				// host list, in case the new host doesn't
 				// fit, so that we can discard the partially-
 				// copied host name.
diff --git a/rpcapd/rpcapd.c b/rpcapd/rpcapd.c
index b91a401..4c1b745 100644
--- a/rpcapd/rpcapd.c
+++ b/rpcapd/rpcapd.c
@@ -35,6 +35,7 @@
 #endif
 
 #include "ftmacros.h"
+#include "diag-control.h"
 
 #include <errno.h>		// for the errno variable
 #include <string.h>		// for strtok, etc
@@ -360,8 +361,8 @@
 	state_change_event = CreateEvent(NULL, FALSE, FALSE, NULL);
 	if (state_change_event == NULL)
 	{
-		sock_geterror("Can't create state change event", errbuf,
-		    PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+		    "Can't create state change event");
 		rpcapd_log(LOGPRIO_ERROR, "%s", errbuf);
 		exit(2);
 	}
@@ -371,8 +372,8 @@
 	//
 	if (!SetConsoleCtrlHandler(main_ctrl_event, TRUE))
 	{
-		sock_geterror("Can't set control handler", errbuf,
-		    PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+		    "Can't set control handler");
 		rpcapd_log(LOGPRIO_ERROR, "%s", errbuf);
 		exit(2);
 	}
@@ -426,8 +427,8 @@
 		sockctrl = dup(0);
 		if (sockctrl == -1)
 		{
-			sock_geterror("Can't dup standard input", errbuf,
-			    PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+			    "Can't dup standard input");
 			rpcapd_log(LOGPRIO_ERROR, "%s", errbuf);
 			exit(2);
 		}
@@ -503,7 +504,7 @@
 
 		// LINUX WARNING: the current linux implementation of pthreads requires a management thread
 		// to handle some hidden stuff. So, as soon as you create the first thread, two threads are
-		// created. Fom this point on, the number of threads active are always one more compared
+		// created. From this point on, the number of threads active are always one more compared
 		// to the number you're expecting
 
 		// Second child continues
@@ -622,7 +623,7 @@
 			SOCKET sock;
 			struct listen_sock *sock_info;
 
-			if ((sock = sock_open(tempaddrinfo, SOCKOPEN_SERVER, SOCKET_MAXCONN, errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
+			if ((sock = sock_open(NULL, tempaddrinfo, SOCKOPEN_SERVER, SOCKET_MAXCONN, errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
 			{
 				switch (tempaddrinfo->ai_family)
 				{
@@ -735,8 +736,8 @@
 
 	if (!SetEvent(state_change_event))
 	{
-		sock_geterror("SetEvent on shutdown event failed", errbuf,
-		    PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+		    "SetEvent on shutdown event failed");
 		rpcapd_log(LOGPRIO_ERROR, "%s", errbuf);
 	}
 }
@@ -903,15 +904,15 @@
 		event = WSACreateEvent();
 		if (event == WSA_INVALID_EVENT)
 		{
-			sock_geterror("Can't create socket event", errbuf,
-			    PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+			    "Can't create socket event");
 			rpcapd_log(LOGPRIO_ERROR, "%s", errbuf);
 			exit(2);
 		}
 		if (WSAEventSelect(sock_info->sock, event, FD_ACCEPT) == SOCKET_ERROR)
 		{
-			sock_geterror("Can't setup socket event", errbuf,
-			    PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+			    "Can't setup socket event");
 			rpcapd_log(LOGPRIO_ERROR, "%s", errbuf);
 			exit(2);
 		}
@@ -929,8 +930,8 @@
 		    WSA_INFINITE, FALSE);
 		if (ret == WSA_WAIT_FAILED)
 		{
-			sock_geterror("WSAWaitForMultipleEvents failed", errbuf,
-			    PCAP_ERRBUF_SIZE);
+			sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+			    "WSAWaitForMultipleEvents failed");
 			rpcapd_log(LOGPRIO_ERROR, "%s", errbuf);
 			exit(2);
 		}
@@ -969,8 +970,8 @@
 			if (WSAEnumNetworkEvents(sock_info->sock,
 			    events[i], &network_events) == SOCKET_ERROR)
 			{
-				sock_geterror("WSAEnumNetworkEvents failed",
-				    errbuf, PCAP_ERRBUF_SIZE);
+				sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+				    "WSAEnumNetworkEvents failed");
 				rpcapd_log(LOGPRIO_ERROR, "%s", errbuf);
 				exit(2);
 			}
@@ -984,10 +985,10 @@
 					//
 					// Yes - report it and keep going.
 					//
-					sock_fmterror("Socket error",
+					sock_fmterrmsg(errbuf,
+					    PCAP_ERRBUF_SIZE,
 					    network_events.iErrorCode[FD_ACCEPT_BIT],
-					    errbuf,
-					    PCAP_ERRBUF_SIZE);
+					    "Socket error");
 					rpcapd_log(LOGPRIO_ERROR, "%s", errbuf);
 					continue;
 				}
@@ -1173,7 +1174,7 @@
 
 		// Don't check for errors here, since the error can be due to the fact that the thread
 		// has been killed
-		sock_geterror("accept()", errbuf, PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE, "accept() failed");
 		rpcapd_log(LOGPRIO_ERROR, "Accept of control connection from client failed: %s",
 		    errbuf);
 		return;
@@ -1197,14 +1198,16 @@
 	//
 	if (WSAEventSelect(sockctrl, NULL, 0) == SOCKET_ERROR)
 	{
-		sock_geterror("WSAEventSelect()", errbuf, PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+		    "WSAEventSelect() failed");
 		rpcapd_log(LOGPRIO_ERROR, "%s", errbuf);
 		sock_close(sockctrl, NULL, 0);
 		return;
 	}
 	if (ioctlsocket(sockctrl, FIONBIO, &off) == SOCKET_ERROR)
 	{
-		sock_geterror("ioctlsocket(FIONBIO)", errbuf, PCAP_ERRBUF_SIZE);
+		sock_geterrmsg(errbuf, PCAP_ERRBUF_SIZE,
+		    "ioctlsocket(FIONBIO) failed");
 		rpcapd_log(LOGPRIO_ERROR, "%s", errbuf);
 		sock_close(sockctrl, NULL, 0);
 		return;
@@ -1357,13 +1360,15 @@
 	{
 		int activeclose;
 
-		if ((sockctrl = sock_open(addrinfo, SOCKOPEN_CLIENT, 0, errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
+		if ((sockctrl = sock_open(activepars->address, addrinfo, SOCKOPEN_CLIENT, 0, errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
 		{
 			rpcapd_log(LOGPRIO_DEBUG, "%s", errbuf);
 
+			DIAG_OFF_FORMAT_TRUNCATION
 			snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error connecting to host %s, port %s, using protocol %s",
 					activepars->address, activepars->port, (hints.ai_family == AF_INET) ? "IPv4":
 					(hints.ai_family == AF_INET6) ? "IPv6" : "Unspecified");
+			DIAG_ON_FORMAT_TRUNCATION
 
 			rpcapd_log(LOGPRIO_DEBUG, "%s", errbuf);
 
diff --git a/rpcapd/rpcapd.manadmin.in b/rpcapd/rpcapd.manadmin.in
index ea6046e..791b4ad 100644
--- a/rpcapd/rpcapd.manadmin.in
+++ b/rpcapd/rpcapd.manadmin.in
@@ -48,7 +48,6 @@
 .B \-l
 .I host_list
 ]
-.br
 .ti +8
 [
 .B \-a
@@ -62,7 +61,6 @@
 ] [
 .B \-i
 ]
-.br
 .ti +8
 [
 .B \-D
@@ -77,7 +75,6 @@
 [
 .B \-S
 ]
-.br
 .ti +8
 [
 .B \-K
@@ -199,7 +196,7 @@
 .B rpcapd
 listens on both IPv4 and IPv6 addresses.
 .TP
-.BI -l " host_list"
+.BI \-l " host_list"
 Only allow hosts specified in the
 .I host_list
 argument to connect to this server.
diff --git a/savefile.c b/savefile.c
index d04b917..db8a3aa 100644
--- a/savefile.c
+++ b/savefile.c
@@ -112,6 +112,16 @@
 }
 
 static int
+sf_cant_set_rfmon(pcap_t *p _U_)
+{
+	/*
+	 * This is a savefile, not a device on which you can capture,
+	 * so never say it supports being put into monitor mode.
+	 */
+	return (0);
+}
+
+static int
 sf_stats(pcap_t *p, struct pcap_stat *ps _U_)
 {
 	snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
@@ -350,7 +360,7 @@
 	if (fname[0] == '-' && fname[1] == '\0')
 	{
 		fp = stdin;
-		if (stdin == NULL) {
+		if (fp == NULL) {
 			snprintf(errbuf, PCAP_ERRBUF_SIZE,
 			    "The standard input is not open");
 			return (NULL);
@@ -551,6 +561,7 @@
 	p->selectable_fd = fileno(fp);
 #endif
 
+	p->can_set_rfmon_op = sf_cant_set_rfmon;
 	p->read_op = pcap_offline_read;
 	p->inject_op = sf_inject;
 	p->setfilter_op = install_bpf_program;
@@ -618,12 +629,27 @@
 pcap_offline_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
 {
 	struct bpf_insn *fcode;
-	int status = 0;
 	int n = 0;
 	u_char *data;
 
-	while (status == 0) {
+	/*
+	 * This can conceivably process more than INT_MAX packets,
+	 * which would overflow the packet count, causing it either
+	 * to look like a negative number, and thus cause us to
+	 * return a value that looks like an error, or overflow
+	 * back into positive territory, and thus cause us to
+	 * return a too-low count.
+	 *
+	 * Therefore, if the packet count is unlimited, we clip
+	 * it at INT_MAX; this routine is not expected to
+	 * process packets indefinitely, so that's not an issue.
+	 */
+	if (PACKET_COUNT_IS_UNLIMITED(cnt))
+		cnt = INT_MAX;
+
+	for (;;) {
 		struct pcap_pkthdr h;
+		int status;
 
 		/*
 		 * Has "pcap_breakloop()" been called?
@@ -643,16 +669,28 @@
 		}
 
 		status = p->next_packet_op(p, &h, &data);
-		if (status) {
-			if (status == 1)
-				return (0);
+		if (status < 0) {
+			/*
+			 * Error.  Pass it back to the caller.
+			 */
 			return (status);
 		}
+		if (status == 0) {
+			/*
+			 * EOF.  Nothing more to process;
+			 */
+			break;
+		}
 
+		/*
+		 * OK, we've read a packet; run it through the filter
+		 * and, if it passes, process it.
+		 */
 		if ((fcode = p->fcode.bf_insns) == NULL ||
 		    pcap_filter(fcode, data, h.len, h.caplen)) {
 			(*callback)(user, &h, data);
-			if (++n >= cnt && cnt > 0)
+			n++;	/* count the packet */
+			if (n >= cnt)
 				break;
 		}
 	}
diff --git a/scanner.c b/scanner.c
index 4b1572f..bbb2b46 100644
--- a/scanner.c
+++ b/scanner.c
@@ -24,9 +24,16 @@
  */
 #include <pcap/pcap-inttypes.h>
 
+/*
+ * grammar.h requires gencode.h and sometimes breaks in a polluted namespace
+ * (see ftmacros.h), so include it early.
+ */
+#include "gencode.h"
+#include "grammar.h"
+
 #include "diag-control.h"
 
-#line 30 "scanner.c"
+#line 37 "scanner.c"
 
 #define  YY_INT_ALIGNED short int
 
@@ -587,8 +594,8 @@
 	yyg->yy_hold_char = *yy_cp; \
 	*yy_cp = '\0'; \
 	yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 183
-#define YY_END_OF_BUFFER 184
+#define YY_NUM_RULES 188
+#define YY_END_OF_BUFFER 189
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -596,198 +603,204 @@
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static const flex_int16_t yy_accept[1724] =
+static const flex_int16_t yy_accept[1785] =
     {   0,
-        0,    0,  184,  182,  113,  113,  114,  182,  114,  114,
-      123,  123,  114,  114,  114,  114,  180,  180,  182,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  114,
-      117,  121,   67,    0,  180,  123,    0,  180,  180,  180,
-        0,  125,  119,  116,  118,  115,  120,  180,  181,  180,
-      180,  180,   20,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,    7,  180,   34,   35,
+        0,    0,  189,  187,  114,  114,  115,  187,  115,  115,
+      124,  124,  115,  115,  115,  115,  185,  185,  187,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  115,
+      118,  122,   67,    0,  185,  124,    0,  185,  185,  185,
+        0,  126,  120,  117,  119,  116,  121,  185,  186,  185,
+      185,  185,   20,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,    7,  185,   34,   35,
 
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,   92,  180,   68,  180,  180,  180,
-      180,  180,  180,   60,  180,  180,  180,  180,   86,  180,
-      180,  180,  180,  180,  180,   61,  180,    4,  180,  180,
-      180,  180,  180,  180,  180,   68,  121,  180,  124,  124,
-      180,  123,  180,    0,  125,  123,  125,  125,  125,  180,
-      180,  180,   67,    5,  180,   81,  180,  180,  180,  180,
-      180,  180,  180,   55,  107,    1,    0,  180,   21,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,   36,  180,  180,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,   93,  185,   68,  185,  185,  185,
+      185,  185,  185,   60,  185,  185,  185,  185,   87,  185,
+      185,  185,  185,  185,  185,   61,  185,    4,  185,  185,
+      185,  185,  185,  185,  185,   68,  122,  185,  125,  125,
+      185,  124,  185,    0,  126,  124,  126,  126,  126,  185,
+      185,  185,   67,    5,  185,   82,  185,  185,  185,  185,
+      185,  185,  185,   55,  108,    1,    0,  185,   21,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,   36,  185,
 
-       18,   43,    0,  180,   29,  180,   25,   70,  180,  180,
-       79,   37,  180,  100,  180,  180,  180,  180,  101,  180,
-       46,   69,   82,  106,  180,   14,  180,    3,  180,  180,
-      180,  180,  180,   94,  180,  180,   26,  180,  105,  180,
-      108,   38,    2,  180,   42,  180,    9,  180,   10,   89,
-      180,   88,  180,  180,    0,  180,  180,  124,  180,  180,
-      180,  180,  123,    0,  180,    0,  126,  125,  125,    0,
-      125,    0,  125,    0,  125,    0,   23,  180,  180,  180,
-      180,   64,   16,   41,  180,   39,  180,  180,  180,   30,
-      180,   98,  180,  180,  180,  111,  180,  180,  104,  110,
+      185,   18,   43,    0,  185,   29,  185,   25,   70,  185,
+      185,   80,   37,  185,  101,  185,  185,  185,  185,  102,
+      185,   46,   69,   83,  107,  185,   14,  185,    3,  185,
+      185,  185,  185,  185,   95,  185,  185,   26,  185,  106,
+      185,  109,   38,    2,  185,   42,  185,    9,  185,   10,
+       90,  185,   89,  185,  185,    0,  185,  185,  125,  185,
+      185,  185,  185,  124,    0,  185,    0,  127,  126,  126,
+        0,  126,    0,  126,    0,  126,    0,   23,  185,  185,
+      185,  185,   64,   16,   41,  185,   39,  185,  185,  185,
+       30,  185,   99,  185,  185,  185,  112,  185,  185,  105,
 
-       45,  109,  112,   11,  180,   12,   13,  180,  180,  180,
-       32,   78,  180,   62,    3,   99,   47,  180,  180,  180,
-       74,  180,  180,  180,  180,   48,  180,  180,   40,  180,
-        6,  180,   93,  180,    8,   95,  180,  180,    0,  180,
-       53,   73,   15,  180,  124,  124,  180,  124,  124,  124,
-      180,  123,  180,    0,  125,  180,    0,    0,  125,    0,
-      125,  126,  125,    0,    0,    0,    0,  125,  125,  125,
-      125,  125,    0,  180,   56,   57,   58,   59,  180,   22,
-      180,  180,  180,  180,   31,  180,  180,  180,  102,  103,
-        0,   19,  180,  180,  180,   87,  180,   33,  180,   80,
+      111,   45,  110,  113,   11,  185,  185,   12,   13,  185,
+      185,  185,   32,   79,  185,   62,    3,  100,   47,  185,
+      185,  185,   75,  185,  185,  185,  185,   48,  185,  185,
+       40,  185,    6,  185,   94,  185,    8,   96,  185,  185,
+        0,  185,   53,   74,   15,  185,  125,  125,  185,  125,
+      125,  125,  185,  124,  185,    0,  126,  185,    0,    0,
+      126,    0,  126,  127,  126,    0,    0,    0,    0,  126,
+      126,  126,  126,  126,    0,  185,   56,   57,   58,   59,
+      185,   22,  185,  185,  185,  185,   31,  185,  185,  185,
+      103,  104,    0,   19,  185,  185,  185,  185,   88,  185,
 
-       28,   27,  180,  180,   83,  180,  180,  180,   50,   17,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,    0,  180,  180,  124,  180,  180,
-      180,  180,  124,  124,  180,  123,  180,    0,    0,  125,
-      125,  125,    0,    0,  126,  125,  125,  126,  125,    0,
-        0,  125,  125,  125,  125,  125,    0,    0,    0,    0,
-      125,  125,    0,  125,    0,  125,    0,   97,  180,  180,
-      180,   24,  180,  180,   77,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,    0,  180,  180,  180,  180,  180,
-       70,  180,  180,  180,  180,  180,  180,  180,   75,   76,
+       33,  185,   81,   28,   27,  185,  185,   84,  185,  185,
+      185,   50,   17,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,    0,  185,  185,
+      125,  185,  185,  185,  185,  125,  125,  185,  124,  185,
+        0,    0,  126,  126,  126,    0,    0,  127,  126,  126,
+      127,  126,    0,    0,  126,  126,  126,  126,  126,    0,
+        0,    0,    0,  126,  126,    0,  126,    0,  126,    0,
+       98,  185,  185,  185,   24,  185,  185,   78,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,    0,  185,  185,
+      185,  185,  185,  185,   70,  185,  185,  185,  185,  185,
 
-      180,   96,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  124,  124,  180,  124,
-      124,  124,  124,  180,  123,  180,    0,  125,  125,    0,
-      125,    0,    0,  125,    0,  125,  126,  125,    0,    0,
-        0,  125,  125,    0,  125,  126,  125,    0,    0,    0,
-        0,    0,    0,    0,  125,  125,  125,  125,  125,    0,
-      180,  180,  180,  180,   52,   63,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,   71,  180,  180,
-       44,   84,   85,  180,  180,  180,  180,   54,  176,  179,
+      185,  185,   76,   77,  185,   97,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      125,  125,  185,  125,  125,  125,  125,  185,  124,  185,
+        0,  126,  126,    0,  126,    0,    0,  126,    0,  126,
+      127,  126,    0,    0,    0,  126,  126,    0,  126,  127,
+      126,    0,    0,    0,    0,    0,    0,    0,  126,  126,
+      126,  126,  126,    0,  185,  185,  185,  185,   52,   63,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,   73,   71,  185,  185,   44,   85,
 
-      178,  172,  180,  174,  173,  177,  180,    0,  180,  180,
-      124,  180,  180,  180,  124,  180,  123,  180,    0,    0,
-      125,  125,  125,  125,  125,  125,    0,    0,  126,  125,
-      125,  125,    0,    0,  125,  125,  125,  125,  125,    0,
-        0,    0,    0,    0,    0,    0,  125,  125,  125,  125,
-      125,    0,    0,    0,    0,    0,  125,  125,    0,  125,
-        0,  125,    0,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  128,  127,
-      180,  180,   72,  180,  180,  180,  175,  171,  180,  180,
+       86,  185,  185,  185,  185,   54,  181,  184,  183,  177,
+      185,  179,  178,  182,  185,    0,  185,  185,  125,  185,
+      185,  185,  125,  185,  124,  185,    0,    0,  126,  126,
+      126,  126,  126,  126,    0,    0,  127,  126,  126,  126,
+        0,    0,  126,  126,  126,  126,  126,    0,    0,    0,
+        0,    0,    0,    0,  126,  126,  126,  126,  126,    0,
+        0,    0,    0,    0,  126,  126,    0,  126,    0,  126,
+        0,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  129,
 
-      124,  124,  124,  124,  180,  123,  180,    0,  125,  125,
-        0,  125,  125,    0,  125,    0,    0,  125,    0,  125,
-      126,  125,    0,    0,    0,  125,  125,    0,  125,  126,
-      125,    0,    0,    0,    0,    0,  125,  125,    0,  125,
-      126,  125,    0,  125,  125,    0,    0,    0,    0,    0,
-        0,    0,  125,  125,  125,  125,  125,    0,   65,  180,
-       55,  133,  140,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  145,  144,  180,   66,   49,  180,  180,    0,  180,
-      180,  180,  180,  180,  123,  180,    0,    0,  125,  125,
+      128,  185,  185,   72,  185,  185,  185,  180,  176,  185,
+      185,  125,  125,  125,  125,  185,  124,  185,    0,  126,
+      126,    0,  126,  126,    0,  126,    0,    0,  126,    0,
+      126,  127,  126,    0,    0,    0,  126,  126,    0,  126,
+      127,  126,    0,    0,    0,    0,    0,  126,  126,    0,
+      126,  127,  126,    0,  126,  126,    0,    0,    0,    0,
+        0,    0,    0,  126,  126,  126,  126,  126,    0,   65,
+      185,   55,  134,  141,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  146,  145,  185,   66,
 
-      125,  125,  125,  125,  125,  125,  125,    0,    0,  126,
-      125,  125,  125,    0,    0,  125,  125,  125,  125,  125,
-        0,    0,    0,    0,    0,    0,    0,  125,  125,  125,
-      125,  125,    0,  125,  125,    0,    0,    0,    0,    0,
-        0,    0,  125,  125,  125,  125,  125,    0,    0,    0,
-        0,    0,    0,  125,  125,    0,  125,    0,  125,    0,
-       90,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  146,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,   51,  122,  122,  124,  124,  180,  123,  180,
-        0,  125,  125,    0,  125,  125,    0,  125,  125,    0,
+       49,  185,  185,    0,  185,  185,  185,  185,  185,  124,
+      185,    0,    0,  126,  126,  126,  126,  126,  126,  126,
+      126,  126,    0,    0,  127,  126,  126,  126,    0,    0,
+      126,  126,  126,  126,  126,    0,    0,    0,    0,    0,
+        0,    0,  126,  126,  126,  126,  126,    0,  126,  126,
+        0,    0,    0,    0,    0,    0,    0,  126,  126,  126,
+      126,  126,    0,    0,    0,    0,    0,    0,  126,  126,
+        0,  126,    0,  126,    0,   91,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  151,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
 
-      125,    0,  122,  125,    0,  125,  126,  125,    0,    0,
-        0,  125,  125,    0,  125,  126,  125,    0,    0,    0,
-        0,    0,  125,  125,    0,  125,  126,  125,    0,    0,
-        0,    0,    0,    0,  125,  125,    0,  125,  126,  125,
-        0,  125,  125,  125,    0,    0,    0,    0,    0,    0,
-        0,  125,  125,  125,  125,  125,    0,  180,  180,  180,
-      180,  180,  180,  180,  180,  138,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,   91,  122,  122,
-      124,  180,  122,  122,    0,    0,  125,  125,  125,  125,
-      125,  125,  125,  125,  125,  125,  125,  125,    0,  122,
+      185,   51,  123,  123,  125,  125,  185,  124,  185,    0,
+      126,  126,    0,  126,  126,    0,  126,  126,    0,  126,
+        0,  123,  126,    0,  126,  127,  126,    0,    0,    0,
+      126,  126,    0,  126,  127,  126,    0,    0,    0,    0,
+        0,  126,  126,    0,  126,  127,  126,    0,    0,    0,
+        0,    0,    0,  126,  126,    0,  126,  127,  126,    0,
+      126,  126,  126,    0,    0,    0,    0,    0,    0,    0,
+      126,  126,  126,  126,  126,    0,  185,  185,  185,  185,
+      185,  185,  185,  185,  139,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
 
-      126,  125,  125,  125,    0,    0,  125,  125,  125,  125,
-      125,    0,    0,    0,    0,    0,    0,    0,  125,  125,
-      125,  125,  125,    0,  125,  125,    0,    0,    0,    0,
-        0,    0,    0,  125,  125,  125,  125,  125,    0,  125,
-      125,  125,    0,    0,    0,    0,    0,    0,    0,  125,
-      125,  125,  125,  125,    0,    0,    0,    0,    0,    0,
-      125,  125,    0,  125,    0,  125,    0,  180,  180,  180,
-      142,  180,  180,  180,  180,  180,  180,  180,  130,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  124,
-      180,  123,    0,  125,  125,    0,  125,  125,    0,  125,
+       92,  123,  123,  125,  185,  123,  123,    0,    0,  126,
+      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,
+      126,    0,  123,  127,  126,  126,  126,    0,    0,  126,
+      126,  126,  126,  126,    0,    0,    0,    0,    0,    0,
+        0,  126,  126,  126,  126,  126,    0,  126,  126,    0,
+        0,    0,    0,    0,    0,    0,  126,  126,  126,  126,
+      126,    0,  126,  126,  126,    0,    0,    0,    0,    0,
+        0,    0,  126,  126,  126,  126,  126,    0,    0,    0,
+        0,    0,    0,  126,  126,    0,  126,    0,  126,    0,
+      185,  185,  185,  143,  185,  185,  185,  185,  185,  185,
 
-      125,    0,  125,  125,    0,  125,    0,    0,    0,  125,
-        0,    0,  125,  126,  125,    0,    0,    0,  125,  125,
-        0,  125,  126,  125,    0,    0,    0,    0,    0,  125,
-      125,    0,  125,  126,  125,    0,    0,    0,    0,    0,
-        0,  125,  125,    0,  125,  126,  125,    0,    0,    0,
-        0,    0,    0,  125,  125,    0,  125,  126,  125,    0,
-      125,  125,  125,    0,    0,    0,    0,    0,    0,    0,
-      125,  125,  125,  125,  125,    0,  180,  180,  180,  180,
-      132,  180,  180,  180,  136,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  122,    0,
+      185,  131,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  125,  185,  124,    0,
+      126,  126,    0,  126,  126,    0,  126,  126,    0,  126,
+      126,    0,  126,    0,    0,    0,  126,    0,    0,  126,
+      127,  126,    0,    0,    0,  126,  126,    0,  126,  127,
+      126,    0,    0,    0,    0,    0,  126,  126,    0,  126,
+      127,  126,    0,    0,    0,    0,    0,    0,  126,  126,
+        0,  126,  127,  126,    0,    0,    0,    0,    0,    0,
+      126,  126,    0,  126,  127,  126,    0,  126,  126,  126,
+        0,    0,    0,    0,    0,    0,    0,  126,  126,  126,
 
-        0,  125,  125,  125,  125,  125,  125,  125,  125,  125,
-      125,  125,  125,  125,  125,  125,    0,    0,    0,  126,
-        0,    0,  125,    0,    0,  125,  125,  125,    0,    0,
-        0,    0,    0,    0,    0,  125,  125,  125,    0,  125,
-      125,    0,    0,    0,    0,    0,    0,    0,  125,  125,
-      125,    0,  125,  125,  125,    0,    0,    0,    0,    0,
-        0,    0,  125,  125,  125,    0,  125,  125,  125,    0,
-        0,    0,    0,    0,    0,    0,  125,  125,  125,    0,
-        0,    0,    0,    0,    0,  125,  125,    0,  125,    0,
-      125,    0,  129,  141,  143,  137,  180,  180,  180,  180,
+      126,  126,    0,  185,  185,  185,  185,  133,  185,  185,
+      185,  137,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  123,
+        0,    0,  126,  126,  126,  126,  126,  126,  126,  126,
+      126,  126,  126,  126,  126,  126,  126,    0,    0,    0,
+      127,    0,    0,  126,    0,    0,  126,  126,  126,    0,
+        0,    0,    0,    0,    0,    0,  126,  126,  126,    0,
+      126,  126,    0,    0,    0,    0,    0,    0,    0,  126,
+      126,  126,    0,  126,  126,  126,    0,    0,    0,    0,
+        0,    0,    0,  126,  126,  126,    0,  126,  126,  126,
 
-      180,  180,  180,  180,  180,  180,  180,  180,  155,  180,
-      180,  180,    0,    0,  125,    0,  125,    0,  125,  125,
-        0,  125,  125,    0,  125,  125,    0,  125,  125,    0,
-      125,    0,    0,    0,    0,  125,  125,    0,  125,    0,
-        0,  125,  125,  125,    0,    0,    0,    0,  125,  125,
-      125,    0,    0,    0,    0,    0,  125,  125,  125,    0,
-        0,    0,    0,    0,  125,  125,  125,    0,    0,    0,
-        0,    0,  125,  125,  125,  125,  125,  125,    0,    0,
-        0,    0,    0,    0,    0,  125,  125,  125,    0,  180,
-      180,  180,  180,  180,  180,  147,  180,  180,  180,  180,
+        0,    0,    0,    0,    0,    0,    0,  126,  126,  126,
+        0,    0,    0,    0,    0,    0,  126,  126,    0,  126,
+        0,  126,    0,  130,  142,  144,  138,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  160,  185,  185,  185,  185,    0,    0,  126,
+        0,  126,    0,  126,  126,    0,  126,  126,    0,  126,
+      126,    0,  126,  126,    0,  126,    0,    0,    0,    0,
+      126,  126,    0,  126,    0,    0,  126,  126,  126,    0,
+        0,    0,    0,  126,  126,  126,    0,    0,    0,    0,
+        0,  126,  126,  126,    0,    0,    0,    0,    0,  126,
 
-      180,  180,  180,  180,  180,  180,    0,    0,    0,  125,
-      125,  125,  125,  125,  125,    0,    0,    0,    0,  125,
-      125,    0,    0,    0,    0,  125,  125,  125,    0,    0,
-        0,    0,    0,  125,  125,  125,  125,    0,    0,    0,
-        0,    0,  125,  125,  125,  125,    0,    0,    0,    0,
-        0,  125,  125,  125,  125,    0,    0,    0,    0,    0,
-      125,    0,    0,    0,    0,    0,  125,  125,  125,  180,
-      180,  180,  139,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  125,  125,  125,  125,
-      125,  125,  125,  125,    0,    0,    0,    0,  125,  125,
+      126,  126,    0,    0,    0,    0,    0,  126,  126,  126,
+      126,  126,  126,    0,    0,    0,    0,    0,    0,    0,
+      126,  126,  126,    0,  185,  185,  185,  185,  185,  185,
+      185,  152,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,    0,    0,    0,  126,  126,
+      126,  126,  126,  126,    0,    0,    0,    0,  126,  126,
+        0,    0,    0,    0,  126,  126,  126,    0,    0,    0,
+        0,    0,  126,  126,  126,  126,    0,    0,    0,    0,
+        0,  126,  126,  126,  126,    0,    0,    0,    0,    0,
+      126,  126,  126,  126,    0,    0,    0,    0,    0,  126,
 
-        0,    0,  125,    0,    0,    0,  125,    0,    0,    0,
-      125,    0,    0,    0,  125,    0,    0,    0,  125,  125,
-      125,  125,    0,    0,    0,    0,    0,  125,  134,  180,
-      131,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  156,  180,  125,    0,    0,  125,  125,    0,
-      125,  125,  125,    0,  125,  125,  125,    0,  125,  125,
-      125,    0,  125,  125,  125,    0,    0,    0,    0,  125,
-      135,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  152,  180,  125,  125,    0,    0,    0,    0,    0,
-        0,  125,  125,  125,    0,  180,  180,  180,  180,  180,
+        0,    0,    0,    0,    0,  126,  126,  126,  185,  185,
+      185,  140,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  126,
+      126,  126,  126,  126,  126,  126,  126,    0,    0,    0,
+        0,  126,  126,    0,    0,  126,    0,    0,    0,  126,
+        0,    0,    0,  126,    0,    0,    0,  126,    0,    0,
+        0,  126,  126,  126,  126,    0,    0,    0,    0,    0,
+      126,  135,  185,  132,  185,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  161,  185,
+      185,  126,    0,    0,  126,  126,    0,  126,  126,  126,
 
-      180,  180,  180,  180,  180,  180,  151,    0,  125,  125,
-      125,  125,  125,    0,  167,  180,  180,  180,  180,  180,
-      180,  180,  154,  180,  180,  125,  125,  166,  180,  180,
-      180,  180,  180,  180,  153,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  165,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  180,  180,
-      180,  164,  180,  180,  180,  180,  180,  170,  180,  180,
-      180,  180,  180,  180,  180,  180,  180,  180,  157,  180,
-      180,  180,  180,  180,  150,  180,  180,  168,  180,  180,
+        0,  126,  126,  126,    0,  126,  126,  126,    0,  126,
+      126,  126,    0,    0,    0,    0,  126,  136,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  148,
+      185,  157,  185,  149,  126,  126,    0,    0,    0,    0,
+        0,    0,  126,  126,  126,    0,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  156,
+        0,  126,  126,  126,  126,  126,    0,  172,  185,  185,
+      185,  185,  185,  185,  185,  185,  159,  185,  185,  185,
+      126,  126,  171,  185,  185,  185,  185,  185,  185,  185,
+      158,  185,  185,  185,  185,  185,  185,  185,  185,  185,
 
-      180,  180,  180,  180,  148,  180,  169,  180,  163,  180,
-      180,  180,  180,  158,  180,  160,  180,  180,  162,  159,
-      149,  161,    0
+      185,  185,  185,  185,  150,  185,  185,  185,  185,  185,
+      185,  185,  185,  185,  185,  185,  147,  185,  185,  170,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+      185,  185,  169,  185,  185,  185,  185,  185,  175,  185,
+      185,  185,  185,  185,  185,  185,  185,  185,  185,  162,
+      185,  185,  185,  185,  185,  155,  185,  185,  173,  185,
+      185,  185,  185,  185,  185,  153,  185,  174,  185,  168,
+      185,  185,  185,  185,  163,  185,  165,  185,  185,  167,
+      164,  154,  166,    0
     } ;
 
 static const YY_CHAR yy_ec[256] =
@@ -832,258 +845,265 @@
         3,    1
     } ;
 
-static const flex_int16_t yy_base[2184] =
+static const flex_int16_t yy_base[2245] =
     {   0,
-        0,    0, 6066, 7626, 7626, 7626, 6044,    0, 7626, 6056,
-       43,   70, 6044,   43, 6040,   75,  110,  151,    0,   70,
+        0,    0, 6541, 7736, 7736, 7736, 6491,    0, 7736, 6499,
+       43,   70, 6478,   43, 6475,   75,  110,  151,    0,   70,
        85,  102,   67,   61,   77,  105,  113,  155,  158,  170,
-       70,  176,  165,  110,  189,  148, 6025,  184, 6016, 6001,
-     7626,    0, 7626,  225,  247,  270, 6030,  293,    0,  300,
-        0,  322, 7626, 7626, 7626, 7626, 7626,  344,    0, 6003,
-     6000, 6013,    0, 6008, 5996, 6007, 6001, 5986, 5960, 5946,
-     5947, 5946, 5939, 5948, 5923, 5926, 5906,  284, 5907, 5907,
-     5875, 5868, 5857, 5849, 5816, 5811, 5801, 5794,   89,   81,
-     5765, 5752,  109, 5704, 5698, 5705,  123,  211,    0,    0,
+       70,  176,  165,  110,  189,  148, 6459,  184, 6448, 6433,
+     7736,    0, 7736,  225,  247,  270, 6462,  293,    0,  300,
+        0,  322, 7736, 7736, 7736, 7736, 7736,  344,    0, 6433,
+     6430, 6442,    0, 6433, 6419, 6430, 6419, 6405, 6379, 6372,
+     6373, 6370, 6360, 6369, 6349, 6359, 6342,  284, 6349, 6343,
+     6328, 6302, 6298, 6305, 6291, 6296, 6283, 6274,   89,   81,
+     6277,   29,  109, 6263, 6250, 6251,  123,  211,    0,    0,
 
-       99,  168, 5686, 5695,  204, 5676, 5656, 5659, 5635, 5624,
-     5610, 5600, 5591, 5597,    0, 5584,    0, 5567, 5573, 5567,
-     5568, 5567, 5567,  200, 5549, 5532, 5543, 5536,  131, 5532,
-      327, 5519,  194, 5518, 5530,    0, 5513,    0, 5510, 5509,
-     5514, 5488, 5479, 5467, 5482, 7626, 7626,  363,  386,  180,
-      426,  449,  472, 5475,  479, 5482,  502,  241, 5472, 5446,
-     5430, 5421,    0,    0, 5426,    0, 5435, 5430, 5419, 5413,
-     5414, 5374, 5375, 5382,    0,    0, 5377, 5366,    0, 5378,
-     5373, 5346, 5360, 5359, 5362, 5358, 5342, 5325, 5321, 5337,
-     5319, 5304, 5299, 5300, 5294, 5277, 5257,    0, 5262, 5254,
+       99,  168, 6239, 6218,  204, 6202, 6194, 6183, 6157, 6140,
+     6146, 6135, 6134, 6140,    0, 6147,    0, 6129, 6135, 6129,
+     6130, 6128, 6127,  200, 6134, 6115, 6124, 6095,  131, 6073,
+      327, 6057,  194, 6046, 6049,    0, 6033,    0, 6032, 6026,
+     6017, 6017, 6003, 5991, 6003, 7736, 7736,  363,  386,  180,
+      426,  449,  472, 5996,  479, 5996,  502,  241, 5976, 5944,
+     5927, 5911,    0,    0, 5912,    0, 5921, 5912, 5897, 5873,
+     5874, 5862, 5833, 5827,    0,    0, 5754, 5724,    0, 5703,
+     5674, 5662, 5675, 5673, 5676, 5673, 5656, 5636, 5633, 5646,
+     5629, 5607, 5599, 5581, 5542, 5553, 5538, 5535,    0, 5539,
 
-        0,    0, 5258, 5216,    0, 5226,    0, 5222, 5191, 5196,
-        0,    0, 5166,    0, 5175, 5182,  201, 5163,    0, 5146,
-     5161,    0, 5156,    0, 5138,    0, 5120, 5123, 5116, 5101,
-     5085, 5076, 5053,    0, 5051, 5062,    0, 5051,    0, 5018,
-        0,    0,    0, 5013,    0,  223,  240, 5023,    0,    0,
-     5014,    0, 5011, 5001,  541, 5010,  563,  586, 5006,  593,
-      352,  260,  616, 4996,  639, 4995, 4994,  647,  271, 4982,
-     4961,  408,  687,  709, 4960,    0,    0, 4936,  374, 4937,
-     4930,    0,    0,    0, 4927,    0, 4924, 4925, 4908,    0,
-     4908,    0, 4900, 4900, 4901,    0, 4886, 4853,    0,    0,
+     5515,    0,    0, 5476, 5466,    0, 5407,    0, 5404, 5392,
+     5399,    0,    0, 5387,    0, 5395, 5386,  201, 5368,    0,
+     5365, 5361,    0, 5355,    0, 5341,    0, 5322, 5324, 5299,
+     5300, 5286, 5279, 5273,    0, 5271, 5252,    0, 5239,    0,
+     5237,    0,    0,    0, 5214,    0,  223,  240, 5224,    0,
+        0, 5214,    0, 5194, 5195,  541, 5223,  563,  586, 5220,
+      593,  352,  260,  616, 5193,  639, 5191, 5170,  647,  271,
+     5150, 5148,  408,  687,  709, 5147,    0,    0, 5123,  374,
+     5107, 5112,    0,    0,    0, 5108,    0, 5073, 5069, 5053,
+        0, 5052,    0, 5045, 5043, 5034,    0, 5012, 5009,    0,
 
-        0,    0,    0,  519, 4858,    0,    0, 4865, 4847, 4830,
-        0,    0, 4825,    0,    0,    0,    0, 4825, 4789, 4790,
-        0, 4783, 4765, 4780, 4751, 4727, 4737, 4726,    0, 4708,
-        0, 4707,    0,  250,    0,    0, 4699, 4693,  715, 4688,
-        0,    0,    0,  753,  776,  272,  816, 4714, 4712,  360,
-      838,  861,  884, 4702,  891,  415, 4683, 4681,  913,  526,
-      936,  958, 4661,    0, 4660,  423,  511,  981, 4658, 1004,
-      294, 4657, 4664, 4602,    0,    0,    0,    0, 4596,    0,
-     4609, 4586, 4548, 4528,    0, 4543, 4537, 4517,    0,    0,
-     1023,  516, 4506, 4494, 4497,    0, 4487,    0, 4491, 4483,
+        0,    0,    0,    0,  519, 5021, 5011,    0,    0, 5013,
+     4977, 4958,    0,    0, 4954,    0,    0,    0,    0, 4968,
+     4946, 4949,    0, 4942, 4913, 4925, 4899, 4894, 4884, 4835,
+        0, 4816,    0, 4815,    0,  250,    0,    0, 4808, 4803,
+      715, 4813,    0,    0,    0,  753,  776,  272,  816, 4838,
+     4836,  360,  838,  861,  884, 4826,  891,  415, 4793, 4792,
+      913,  526,  936,  958, 4789,    0, 4787,  423,  511,  981,
+     4769, 1004,  294, 4768, 4774, 4743,    0,    0,    0,    0,
+     4720,    0, 4734, 4732, 4714, 4696,    0, 4713, 4707, 4705,
+        0,    0, 1023,  516, 4678, 4667, 4665, 4664,    0, 4653,
 
-        0,    0, 4492, 4457,  515, 4455, 4456,   73, 4451,    0,
-     4439, 4431, 4407, 4381, 4373, 4360, 4340, 4356, 4349, 4320,
-     4320, 4311, 4299, 4314, 1059, 4328, 1081, 1104, 4313, 1111,
-      669,  313, 1134,  324, 1173, 1195, 1218, 4295, 4286, 1226,
-      357, 4257, 4198, 4197, 4194, 1266,  358, 4193, 4160,  663,
-      683, 1306, 4159, 1329,  420, 4155, 4161, 4135,  737,    0,
-      394, 4134,  798, 1369, 1391, 4131,    0,    0, 4104, 4088,
-     4065,    0, 4055, 4039,    0, 4043, 4056, 4009, 4022, 4020,
-      703, 4005,  728, 3990, 1008, 3987, 3974, 3993, 3981, 3960,
-        0, 3948, 3958, 3949, 3954, 3942, 3911, 3908,    0,    0,
+        0, 4631, 4624,    0,    0, 4628, 4610,  515, 4608, 4606,
+       73, 4603,    0, 4592, 4565, 4576, 4552, 4543, 4535, 4514,
+     4515, 4507, 4493, 4493, 4469, 4474, 4472, 1059, 4488, 1081,
+     1104, 4486, 1111,  669,  313, 1134,  324, 1173, 1195, 1218,
+     4476, 4475, 1226,  357, 4456, 4454, 4453, 4434, 1266,  358,
+     4431, 4430,  663,  683, 1306, 4429, 1329,  420, 4387, 4394,
+     4385,  737,    0,  394, 4382,  798, 1369, 1391, 4364,    0,
+        0, 4333, 4330, 4309,    0, 4318, 4270,    0, 4270, 4266,
+     4251, 4264, 4263,  703, 4217,  728, 4217, 1395, 4212, 4200,
+     4202, 4190, 4179, 4197,    0, 4155, 4162, 4134, 4139, 4136,
 
-     3911,    0, 3906, 3898, 3900, 3879, 3869, 3860, 3860, 3850,
-     3807, 3804, 3806, 3787, 3786, 1415, 1438,  421, 1478, 3779,
-     3765,  684, 1501, 1524, 1531, 1554, 3739, 1561, 1584, 1606,
-     3737, 3734, 3689, 1628,  805, 1651, 1673, 3668,    0, 1156,
-        0,  571, 3646, 1163, 1696, 1718, 3644,    0,  747,  750,
-     3651,  601,  813,  832, 1741, 3625, 1764,  425, 3624, 3631,
-      490, 3594, 3581, 3577,    0,    0, 3563, 3565, 3533, 3532,
-     3544, 3526, 3506, 3494, 3485, 3484, 3476, 3476, 3463, 3448,
-      227,  998, 1009, 3455, 3441, 3429, 3411,    0, 3398, 3371,
-        0,    0,    0, 3384, 3362, 3367, 3353,    0,    0,    0,
+     4125, 4092,    0,    0, 4096,    0, 4067, 4058, 4071, 4070,
+     4032, 4024, 4034, 4022, 3999, 3997, 4001, 4006, 4005, 1432,
+     1455,  421, 1495, 3996, 3993,  684, 1518, 1541, 1548, 1571,
+     3983, 1578, 1601, 1623, 3982, 3981, 3969, 1645,  805, 1668,
+     1690, 3948,    0, 1026,    0,  571, 3930, 1033, 1713, 1735,
+     3905,    0,  747,  750, 3895,  601,  813,  832, 1758, 3883,
+     1781,  425, 3882, 3888,  490, 3851, 3848, 3825,    0,    0,
+     3830, 3832, 3817, 3793, 3800, 3770, 3769, 3776, 3766, 3748,
+     3759, 3739, 3739, 3707, 3688,  227, 1020, 3698, 1025, 3688,
+     3692, 3662, 3671, 3649,    0,    0, 3620, 3614,    0,    0,
 
-        0,    0, 3357,    0,    0,    0, 3346, 1803, 3358, 1825,
-     1848, 3356, 1855,  330, 1878, 1901, 1908, 1931, 3347, 3346,
-     1939,  426, 3343, 1979,  449, 3342, 3324, 3323, 3321, 2019,
-      498, 3320, 1031, 1035, 2059, 3319, 2082,  538, 3318, 3295,
-     1053, 1055, 3294, 3290, 1172, 1236, 2122, 3262, 2145,  564,
-     3261, 3267, 1250,    0, 1257,    0,  624, 3237, 1288, 2185,
-     2207, 3236,    0, 2229,  301,  407,  302,  246, 1012,  522,
-      700, 3191,  539,   19,  538,  661,  569,  790,  650,  682,
-      406,  757, 1015,  834,  887,  454,  999, 1054, 3189, 3188,
-     1168, 3186, 3184, 1214, 1017,  571, 3166, 3164, 2266, 2289,
+        0, 3605, 3600, 3586, 3570,    0,    0,    0,    0,    0,
+     3556,    0,    0,    0, 3524, 1820, 3558, 1842, 1865, 3554,
+     1872,  330, 1894, 1917, 1924, 1947, 3545, 3530, 1955,  426,
+     3527, 1995,  449, 3525, 3503, 3485, 3482, 2035,  498, 3480,
+     1053, 1143, 2075, 3440, 2098,  538, 3438, 3445, 1144, 1145,
+     3424, 3423, 1147, 1149, 2138, 3413, 2161,  564, 3393, 3400,
+     1163,    0, 1248,    0,  624, 3390, 1255, 2201, 2223, 3389,
+        0, 2245,  301,  407,  302,  246, 1136,  522,  700, 3361,
+      539,  478,  538,  661,  569,  455,  790,  650,  682,  406,
+      757, 1017,  834, 1056,  887,  571,  796, 1168, 1242, 3360,
 
-     2311, 2346,  617, 2369,  625, 2377, 2400, 3178, 2407, 2430,
-     2452, 3168, 2475, 2497, 3167, 3163, 3133, 2519, 1295, 2542,
-     2564, 3130,    0, 1351,    0, 1119, 3105, 1358, 2587, 2609,
-     3104,    0, 1460,    0, 1467,    0, 1142, 3103, 1786, 2632,
-     2654, 3093,    0,  706, 1793, 3078, 1303, 1366, 3075, 3071,
-     1385, 1415, 2677, 3052, 2700,  752, 3042, 3048,  518,  854,
-      663, 1172, 1305, 1368, 1949, 1476,  907,  832,  930, 1974,
-      702, 1477, 1803,  951, 1950, 1951, 1953,  974,  953, 1990,
-     1993,  769,  831,  952,  997, 1074, 2013, 2018, 2741, 1127,
-     2763, 1407, 2785, 2046, 2808, 2831, 3037, 3005, 2839,  810,
+     3338, 1254, 3333, 3312, 1255, 1125,  590, 3310, 3307, 2282,
+     2305, 2327, 2362,  617, 2385,  627, 2393, 2416, 3302, 2423,
+     2446, 2468, 3300, 2491, 2513, 3298, 3277, 3275, 2535, 1290,
+     2558, 2580, 3252,    0, 1297,    0, 1119, 3234, 1351, 2603,
+     2625, 3231,    0, 1358,    0, 1477,    0, 1399, 3229, 1484,
+     2648, 2670, 3227,    0,  706, 1803, 3217, 1366, 1404, 3214,
+     3202, 1427, 1432, 2693, 3184, 2716,  752, 3183, 3190,  702,
+      854,  769, 1368, 1384, 1493, 1965, 1494,  907,  930,  952,
+     1990,  831, 1386, 1795, 1798,  951, 1966, 1967, 1817,  974,
+      953, 2005,  997, 2034, 1818, 1074, 1126, 1188, 1323, 1265,
 
-     3004, 2879,  860, 3001, 2919,  861, 2986, 2985, 2983, 2964,
-     2959,  862, 2961, 1600, 2016, 2999, 2960, 3022,  888, 2927,
-     2932, 2054, 2056, 2930, 2929, 2092, 2097, 3062, 2920, 3085,
-      978, 2908, 2895, 1058, 2111, 2892, 2119, 2155, 2890, 2889,
-     2156, 2160, 3125, 2880, 3148, 1081, 2868, 2855,    0, 2174,
-        0, 2251,    0, 1486, 2846, 2318, 3188, 3210, 2844,    0,
-     1188, 1323, 1432, 1577, 2184, 1578, 1802, 1621, 1622, 2243,
-     1645, 2244, 2058, 1666, 1689, 2155, 2329, 1870, 2710, 2246,
-     1668, 2202, 1384, 3234, 3256, 3279, 1082, 3318, 3341, 3364,
-     2842, 3371, 3394, 3416, 2841, 3439, 3461, 2840, 3484, 3506,
+     1322, 2029, 2045, 2757, 1426, 2779, 1448, 2801, 2061, 2824,
+     2847, 3181, 3172, 2855,  812, 3147, 2895,  835, 3127, 2935,
+      861, 3117, 3108, 3061, 3055, 2975,  862, 3054, 1617, 1971,
+     3015, 3020, 3038,  885, 3017, 3010, 2032, 2070, 3007, 2988,
+     2072, 2108, 3078, 2977, 3101,  888, 2976, 2951,  978, 2122,
+     2948, 2135, 2171, 2946, 2945, 2172, 2176, 3141, 2936, 3164,
+      980, 2924, 2911,    0, 2190,    0, 2267,    0, 1503, 2900,
+     2334, 3204, 3226, 2898,    0, 1594, 1595, 1616, 1639, 1819,
+     1662, 1989, 1683, 1685, 1820, 1729, 2200, 2345, 2115, 1706,
+     1728, 2171, 2726, 1886, 2727, 1751, 2262, 2259, 1775, 1887,
 
-     2815, 2813, 2811, 3528, 2328, 3551, 3573, 2810,    0, 2335,
-        0, 1539, 2790, 2726, 3596, 3618, 2786,    0, 2861,    0,
-     2868,    0, 1863, 2766, 2901, 3641, 3663, 2728,    0,    0,
-     2908,    0, 2941,    0, 1916, 2708, 2948, 3686, 3708, 2707,
-        0,    0, 1108, 2981, 2713, 2263, 2266, 2692, 2691, 2446,
-     2491, 3731, 2682, 3754, 1110, 2680, 2686, 2245, 2328, 2958,
-     2327, 1712, 2738, 2976, 1711, 2998, 2725, 1734, 1758, 1757,
-     2777, 1818, 1955, 1431, 2694, 1871, 3016, 1956, 1995, 2121,
-     3795, 3818, 3827, 2222, 2660, 2659, 3844, 1167, 2655, 3884,
-     1169, 2637, 3924, 1170, 2635, 3964, 1301, 2616, 2614, 2592,
+     2218, 1730, 3250, 3272, 3295,  981, 3334, 3357, 3380, 2897,
+     3387, 3410, 3432, 2896, 3455, 3477, 2884, 3500, 3522, 2863,
+     2862, 2860, 3544, 2344, 3567, 3589, 2858,    0, 2351,    0,
+     1556, 2857, 2743, 3612, 3634, 2856,    0, 2877,    0, 2884,
+        0, 1880, 2832, 2917, 3657, 3679, 2831,    0,    0, 2924,
+        0, 2957,    0, 1932, 2829, 2964, 3702, 3724, 2827,    0,
+        0, 1031, 2997, 2834, 2277, 2279, 2815, 2814, 2282, 2462,
+     3747, 2802, 3770, 1033, 2782, 2789, 2344, 2741, 2974, 2343,
+     1888, 2754, 2992, 2009, 3014, 2505, 2135, 3032, 2238, 2461,
+     2793, 2239, 1971, 1774, 3095, 3052, 2298, 2299, 3055, 2091,
 
-     4003, 4026, 1306, 2572, 2711, 2738, 4066, 2570, 4089, 1365,
-     2569, 2558, 2956, 2996, 2555, 2553, 3033, 3037, 4129, 2527,
-     4152, 1412, 2525, 2513, 1475, 3051, 2510, 3059, 3095, 2508,
-     2488, 3096, 3100, 4192, 2478, 4215, 1477, 2460, 2465,    0,
-     1501, 3114, 2463, 3122, 3158, 2462, 2441, 3159, 3163, 4255,
-     2413, 4278, 1503, 2412, 2418,    0, 3177,    0, 3301,    0,
-     1962, 2409, 3308, 4318, 4340, 2408,    0, 3158, 3764, 3765,
-     2223, 3078, 3317, 2283, 3204, 2735, 2423, 2424, 2224, 3768,
-     3318, 2445, 2282, 3837, 2490, 3839, 2468, 2513, 3771, 4364,
-     4387, 4396, 2384, 4412, 4435, 4457, 2383, 4480, 4502, 2380,
+     1813, 2137, 2240, 3811, 3834, 3843, 2439, 2779, 2759, 3860,
+     1035, 2757, 3900, 1055, 2724, 3940, 1082, 2721, 3980, 1083,
+     2701, 2700, 2699, 4019, 4042, 1167, 2698, 2727, 2754, 4082,
+     2678, 4105, 1196, 2676, 2683, 2972, 3053, 2664, 2661, 3075,
+     3112, 4145, 2651, 4168, 1197, 2633, 2616, 1301, 3126, 2614,
+     3136, 3138, 2571, 2569, 3174, 3179, 4208, 2543, 4231, 1305,
+     2541, 2548,    0, 1306, 3193, 2546, 3201, 3220, 2545, 2527,
+     3304, 3305, 4271, 2494, 4294, 1426, 2473, 2479,    0, 3319,
+        0, 3326,    0, 1978, 2451, 3792, 4334, 4356, 2449,    0,
+     3857, 3859, 3871, 2440, 3157, 3075, 2462, 3220, 2508, 2506,
 
-     4525, 4547, 2349, 4570, 4592, 2348, 2347, 4615, 1530, 2296,
-     2289, 3869, 4655, 2212, 2209,    0, 3906,    0, 1995, 2208,
-     3913, 4678, 2188, 2164,    0, 3946,    0, 3953,    0, 2005,
-     2160, 3986, 4701, 2153, 2130,    0,    0, 3993,    0, 4048,
-        0, 2035, 2101, 4055, 4724, 2100, 2097,    0,    0, 4111,
-        0, 4118,    0, 2385, 2067, 4174, 4747, 2064, 2037,    0,
-        0, 1531, 4181, 2014, 3204, 3410, 2010, 2008, 3455, 3500,
-     4770, 1996, 4793, 1532, 1960, 1964, 2512, 2535, 2557, 2580,
-     2558, 2604, 4225, 2602, 2603, 4209, 2800, 4288, 3838, 4272,
-     3861, 4002, 4065, 4608, 3843, 2626, 2648, 4609, 4834, 1955,
+     2507, 2484, 3784, 2551, 3893, 2573, 2575, 3894, 2596, 3853,
+     2574, 3786, 3787, 2619, 3916, 2620, 4380, 4403, 4412, 2429,
+     4428, 4451, 4473, 2428, 4496, 4518, 2426, 4541, 4563, 2425,
+     4586, 4608, 2424, 2400, 4631, 1431, 2399, 2396, 3962, 4671,
+     2365, 2364,    0, 3969,    0, 2011, 2363, 4002, 4694, 2305,
+     2287,    0, 4009,    0, 4064,    0, 2113, 2268, 4071, 4717,
+     2228, 2225,    0,    0, 4127,    0, 4134,    0, 2401, 2224,
+     4190, 4740, 2204, 2180,    0,    0, 4197,    0, 4253,    0,
+     2731, 2176, 4260, 4763, 2169, 2146,    0,    0, 1490, 4316,
+     2133, 3426, 3471, 2132, 2091, 3516, 3857, 4786, 2081, 4809,
 
-     4850, 4873, 1558, 1915, 4913, 1602, 1914, 4953, 1648, 1913,
-     4993, 1695, 1911, 5033, 1715, 1910, 1909, 4241, 5073, 1880,
-     1806,    0, 1804, 3769, 4002, 5096, 1767, 1747, 1707, 4063,
-     4126, 1706, 1686, 4189, 4250, 5119, 1658, 1652, 1622, 1738,
-     4304, 1619, 4314, 4334, 1617, 1615, 4406, 4407, 5142, 1587,
-     1567, 1574,    0, 1797, 4639, 1541, 4409, 4411, 1511, 1510,
-     4451, 4496, 5165, 1480, 1479, 1446,    0, 1799, 4646,  121,
-     4541, 4803,  145,  164, 4804, 4806, 5188,  168,  308,  373,
-        0, 4820,    0, 4895,    0, 3038,  393, 4902, 5211,    0,
-      450,    0, 2649, 2671, 2757, 2779, 2801, 4803, 4830, 4912,
+     1492, 2080, 2069, 2618, 2641, 2663, 2686, 2664, 2795, 4641,
+     2817, 2796, 3895, 3264, 4018, 4642, 4803, 4819, 4019, 4080,
+     4144, 4821, 4823, 3118, 4081, 3050, 3265, 4825, 3266, 4857,
+     2021, 4873, 4896, 1494, 2019, 4936, 1518, 2016, 4976, 1520,
+     2012, 5016, 1547, 1976, 5056, 1548, 1972, 1971, 4323, 5096,
+     1960, 1931,    0, 1930, 3916, 4142, 5119, 1929, 1927, 1933,
+     4205, 4268, 1905, 1881, 4331, 4350, 5142, 1847, 1807, 1813,
+     1549, 4419, 1771, 4427, 4467, 1769, 1768, 4512, 4557, 5165,
+     1718, 1695, 1700,    0, 1575, 4658,  121, 4642, 4666,  145,
+      164, 4833, 4868, 5188,  168,  308,  373,    0, 1619, 4918,
 
-     4128, 3124, 4191, 4317, 3226, 4831, 4930, 4411, 2780, 3250,
-     4832, 4924, 5234, 1802,    0,  505, 5274,    0,  532, 5297,
-        0,  548, 5320,    0,  568, 5343,    0,  600, 5366,    0,
-      618, 4849, 4910, 5389,  619,  621,  622,  657,  650, 4975,
-        0, 3264,  672,  673, 4982,    0, 5015,    0, 3379,  692,
-      755,    0, 5022,    0, 5055,    0, 3777,  759,  761,    0,
-     5062,    0, 5256,    0, 3778,  779,  818,    0, 5263,    0,
-     5411,    0, 3782,  821,  864,    0, 1826, 5418,  904, 5070,
-     5271,  905,  924, 5426, 5427, 5467,  918,    0,  945, 5072,
-     3410, 3455, 3249, 3272, 5429, 2878, 3387, 3432, 3454, 5430,
+      401, 4870, 4912,  458,  534, 4931, 4932, 5211,  532,  548,
+      576,    0, 4958,    0, 4998,    0, 3064,  600, 5005, 5234,
+        0,  621,    0, 2894, 2934, 3010, 3013, 3349, 5015, 5050,
+     5026, 4207, 5027, 3403, 4270, 4333, 3350, 4668, 4872, 4853,
+     5051, 4953, 3077, 3404, 5055, 5066, 3351, 5257, 1620,    0,
+      622, 5297,    0,  649, 5320,    0,  650, 5343,    0,  652,
+     5366,    0,  671, 5389,    0,  672, 4933, 5072, 5412,  673,
+      692,  711,  763,  759, 5279,    0, 3065,  761,  779, 5286,
+        0, 5434,    0, 3303,  821,  864,    0, 5441,    0, 5448,
+        0, 3889,  896,  897,    0, 5455,    0, 5462,    0, 3923,
 
-     3499, 5431, 5432, 3409, 4313, 5433, 5490,  939,  983,    0,
-        0,    0,    0,    0,    0, 5432,    0, 4230,  986,  987,
-        0, 5442, 5462, 1014, 1015,    0, 1850, 5512, 1046, 5464,
-     5506, 1068, 1091,    0,    0, 1852, 5520, 1125, 5528, 5529,
-     1144, 1145,    0,    0, 1854, 5529, 1182, 5537, 5538, 1210,
-     1237,    0,    0, 1993, 5552, 1239, 5546, 5547, 1241, 1242,
-        0,    0, 5568,    0, 5577,    0, 4231, 1268,    0, 4927,
-     5588, 5590, 2918, 3500, 5589, 5592, 5593, 5594, 5595, 5591,
-     3545, 5596, 3567, 5273, 5599, 3522,    0, 7626,    0,    0,
-        0,    0,    0,    0, 5622, 5624, 1277, 1279,    0, 7626,
+      918,  937,    0, 5469,    0, 5476,    0, 3927,  939,  983,
+        0, 1640, 5483, 1015, 5091, 5294, 1068, 1120, 5491, 5492,
+     5532, 1116,    0, 1126, 5296, 3138, 3242, 3426, 3448, 5494,
+     5495, 3470, 3471, 3493, 3515, 5496, 3516, 5497, 4826, 3560,
+     5510, 3561, 4851, 5503, 3582, 5555, 1164, 1197,    0,    0,
+        0,    0,    0,    0, 5577,    0, 3928, 1200, 1201,    0,
+     5503, 5504, 1237, 1239,    0, 1710, 5584, 1241, 5507, 5508,
+     1242, 1279,    0,    0, 1817, 5591, 1282, 5599, 5600, 1316,
+     1317,    0,    0, 1843, 5600, 1378, 5608, 5609, 1379, 1382,
+        0,    0, 1844, 5614, 1406, 5610, 5611, 1422, 1429,    0,
 
-     5627,    0, 7626,    0, 5638,    0, 7626,    0, 5645,    0,
-     7626,    0, 5652,    0, 7626,    0, 5663,    0, 7626,    0,
-     2030, 5670, 1281, 5678, 5679, 1282, 4293,    0, 3544, 5681,
-     3589, 3590, 5682, 5685, 5686, 3611, 5687, 5688, 3613, 5683,
-     5690, 5695, 3656, 5684,    0, 5730,    0, 2059, 5737, 1316,
-        0, 2093, 5744, 1319,    0, 2096, 5751, 1378,    0, 2159,
-     5758, 1382,    0, 2347, 5765, 1402,    0, 5772,    0, 7626,
-     3657, 5689, 3658, 3680, 3702, 5781, 5783, 5784, 5696, 3703,
-     5785, 3679, 5786, 2348, 5785, 1425,    0,    0,    0,    0,
-        0,    0, 2376, 5802, 1428, 5795, 5797, 5697, 5796, 3724,
+        0, 5625,    0, 5639,    0, 3929, 1455,    0, 4950, 5635,
+     4600, 3584, 3606, 5636, 5637, 5655, 5656, 5657, 5658, 5659,
+     3629, 5660, 3651, 5663, 5662, 5668, 5669, 3628, 3605,    0,
+     7736,    0,    0,    0,    0,    0,    0, 5677, 5686, 1468,
+     1505,    0, 7736, 5701,    0, 7736,    0, 5708,    0, 7736,
+        0, 5716,    0, 7736,    0, 5725,    0, 7736,    0, 5732,
+        0, 7736,    0, 1895, 5739, 1528, 5747, 5748, 1558, 4436,
+        0, 3672, 5093, 3673, 3674, 5750, 5752, 5751, 5755, 3695,
+     5756, 5757, 3717, 5753, 5760, 3740, 5754, 5761, 3719, 5758,
+     3741,    0, 5796,    0, 2009, 5803, 1591,    0, 2012, 5810,
 
-     5815, 3725, 4083, 5817, 5818, 5821, 3701,    0,    0,    0,
-        0,    0,    0,    0, 3790, 5824, 4254, 4563, 5825, 5826,
-     5828, 5830, 3841, 5833, 5840,    0,    0, 3881, 4356, 4450,
-     4473, 5839, 4496, 5849, 3883, 5855, 5859, 5861, 5862, 4250,
-     5873, 4406, 5851, 4540, 5874, 4585, 4541, 4586, 5877, 5875,
-     5881, 5880, 5899, 5883, 4671, 5886, 5905, 5906, 3923, 5908,
-     5909, 5912, 4672, 4695, 5919, 5930, 5920, 5931, 4718, 4741,
-     5933, 3963, 5935, 4763, 5934, 5938, 4764, 4252, 5090, 5943,
-     5953, 5956, 5961, 5112, 5958, 5962, 5967, 5971, 4587, 5981,
-     5982, 5983, 5113, 5987, 4866, 5136, 5990, 4992, 5991, 5995,
+     1592,    0, 2046, 5817, 1612,    0, 2175, 5824, 1636,    0,
+     2363, 5831, 1639,    0, 5838,    0, 7736, 3763, 5847, 4099,
+     5765, 4372, 4512, 5848, 5850, 5851, 5854, 4557, 5766, 3808,
+     3935, 3809, 5853, 3979, 2364, 5853, 1677,    0,    0,    0,
+        0,    0,    0, 2392, 5870, 1681, 5862, 5880, 5882, 5884,
+     5890, 4349, 5891, 4162, 4288, 5892, 5885, 5893, 5895, 4444,
+        0,    0,    0,    0,    0,    0,    0, 4466, 5896, 4489,
+     5900, 5903, 5914, 5918, 5919, 5925, 4534, 5926, 5927, 4556,
+        0,    0, 4579, 4601, 4688, 4711, 4734, 5930, 4757, 5933,
+     4603, 5937, 5764, 4780, 5948, 5955, 5958, 5028, 5960, 5090,
 
-     5158, 5159, 6001, 5205, 5032, 6002, 5204, 5228, 5227, 6005,
-     6006, 6015, 6009, 5291, 6014, 5313, 6016, 6045, 5314, 5336,
-     5337, 5359, 7626, 6068, 6075, 6079, 6082, 6085, 6088, 6091,
-     6094, 6097, 6100, 6103, 6106, 6109, 6112, 6115, 6118, 6121,
-     6124, 6127, 6131, 6135, 6138, 6141, 6144, 6147, 6150, 6153,
-     6156, 6159, 6163, 6167, 6170, 6173, 6177, 6179, 6182, 6185,
-     6188, 6191, 6194, 6197, 6200, 6203, 6207, 6209, 6212, 6216,
-     6221, 6225, 6228, 6232, 6235, 6238, 6241, 6244, 6247, 6250,
-     6253, 6257, 6261, 6264, 6268, 6272, 6277, 6281, 6283, 6287,
-     6290, 6294, 6297, 6300, 6304, 6306, 6309, 6312, 6315, 6318,
+     5964, 5030, 5961, 5091, 4867, 5963, 5135, 5136, 5966, 5967,
+     5979, 5973, 5986, 5974, 5158, 5987, 4912, 5999, 6001, 4975,
+     6006, 6007, 6009, 5181, 5182, 6015, 6010, 6017, 6020, 5205,
+     5228, 6028, 5250, 6030, 5251, 6031, 6040, 5337, 5314, 5336,
+     6044, 6049, 6050, 6055, 5359, 6053, 6054, 6056, 6069, 5382,
+     6076, 6062, 6077, 5383, 6084, 5406, 6080, 6091, 5498, 6096,
+     6098, 6099, 5499, 6100, 5549, 5500, 6102, 5852, 6105, 6103,
+     6107, 6109, 6111, 6112, 6118, 6130, 6131, 6136, 6151, 6139,
+     6141, 6143, 6144, 7736, 6178, 6185, 6189, 6192, 6195, 6198,
+     6201, 6204, 6207, 6210, 6213, 6216, 6219, 6222, 6225, 6228,
 
-     6321, 6324, 6327, 6330, 6333, 6337, 6339, 6342, 6345, 6348,
-     6352, 6354, 6357, 6360, 6365, 6369, 6374, 6378, 6380, 6384,
-     6387, 6391, 6396, 6400, 6403, 6406, 6409, 6412, 6415, 6418,
-     6421, 6425, 6429, 6432, 6436, 6440, 6445, 6449, 6451, 6455,
-     6458, 6462, 6465, 6470, 6474, 6479, 6483, 6485, 6489, 6492,
-     6496, 6499, 6502, 6505, 6509, 6511, 6514, 6519, 6523, 6526,
-     6529, 6532, 6535, 6538, 6541, 6544, 6547, 6551, 6553, 6556,
-     6559, 6562, 6566, 6568, 6571, 6574, 6577, 6580, 6584, 6586,
-     6589, 6592, 6595, 6600, 6604, 6609, 6613, 6615, 6619, 6622,
-     6626, 6631, 6635, 6638, 6641, 6644, 6647, 6650, 6653, 6656,
+     6231, 6234, 6237, 6241, 6245, 6248, 6251, 6254, 6257, 6260,
+     6263, 6266, 6269, 6273, 6277, 6280, 6283, 6287, 6289, 6292,
+     6295, 6298, 6301, 6304, 6307, 6310, 6313, 6317, 6319, 6322,
+     6326, 6331, 6335, 6338, 6342, 6345, 6348, 6351, 6354, 6357,
+     6360, 6363, 6367, 6371, 6374, 6378, 6382, 6387, 6391, 6393,
+     6397, 6400, 6404, 6407, 6410, 6414, 6416, 6419, 6422, 6425,
+     6428, 6431, 6434, 6437, 6440, 6443, 6447, 6449, 6452, 6455,
+     6458, 6462, 6464, 6467, 6470, 6475, 6479, 6484, 6488, 6490,
+     6494, 6497, 6501, 6506, 6510, 6513, 6516, 6519, 6522, 6525,
+     6528, 6531, 6535, 6539, 6542, 6546, 6550, 6555, 6559, 6561,
 
-     6660, 6664, 6667, 6671, 6675, 6680, 6684, 6686, 6690, 6693,
-     6697, 6700, 6705, 6709, 6714, 6718, 6720, 6724, 6727, 6731,
-     6734, 6737, 6742, 6746, 6751, 6755, 6757, 6761, 6764, 6768,
-     6771, 6774, 6777, 6781, 6783, 6786, 6791, 6795, 6798, 6801,
-     6804, 6807, 6810, 6813, 6816, 6819, 6822, 6825, 6828, 6832,
-     6834, 6837, 6840, 6843, 6846, 6850, 6852, 6855, 6858, 6861,
-     6864, 6867, 6871, 6873, 6876, 6879, 6882, 6885, 6888, 6892,
-     6894, 6897, 6900, 6903, 6906, 6911, 6915, 6920, 6924, 6926,
-     6930, 6933, 6937, 6942, 6946, 6949, 6952, 6955, 6958, 6961,
-     6964, 6967, 6970, 6973, 6977, 6981, 6984, 6988, 6992, 6997,
+     6565, 6568, 6572, 6575, 6580, 6584, 6589, 6593, 6595, 6599,
+     6602, 6606, 6609, 6612, 6615, 6619, 6621, 6624, 6629, 6633,
+     6636, 6639, 6642, 6645, 6648, 6651, 6654, 6657, 6661, 6663,
+     6666, 6669, 6672, 6676, 6678, 6681, 6684, 6687, 6690, 6694,
+     6696, 6699, 6702, 6705, 6710, 6714, 6719, 6723, 6725, 6729,
+     6732, 6736, 6741, 6745, 6748, 6751, 6754, 6757, 6760, 6763,
+     6766, 6770, 6774, 6777, 6781, 6785, 6790, 6794, 6796, 6800,
+     6803, 6807, 6810, 6815, 6819, 6824, 6828, 6830, 6834, 6837,
+     6841, 6844, 6847, 6852, 6856, 6861, 6865, 6867, 6871, 6874,
+     6878, 6881, 6884, 6887, 6891, 6893, 6896, 6901, 6905, 6908,
 
-     7001, 7003, 7007, 7010, 7014, 7017, 7022, 7026, 7031, 7035,
-     7037, 7041, 7044, 7048, 7051, 7054, 7059, 7063, 7068, 7072,
-     7074, 7078, 7081, 7085, 7088, 7091, 7096, 7100, 7105, 7109,
-     7111, 7115, 7118, 7122, 7125, 7128, 7131, 7135, 7137, 7140,
-     7143, 7148, 7152, 7155, 7158, 7161, 7164, 7167, 7170, 7173,
-     7176, 7179, 7182, 7185, 7189, 7193, 7196, 7199, 7203, 7206,
-     7209, 7213, 7215, 7218, 7221, 7225, 7227, 7230, 7233, 7236,
-     7240, 7242, 7245, 7248, 7251, 7255, 7257, 7260, 7263, 7266,
-     7270, 7272, 7275, 7278, 7283, 7287, 7292, 7296, 7298, 7302,
-     7305, 7309, 7314, 7318, 7321, 7324, 7327, 7330, 7333, 7336,
+     6911, 6914, 6917, 6920, 6923, 6926, 6929, 6932, 6935, 6938,
+     6942, 6944, 6947, 6950, 6953, 6956, 6960, 6962, 6965, 6968,
+     6971, 6974, 6977, 6981, 6983, 6986, 6989, 6992, 6995, 6998,
+     7002, 7004, 7007, 7010, 7013, 7016, 7021, 7025, 7030, 7034,
+     7036, 7040, 7043, 7047, 7052, 7056, 7059, 7062, 7065, 7068,
+     7071, 7074, 7077, 7080, 7083, 7087, 7091, 7094, 7098, 7102,
+     7107, 7111, 7113, 7117, 7120, 7124, 7127, 7132, 7136, 7141,
+     7145, 7147, 7151, 7154, 7158, 7161, 7164, 7169, 7173, 7178,
+     7182, 7184, 7188, 7191, 7195, 7198, 7201, 7206, 7210, 7215,
+     7219, 7221, 7225, 7228, 7232, 7235, 7238, 7241, 7245, 7247,
 
-     7339, 7342, 7346, 7348, 7351, 7355, 7360, 7364, 7365, 7368,
-     7373, 7377, 7382, 7386, 7387, 7390, 7393, 7398, 7402, 7407,
-     7411, 7412, 7415, 7418, 7423, 7427, 7432, 7436, 7437, 7440,
-     7443, 7448, 7452, 7457, 7461, 7462, 7465, 7468, 7471, 7475,
-     7477, 7482, 7486, 7489, 7492, 7495, 7498, 7501, 7504, 7508,
-     7513, 7517, 7518, 7521, 7524, 7527, 7530, 7533, 7536, 7539,
-     7542, 7545, 7548, 7553, 7557, 7560, 7563, 7566, 7570, 7574,
-     7578, 7582, 7586, 7589, 7592, 7596, 7599, 7602, 7605, 7608,
-     7611, 7615, 7618
+     7250, 7253, 7258, 7262, 7265, 7268, 7271, 7274, 7277, 7280,
+     7283, 7286, 7289, 7292, 7295, 7299, 7303, 7306, 7309, 7313,
+     7316, 7319, 7323, 7325, 7328, 7331, 7335, 7337, 7340, 7343,
+     7346, 7350, 7352, 7355, 7358, 7361, 7365, 7367, 7370, 7373,
+     7376, 7380, 7382, 7385, 7388, 7393, 7397, 7402, 7406, 7408,
+     7412, 7415, 7419, 7424, 7428, 7431, 7434, 7437, 7440, 7443,
+     7446, 7449, 7452, 7456, 7458, 7461, 7465, 7470, 7474, 7475,
+     7478, 7483, 7487, 7492, 7496, 7497, 7500, 7503, 7508, 7512,
+     7517, 7521, 7522, 7525, 7528, 7533, 7537, 7542, 7546, 7547,
+     7550, 7553, 7558, 7562, 7567, 7571, 7572, 7575, 7578, 7581,
+
+     7585, 7587, 7592, 7596, 7599, 7602, 7605, 7608, 7611, 7614,
+     7618, 7623, 7627, 7628, 7631, 7634, 7637, 7640, 7643, 7646,
+     7649, 7652, 7655, 7658, 7663, 7667, 7670, 7673, 7676, 7680,
+     7684, 7688, 7692, 7696, 7699, 7702, 7706, 7709, 7712, 7715,
+     7718, 7721, 7725, 7728
     } ;
 
-static const flex_int16_t yy_def[2184] =
+static const flex_int16_t yy_def[2245] =
     {   0,
-     1723,    1, 1723, 1723, 1723, 1723, 1723, 1724, 1723, 1723,
-     1723,   11, 1723, 1723, 1723, 1723,   11,   17, 1725,   17,
+     1784,    1, 1784, 1784, 1784, 1784, 1784, 1785, 1784, 1784,
+     1784,   11, 1784, 1784, 1784, 1784,   11,   17, 1786,   17,
        17,   17,   17,   17,   17,   18,   18,   18,   18,   18,
-       18,   18,   18,   18,   18,   18,   18,   18,   18, 1723,
-     1723, 1726, 1723,   18,   18,   17, 1727,   46,   18,   18,
-       18, 1723, 1723, 1723, 1723, 1723, 1723,   45, 1725,   48,
+       18,   18,   18,   18,   18,   18,   18,   18,   18, 1784,
+     1784, 1787, 1784,   18,   18,   17, 1788,   46,   18,   18,
+       18, 1784, 1784, 1784, 1784, 1784, 1784,   45, 1786,   48,
        48,   48,   18,   18,   18,   18,   48,   18,   18,   48,
        18,   18,   18,   48,   18,   18,   18,   18,   18,   48,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
@@ -1093,8 +1113,8 @@
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
-       18,   18,   18,   18,   18, 1723, 1723,   18,   18,  149,
-       18,   18,  152, 1728, 1723,   50, 1723,  157, 1729,   18,
+       18,   18,   18,   18,   18, 1784, 1784,   18,   18,  149,
+       18,   18,  152, 1789, 1784,   50, 1784,  157, 1790,   18,
        18,  153,   18,   18,   18,  153,   18,   18,   18,   18,
        18,   18,  153,   18,   18,   18,   18,   18,   18,   18,
       153,   18,   18,   18,   18,   18,   18,   18,   18,   18,
@@ -1106,8 +1126,8 @@
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
-      257,  258,  153, 1730,  263, 1731, 1732, 1723,  268, 1733,
-     1734, 1723, 1723, 1723, 1735, 1736,   18,   18,   18,   18,
+       18,  258,  259,  153, 1791,  264, 1792, 1793, 1784,  269,
+     1794, 1795, 1784, 1784, 1784, 1796, 1797,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
 
@@ -1115,212 +1135,219 @@
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
-       18,   18,   18,   18,   18,  345,   18,  258,  260,  258,
-      260,  260,  352, 1737, 1723,  351, 1738, 1739, 1723, 1723,
-     1723, 1723, 1740, 1741, 1742, 1743, 1743, 1723, 1744, 1723,
-      370, 1745, 1736,   18,   18,   18,   18,   18,   18,   18,
+       18,   18,   18,   18,   18,   18,   18,  347,   18,  259,
+      261,  259,  261,  261,  354, 1798, 1784,  353, 1799, 1800,
+     1784, 1784, 1784, 1784, 1801, 1802, 1803, 1804, 1804, 1784,
+     1805, 1784,  372, 1806, 1797,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
 
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
-      427,  428,  428,  433,  427,  352,  436, 1746, 1747, 1723,
-      440, 1748, 1723, 1749, 1750, 1723,  446, 1751, 1752, 1753,
-     1753, 1723, 1754, 1723,  454, 1755, 1741, 1723, 1723, 1756,
-     1757, 1723, 1723, 1723, 1723, 1758, 1759,   18,   18,   18,
+       18,   18,   18,  430,  431,  431,  436,  430,  354,  439,
+     1807, 1808, 1784,  443, 1809, 1784, 1810, 1811, 1784,  449,
+     1812, 1813, 1814, 1814, 1784, 1815, 1784,  457, 1816, 1802,
+     1784, 1784, 1817, 1818, 1784, 1784, 1784, 1784, 1819, 1820,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
 
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
-       18,   18,   18,   18,   18,   18,   18,  517,   18,  428,
-      430,  428,  428,  523,  436,  525, 1760, 1723, 1723, 1723,
-     1761, 1762, 1763, 1723, 1723, 1723, 1723, 1764, 1765, 1723,
-     1766, 1767, 1723, 1723, 1723, 1723, 1768, 1769, 1770, 1770,
-     1756, 1757, 1771, 1771, 1723, 1772, 1723,  557, 1773, 1774,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
+       18,  521,   18,  431,  433,  431,  431,  527,  439,  529,
+     1821, 1784, 1784, 1784, 1822, 1823, 1824, 1784, 1784, 1784,
+     1784, 1825, 1826, 1784, 1827, 1828, 1784, 1784, 1784, 1784,
+     1829, 1830, 1831, 1831, 1817, 1818, 1832, 1832, 1784, 1833,
+     1784,  561, 1834, 1835,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
 
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
-       18,   18,   18,  611,  611,  615,  525,  617, 1775, 1776,
-     1723,  621, 1777, 1723,  624, 1778, 1723, 1779, 1780, 1723,
-      630, 1781, 1782, 1782, 1723, 1783, 1723,  637, 1784, 1785,
-     1786, 1786, 1787, 1788, 1789, 1789, 1723, 1790, 1723,  649,
-     1791, 1792, 1723, 1793, 1723, 1794, 1795, 1723, 1723, 1723,
-     1723, 1796, 1797,  618,  664,  664,  664,  664,  664,  664,
-      664,  664,  664,  664,  664,  664,  664,  664,  664,  664,
-      664,  664,  664,  664,  664,  664,  664,  664,  664,  664,
-      664,  664,  664,  664,  664,  664,  664,  664,  618,  618,
+       18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
+       18,  619,  527,  623,  529,  625, 1836, 1837, 1784,  629,
+     1838, 1784,  632, 1839, 1784, 1840, 1841, 1784,  638, 1842,
+     1843, 1843, 1784, 1844, 1784,  645, 1845, 1846, 1847, 1847,
+     1848, 1849, 1850, 1850, 1784, 1851, 1784,  657, 1852, 1853,
+     1784, 1854, 1784, 1855, 1856, 1784, 1784, 1784, 1784, 1857,
+     1858,  626,  672,  672,  672,  672,  672,  672,  672,  672,
+      672,  672,  672,  672,  672,  672,  672,  672,  672,  672,
+      672,  672,  672,  672,  672,  672,  672,  672,  672,  672,
 
-      664,  701,  701,  701,  664,  701,  706, 1798, 1723, 1723,
-     1723, 1799, 1723, 1723, 1800, 1801, 1802, 1723, 1723, 1723,
-     1723, 1803, 1804, 1723, 1805, 1806, 1723, 1723, 1723, 1723,
-     1807, 1808, 1723, 1809, 1723, 1810, 1811, 1723, 1723, 1723,
-     1723, 1812, 1813, 1814, 1723, 1815, 1816, 1816, 1817, 1818,
-     1819, 1819, 1723, 1820, 1723,  755, 1821, 1822, 1823, 1823,
-     1823, 1823, 1823, 1823, 1823, 1823, 1823, 1823, 1823, 1823,
-     1823, 1823, 1823, 1823, 1823, 1823, 1823, 1823, 1823, 1823,
-     1823, 1823, 1823, 1823, 1823, 1823, 1823, 1823, 1823, 1823,
-      789, 1823,  789,  793,  793,  795, 1824, 1825, 1723,  799,
+      672,  672,  672,  672,  672,  672,  672,  672,  672,  626,
+      626,  672,  712,  712,  712,  672,  712,  717, 1859, 1784,
+     1784, 1784, 1860, 1784, 1784, 1861, 1862, 1863, 1784, 1784,
+     1784, 1784, 1864, 1865, 1784, 1866, 1867, 1784, 1784, 1784,
+     1784, 1868, 1869, 1784, 1870, 1784, 1871, 1872, 1784, 1784,
+     1784, 1784, 1873, 1874, 1875, 1784, 1876, 1877, 1877, 1878,
+     1879, 1880, 1880, 1784, 1881, 1784,  766, 1882, 1883, 1884,
+     1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
+     1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
+     1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884,
 
-     1826, 1723,  802, 1827, 1723,  805, 1828, 1723, 1829, 1830,
-     1723,  811, 1831, 1832, 1832, 1723, 1833, 1723,  818, 1834,
-     1835, 1836, 1836, 1837, 1838, 1839, 1839, 1723, 1840, 1723,
-      830, 1841, 1842, 1843, 1723, 1844, 1845, 1845, 1846, 1847,
-     1848, 1848, 1723, 1849, 1723,  845, 1850, 1851, 1852, 1723,
-     1853, 1723, 1854, 1855, 1723, 1723, 1723, 1723, 1856, 1857,
-     1858, 1858, 1858, 1858, 1858, 1858, 1858, 1858, 1858, 1858,
-     1858, 1858, 1858, 1858, 1858, 1858, 1858, 1858, 1858, 1858,
-     1858, 1858, 1858, 1858,  884,  884,  886,  884,  884,  889,
-     1859, 1723, 1723, 1723, 1860, 1723, 1723, 1861, 1723, 1723,
+     1884, 1884, 1884, 1884, 1884,  804, 1884,  804,  808,  808,
+      810, 1885, 1886, 1784,  814, 1887, 1784,  817, 1888, 1784,
+      820, 1889, 1784, 1890, 1891, 1784,  826, 1892, 1893, 1893,
+     1784, 1894, 1784,  833, 1895, 1896, 1897, 1897, 1898, 1899,
+     1900, 1900, 1784, 1901, 1784,  845, 1902, 1903, 1904, 1784,
+     1905, 1906, 1906, 1907, 1908, 1909, 1909, 1784, 1910, 1784,
+      860, 1911, 1912, 1913, 1784, 1914, 1784, 1915, 1916, 1784,
+     1784, 1784, 1784, 1917, 1918, 1919, 1919, 1919, 1919, 1919,
+     1919, 1919, 1919, 1919, 1919, 1919, 1919, 1919, 1919, 1919,
+     1919, 1919, 1919, 1919, 1919, 1919, 1919, 1919, 1919, 1919,
 
-     1862, 1863, 1864, 1723, 1723, 1723, 1723, 1865, 1866, 1723,
-     1867, 1868, 1723, 1723, 1723, 1723, 1869, 1870, 1723, 1871,
-     1723, 1872, 1873, 1723, 1723, 1723, 1723, 1874, 1875, 1876,
-     1723, 1877, 1723, 1878, 1879, 1723, 1723, 1723, 1723, 1880,
-     1881, 1882, 1883, 1723, 1884, 1885, 1885, 1886, 1887, 1888,
-     1888, 1723, 1889, 1723,  954, 1890, 1891, 1892, 1892, 1892,
-     1892, 1892, 1892, 1892, 1892, 1892, 1892, 1892, 1892, 1892,
-     1892, 1892, 1892, 1892, 1892, 1892, 1892, 1892, 1892, 1892,
-     1892,  981, 1892, 1892, 1893, 1894, 1723,  987, 1895, 1723,
-      990, 1896, 1723,  993, 1897, 1723,  996, 1898, 1723, 1899,
+     1919, 1919, 1919,  903,  903,  905,  903,  903,  908, 1920,
+     1784, 1784, 1784, 1921, 1784, 1784, 1922, 1784, 1784, 1923,
+     1924, 1925, 1784, 1784, 1784, 1784, 1926, 1927, 1784, 1928,
+     1929, 1784, 1784, 1784, 1784, 1930, 1931, 1784, 1932, 1784,
+     1933, 1934, 1784, 1784, 1784, 1784, 1935, 1936, 1937, 1784,
+     1938, 1784, 1939, 1940, 1784, 1784, 1784, 1784, 1941, 1942,
+     1943, 1944, 1784, 1945, 1946, 1946, 1947, 1948, 1949, 1949,
+     1784, 1950, 1784,  973, 1951, 1952, 1953, 1953, 1953, 1953,
+     1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953,
+     1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953,
 
-     1723, 1723, 1002, 1900, 1901, 1901, 1723, 1902, 1723, 1009,
-     1903, 1904, 1905, 1905, 1906, 1907, 1908, 1908, 1723, 1909,
-     1723, 1021, 1910, 1911, 1912, 1723, 1913, 1914, 1914, 1915,
-     1916, 1917, 1917, 1723, 1918, 1723, 1036, 1919, 1920, 1921,
-     1922, 1723, 1923, 1924, 1924, 1925, 1926, 1927, 1927, 1723,
-     1928, 1723, 1052, 1929, 1930, 1931, 1723, 1932, 1723, 1933,
-     1934, 1723, 1723, 1723, 1723, 1935, 1936, 1937, 1937, 1937,
-     1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937,
-     1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937,
-     1090, 1937, 1938, 1723, 1723, 1723, 1939, 1723, 1723, 1940,
+     1953, 1953, 1953, 1953, 1004, 1953, 1953, 1954, 1955, 1784,
+     1010, 1956, 1784, 1013, 1957, 1784, 1016, 1958, 1784, 1019,
+     1959, 1784, 1960, 1784, 1784, 1025, 1961, 1962, 1962, 1784,
+     1963, 1784, 1032, 1964, 1965, 1966, 1966, 1967, 1968, 1969,
+     1969, 1784, 1970, 1784, 1044, 1971, 1972, 1973, 1784, 1974,
+     1975, 1975, 1976, 1977, 1978, 1978, 1784, 1979, 1784, 1059,
+     1980, 1981, 1982, 1983, 1784, 1984, 1985, 1985, 1986, 1987,
+     1988, 1988, 1784, 1989, 1784, 1075, 1990, 1991, 1992, 1784,
+     1993, 1784, 1994, 1995, 1784, 1784, 1784, 1784, 1996, 1997,
+     1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998,
 
-     1723, 1723, 1941, 1723, 1723, 1942, 1943, 1723, 1108, 1944,
-     1945, 1723, 1723, 1946, 1947, 1948, 1723, 1949, 1950, 1723,
-     1723, 1723, 1951, 1952, 1953, 1723, 1954, 1723, 1955, 1956,
-     1723, 1723, 1723, 1957, 1958, 1959, 1960, 1723, 1961, 1723,
-     1962, 1963, 1723, 1723, 1723, 1964, 1965, 1966, 1967, 1723,
-     1968, 1723, 1969, 1970, 1723, 1723, 1723, 1971, 1972, 1973,
-     1974, 1975, 1723, 1976, 1977, 1977, 1978, 1979, 1980, 1980,
-     1723, 1981, 1723, 1173, 1982, 1983, 1984, 1984, 1984, 1984,
-     1984, 1984, 1984, 1984, 1984, 1984, 1984, 1984, 1984, 1984,
-     1984, 1984, 1984, 1984, 1984, 1984, 1984, 1984, 1984, 1985,
+     1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998,
+     1998, 1998, 1998, 1998, 1998, 1998, 1998, 1117, 1998, 1999,
+     1784, 1784, 1784, 2000, 1784, 1784, 2001, 1784, 1784, 2002,
+     1784, 1784, 2003, 2004, 1784, 1135, 2005, 2006, 1784, 1784,
+     2007, 2008, 2009, 1784, 2010, 2011, 1784, 1784, 1784, 2012,
+     2013, 2014, 1784, 2015, 1784, 2016, 2017, 1784, 1784, 1784,
+     2018, 2019, 2020, 2021, 1784, 2022, 1784, 2023, 2024, 1784,
+     1784, 1784, 2025, 2026, 2027, 2028, 1784, 2029, 1784, 2030,
+     2031, 1784, 1784, 1784, 2032, 2033, 2034, 2035, 2036, 1784,
+     2037, 2038, 2038, 2039, 2040, 2041, 2041, 1784, 2042, 1784,
 
-     1723, 1723, 1202, 1986, 1723, 1205, 1987, 1723, 1208, 1988,
-     1723, 1211, 1989, 1723, 1214, 1990, 1723, 1723, 1723, 1991,
-     1992, 1993, 1994, 1995, 1995, 1723, 1996, 1997, 1998, 1999,
-     1999, 2000, 2001, 2002, 2002, 1723, 2003, 2004, 2005, 2006,
-     1723, 2007, 2008, 2008, 2009, 2010, 2011, 2011, 1723, 2012,
-     2013, 2014, 2015, 2016, 1723, 2017, 2018, 2018, 2019, 2020,
-     2021, 2021, 1723, 2022, 2023, 2024, 2025, 2026, 1723, 2027,
-     2028, 2028, 2029, 2030, 2031, 2031, 1723, 2032, 2033, 2034,
-     2035, 1723, 2036, 1723, 2037, 2038, 1723, 1723, 1723, 2039,
-     2040, 2041, 2042, 2042, 2042, 2042, 2042, 2042, 2042, 2042,
+     1200, 2043, 2044, 2045, 2045, 2045, 2045, 2045, 2045, 2045,
+     2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045,
+     2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045,
+     2046, 1784, 1784, 1233, 2047, 1784, 1236, 2048, 1784, 1239,
+     2049, 1784, 1242, 2050, 1784, 1245, 2051, 1784, 1784, 1784,
+     2052, 2053, 2054, 2055, 2056, 2056, 1784, 2057, 2058, 2059,
+     2060, 2060, 2061, 2062, 2063, 2063, 1784, 2064, 2065, 2066,
+     2067, 1784, 2068, 2069, 2069, 2070, 2071, 2072, 2072, 1784,
+     2073, 2074, 2075, 2076, 2077, 1784, 2078, 2079, 2079, 2080,
+     2081, 2082, 2082, 1784, 2083, 2084, 2085, 2086, 2087, 1784,
 
-     2042, 2042, 2042, 2042, 2042, 2042, 2042, 2042, 2042, 2042,
-     2042, 2042, 1723, 1313, 2043, 2044, 1723, 2045, 2046, 1723,
-     2047, 2048, 1723, 2049, 2050, 1723, 2051, 2052, 1723, 2053,
-     2054, 2055, 2055, 1723, 2056, 2057, 2058, 2059, 2060, 1723,
-     2061, 2062, 1723, 2063, 1723, 2064, 1723, 2065, 2066, 1723,
-     2067, 2068, 1723, 2069, 1723, 2070, 2071, 1723, 2072, 2073,
-     1723, 2074, 1723, 2075, 2076, 1723, 2077, 2078, 1723, 2079,
-     1723, 2080, 2081, 1723, 2082, 2083, 2084, 1723, 2085, 2086,
-     2086, 2087, 2088, 2089, 2089, 1723, 2090, 2091, 2092, 2093,
-     2093, 2093, 2093, 2093, 2093, 2093, 2093, 2093, 2093, 2093,
+     2088, 2089, 2089, 2090, 2091, 2092, 2092, 1784, 2093, 2094,
+     2095, 2096, 1784, 2097, 1784, 2098, 2099, 1784, 1784, 1784,
+     2100, 2101, 2102, 2103, 2103, 2103, 2103, 2103, 2103, 2103,
+     2103, 2103, 2103, 2103, 2103, 2103, 2103, 2103, 2103, 2103,
+     2103, 2103, 2103, 2103, 2103, 2103, 2103, 1784, 1348, 2104,
+     2105, 1784, 2106, 2107, 1784, 2108, 2109, 1784, 2110, 2111,
+     1784, 2112, 2113, 1784, 2114, 2115, 2116, 2116, 1784, 2117,
+     2118, 2119, 2120, 2121, 1784, 2122, 2123, 1784, 2124, 1784,
+     2125, 1784, 2126, 2127, 1784, 2128, 2129, 1784, 2130, 1784,
+     2131, 2132, 1784, 2133, 2134, 1784, 2135, 1784, 2136, 2137,
 
-     2093, 2093, 2093, 2093, 2093, 2093, 1723, 2094, 2095, 2096,
-     2097, 2098, 2099, 2100, 2101, 1723, 2102, 2103, 1723, 2104,
-     2105, 2106, 2106, 2107, 2108, 2109, 2110, 1723, 2111, 2112,
-     2112, 2113, 2114, 2115, 2116, 2117, 1723, 2118, 2119, 2119,
-     2120, 2121, 2122, 2123, 2124, 1723, 2125, 2126, 2126, 2127,
-     2128, 2129, 2130, 2131, 1723, 2132, 2133, 2133, 2134, 2135,
-     2136, 2137, 1723, 2138, 1723, 2139, 2140, 1723, 2141, 2142,
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142, 2142, 2142, 2142, 2142, 2143, 1723, 2144, 2145,
-     2146, 2147, 2148, 2149, 2150, 2150, 2151, 2152, 2153, 1723,
+     1784, 2138, 2139, 1784, 2140, 1784, 2141, 2142, 1784, 2143,
+     2144, 2145, 1784, 2146, 2147, 2147, 2148, 2149, 2150, 2150,
+     1784, 2151, 2152, 2153, 2154, 2154, 2154, 2154, 2154, 2154,
+     2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154,
+     2154, 2154, 2154, 2154, 2154, 1784, 2155, 2156, 2157, 2158,
+     2159, 2160, 2161, 2162, 1784, 2163, 2164, 1784, 2165, 2166,
+     2167, 2167, 2168, 2169, 2170, 2171, 1784, 2172, 2173, 2173,
+     2174, 2175, 2176, 2177, 2178, 1784, 2179, 2180, 2180, 2181,
+     2182, 2183, 2184, 2185, 1784, 2186, 2187, 2187, 2188, 2189,
+     2190, 2191, 2192, 1784, 2193, 2194, 2194, 2195, 2196, 2197,
 
-     1723, 2154, 1723, 2155, 1723, 2156, 1723, 2157, 1723, 2158,
-     1723, 2159, 1723, 2160, 1723, 2161, 1723, 2162, 1723, 2137,
-     2163, 1723, 2138, 2164, 2164, 2139, 2140, 2165, 2142, 2142,
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142, 2142, 2142, 2166, 1723, 2167, 2168, 1723, 2154,
-     2155, 2169, 1723, 2156, 2157, 2170, 1723, 2158, 2159, 2171,
-     1723, 2160, 2161, 2172, 1723, 2162, 2173, 1723, 2174, 1723,
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142, 2142, 2175, 1723, 2167, 2176, 2177, 2178, 2179,
-     2180, 2173, 2181, 1723, 2174, 2142, 2142, 2142, 2142, 2142,
+     2198, 1784, 2199, 1784, 2200, 2201, 1784, 2202, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2204,
+     1784, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2211, 2212,
+     2213, 2214, 1784, 1784, 2215, 1784, 2216, 1784, 2217, 1784,
+     2218, 1784, 2219, 1784, 2220, 1784, 2221, 1784, 2222, 1784,
+     2223, 1784, 2198, 2224, 1784, 2199, 2225, 2225, 2200, 2201,
+     2226, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2227, 1784, 2228, 2229, 1784, 2215, 2216, 2230, 1784,
 
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2182, 2176, 2177,
-     2178, 2179, 2180, 2183, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142, 2142, 2142, 2142, 2182, 2183, 2142, 2142, 2142,
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
+     2217, 2218, 2231, 1784, 2219, 2220, 2232, 1784, 2221, 2222,
+     2233, 1784, 2223, 2234, 1784, 2235, 1784, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2236, 1784, 2228, 2237, 2238, 2239,
+     2240, 2241, 2234, 2242, 1784, 2235, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2243, 2237, 2238, 2239, 2240, 2241, 2244, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2243, 2244, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
 
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
-     2142, 2142,    0, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203,
+     2203, 2203, 2203,    0, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
 
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
 
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
 
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
 
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784
     } ;
 
-static const flex_int16_t yy_nxt[7679] =
+static const flex_int16_t yy_nxt[7789] =
     {   0,
         4,    5,    6,    5,    7,    8,    9,   10,    9,    9,
         4,   11,   12,   12,   12,   12,   12,   12,   13,   14,
@@ -1328,847 +1355,859 @@
        23,   24,   25,   26,   27,   28,   18,   29,   30,   31,
        32,   33,   18,   34,   35,   36,   37,   38,   39,   18,
        18,   40,   44,   45,   46,   46,   46,   46,   46,   46,
-       46,   47,   53,   54,   49,   48,   49,   50,  769,   51,
+       46,   47,   53,   54,  195,   48,   49,   50,  196,   51,
        48,   48,   48,   48,   48,   48,   49,   49,   49,   49,
        49,   49,   49,   49,   49,   49,   49,   49,   49,   49,
        49,   49,   50,   49,   49,   56,   57,   60,   74,   61,
 
-       62,  112,   75,  499,   63,   78,   79,   80,   76,   64,
-      113,   77,   81,   65,   67,   66,  192,  500,  193,   49,
+       62,  112,   75,  503,   63,   78,   79,   80,   76,   64,
+      113,   77,   81,   65,   67,   66,  192,  504,  193,   49,
        58,   48,   48,   48,   48,   48,   48,   48,   68,   70,
-      190, 1150,   82,  191,   49,   69,   83,  124,  206,   71,
-      201,  125,   72,   85,  207,   86,   73,  196,   84,  126,
-       87,   88,  197,   89,  127, 1152,  128,   90,  237,   49,
-       51,   49,   49,   49,   49,   49,   49,   49,   49, 1723,
-       99,  100,  202,   49,  937,  136,  238,  137,   49,   49,
-       49,   49,   49,   49,   91,  101, 1330,   92,   93,  102,
+      190, 1165,   82,  191,   49,   69,   83,  124,  207,   71,
+      202,  125,   72,   85,  208,   86,   73,  197,   84,  126,
+       87,   88,  198,   89,  127, 1167,  128,   90,  238,   49,
+       51,   49,   49,   49,   49,   49,   49,   49,   49, 1784,
+       99,  100,  203,   49,  944,  136,  239,  137,   49,   49,
+       49,   49,   49,   49,   91,  101, 1362,   92,   93,  102,
        94,  138,   95,  103,   96,  104,   97,  106,  139,   98,
 
-      119,  107,  105,  114,   49,  120,  121,  208,  122,  123,
-      108,  109,  209,  141,  110,  115,  111,  116,  129,  117,
-      203,  142,  118,  243,  130,  143,  131,  144,  132,   49,
-      231,  319,  133,  244,  134,  135,  148,  148,  148,  148,
-      148,  148,  148,  232,  320,  212,  204,  148,  213,  339,
-      214,  205,  148,  148,  148,  148,  148,  148,  149,  150,
-      150,  150,  150,  150,  150, 1723,  337,  681,  338,  151,
-       49,  350,  340,  682,  151,  151,  151,  151,  151,  151,
-       45,  152,  152,  152,  152,  152,  152,  152,  763,  412,
-     1723,   49,  153,  177,  413, 1723,   49,  153,  153,  153,
+      119,  107,  105,  114,   49,  120,  121,  209,  122,  123,
+      108,  109,  210,  141,  110,  115,  111,  116,  129,  117,
+      204,  142,  118,  244,  130,  143,  131,  144,  132,   49,
+      232,  321,  133,  245,  134,  135,  148,  148,  148,  148,
+      148,  148,  148,  233,  322,  213,  205,  148,  214,  341,
+      215,  206,  148,  148,  148,  148,  148,  148,  149,  150,
+      150,  150,  150,  150,  150, 1784,  339,  690,  340,  151,
+       49,  352,  342,  691,  151,  151,  151,  151,  151,  151,
+       45,  152,  152,  152,  152,  152,  152,  152,  774,  415,
+     1784,   49,  153,  177,  416, 1784,   49,  153,  153,  153,
 
       153,  153,  153,   58,  153,  153,  153,  153,  153,  153,
-      153,  156,  156,  156,  156,  156,  156,  156, 1723,  178,
-     1723,   49,  156,   49,  522,  179,  448,  156,  156,  156,
+      153,  156,  156,  156,  156,  156,  156,  156, 1784,  178,
+     1784,   49,  156,   49,  526,  179,  451,  156,  156,  156,
       156,  156,  156,  157,  158,  158,  158,  158,  158,  158,
-       49,  703,  762, 1723,  159,  760,   49,   49,   49,  159,
+       49,  714,  773, 1784,  159,  771,   49,   49,   49,  159,
       159,  159,  159,  159,  159,  151,  151,  151,  151,  151,
-      151,  151,  240,  347,  347,  347,  347,  347,  347,  347,
-      432,  241,  255,   49,  256,  256,  256,  256,  256,  256,
-      256, 1723, 1723, 1156,  260,  256,  375,  376,  377,  378,
-      256,  256,  256,  256,  256,  256,  257,  258,  258,  258,
+      151,  151,  241,  349,  349,  349,  349,  349,  349,  349,
+      435,  242,  256,   49,  257,  257,  257,  257,  257,  257,
+      257, 1784, 1784, 1171,  261,  257,  377,  378,  379,  380,
+      257,  257,  257,  257,  257,  257,  258,  259,  259,  259,
 
-      258,  258,  258,  258,  272,  379, 1723, 1723,  259,  260,
-      260, 1065,  274,  259,  259,  259,  259,  259,  259,  366,
-      367,  367,  367,  367,  367,  367,  435,  435,  435,  435,
-      435,  435,  435,  459,  776,  260,  261,  259,  259,  259,
-      259,  259,  259,  259, 1723,   49,  761,  460,  259, 1723,
-     1723,   49,   49,  259,  259,  259,  259,  259,  259,  262,
-      263,  263,  263,  263,  263,  263,  263,  264, 1290, 1723,
-       49,  265,  460, 1723, 1723, 1723,  265,  265,  265,  265,
-      265,  265,   49,  265,  265,  265,  265,  265,  265,  265,
-      268,  269,  269,  269,  269,  269,  269,  270, 1723,   49,
+      259,  259,  259,  259,  273,  381, 1784, 1784,  260,  261,
+      261, 1177,  275,  260,  260,  260,  260,  260,  260,  368,
+      369,  369,  369,  369,  369,  369,  438,  438,  438,  438,
+      438,  438,  438,  462,  788,  261,  262,  260,  260,  260,
+      260,  260,  260,  260, 1784,   49,  772,  463,  260, 1784,
+     1784,   49,   49,  260,  260,  260,  260,  260,  260,  263,
+      264,  264,  264,  264,  264,  264,  264,  265, 1179, 1784,
+       49,  266,  463, 1784, 1784, 1784,  266,  266,  266,  266,
+      266,  266,   49,  266,  266,  266,  266,  266,  266,  266,
+      269,  270,  270,  270,  270,  270,  270,  271, 1784,  784,
 
-      781,  271,  375,  376,  377,  378,  271,  271,  271,  271,
-      271,  271,  272,  273,  273,  273,  273,  273,  273,  273,
-      274,  459, 1723, 1408,  275,  485,  276,   51,  391,  275,
-      275,  275,  275,  275,  275, 1723,  392,  450,  451,  451,
-      451,  451,  451,  451,   51,  486,  495, 1723,  393,  765,
-     1318,  276,  344,  344,  344,  344,  344,  344,  344,  496,
-     1723,  487, 1723,  344,  394,  770, 1321,   49,  344,  344,
-      344,  344,  344,  344,  345,  346,  346,  346,  346,  346,
-      346,  360,  768,   49,   49,  347, 1324, 1723, 1723,  530,
-      347,  347,  347,  347,  347,  347,  257,  348,  348,  348,
+       49,  272,  377,  378,  379,  380,  272,  272,  272,  272,
+      272,  272,  273,  274,  274,  274,  274,  274,  274,  274,
+      275,  462, 1784,   49,  276,  488,  277,  780,  393,  276,
+      276,  276,  276,  276,  276, 1784,  394,  453,  454,  454,
+      454,  454,  454,  454,  956,  489,  499, 1784,  395,  776,
+     1365,  277,  346,  346,  346,  346,  346,  346,  346,  500,
+     1784,  490, 1784,  346,  396,  781,  451,   49,  346,  346,
+      346,  346,  346,  346,  347,  348,  348,  348,  348,  348,
+      348,  362,  779,   49,   49,  349, 1183, 1784, 1784,  534,
+      349,  349,  349,  349,  349,  349,  258,  350,  350,  350,
 
-      348,  348,  348,  348,  349,  349,  349,  349,  349,  349,
-      349,  272,  772, 1723,   49,  349,   49,  788, 1327, 1723,
-      349,  349,  349,  349,  349,  349,  351,  352,  352,  352,
-      352,  352,  352,  352,  463,  794, 1330, 1408,  353,  448,
-      448,  613,  465,  353,  353,  353,  353,  353,  353,  356,
-      353,  353,  353,  353,  353,  353,  353,  360,  361,  361,
-      361,  361,  361,  361,  361,  362,  613, 1218,  448,  363,
-       49,  364,   51,  540,  363,  363,  363,  363,  363,  363,
-      519,  519,  519,  519,  519,  519,  519,  541,  774,   51,
-     1318,  448,  771,  540,  614,   49,  364,  272,  368,  368,
+      350,  350,  350,  350,  351,  351,  351,  351,  351,  351,
+      351,  273,  783, 1784,   49,  351,   49,  795, 1088, 1784,
+      351,  351,  351,  351,  351,  351,  353,  354,  354,  354,
+      354,  354,  354,  354,  466,   49,  803,  809,  355, 1321,
+     1447,  621,  468,  355,  355,  355,  355,  355,  355,  358,
+      355,  355,  355,  355,  355,  355,  355,  362,  363,  363,
+      363,  363,  363,  363,  363,  364,  621, 1353, 1356,  365,
+     1359,  366,   49,  544,  365,  365,  365,  365,  365,  365,
+      523,  523,  523,  523,  523,  523,  523,  545,  786, 1362,
+     1365, 1447,  782,  544,  622,   49,  366,  273,  370,  370,
 
-      368,  368,  368,  368,  368,  274,   49, 1723,  430,  369,
-     1321,   51,  541,  775,  369,  369,  369,  369,  369,  369,
-      370,  371,  371,  371,  371,  371,  371,   49,   51,  871,
-      849,  372, 1723,  430,  571,  766,  372,  372,  372,  372,
-      372,  372,  416,  572,  417,   49,  418,  419,  549,  550,
-      550,  550,  550,  550,  550,  849,  420,  653,  421,  422,
-      653,  423,  425,  574,  426,  426,  426,  426,  426,  426,
-      426,  654,  575,  448, 1723,  426, 1723, 1324,   51,  448,
-      426,  426,  426,  426,  426,  426,  427,  428,  428,  428,
-      428,  428,  428,  428,  777,   51,  654, 1327,  429, 1723,
+      370,  370,  370,  370,  370,  275,   49, 1784,  433,  371,
+      451,   51,  545,  787,  371,  371,  371,  371,  371,  371,
+      372,  373,  373,  373,  373,  373,  373,   49,   51,  451,
+      864,  374, 1784,  433,  575,  777,  374,  374,  374,  374,
+      374,  374,  419,  576,  420,   49,  421,  422,  553,  554,
+      554,  554,  554,  554,  554,  864,  423,  661,  424,  425,
+      661,  426,  428,  578,  429,  429,  429,  429,  429,  429,
+      429,  662,  579, 1249, 1784,  429, 1784,  451,   51, 1353,
+      429,  429,  429,  429,  429,  429,  430,  431,  431,  431,
+      431,  431,  431,  431,  789,   51,  662,  451,  432, 1784,
 
-      430, 1723,   49,  429,  429,  429,  429,  429,  429,  553,
-      554,  554,  554,  554,  554,  554,  633,  634,  634,  634,
-      634,  634,  634,  655,  773,  430,  431,  429,  429,  429,
-      429,  429,  429,  429, 1723,   49,  448,  656,  429, 1330,
-       51,   51,  655,  429,  429,  429,  429,  429,  429,  433,
-      434,  434,  434,  434,  434,  434, 1723,   51,   51, 1723,
-      435,  868,  656,   51,  779,  435,  435,  435,  435,  435,
-      435,  262,  436,  436,  436,  436,  436,  436,  436,   49,
-       51, 1723,  448,  437, 1723, 1723, 1723,  861,  437,  437,
-      437,  437,  437,  437,   49,  437,  437,  437,  437,  437,
+      433, 1784,   49,  432,  432,  432,  432,  432,  432,  557,
+      558,  558,  558,  558,  558,  558,  641,  642,  642,  642,
+      642,  642,  642,  663,  785,  433,  434,  432,  432,  432,
+      432,  432,  432,  432,  796,   49, 1784,  664,  432, 1356,
+       51,   49,  663,  432,  432,  432,  432,  432,  432,  436,
+      437,  437,  437,  437,  437,  437, 1784,   51,  886, 1784,
+      438, 1784,  664,   51,  791,  438,  438,  438,  438,  438,
+      438,  263,  439,  439,  439,  439,  439,  439,  439,   49,
+       51, 1784,  451,  440, 1784, 1784, 1784,  876,  440,  440,
+      440,  440,  440,  440,   49,  440,  440,  440,  440,  440,
 
-      437,  437,  440,  441,  441,  441,  441,  441,  441, 1723,
-     1723, 1723, 1723,  442, 1282, 1284,   51,  780,  442,  442,
-      442,  442,  442,  442,  446,  447,  447,  447,  447,  447,
-      447,  448,   49,   51, 1063,  449, 1290, 1723,  867,   51,
-      449,  449,  449,  449,  449,  449,  360,  452,  452,  452,
-      452,  452,  452,  452,  362, 1288,   51, 1488,  453,  869,
-       51,   51,   51,  453,  453,  453,  453,  453,  453,  454,
-      455,  455,  455,  455,  455,  455,  448,   51,   51,   51,
-      456,  882,  874,   51,  879,  456,  456,  456,  456,  456,
-      456,  272,  461,  461,  461,  461,  461,  461,  461,  274,
+      440,  440,  443,  444,  444,  444,  444,  444,  444, 1784,
+     1784, 1784, 1784,  445, 1359,  451,   51,  794,  445,  445,
+      445,  445,  445,  445,  449,  450,  450,  450,  450,  450,
+      450,  451,   49,   51, 1784,  452, 1362, 1784,  882,   51,
+      452,  452,  452,  452,  452,  452,  362,  455,  455,  455,
+      455,  455,  455,  455,  364,  451,   51, 1365,  456,  883,
+       51,   51,   51,  456,  456,  456,  456,  456,  456,  457,
+      458,  458,  458,  458,  458,  458,  451,   51,   51,   51,
+      459,  884,  890,   51,  895,  459,  459,  459,  459,  459,
+      459,  273,  464,  464,  464,  464,  464,  464,  464,  275,
 
-       51, 1408, 1723,  462, 1408,  448,   51,  878,  462,  462,
-      462,  462,  462,  462,  463,  464,  464,  464,  464,  464,
-      464,  464,  465,   51, 1340, 1112,  466, 1723,  467,  683,
-      782,  466,  466,  466,  466,  466,  466,  577,  684,  578,
-      685,  724,  579,  580,   49,  724,  581,  582,  764,  686,
-      778,  583,  787,  467,  477,  725, 1345,   49,  478, 1723,
-       49,  479,   49,  733,  480,  733,  481,  482,  483,  484,
-      516,  516,  516,  516,  516,  516,  516,  734, 1347, 1723,
-      725,  516,  930,   51, 1723,  783,  516,  516,  516,  516,
-      516,  516,  517,  518,  518,  518,  518,  518,  518,   49,
+       51,  451,  949,  465, 1784,   49,   51,  894,  465,  465,
+      465,  465,  465,  465,  466,  467,  467,  467,  467,  467,
+      467,  467,  468,   51,  897, 1313,  469,  949,  470, 1784,
+       49,  469,  469,  469,  469,  469,  469,  649,  650,  650,
+      650,  650,  650,  650,  653,  654,  654,  654,  654,  654,
+      654,  692,  790,  470,  480, 1079,  695, 1784,  481, 1784,
+      693,  482,   49,  735,  483,  696,  484,  485,  486,  487,
+      520,  520,  520,  520,  520,  520,  520,  736, 1315, 1784,
+     1079,  520, 1784,   51, 1784,  792,  520,  520,  520,  520,
+      520,  520,  521,  522,  522,  522,  522,  522,  522,  793,
 
-       51, 1121,  734,  519, 1723, 1723,   49,  930,  519,  519,
-      519,  519,  519,  519,  427,  520,  520,  520,  520,  520,
-      520,  520,  521,  521,  521,  521,  521,  521,  521,  535,
-     1723,   49, 1056,  521, 1723, 1353,  789,  711,  521,  521,
-      521,  521,  521,  521,  432,  523,  523,  523,  523,  523,
-      523,  523,  544,   51, 1355, 1132,  524, 1056,  260, 1723,
-      714,  524,  524,  524,  524,  524,  524,  641,  642,  642,
-      642,  642,  642,  642,  645,  646,  646,  646,  646,  646,
-      646,   51,  735,  260,  524,  524,  524,  524,  524,  524,
-      524, 1723, 1361, 1723, 1723,  524,  736,   51,   51,  784,
+       51,   49,  736,  523, 1784,  900, 1784, 1784,  523,  523,
+      523,  523,  523,  523,  430,  524,  524,  524,  524,  524,
+      524,  524,  525,  525,  525,  525,  525,  525,  525,  539,
+     1086, 1784, 1784,  525, 1321,   51, 1319,  722,  525,  525,
+      525,  525,  525,  525,  435,  527,  527,  527,  527,  527,
+      527,  527,   51,  735,  744,  744,  528,  746,  261,  746,
+      802,  528,  528,  528,  528,  528,  528, 1784,  745, 1784,
+       49,  747,  775, 1784,  755,  756,  756,  756,  756,  756,
+      756,   49, 1531,  261,  528,  528,  528,  528,  528,  528,
+      528, 1784, 1784,  745, 1784,  528,  747,   51, 1784,  797,
 
-      524,  524,  524,  524,  524,  524,  525,  525,  525,  525,
-      525,  525,  525,   49,   51,  862, 1723,  526, 1723, 1723,
-     1363,  736,  526,  526,  526,  526,  526,  526,   49,  526,
-      526,  526,  526,  526,  526,  526,  360,  529,  529,  529,
-      529,  529,  529,  529,  530,  786,  735, 1144,  531, 1369,
-      364, 1371, 1156,  531,  531,  531,  531,  531,  531,   49,
-     1723,  744,  745,  745,  745,  745,  745,  745,  747,  748,
-      748,  748,  748,  748,  748,  364,  535,  536,  536,  536,
-      536,  536,  536,  536,  537, 1723, 1290, 1416,  538, 1218,
-      539, 1463, 1465,  538,  538,  538,  538,  538,  538,  751,
+      528,  528,  528,  528,  528,  528,  529,  529,  529,  529,
+      529,  529,  529,   49,   51, 1447, 1784,  530, 1447,  451,
+     1784, 1784,  530,  530,  530,  530,  530,  530,   49,  530,
+      530,  530,  530,  530,  530,  530,  362,  533,  533,  533,
+      533,  533,  533,  533,  534, 1784, 1784, 1375,  535, 1139,
+      366, 1380, 1382,  535,  535,  535,  535,  535,  535,  758,
+      759,  759,  759,  759,  759,  759,  762,  763,  763,  763,
+      763,  763,  763,  798,   51,  366,  539,  540,  540,  540,
+      540,  540,  540,  540,  541,  799,  801,   49,  542, 1148,
+      543,   51, 1388,  542,  542,  542,  542,  542,  542,   49,
 
-      752,  752,  752,  752,  752,  752,  814,  815,  815,  815,
-      815,  815,  815,  850,   51,  539,  360,  542,  542,  542,
-      542,  542,  542,  542,  530, 1723, 1501,  851,  543, 1505,
-     1723,   51,   51,  543,  543,  543,  543,  543,  543,  544,
-      545,  545,  545,  545,  545,  545,  545,  546,  863,   51,
-     1723,  547,  851,  548,  958, 1723,  547,  547,  547,  547,
-      547,  547,  822,  823,  823,  823,  823,  823,  823,  826,
-      827,  827,  827,  827,  827,  827,  850,   51,  548,  463,
-      555,  555,  555,  555,  555,  555,  555,  465, 1509, 1723,
-     1723,  556, 1513,   51,   51,  852,  556,  556,  556,  556,
+       49,  829,  830,  830,  830,  830,  830,  830,  837,  838,
+      838,  838,  838,  838,  838,  543,  362,  546,  546,  546,
+      546,  546,  546,  546,  534, 1164, 1390, 1159,  547, 1784,
+     1176,   51,   51,  547,  547,  547,  547,  547,  547,  548,
+      549,  549,  549,  549,  549,  549,  549,  550,   51,   51,
+     1164,  551,  901,  552, 1784, 1176,  551,  551,  551,  551,
+      551,  551,  841,  842,  842,  842,  842,  842,  842,  849,
+      850,  850,  850,  850,  850,  850,  865,   51,  552,  466,
+      559,  559,  559,  559,  559,  559,  559,  468, 1396, 1398,
+      866,  560, 1171,   51,   51,   51,  560,  560,  560,  560,
 
-      556,  556,  557,  558,  558,  558,  558,  558,  558,  853,
-       51,  864, 1517,  559, 1723, 1723,   51,  791,  559,  559,
-      559,  559,  559,  559,  608,  852,  609,  609,  609,  609,
-      609,  609,  609,   51,  853, 1546, 1723,  609, 1568, 1723,
-       51,   51,  609,  609,  609,  609,  609,  609,  610,  611,
-      611,  611,  611,  611,  611,  611, 1144,   51,   51, 1086,
-      612, 1723,  613,  959, 1723,  612,  612,  612,  612,  612,
-      612,  834,  835,  835,  835,  835,  835,  835,  837,  838,
-      838,  838,  838,  838,  838,   51,   51,  613,  610,  612,
-      612,  612,  612,  612,  612,  612,  659,  448, 1327, 1137,
+      560,  560,  561,  562,  562,  562,  562,  562,  562,  548,
+       51,  877,   51,  563,  865,  866, 1404,  725,  563,  563,
+      563,  563,  563,  563,  581,  582,  583,  878, 1784,  584,
+      585,  887, 1406,  586,  587,  804,  588,  867,  589, 1183,
+      590,  616,  867,  617,  617,  617,  617,  617,  617,  617,
+     1784,  868,   51, 1784,  617, 1784, 1784,   51,  806,  617,
+      617,  617,  617,  617,  617,  618,  619,  619,  619,  619,
+      619,  619,  619, 1321,   51, 1784,  868,  620, 1455,  621,
+     1784, 1784,  620,  620,  620,  620,  620,  620,  852,  853,
+      853,  853,  853,  853,  853,  856,  857,  857,  857,  857,
 
-      612, 1723,   51,   51,  661,  612,  612,  612,  612,  612,
-      612,  432,  615,  615,  615,  615,  615,  615,  615,  866,
-      925, 1140,  872,  616, 1137, 1149, 1723, 1723,  616,  616,
-      616,  616,  616,  616,   49,  616,  616,  616,  616,  616,
-      616,  616,  617,  617,  617,  617,  617,  617,  617,  719,
-     1149, 1138, 1723,  618, 1723, 1281, 1723,  894,  618,  618,
-      618,  618,  618,  618,   49,  618,  618,  618,  618,  618,
-      618,  618,  621,  622,  622,  622,  622,  622,  622, 1723,
-     1281, 1723, 1723,  623, 1132,  448,   51,   51,  623,  623,
-      623,  623,  623,  623,  360,  452,  452,  452,  452,  452,
+      857,  857,   51,   51,  621,  618,  620,  620,  620,  620,
+      620,  620,  620,  667, 1312, 1249, 1784,  620, 1784,   51,
+       51,  669,  620,  620,  620,  620,  620,  620,  435,  623,
+      623,  623,  623,  623,  623,  623,  879,  881, 1502, 1312,
+      624, 1784, 1784, 1784, 1784,  624,  624,  624,  624,  624,
+      624,   49,  624,  624,  624,  624,  624,  624,  624,  625,
+      625,  625,  625,  625,  625,  625,  730, 1784, 1504, 1784,
+      626, 1784, 1784, 1387,  913,  626,  626,  626,  626,  626,
+      626,   49,  626,  626,  626,  626,  626,  626,  626,  629,
+      630,  630,  630,  630,  630,  630, 1784, 1784, 1387, 1395,
 
-      452,  452,  530,   51,   51, 1324,  453, 1723,  960,  962,
-      910,  453,  453,  453,  453,  453,  453,  624,  625,  625,
-      625,  625,  625,  625,  911,  914, 1723, 1128,  626, 1126,
-       51,   51, 1121,  626,  626,  626,  626,  626,  626,  630,
-      631,  631,  631,  631,  631,  631,  448,   51,   51,  911,
-      632, 1723,  964,  965,   51,  632,  632,  632,  632,  632,
-      632,  535,  635,  635,  635,  635,  635,  635,  635,  537,
-      448,   51, 1723,  636,  967,   51, 1321,   51,  636,  636,
-      636,  636,  636,  636,  637,  638,  638,  638,  638,  638,
-      638,  448,   51,  970,   51,  639,  905, 1723,   51,  977,
+      631, 1544, 1548,   51,   51,  631,  631,  631,  631,  631,
+      631,  362,  455,  455,  455,  455,  455,  455,  455,  534,
+       51,   51, 1552,  456, 1395,   51,  977,  929,  456,  456,
+      456,  456,  456,  456,  632,  633,  633,  633,  633,  633,
+      633,  930,   51, 1403, 1784,  634, 1556,  978,   51, 1560,
+      634,  634,  634,  634,  634,  634,  638,  639,  639,  639,
+      639,  639,  639,  451, 1501,   51,  930,  640, 1403, 1784,
+      979,   51,  640,  640,  640,  640,  640,  640,  539,  643,
+      643,  643,  643,  643,  643,  643,  541, 1593,   51, 1501,
+      644, 1615,   51,  981,   51,  644,  644,  644,  644,  644,
 
-      639,  639,  639,  639,  639,  639,  544,  647,  647,  647,
-      647,  647,  647,  647,  546,   51, 1117, 1112,  648, 1723,
-       51,   51,  971,  648,  648,  648,  648,  648,  648,  649,
-      650,  650,  650,  650,  650,  650,  448,   51,   51, 1723,
-      651, 1073, 1077,   51, 1723,  651,  651,  651,  651,  651,
-      651,  463,  657,  657,  657,  657,  657,  657,  657,  465,
-       51, 1080, 1352,  658, 1723,  448,   51,   51,  658,  658,
-      658,  658,  658,  658,  659,  660,  660,  660,  660,  660,
-      660,  660,  661,   51,   51, 1318,  662, 1352,  663, 1081,
-     1082,  662,  662,  662,  662,  662,  662,  841,  842,  842,
+      644,  645,  646,  646,  646,  646,  646,  646,  451,   51,
+     1159,   51,  647,  451,  983,   51,  984,  647,  647,  647,
+      647,  647,  647,  548,  655,  655,  655,  655,  655,  655,
+      655,  550,   51,  990, 1547,  656, 1359,   51,   51,   51,
+      656,  656,  656,  656,  656,  656,  657,  658,  658,  658,
+      658,  658,  658,  451,   51,   51,   51,  659,  986, 1547,
+       51,  991,  659,  659,  659,  659,  659,  659,  466,  665,
+      665,  665,  665,  665,  665,  665,  468,   51,  933, 1155,
+      666, 1153,  996,   51,   51,  666,  666,  666,  666,  666,
+      666,  667,  668,  668,  668,  668,  668,  668,  668,  669,
 
-      842,  842,  842,  842,  745,  745,  745,  745,  745,  745,
-      745,   51,   51,  663,  699,  699,  699,  699,  699,  699,
-      699, 1360,  448, 1368, 1220,  699, 1723,   51,   51,   51,
-      699,  699,  699,  699,  699,  699,  700,  700,  700,  700,
-      700,  700,  700,  873,   51,  963, 1360,  700, 1368, 1084,
-     1462, 1723,  700,  700,  700,  700,  700,  700,  610,  701,
-      701,  701,  701,  701,  701,  701,  702,  702,  702,  702,
-      702,  702,  702,  728, 1504, 1462, 1508,  702, 1512,   51,
-       51,  897,  702,  702,  702,  702,  702,  702,  432,  704,
-      704,  704,  704,  704,  704,  704,   51,   51, 1337, 1504,
+       51,   51, 1110,  670,   51,  671,  999,   51,  670,  670,
+      670,  670,  670,  670,  756,  756,  756,  756,  756,  756,
+      756,   51,   51, 1148,   51,  451,   51,   51,   51,   51,
+      671,  710,  710,  710,  710,  710,  710,  710,  889,   51,
+      888, 1551,  710,   51,   51,   51,   51,  710,  710,  710,
+      710,  710,  710,  711,  711,  711,  711,  711,  711,  711,
+      980,  985,  893,  899,  711, 1356, 1551, 1555, 1559,  711,
+      711,  711,  711,  711,  711,  618,  712,  712,  712,  712,
+      712,  712,  712,  713,  713,  713,  713,  713,  713,  713,
+      739,  924, 1555, 1559,  713,   51,   51,   51,  916,  713,
 
-      705, 1508, 1088, 1512,  974,  705,  705,  705,  705,  705,
-      705,   49,  705,  705,  705,  705,  705,  705,  705,  706,
-      706,  706,  706,  706,  706,  706,  739, 1201, 1330, 1327,
-      707, 1324, 1321, 1318,  900,  707,  707,  707,  707,  707,
-      707,   49,  707,  707,  707,  707,  707,  707,  707,  535,
-      710,  710,  710,  710,  710,  710,  710,  711,   51,   51,
-       51,  712,   51,  539,   51,   51,  712,  712,  712,  712,
-      712,  712,  856, 1201, 1063,   51,   51,   51, 1290,   51,
-      858,   51,   51,   51, 1085,  875,  876,  865,  539,  544,
-      713,  713,  713,  713,  713,  713,  713,  714,  877,   51,
+      713,  713,  713,  713,  713,  715,  715,  715,  715,  715,
+      715,  715,   51,   51,   51, 1144,  716, 1096, 1000, 1614,
+      994,  716,  716,  716,  716,  716,  716,   49,  716,  716,
+      716,  716,  716,  716,  716,  717,  717,  717,  717,  717,
+      717,  717,  750, 1139, 1614,  451,  718, 1353,  451, 1251,
+      919,  718,  718,  718,  718,  718,  718,   49,  718,  718,
+      718,  718,  718,  718,  718,  539,  721,  721,  721,  721,
+      721,  721,  721,  722,   51,   51,   51,  723, 1372,  543,
+       51,  929,  723,  723,  723,  723,  723,  723,  871, 1232,
+     1365,   51,   51,   51, 1362, 1784,  873,   51,   51,   51,
 
-       51,  715,   51,  548,   51,  905,  715,  715,  715,  715,
-      715,  715,  870, 1096, 1065,  914,   51, 1516,  856,   51,
-     1059,   51,   51, 1099, 1057,  880,  910,   51,  548,  719,
-      720,  720,  720,  720,  720,  720,  720,  721,  881,   51,
-     1723,  722, 1516,  723,   51,  925,  722,  722,  722,  722,
-      722,  722,  883, 1102, 1567, 1158,  336,  888,  888,  888,
-      888,  888,  888,  888,  919, 1723,  919,   51,  723,  535,
-      726,  726,  726,  726,  726,  726,  726,  711,  920, 1567,
-     1723,  727,  448, 1587,   51, 1105,  727,  727,  727,  727,
-      727,  727,  728,  729,  729,  729,  729,  729,  729,  729,
+     1109,  891,  892,  880,  543,  548,  724,  724,  724,  724,
+      724,  724,  724,  725,   51,   51,   51,  726,   51,  552,
+     1784,  924,  726,  726,  726,  726,  726,  726,  885, 1123,
+     1359,   51,  982, 1638, 1356,   51, 1639, 1353,   51, 1232,
+     1100,  896,  938,   51,  552,  730,  731,  731,  731,  731,
+      731,  731,  731,  732,   51,   51,  939,  733, 1638,  734,
+       51, 1639,  733,  733,  733,  733,  733,  733,  902,  898,
+     1640,   51,  907,  907,  907,  907,  907,  907,  907, 1086,
+      938,  939,  940,  338,  734,  539,  737,  737,  737,  737,
+      737,  737,  737,  722, 1784, 1640,  941,  738, 1321, 1088,
 
-      730,  969,  921,  920,  731, 1723,  732,  921, 1587,  731,
-      731,  731,  731,  731,  731, 1146,  922, 1588,  448, 1102,
-     1589, 1723,  835,  835,  835,  835,  835,  835,  835,  931,
-       51,  732,  544,  737,  737,  737,  737,  737,  737,  737,
-      714,  922, 1588,  932,  738, 1589, 1723,   51, 1134,  738,
-      738,  738,  738,  738,  738,  739,  740,  740,  740,  740,
-      740,  740,  740,  741,   51,  931,  933,  742,  932,  743,
-      933,  448,  742,  742,  742,  742,  742,  742, 1099, 1723,
-      934,   51, 1123, 1590, 1723,  943,  944,  944,  944,  944,
-      944,  944,  972,   51,  743,  659,  753,  753,  753,  753,
+       51,  871,  738,  738,  738,  738,  738,  738,  739,  740,
+      740,  740,  740,  740,  740,  740,  741,   51,  940, 1784,
+      742,  941,  743,  933,   51,  742,  742,  742,  742,  742,
+      742, 1126, 1784,  850,  850,  850,  850,  850,  850,  850,
+     1116,   51, 1082, 1080,   51,  950,   51,  743,  548,  748,
+      748,  748,  748,  748,  748,  748,  725, 1784,  989,  951,
+      749,   51, 1103,   51, 1185,  749,  749,  749,  749,  749,
+      749,  750,  751,  751,  751,  751,  751,  751,  751,  752,
+       51,  950,  952,  753,  951,  754,  952,  451,  753,  753,
+      753,  753,  753,  753, 1132, 1784,  953,   51, 1173, 1641,
 
-      753,  753,  753,  661, 1723,  934,  448,  754, 1590, 1723,
-       51,   51,  754,  754,  754,  754,  754,  754,  755,  756,
-      756,  756,  756,  756,  756,  961, 1096, 1114,   51,  757,
-      448,   51,   51,   51,  757,  757,  757,  757,  757,  757,
-       49,   49,   49,   49,   49,   49,   49,  978,   51,   51,
-       51,   49,   51,   51,   51,   51,   49,   49,   49,   49,
-       49,   49,  946,  947,  947,  947,  947,  947,  947,   51,
-       51,   51,   51, 1057,  759,  789, 1057,  790,  790,  790,
-      790,  790,  790,  790,  966,  968, 1068, 1058,  790,  976,
-     1723,   51,   51,  790,  790,  790,  790,  790,  790,  791,
+     1784,  962,  963,  963,  963,  963,  963,  963,  992,   51,
+      754,  667,  764,  764,  764,  764,  764,  764,  764,  669,
+     1784,  953,  451,  765, 1641, 1784,   51,   51,  765,  765,
+      765,  765,  765,  765,  766,  767,  767,  767,  767,  767,
+      767,  987, 1129, 1161,   51,  768,  451,   51,   51,   51,
+      768,  768,  768,  768,  768,  768,   49,   49,   49,   49,
+       49,   49,   49, 1001,   51,   51,   51,   49,   51, 1105,
+     1108,   51,   49,   49,   49,   49,   49,   49,  965,  966,
+      966,  966,  966,  966,  966,   51, 1126, 1080,   51, 1080,
+      770,  804, 1082,  805,  805,  805,  805,  805,  805,  805,
 
-      792,  792,  792,  792,  792,  792,  792, 1220,   51,   51,
-     1190,  792, 1058, 1182,  448, 1723,  792,  792,  792,  792,
-      792,  792,  701,  701,  701,  701,  701,  701,  701,  950,
-      951,  951,  951,  951,  951,  951,   51,   51,   51, 1005,
-     1006, 1006, 1006, 1006, 1006, 1006, 1013, 1014, 1014, 1014,
-     1014, 1014, 1014,   51,   51,   51,   49,  702,  702,  702,
-      702,  702,  702,  702,  973, 1201, 1105, 1102,  702, 1069,
-     1072, 1591, 1608,  702,  702,  702,  702,  702,  702,  793,
-      348,  348,  348,  348,  348,  348,  348,  262,  795,  795,
-      795,  795,  795,  795,  795,  937, 1591, 1608, 1099,  796,
+      997, 1081,  998, 1784,  805, 1150, 1083,   51,   51,  805,
+      805,  805,  805,  805,  805,  806,  807,  807,  807,  807,
+      807,  807,  807,  451,   51,   51, 1081,  807, 1784, 1113,
+     1114, 1083,  807,  807,  807,  807,  807,  807,  712,  712,
+      712,  712,  712,  712,  712,  969,  970,  970,  970,  970,
+      970,  970,   51,   51,   51, 1028, 1029, 1029, 1029, 1029,
+     1029, 1029, 1036, 1037, 1037, 1037, 1037, 1037, 1037,   51,
+       51,   51,   49,  713,  713,  713,  713,  713,  713,  713,
+      988, 1123, 1141,  451,  713, 1091, 1095, 1642, 1661,  713,
+      713,  713,  713,  713,  713,  808,  350,  350,  350,  350,
 
-     1614, 1096, 1201, 1105,  796,  796,  796,  796,  796,  796,
-       49,  796,  796,  796,  796,  796,  796,  796,  799,  800,
-      800,  800,  800,  800,  800, 1614, 1065,  858,  937,  801,
-     1158, 1105,   51,   51,  801,  801,  801,  801,  801,  801,
-      535,  635,  635,  635,  635,  635,  635,  635,  711,   51,
-       51,  739,  636, 1185,   51, 1186, 1059,  636,  636,  636,
-      636,  636,  636,  802,  803,  803,  803,  803,  803,  803,
-     1060,   51,  933,  931,  804,  925, 1189,   51, 1146,  804,
-      804,  804,  804,  804,  804,  544,  647,  647,  647,  647,
-      647,  647,  647,  714,   51, 1060, 1102,  648,  728,   51,
+      350,  350,  350,  263,  810,  810,  810,  810,  810,  810,
+      810,  944, 1642, 1661, 1251,  811, 1667,  451, 1232, 1129,
+      811,  811,  811,  811,  811,  811,   49,  811,  811,  811,
+      811,  811,  811,  811,  814,  815,  815,  815,  815,  815,
+      815, 1667, 1132, 1129, 1126,  816, 1123, 1232,   51,   51,
+      816,  816,  816,  816,  816,  816,  539,  643,  643,  643,
+      643,  643,  643,  643,  722,   51,   51, 1088,  644,  873,
+       51,   51, 1082,  644,  644,  644,  644,  644,  644,  817,
+      818,  818,  818,  818,  818,  818, 1784,   51,   51,  956,
+      819, 1185, 1209,   51, 1106,  819,  819,  819,  819,  819,
 
-     1194, 1059,  648,  648,  648,  648,  648,  648,  805,  806,
-      806,  806,  806,  806,  806, 1723,   51, 1192,  921,  807,
-      919,   51,   51,  914,  807,  807,  807,  807,  807,  807,
-      811,  812,  812,  812,  812,  812,  812,  448,   51,   51,
-     1723,  813, 1195, 1134,   51, 1099,  813,  813,  813,  813,
-      813,  813,  719,  816,  816,  816,  816,  816,  816,  816,
-      721,   51, 1293,  719,  817,  910,   51,   51,  905,  817,
-      817,  817,  817,  817,  817,  818,  819,  819,  819,  819,
-      819,  819,  448,   51,   51, 1294,  820, 1123, 1096,   51,
-     1114,  820,  820,  820,  820,  820,  820,  728,  828,  828,
+      819,  548,  655,  655,  655,  655,  655,  655,  655,  725,
+       51, 1784, 1132,  656,   51,   51,   51,   51,  656,  656,
+      656,  656,  656,  656,  820,  821,  821,  821,  821,  821,
+      821,   51,   51,   51,   51,  822, 1212,  750, 1213, 1102,
+      822,  822,  822,  822,  822,  822,  826,  827,  827,  827,
+      827,  827,  827,  451, 1211,  952,  950,  828,  944, 1173,
+       51, 1129,  828,  828,  828,  828,  828,  828,  730,  831,
+      831,  831,  831,  831,  831,  831,  732,   51, 1215,  739,
+      832,  940,   51,   51,   51,  832,  832,  832,  832,  832,
+      832,  833,  834,  834,  834,  834,  834,  834,  451,   51,
 
-      828,  828,  828,  828,  828,  730,   51, 1295, 1296,  829,
-     1001,   51,   51,   51,  829,  829,  829,  829,  829,  829,
-      830,  831,  831,  831,  831,  831,  831,  448,   51,   51,
-       51,  832,  986, 1299, 1105,   51,  832,  832,  832,  832,
-      832,  832,  739,  843,  843,  843,  843,  843,  843,  843,
-      741, 1297,   51, 1102,  844, 1099, 1310,   51,   51,  844,
-      844,  844,  844,  844,  844,  845,  846,  846,  846,  846,
-      846,  846,  448, 1096,   51,   51,  847, 1094,  986, 1311,
-       51,  847,  847,  847,  847,  847,  847,  659,  854,  854,
-      854,  854,  854,  854,  854,  661,  856,   51, 1065,  855,
+       51,   51,  835, 1218, 1217,   51, 1222,  835,  835,  835,
+      835,  835,  835,  739,  843,  843,  843,  843,  843,  843,
+      843,  741,   51, 1220,  938,  844,  933,   51,   51,   51,
+      844,  844,  844,  844,  844,  844,  845,  846,  846,  846,
+      846,  846,  846,  451,   51,   51,   51,  847, 1225, 1229,
+       51, 1161,  847,  847,  847,  847,  847,  847,  750,  858,
+      858,  858,  858,  858,  858,  858,  752,   51, 1324, 1126,
+      859,  730,   51,   51,  929,  859,  859,  859,  859,  859,
+      859,  860,  861,  861,  861,  861,  861,  861,  451,   51,
+       51, 1325,  862,  924, 1150,   51, 1123,  862,  862,  862,
 
-      858,  659,  852,   51,  855,  855,  855,  855,  855,  855,
-      856,  857,  857,  857,  857,  857,  857,  857,  858,   51,
-       51, 1117,  859,  850,  860,  939,  900,  859,  859,  859,
-      859,  859,  859, 1087,   51, 1118,   51, 1017, 1018, 1018,
-     1018, 1018, 1018, 1018,   51,  975,  927,   51, 1117,  860,
-       51,   51,  884,  884,  884,  884,  884,  884,  884, 1079,
-     1118,   51, 1723,  884,   51, 1074,   51,   51,  884,  884,
-      884,  884,  884,  884,  885,  885,  885,  885,  885,  885,
-      885, 1184, 1075,   51,  897,  885,   51, 1723,   51,   51,
-      885,  885,  885,  885,  885,  885,  886,  887,  887,  887,
+      862,  862,  862,  667,  869,  869,  869,  869,  869,  869,
+      869,  669,   51, 1326, 1327,  870, 1141, 1024, 1009, 1132,
+      870,  870,  870,  870,  870,  870,  871,  872,  872,  872,
+      872,  872,  872,  872,  873,   51,   51, 1144,  874, 1129,
+      875,  956, 1126,  874,  874,  874,  874,  874,  874, 1132,
+       51, 1145,   51,   51, 1040, 1041, 1041, 1041, 1041, 1041,
+     1041,  993,  995,   51, 1144,  875,   51,   51,  903,  903,
+      903,  903,  903,  903,  903, 1123, 1145, 1121, 1784,  903,
+       51, 1097, 1092,   51,  903,  903,  903,  903,  903,  903,
+      904,  904,  904,  904,  904,  904,  904, 1009, 1098,  871,
 
-      887,  887,  887,   51,  916,   51,   51,  888,  894,   51,
-       51, 1083,  888,  888,  888,  888,  888,  888,  262,  889,
-      889,  889,  889,  889,  889,  889,   51,   51,  907, 1001,
-      890,  986, 1390,  900, 1301,  890,  890,  890,  890,  890,
-      890,   49,  890,  890,  890,  890,  890,  890,  890,  719,
-      893,  893,  893,  893,  893,  893,  893,  894,  897,  894,
-      986,  895,  858,  723,  661,  739,  895,  895,  895,  895,
-      895,  895, 1025, 1026, 1026, 1026, 1026, 1026, 1026, 1028,
-     1029, 1029, 1029, 1029, 1029, 1029,  939,   51,  723,  728,
-      896,  896,  896,  896,  896,  896,  896,  897,  900,  544,
+     1088,  904,   51, 1784,   51,   51,  904,  904,  904,  904,
+      904,  904,  905,  906,  906,  906,  906,  906,  906,   51,
+      873,   51,   51,  907,  667,  867,   51, 1107,  907,  907,
+      907,  907,  907,  907,  263,  908,  908,  908,  908,  908,
+      908,  908, 1328,   51,  865,  958,  909,  919, 1330,  946,
+      916,  909,  909,  909,  909,  909,  909,   49,  909,  909,
+      909,  909,  909,  909,  909,  730,  912,  912,  912,  912,
+      912,  912,  912,  913,  935,  913,  926,  914, 1024,  734,
+     1009,  919,  914,  914,  914,  914,  914,  914, 1048, 1049,
+     1049, 1049, 1049, 1049, 1049, 1051, 1052, 1052, 1052, 1052,
 
-      735,  898,  733,  732,   51,  728,  898,  898,  898,  898,
-      898,  898, 1032, 1033, 1033, 1033, 1033, 1033, 1033, 1041,
-     1042, 1042, 1042, 1042, 1042, 1042,  927,   51,  732,  739,
-      899,  899,  899,  899,  899,  899,  899,  900,  897,  535,
-      724,  901,  719,  743,   51,  916,  901,  901,  901,  901,
-      901,  901, 1044, 1045, 1045, 1045, 1045, 1045, 1045, 1048,
-     1049, 1049, 1049, 1049, 1049, 1049, 1126,   51,  743,  905,
-      906,  906,  906,  906,  906,  906,  906,  907,  894,  907,
-     1127,  908,  904,  909,   51,   51,  908,  908,  908,  908,
-      908,  908,  944,  944,  944,  944,  944,  944,  944, 1070,
+     1052, 1052,  916,   51,  734,  739,  915,  915,  915,  915,
+      915,  915,  915,  916,  913, 1009,  873,  917,  669,  743,
+       51,  750,  917,  917,  917,  917,  917,  917, 1055, 1056,
+     1056, 1056, 1056, 1056, 1056, 1064, 1065, 1065, 1065, 1065,
+     1065, 1065,  958,   51,  743,  750,  918,  918,  918,  918,
+      918,  918,  918,  919,  919,  548,  746,  920,  744,  754,
+       51,  739,  920,  920,  920,  920,  920,  920, 1067, 1068,
+     1068, 1068, 1068, 1068, 1068, 1071, 1072, 1072, 1072, 1072,
+     1072, 1072, 1153,   51,  754,  924,  925,  925,  925,  925,
+      925,  925,  925,  926,  946,  916, 1154,  927,  539,  928,
 
-     1071,  810,   51,  798,  900, 1127, 1126,   51,  909,  719,
-      912,  912,  912,  912,  912,  912,  912,  894, 1076,  897,
-     1723,  913,  894,  892,   51,   51,  913,  913,  913,  913,
-      913,  913,  914,  915,  915,  915,  915,  915,  915,  915,
-      916, 1078,   51, 1128,  917, 1723,  918, 1128, 1063,  917,
-      917,  917,  917,  917,  917,  798, 1065, 1129,  659, 1089,
-      858, 1723, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1138,
-      661,  918,  728,  923,  923,  923,  923,  923,  923,  923,
-      897,  463, 1129, 1139,  924,  655, 1723,   51,  653,  924,
-      924,  924,  924,  924,  924,  925,  926,  926,  926,  926,
+       51,   51,  927,  927,  927,  927,  927,  927,  963,  963,
+      963,  963,  963,  963,  963, 1093, 1094,  735,   51,   51,
+      730, 1154,   51,   51,  928,  730,  931,  931,  931,  931,
+      931,  931,  931,  913, 1099,  935,   51,  932,  913,   51,
+       51,   51,  932,  932,  932,  932,  932,  932,  933,  934,
+      934,  934,  934,  934,  934,  934,  935, 1101,   51,   51,
+      936,   51,  937, 1153,   51,  936,  936,  936,  936,  936,
+      936, 1104,  926,  923, 1086, 1139,   51, 1784,   51,  825,
+     1344,   51, 1088, 1353,   51, 1155,   51,  937,  739,  942,
+      942,  942,  942,  942,  942,  942,  916, 1112, 1115, 1156,
 
-      926,  926,  926,  927,   51, 1138, 1140,  928, 1139,  929,
-     1140,  741,  928,  928,  928,  928,  928,  928, 1180, 1723,
-     1141,  714,  730,  711, 1723, 1042, 1042, 1042, 1042, 1042,
-     1042, 1042, 1150,   51,  929,  739,  935,  935,  935,  935,
-      935,  935,  935,  900, 1723, 1141, 1151,  936,  721, 1723,
-       51,  810,  936,  936,  936,  936,  936,  936,  937,  938,
-      938,  938,  938,  938,  938,  938,  939,   51, 1150, 1152,
-      940, 1151,  941, 1152, 1396,  940,  940,  940,  940,  940,
-      940,  798, 1723, 1153,   51,  714,  711, 1723, 1162, 1163,
-     1163, 1163, 1163, 1163, 1163, 1177,  798,  941,  856,  952,
+      943,   51, 1784,   51,   51,  943,  943,  943,  943,  943,
+      943,  944,  945,  945,  945,  945,  945,  945,  945,  946,
+     1208,   51, 1155,  947, 1156,  948,  813,   51,  947,  947,
+      947,  947,  947,  947, 1111,  919, 1784, 1049, 1049, 1049,
+     1049, 1049, 1049, 1049,   51,  916, 1165,   51, 1165, 1342,
+      948,  750,  954,  954,  954,  954,  954,  954,  954,  919,
+     1166, 1784, 1784,  955,   51,  913,   51, 1510,  955,  955,
+      955,  955,  955,  955,  956,  957,  957,  957,  957,  957,
+      957,  957,  958,   51, 1167, 1166,  959, 1784,  960, 1167,
+      911,  959,  959,  959,  959,  959,  959, 1207, 1168,  813,
 
-      952,  952,  952,  952,  952,  952,  858, 1723, 1153,   49,
-      953,   49, 1723,   51, 1282,  953,  953,  953,  953,  953,
-      953,  954,  955,  955,  955,  955,  955,  955, 1283,   49,
-       51,  785,  956,   49,   49,   51,  767,  956,  956,  956,
-      956,  956,  956,   51, 1183,  979,  979,  979,  979,  979,
-      979,  979,   51, 1283,  661,  465,  979, 1399,   51,   51,
-       51,  979,  979,  979,  979,  979,  979,  980,  980,  980,
-      980,  980,  980,  980, 1112,   51,   51,  544,  980,  741,
-      714,   51, 1318,  980,  980,  980,  980,  980,  980,  614,
-      981,  981,  981,  981,  981,  981,  981, 1404,   51, 1473,
+      667,  873,  669, 1784, 1065, 1065, 1065, 1065, 1065, 1065,
+     1065, 1177,  466,  960,  871,  971,  971,  971,  971,  971,
+      971,  971,  873, 1168,  663, 1178,  972,  661, 1784,   51,
+     1177,  972,  972,  972,  972,  972,  972,  973,  974,  974,
+      974,  974,  974,  974, 1784,  752,   51,  725,  975,  741,
+     1178,   51,  722,  975,  975,  975,  975,  975,  975,   51,
+     1210, 1002, 1002, 1002, 1002, 1002, 1002, 1002,   51, 1784,
+      732, 1511, 1002,   51,   51,   51,   51, 1002, 1002, 1002,
+     1002, 1002, 1002, 1003, 1003, 1003, 1003, 1003, 1003, 1003,
+       51,   51,   51,  825, 1003,  813, 1345, 1347, 1332, 1003,
 
-      360,  982, 1474,  430,  540,  535,  982,  982,  982,  982,
-      982,  982, 1165, 1166, 1166, 1166, 1166, 1166, 1166, 1169,
-     1170, 1170, 1170, 1170, 1170, 1170,   51,   51,  430,  982,
-      982,  982,  982,  982,  982,  982,  730,  711,  721,  718,
-      982,  629,  620,   51,   51,  982,  982,  982,  982,  982,
-      982,  262,  983,  983,  983,  983,  983,  983,  983, 1188,
-      714,  711, 1181,  984,  709,  620,  610,  608,  984,  984,
-      984,  984,  984,  984,   49,  984,  984,  984,  984,  984,
-      984,  984,  987,  988,  988,  988,  988,  988,  988, 1121,
-      698,  697,  696,  989,  695,  694,   51, 1321,  989,  989,
+     1003, 1003, 1003, 1003, 1003,  622, 1004, 1004, 1004, 1004,
+     1004, 1004, 1004, 1148, 1179, 1179,  725, 1005,  722,  433,
+      813, 1356, 1005, 1005, 1005, 1005, 1005, 1005, 1180, 1784,
+     1189, 1190, 1190, 1190, 1190, 1190, 1190, 1192, 1193, 1193,
+     1193, 1193, 1193, 1193,  433, 1005, 1005, 1005, 1005, 1005,
+     1005, 1005,   49, 1180, 1784,   49, 1005,   49,   51,   51,
+       51, 1005, 1005, 1005, 1005, 1005, 1005,  263, 1006, 1006,
+     1006, 1006, 1006, 1006, 1006,   51,   51,   51,  800, 1007,
+     1425, 1435, 1445,   49, 1007, 1007, 1007, 1007, 1007, 1007,
+       49, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1010, 1011,
 
-      989,  989,  989,  989,  719,  816,  816,  816,  816,  816,
-      816,  816,  894,   51,  693,  692,  817, 1476,   51,   51,
-     1282,  817,  817,  817,  817,  817,  817,  990,  991,  991,
-      991,  991,  991,  991, 1723,   51,   51,  691,  992, 1471,
-     1484,   51,  690,  992,  992,  992,  992,  992,  992,  728,
-      828,  828,  828,  828,  828,  828,  828,  897,   51, 1723,
-      689,  829, 1477,   51,   51, 1284,  829,  829,  829,  829,
-      829,  829,  993,  994,  994,  994,  994,  994,  994, 1285,
-       51,   51,  688,  995, 1472,  687, 1478,  680,  995,  995,
-      995,  995,  995,  995,  739,  843,  843,  843,  843,  843,
+     1011, 1011, 1011, 1011, 1011,   49,  778,  669,  468, 1012,
+      548,  752,   51,   51, 1012, 1012, 1012, 1012, 1012, 1012,
+      730,  831,  831,  831,  831,  831,  831,  831,  913,   51,
+       51,  725,  832,  362,  544,   51, 1313,  832,  832,  832,
+      832,  832,  832, 1013, 1014, 1014, 1014, 1014, 1014, 1014,
+     1314, 1442,   51, 1432, 1015,  539,  741,   51,  722, 1015,
+     1015, 1015, 1015, 1015, 1015,  739,  843,  843,  843,  843,
+      843,  843,  843,  916,   51, 1314, 1512,  844, 1513,   51,
+       51, 1313,  844,  844,  844,  844,  844,  844, 1016, 1017,
+     1017, 1017, 1017, 1017, 1017, 1784,   51,   51,  732, 1018,
 
-      843,  843,  900,  679, 1285,  678,  844,  677,   51,   51,
-     1284,  844,  844,  844,  844,  844,  844,  996,  997,  997,
-      997,  997,  997,  997, 1723,   51,   51,  676,  998, 1481,
-      675,   51,  674,  998,  998,  998,  998,  998,  998, 1002,
-     1003, 1003, 1003, 1003, 1003, 1003,  448, 1532,   51, 1723,
-     1004, 1544,  673,   51,   51, 1004, 1004, 1004, 1004, 1004,
-     1004,  905, 1007, 1007, 1007, 1007, 1007, 1007, 1007,  907,
-       51,   51,  672, 1008,  671,  670,   51,  669, 1008, 1008,
-     1008, 1008, 1008, 1008, 1009, 1010, 1010, 1010, 1010, 1010,
-     1010,  448, 1539,   51, 1541, 1011,  668,  667,   51,   51,
+      729, 1516,   51,  637, 1018, 1018, 1018, 1018, 1018, 1018,
+      750,  858,  858,  858,  858,  858,  858,  858,  919,   51,
+     1784,  628,  859, 1517,   51,   51, 1315,  859,  859,  859,
+      859,  859,  859, 1019, 1020, 1020, 1020, 1020, 1020, 1020,
+     1316,   51,   51,  725, 1021,  722, 1521, 1518,  720, 1021,
+     1021, 1021, 1021, 1021, 1021, 1025, 1026, 1026, 1026, 1026,
+     1026, 1026,  451,  628,  618, 1316, 1027,  616,  709,   51,
+       51, 1027, 1027, 1027, 1027, 1027, 1027,  924, 1030, 1030,
+     1030, 1030, 1030, 1030, 1030,  926,   51,   51, 1524, 1031,
+      708,   51, 1526,   51, 1031, 1031, 1031, 1031, 1031, 1031,
 
-     1011, 1011, 1011, 1011, 1011, 1011,  914, 1019, 1019, 1019,
-     1019, 1019, 1019, 1019,  916,   51,   51,  666, 1020,  665,
-       51, 1572,   51, 1020, 1020, 1020, 1020, 1020, 1020, 1021,
-     1022, 1022, 1022, 1022, 1022, 1022,  448,   51,  664,   51,
-     1023,  463,  661,  465, 1579, 1023, 1023, 1023, 1023, 1023,
-     1023,  925, 1034, 1034, 1034, 1034, 1034, 1034, 1034,  927,
-     1576,  459,  546, 1035,  530,   51,   51,   51, 1035, 1035,
-     1035, 1035, 1035, 1035, 1036, 1037, 1037, 1037, 1037, 1037,
-     1037,  448,   51,   51,   51, 1038,  537, 1597,   51,   51,
-     1038, 1038, 1038, 1038, 1038, 1038,  937, 1050, 1050, 1050,
+     1032, 1033, 1033, 1033, 1033, 1033, 1033,  451,   51,  707,
+       51, 1034, 1529,  706,   51,   51, 1034, 1034, 1034, 1034,
+     1034, 1034,  933, 1042, 1042, 1042, 1042, 1042, 1042, 1042,
+      935,   51,   51,  705, 1043,  704, 1591,   51,   51, 1043,
+     1043, 1043, 1043, 1043, 1043, 1044, 1045, 1045, 1045, 1045,
+     1045, 1045,  451, 1575,   51,   51, 1046, 1590,  703,  702,
+       51, 1046, 1046, 1046, 1046, 1046, 1046,  944, 1057, 1057,
+     1057, 1057, 1057, 1057, 1057,  946, 1583,   51, 1585, 1058,
+      701,   51,   51,   51, 1058, 1058, 1058, 1058, 1058, 1058,
+     1059, 1060, 1060, 1060, 1060, 1060, 1060,  451,   51,   51,
 
-     1050, 1050, 1050, 1050,  939,   51,   51,  629, 1051, 1598,
-       51,   51,   51, 1051, 1051, 1051, 1051, 1051, 1051, 1052,
-     1053, 1053, 1053, 1053, 1053, 1053,  448,   51,   51,   51,
-     1054, 1599, 1605,   51,   51, 1054, 1054, 1054, 1054, 1054,
-     1054,  856, 1061, 1061, 1061, 1061, 1061, 1061, 1061,  858,
-       51,   51,  620, 1062, 1619,  530, 1621,  620, 1062, 1062,
-     1062, 1062, 1062, 1062, 1063, 1064, 1064, 1064, 1064, 1064,
-     1064, 1064, 1065,   51,   51,  614, 1066,   51, 1067, 1340,
-       51, 1066, 1066, 1066, 1066, 1066, 1066, 1132, 1144,  614,
-       51,   51, 1156, 1341,   51, 1324, 1327,   51, 1196,   51,
+       51, 1061,  700,  699,   51, 1619, 1061, 1061, 1061, 1061,
+     1061, 1061,  956, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
+      958,   51,  698,  697, 1074,  694,   51,  689,   51, 1074,
+     1074, 1074, 1074, 1074, 1074, 1075, 1076, 1076, 1076, 1076,
+     1076, 1076,  451,   51, 1624,   51, 1077,  688, 1627,   51,
+       51, 1077, 1077, 1077, 1077, 1077, 1077,  871, 1084, 1084,
+     1084, 1084, 1084, 1084, 1084,  873,   51,   51,  687, 1085,
+      686, 1634,   51, 1630, 1085, 1085, 1085, 1085, 1085, 1085,
+     1086, 1087, 1087, 1087, 1087, 1087, 1087, 1087, 1088,   51,
+      685,  684, 1089,   51, 1090,   51,   51, 1089, 1089, 1089,
 
-     1330, 1178, 1179, 1067,   51,  614, 1090, 1090, 1090, 1090,
-     1090, 1090, 1090, 1187, 1197, 1198,   51, 1091, 1341,  607,
-      606,   51, 1091, 1091, 1091, 1091, 1091, 1091,   49, 1091,
-     1091, 1091, 1091, 1091, 1091, 1091,   51,  262, 1092, 1092,
-     1092, 1092, 1092, 1092, 1092,  605,   51,   51,   51,  604,
-       51,  603,   51,   51,  905, 1095, 1095, 1095, 1095, 1095,
-     1095, 1095, 1096,   51,   51,   51, 1097,   51,  909,   51,
-       51, 1097, 1097, 1097, 1097, 1097, 1097, 1303, 1191, 1193,
-     1224, 1225, 1225, 1225, 1225, 1225, 1225,   51, 1309,  602,
-       51,  601,   51,  909,  914, 1098, 1098, 1098, 1098, 1098,
+     1089, 1089, 1089, 1196, 1197, 1197, 1197, 1197, 1197, 1197,
+       51,  683,   51,   51,  682,  681,  680,   51,   51, 1090,
+       51,  622, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1214,
+      679, 1223, 1224, 1118,   51,   51,  678,   51, 1118, 1118,
+     1118, 1118, 1118, 1118,   49, 1118, 1118, 1118, 1118, 1118,
+     1118, 1118,   51,  263, 1119, 1119, 1119, 1119, 1119, 1119,
+     1119,  677,   51,  676,  675,  674,   51, 1315,   51,   51,
+      924, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1123,   51,
+       51, 1784, 1124,   51,  928,   51,  673, 1124, 1124, 1124,
+     1124, 1124, 1124, 1221, 1204,  672, 1205,   51,  466, 1159,
 
-     1098, 1098, 1099,  600, 1305,  599, 1100,   51,  918,   51,
-      598, 1100, 1100, 1100, 1100, 1100, 1100, 1230, 1231, 1231,
-     1231, 1231, 1231, 1231, 1234, 1235, 1235, 1235, 1235, 1235,
-     1235,  597,   51,  918,  925, 1101, 1101, 1101, 1101, 1101,
-     1101, 1101, 1102,  333,  234,  596, 1103,  595,  929,   51,
-      594, 1103, 1103, 1103, 1103, 1103, 1103, 1240, 1241, 1241,
-     1241, 1241, 1241, 1241, 1243, 1244, 1244, 1244, 1244, 1244,
-     1244,  593,   51,  929,  937, 1104, 1104, 1104, 1104, 1104,
-     1104, 1104, 1105,  592,  591,  590, 1106,  589,  941,   51,
-      588, 1106, 1106, 1106, 1106, 1106, 1106, 1247, 1248, 1248,
+      669,  468,   51,   51,   51,  462, 1784, 1359, 1206,  928,
+      933, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1126,   51,
+       51,   51, 1127,  550,  937,   51, 1375, 1127, 1127, 1127,
+     1127, 1127, 1127, 1171, 1216, 1219, 1331, 1183, 1249, 1319,
+     1376, 1362,   51, 1226,   51, 1365, 1447, 1321,  534,  937,
+      944, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1129, 1227,
+     1228,   51, 1130, 1659,  948, 1376,  541, 1130, 1130, 1130,
+     1130, 1130, 1130, 1255, 1256, 1256, 1256, 1256, 1256, 1256,
+     1261, 1262, 1262, 1262, 1262, 1262, 1262,  637,   51,  948,
+      956, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1132,  628,
+
+      534,  628, 1133,  622,  960,   51,  622, 1133, 1133, 1133,
+     1133, 1133, 1133, 1265, 1266, 1266, 1266, 1266, 1266, 1266,
+     1271, 1272, 1272, 1272, 1272, 1272, 1272,   51,   51,  960,
+     1135, 1136, 1136, 1136, 1136, 1136, 1136, 1137,  615,  614,
+      613, 1138,  612,  611,   51,   51, 1138, 1138, 1138, 1138,
+     1138, 1138, 1139, 1140, 1140, 1140, 1140, 1140, 1140, 1140,
+     1141,  610, 1337, 1333, 1142,  609, 1143,  608,  607, 1142,
+     1142, 1142, 1142, 1142, 1142, 1274, 1275, 1275, 1275, 1275,
+     1275, 1275, 1278, 1279, 1279, 1279, 1279, 1279, 1279,   51,
+       51, 1143,  924, 1146, 1146, 1146, 1146, 1146, 1146, 1146,
 
-     1248, 1248, 1248, 1248, 1254, 1255, 1255, 1255, 1255, 1255,
-     1255,   51, 1340,  941, 1108, 1109, 1109, 1109, 1109, 1109,
-     1109, 1110,  587,  586,  585, 1111, 1723,  584,   51,  576,
-     1111, 1111, 1111, 1111, 1111, 1111, 1112, 1113, 1113, 1113,
-     1113, 1113, 1113, 1113, 1114,  573, 1306,  570, 1115,  569,
-     1116, 1723,  568, 1115, 1115, 1115, 1115, 1115, 1115, 1257,
-     1258, 1258, 1258, 1258, 1258, 1258, 1261, 1262, 1262, 1262,
-     1262, 1262, 1262, 1345,   51, 1116,  905, 1119, 1119, 1119,
-     1119, 1119, 1119, 1119, 1096,  567,  566, 1346, 1120,  565,
-      564,   51,   51, 1120, 1120, 1120, 1120, 1120, 1120, 1121,
+     1123,  606,  605,  335, 1147,  235,   51,   51,   51, 1147,
+     1147, 1147, 1147, 1147, 1147, 1148, 1149, 1149, 1149, 1149,
+     1149, 1149, 1149, 1150, 1338,   51, 1343, 1151, 1648, 1152,
+      604,  603, 1151, 1151, 1151, 1151, 1151, 1151, 1285, 1286,
+     1286, 1286, 1286, 1286, 1286, 1288, 1289, 1289, 1289, 1289,
+     1289, 1289, 1375,   51, 1152,  933, 1157, 1157, 1157, 1157,
+     1157, 1157, 1157, 1126,  602,  601, 1784, 1158,  600,  599,
+       51,   51, 1158, 1158, 1158, 1158, 1158, 1158, 1159, 1160,
+     1160, 1160, 1160, 1160, 1160, 1160, 1161, 1339,   51,  598,
+     1162, 1784, 1163, 1675,  597, 1162, 1162, 1162, 1162, 1162,
 
-     1122, 1122, 1122, 1122, 1122, 1122, 1122, 1123, 1307,   51,
-      563, 1124, 1346, 1125, 1622,  562, 1124, 1124, 1124, 1124,
-     1124, 1124, 1268, 1269, 1269, 1269, 1269, 1269, 1269, 1271,
-     1272, 1272, 1272, 1272, 1272, 1272, 1345,   51, 1125,  914,
-     1130, 1130, 1130, 1130, 1130, 1130, 1130, 1099,  561,  465,
-     1723, 1131,  274,  448,   51, 1394, 1131, 1131, 1131, 1131,
-     1131, 1131, 1132, 1133, 1133, 1133, 1133, 1133, 1133, 1133,
-     1134,  360, 1395,  546, 1135, 1723, 1136,  530,  537, 1135,
-     1135, 1135, 1135, 1135, 1135, 1275, 1276, 1276, 1276, 1276,
-     1276, 1276, 1163, 1163, 1163, 1163, 1163, 1163, 1163, 1347,
+     1162, 1292, 1293, 1293, 1293, 1293, 1293, 1293, 1299, 1300,
+     1300, 1300, 1300, 1300, 1300, 1380,   51, 1163,  944, 1169,
+     1169, 1169, 1169, 1169, 1169, 1169, 1129,  596,  595, 1381,
+     1170,  594,  593,   51, 1429, 1170, 1170, 1170, 1170, 1170,
+     1170, 1171, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1173,
+      592, 1430,  591, 1174, 1381, 1175,  580,  577, 1174, 1174,
+     1174, 1174, 1174, 1174, 1302, 1303, 1303, 1303, 1303, 1303,
+     1303, 1306, 1307, 1307, 1307, 1307, 1307, 1307, 1380,   51,
+     1175,  956, 1181, 1181, 1181, 1181, 1181, 1181, 1181, 1132,
+      574,  573, 1784, 1182,  572,  571,   51,   51, 1182, 1182,
 
-       51, 1136,  925, 1142, 1142, 1142, 1142, 1142, 1142, 1142,
-     1102,  448,  534, 1348, 1143,  445,  439,   51,   51, 1143,
-     1143, 1143, 1143, 1143, 1143, 1144, 1145, 1145, 1145, 1145,
-     1145, 1145, 1145, 1146,   51,   51, 1397, 1147, 1348, 1148,
-     1218, 1288, 1147, 1147, 1147, 1147, 1147, 1147, 1408, 1290,
-     1300,   51, 1332, 1333, 1333, 1333, 1333, 1333, 1333,   51,
-     1347,   51, 1298,   51, 1148,  937, 1154, 1154, 1154, 1154,
-     1154, 1154, 1154, 1105, 1723,  530,   51, 1155,   51, 1650,
-       51,   51, 1155, 1155, 1155, 1155, 1155, 1155, 1156, 1157,
-     1157, 1157, 1157, 1157, 1157, 1157, 1158,   51,   51, 1723,
+     1182, 1182, 1182, 1182, 1183, 1184, 1184, 1184, 1184, 1184,
+     1184, 1184, 1185,  570,   51, 1433, 1186, 1784, 1187, 1676,
+      569, 1186, 1186, 1186, 1186, 1186, 1186, 1190, 1190, 1190,
+     1190, 1190, 1190, 1190, 1367, 1368, 1368, 1368, 1368, 1368,
+     1368, 1382,   51, 1187, 1086, 1198, 1198, 1198, 1198, 1198,
+     1198, 1198, 1088,  568,  567, 1383, 1199,  566,   51,   51,
+     1382, 1199, 1199, 1199, 1199, 1199, 1199, 1200, 1201, 1201,
+     1201, 1201, 1201, 1201, 1784,   51, 1434,  565, 1202, 1673,
+     1383,   51,  468, 1202, 1202, 1202, 1202, 1202, 1202,   51,
+      622, 1230, 1230, 1230, 1230, 1230, 1230, 1230,   51, 1784,
 
-     1159, 1629, 1160, 1288,  528, 1159, 1159, 1159, 1159, 1159,
-     1159, 1723, 1304,  439,   51, 1241, 1241, 1241, 1241, 1241,
-     1241, 1241,   51,  431, 1353, 1302,   51, 1160, 1063, 1171,
-     1171, 1171, 1171, 1171, 1171, 1171, 1065,  425, 1354,   51,
-     1172,  515,  514,   51, 1353, 1172, 1172, 1172, 1172, 1172,
-     1172, 1173, 1174, 1174, 1174, 1174, 1174, 1174, 1723, 1485,
-     1398,  513, 1175, 1354,  512,   51,  511, 1175, 1175, 1175,
-     1175, 1175, 1175,   51,  614, 1199, 1199, 1199, 1199, 1199,
-     1199, 1199,   51, 1723,  510,  509,  984, 1637,  508,  507,
-       51,  984,  984,  984,  984,  984,  984,   49,  984,  984,
+      275, 1650, 1007,  451,  362,  550,   51, 1007, 1007, 1007,
+     1007, 1007, 1007,   49, 1007, 1007, 1007, 1007, 1007, 1007,
+     1007,   51,  263, 1119, 1119, 1119, 1119, 1119, 1119, 1119,
+     1272, 1272, 1272, 1272, 1272, 1272, 1272, 1388,   51, 1233,
+     1234, 1234, 1234, 1234, 1234, 1234, 1319,  534,  541,  451,
+     1235, 1389,  538,   51, 1784, 1235, 1235, 1235, 1235, 1235,
+     1235,  924, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1123,
+       51,  448,  442, 1031,  534,   51, 1389, 1388, 1031, 1031,
+     1031, 1031, 1031, 1031, 1236, 1237, 1237, 1237, 1237, 1237,
+     1237, 1784,   51,  532,  442, 1238,  434,  428,   51,  519,
 
-      984,  984,  984,  984,  984,   51,  262, 1092, 1092, 1092,
-     1092, 1092, 1092, 1092,  506,   51, 1355, 1355,  505, 1361,
-       51, 1361,   51, 1202, 1203, 1203, 1203, 1203, 1203, 1203,
-     1356, 1723,   51, 1362, 1204, 1723, 1652,   51,  504, 1204,
-     1204, 1204, 1204, 1204, 1204,  905, 1007, 1007, 1007, 1007,
-     1007, 1007, 1007, 1096, 1403, 1356, 1723, 1008, 1362,   51,
-     1723, 1363, 1008, 1008, 1008, 1008, 1008, 1008, 1205, 1206,
-     1206, 1206, 1206, 1206, 1206, 1364,   51,  503,  502, 1207,
-      501, 1638,   51,  498, 1207, 1207, 1207, 1207, 1207, 1207,
-      914, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1099,   51,
+     1238, 1238, 1238, 1238, 1238, 1238,  933, 1042, 1042, 1042,
+     1042, 1042, 1042, 1042, 1126,   51, 1784,  518, 1043,  517,
+     1684,   51, 1390, 1043, 1043, 1043, 1043, 1043, 1043, 1239,
+     1240, 1240, 1240, 1240, 1240, 1240, 1391,  516,   51,  515,
+     1241, 1651,  514,   51,  513, 1241, 1241, 1241, 1241, 1241,
+     1241,  944, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1129,
+       51, 1391,  512, 1058,  511,   51,   51, 1390, 1058, 1058,
+     1058, 1058, 1058, 1058, 1242, 1243, 1243, 1243, 1243, 1243,
+     1243, 1784,   51,   51,  510, 1244, 1657, 1693,   51,  509,
+     1244, 1244, 1244, 1244, 1244, 1244,  956, 1073, 1073, 1073,
 
-     1364,  497, 1020,  494, 1639,   51, 1363, 1020, 1020, 1020,
-     1020, 1020, 1020, 1208, 1209, 1209, 1209, 1209, 1209, 1209,
-     1723,  493,   51,  492, 1210,  491,  490, 1641,  115, 1210,
-     1210, 1210, 1210, 1210, 1210,  925, 1034, 1034, 1034, 1034,
-     1034, 1034, 1034, 1102,  489, 1723,  488, 1035,  476,   51,
-       51, 1369, 1035, 1035, 1035, 1035, 1035, 1035, 1211, 1212,
-     1212, 1212, 1212, 1212, 1212, 1370,   51,   51,  475, 1213,
-      474, 1654,   51,  473, 1213, 1213, 1213, 1213, 1213, 1213,
-      937, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1105,   51,
-     1370, 1657, 1051,  472,   51,   51,   51, 1051, 1051, 1051,
+     1073, 1073, 1073, 1073, 1132,   51, 1784,  508, 1074,   51,
+       51,  507,   51, 1074, 1074, 1074, 1074, 1074, 1074, 1245,
+     1246, 1246, 1246, 1246, 1246, 1246,   51,   51, 1694,   51,
+     1247,  506,  505,  502, 1574, 1247, 1247, 1247, 1247, 1247,
+     1247, 1249, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1251,
+       51,   51, 1396, 1252,  501, 1253,  498,  497, 1252, 1252,
+     1252, 1252, 1252, 1252,  496,  495, 1397,   51,   51, 1286,
+     1286, 1286, 1286, 1286, 1286, 1286, 1396,   51, 1329, 1334,
+     1253, 1139, 1257, 1257, 1257, 1257, 1257, 1257, 1257, 1141,
+     1784, 1397,  494, 1258,   51,  115,  493,   51, 1258, 1258,
 
-     1051, 1051, 1051, 1214, 1215, 1215, 1215, 1215, 1215, 1215,
-     1630,   51,   51,   51, 1216,  471, 1656,   51,   51, 1216,
-     1216, 1216, 1216, 1216, 1216, 1218, 1219, 1219, 1219, 1219,
-     1219, 1219, 1219, 1220,   51,   51, 1658, 1221,  470, 1222,
-      469,  468, 1221, 1221, 1221, 1221, 1221, 1221, 1308, 1312,
-     1255, 1255, 1255, 1255, 1255, 1255, 1255, 1269, 1269, 1269,
-     1269, 1269, 1269, 1269, 1222, 1112, 1226, 1226, 1226, 1226,
-     1226, 1226, 1226, 1114,  272,  465,  274, 1227,  448,  362,
-       51,   51, 1227, 1227, 1227, 1227, 1227, 1227, 1121, 1236,
-     1236, 1236, 1236, 1236, 1236, 1236, 1123,   51,   51,  445,
+     1258, 1258, 1258, 1258, 1148, 1267, 1267, 1267, 1267, 1267,
+     1267, 1267, 1150, 1436,   51, 1784, 1268,  492,  491, 1695,
+       51, 1268, 1268, 1268, 1268, 1268, 1268, 1159, 1280, 1280,
+     1280, 1280, 1280, 1280, 1280, 1161,  479,   51,  478, 1281,
+      477,  476, 1696,   51, 1281, 1281, 1281, 1281, 1281, 1281,
+     1171, 1294, 1294, 1294, 1294, 1294, 1294, 1294, 1173,  475,
+       51,  474, 1295,  473,  472, 1697,   51, 1295, 1295, 1295,
+     1295, 1295, 1295, 1183, 1308, 1308, 1308, 1308, 1308, 1308,
+     1308, 1185,  471,   51,  273, 1309,  468,  275, 1699,   51,
+     1309, 1309, 1309, 1309, 1309, 1309, 1086, 1317, 1317, 1317,
 
-     1237,  439, 1667, 1675,   51, 1237, 1237, 1237, 1237, 1237,
-     1237, 1132, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1134,
-      439,   51,  432, 1250,  432,  424, 1676,   51, 1250, 1250,
-     1250, 1250, 1250, 1250, 1144, 1263, 1263, 1263, 1263, 1263,
-     1263, 1263, 1146,  415,   51,  414, 1264,  411,  410, 1681,
-       51, 1264, 1264, 1264, 1264, 1264, 1264, 1156, 1277, 1277,
-     1277, 1277, 1277, 1277, 1277, 1158,  409,   51,  408, 1278,
-      407, 1682,   51,   51, 1278, 1278, 1278, 1278, 1278, 1278,
-     1063, 1286, 1286, 1286, 1286, 1286, 1286, 1286, 1065,   51,
-       51,  406, 1287, 1688, 1685,  405,  404, 1287, 1287, 1287,
+     1317, 1317, 1317, 1317, 1088,  451,   51,  364, 1318, 1706,
+      448,  442,   51, 1318, 1318, 1318, 1318, 1318, 1318, 1319,
+     1320, 1320, 1320, 1320, 1320, 1320, 1320, 1321,   51,   51,
+       51, 1322,   51, 1323,   51,   51, 1322, 1322, 1322, 1322,
+     1322, 1322, 1335, 1398,  442,   51,  435,   51,  435,   51,
+      427,   51,   51,  418,  417,  414,  413, 1399, 1323, 1336,
+       51, 1340,   51, 1341, 1523, 1346,   51,  622,  524,  524,
+      524,  524,  524,  524,  524,  412,   51,   51, 1398,   51,
+     1404,   51, 1399,   51, 1348, 1349, 1349, 1349, 1349, 1349,
+     1349, 1350, 1784,   51, 1405, 1351, 1439, 1527,   51, 1437,
 
-     1287, 1287, 1287, 1288, 1289, 1289, 1289, 1289, 1289, 1289,
-     1289, 1290,   51, 1369, 1371, 1291, 1371, 1292,  403,  402,
-     1291, 1291, 1291, 1291, 1291, 1291,  401, 1723, 1372,   51,
-     1723, 1377, 1378, 1378, 1378, 1378, 1378, 1378, 1391,   51,
-       51,   51, 1292,   51,  614,  520,  520,  520,  520,  520,
-      520,  520, 1723, 1372,  400, 1723,   51,   51,   51, 1416,
-       51, 1313, 1314, 1314, 1314, 1314, 1314, 1314, 1315, 1392,
-      399, 1405, 1316, 1417,  398,   51, 1400, 1316, 1316, 1316,
-     1316, 1316, 1316, 1112, 1317, 1317, 1317, 1317, 1317, 1317,
-     1317, 1318,   51,  397,  396, 1319,  395, 1116, 1417,  390,
+     1351, 1351, 1351, 1351, 1351, 1351, 1139, 1352, 1352, 1352,
+     1352, 1352, 1352, 1352, 1353,  411, 1438, 1784, 1354, 1405,
+     1143,   51, 1404, 1354, 1354, 1354, 1354, 1354, 1354, 1300,
+     1300, 1300, 1300, 1300, 1300, 1300, 1784,  410,   51,  409,
+      408, 1406, 1406, 1455,  407, 1143, 1148, 1355, 1355, 1355,
+     1355, 1355, 1355, 1355, 1356, 1407, 1784, 1456, 1357,   51,
+     1152, 1784,   51, 1357, 1357, 1357, 1357, 1357, 1357, 1412,
+     1413, 1413, 1413, 1413, 1413, 1413,   51,  406,  405,   51,
+     1407, 1784, 1456,  404,   51, 1152, 1159, 1358, 1358, 1358,
+     1358, 1358, 1358, 1358, 1359, 1572, 1441,  403, 1360,  402,
 
-     1319, 1319, 1319, 1319, 1319, 1319, 1380, 1381, 1381, 1381,
-     1381, 1381, 1381, 1384, 1385, 1385, 1385, 1385, 1385, 1385,
-     1416,   51, 1116, 1121, 1320, 1320, 1320, 1320, 1320, 1320,
-     1320, 1321,  389,   51, 1723, 1322,   51, 1125,   51,   51,
-     1322, 1322, 1322, 1322, 1322, 1322,  388,  387,  386, 1393,
-       51,  315,  385,   51,  384,  383,   51, 1401,  382, 1723,
-      381, 1406, 1125, 1132, 1323, 1323, 1323, 1323, 1323, 1323,
-     1323, 1324, 1529,  380, 1402, 1325,  374, 1136,  274,  362,
-     1325, 1325, 1325, 1325, 1325, 1325, 1422, 1423, 1423, 1423,
-     1423, 1423, 1423, 1427, 1428, 1428, 1428, 1428, 1428, 1428,
+     1163,   51,  401, 1360, 1360, 1360, 1360, 1360, 1360, 1415,
+     1416, 1416, 1416, 1416, 1416, 1416, 1419, 1420, 1420, 1420,
+     1420, 1420, 1420,  400,   51, 1163, 1171, 1361, 1361, 1361,
+     1361, 1361, 1361, 1361, 1362,   51,   51,   51, 1363,   51,
+     1175,   51,  399, 1363, 1363, 1363, 1363, 1363, 1363,  398,
+     1426,  397,   51,   51,   51,  392,   51, 1710,  391,   51,
+       51, 1714, 1431, 1428,   51, 1175, 1183, 1364, 1364, 1364,
+     1364, 1364, 1364, 1364, 1365,   51,   51,   51, 1366,  390,
+     1187,   51, 1455, 1366, 1366, 1366, 1366, 1366, 1366, 1427,
+      389, 1440,   51,  388, 1443,  317, 1784,  387,  386,   51,
 
-      270,   51, 1136, 1144, 1326, 1326, 1326, 1326, 1326, 1326,
-     1326, 1327,  359,  267,  355, 1328,  261, 1148,   51,  255,
-     1328, 1328, 1328, 1328, 1328, 1328, 1430, 1431, 1431, 1431,
-     1431, 1431, 1431, 1436, 1437, 1437, 1437, 1437, 1437, 1437,
-      138,   51, 1148, 1156, 1329, 1329, 1329, 1329, 1329, 1329,
-     1329, 1330,  343,  342,  341, 1331,  336, 1160,   51,  315,
-     1331, 1331, 1331, 1331, 1331, 1331, 1439, 1440, 1440, 1440,
-     1440, 1440, 1440, 1445, 1446, 1446, 1446, 1446, 1446, 1446,
-     1463,   51, 1160, 1218, 1334, 1334, 1334, 1334, 1334, 1334,
-     1334, 1220,  335,  334, 1464, 1335,  333,  332,   51,   51,
+       51, 1502,   51, 1444,  385, 1187, 1249, 1369, 1369, 1369,
+     1369, 1369, 1369, 1369, 1251, 1503,   51,   51, 1370,   51,
+     1712, 1784, 1716, 1370, 1370, 1370, 1370, 1370, 1370, 1139,
+     1377, 1377, 1377, 1377, 1377, 1377, 1377, 1353, 1618,  384,
+     1503, 1378,  383,  382,   51,   51, 1378, 1378, 1378, 1378,
+     1378, 1378, 1148, 1384, 1384, 1384, 1384, 1384, 1384, 1384,
+     1356,   51,   51,  376, 1385,  275,  364,   51,  271, 1385,
+     1385, 1385, 1385, 1385, 1385, 1159, 1392, 1392, 1392, 1392,
+     1392, 1392, 1392, 1359,   51, 1718, 1719, 1393,  361, 1728,
+       51,   51, 1393, 1393, 1393, 1393, 1393, 1393, 1171, 1400,
 
-     1335, 1335, 1335, 1335, 1335, 1335, 1112, 1342, 1342, 1342,
-     1342, 1342, 1342, 1342, 1318, 1470,   51,  331, 1343, 1464,
-      330,   51,   51, 1343, 1343, 1343, 1343, 1343, 1343, 1121,
-     1349, 1349, 1349, 1349, 1349, 1349, 1349, 1321,   51,   51,
-     1689, 1350,  329, 1695, 1703,   51, 1350, 1350, 1350, 1350,
-     1350, 1350, 1132, 1357, 1357, 1357, 1357, 1357, 1357, 1357,
-     1324,  328,   51,  327, 1358,  326,  325,   51,   51, 1358,
-     1358, 1358, 1358, 1358, 1358, 1144, 1365, 1365, 1365, 1365,
-     1365, 1365, 1365, 1327,   51,   51, 1705, 1366,  324,  323,
-     1710,  322, 1366, 1366, 1366, 1366, 1366, 1366, 1156, 1373,
+     1400, 1400, 1400, 1400, 1400, 1400, 1362,   51,   51,  268,
+     1401,  357, 1736, 1737,   51, 1401, 1401, 1401, 1401, 1401,
+     1401, 1183, 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1365,
+      262,   51,  256, 1409,  138,  345, 1742,   51, 1409, 1409,
+     1409, 1409, 1409, 1409, 1319, 1421, 1421, 1421, 1421, 1421,
+     1421, 1421, 1321,  344,   51,  343, 1422,  338, 1743,   51,
+       51, 1422, 1422, 1422, 1422, 1422, 1422, 1249, 1446, 1446,
+     1446, 1446, 1446, 1446, 1446, 1447,   51,   51,  317, 1448,
+      337, 1253, 1746,  336, 1448, 1448, 1448, 1448, 1448, 1448,
+     1461, 1462, 1462, 1462, 1462, 1462, 1462, 1466, 1467, 1467,
 
-     1373, 1373, 1373, 1373, 1373, 1373, 1330,  321, 1709,  318,
-     1374,  317,  316,   51,   51, 1374, 1374, 1374, 1374, 1374,
-     1374, 1288, 1386, 1386, 1386, 1386, 1386, 1386, 1386, 1290,
-       51,   51,  315, 1387, 1712,  314,   51,   51, 1387, 1387,
-     1387, 1387, 1387, 1387, 1218, 1407, 1407, 1407, 1407, 1407,
-     1407, 1407, 1408,   51,   51,  313, 1409,  312, 1222, 1714,
-      311, 1409, 1409, 1409, 1409, 1409, 1409, 1448, 1449, 1449,
-     1449, 1449, 1449, 1449, 1454, 1455, 1455, 1455, 1455, 1455,
-     1455, 1463,   51, 1222, 1112, 1226, 1226, 1226, 1226, 1226,
-     1226, 1226, 1318,  310,  309, 1723, 1227,  308,  307,   51,
+     1467, 1467, 1467, 1467, 1502,   51, 1253, 1139, 1257, 1257,
+     1257, 1257, 1257, 1257, 1257, 1353,  335,  334, 1784, 1258,
+      333,  332,   51,   51, 1258, 1258, 1258, 1258, 1258, 1258,
+     1148, 1267, 1267, 1267, 1267, 1267, 1267, 1267, 1356, 1509,
+       51,  331, 1268, 1784,  330,   51,   51, 1268, 1268, 1268,
+     1268, 1268, 1268, 1159, 1280, 1280, 1280, 1280, 1280, 1280,
+     1280, 1359,   51,   51,  329, 1281, 1749,  328,   51,  327,
+     1281, 1281, 1281, 1281, 1281, 1281, 1171, 1294, 1294, 1294,
+     1294, 1294, 1294, 1294, 1362,   51, 1750,  326, 1295,  325,
+     1756,   51,   51, 1295, 1295, 1295, 1295, 1295, 1295, 1183,
 
-       51, 1227, 1227, 1227, 1227, 1227, 1227, 1121, 1236, 1236,
-     1236, 1236, 1236, 1236, 1236, 1321, 1542,   51,  306, 1237,
-     1723,  305,   51,   51, 1237, 1237, 1237, 1237, 1237, 1237,
-     1132, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1324,   51,
-       51,  304, 1250,  303,  302,   51,   51, 1250, 1250, 1250,
-     1250, 1250, 1250, 1144, 1263, 1263, 1263, 1263, 1263, 1263,
-     1263, 1327,   51,   51,  301, 1264,  300,  299,   51,  298,
-     1264, 1264, 1264, 1264, 1264, 1264, 1156, 1277, 1277, 1277,
-     1277, 1277, 1277, 1277, 1330,   51,  297,  296, 1278,  295,
-      294,  293,  292, 1278, 1278, 1278, 1278, 1278, 1278, 1218,
+     1308, 1308, 1308, 1308, 1308, 1308, 1308, 1365,   51,   51,
+      324, 1309,  323,  320, 1764,   51, 1309, 1309, 1309, 1309,
+     1309, 1309, 1249, 1457, 1457, 1457, 1457, 1457, 1457, 1457,
+     1447,  319,   51,  318, 1458,  317,  316,  315,  314, 1458,
+     1458, 1458, 1458, 1458, 1458, 1469, 1470, 1470, 1470, 1470,
+     1470, 1470, 1475, 1476, 1476, 1476, 1476, 1476, 1476, 1478,
+     1479, 1479, 1479, 1479, 1479, 1479, 1484, 1485, 1485, 1485,
+     1485, 1485, 1485, 1487, 1488, 1488, 1488, 1488, 1488, 1488,
+     1493, 1494, 1494, 1494, 1494, 1494, 1494, 1496, 1497, 1497,
+     1497, 1497, 1497, 1497, 1413, 1413, 1413, 1413, 1413, 1413,
 
-     1418, 1418, 1418, 1418, 1418, 1418, 1418, 1408,  138,  291,
-      290, 1419,  289,  288,  287,  286, 1419, 1419, 1419, 1419,
-     1419, 1419, 1457, 1458, 1458, 1458, 1458, 1458, 1458, 1378,
-     1378, 1378, 1378, 1378, 1378, 1378, 1465, 1465,   51,   51,
-       51,   51,   51, 1495, 1496, 1496, 1496, 1496, 1496, 1496,
-     1466, 1723, 1501,  285,  284,   51,   51,   51,   51,   51,
-      283,  282,  281,  280,  279,  278, 1502, 1479, 1486, 1475,
-     1483, 1482, 1501, 1480, 1505, 1466, 1723, 1288, 1467, 1467,
-     1467, 1467, 1467, 1467, 1467, 1290, 1723,  277, 1506, 1468,
-      274, 1502,  262,  267, 1468, 1468, 1468, 1468, 1468, 1468,
+     1413, 1504, 1504,   51,   51,   51,   51,   51,   51,   51,
+      313,  312,   51, 1544, 1544, 1505, 1784, 1548, 1548,   51,
+       51,   51,   51,   51,   51,   51,   51, 1545, 1784,   51,
+     1771, 1549, 1784, 1519, 1514, 1515,   51, 1522, 1528, 1520,
+     1505, 1784, 1319, 1506, 1506, 1506, 1506, 1506, 1506, 1506,
+     1321, 1525, 1545, 1784, 1507,  311, 1549, 1784,   51, 1507,
+     1507, 1507, 1507, 1507, 1507, 1249, 1369, 1369, 1369, 1369,
+     1369, 1369, 1369, 1447,  310,   51,  309, 1370, 1773,  308,
+      307,  306, 1370, 1370, 1370, 1370, 1370, 1370, 1538, 1539,
+     1539, 1539, 1539, 1539, 1539, 1467, 1467, 1467, 1467, 1467,
 
-     1218, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1408,  254,
-      253, 1723, 1335, 1506,  252,  251, 1505, 1335, 1335, 1335,
-     1335, 1335, 1335, 1428, 1428, 1428, 1428, 1428, 1428, 1428,
-     1723, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1509, 1509,
-     1446, 1446, 1446, 1446, 1446, 1446, 1446, 1513, 1513,  250,
-      249,  248, 1510, 1723,  247, 1723, 1517, 1517,  246,  245,
-      242, 1514, 1723, 1455, 1455, 1455, 1455, 1455, 1455, 1455,
-     1518, 1723,  239,  236,  235,  234,  233, 1510, 1723, 1521,
-     1522, 1522, 1522, 1522, 1522, 1522, 1514, 1723, 1524, 1525,
-     1525, 1525, 1525, 1525, 1525, 1518, 1723,   51,   51,   51,
+     1467, 1467, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1552,
+     1552, 1485, 1485, 1485, 1485, 1485, 1485, 1485, 1556, 1556,
+     1560, 1560,  305, 1553, 1784, 1494, 1494, 1494, 1494, 1494,
+     1494, 1494, 1557, 1784, 1561, 1784, 1564, 1565, 1565, 1565,
+     1565, 1565, 1565,  304,   51,   51,   51,  303, 1553, 1784,
+     1567, 1568, 1568, 1568, 1568, 1568, 1568, 1557, 1784, 1561,
+     1784,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+     1573,   51,   51, 1576,  302,  301, 1577,   51,   51,  300,
+      299,   51,   51,   51,   51,   51,   51, 1593,   51,   51,
+     1578, 1579, 1580, 1581,   51,   51, 1593, 1584, 1586, 1582,
 
-       51,   51,   51,   51,   51,   51,  230,  229,   51,  228,
-      227,  226,  225,  224,   51,   51,   51,   51,   51,   51,
-       51,   51,   51, 1530, 1531,   51, 1533, 1534, 1535, 1536,
-     1537, 1538, 1546, 1540, 1546,  223,  222, 1543, 1548, 1549,
-     1549, 1549, 1549, 1549, 1549,  221, 1547,  220, 1723, 1552,
-     1553, 1553, 1553, 1553, 1553, 1553, 1556, 1557, 1557, 1557,
-     1557, 1557, 1557, 1560, 1561, 1561, 1561, 1561, 1561, 1561,
-      219, 1547,  218, 1723, 1564, 1565, 1565, 1565, 1565, 1565,
-     1565, 1522, 1522, 1522, 1522, 1522, 1522, 1522, 1568, 1568,
-       51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+      298, 1594,  297,  296,  295, 1587,  294, 1589,  293,  138,
+     1784, 1588, 1595, 1596, 1596, 1596, 1596, 1596, 1596, 1599,
+     1600, 1600, 1600, 1600, 1600, 1600, 1594, 1603, 1604, 1604,
+     1604, 1604, 1604, 1604,  292, 1784, 1607, 1608, 1608, 1608,
+     1608, 1608, 1608, 1611, 1612, 1612, 1612, 1612, 1612, 1612,
+     1565, 1565, 1565, 1565, 1565, 1565, 1565, 1615, 1615,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,  291,   51,
+       51, 1616, 1784,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51, 1620,   51,   51, 1628,  290,
+       51,   51,   51, 1633, 1631, 1622, 1616, 1784, 1621, 1623,
 
-      217,  216, 1569, 1723,   51,   51,   51,   51,   51,   51,
-       51,   51,   51,   51,   51,   51,   51, 1573, 1580, 1583,
-      215,   51,   51,   51,  211,  210, 1571, 1569, 1723, 1574,
-     1575, 1577, 1596,  200, 1578, 1581,  199, 1617,  198, 1604,
-     1582, 1584, 1585, 1585, 1585, 1585, 1585, 1585, 1549, 1549,
-     1549, 1549, 1549, 1549, 1549, 1553, 1553, 1553, 1553, 1553,
-     1553, 1553, 1557, 1557, 1557, 1557, 1557, 1557, 1557, 1561,
-     1561, 1561, 1561, 1561, 1561, 1561, 1565, 1565, 1565, 1565,
-     1565, 1565, 1565, 1593, 1594, 1594, 1594, 1594, 1594, 1594,
-       51,  195,   51,   51,   51,   51, 1585, 1585, 1585, 1585,
+     1625, 1658, 1705, 1626, 1649, 1629, 1632, 1635, 1636, 1636,
+     1636, 1636, 1636, 1636, 1596, 1596, 1596, 1596, 1596, 1596,
+     1596, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1604, 1604,
+     1604, 1604, 1604, 1604, 1604, 1608, 1608, 1608, 1608, 1608,
+     1608, 1608, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1644,
+     1645, 1645, 1645, 1645, 1645, 1645,   51,   51,  289,   51,
+       51,   51,   51,   51, 1636, 1636, 1636, 1636, 1636, 1636,
+     1636,   51,  288,   51,   51, 1652,   51,   51,   51,   51,
+       51, 1645, 1645, 1645, 1645, 1645, 1645, 1645,   51,   51,
+     1647,   51, 1653,   51,   51, 1654, 1655, 1656, 1660,   51,
 
-     1585, 1585, 1585,  194,   51,   51,   51,   51, 1600,   51,
-       51,   51,   51, 1594, 1594, 1594, 1594, 1594, 1594, 1594,
-     1606,   51,   51,   51,   51, 1601,   51,   51, 1602, 1603,
-       51, 1607, 1616,   51,   51,   51, 1618,   51,  189,   51,
-     1615,   51,   51,   51,   51,  188,  187,   51,   51,   51,
-       51,   51,   51, 1624,   51, 1620,   51,  186,   51,   51,
-       51, 1625, 1623, 1632,   51,   51,   51, 1633,   51, 1628,
-       51,   51, 1631, 1634, 1640,   51, 1642,   51, 1635, 1636,
-      185,   51,   51,   51,   51,   51,   51,   51,   51,   51,
-       51, 1653,   51, 1643, 1644,   51,  184, 1645, 1646,   51,
+       51,   51,   51,  287,   51,   51,   51, 1668,   51,   51,
+       51,   51,   51,  286,  285, 1669,   51,   51,   51,   51,
+     1678,   51,   51,   51, 1671, 1670,   51,   51,   51,   51,
+     1672, 1674, 1680, 1679,   51,   51,   51, 1677,  284,   51,
+       51, 1683,   51,  283,   51,   51,   51, 1685,  282,  281,
+     1686,   51,   51,   51,  280, 1688,   51,   51, 1689,   51,
+     1700, 1687,  279,   51,   51, 1698, 1692,   51, 1690,   51,
+       51, 1691,   51,   51,   51,   51,   51, 1701, 1702, 1703,
+     1704,   51,   51,   51,   51,  278,   51,   51,   51,   51,
+       51, 1707,   51,   51,  275,   51,   51, 1717, 1708,   51,
 
-       51,   51, 1647,   51, 1648, 1649,   51,   51,   51,   51,
-     1660, 1661,   51,  183,   51,   51, 1651,   51,   51,  182,
-     1655,   51, 1659, 1662, 1663,   51, 1666, 1664,   51,   51,
-     1668,   51,   51, 1670,   51,   51, 1665,  181,   51,   51,
-       51,  180,   51,   51,   51,   51,   51,   51, 1669, 1673,
-     1671,  176,   51, 1672, 1677,  175,   51,   51, 1674,   51,
-       51,   51,   51, 1679,   51,   51,  174,   51, 1678,   51,
-       51,   51, 1680, 1683, 1684, 1686,   51,  173,  172,   51,
-       51, 1687,   51, 1690,   51,  171,  170,   51,   51,  169,
-       51,   51,   51,   51, 1691, 1692,   51,   51, 1694,   51,
+       51, 1709, 1721, 1711, 1713,   51,  263, 1715,   51, 1722,
+       51, 1720,   51,   51,  268,   51,   51, 1727,   51,   51,
+     1725, 1723, 1724, 1726,   51,   51,   51,   51, 1731,   51,
+      255, 1729,   51,   51,  254,   51,   51,   51,  253,   51,
+       51,   51, 1730,   51,  252, 1732,   51, 1734, 1739,   51,
+     1738, 1733,  251,   51,   51, 1735,   51,   51,   51,   51,
+     1740, 1741,   51,   51,   51,   51,   51,  250, 1744, 1745,
+       51,   51, 1747,  249,  248,   51,   51,  247,   51,   51,
+       51,   51,   51, 1748, 1751,   51,   51,  246,   51,   51,
+     1752, 1753, 1755,   51, 1758,   51, 1757, 1754,  243, 1762,
 
-       51, 1696, 1697, 1693,   51,  168, 1699,   51,   51,   51,
-       51,   51, 1698,   51,   51,   51,   51,   51,   51, 1701,
-     1700,   51, 1704,   51,   51,   51,  167,   51,   51, 1702,
-      166,   51,   51, 1706,  165,   51, 1707,  164,  163, 1708,
-       51,   51,   51,  162, 1711,  161,  160, 1713,  155, 1715,
-     1717, 1716,  146,  145,   51,  140, 1718, 1721, 1722, 1719,
-       55, 1720,   52,   43,   41, 1723, 1723, 1723, 1723, 1723,
-     1723,   51,   42, 1723,   42,   59, 1723,   59,   59,   59,
-       59,   59,   59,  147, 1723,  147,  154,  154,  154,  266,
-      266,  266,  275,  275,  275,  354,  354,  354,  357,  357,
+       51, 1759,   51,   51, 1760,   51,   51,   51,   51,   51,
+       51,   51,   51,  240,   51, 1761,   51,   51,   51, 1765,
+       51,   51,   51, 1763,   51,   51,   51,   51,   51,   51,
+     1766,   51,  237,   51, 1767,   51, 1775,   51,   51,   51,
+       51, 1768, 1769, 1772,   51,   51, 1778, 1774,   51, 1770,
+       51, 1776,   51,   51, 1777,  236,   51,   51,  235, 1779,
+       51,  234,   51, 1782, 1783,   51,  231,   51,  230,   51,
+       51,  229,  228,  227,  226, 1780,  225,   51,  224,  223,
+      222, 1781,   42,  221,   42,   59,  220,   59,   59,   59,
+       59,   59,   59,  147,  219,  147,  154,  154,  154,  267,
 
-      357,  358,  358,  358,  365,  365,  365,  363,  363,  363,
-      369,  369,  369,  373, 1723,  373,  438,  438,  438,  443,
-      443,  443,  444,  444,  444,  453,  453,  453,  457, 1723,
-      457,  458,  458,  458,  367,  367, 1723, 1723,  367,  462,
-      462,  462,  466,  466,  466,  357,  357,  357,  527,  527,
-      527,  531,  531,  531,  532,  532,  532,  533,  533,  533,
-      365,  365,  365,  538,  538,  538,  451,  451, 1723, 1723,
-      451,  543,  543,  543,  547,  547,  547,  551, 1723,  551,
-      552,  552,  552,  556,  556,  556,  560, 1723,  560,  619,
-      619,  619,  453,  453,  453,  627,  627,  627,  628,  628,
+      267,  267,  276,  276,  276,  356,  356,  356,  359,  359,
+      359,  360,  360,  360,  367,  367,  367,  365,  365,  365,
+      371,  371,  371,  375,  218,  375,  441,  441,  441,  446,
+      446,  446,  447,  447,  447,  456,  456,  456,  460,  217,
+      460,  461,  461,  461,  369,  369,  216,  212,  369,  465,
+      465,  465,  469,  469,  469,  359,  359,  359,  531,  531,
+      531,  535,  535,  535,  536,  536,  536,  537,  537,  537,
+      367,  367,  367,  542,  542,  542,  454,  454,  211,  201,
+      454,  547,  547,  547,  551,  551,  551,  555,  200,  555,
+      556,  556,  556,  560,  560,  560,  564,  199,  564,  627,
 
-      628,  636,  636,  636,  640, 1723,  640,  643, 1723,  643,
-      644,  644,  644,  648,  648,  648,  652, 1723,  652,  550,
-      550, 1723, 1723,  550,  554,  554, 1723, 1723,  554,  658,
-      658,  658,  662,  662,  662,  560,  560, 1723,  560,  532,
-      532,  532,  708,  708,  708,  712,  712,  712,  715,  715,
-      715,  716,  716,  716,  717,  717,  717,  722,  722,  722,
-      634,  634, 1723, 1723,  634,  727,  727,  727,  731,  731,
-      731,  640,  640, 1723,  640,  642,  642, 1723, 1723,  642,
-      643,  643, 1723,  643,  644,  644,  646,  646, 1723, 1723,
-      646,  738,  738,  738,  742,  742,  742,  652,  652, 1723,
+      627,  627,  456,  456,  456,  635,  635,  635,  636,  636,
+      636,  644,  644,  644,  648,  194,  648,  651,  189,  651,
+      652,  652,  652,  656,  656,  656,  660,  188,  660,  554,
+      554,  187,  186,  554,  558,  558,  185,  184,  558,  666,
+      666,  666,  670,  670,  670,  564,  564,  183,  564,  536,
+      536,  536,  719,  719,  719,  723,  723,  723,  726,  726,
+      726,  727,  727,  727,  728,  728,  728,  733,  733,  733,
+      642,  642,  182,  181,  642,  738,  738,  738,  742,  742,
+      742,  648,  648,  180,  648,  650,  650,  176,  175,  650,
+      651,  651,  174,  651,  652,  652,  654,  654,  173,  172,
 
-      652,  746, 1723,  746,  749, 1723,  749,  750,  750,  750,
-      754,  754,  754,  758, 1723,  758,  797,  797,  797,  636,
-      636,  636,  648,  648,  648,  808,  808,  808,  809,  809,
-      809,  817,  817,  817,  821, 1723,  821,  824, 1723,  824,
-      825,  825,  825,  829,  829,  829,  833, 1723,  833,  836,
-     1723,  836,  839, 1723,  839,  840,  840,  840,  844,  844,
-      844,  848, 1723,  848,  745, 1723, 1723,  745,  746,  746,
-     1723,  746,  748,  748, 1723, 1723,  748,  749,  749, 1723,
-      749,  750,  750,  752,  752, 1723, 1723,  752,  855,  855,
-      855,  859,  859,  859,  758,  758, 1723,  758,   49,   49,
+      654,  749,  749,  749,  753,  753,  753,  660,  660,  171,
+      660,  757,  170,  757,  760,  169,  760,  761,  761,  761,
+      765,  765,  765,  769,  168,  769,  812,  812,  812,  644,
+      644,  644,  656,  656,  656,  823,  823,  823,  824,  824,
+      824,  832,  832,  832,  836,  167,  836,  839,  166,  839,
+      840,  840,  840,  844,  844,  844,  848,  165,  848,  851,
+      164,  851,  854,  163,  854,  855,  855,  855,  859,  859,
+      859,  863,  162,  863,  756,  161,  160,  756,  757,  757,
+      155,  757,  759,  759,  146,  145,  759,  760,  760,  140,
+      760,  761,  761,  763,  763,   55,   52,  763,  870,  870,
 
-       49, 1723,   49,   49,  716,  716,  716,  891,  891,  891,
-      895,  895,  895,  898,  898,  898,  901,  901,  901,  902,
-      902,  902,  903,  903,  903,  908,  908,  908,  815,  815,
-     1723, 1723,  815,  913,  913,  913,  917,  917,  917,  821,
-      821, 1723,  821,  823,  823, 1723, 1723,  823,  824,  824,
-     1723,  824,  825,  825,  827,  827, 1723, 1723,  827,  924,
-      924,  924,  928,  928,  928,  833,  833, 1723,  833,  835,
-     1723, 1723,  835,  836,  836, 1723,  836,  838,  838, 1723,
-     1723,  838,  839,  839, 1723,  839,  840,  840,  842,  842,
-     1723, 1723,  842,  936,  936,  936,  940,  940,  940,  848,
+      870,  874,  874,  874,  769,  769,   43,  769,   49,   49,
+       49,   41,   49,   49,  727,  727,  727,  910,  910,  910,
+      914,  914,  914,  917,  917,  917,  920,  920,  920,  921,
+      921,  921,  922,  922,  922,  927,  927,  927,  830,  830,
+     1784, 1784,  830,  932,  932,  932,  936,  936,  936,  836,
+      836, 1784,  836,  838,  838, 1784, 1784,  838,  839,  839,
+     1784,  839,  840,  840,  842,  842, 1784, 1784,  842,  943,
+      943,  943,  947,  947,  947,  848,  848, 1784,  848,  850,
+     1784, 1784,  850,  851,  851, 1784,  851,  853,  853, 1784,
+     1784,  853,  854,  854, 1784,  854,  855,  855,  857,  857,
 
-      848, 1723,  848,  942, 1723,  942,  945, 1723,  945,  948,
-     1723,  948,  949,  949,  949,  953,  953,  953,  957, 1723,
-      957,   49,   49,   49, 1723,   49,   49,  985,  985,  985,
-      817,  817,  817,  829,  829,  829,  844,  844,  844,  999,
-      999,  999, 1000, 1000, 1000, 1008, 1008, 1008, 1012, 1723,
-     1012, 1015, 1723, 1015, 1016, 1016, 1016, 1020, 1020, 1020,
-     1024, 1723, 1024, 1027, 1723, 1027, 1030, 1723, 1030, 1031,
-     1031, 1031, 1035, 1035, 1035, 1039, 1723, 1039, 1040, 1723,
-     1040, 1043, 1723, 1043, 1046, 1723, 1046, 1047, 1047, 1047,
-     1051, 1051, 1051, 1055, 1723, 1055,  942, 1723,  942,  944,
+     1784, 1784,  857,  955,  955,  955,  959,  959,  959,  863,
+      863, 1784,  863,  961, 1784,  961,  964, 1784,  964,  967,
+     1784,  967,  968,  968,  968,  972,  972,  972,  976, 1784,
+      976,   49,   49,   49, 1784,   49,   49, 1008, 1008, 1008,
+      832,  832,  832,  844,  844,  844,  859,  859,  859, 1022,
+     1022, 1022, 1023, 1023, 1023, 1031, 1031, 1031, 1035, 1784,
+     1035, 1038, 1784, 1038, 1039, 1039, 1039, 1043, 1043, 1043,
+     1047, 1784, 1047, 1050, 1784, 1050, 1053, 1784, 1053, 1054,
+     1054, 1054, 1058, 1058, 1058, 1062, 1784, 1062, 1063, 1784,
+     1063, 1066, 1784, 1066, 1069, 1784, 1069, 1070, 1070, 1070,
 
-     1723, 1723,  944,  945,  945, 1723,  945,  947,  947, 1723,
-     1723,  947,  948,  948, 1723,  948,  949,  949,  951,  951,
-     1723, 1723,  951, 1062, 1062, 1062, 1066, 1066, 1066,  957,
-      957, 1723,  957,   49,   49,   49, 1723,   49,   49,  902,
-      902,  902, 1093, 1093, 1093, 1097, 1097, 1097, 1100, 1100,
-     1100, 1103, 1103, 1103, 1106, 1106, 1106, 1107, 1107, 1107,
-     1115, 1115, 1115, 1006, 1006, 1723, 1723, 1006, 1120, 1120,
-     1120, 1124, 1124, 1124, 1012, 1012, 1723, 1012, 1014, 1014,
-     1723, 1723, 1014, 1015, 1015, 1723, 1015, 1016, 1016, 1018,
-     1018, 1723, 1723, 1018, 1131, 1131, 1131, 1135, 1135, 1135,
+     1074, 1074, 1074, 1078, 1784, 1078,  961, 1784,  961,  963,
+     1784, 1784,  963,  964,  964, 1784,  964,  966,  966, 1784,
+     1784,  966,  967,  967, 1784,  967,  968,  968,  970,  970,
+     1784, 1784,  970, 1085, 1085, 1085, 1089, 1089, 1089,  976,
+      976, 1784,  976,   49,   49,   49, 1784,   49,   49,  921,
+      921,  921, 1120, 1120, 1120, 1124, 1124, 1124, 1127, 1127,
+     1127, 1130, 1130, 1130, 1133, 1133, 1133, 1134, 1134, 1134,
+     1142, 1142, 1142, 1029, 1029, 1784, 1784, 1029, 1147, 1147,
+     1147, 1151, 1151, 1151, 1035, 1035, 1784, 1035, 1037, 1037,
+     1784, 1784, 1037, 1038, 1038, 1784, 1038, 1039, 1039, 1041,
 
-     1024, 1024, 1723, 1024, 1026, 1723, 1723, 1026, 1027, 1027,
-     1723, 1027, 1029, 1029, 1723, 1723, 1029, 1030, 1030, 1723,
-     1030, 1031, 1031, 1033, 1033, 1723, 1723, 1033, 1143, 1143,
-     1143, 1147, 1147, 1147, 1039, 1039, 1723, 1039, 1040, 1723,
-     1040, 1042, 1723, 1723, 1042, 1043, 1043, 1723, 1043, 1045,
-     1045, 1723, 1723, 1045, 1046, 1046, 1723, 1046, 1047, 1047,
-     1049, 1049, 1723, 1723, 1049, 1155, 1155, 1155, 1159, 1159,
-     1159, 1055, 1055, 1723, 1055, 1161, 1723, 1161, 1164, 1723,
-     1164, 1167, 1723, 1167, 1168, 1168, 1168, 1172, 1172, 1172,
-     1176, 1723, 1176,   49,   49,   49, 1723,   49,   49, 1200,
+     1041, 1784, 1784, 1041, 1158, 1158, 1158, 1162, 1162, 1162,
+     1047, 1047, 1784, 1047, 1049, 1784, 1784, 1049, 1050, 1050,
+     1784, 1050, 1052, 1052, 1784, 1784, 1052, 1053, 1053, 1784,
+     1053, 1054, 1054, 1056, 1056, 1784, 1784, 1056, 1170, 1170,
+     1170, 1174, 1174, 1174, 1062, 1062, 1784, 1062, 1063, 1784,
+     1063, 1065, 1784, 1784, 1065, 1066, 1066, 1784, 1066, 1068,
+     1068, 1784, 1784, 1068, 1069, 1069, 1784, 1069, 1070, 1070,
+     1072, 1072, 1784, 1784, 1072, 1182, 1182, 1182, 1186, 1186,
+     1186, 1078, 1078, 1784, 1078, 1188, 1784, 1188, 1191, 1784,
+     1191, 1194, 1784, 1194, 1195, 1195, 1195, 1199, 1199, 1199,
 
-     1200, 1200, 1008, 1008, 1008, 1020, 1020, 1020, 1035, 1035,
-     1035, 1051, 1051, 1051, 1217, 1217, 1217, 1223, 1223, 1223,
-     1221, 1221, 1221, 1228, 1228, 1228, 1227, 1227, 1227, 1229,
-     1723, 1229, 1232, 1723, 1232, 1233, 1233, 1233, 1238, 1238,
-     1238, 1237, 1237, 1237, 1239, 1723, 1239, 1242, 1723, 1242,
-     1245, 1723, 1245, 1246, 1246, 1246, 1251, 1251, 1251, 1250,
-     1250, 1250, 1252, 1723, 1252, 1253, 1723, 1253, 1256, 1723,
-     1256, 1259, 1723, 1259, 1260, 1260, 1260, 1265, 1265, 1265,
-     1264, 1264, 1264, 1266, 1723, 1266, 1267, 1723, 1267, 1270,
-     1723, 1270, 1273, 1723, 1273, 1274, 1274, 1274, 1279, 1279,
+     1203, 1784, 1203,   49,   49,   49, 1784,   49,   49, 1231,
+     1231, 1231, 1031, 1031, 1031, 1043, 1043, 1043, 1058, 1058,
+     1058, 1074, 1074, 1074, 1248, 1248, 1248, 1254, 1254, 1254,
+     1252, 1252, 1252, 1259, 1259, 1259, 1258, 1258, 1258, 1260,
+     1784, 1260, 1263, 1784, 1263, 1264, 1264, 1264, 1269, 1269,
+     1269, 1268, 1268, 1268, 1270, 1784, 1270, 1273, 1784, 1273,
+     1276, 1784, 1276, 1277, 1277, 1277, 1282, 1282, 1282, 1281,
+     1281, 1281, 1283, 1784, 1283, 1284, 1784, 1284, 1287, 1784,
+     1287, 1290, 1784, 1290, 1291, 1291, 1291, 1296, 1296, 1296,
+     1295, 1295, 1295, 1297, 1784, 1297, 1298, 1784, 1298, 1301,
 
-     1279, 1278, 1278, 1278, 1280, 1723, 1280, 1161, 1723, 1161,
-     1163, 1723, 1723, 1163, 1164, 1164, 1723, 1164, 1166, 1166,
-     1723, 1723, 1166, 1167, 1167, 1723, 1167, 1168, 1168, 1170,
-     1170, 1723, 1723, 1170, 1287, 1287, 1287, 1291, 1291, 1291,
-     1176, 1176, 1723, 1176,   49,   49,   49, 1723,   49,   49,
-     1107, 1107, 1107, 1319, 1319, 1319, 1322, 1322, 1322, 1325,
-     1325, 1325, 1328, 1328, 1328, 1331, 1331, 1331, 1336, 1336,
-     1336, 1335, 1335, 1335, 1338, 1723, 1338, 1339, 1339, 1339,
-     1225, 1225, 1723, 1723, 1225, 1343, 1343, 1343, 1344, 1344,
-     1344, 1229, 1229, 1723, 1229, 1231, 1231, 1723, 1723, 1231,
+     1784, 1301, 1304, 1784, 1304, 1305, 1305, 1305, 1310, 1310,
+     1310, 1309, 1309, 1309, 1311, 1784, 1311, 1188, 1784, 1188,
+     1190, 1784, 1784, 1190, 1191, 1191, 1784, 1191, 1193, 1193,
+     1784, 1784, 1193, 1194, 1194, 1784, 1194, 1195, 1195, 1197,
+     1197, 1784, 1784, 1197, 1318, 1318, 1318, 1322, 1322, 1322,
+     1203, 1203, 1784, 1203,   49,   49,   49, 1784,   49,   49,
+     1134, 1134, 1134, 1354, 1354, 1354, 1357, 1357, 1357, 1360,
+     1360, 1360, 1363, 1363, 1363, 1366, 1366, 1366, 1371, 1371,
+     1371, 1370, 1370, 1370, 1373, 1784, 1373, 1374, 1374, 1374,
+     1256, 1256, 1784, 1784, 1256, 1378, 1378, 1378, 1379, 1379,
 
-     1232, 1232, 1723, 1232, 1233, 1233, 1235, 1235, 1723, 1723,
-     1235, 1350, 1350, 1350, 1351, 1351, 1351, 1239, 1239, 1723,
-     1239, 1241, 1723, 1723, 1241, 1242, 1242, 1723, 1242, 1244,
-     1244, 1723, 1723, 1244, 1245, 1245, 1723, 1245, 1246, 1246,
-     1248, 1248, 1723, 1723, 1248, 1358, 1358, 1358, 1359, 1359,
-     1359, 1252, 1252, 1723, 1252, 1253, 1723, 1253, 1255, 1723,
-     1723, 1255, 1256, 1256, 1723, 1256, 1258, 1258, 1723, 1723,
-     1258, 1259, 1259, 1723, 1259, 1260, 1260, 1262, 1262, 1723,
-     1723, 1262, 1366, 1366, 1366, 1367, 1367, 1367, 1266, 1266,
-     1723, 1266, 1267, 1723, 1267, 1269, 1723, 1723, 1269, 1270,
+     1379, 1260, 1260, 1784, 1260, 1262, 1262, 1784, 1784, 1262,
+     1263, 1263, 1784, 1263, 1264, 1264, 1266, 1266, 1784, 1784,
+     1266, 1385, 1385, 1385, 1386, 1386, 1386, 1270, 1270, 1784,
+     1270, 1272, 1784, 1784, 1272, 1273, 1273, 1784, 1273, 1275,
+     1275, 1784, 1784, 1275, 1276, 1276, 1784, 1276, 1277, 1277,
+     1279, 1279, 1784, 1784, 1279, 1393, 1393, 1393, 1394, 1394,
+     1394, 1283, 1283, 1784, 1283, 1284, 1784, 1284, 1286, 1784,
+     1784, 1286, 1287, 1287, 1784, 1287, 1289, 1289, 1784, 1784,
+     1289, 1290, 1290, 1784, 1290, 1291, 1291, 1293, 1293, 1784,
+     1784, 1293, 1401, 1401, 1401, 1402, 1402, 1402, 1297, 1297,
 
-     1270, 1723, 1270, 1272, 1272, 1723, 1723, 1272, 1273, 1273,
-     1723, 1273, 1274, 1274, 1276, 1276, 1723, 1723, 1276, 1374,
-     1374, 1374, 1375, 1375, 1375, 1280, 1280, 1723, 1280, 1376,
-     1723, 1376, 1379, 1723, 1379, 1382, 1723, 1382, 1383, 1383,
-     1383, 1388, 1723, 1388, 1387, 1387, 1387, 1389, 1723, 1389,
-       49,   49,   49, 1723,   49,   49, 1410, 1723, 1410, 1409,
-     1409, 1409, 1411, 1723, 1411, 1227, 1227, 1227, 1412, 1723,
-     1412, 1237, 1237, 1237, 1413, 1723, 1413, 1250, 1250, 1250,
-     1414, 1723, 1414, 1264, 1264, 1264, 1415, 1723, 1415, 1278,
-     1278, 1278, 1333, 1333, 1723, 1723, 1333, 1419, 1419, 1419,
+     1784, 1297, 1298, 1784, 1298, 1300, 1784, 1784, 1300, 1301,
+     1301, 1784, 1301, 1303, 1303, 1784, 1784, 1303, 1304, 1304,
+     1784, 1304, 1305, 1305, 1307, 1307, 1784, 1784, 1307, 1409,
+     1409, 1409, 1410, 1410, 1410, 1311, 1311, 1784, 1311, 1411,
+     1784, 1411, 1414, 1784, 1414, 1417, 1784, 1417, 1418, 1418,
+     1418, 1423, 1784, 1423, 1422, 1422, 1422, 1424, 1784, 1424,
+       49,   49,   49, 1784,   49,   49, 1449, 1784, 1449, 1448,
+     1448, 1448, 1450, 1784, 1450, 1258, 1258, 1258, 1451, 1784,
+     1451, 1268, 1268, 1268, 1452, 1784, 1452, 1281, 1281, 1281,
+     1453, 1784, 1453, 1295, 1295, 1295, 1454, 1784, 1454, 1309,
 
-     1420, 1420, 1420,  365,  365,  365, 1338, 1338, 1723, 1338,
-     1421, 1421, 1421, 1424, 1723, 1424, 1425, 1425, 1425, 1426,
-     1426, 1426, 1429, 1723, 1429, 1432, 1723, 1432, 1433, 1433,
-     1433, 1434, 1434, 1434, 1435, 1723, 1435, 1438, 1723, 1438,
-     1441, 1723, 1441, 1442, 1442, 1442, 1443, 1443, 1443, 1444,
-     1723, 1444, 1447, 1723, 1447, 1450, 1723, 1450, 1451, 1451,
-     1451, 1452, 1452, 1452, 1453, 1723, 1453, 1456, 1723, 1456,
-     1459, 1723, 1459, 1460, 1460, 1460, 1461, 1461, 1461, 1376,
-     1723, 1376, 1378, 1723, 1723, 1378, 1379, 1379, 1723, 1379,
-     1381, 1381, 1723, 1723, 1381, 1382, 1382, 1723, 1382, 1383,
+     1309, 1309, 1368, 1368, 1784, 1784, 1368, 1458, 1458, 1458,
+     1459, 1459, 1459,  367,  367,  367, 1373, 1373, 1784, 1373,
+     1460, 1460, 1460, 1463, 1784, 1463, 1464, 1464, 1464, 1465,
+     1465, 1465, 1468, 1784, 1468, 1471, 1784, 1471, 1472, 1472,
+     1472, 1473, 1473, 1473, 1474, 1784, 1474, 1477, 1784, 1477,
+     1480, 1784, 1480, 1481, 1481, 1481, 1482, 1482, 1482, 1483,
+     1784, 1483, 1486, 1784, 1486, 1489, 1784, 1489, 1490, 1490,
+     1490, 1491, 1491, 1491, 1492, 1784, 1492, 1495, 1784, 1495,
+     1498, 1784, 1498, 1499, 1499, 1499, 1500, 1500, 1500, 1411,
+     1784, 1411, 1413, 1784, 1784, 1413, 1414, 1414, 1784, 1414,
 
-     1383, 1385, 1385, 1723, 1723, 1385, 1468, 1468, 1468, 1469,
-     1723, 1469, 1389, 1389, 1723, 1389,   49,   49,   49, 1723,
-       49,   49, 1487, 1487, 1487, 1335, 1335, 1335, 1489, 1723,
-     1489, 1490, 1723, 1490, 1491, 1723, 1491, 1492, 1723, 1492,
-     1493, 1723, 1493, 1494, 1723, 1494, 1497, 1723, 1497, 1498,
-     1498, 1498, 1499, 1499, 1499, 1500, 1723, 1500, 1423, 1423,
-     1723, 1723, 1423, 1424, 1424, 1723, 1424, 1425, 1425, 1503,
-     1723, 1503, 1428, 1723, 1723, 1428, 1429, 1429, 1723, 1429,
-     1431, 1431, 1723, 1723, 1431, 1432, 1432, 1723, 1432, 1433,
-     1433, 1507, 1723, 1507, 1435, 1723, 1435, 1437, 1723, 1723,
+     1416, 1416, 1784, 1784, 1416, 1417, 1417, 1784, 1417, 1418,
+     1418, 1420, 1420, 1784, 1784, 1420, 1507, 1507, 1507, 1508,
+     1784, 1508, 1424, 1424, 1784, 1424,   49,   49,   49, 1784,
+       49,   49, 1530, 1530, 1530, 1370, 1370, 1370, 1532, 1784,
+     1532, 1533, 1784, 1533, 1534, 1784, 1534, 1535, 1784, 1535,
+     1536, 1784, 1536, 1537, 1784, 1537, 1540, 1784, 1540, 1541,
+     1541, 1541, 1542, 1542, 1542, 1543, 1784, 1543, 1462, 1462,
+     1784, 1784, 1462, 1463, 1463, 1784, 1463, 1464, 1464, 1546,
+     1784, 1546, 1467, 1784, 1784, 1467, 1468, 1468, 1784, 1468,
+     1470, 1470, 1784, 1784, 1470, 1471, 1471, 1784, 1471, 1472,
 
-     1437, 1438, 1438, 1723, 1438, 1440, 1440, 1723, 1723, 1440,
-     1441, 1441, 1723, 1441, 1442, 1442, 1511, 1723, 1511, 1444,
-     1723, 1444, 1446, 1723, 1723, 1446, 1447, 1447, 1723, 1447,
-     1449, 1449, 1723, 1723, 1449, 1450, 1450, 1723, 1450, 1451,
-     1451, 1515, 1723, 1515, 1453, 1723, 1453, 1455, 1723, 1723,
-     1455, 1456, 1456, 1723, 1456, 1458, 1458, 1723, 1723, 1458,
-     1459, 1459, 1723, 1459, 1460, 1460, 1519, 1723, 1519, 1520,
-     1723, 1520, 1523, 1723, 1523, 1526, 1723, 1526, 1527, 1527,
-     1527, 1528, 1723, 1528,   49,   49,   49, 1723,   49,   49,
-     1545, 1723, 1545, 1421, 1723, 1421, 1426, 1723, 1426, 1434,
+     1472, 1550, 1784, 1550, 1474, 1784, 1474, 1476, 1784, 1784,
+     1476, 1477, 1477, 1784, 1477, 1479, 1479, 1784, 1784, 1479,
+     1480, 1480, 1784, 1480, 1481, 1481, 1554, 1784, 1554, 1483,
+     1784, 1483, 1485, 1784, 1784, 1485, 1486, 1486, 1784, 1486,
+     1488, 1488, 1784, 1784, 1488, 1489, 1489, 1784, 1489, 1490,
+     1490, 1558, 1784, 1558, 1492, 1784, 1492, 1494, 1784, 1784,
+     1494, 1495, 1495, 1784, 1495, 1497, 1497, 1784, 1784, 1497,
+     1498, 1498, 1784, 1498, 1499, 1499, 1562, 1784, 1562, 1563,
+     1784, 1563, 1566, 1784, 1566, 1569, 1784, 1569, 1570, 1570,
+     1570, 1571, 1784, 1571,   49,   49,   49, 1784,   49,   49,
 
-     1723, 1434, 1443, 1723, 1443, 1452, 1723, 1452, 1461, 1723,
-     1461, 1496, 1496, 1723, 1723, 1496, 1497, 1497, 1723, 1497,
-     1498, 1498, 1488, 1723, 1488, 1550, 1723, 1550, 1551, 1723,
-     1551, 1554, 1723, 1554, 1555, 1723, 1555, 1558, 1723, 1558,
-     1559, 1723, 1559, 1562, 1723, 1562, 1563, 1723, 1563, 1566,
-     1723, 1566, 1522, 1723, 1723, 1522, 1525, 1525, 1723, 1723,
-     1525, 1570, 1723, 1570, 1499, 1723, 1499, 1586, 1723, 1586,
-     1549, 1723, 1723, 1549, 1553, 1723, 1723, 1553, 1557, 1723,
-     1723, 1557, 1561, 1723, 1723, 1561, 1565, 1723, 1723, 1565,
-     1592, 1723, 1592, 1595, 1723, 1595, 1585, 1723, 1723, 1585,
+     1592, 1784, 1592, 1460, 1784, 1460, 1465, 1784, 1465, 1473,
+     1784, 1473, 1482, 1784, 1482, 1491, 1784, 1491, 1500, 1784,
+     1500, 1539, 1539, 1784, 1784, 1539, 1540, 1540, 1784, 1540,
+     1541, 1541, 1531, 1784, 1531, 1597, 1784, 1597, 1598, 1784,
+     1598, 1601, 1784, 1601, 1602, 1784, 1602, 1605, 1784, 1605,
+     1606, 1784, 1606, 1609, 1784, 1609, 1610, 1784, 1610, 1613,
+     1784, 1613, 1565, 1784, 1784, 1565, 1568, 1568, 1784, 1784,
+     1568, 1617, 1784, 1617, 1542, 1784, 1542, 1637, 1784, 1637,
+     1596, 1784, 1784, 1596, 1600, 1784, 1784, 1600, 1604, 1784,
+     1784, 1604, 1608, 1784, 1784, 1608, 1612, 1784, 1784, 1612,
 
-     1609, 1723, 1609, 1610, 1723, 1610, 1611, 1723, 1611, 1612,
-     1723, 1612, 1613, 1723, 1613, 1594, 1723, 1723, 1594, 1626,
-     1723, 1626, 1627, 1723, 1627,    3, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723
+     1643, 1784, 1643, 1646, 1784, 1646, 1636, 1784, 1784, 1636,
+     1662, 1784, 1662, 1663, 1784, 1663, 1664, 1784, 1664, 1665,
+     1784, 1665, 1666, 1784, 1666, 1645, 1784, 1784, 1645, 1681,
+     1784, 1681, 1682, 1784, 1682,    3, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784
     } ;
 
-static const flex_int16_t yy_chk[7679] =
+static const flex_int16_t yy_chk[7789] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -2176,844 +2215,856 @@
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,   11,   11,   11,   11,   11,   11,   11,   11,
-       11,   11,   14,   14,  674,   11,   11,   11,  674,   11,
+       11,   11,   14,   14,   92,   11,   11,   11,   92,   11,
        11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
        11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
        11,   11,   11,   11,   12,   16,   16,   20,   23,   20,
 
-       20,   31,   23,  408,   20,   24,   24,   25,   23,   20,
-       31,   23,   25,   20,   21,   20,   90,  408,   90,   12,
+       20,   31,   23,  411,   20,   24,   24,   25,   23,   20,
+       31,   23,   25,   20,   21,   20,   90,  411,   90,   12,
        17,   17,   17,   17,   17,   17,   17,   17,   21,   22,
-       89, 1270,   26,   89,   17,   21,   26,   34,  101,   22,
+       89, 1287,   26,   89,   17,   21,   26,   34,  101,   22,
        97,   34,   22,   27,  101,   27,   22,   93,   26,   34,
-       27,   27,   93,   27,   34, 1273,   34,   27,  129,   17,
+       27,   27,   93,   27,   34, 1290,   34,   27,  129,   17,
        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
-       29,   29,   97,   18, 1274,   36,  129,   36,   18,   18,
-       18,   18,   18,   18,   28,   29, 1278,   28,   28,   29,
+       29,   29,   97,   18, 1291,   36,  129,   36,   18,   18,
+       18,   18,   18,   18,   28,   29, 1295,   28,   28,   29,
        28,   36,   28,   29,   28,   29,   28,   30,   36,   28,
 
        33,   30,   29,   32,  150,   33,   33,  102,   33,   33,
        30,   30,  102,   38,   30,   32,   30,   32,   35,   32,
        98,   38,   32,  133,   35,   38,   35,   38,   35,  150,
-      124,  217,   35,  133,   35,   35,   44,   44,   44,   44,
-       44,   44,   44,  124,  217,  105,   98,   44,  105,  247,
+      124,  218,   35,  133,   35,   35,   44,   44,   44,   44,
+       44,   44,   44,  124,  218,  105,   98,   44,  105,  248,
       105,   98,   44,   44,   44,   44,   44,   44,   45,   45,
-       45,   45,   45,   45,   45,  158,  246,  581,  246,   45,
-      262,  262,  247,  581,   45,   45,   45,   45,   45,   45,
-       46,   46,   46,   46,   46,   46,   46,   46,  668,  334,
-      158,  668,   46,   78,  334,  269,  346,   46,   46,   46,
+       45,   45,   45,   45,   45,  158,  247,  586,  247,   45,
+      263,  263,  248,  586,   45,   45,   45,   45,   45,   45,
+       46,   46,   46,   46,   46,   46,   46,   46,  676,  336,
+      158,  676,   46,   78,  336,  270,  348,   46,   46,   46,
 
        46,   46,   46,   48,   48,   48,   48,   48,   48,   48,
-       48,   50,   50,   50,   50,   50,   50,   50,  371,   78,
-      269,  346,   50,  432,  432,   78, 1279,   50,   50,   50,
+       48,   50,   50,   50,   50,   50,   50,   50,  373,   78,
+      270,  348,   50,  435,  435,   78, 1296,   50,   50,   50,
        50,   50,   50,   52,   52,   52,   52,   52,   52,   52,
-      614,  614,  667,  371,   52,  665,  665,  667,  434,   52,
+      622,  622,  675,  373,   52,  673,  673,  675,  437,   52,
        52,   52,   52,   52,   52,   58,   58,   58,   58,   58,
-       58,   58,  131,  261,  261,  261,  261,  261,  261,  261,
-      350,  131,  148,  434,  148,  148,  148,  148,  148,  148,
-      148,  441,  447, 1280,  350,  148,  279,  279,  279,  279,
+       58,   58,  131,  262,  262,  262,  262,  262,  262,  262,
+      352,  131,  148,  437,  148,  148,  148,  148,  148,  148,
+      148,  444,  450, 1297,  352,  148,  280,  280,  280,  280,
       148,  148,  148,  148,  148,  148,  149,  149,  149,  149,
 
-      149,  149,  149,  149,  461,  279,  441,  447,  149,  350,
-      149, 1287,  461,  149,  149,  149,  149,  149,  149,  272,
-      272,  272,  272,  272,  272,  272,  356,  356,  356,  356,
-      356,  356,  356,  366,  681,  149,  151,  151,  151,  151,
-      151,  151,  151,  151,  455,  518,  666,  366,  151,  558,
-      622,  681,  666,  151,  151,  151,  151,  151,  151,  152,
-      152,  152,  152,  152,  152,  152,  152,  152, 1291,  455,
-      518,  152,  366,  625,  558,  622,  152,  152,  152,  152,
+      149,  149,  149,  149,  464,  280,  444,  450,  149,  352,
+      149, 1301,  464,  149,  149,  149,  149,  149,  149,  273,
+      273,  273,  273,  273,  273,  273,  358,  358,  358,  358,
+      358,  358,  358,  368,  690,  149,  151,  151,  151,  151,
+      151,  151,  151,  151,  458,  522,  674,  368,  151,  562,
+      630,  690,  674,  151,  151,  151,  151,  151,  151,  152,
+      152,  152,  152,  152,  152,  152,  152,  152, 1304,  458,
+      522,  152,  368,  633,  562,  630,  152,  152,  152,  152,
       152,  152,  153,  153,  153,  153,  153,  153,  153,  153,
-      155,  155,  155,  155,  155,  155,  155,  155,  625,  686,
+      155,  155,  155,  155,  155,  155,  155,  155,  633,  686,
 
-      686,  155,  561,  561,  561,  561,  155,  155,  155,  155,
+      686,  155,  565,  565,  565,  565,  155,  155,  155,  155,
       155,  155,  157,  157,  157,  157,  157,  157,  157,  157,
-      157,  367,  631, 1316,  157,  392,  157,  759,  304,  157,
-      157,  157,  157,  157,  157,  367,  304,  360,  360,  360,
-      360,  360,  360,  360,  759,  392,  405,  631,  304,  670,
-     1319,  157,  255,  255,  255,  255,  255,  255,  255,  405,
-      367,  392,  638,  255,  304,  675, 1322,  670,  255,  255,
-      255,  255,  255,  255,  257,  257,  257,  257,  257,  257,
-      257,  542,  673,  675,  673,  257, 1325,  638,  650,  542,
-      257,  257,  257,  257,  257,  257,  258,  258,  258,  258,
+      157,  369,  639,  682,  157,  394,  157,  682,  305,  157,
+      157,  157,  157,  157,  157,  369,  305,  362,  362,  362,
+      362,  362,  362,  362, 1305,  394,  408,  639,  305,  678,
+     1309,  157,  256,  256,  256,  256,  256,  256,  256,  408,
+      369,  394,  646,  256,  305,  683, 1310,  678,  256,  256,
+      256,  256,  256,  256,  258,  258,  258,  258,  258,  258,
+      258,  546,  681,  683,  681,  258, 1311,  646,  658,  546,
+      258,  258,  258,  258,  258,  258,  259,  259,  259,  259,
 
-      258,  258,  258,  258,  260,  260,  260,  260,  260,  260,
-      260,  552,  677,  650,  677,  260,  696,  696, 1328,  552,
-      260,  260,  260,  260,  260,  260,  263,  263,  263,  263,
-      263,  263,  263,  263,  657,  705, 1331, 1335,  263, 1336,
-     1337,  703,  657,  263,  263,  263,  263,  263,  263,  265,
-      265,  265,  265,  265,  265,  265,  265,  268,  268,  268,
-      268,  268,  268,  268,  268,  268,  703, 1338, 1339,  268,
-      705,  268,  761,  450,  268,  268,  268,  268,  268,  268,
-      431,  431,  431,  431,  431,  431,  431,  450,  679,  761,
-     1343, 1344,  676,  451,  522,  679,  268,  273,  273,  273,
+      259,  259,  259,  259,  261,  261,  261,  261,  261,  261,
+      261,  556,  685,  658,  685,  261,  696,  696, 1318,  556,
+      261,  261,  261,  261,  261,  261,  264,  264,  264,  264,
+      264,  264,  264,  264,  665,  707,  707,  716,  264, 1322,
+     1351,  714,  665,  264,  264,  264,  264,  264,  264,  266,
+      266,  266,  266,  266,  266,  266,  266,  269,  269,  269,
+      269,  269,  269,  269,  269,  269,  714, 1354, 1357,  269,
+     1360,  269,  716,  453,  269,  269,  269,  269,  269,  269,
+      434,  434,  434,  434,  434,  434,  434,  453,  688, 1363,
+     1366, 1370,  684,  454,  526,  688,  269,  274,  274,  274,
 
-      273,  273,  273,  273,  273,  273,  676,  451,  522,  273,
-     1350,  771,  450,  680,  273,  273,  273,  273,  273,  273,
-      274,  274,  274,  274,  274,  274,  274,  680,  771,  771,
-      744,  274,  451,  522,  481,  671,  274,  274,  274,  274,
-      274,  274,  339,  481,  339,  671,  339,  339,  459,  459,
-      459,  459,  459,  459,  459,  744,  339,  549,  339,  339,
-      550,  339,  344,  483,  344,  344,  344,  344,  344,  344,
-      344,  549,  483, 1351,  550,  344,  756, 1358,  782, 1359,
-      344,  344,  344,  344,  344,  344,  345,  345,  345,  345,
-      345,  345,  345,  345,  682,  782,  549, 1366,  345,  550,
+      274,  274,  274,  274,  274,  274,  684,  454,  526,  274,
+     1371,  770,  453,  689,  274,  274,  274,  274,  274,  274,
+      275,  275,  275,  275,  275,  275,  275,  689,  770, 1372,
+      755,  275,  454,  526,  484,  679,  275,  275,  275,  275,
+      275,  275,  341,  484,  341,  679,  341,  341,  462,  462,
+      462,  462,  462,  462,  462,  755,  341,  553,  341,  341,
+      554,  341,  346,  486,  346,  346,  346,  346,  346,  346,
+      346,  553,  486, 1373,  554,  346,  767, 1374,  772, 1378,
+      346,  346,  346,  346,  346,  346,  347,  347,  347,  347,
+      347,  347,  347,  347,  691,  772,  553, 1379,  347,  554,
 
-      345,  756,  682,  345,  345,  345,  345,  345,  345,  463,
-      463,  463,  463,  463,  463,  463,  535,  535,  535,  535,
-      535,  535,  535,  553,  678,  345,  347,  347,  347,  347,
-      347,  347,  347,  347,  800,  678, 1367,  553,  347, 1374,
-      783,  768,  554,  347,  347,  347,  347,  347,  347,  351,
-      351,  351,  351,  351,  351,  351,  554,  783,  768,  800,
-      351,  768,  553,  760,  684,  351,  351,  351,  351,  351,
-      351,  352,  352,  352,  352,  352,  352,  352,  352,  684,
-      760,  554, 1375,  352,  803,  806,  812,  760,  352,  352,
-      352,  352,  352,  352,  353,  353,  353,  353,  353,  353,
+      347,  767,  691,  347,  347,  347,  347,  347,  347,  466,
+      466,  466,  466,  466,  466,  466,  539,  539,  539,  539,
+      539,  539,  539,  557,  687,  347,  349,  349,  349,  349,
+      349,  349,  349,  349,  697,  687,  815,  557,  349, 1385,
+      782,  697,  558,  349,  349,  349,  349,  349,  349,  353,
+      353,  353,  353,  353,  353,  353,  558,  782,  782,  818,
+      353,  815,  557,  771,  693,  353,  353,  353,  353,  353,
+      353,  354,  354,  354,  354,  354,  354,  354,  354,  693,
+      771,  558, 1386,  354,  818,  821,  827,  771,  354,  354,
+      354,  354,  354,  354,  355,  355,  355,  355,  355,  355,
 
-      353,  353,  355,  355,  355,  355,  355,  355,  355,  803,
-      806,  812,  819,  355, 1379, 1382,  767,  685,  355,  355,
-      355,  355,  355,  355,  359,  359,  359,  359,  359,  359,
-      359,  359,  685,  767, 1383,  359, 1387,  819,  767,  769,
-      359,  359,  359,  359,  359,  359,  361,  361,  361,  361,
-      361,  361,  361,  361,  361, 1389,  769, 1408,  361,  769,
-      774,  784,  779,  361,  361,  361,  361,  361,  361,  362,
-      362,  362,  362,  362,  362,  362,  362,  774,  784,  779,
-      362,  784,  774,  778,  779,  362,  362,  362,  362,  362,
-      362,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      355,  355,  357,  357,  357,  357,  357,  357,  357,  834,
+      821,  827,  846,  357, 1393, 1394,  778,  695,  357,  357,
+      357,  357,  357,  357,  361,  361,  361,  361,  361,  361,
+      361,  361,  695,  778,  834,  361, 1401,  846,  778,  779,
+      361,  361,  361,  361,  361,  361,  363,  363,  363,  363,
+      363,  363,  363,  363,  363, 1402,  779, 1409,  363,  779,
+      786,  780,  791,  363,  363,  363,  363,  363,  363,  364,
+      364,  364,  364,  364,  364,  364,  364,  786,  780,  791,
+      364,  780,  786,  790,  791,  364,  364,  364,  364,  364,
+      364,  370,  370,  370,  370,  370,  370,  370,  370,  370,
 
-      778, 1409,  831,  368, 1419, 1420,  785,  778,  368,  368,
-      368,  368,  368,  368,  370,  370,  370,  370,  370,  370,
-      370,  370,  370,  785, 1424, 1425,  370,  831,  370,  582,
-      687,  370,  370,  370,  370,  370,  370,  485,  582,  485,
-      583,  633,  485,  485,  687,  634,  485,  485,  669,  583,
-      683,  485,  695,  370,  391,  633, 1429,  669,  391,  634,
-      683,  391,  695,  641,  391,  642,  391,  391,  391,  391,
-      425,  425,  425,  425,  425,  425,  425,  641, 1432,  642,
-      633,  425,  834,  786,  634,  688,  425,  425,  425,  425,
-      425,  425,  427,  427,  427,  427,  427,  427,  427,  688,
+      790, 1410,  849,  370,  861,  906,  793,  790,  370,  370,
+      370,  370,  370,  370,  372,  372,  372,  372,  372,  372,
+      372,  372,  372,  793,  793, 1414,  372,  849,  372,  861,
+      906,  372,  372,  372,  372,  372,  372,  544,  544,  544,
+      544,  544,  544,  544,  548,  548,  548,  548,  548,  548,
+      548,  587,  692,  372,  393,  962,  589,  974,  393, 1011,
+      587,  393,  692,  641,  393,  589,  393,  393,  393,  393,
+      428,  428,  428,  428,  428,  428,  428,  641, 1417, 1014,
+      962,  428,  974,  796, 1011,  694,  428,  428,  428,  428,
+      428,  428,  430,  430,  430,  430,  430,  430,  430,  694,
 
-      786, 1433,  641,  427,  642,  846,  887,  834,  427,  427,
-      427,  427,  427,  427,  428,  428,  428,  428,  428,  428,
-      428,  428,  430,  430,  430,  430,  430,  430,  430,  726,
-      846,  887,  943,  430,  955, 1438,  790,  726,  430,  430,
-      430,  430,  430,  430,  433,  433,  433,  433,  433,  433,
-      433,  433,  737,  790, 1441, 1442,  433,  943,  433,  955,
-      737,  433,  433,  433,  433,  433,  433,  540,  540,  540,
-      540,  540,  540,  540,  544,  544,  544,  544,  544,  544,
-      544,  762,  645,  433,  435,  435,  435,  435,  435,  435,
-      435,  988, 1447,  991,  994,  435,  645,  861,  762,  691,
+      796,  694,  641,  430, 1014,  796, 1017, 1020,  430,  430,
+      430,  430,  430,  430,  431,  431,  431,  431,  431,  431,
+      431,  431,  433,  433,  433,  433,  433,  433,  433,  737,
+     1418, 1017, 1020,  433, 1422,  797, 1424,  737,  433,  433,
+      433,  433,  433,  433,  436,  436,  436,  436,  436,  436,
+      436,  436,  797,  642,  649,  650,  436,  653,  436,  654,
+      706,  436,  436,  436,  436,  436,  436,  642,  649,  650,
+      706,  653,  677,  654,  661,  661,  661,  661,  661,  661,
+      661,  677, 1447,  436,  438,  438,  438,  438,  438,  438,
+      438, 1026,  642,  649,  650,  438,  653,  798,  654,  698,
 
-      435,  435,  435,  435,  435,  435,  436,  436,  436,  436,
-      436,  436,  436,  691,  861,  762,  988,  436,  991,  994,
-     1450,  645,  436,  436,  436,  436,  436,  436,  437,  437,
-      437,  437,  437,  437,  437,  437,  440,  440,  440,  440,
-      440,  440,  440,  440,  440,  694,  646, 1451,  440, 1456,
-      440, 1459, 1460,  440,  440,  440,  440,  440,  440,  694,
-      646,  653,  653,  653,  653,  653,  653,  653,  655,  655,
-      655,  655,  655,  655,  655,  440,  446,  446,  446,  446,
-      446,  446,  446,  446,  446,  646, 1468, 1497,  446, 1498,
-      446, 1523, 1526,  446,  446,  446,  446,  446,  446,  659,
+      438,  438,  438,  438,  438,  438,  439,  439,  439,  439,
+      439,  439,  439,  698,  798, 1448, 1026,  439, 1458, 1459,
+     1033, 1045,  439,  439,  439,  439,  439,  439,  440,  440,
+      440,  440,  440,  440,  440,  440,  443,  443,  443,  443,
+      443,  443,  443,  443,  443, 1033, 1045, 1463,  443, 1464,
+      443, 1468, 1471,  443,  443,  443,  443,  443,  443,  663,
+      663,  663,  663,  663,  663,  663,  667,  667,  667,  667,
+      667,  667,  667,  699,  800,  443,  449,  449,  449,  449,
+      449,  449,  449,  449,  449,  702,  705,  699,  449, 1472,
+      449,  800, 1477,  449,  449,  449,  449,  449,  449,  702,
 
-      659,  659,  659,  659,  659,  659,  719,  719,  719,  719,
-      719,  719,  719,  747,  763,  446,  452,  452,  452,  452,
-      452,  452,  452,  452,  452,  997, 1550,  747,  452, 1554,
-     1003,  763,  862,  452,  452,  452,  452,  452,  452,  454,
-      454,  454,  454,  454,  454,  454,  454,  454,  763,  862,
-      997,  454,  747,  454,  862, 1003,  454,  454,  454,  454,
-      454,  454,  724,  724,  724,  724,  724,  724,  724,  728,
-      728,  728,  728,  728,  728,  728,  748,  764,  454,  464,
-      464,  464,  464,  464,  464,  464,  464,  464, 1558, 1010,
-      748,  464, 1562,  883,  764,  751,  464,  464,  464,  464,
+      705,  730,  730,  730,  730,  730,  730,  730,  735,  735,
+      735,  735,  735,  735,  735,  449,  455,  455,  455,  455,
+      455,  455,  455,  455,  455, 1048, 1480, 1481,  455, 1060,
+     1064,  801,  799,  455,  455,  455,  455,  455,  455,  457,
+      457,  457,  457,  457,  457,  457,  457,  457,  801,  799,
+     1048,  457,  799,  457, 1060, 1064,  457,  457,  457,  457,
+      457,  457,  739,  739,  739,  739,  739,  739,  739,  744,
+      744,  744,  744,  744,  744,  744,  758,  773,  457,  467,
+      467,  467,  467,  467,  467,  467,  467,  467, 1486, 1489,
+      758,  467, 1490,  774,  773,  783,  467,  467,  467,  467,
 
-      464,  464,  465,  465,  465,  465,  465,  465,  465,  751,
-      883,  764, 1566,  465, 1010,  748,  792,  792,  465,  465,
-      465,  465,  465,  465,  516,  752,  516,  516,  516,  516,
-      516,  516,  516,  792,  751, 1586, 1022,  516, 1595,  752,
-      974,  863,  516,  516,  516,  516,  516,  516,  517,  517,
-      517,  517,  517,  517,  517,  517, 1266,  974,  863,  974,
-      517, 1022,  517,  863,  752,  517,  517,  517,  517,  517,
-      517,  733,  733,  733,  733,  733,  733,  733,  735,  735,
-      735,  735,  735,  735,  735,  766,  772,  517,  519,  519,
-      519,  519,  519,  519,  519,  519,  854, 1265, 1264, 1025,
+      467,  467,  468,  468,  468,  468,  468,  468,  468,  748,
+      774,  773,  783,  468,  759,  758, 1495,  748,  468,  468,
+      468,  468,  468,  468,  488,  488,  488,  774,  759,  488,
+      488,  783, 1498,  488,  488,  805,  488,  762,  488, 1499,
+      488,  520,  763,  520,  520,  520,  520,  520,  520,  520,
+     1076,  762,  805,  759,  520, 1136,  763,  807,  807,  520,
+      520,  520,  520,  520,  520,  521,  521,  521,  521,  521,
+      521,  521,  521, 1507,  807, 1076,  762,  521, 1540,  521,
+     1136,  763,  521,  521,  521,  521,  521,  521,  746,  746,
+      746,  746,  746,  746,  746,  750,  750,  750,  750,  750,
 
-      519, 1037,  766,  772,  854,  519,  519,  519,  519,  519,
-      519,  523,  523,  523,  523,  523,  523,  523,  523,  766,
-     1260, 1259,  772,  523, 1025, 1041, 1037, 1053,  523,  523,
-      523,  523,  523,  523,  524,  524,  524,  524,  524,  524,
-      524,  524,  525,  525,  525,  525,  525,  525,  525,  912,
-     1041, 1256, 1053,  525, 1109, 1162, 1174,  912,  525,  525,
-      525,  525,  525,  525,  526,  526,  526,  526,  526,  526,
-      526,  526,  528,  528,  528,  528,  528,  528,  528, 1109,
-     1162, 1174, 1203,  528, 1252, 1251,  864,  866,  528,  528,
-      528,  528,  528,  528,  529,  529,  529,  529,  529,  529,
+      750,  750,  775,  777,  521,  523,  523,  523,  523,  523,
+      523,  523,  523,  869, 1189, 1541, 1201,  523, 1234,  775,
+      777,  869,  523,  523,  523,  523,  523,  523,  527,  527,
+      527,  527,  527,  527,  527,  527,  775,  777, 1566, 1189,
+      527, 1201, 1237, 1234, 1240,  527,  527,  527,  527,  527,
+      527,  528,  528,  528,  528,  528,  528,  528,  528,  529,
+      529,  529,  529,  529,  529,  529,  931, 1237, 1569, 1240,
+      529, 1243, 1246, 1271,  931,  529,  529,  529,  529,  529,
+      529,  530,  530,  530,  530,  530,  530,  530,  530,  532,
+      532,  532,  532,  532,  532,  532, 1243, 1246, 1271, 1285,
 
-      529,  529,  529,  864,  866, 1250,  529, 1203,  864,  866,
-      814,  529,  529,  529,  529,  529,  529,  530,  530,  530,
-      530,  530,  530,  530,  814, 1246, 1206, 1245,  530, 1242,
-      868,  869, 1239,  530,  530,  530,  530,  530,  530,  534,
-      534,  534,  534,  534,  534,  534,  534,  868,  869,  814,
-      534, 1206,  868,  869,  871,  534,  534,  534,  534,  534,
-      534,  536,  536,  536,  536,  536,  536,  536,  536,  536,
-     1238,  871, 1209,  536,  871,  874, 1237,  881,  536,  536,
-      536,  536,  536,  536,  537,  537,  537,  537,  537,  537,
-      537,  537,  874,  874,  881,  537, 1233, 1209,  875,  881,
+      532, 1597, 1601,  876,  877,  532,  532,  532,  532,  532,
+      532,  533,  533,  533,  533,  533,  533,  533,  533,  533,
+      876,  877, 1605,  533, 1285,  878,  877,  829,  533,  533,
+      533,  533,  533,  533,  534,  534,  534,  534,  534,  534,
+      534,  829,  878, 1299, 1349,  534, 1609,  878,  879, 1613,
+      534,  534,  534,  534,  534,  534,  538,  538,  538,  538,
+      538,  538,  538,  538, 1412,  879,  829,  538, 1299, 1349,
+      879,  881,  538,  538,  538,  538,  538,  538,  540,  540,
+      540,  540,  540,  540,  540,  540,  540, 1637,  881, 1412,
+      540, 1646,  883,  881,  884,  540,  540,  540,  540,  540,
 
-      537,  537,  537,  537,  537,  537,  545,  545,  545,  545,
-      545,  545,  545,  545,  545,  875, 1232, 1229,  545, 1212,
-      965,  962,  875,  545,  545,  545,  545,  545,  545,  546,
-      546,  546,  546,  546,  546,  546,  546,  965,  962, 1215,
-      546,  962,  965,  968, 1212,  546,  546,  546,  546,  546,
-      546,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      968,  968, 1240,  555, 1215, 1228,  970,  969,  555,  555,
-      555,  555,  555,  555,  557,  557,  557,  557,  557,  557,
-      557,  557,  557,  970,  969, 1227,  557, 1240,  557,  969,
-      970,  557,  557,  557,  557,  557,  557,  739,  739,  739,
+      540,  541,  541,  541,  541,  541,  541,  541,  541,  883,
+     1283,  884,  541, 1282,  883,  890,  884,  541,  541,  541,
+      541,  541,  541,  549,  549,  549,  549,  549,  549,  549,
+      549,  549,  890,  890, 1466,  549, 1281,  891,  886,  902,
+      549,  549,  549,  549,  549,  549,  550,  550,  550,  550,
+      550,  550,  550,  550,  891,  886,  902,  550,  886, 1466,
+      896,  891,  550,  550,  550,  550,  550,  550,  559,  559,
+      559,  559,  559,  559,  559,  559,  559,  896, 1277, 1276,
+      559, 1273,  896,  994,  899,  559,  559,  559,  559,  559,
+      559,  561,  561,  561,  561,  561,  561,  561,  561,  561,
 
-      739,  739,  739,  739,  745,  745,  745,  745,  745,  745,
-      745,  867,  773,  557,  608,  608,  608,  608,  608,  608,
-      608, 1254, 1223, 1268, 1221,  608, 1314,  972,  867,  773,
-      608,  608,  608,  608,  608,  608,  610,  610,  610,  610,
-      610,  610,  610,  773,  972,  867, 1254,  610, 1268,  972,
-     1377, 1314,  610,  610,  610,  610,  610,  610,  611,  611,
-      611,  611,  611,  611,  611,  611,  613,  613,  613,  613,
-      613,  613,  613,  923, 1427, 1377, 1436,  613, 1445,  878,
-      976,  923,  613,  613,  613,  613,  613,  613,  615,  615,
-      615,  615,  615,  615,  615,  615,  878,  976, 1220, 1427,
+      994,  899,  994,  561,  784,  561,  899,  785,  561,  561,
+      561,  561,  561,  561,  756,  756,  756,  756,  756,  756,
+      756,  784, 1001, 1270,  785, 1269,  789,  795,  880,  885,
+      561,  616,  616,  616,  616,  616,  616,  616,  785, 1001,
+      784, 1475,  616,  789,  795,  880,  885,  616,  616,  616,
+      616,  616,  616,  618,  618,  618,  618,  618,  618,  618,
+      880,  885,  789,  795,  618, 1268, 1475, 1484, 1493,  618,
+      618,  618,  618,  618,  618,  619,  619,  619,  619,  619,
+      619,  619,  619,  621,  621,  621,  621,  621,  621,  621,
+      942, 1264, 1484, 1493,  621,  894,  900,  981,  942,  621,
 
-      615, 1436,  976, 1445,  878,  615,  615,  615,  615,  615,
-      615,  616,  616,  616,  616,  616,  616,  616,  616,  617,
-      617,  617,  617,  617,  617,  617,  935, 1217, 1216, 1213,
-      617, 1210, 1207, 1204,  935,  617,  617,  617,  617,  617,
-      617,  618,  618,  618,  618,  618,  618,  618,  618,  621,
-      621,  621,  621,  621,  621,  621,  621,  621,  765,  775,
-      776,  621,  777,  621,  973,  978,  621,  621,  621,  621,
-      621,  621, 1061, 1200, 1176,  765,  775,  776, 1175,  777,
-     1061,  973,  978,  770,  973,  775,  776,  765,  621,  624,
-      624,  624,  624,  624,  624,  624,  624,  624,  777,  780,
+      621,  621,  621,  621,  621,  623,  623,  623,  623,  623,
+      623,  623,  894,  900,  981, 1263,  623,  981,  900, 1564,
+      894,  623,  623,  623,  623,  623,  623,  624,  624,  624,
+      624,  624,  624,  624,  624,  625,  625,  625,  625,  625,
+      625,  625,  954, 1260, 1564, 1259,  625, 1258, 1254, 1252,
+      954,  625,  625,  625,  625,  625,  625,  626,  626,  626,
+      626,  626,  626,  626,  626,  629,  629,  629,  629,  629,
+      629,  629,  629,  629,  776,  787,  788,  629, 1251,  629,
+      993,  830,  629,  629,  629,  629,  629,  629, 1084, 1248,
+     1247,  776,  787,  788, 1244,  830, 1084,  993,  882,  781,
 
-      770,  624,  781,  624,  979, 1119,  624,  624,  624,  624,
-      624,  624,  770, 1119, 1172, 1130,  780, 1454, 1168,  781,
-     1167,  979,  787, 1130, 1164,  780,  815,  788,  624,  630,
-      630,  630,  630,  630,  630,  630,  630,  630,  781,  787,
-      815,  630, 1454,  630,  788, 1142,  630,  630,  630,  630,
-      630,  630,  787, 1142, 1521, 1159,  788,  794,  794,  794,
-      794,  794,  794,  794,  822,  815,  823,  873,  630,  635,
-      635,  635,  635,  635,  635,  635,  635,  635,  822, 1521,
-      823,  635, 1158, 1548,  873, 1155,  635,  635,  635,  635,
-      635,  635,  637,  637,  637,  637,  637,  637,  637,  637,
+      993,  787,  788,  776,  629,  632,  632,  632,  632,  632,
+      632,  632,  632,  632,  792,  882,  781,  632,  984,  632,
+      830, 1146,  632,  632,  632,  632,  632,  632,  781, 1146,
+     1241,  792,  882, 1595, 1238,  984, 1599, 1235,  802, 1231,
+      984,  792,  837,  794,  632,  638,  638,  638,  638,  638,
+      638,  638,  638,  638,  803,  802,  837,  638, 1595,  638,
+      794, 1599,  638,  638,  638,  638,  638,  638,  802,  794,
+     1603,  803,  809,  809,  809,  809,  809,  809,  809, 1203,
+      838,  837,  841,  803,  638,  643,  643,  643,  643,  643,
+      643,  643,  643,  643,  838, 1603,  841,  643, 1202, 1199,
 
-      637,  873,  826,  822,  637,  823,  637,  827, 1548,  637,
-      637,  637,  637,  637,  637, 1147,  826, 1552, 1146, 1143,
-     1556,  827,  835,  835,  835,  835,  835,  835,  835,  837,
-      980,  637,  647,  647,  647,  647,  647,  647,  647,  647,
-      647,  826, 1552,  837,  647, 1556,  827,  980, 1135,  647,
-      647,  647,  647,  647,  647,  649,  649,  649,  649,  649,
-      649,  649,  649,  649,  876,  838,  841,  649,  837,  649,
-      842, 1134,  649,  649,  649,  649,  649,  649, 1131,  838,
-      841,  876, 1124, 1560,  842,  850,  850,  850,  850,  850,
-      850,  850,  876,  865,  649,  660,  660,  660,  660,  660,
+     1000, 1195,  643,  643,  643,  643,  643,  643,  645,  645,
+      645,  645,  645,  645,  645,  645,  645, 1000,  842,  838,
+      645,  841,  645, 1157,  889,  645,  645,  645,  645,  645,
+      645, 1157,  842,  850,  850,  850,  850,  850,  850,  850,
+     1000,  889, 1194, 1191,  987,  852, 1002,  645,  655,  655,
+      655,  655,  655,  655,  655,  655,  655,  842,  889,  852,
+      655,  987,  987, 1002, 1186,  655,  655,  655,  655,  655,
+      655,  657,  657,  657,  657,  657,  657,  657,  657,  657,
+      892,  853,  856,  657,  852,  657,  857, 1185,  657,  657,
+      657,  657,  657,  657, 1182,  853,  856,  892, 1174, 1607,
 
-      660,  660,  660,  660,  838,  841, 1123,  660, 1560,  842,
-      865,  882,  660,  660,  660,  660,  660,  660,  661,  661,
-      661,  661,  661,  661,  661,  865, 1120, 1115,  882,  661,
-     1114,  984, 1071, 1079,  661,  661,  661,  661,  661,  661,
-      664,  664,  664,  664,  664,  664,  664,  882,  984, 1071,
-     1079,  664,  870,  872,  958,  880,  664,  664,  664,  664,
-      664,  664,  852,  852,  852,  852,  852,  852,  852,  870,
-      872,  958,  880,  946,  664,  699,  947,  699,  699,  699,
-      699,  699,  699,  699,  870,  872,  958,  946,  699,  880,
-      947, 1083, 1074,  699,  699,  699,  699,  699,  699,  700,
+      857,  865,  865,  865,  865,  865,  865,  865,  892,  887,
+      657,  668,  668,  668,  668,  668,  668,  668,  668,  668,
+      853,  856, 1173,  668, 1607,  857,  887,  901,  668,  668,
+      668,  668,  668,  668,  669,  669,  669,  669,  669,  669,
+      669,  887, 1170, 1162,  901,  669, 1161,  989,  992, 1003,
+      669,  669,  669,  669,  669,  669,  672,  672,  672,  672,
+      672,  672,  672,  901,  989,  992, 1003,  672,  898,  989,
+      992,  897,  672,  672,  672,  672,  672,  672,  867,  867,
+      867,  867,  867,  867,  867,  898, 1158,  965,  897,  966,
+      672,  710,  969,  710,  710,  710,  710,  710,  710,  710,
 
-      700,  700,  700,  700,  700,  700,  700, 1111, 1083, 1074,
-     1083,  700,  946, 1074, 1110,  947,  700,  700,  700,  700,
-      700,  700,  701,  701,  701,  701,  701,  701,  701,  856,
-      856,  856,  856,  856,  856,  856,  961,  959,  877,  905,
-      905,  905,  905,  905,  905,  905,  910,  910,  910,  910,
-      910,  910,  910,  961,  959,  877,  701,  702,  702,  702,
-      702,  702,  702,  702,  877, 1107, 1106, 1103,  702,  959,
-      961, 1564, 1584,  702,  702,  702,  702,  702,  702,  704,
-      704,  704,  704,  704,  704,  704,  704,  706,  706,  706,
-      706,  706,  706,  706,  706, 1154, 1564, 1584, 1100,  706,
+      897,  965,  898,  966,  710, 1151,  969,  997,  998,  710,
+      710,  710,  710,  710,  710,  711,  711,  711,  711,  711,
+      711,  711,  711, 1150,  997,  998,  965,  711,  966,  997,
+      998,  969,  711,  711,  711,  711,  711,  711,  712,  712,
+      712,  712,  712,  712,  712,  871,  871,  871,  871,  871,
+      871,  871,  980,  977,  888,  924,  924,  924,  924,  924,
+      924,  924,  929,  929,  929,  929,  929,  929,  929,  980,
+      977,  888,  712,  713,  713,  713,  713,  713,  713,  713,
+      888, 1147, 1142, 1141,  713,  977,  980, 1611, 1635,  713,
+      713,  713,  713,  713,  713,  715,  715,  715,  715,  715,
 
-     1593, 1097, 1093, 1154,  706,  706,  706,  706,  706,  706,
-      707,  707,  707,  707,  707,  707,  707,  707,  709,  709,
-      709,  709,  709,  709,  709, 1593, 1066, 1062, 1055,  709,
-     1054, 1051, 1077, 1078,  709,  709,  709,  709,  709,  709,
-      710,  710,  710,  710,  710,  710,  710,  710,  710, 1077,
-     1078, 1047,  710, 1077, 1082, 1078,  950,  710,  710,  710,
-      710,  710,  710,  711,  711,  711,  711,  711,  711,  711,
-      950, 1082, 1046, 1043,  711, 1039, 1082, 1087, 1038,  711,
-      711,  711,  711,  711,  711,  713,  713,  713,  713,  713,
-      713,  713,  713,  713, 1087,  950, 1035,  713, 1031, 1085,
+      715,  715,  715,  717,  717,  717,  717,  717,  717,  717,
+      717, 1169, 1611, 1635, 1138,  717, 1644, 1137, 1134, 1169,
+      717,  717,  717,  717,  717,  717,  718,  718,  718,  718,
+      718,  718,  718,  718,  720,  720,  720,  720,  720,  720,
+      720, 1644, 1133, 1130, 1127,  720, 1124, 1120, 1007, 1094,
+      720,  720,  720,  720,  720,  720,  721,  721,  721,  721,
+      721,  721,  721,  721,  721, 1007, 1094, 1089,  721, 1085,
+      990, 1097,  970,  721,  721,  721,  721,  721,  721,  722,
+      722,  722,  722,  722,  722,  722,  970,  990, 1097, 1078,
+      722, 1077, 1097, 1102,  990,  722,  722,  722,  722,  722,
 
-     1087,  951,  713,  713,  713,  713,  713,  713,  714,  714,
-      714,  714,  714,  714,  714,  951, 1085, 1085, 1030,  714,
-     1027, 1177, 1088, 1024,  714,  714,  714,  714,  714,  714,
-      718,  718,  718,  718,  718,  718,  718,  718, 1177, 1088,
-      951,  718, 1088, 1023, 1178, 1020,  718,  718,  718,  718,
-      718,  718,  720,  720,  720,  720,  720,  720,  720,  720,
-      720, 1178, 1177, 1016,  720, 1015, 1179, 1181, 1012,  720,
-      720,  720,  720,  720,  720,  721,  721,  721,  721,  721,
-      721,  721,  721, 1179, 1181, 1178,  721, 1011, 1008, 1180,
-     1004,  721,  721,  721,  721,  721,  721,  729,  729,  729,
+      722,  724,  724,  724,  724,  724,  724,  724,  724,  724,
+     1102,  970, 1074,  724,  986, 1100, 1101, 1099,  724,  724,
+      724,  724,  724,  724,  725,  725,  725,  725,  725,  725,
+      725,  986, 1100, 1101, 1099,  725, 1100, 1070, 1101,  986,
+      725,  725,  725,  725,  725,  725,  729,  729,  729,  729,
+      729,  729,  729,  729, 1099, 1069, 1066,  729, 1062, 1061,
+     1104, 1058,  729,  729,  729,  729,  729,  729,  731,  731,
+      731,  731,  731,  731,  731,  731,  731, 1104, 1104, 1054,
+      731, 1053, 1106, 1111, 1107,  731,  731,  731,  731,  731,
+      731,  732,  732,  732,  732,  732,  732,  732,  732, 1106,
 
-      729,  729,  729,  729,  729,  729, 1180, 1179, 1180,  729,
-     1000, 1184, 1185, 1182,  729,  729,  729,  729,  729,  729,
-      730,  730,  730,  730,  730,  730,  730,  730, 1184, 1185,
-     1182,  730,  999, 1184,  998, 1196,  730,  730,  730,  730,
-      730,  730,  740,  740,  740,  740,  740,  740,  740,  740,
-      740, 1182, 1196,  995,  740,  992, 1196, 1197, 1293,  740,
-      740,  740,  740,  740,  740,  741,  741,  741,  741,  741,
-      741,  741,  741,  989, 1197, 1293,  741,  986,  985, 1197,
-     1294,  741,  741,  741,  741,  741,  741,  753,  753,  753,
-      753,  753,  753,  753,  753,  753,  957, 1294,  956,  753,
+     1111, 1107,  732, 1107, 1106, 1109, 1111,  732,  732,  732,
+      732,  732,  732,  740,  740,  740,  740,  740,  740,  740,
+      740,  740, 1109, 1109, 1050,  740, 1047, 1204, 1114, 1116,
+      740,  740,  740,  740,  740,  740,  741,  741,  741,  741,
+      741,  741,  741,  741, 1204, 1114, 1116,  741, 1114, 1116,
+     1205, 1046,  741,  741,  741,  741,  741,  741,  751,  751,
+      751,  751,  751,  751,  751,  751,  751, 1205, 1204, 1043,
+      751, 1039, 1206, 1208, 1038,  751,  751,  751,  751,  751,
+      751,  752,  752,  752,  752,  752,  752,  752,  752, 1206,
+     1208, 1205,  752, 1035, 1034, 1207, 1031,  752,  752,  752,
 
-      953,  949,  948,  975,  753,  753,  753,  753,  753,  753,
-      755,  755,  755,  755,  755,  755,  755,  755,  755,  879,
-      975, 1005,  755,  945,  755,  940,  936,  755,  755,  755,
-      755,  755,  755,  975,  967, 1005,  879,  914,  914,  914,
-      914,  914,  914,  914, 1076,  879,  928,  963, 1006,  755,
-      789,  967,  789,  789,  789,  789,  789,  789,  789,  967,
-     1005, 1076, 1006,  789,  963,  963, 1295,  789,  789,  789,
-      789,  789,  789,  789,  791,  791,  791,  791,  791,  791,
-      791, 1076,  963, 1295,  924,  791,  971, 1006, 1296, 1309,
-      791,  791,  791,  791,  791,  791,  793,  793,  793,  793,
+      752,  752,  752,  764,  764,  764,  764,  764,  764,  764,
+      764,  764, 1207, 1206, 1207,  764, 1027, 1023, 1022, 1021,
+      764,  764,  764,  764,  764,  764,  766,  766,  766,  766,
+      766,  766,  766,  766,  766,  893,  895, 1028,  766, 1018,
+      766, 1181, 1015,  766,  766,  766,  766,  766,  766, 1181,
+      978, 1028,  893,  895,  933,  933,  933,  933,  933,  933,
+      933,  893,  895,  982, 1029,  766,  804,  978,  804,  804,
+      804,  804,  804,  804,  804, 1012, 1028, 1009, 1029,  804,
+      982,  982,  978,  804,  804,  804,  804,  804,  804,  804,
+      806,  806,  806,  806,  806,  806,  806, 1008,  982,  976,
 
-      793,  793,  793,  971,  917, 1296, 1309,  793,  913, 1187,
-     1297,  971,  793,  793,  793,  793,  793,  793,  795,  795,
-      795,  795,  795,  795,  795,  795, 1187, 1297,  908,  903,
-      795,  902, 1297,  901, 1187,  795,  795,  795,  795,  795,
-      795,  796,  796,  796,  796,  796,  796,  796,  796,  799,
-      799,  799,  799,  799,  799,  799,  799,  799,  898,  895,
-      891,  799,  859,  799,  855,  848,  799,  799,  799,  799,
-      799,  799,  919,  919,  919,  919,  919,  919,  919,  921,
-      921,  921,  921,  921,  921,  921,  847, 1396,  799,  802,
-      802,  802,  802,  802,  802,  802,  802,  802,  844,  840,
+      975,  806,  991, 1029, 1209, 1212,  806,  806,  806,  806,
+      806,  806,  808,  808,  808,  808,  808,  808,  808,  991,
+      972, 1209, 1212,  808,  968,  967, 1211,  991,  808,  808,
+      808,  808,  808,  808,  810,  810,  810,  810,  810,  810,
+      810,  810, 1209, 1211,  964,  959,  810,  955, 1211,  947,
+      943,  810,  810,  810,  810,  810,  810,  811,  811,  811,
+      811,  811,  811,  811,  811,  814,  814,  814,  814,  814,
+      814,  814,  814,  814,  936,  932,  927,  814,  922,  814,
+      921,  920,  814,  814,  814,  814,  814,  814,  938,  938,
+      938,  938,  938,  938,  938,  940,  940,  940,  940,  940,
 
-      839,  802,  836,  802, 1396,  833,  802,  802,  802,  802,
-      802,  802,  925,  925,  925,  925,  925,  925,  925,  931,
-      931,  931,  931,  931,  931,  931,  832, 1473,  802,  805,
-      805,  805,  805,  805,  805,  805,  805,  805,  829,  825,
-      824,  805,  821,  805, 1473,  820,  805,  805,  805,  805,
-      805,  805,  933,  933,  933,  933,  933,  933,  933,  937,
-      937,  937,  937,  937,  937,  937, 1013,  960,  805,  811,
-      811,  811,  811,  811,  811,  811,  811,  811,  817,  813,
-     1013,  811,  810,  811,  960,  964,  811,  811,  811,  811,
-      811,  811,  944,  944,  944,  944,  944,  944,  944,  960,
+      940,  940,  917, 1324,  814,  817,  817,  817,  817,  817,
+      817,  817,  817,  817,  914,  910,  874,  817,  870,  817,
+     1324,  863,  817,  817,  817,  817,  817,  817,  944,  944,
+      944,  944,  944,  944,  944,  950,  950,  950,  950,  950,
+      950,  950,  862, 1325,  817,  820,  820,  820,  820,  820,
+      820,  820,  820,  820,  859,  855,  854,  820,  851,  820,
+     1325,  848,  820,  820,  820,  820,  820,  820,  952,  952,
+      952,  952,  952,  952,  952,  956,  956,  956,  956,  956,
+      956,  956, 1036,  979,  820,  826,  826,  826,  826,  826,
+      826,  826,  826,  826,  847,  844, 1036,  826,  840,  826,
 
-      960,  809,  964,  808,  807, 1013, 1014,  966,  811,  816,
-      816,  816,  816,  816,  816,  816,  816,  816,  964,  804,
-     1014,  816,  801,  798,  966,  977,  816,  816,  816,  816,
-      816,  816,  818,  818,  818,  818,  818,  818,  818,  818,
-      818,  966,  977, 1017,  818, 1014,  818, 1018, 1286,  818,
-      818,  818,  818,  818,  818,  797, 1286, 1017,  758,  977,
-      757, 1018, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1028,
-      754,  818,  828,  828,  828,  828,  828,  828,  828,  828,
-      828,  750, 1017, 1028,  828,  749, 1018, 1072,  746,  828,
-      828,  828,  828,  828,  828,  830,  830,  830,  830,  830,
+      979,  983,  826,  826,  826,  826,  826,  826,  963,  963,
+      963,  963,  963,  963,  963,  979,  979,  839,  983, 1326,
+      836, 1036, 1327,  985,  826,  831,  831,  831,  831,  831,
+      831,  831,  831,  831,  983,  835, 1326,  831,  832, 1327,
+      985,  988,  831,  831,  831,  831,  831,  831,  833,  833,
+      833,  833,  833,  833,  833,  833,  833,  985,  988, 1226,
+      833,  996,  833, 1037,  999,  833,  833,  833,  833,  833,
+      833,  988,  828,  825, 1317, 1377, 1226, 1037,  996,  824,
+     1226,  999, 1317, 1377, 1096, 1040, 1343,  833,  843,  843,
+      843,  843,  843,  843,  843,  843,  843,  996,  999, 1040,
 
-      830,  830,  830,  830, 1072, 1029, 1032,  830, 1028,  830,
-     1033,  742,  830,  830,  830,  830,  830,  830, 1072, 1029,
-     1032,  738,  731,  727, 1033, 1042, 1042, 1042, 1042, 1042,
-     1042, 1042, 1044, 1302,  830,  843,  843,  843,  843,  843,
-      843,  843,  843,  843, 1029, 1032, 1044,  843,  722, 1033,
-     1302,  717,  843,  843,  843,  843,  843,  843,  845,  845,
-      845,  845,  845,  845,  845,  845,  845, 1068, 1045, 1048,
-      845, 1044,  845, 1049, 1302,  845,  845,  845,  845,  845,
-      845,  716, 1045, 1048, 1068,  715,  712, 1049, 1057, 1057,
-     1057, 1057, 1057, 1057, 1057, 1068,  708,  845,  857,  857,
+      843, 1096, 1037, 1343,  995,  843,  843,  843,  843,  843,
+      843,  845,  845,  845,  845,  845,  845,  845,  845,  845,
+     1096,  995, 1041,  845, 1040,  845,  823, 1224,  845,  845,
+      845,  845,  845,  845,  995,  822, 1041, 1049, 1049, 1049,
+     1049, 1049, 1049, 1049, 1224,  819, 1051, 1426, 1052, 1224,
+      845,  858,  858,  858,  858,  858,  858,  858,  858,  858,
+     1051, 1041, 1052,  858, 1426,  816, 1095, 1426,  858,  858,
+      858,  858,  858,  858,  860,  860,  860,  860,  860,  860,
+      860,  860,  860, 1095, 1055, 1051,  860, 1052,  860, 1056,
+      813,  860,  860,  860,  860,  860,  860, 1095, 1055,  812,
 
-      857,  857,  857,  857,  857,  857,  857, 1045, 1048,  698,
-      857,  697, 1049, 1075, 1165,  857,  857,  857,  857,  857,
-      857,  858,  858,  858,  858,  858,  858,  858, 1165,  693,
-     1075,  692,  858,  690,  689, 1305,  672,  858,  858,  858,
-      858,  858,  858,  884, 1075,  884,  884,  884,  884,  884,
-      884,  884, 1305, 1165,  662,  658,  884, 1305, 1393, 1310,
-      884,  884,  884,  884,  884,  884,  884,  885,  885,  885,
-      885,  885,  885,  885, 1342, 1393, 1310,  652,  885,  651,
-      648, 1394, 1342,  885,  885,  885,  885,  885,  885,  886,
-      886,  886,  886,  886,  886,  886,  886, 1310, 1394, 1393,
+      769,  768,  765, 1056, 1065, 1065, 1065, 1065, 1065, 1065,
+     1065, 1067,  761,  860,  872,  872,  872,  872,  872,  872,
+      872,  872,  872, 1055,  760, 1067,  872,  757, 1056, 1098,
+     1068,  872,  872,  872,  872,  872,  872,  873,  873,  873,
+      873,  873,  873,  873, 1068,  753, 1098,  749,  873,  742,
+     1067, 1427,  738,  873,  873,  873,  873,  873,  873,  903,
+     1098,  903,  903,  903,  903,  903,  903,  903, 1427, 1068,
+      733, 1427,  903, 1214, 1227, 1229,  903,  903,  903,  903,
+      903,  903,  903,  904,  904,  904,  904,  904,  904,  904,
+     1214, 1227, 1229,  728,  904,  727, 1227, 1229, 1214,  904,
 
-      644,  886, 1394,  886,  643,  640,  886,  886,  886,  886,
-      886,  886, 1059, 1059, 1059, 1059, 1059, 1059, 1059, 1063,
-     1063, 1063, 1063, 1063, 1063, 1063, 1073, 1081,  886,  888,
-      888,  888,  888,  888,  888,  888,  639,  636,  632,  629,
-      888,  628,  627, 1073, 1081,  888,  888,  888,  888,  888,
-      888,  889,  889,  889,  889,  889,  889,  889,  889, 1081,
-      626,  623, 1073,  889,  620,  619,  612,  609,  889,  889,
-      889,  889,  889,  889,  890,  890,  890,  890,  890,  890,
-      890,  890,  892,  892,  892,  892,  892,  892,  892, 1349,
-      607,  603,  597,  892,  596,  595, 1397, 1349,  892,  892,
+      904,  904,  904,  904,  904,  905,  905,  905,  905,  905,
+      905,  905,  905, 1384, 1071, 1072,  726,  905,  723,  905,
+      719, 1384,  905,  905,  905,  905,  905,  905, 1071, 1072,
+     1080, 1080, 1080, 1080, 1080, 1080, 1080, 1082, 1082, 1082,
+     1082, 1082, 1082, 1082,  905,  907,  907,  907,  907,  907,
+      907,  907,  709, 1071, 1072,  708,  907,  704, 1328, 1337,
+     1347,  907,  907,  907,  907,  907,  907,  908,  908,  908,
+      908,  908,  908,  908,  908, 1328, 1337, 1347,  703,  908,
+     1328, 1337, 1347,  701,  908,  908,  908,  908,  908,  908,
+      909,  909,  909,  909,  909,  909,  909,  909,  911,  911,
 
-      892,  892,  892,  892,  893,  893,  893,  893,  893,  893,
-      893,  893,  893, 1397,  594,  590,  893, 1397, 1404, 1391,
-     1166,  893,  893,  893,  893,  893,  893,  894,  894,  894,
-      894,  894,  894,  894, 1166, 1404, 1391,  589,  894, 1391,
-     1404, 1398,  587,  894,  894,  894,  894,  894,  894,  896,
-      896,  896,  896,  896,  896,  896,  896,  896, 1398, 1166,
-      586,  896, 1398, 1399, 1392, 1169,  896,  896,  896,  896,
-      896,  896,  897,  897,  897,  897,  897,  897,  897, 1169,
-     1399, 1392,  585,  897, 1392,  584, 1399,  580,  897,  897,
-      897,  897,  897,  897,  899,  899,  899,  899,  899,  899,
+      911,  911,  911,  911,  911,  700,  680,  670,  666,  911,
+      660,  659, 1334, 1344,  911,  911,  911,  911,  911,  911,
+      912,  912,  912,  912,  912,  912,  912,  912,  912, 1334,
+     1344,  656,  912,  652,  651, 1428, 1192,  912,  912,  912,
+      912,  912,  912,  913,  913,  913,  913,  913,  913,  913,
+     1192, 1344, 1428, 1334,  913,  648,  647, 1429,  644,  913,
+      913,  913,  913,  913,  913,  915,  915,  915,  915,  915,
+      915,  915,  915,  915, 1429, 1192, 1428,  915, 1429, 1432,
+     1433, 1193,  915,  915,  915,  915,  915,  915,  916,  916,
+      916,  916,  916,  916,  916, 1193, 1432, 1433,  640,  916,
 
-      899,  899,  899,  579, 1169,  578,  899,  577, 1401, 1474,
-     1170,  899,  899,  899,  899,  899,  899,  900,  900,  900,
-      900,  900,  900,  900, 1170, 1401, 1474,  576,  900, 1401,
-      575, 1486,  574,  900,  900,  900,  900,  900,  900,  904,
-      904,  904,  904,  904,  904,  904,  904, 1474, 1486, 1170,
-      904, 1486,  573, 1529, 1481,  904,  904,  904,  904,  904,
-      904,  906,  906,  906,  906,  906,  906,  906,  906,  906,
-     1529, 1481,  572,  906,  571,  570, 1483,  569,  906,  906,
-      906,  906,  906,  906,  907,  907,  907,  907,  907,  907,
-      907,  907, 1481, 1483, 1483,  907,  568,  567, 1531, 1532,
+      637, 1433, 1434,  636,  916,  916,  916,  916,  916,  916,
+      918,  918,  918,  918,  918,  918,  918,  918,  918, 1434,
+     1193,  635,  918, 1434, 1435, 1437, 1196,  918,  918,  918,
+      918,  918,  918,  919,  919,  919,  919,  919,  919,  919,
+     1196, 1435, 1437,  634,  919,  631, 1437, 1435,  628,  919,
+      919,  919,  919,  919,  919,  923,  923,  923,  923,  923,
+      923,  923,  923,  627,  620, 1196,  923,  617,  615, 1440,
+     1442,  923,  923,  923,  923,  923,  923,  925,  925,  925,
+      925,  925,  925,  925,  925,  925, 1440, 1442, 1440,  925,
+      611, 1445, 1442, 1512,  925,  925,  925,  925,  925,  925,
 
-      907,  907,  907,  907,  907,  907,  915,  915,  915,  915,
-      915,  915,  915,  915,  915, 1531, 1532,  564,  915,  563,
-     1536, 1532, 1539,  915,  915,  915,  915,  915,  915,  916,
-      916,  916,  916,  916,  916,  916,  916, 1536,  562, 1539,
-      916,  560,  559,  556, 1539,  916,  916,  916,  916,  916,
-      916,  926,  926,  926,  926,  926,  926,  926,  926,  926,
-     1536,  551,  547,  926,  543, 1543, 1571, 1573,  926,  926,
-      926,  926,  926,  926,  927,  927,  927,  927,  927,  927,
-      927,  927, 1543, 1571, 1573,  927,  538, 1573, 1582, 1574,
-      927,  927,  927,  927,  927,  927,  938,  938,  938,  938,
+      926,  926,  926,  926,  926,  926,  926,  926, 1445,  605,
+     1512,  926, 1445,  604, 1529, 1513,  926,  926,  926,  926,
+      926,  926,  934,  934,  934,  934,  934,  934,  934,  934,
+      934, 1529, 1513,  603,  934,  602, 1529, 1528, 1521,  934,
+      934,  934,  934,  934,  934,  935,  935,  935,  935,  935,
+      935,  935,  935, 1513, 1528, 1521,  935, 1528,  598,  597,
+     1523,  935,  935,  935,  935,  935,  935,  945,  945,  945,
+      945,  945,  945,  945,  945,  945, 1521, 1523, 1523,  945,
+      594, 1572, 1574, 1575,  945,  945,  945,  945,  945,  945,
+      946,  946,  946,  946,  946,  946,  946,  946, 1572, 1574,
 
-      938,  938,  938,  938,  938, 1582, 1574,  533,  938, 1574,
-     1607, 1575, 1580,  938,  938,  938,  938,  938,  938,  939,
-      939,  939,  939,  939,  939,  939,  939, 1607, 1575, 1580,
-      939, 1575, 1580, 1600, 1602,  939,  939,  939,  939,  939,
-      939,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-     1600, 1602,  532,  952, 1600,  531, 1602,  527,  952,  952,
-      952,  952,  952,  952,  954,  954,  954,  954,  954,  954,
-      954,  954,  954, 1069, 1070,  521,  954, 1080,  954, 1224,
-     1089,  954,  954,  954,  954,  954,  954, 1357, 1365,  520,
-     1069, 1070, 1373, 1224, 1080, 1357, 1365, 1089, 1089, 1615,
+     1575,  946,  593,  592, 1580, 1575,  946,  946,  946,  946,
+      946,  946,  957,  957,  957,  957,  957,  957,  957,  957,
+      957, 1580,  591,  590,  957,  588, 1583,  585, 1589,  957,
+      957,  957,  957,  957,  957,  958,  958,  958,  958,  958,
+      958,  958,  958, 1583, 1580, 1589,  958,  584, 1583, 1586,
+     1591,  958,  958,  958,  958,  958,  958,  971,  971,  971,
+      971,  971,  971,  971,  971,  971, 1586, 1591,  583,  971,
+      582, 1591, 1618, 1586,  971,  971,  971,  971,  971,  971,
+      973,  973,  973,  973,  973,  973,  973,  973,  973, 1618,
+      581,  580,  973, 1103,  973, 1112, 1113,  973,  973,  973,
 
-     1373, 1069, 1070,  954,  981,  981,  981,  981,  981,  981,
-      981,  981,  981, 1080, 1089, 1089, 1615,  981, 1224,  515,
-      514,  981,  981,  981,  981,  981,  981,  981,  982,  982,
-      982,  982,  982,  982,  982,  982,  983,  983,  983,  983,
-      983,  983,  983,  983,  983,  513, 1084, 1189, 1086,  512,
-     1623,  511, 1195,  983,  987,  987,  987,  987,  987,  987,
-      987,  987,  987, 1084, 1189, 1086,  987, 1623,  987, 1195,
-     1191,  987,  987,  987,  987,  987,  987, 1189, 1084, 1086,
-     1112, 1112, 1112, 1112, 1112, 1112, 1112, 1191, 1195,  510,
-     1628,  509, 1635,  987,  990,  990,  990,  990,  990,  990,
+      973,  973,  973, 1086, 1086, 1086, 1086, 1086, 1086, 1086,
+     1103,  579, 1112, 1113,  578,  577,  576, 1630, 1632,  973,
+     1004, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1103,
+      575, 1112, 1113, 1004, 1630, 1632,  574, 1004, 1004, 1004,
+     1004, 1004, 1004, 1004, 1005, 1005, 1005, 1005, 1005, 1005,
+     1005, 1005, 1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006,
+     1006,  573, 1110,  572,  571,  568, 1091, 1197, 1092, 1006,
+     1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1110,
+     1093, 1197, 1010, 1091, 1010, 1092,  567, 1010, 1010, 1010,
+     1010, 1010, 1010, 1110, 1091,  566, 1092, 1093,  564, 1392,
 
-      990,  990,  990,  508, 1191,  507,  990, 1628,  990, 1635,
-      506,  990,  990,  990,  990,  990,  990, 1117, 1117, 1117,
-     1117, 1117, 1117, 1117, 1121, 1121, 1121, 1121, 1121, 1121,
-     1121,  505, 1659,  990,  993,  993,  993,  993,  993,  993,
-      993,  993,  993,  504,  503,  501,  993,  498,  993, 1659,
-      497,  993,  993,  993,  993,  993,  993, 1126, 1126, 1126,
-     1126, 1126, 1126, 1126, 1128, 1128, 1128, 1128, 1128, 1128,
-     1128,  496, 1672,  993,  996,  996,  996,  996,  996,  996,
-      996,  996,  996,  495,  494,  493,  996,  492,  996, 1672,
-      490,  996,  996,  996,  996,  996,  996, 1132, 1132, 1132,
+      563,  560, 1105, 1108, 1213,  555, 1197, 1392, 1093, 1010,
+     1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1105,
+     1108, 1213, 1013,  551, 1013, 1115, 1255, 1013, 1013, 1013,
+     1013, 1013, 1013, 1400, 1105, 1108, 1213, 1408, 1457, 1506,
+     1255, 1400, 1115, 1115, 1631, 1408, 1457, 1506,  547, 1013,
+     1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1115,
+     1115, 1631, 1016, 1631, 1016, 1255,  542, 1016, 1016, 1016,
+     1016, 1016, 1016, 1139, 1139, 1139, 1139, 1139, 1139, 1139,
+     1144, 1144, 1144, 1144, 1144, 1144, 1144,  537, 1634, 1016,
+     1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019,  536,
 
-     1132, 1132, 1132, 1132, 1138, 1138, 1138, 1138, 1138, 1138,
-     1138, 1192, 1225,  996, 1001, 1001, 1001, 1001, 1001, 1001,
-     1001, 1001,  489,  488,  487, 1001, 1225,  486, 1192,  484,
-     1001, 1001, 1001, 1001, 1001, 1001, 1002, 1002, 1002, 1002,
-     1002, 1002, 1002, 1002, 1002,  482, 1192,  480, 1002,  479,
-     1002, 1225,  478, 1002, 1002, 1002, 1002, 1002, 1002, 1140,
-     1140, 1140, 1140, 1140, 1140, 1140, 1144, 1144, 1144, 1144,
-     1144, 1144, 1144, 1230, 1193, 1002, 1007, 1007, 1007, 1007,
-     1007, 1007, 1007, 1007, 1007,  477,  476, 1230, 1007,  474,
-      473, 1193, 1603, 1007, 1007, 1007, 1007, 1007, 1007, 1009,
+      535,  531, 1019,  525, 1019, 1634,  524, 1019, 1019, 1019,
+     1019, 1019, 1019, 1148, 1148, 1148, 1148, 1148, 1148, 1148,
+     1153, 1153, 1153, 1153, 1153, 1153, 1153, 1215, 1219, 1019,
+     1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,  519,  518,
+      517, 1024,  516,  515, 1215, 1219, 1024, 1024, 1024, 1024,
+     1024, 1024, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025,
+     1025,  514, 1219, 1215, 1025,  513, 1025,  512,  511, 1025,
+     1025, 1025, 1025, 1025, 1025, 1155, 1155, 1155, 1155, 1155,
+     1155, 1155, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1220,
+     1225, 1025, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030,
+
+     1030,  510,  509,  508, 1030,  507, 1220, 1225, 1620, 1030,
+     1030, 1030, 1030, 1030, 1030, 1032, 1032, 1032, 1032, 1032,
+     1032, 1032, 1032, 1032, 1220, 1620, 1225, 1032, 1620, 1032,
+      505,  502, 1032, 1032, 1032, 1032, 1032, 1032, 1165, 1165,
+     1165, 1165, 1165, 1165, 1165, 1167, 1167, 1167, 1167, 1167,
+     1167, 1167, 1256, 1221, 1032, 1042, 1042, 1042, 1042, 1042,
+     1042, 1042, 1042, 1042,  501,  500, 1256, 1042,  499,  498,
+     1221, 1654, 1042, 1042, 1042, 1042, 1042, 1042, 1044, 1044,
+     1044, 1044, 1044, 1044, 1044, 1044, 1044, 1221, 1654,  497,
+     1044, 1256, 1044, 1654,  496, 1044, 1044, 1044, 1044, 1044,
 
-     1009, 1009, 1009, 1009, 1009, 1009, 1009, 1009, 1193, 1603,
-      471, 1009, 1230, 1009, 1603,  470, 1009, 1009, 1009, 1009,
-     1009, 1009, 1150, 1150, 1150, 1150, 1150, 1150, 1150, 1152,
-     1152, 1152, 1152, 1152, 1152, 1152, 1231, 1301, 1009, 1019,
-     1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019,  469,  466,
-     1231, 1019,  462,  458, 1301, 1301, 1019, 1019, 1019, 1019,
-     1019, 1019, 1021, 1021, 1021, 1021, 1021, 1021, 1021, 1021,
-     1021,  457, 1301,  456, 1021, 1231, 1021,  453,  449, 1021,
-     1021, 1021, 1021, 1021, 1021, 1156, 1156, 1156, 1156, 1156,
-     1156, 1156, 1163, 1163, 1163, 1163, 1163, 1163, 1163, 1234,
+     1044, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1177, 1177,
+     1177, 1177, 1177, 1177, 1177, 1261, 1332, 1044, 1057, 1057,
+     1057, 1057, 1057, 1057, 1057, 1057, 1057,  494,  493, 1261,
+     1057,  492,  491, 1332, 1332, 1057, 1057, 1057, 1057, 1057,
+     1057, 1059, 1059, 1059, 1059, 1059, 1059, 1059, 1059, 1059,
+      490, 1332,  489, 1059, 1261, 1059,  487,  485, 1059, 1059,
+     1059, 1059, 1059, 1059, 1179, 1179, 1179, 1179, 1179, 1179,
+     1179, 1183, 1183, 1183, 1183, 1183, 1183, 1183, 1262, 1335,
+     1059, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
+      483,  482, 1262, 1073,  481,  480, 1335, 1655, 1073, 1073,
 
-     1303, 1021, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034,
-     1034,  448,  445, 1234, 1034,  444,  443, 1303, 1186, 1034,
-     1034, 1034, 1034, 1034, 1034, 1036, 1036, 1036, 1036, 1036,
-     1036, 1036, 1036, 1036, 1183, 1186, 1303, 1036, 1234, 1036,
-     1418, 1467, 1036, 1036, 1036, 1036, 1036, 1036, 1418, 1467,
-     1186, 1183, 1218, 1218, 1218, 1218, 1218, 1218, 1218, 1640,
-     1235, 1678, 1183, 1617, 1036, 1050, 1050, 1050, 1050, 1050,
-     1050, 1050, 1050, 1050, 1235,  442, 1640, 1050, 1678, 1640,
-     1617, 1190, 1050, 1050, 1050, 1050, 1050, 1050, 1052, 1052,
-     1052, 1052, 1052, 1052, 1052, 1052, 1052, 1188, 1190, 1235,
+     1073, 1073, 1073, 1073, 1075, 1075, 1075, 1075, 1075, 1075,
+     1075, 1075, 1075,  479, 1655, 1335, 1075, 1262, 1075, 1655,
+      477, 1075, 1075, 1075, 1075, 1075, 1075, 1190, 1190, 1190,
+     1190, 1190, 1190, 1190, 1249, 1249, 1249, 1249, 1249, 1249,
+     1249, 1265, 1336, 1075, 1087, 1087, 1087, 1087, 1087, 1087,
+     1087, 1087, 1087,  476,  474, 1265, 1087,  473, 1652, 1336,
+     1266, 1087, 1087, 1087, 1087, 1087, 1087, 1088, 1088, 1088,
+     1088, 1088, 1088, 1088, 1266, 1652, 1336,  472, 1088, 1652,
+     1265, 1622,  469, 1088, 1088, 1088, 1088, 1088, 1088, 1117,
+     1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1622, 1266,
 
-     1052, 1617, 1052, 1527,  439, 1052, 1052, 1052, 1052, 1052,
-     1052, 1527, 1190,  438, 1188, 1241, 1241, 1241, 1241, 1241,
-     1241, 1241, 1405,  429, 1243, 1188, 1304, 1052, 1064, 1064,
-     1064, 1064, 1064, 1064, 1064, 1064, 1064,  426, 1243, 1405,
-     1064,  424,  423, 1304, 1244, 1064, 1064, 1064, 1064, 1064,
-     1064, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1244, 1405,
-     1304,  422, 1065, 1243,  421, 1629,  420, 1065, 1065, 1065,
-     1065, 1065, 1065, 1090, 1090, 1090, 1090, 1090, 1090, 1090,
-     1090, 1090, 1629, 1244,  419,  418, 1090, 1629,  417,  416,
-     1090, 1090, 1090, 1090, 1090, 1090, 1090, 1091, 1091, 1091,
+      465, 1622, 1117,  461,  460,  459, 1117, 1117, 1117, 1117,
+     1117, 1117, 1117, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
+     1118, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119,
+     1272, 1272, 1272, 1272, 1272, 1272, 1272, 1274, 1119, 1121,
+     1121, 1121, 1121, 1121, 1121, 1121, 1570,  456,  452,  451,
+     1121, 1274,  448, 1660, 1570, 1121, 1121, 1121, 1121, 1121,
+     1121, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122,
+     1660,  447,  446, 1122,  445, 1668, 1274, 1275, 1122, 1122,
+     1122, 1122, 1122, 1122, 1123, 1123, 1123, 1123, 1123, 1123,
+     1123, 1275, 1668,  442,  441, 1123,  432,  429, 1670,  427,
 
-     1091, 1091, 1091, 1091, 1091, 1092, 1092, 1092, 1092, 1092,
-     1092, 1092, 1092, 1092,  415, 1642, 1247, 1248,  414, 1257,
-     1308, 1258, 1092, 1094, 1094, 1094, 1094, 1094, 1094, 1094,
-     1247, 1248, 1642, 1257, 1094, 1258, 1642, 1308,  413, 1094,
-     1094, 1094, 1094, 1094, 1094, 1095, 1095, 1095, 1095, 1095,
-     1095, 1095, 1095, 1095, 1308, 1247, 1248, 1095, 1257, 1630,
-     1258, 1261, 1095, 1095, 1095, 1095, 1095, 1095, 1096, 1096,
-     1096, 1096, 1096, 1096, 1096, 1261, 1630,  412,  411, 1096,
-      409, 1630, 1631,  407, 1096, 1096, 1096, 1096, 1096, 1096,
-     1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1631,
+     1123, 1123, 1123, 1123, 1123, 1123, 1125, 1125, 1125, 1125,
+     1125, 1125, 1125, 1125, 1125, 1670, 1275,  426, 1125,  425,
+     1670, 1623, 1278, 1125, 1125, 1125, 1125, 1125, 1125, 1126,
+     1126, 1126, 1126, 1126, 1126, 1126, 1278,  424, 1623,  423,
+     1126, 1623,  422, 1677,  421, 1126, 1126, 1126, 1126, 1126,
+     1126, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128,
+     1677, 1278,  420, 1128,  419, 1680, 1628, 1279, 1128, 1128,
+     1128, 1128, 1128, 1128, 1129, 1129, 1129, 1129, 1129, 1129,
+     1129, 1279, 1680, 1628,  418, 1129, 1628, 1680, 1683,  417,
+     1129, 1129, 1129, 1129, 1129, 1129, 1131, 1131, 1131, 1131,
 
-     1261,  406, 1098,  404, 1631, 1633, 1262, 1098, 1098, 1098,
-     1098, 1098, 1098, 1099, 1099, 1099, 1099, 1099, 1099, 1099,
-     1262,  403, 1633,  400, 1099,  399,  397, 1633,  395, 1099,
-     1099, 1099, 1099, 1099, 1099, 1101, 1101, 1101, 1101, 1101,
-     1101, 1101, 1101, 1101,  394, 1262,  393, 1101,  388, 1644,
-     1647, 1271, 1101, 1101, 1101, 1101, 1101, 1101, 1102, 1102,
-     1102, 1102, 1102, 1102, 1102, 1271, 1644, 1647,  387, 1102,
-      386, 1644, 1618,  384, 1102, 1102, 1102, 1102, 1102, 1102,
-     1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104, 1618,
-     1271, 1647, 1104,  383, 1646, 1648, 1689, 1104, 1104, 1104,
+     1131, 1131, 1131, 1131, 1131, 1683, 1279,  416, 1131, 1511,
+     1684,  415, 1691, 1131, 1131, 1131, 1131, 1131, 1131, 1132,
+     1132, 1132, 1132, 1132, 1132, 1132, 1511, 1684, 1684, 1691,
+     1132,  414,  412,  410, 1511, 1132, 1132, 1132, 1132, 1132,
+     1132, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135,
+     1210, 1216, 1288, 1135,  409, 1135,  407,  406, 1135, 1135,
+     1135, 1135, 1135, 1135,  403,  402, 1288, 1210, 1216, 1286,
+     1286, 1286, 1286, 1286, 1286, 1286, 1289, 1338, 1210, 1216,
+     1135, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140,
+     1289, 1288,  400, 1140, 1338,  398,  397, 1685, 1140, 1140,
 
-     1104, 1104, 1104, 1105, 1105, 1105, 1105, 1105, 1105, 1105,
-     1618, 1646, 1648, 1689, 1105,  382, 1646, 1194, 1198, 1105,
-     1105, 1105, 1105, 1105, 1105, 1108, 1108, 1108, 1108, 1108,
-     1108, 1108, 1108, 1108, 1194, 1198, 1648, 1108,  381, 1108,
-      379,  374, 1108, 1108, 1108, 1108, 1108, 1108, 1194, 1198,
-     1255, 1255, 1255, 1255, 1255, 1255, 1255, 1269, 1269, 1269,
-     1269, 1269, 1269, 1269, 1108, 1113, 1113, 1113, 1113, 1113,
-     1113, 1113, 1113, 1113,  373,  372,  369, 1113,  365,  363,
-     1655, 1663, 1113, 1113, 1113, 1113, 1113, 1113, 1122, 1122,
-     1122, 1122, 1122, 1122, 1122, 1122, 1122, 1655, 1663,  358,
+     1140, 1140, 1140, 1140, 1149, 1149, 1149, 1149, 1149, 1149,
+     1149, 1149, 1149, 1338, 1685, 1289, 1149,  396,  395, 1685,
+     1686, 1149, 1149, 1149, 1149, 1149, 1149, 1160, 1160, 1160,
+     1160, 1160, 1160, 1160, 1160, 1160,  390, 1686,  389, 1160,
+      388,  386, 1686, 1687, 1160, 1160, 1160, 1160, 1160, 1160,
+     1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172,  385,
+     1687,  384, 1172,  383,  381, 1687, 1689, 1172, 1172, 1172,
+     1172, 1172, 1172, 1184, 1184, 1184, 1184, 1184, 1184, 1184,
+     1184, 1184,  376, 1689,  375, 1184,  374,  371, 1689, 1694,
+     1184, 1184, 1184, 1184, 1184, 1184, 1198, 1198, 1198, 1198,
 
-     1122,  357, 1655, 1663, 1664, 1122, 1122, 1122, 1122, 1122,
-     1122, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133,
-      354, 1664,  349, 1133,  348,  340, 1664, 1669, 1133, 1133,
-     1133, 1133, 1133, 1133, 1145, 1145, 1145, 1145, 1145, 1145,
-     1145, 1145, 1145,  338, 1669,  337, 1145,  332,  330, 1669,
-     1670, 1145, 1145, 1145, 1145, 1145, 1145, 1157, 1157, 1157,
-     1157, 1157, 1157, 1157, 1157, 1157,  328, 1670,  327, 1157,
-      326, 1670, 1674, 1677, 1157, 1157, 1157, 1157, 1157, 1157,
-     1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1674,
-     1677,  325, 1171, 1677, 1674,  324,  323, 1171, 1171, 1171,
+     1198, 1198, 1198, 1198, 1198,  367, 1694,  365, 1198, 1694,
+      360,  359, 1217, 1198, 1198, 1198, 1198, 1198, 1198, 1200,
+     1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1218, 1217,
+     1222, 1200, 1223, 1200, 1228, 1439, 1200, 1200, 1200, 1200,
+     1200, 1200, 1217, 1292,  356, 1218,  351, 1222,  350, 1223,
+      342, 1228, 1439,  340,  339,  334,  332, 1292, 1200, 1218,
+     1443, 1222, 1340, 1223, 1439, 1228, 1230, 1230, 1230, 1230,
+     1230, 1230, 1230, 1230, 1230,  330, 1705, 1443, 1293, 1340,
+     1302, 1339, 1292, 1230, 1232, 1232, 1232, 1232, 1232, 1232,
+     1232, 1232, 1293, 1705, 1302, 1232, 1340, 1443, 1339, 1339,
 
-     1171, 1171, 1171, 1173, 1173, 1173, 1173, 1173, 1173, 1173,
-     1173, 1173, 1298, 1272, 1275, 1173, 1276, 1173,  322,  320,
-     1173, 1173, 1173, 1173, 1173, 1173,  319, 1272, 1275, 1298,
-     1276, 1282, 1282, 1282, 1282, 1282, 1282, 1282, 1298, 1299,
-     1306, 1311, 1173, 1199, 1199, 1199, 1199, 1199, 1199, 1199,
-     1199, 1199, 1272, 1275,  318, 1276, 1299, 1306, 1311, 1332,
-     1199, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1299,
-      313, 1311, 1201, 1332,  310, 1695, 1306, 1201, 1201, 1201,
-     1201, 1201, 1201, 1202, 1202, 1202, 1202, 1202, 1202, 1202,
-     1202, 1202, 1695,  309,  308, 1202,  305, 1202, 1332,  298,
+     1232, 1232, 1232, 1232, 1232, 1232, 1233, 1233, 1233, 1233,
+     1233, 1233, 1233, 1233, 1233,  329, 1339, 1293, 1233, 1302,
+     1233, 1717, 1303, 1233, 1233, 1233, 1233, 1233, 1233, 1300,
+     1300, 1300, 1300, 1300, 1300, 1300, 1303,  328, 1717,  327,
+      326, 1306, 1307, 1367,  325, 1233, 1236, 1236, 1236, 1236,
+     1236, 1236, 1236, 1236, 1236, 1306, 1307, 1367, 1236, 1509,
+     1236, 1303, 1342, 1236, 1236, 1236, 1236, 1236, 1236, 1313,
+     1313, 1313, 1313, 1313, 1313, 1313, 1509,  324,  322, 1342,
+     1306, 1307, 1367,  321, 1720, 1236, 1239, 1239, 1239, 1239,
+     1239, 1239, 1239, 1239, 1239, 1509, 1342,  320, 1239,  315,
 
-     1202, 1202, 1202, 1202, 1202, 1202, 1284, 1284, 1284, 1284,
-     1284, 1284, 1284, 1288, 1288, 1288, 1288, 1288, 1288, 1288,
-     1333, 1300, 1202, 1205, 1205, 1205, 1205, 1205, 1205, 1205,
-     1205, 1205,  297, 1312, 1333, 1205, 1470, 1205, 1300, 1307,
-     1205, 1205, 1205, 1205, 1205, 1205,  295,  294,  293, 1300,
-     1312,  291,  289, 1470,  288,  287, 1307, 1307,  285, 1333,
-      281, 1312, 1205, 1208, 1208, 1208, 1208, 1208, 1208, 1208,
-     1208, 1208, 1470,  280, 1307, 1208,  278, 1208,  275,  271,
-     1208, 1208, 1208, 1208, 1208, 1208, 1340, 1340, 1340, 1340,
-     1340, 1340, 1340, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
+     1239, 1720,  312, 1239, 1239, 1239, 1239, 1239, 1239, 1315,
+     1315, 1315, 1315, 1315, 1315, 1315, 1319, 1319, 1319, 1319,
+     1319, 1319, 1319,  311, 1329, 1239, 1242, 1242, 1242, 1242,
+     1242, 1242, 1242, 1242, 1242, 1331, 1333, 1698, 1242, 1702,
+     1242, 1329,  310, 1242, 1242, 1242, 1242, 1242, 1242,  307,
+     1329,  306, 1331, 1333, 1698,  299, 1702, 1698,  298, 1330,
+     1341, 1702, 1333, 1331, 1345, 1242, 1245, 1245, 1245, 1245,
+     1245, 1245, 1245, 1245, 1245, 1346, 1330, 1341, 1245,  296,
+     1245, 1345, 1368, 1245, 1245, 1245, 1245, 1245, 1245, 1330,
+      295, 1341, 1346,  294, 1345,  292, 1368,  290,  289, 1700,
 
-      270, 1698, 1208, 1211, 1211, 1211, 1211, 1211, 1211, 1211,
-     1211, 1211,  267,  266,  264, 1211,  259, 1211, 1698,  256,
-     1211, 1211, 1211, 1211, 1211, 1211, 1347, 1347, 1347, 1347,
-     1347, 1347, 1347, 1353, 1353, 1353, 1353, 1353, 1353, 1353,
-      254, 1705, 1211, 1214, 1214, 1214, 1214, 1214, 1214, 1214,
-     1214, 1214,  253,  251,  248, 1214,  244, 1214, 1705,  240,
-     1214, 1214, 1214, 1214, 1214, 1214, 1355, 1355, 1355, 1355,
-     1355, 1355, 1355, 1361, 1361, 1361, 1361, 1361, 1361, 1361,
-     1380, 1390, 1214, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
-     1219, 1219,  238,  236, 1380, 1219,  235,  233, 1390, 1679,
+     1704, 1415, 1573, 1346,  288, 1245, 1250, 1250, 1250, 1250,
+     1250, 1250, 1250, 1250, 1250, 1415, 1700, 1704, 1250, 1573,
+     1700, 1368, 1704, 1250, 1250, 1250, 1250, 1250, 1250, 1257,
+     1257, 1257, 1257, 1257, 1257, 1257, 1257, 1257, 1573,  286,
+     1415, 1257,  282,  281, 1707, 1708, 1257, 1257, 1257, 1257,
+     1257, 1257, 1267, 1267, 1267, 1267, 1267, 1267, 1267, 1267,
+     1267, 1707, 1708,  279, 1267,  276,  272, 1715,  271, 1267,
+     1267, 1267, 1267, 1267, 1267, 1280, 1280, 1280, 1280, 1280,
+     1280, 1280, 1280, 1280, 1715, 1707, 1708, 1280,  268, 1715,
+     1724, 1725, 1280, 1280, 1280, 1280, 1280, 1280, 1294, 1294,
 
-     1219, 1219, 1219, 1219, 1219, 1219, 1226, 1226, 1226, 1226,
-     1226, 1226, 1226, 1226, 1226, 1390, 1679,  232, 1226, 1380,
-      231, 1684, 1693, 1226, 1226, 1226, 1226, 1226, 1226, 1236,
-     1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1684, 1693,
-     1679, 1236,  230, 1684, 1693, 1696, 1236, 1236, 1236, 1236,
-     1236, 1236, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249,
-     1249,  229, 1696,  228, 1249,  227,  225, 1701, 1702, 1249,
-     1249, 1249, 1249, 1249, 1249, 1263, 1263, 1263, 1263, 1263,
-     1263, 1263, 1263, 1263, 1701, 1702, 1696, 1263,  223,  221,
-     1702,  220, 1263, 1263, 1263, 1263, 1263, 1263, 1277, 1277,
+     1294, 1294, 1294, 1294, 1294, 1294, 1294, 1724, 1725,  267,
+     1294,  265, 1724, 1725, 1730, 1294, 1294, 1294, 1294, 1294,
+     1294, 1308, 1308, 1308, 1308, 1308, 1308, 1308, 1308, 1308,
+      260, 1730,  257, 1308,  255,  254, 1730, 1731, 1308, 1308,
+     1308, 1308, 1308, 1308, 1320, 1320, 1320, 1320, 1320, 1320,
+     1320, 1320, 1320,  252, 1731,  249, 1320,  245, 1731, 1733,
+     1735, 1320, 1320, 1320, 1320, 1320, 1320, 1348, 1348, 1348,
+     1348, 1348, 1348, 1348, 1348, 1348, 1733, 1735,  241, 1348,
+      239, 1348, 1735,  237, 1348, 1348, 1348, 1348, 1348, 1348,
+     1375, 1375, 1375, 1375, 1375, 1375, 1375, 1380, 1380, 1380,
 
-     1277, 1277, 1277, 1277, 1277, 1277, 1277,  218, 1701,  216,
-     1277,  215,  213, 1707, 1704, 1277, 1277, 1277, 1277, 1277,
-     1277, 1289, 1289, 1289, 1289, 1289, 1289, 1289, 1289, 1289,
-     1707, 1704,  210, 1289, 1704,  209, 1709, 1708, 1289, 1289,
-     1289, 1289, 1289, 1289, 1313, 1313, 1313, 1313, 1313, 1313,
-     1313, 1313, 1313, 1709, 1708,  208, 1313,  206, 1313, 1708,
-      204, 1313, 1313, 1313, 1313, 1313, 1313, 1363, 1363, 1363,
-     1363, 1363, 1363, 1363, 1369, 1369, 1369, 1369, 1369, 1369,
-     1369, 1381, 1484, 1313, 1317, 1317, 1317, 1317, 1317, 1317,
-     1317, 1317, 1317,  203,  200, 1381, 1317,  199,  197, 1484,
+     1380, 1380, 1380, 1380, 1416, 1425, 1348, 1352, 1352, 1352,
+     1352, 1352, 1352, 1352, 1352, 1352,  236,  234, 1416, 1352,
+      233,  232, 1425, 1739, 1352, 1352, 1352, 1352, 1352, 1352,
+     1355, 1355, 1355, 1355, 1355, 1355, 1355, 1355, 1355, 1425,
+     1739,  231, 1355, 1416,  230, 1740, 1738, 1355, 1355, 1355,
+     1355, 1355, 1355, 1358, 1358, 1358, 1358, 1358, 1358, 1358,
+     1358, 1358, 1740, 1738,  229, 1358, 1738,  228, 1745,  226,
+     1358, 1358, 1358, 1358, 1358, 1358, 1361, 1361, 1361, 1361,
+     1361, 1361, 1361, 1361, 1361, 1745, 1740,  224, 1361,  222,
+     1745, 1750, 1754, 1361, 1361, 1361, 1361, 1361, 1361, 1364,
 
-     1714, 1317, 1317, 1317, 1317, 1317, 1317, 1320, 1320, 1320,
-     1320, 1320, 1320, 1320, 1320, 1320, 1484, 1714,  196, 1320,
-     1381,  195, 1716, 1719, 1320, 1320, 1320, 1320, 1320, 1320,
-     1323, 1323, 1323, 1323, 1323, 1323, 1323, 1323, 1323, 1716,
-     1719,  194, 1323,  193,  192, 1720, 1721, 1323, 1323, 1323,
-     1323, 1323, 1323, 1326, 1326, 1326, 1326, 1326, 1326, 1326,
-     1326, 1326, 1720, 1721,  191, 1326,  190,  189, 1722,  188,
-     1326, 1326, 1326, 1326, 1326, 1326, 1329, 1329, 1329, 1329,
-     1329, 1329, 1329, 1329, 1329, 1722,  187,  186, 1329,  185,
-      184,  183,  182, 1329, 1329, 1329, 1329, 1329, 1329, 1334,
+     1364, 1364, 1364, 1364, 1364, 1364, 1364, 1364, 1750, 1754,
+      221, 1364,  219,  217, 1754, 1756, 1364, 1364, 1364, 1364,
+     1364, 1364, 1369, 1369, 1369, 1369, 1369, 1369, 1369, 1369,
+     1369,  216, 1756,  214, 1369,  211,  210,  209,  207, 1369,
+     1369, 1369, 1369, 1369, 1369, 1382, 1382, 1382, 1382, 1382,
+     1382, 1382, 1388, 1388, 1388, 1388, 1388, 1388, 1388, 1390,
+     1390, 1390, 1390, 1390, 1390, 1390, 1396, 1396, 1396, 1396,
+     1396, 1396, 1396, 1398, 1398, 1398, 1398, 1398, 1398, 1398,
+     1404, 1404, 1404, 1404, 1404, 1404, 1404, 1406, 1406, 1406,
+     1406, 1406, 1406, 1406, 1413, 1413, 1413, 1413, 1413, 1413,
 
-     1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334,  181,  180,
-      178, 1334,  177,  174,  173,  172, 1334, 1334, 1334, 1334,
-     1334, 1334, 1371, 1371, 1371, 1371, 1371, 1371, 1371, 1378,
-     1378, 1378, 1378, 1378, 1378, 1378, 1384, 1385, 1395, 1400,
-     1402, 1403, 1406, 1416, 1416, 1416, 1416, 1416, 1416, 1416,
-     1384, 1385, 1422,  171,  170, 1395, 1400, 1402, 1403, 1406,
-      169,  168,  167,  165,  162,  161, 1422, 1400, 1406, 1395,
-     1403, 1402, 1423, 1400, 1430, 1384, 1385, 1386, 1386, 1386,
-     1386, 1386, 1386, 1386, 1386, 1386, 1423,  160, 1430, 1386,
-      159, 1422,  156,  154, 1386, 1386, 1386, 1386, 1386, 1386,
+     1413, 1419, 1420, 1430, 1431, 1436, 1438, 1759, 1763, 1766,
+      205,  204, 1444, 1461, 1462, 1419, 1420, 1469, 1470, 1441,
+     1430, 1431, 1436, 1438, 1759, 1763, 1766, 1461, 1462, 1444,
+     1763, 1469, 1470, 1436, 1430, 1431, 1441, 1438, 1444, 1436,
+     1419, 1420, 1421, 1421, 1421, 1421, 1421, 1421, 1421, 1421,
+     1421, 1441, 1461, 1462, 1421,  201, 1469, 1470, 1765, 1421,
+     1421, 1421, 1421, 1421, 1421, 1446, 1446, 1446, 1446, 1446,
+     1446, 1446, 1446, 1446,  200, 1765,  198, 1446, 1765,  197,
+      196,  195, 1446, 1446, 1446, 1446, 1446, 1446, 1455, 1455,
+     1455, 1455, 1455, 1455, 1455, 1467, 1467, 1467, 1467, 1467,
 
-     1407, 1407, 1407, 1407, 1407, 1407, 1407, 1407, 1407,  145,
-      144, 1423, 1407, 1430,  143,  142, 1431, 1407, 1407, 1407,
-     1407, 1407, 1407, 1428, 1428, 1428, 1428, 1428, 1428, 1428,
-     1431, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1439, 1440,
-     1446, 1446, 1446, 1446, 1446, 1446, 1446, 1448, 1449,  141,
-      140,  139, 1439, 1440,  137, 1431, 1457, 1458,  135,  134,
-      132, 1448, 1449, 1455, 1455, 1455, 1455, 1455, 1455, 1455,
-     1457, 1458,  130,  128,  127,  126,  125, 1439, 1440, 1463,
-     1463, 1463, 1463, 1463, 1463, 1463, 1448, 1449, 1465, 1465,
-     1465, 1465, 1465, 1465, 1465, 1457, 1458, 1471, 1475, 1472,
+     1467, 1467, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1478,
+     1479, 1485, 1485, 1485, 1485, 1485, 1485, 1485, 1487, 1488,
+     1496, 1497,  194, 1478, 1479, 1494, 1494, 1494, 1494, 1494,
+     1494, 1494, 1487, 1488, 1496, 1497, 1502, 1502, 1502, 1502,
+     1502, 1502, 1502,  193, 1510, 1514, 1515,  192, 1478, 1479,
+     1504, 1504, 1504, 1504, 1504, 1504, 1504, 1487, 1488, 1496,
+     1497, 1510, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1522,
+     1510, 1525, 1524, 1514,  191,  190, 1515, 1526, 1527,  189,
+      188, 1516, 1517, 1518, 1519, 1520, 1522, 1538, 1525, 1524,
+     1516, 1517, 1518, 1519, 1526, 1527, 1539, 1522, 1524, 1520,
 
-     1480, 1476, 1477, 1478, 1479, 1482,  123,  122, 1485,  121,
-      120,  119,  118,  116, 1471, 1475, 1472, 1480, 1476, 1477,
-     1478, 1479, 1482, 1471, 1472, 1485, 1475, 1476, 1477, 1478,
-     1479, 1480, 1495, 1482, 1496,  114,  113, 1485, 1501, 1501,
-     1501, 1501, 1501, 1501, 1501,  112, 1495,  111, 1496, 1505,
-     1505, 1505, 1505, 1505, 1505, 1505, 1509, 1509, 1509, 1509,
-     1509, 1509, 1509, 1513, 1513, 1513, 1513, 1513, 1513, 1513,
-      110, 1495,  109, 1496, 1517, 1517, 1517, 1517, 1517, 1517,
-     1517, 1522, 1522, 1522, 1522, 1522, 1522, 1522, 1524, 1525,
-     1530, 1533, 1540, 1544, 1534, 1535, 1537, 1538, 1572, 1541,
+      187, 1538,  186,  185,  184, 1525,  183, 1527,  182,  181,
+     1539, 1526, 1544, 1544, 1544, 1544, 1544, 1544, 1544, 1548,
+     1548, 1548, 1548, 1548, 1548, 1548, 1538, 1552, 1552, 1552,
+     1552, 1552, 1552, 1552,  180, 1539, 1556, 1556, 1556, 1556,
+     1556, 1556, 1556, 1560, 1560, 1560, 1560, 1560, 1560, 1560,
+     1565, 1565, 1565, 1565, 1565, 1565, 1565, 1567, 1568, 1576,
+     1578, 1577, 1584, 1587, 1579, 1581, 1582, 1590,  178, 1585,
+     1588, 1567, 1568, 1693, 1621, 1629, 1576, 1578, 1577, 1584,
+     1587, 1579, 1581, 1582, 1590, 1576, 1585, 1588, 1584,  177,
+     1693, 1621, 1629, 1590, 1587, 1578, 1567, 1568, 1577, 1579,
 
-      108,  107, 1524, 1525, 1542, 1579, 1598, 1530, 1533, 1540,
-     1544, 1534, 1535, 1537, 1538, 1572, 1541, 1533, 1540, 1544,
-      106, 1542, 1579, 1598,  104,  103, 1530, 1524, 1525, 1534,
-     1535, 1537, 1572,   96, 1538, 1541,   95, 1598,   94, 1579,
-     1542, 1546, 1546, 1546, 1546, 1546, 1546, 1546, 1549, 1549,
-     1549, 1549, 1549, 1549, 1549, 1553, 1553, 1553, 1553, 1553,
-     1553, 1553, 1557, 1557, 1557, 1557, 1557, 1557, 1557, 1561,
-     1561, 1561, 1561, 1561, 1561, 1561, 1565, 1565, 1565, 1565,
-     1565, 1565, 1565, 1568, 1568, 1568, 1568, 1568, 1568, 1568,
-     1576,   92, 1577, 1578, 1581, 1583, 1585, 1585, 1585, 1585,
+     1581, 1629, 1693, 1582, 1621, 1585, 1588, 1593, 1593, 1593,
+     1593, 1593, 1593, 1593, 1596, 1596, 1596, 1596, 1596, 1596,
+     1596, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1604, 1604,
+     1604, 1604, 1604, 1604, 1604, 1608, 1608, 1608, 1608, 1608,
+     1608, 1608, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1615,
+     1615, 1615, 1615, 1615, 1615, 1615, 1619, 1624,  174, 1625,
+     1626, 1768, 1633, 1627, 1636, 1636, 1636, 1636, 1636, 1636,
+     1636, 1647,  173, 1619, 1624, 1624, 1625, 1626, 1768, 1633,
+     1627, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1647, 1648,
+     1619, 1649, 1624, 1650, 1657, 1625, 1626, 1627, 1633, 1651,
 
-     1585, 1585, 1585,   91, 1596, 1599, 1597, 1576, 1576, 1577,
-     1578, 1581, 1583, 1594, 1594, 1594, 1594, 1594, 1594, 1594,
-     1581, 1596, 1599, 1597, 1601, 1576, 1604, 1605, 1577, 1578,
-     1606, 1583, 1597, 1616, 1619, 1620, 1599, 1621,   88, 1622,
-     1596, 1601, 1624, 1604, 1605,   87,   86, 1606, 1632, 1625,
-     1616, 1619, 1620, 1605, 1621, 1601, 1622,   85, 1634, 1624,
-     1643, 1606, 1604, 1620, 1636, 1632, 1625, 1621, 1637, 1616,
-     1638, 1639, 1619, 1622, 1632, 1634, 1634, 1643, 1624, 1625,
-       84, 1636, 1641, 1645, 1650, 1637, 1649, 1638, 1639, 1652,
-     1651, 1643, 1654, 1634, 1634, 1656,   83, 1636, 1636, 1641,
+     1653, 1656, 1658,  172, 1659, 1669, 1648, 1647, 1649, 1671,
+     1650, 1657, 1672,  171,  170, 1648, 1651, 1653, 1656, 1658,
+     1657, 1659, 1669, 1673, 1650, 1649, 1671, 1674, 1675, 1672,
+     1651, 1653, 1659, 1658, 1676, 1678, 1679, 1656,  169, 1688,
+     1673, 1669, 1690,  168, 1674, 1675, 1692, 1671,  167,  165,
+     1672, 1676, 1678, 1679,  162, 1674, 1688, 1695, 1675, 1690,
+     1690, 1673,  161, 1692, 1696, 1688, 1679, 1697, 1676, 1699,
+     1703, 1678, 1706, 1701, 1695, 1709, 1710, 1690, 1690, 1692,
+     1692, 1696, 1712, 1714, 1697,  160, 1699, 1703, 1711, 1706,
+     1701, 1695, 1709, 1710,  159, 1713, 1716, 1706, 1696, 1712,
 
-     1645, 1650, 1637, 1649, 1638, 1639, 1652, 1651, 1653, 1654,
-     1650, 1651, 1656,   82, 1657, 1658, 1641, 1660, 1661,   81,
-     1645, 1662, 1649, 1651, 1651, 1653, 1654, 1652, 1665, 1667,
-     1656, 1657, 1658, 1658, 1660, 1661, 1653,   80, 1662, 1666,
-     1668,   79, 1671, 1675, 1673, 1665, 1667, 1676, 1657, 1661,
-     1658,   77, 1680, 1660, 1665,   76, 1666, 1668, 1662, 1671,
-     1675, 1673, 1681, 1667, 1676, 1682,   75, 1685, 1666, 1680,
-     1683, 1686, 1668, 1671, 1673, 1675, 1687,   74,   73, 1681,
-     1688, 1676, 1682, 1680, 1685,   72,   71, 1683, 1686,   70,
-     1690, 1691, 1692, 1687, 1681, 1681, 1694, 1688, 1683, 1697,
+     1714, 1697, 1710, 1699, 1701, 1711,  156, 1703, 1718, 1711,
+     1719, 1709, 1713, 1716,  154, 1721, 1722, 1714, 1723, 1727,
+     1712, 1711, 1711, 1713, 1726, 1718, 1728, 1719, 1719, 1729,
+      145, 1716, 1721, 1722,  144, 1723, 1727, 1732,  143, 1734,
+     1736, 1726, 1718, 1728,  142, 1719, 1729, 1722, 1727, 1737,
+     1726, 1721,  141, 1741, 1732, 1723, 1734, 1736, 1742, 1743,
+     1728, 1729, 1746, 1747, 1744, 1748, 1737,  140, 1732, 1734,
+     1741, 1752, 1736,  139,  137, 1742, 1743,  135, 1749, 1746,
+     1747, 1744, 1748, 1737, 1741, 1751, 1753,  134, 1752, 1757,
+     1742, 1742, 1744, 1755, 1747, 1749, 1746, 1743,  132, 1752,
 
-     1699, 1685, 1686, 1682, 1700,   69, 1688, 1690, 1691, 1692,
-     1703, 1706, 1687, 1694, 1710, 1711, 1697, 1699, 1713, 1691,
-     1690, 1700, 1694, 1715, 1712, 1717,   68, 1703, 1706, 1692,
-       67, 1710, 1711, 1697,   66, 1713, 1699,   65,   64, 1700,
-     1715, 1712, 1717,   62, 1703,   61,   60, 1706,   47, 1710,
-     1712, 1711,   40,   39, 1718,   37, 1713, 1718, 1718, 1715,
-       15, 1717,   13,   10,    7,    3,    0,    0,    0,    0,
-        0, 1718, 1724,    0, 1724, 1725,    0, 1725, 1725, 1725,
-     1725, 1725, 1725, 1726,    0, 1726, 1727, 1727, 1727, 1728,
-     1728, 1728, 1729, 1729, 1729, 1730, 1730, 1730, 1731, 1731,
+     1758, 1748, 1751, 1753, 1749, 1760, 1757, 1761, 1762, 1764,
+     1755, 1767, 1770,  130, 1769, 1751, 1771, 1758, 1772, 1755,
+     1773, 1774, 1760, 1753, 1761, 1762, 1764, 1775, 1767, 1770,
+     1757, 1769,  128, 1771, 1758, 1772, 1769, 1773, 1774, 1776,
+     1777, 1760, 1761, 1764, 1775, 1778, 1773, 1767, 1780, 1762,
+     1781, 1771, 1782, 1783, 1772,  127, 1776, 1777,  126, 1774,
+     1779,  125, 1778, 1779, 1779, 1780,  123, 1781,  122, 1782,
+     1783,  121,  120,  119,  118, 1776,  116, 1779,  114,  113,
+      112, 1778, 1785,  111, 1785, 1786,  110, 1786, 1786, 1786,
+     1786, 1786, 1786, 1787,  109, 1787, 1788, 1788, 1788, 1789,
 
-     1731, 1732, 1732, 1732, 1733, 1733, 1733, 1734, 1734, 1734,
-     1735, 1735, 1735, 1736,    0, 1736, 1737, 1737, 1737, 1738,
-     1738, 1738, 1739, 1739, 1739, 1740, 1740, 1740, 1741,    0,
-     1741, 1742, 1742, 1742, 1743, 1743,    0,    0, 1743, 1744,
-     1744, 1744, 1745, 1745, 1745, 1746, 1746, 1746, 1747, 1747,
-     1747, 1748, 1748, 1748, 1749, 1749, 1749, 1750, 1750, 1750,
-     1751, 1751, 1751, 1752, 1752, 1752, 1753, 1753,    0,    0,
-     1753, 1754, 1754, 1754, 1755, 1755, 1755, 1756,    0, 1756,
-     1757, 1757, 1757, 1758, 1758, 1758, 1759,    0, 1759, 1760,
-     1760, 1760, 1761, 1761, 1761, 1762, 1762, 1762, 1763, 1763,
+     1789, 1789, 1790, 1790, 1790, 1791, 1791, 1791, 1792, 1792,
+     1792, 1793, 1793, 1793, 1794, 1794, 1794, 1795, 1795, 1795,
+     1796, 1796, 1796, 1797,  108, 1797, 1798, 1798, 1798, 1799,
+     1799, 1799, 1800, 1800, 1800, 1801, 1801, 1801, 1802,  107,
+     1802, 1803, 1803, 1803, 1804, 1804,  106,  104, 1804, 1805,
+     1805, 1805, 1806, 1806, 1806, 1807, 1807, 1807, 1808, 1808,
+     1808, 1809, 1809, 1809, 1810, 1810, 1810, 1811, 1811, 1811,
+     1812, 1812, 1812, 1813, 1813, 1813, 1814, 1814,  103,   96,
+     1814, 1815, 1815, 1815, 1816, 1816, 1816, 1817,   95, 1817,
+     1818, 1818, 1818, 1819, 1819, 1819, 1820,   94, 1820, 1821,
 
-     1763, 1764, 1764, 1764, 1765,    0, 1765, 1766,    0, 1766,
-     1767, 1767, 1767, 1768, 1768, 1768, 1769,    0, 1769, 1770,
-     1770,    0,    0, 1770, 1771, 1771,    0,    0, 1771, 1772,
-     1772, 1772, 1773, 1773, 1773, 1774, 1774,    0, 1774, 1775,
-     1775, 1775, 1776, 1776, 1776, 1777, 1777, 1777, 1778, 1778,
-     1778, 1779, 1779, 1779, 1780, 1780, 1780, 1781, 1781, 1781,
-     1782, 1782,    0,    0, 1782, 1783, 1783, 1783, 1784, 1784,
-     1784, 1785, 1785,    0, 1785, 1786, 1786,    0,    0, 1786,
-     1787, 1787,    0, 1787, 1788, 1788, 1789, 1789,    0,    0,
-     1789, 1790, 1790, 1790, 1791, 1791, 1791, 1792, 1792,    0,
+     1821, 1821, 1822, 1822, 1822, 1823, 1823, 1823, 1824, 1824,
+     1824, 1825, 1825, 1825, 1826,   91, 1826, 1827,   88, 1827,
+     1828, 1828, 1828, 1829, 1829, 1829, 1830,   87, 1830, 1831,
+     1831,   86,   85, 1831, 1832, 1832,   84,   83, 1832, 1833,
+     1833, 1833, 1834, 1834, 1834, 1835, 1835,   82, 1835, 1836,
+     1836, 1836, 1837, 1837, 1837, 1838, 1838, 1838, 1839, 1839,
+     1839, 1840, 1840, 1840, 1841, 1841, 1841, 1842, 1842, 1842,
+     1843, 1843,   81,   80, 1843, 1844, 1844, 1844, 1845, 1845,
+     1845, 1846, 1846,   79, 1846, 1847, 1847,   77,   76, 1847,
+     1848, 1848,   75, 1848, 1849, 1849, 1850, 1850,   74,   73,
 
-     1792, 1793,    0, 1793, 1794,    0, 1794, 1795, 1795, 1795,
-     1796, 1796, 1796, 1797,    0, 1797, 1798, 1798, 1798, 1799,
-     1799, 1799, 1800, 1800, 1800, 1801, 1801, 1801, 1802, 1802,
-     1802, 1803, 1803, 1803, 1804,    0, 1804, 1805,    0, 1805,
-     1806, 1806, 1806, 1807, 1807, 1807, 1808,    0, 1808, 1809,
-        0, 1809, 1810,    0, 1810, 1811, 1811, 1811, 1812, 1812,
-     1812, 1813,    0, 1813, 1814,    0,    0, 1814, 1815, 1815,
-        0, 1815, 1816, 1816,    0,    0, 1816, 1817, 1817,    0,
-     1817, 1818, 1818, 1819, 1819,    0,    0, 1819, 1820, 1820,
-     1820, 1821, 1821, 1821, 1822, 1822,    0, 1822, 1823, 1823,
+     1850, 1851, 1851, 1851, 1852, 1852, 1852, 1853, 1853,   72,
+     1853, 1854,   71, 1854, 1855,   70, 1855, 1856, 1856, 1856,
+     1857, 1857, 1857, 1858,   69, 1858, 1859, 1859, 1859, 1860,
+     1860, 1860, 1861, 1861, 1861, 1862, 1862, 1862, 1863, 1863,
+     1863, 1864, 1864, 1864, 1865,   68, 1865, 1866,   67, 1866,
+     1867, 1867, 1867, 1868, 1868, 1868, 1869,   66, 1869, 1870,
+       65, 1870, 1871,   64, 1871, 1872, 1872, 1872, 1873, 1873,
+     1873, 1874,   62, 1874, 1875,   61,   60, 1875, 1876, 1876,
+       47, 1876, 1877, 1877,   40,   39, 1877, 1878, 1878,   37,
+     1878, 1879, 1879, 1880, 1880,   15,   13, 1880, 1881, 1881,
 
-     1823,    0, 1823, 1823, 1824, 1824, 1824, 1825, 1825, 1825,
-     1826, 1826, 1826, 1827, 1827, 1827, 1828, 1828, 1828, 1829,
-     1829, 1829, 1830, 1830, 1830, 1831, 1831, 1831, 1832, 1832,
-        0,    0, 1832, 1833, 1833, 1833, 1834, 1834, 1834, 1835,
-     1835,    0, 1835, 1836, 1836,    0,    0, 1836, 1837, 1837,
-        0, 1837, 1838, 1838, 1839, 1839,    0,    0, 1839, 1840,
-     1840, 1840, 1841, 1841, 1841, 1842, 1842,    0, 1842, 1843,
-        0,    0, 1843, 1844, 1844,    0, 1844, 1845, 1845,    0,
-        0, 1845, 1846, 1846,    0, 1846, 1847, 1847, 1848, 1848,
-        0,    0, 1848, 1849, 1849, 1849, 1850, 1850, 1850, 1851,
+     1881, 1882, 1882, 1882, 1883, 1883,   10, 1883, 1884, 1884,
+     1884,    7, 1884, 1884, 1885, 1885, 1885, 1886, 1886, 1886,
+     1887, 1887, 1887, 1888, 1888, 1888, 1889, 1889, 1889, 1890,
+     1890, 1890, 1891, 1891, 1891, 1892, 1892, 1892, 1893, 1893,
+        3,    0, 1893, 1894, 1894, 1894, 1895, 1895, 1895, 1896,
+     1896,    0, 1896, 1897, 1897,    0,    0, 1897, 1898, 1898,
+        0, 1898, 1899, 1899, 1900, 1900,    0,    0, 1900, 1901,
+     1901, 1901, 1902, 1902, 1902, 1903, 1903,    0, 1903, 1904,
+        0,    0, 1904, 1905, 1905,    0, 1905, 1906, 1906,    0,
+        0, 1906, 1907, 1907,    0, 1907, 1908, 1908, 1909, 1909,
 
-     1851,    0, 1851, 1852,    0, 1852, 1853,    0, 1853, 1854,
-        0, 1854, 1855, 1855, 1855, 1856, 1856, 1856, 1857,    0,
-     1857, 1858, 1858, 1858,    0, 1858, 1858, 1859, 1859, 1859,
-     1860, 1860, 1860, 1861, 1861, 1861, 1862, 1862, 1862, 1863,
-     1863, 1863, 1864, 1864, 1864, 1865, 1865, 1865, 1866,    0,
-     1866, 1867,    0, 1867, 1868, 1868, 1868, 1869, 1869, 1869,
-     1870,    0, 1870, 1871,    0, 1871, 1872,    0, 1872, 1873,
-     1873, 1873, 1874, 1874, 1874, 1875,    0, 1875, 1876,    0,
-     1876, 1877,    0, 1877, 1878,    0, 1878, 1879, 1879, 1879,
-     1880, 1880, 1880, 1881,    0, 1881, 1882,    0, 1882, 1883,
+        0,    0, 1909, 1910, 1910, 1910, 1911, 1911, 1911, 1912,
+     1912,    0, 1912, 1913,    0, 1913, 1914,    0, 1914, 1915,
+        0, 1915, 1916, 1916, 1916, 1917, 1917, 1917, 1918,    0,
+     1918, 1919, 1919, 1919,    0, 1919, 1919, 1920, 1920, 1920,
+     1921, 1921, 1921, 1922, 1922, 1922, 1923, 1923, 1923, 1924,
+     1924, 1924, 1925, 1925, 1925, 1926, 1926, 1926, 1927,    0,
+     1927, 1928,    0, 1928, 1929, 1929, 1929, 1930, 1930, 1930,
+     1931,    0, 1931, 1932,    0, 1932, 1933,    0, 1933, 1934,
+     1934, 1934, 1935, 1935, 1935, 1936,    0, 1936, 1937,    0,
+     1937, 1938,    0, 1938, 1939,    0, 1939, 1940, 1940, 1940,
 
-        0,    0, 1883, 1884, 1884,    0, 1884, 1885, 1885,    0,
-        0, 1885, 1886, 1886,    0, 1886, 1887, 1887, 1888, 1888,
-        0,    0, 1888, 1889, 1889, 1889, 1890, 1890, 1890, 1891,
-     1891,    0, 1891, 1892, 1892, 1892,    0, 1892, 1892, 1893,
-     1893, 1893, 1894, 1894, 1894, 1895, 1895, 1895, 1896, 1896,
-     1896, 1897, 1897, 1897, 1898, 1898, 1898, 1899, 1899, 1899,
-     1900, 1900, 1900, 1901, 1901,    0,    0, 1901, 1902, 1902,
-     1902, 1903, 1903, 1903, 1904, 1904,    0, 1904, 1905, 1905,
-        0,    0, 1905, 1906, 1906,    0, 1906, 1907, 1907, 1908,
-     1908,    0,    0, 1908, 1909, 1909, 1909, 1910, 1910, 1910,
+     1941, 1941, 1941, 1942,    0, 1942, 1943,    0, 1943, 1944,
+        0,    0, 1944, 1945, 1945,    0, 1945, 1946, 1946,    0,
+        0, 1946, 1947, 1947,    0, 1947, 1948, 1948, 1949, 1949,
+        0,    0, 1949, 1950, 1950, 1950, 1951, 1951, 1951, 1952,
+     1952,    0, 1952, 1953, 1953, 1953,    0, 1953, 1953, 1954,
+     1954, 1954, 1955, 1955, 1955, 1956, 1956, 1956, 1957, 1957,
+     1957, 1958, 1958, 1958, 1959, 1959, 1959, 1960, 1960, 1960,
+     1961, 1961, 1961, 1962, 1962,    0,    0, 1962, 1963, 1963,
+     1963, 1964, 1964, 1964, 1965, 1965,    0, 1965, 1966, 1966,
+        0,    0, 1966, 1967, 1967,    0, 1967, 1968, 1968, 1969,
 
-     1911, 1911,    0, 1911, 1912,    0,    0, 1912, 1913, 1913,
-        0, 1913, 1914, 1914,    0,    0, 1914, 1915, 1915,    0,
-     1915, 1916, 1916, 1917, 1917,    0,    0, 1917, 1918, 1918,
-     1918, 1919, 1919, 1919, 1920, 1920,    0, 1920, 1921,    0,
-     1921, 1922,    0,    0, 1922, 1923, 1923,    0, 1923, 1924,
-     1924,    0,    0, 1924, 1925, 1925,    0, 1925, 1926, 1926,
-     1927, 1927,    0,    0, 1927, 1928, 1928, 1928, 1929, 1929,
-     1929, 1930, 1930,    0, 1930, 1931,    0, 1931, 1932,    0,
-     1932, 1933,    0, 1933, 1934, 1934, 1934, 1935, 1935, 1935,
-     1936,    0, 1936, 1937, 1937, 1937,    0, 1937, 1937, 1938,
+     1969,    0,    0, 1969, 1970, 1970, 1970, 1971, 1971, 1971,
+     1972, 1972,    0, 1972, 1973,    0,    0, 1973, 1974, 1974,
+        0, 1974, 1975, 1975,    0,    0, 1975, 1976, 1976,    0,
+     1976, 1977, 1977, 1978, 1978,    0,    0, 1978, 1979, 1979,
+     1979, 1980, 1980, 1980, 1981, 1981,    0, 1981, 1982,    0,
+     1982, 1983,    0,    0, 1983, 1984, 1984,    0, 1984, 1985,
+     1985,    0,    0, 1985, 1986, 1986,    0, 1986, 1987, 1987,
+     1988, 1988,    0,    0, 1988, 1989, 1989, 1989, 1990, 1990,
+     1990, 1991, 1991,    0, 1991, 1992,    0, 1992, 1993,    0,
+     1993, 1994,    0, 1994, 1995, 1995, 1995, 1996, 1996, 1996,
 
-     1938, 1938, 1939, 1939, 1939, 1940, 1940, 1940, 1941, 1941,
-     1941, 1942, 1942, 1942, 1943, 1943, 1943, 1944, 1944, 1944,
-     1945, 1945, 1945, 1946, 1946, 1946, 1947, 1947, 1947, 1948,
-        0, 1948, 1949,    0, 1949, 1950, 1950, 1950, 1951, 1951,
-     1951, 1952, 1952, 1952, 1953,    0, 1953, 1954,    0, 1954,
-     1955,    0, 1955, 1956, 1956, 1956, 1957, 1957, 1957, 1958,
-     1958, 1958, 1959,    0, 1959, 1960,    0, 1960, 1961,    0,
-     1961, 1962,    0, 1962, 1963, 1963, 1963, 1964, 1964, 1964,
-     1965, 1965, 1965, 1966,    0, 1966, 1967,    0, 1967, 1968,
-        0, 1968, 1969,    0, 1969, 1970, 1970, 1970, 1971, 1971,
+     1997,    0, 1997, 1998, 1998, 1998,    0, 1998, 1998, 1999,
+     1999, 1999, 2000, 2000, 2000, 2001, 2001, 2001, 2002, 2002,
+     2002, 2003, 2003, 2003, 2004, 2004, 2004, 2005, 2005, 2005,
+     2006, 2006, 2006, 2007, 2007, 2007, 2008, 2008, 2008, 2009,
+        0, 2009, 2010,    0, 2010, 2011, 2011, 2011, 2012, 2012,
+     2012, 2013, 2013, 2013, 2014,    0, 2014, 2015,    0, 2015,
+     2016,    0, 2016, 2017, 2017, 2017, 2018, 2018, 2018, 2019,
+     2019, 2019, 2020,    0, 2020, 2021,    0, 2021, 2022,    0,
+     2022, 2023,    0, 2023, 2024, 2024, 2024, 2025, 2025, 2025,
+     2026, 2026, 2026, 2027,    0, 2027, 2028,    0, 2028, 2029,
 
-     1971, 1972, 1972, 1972, 1973,    0, 1973, 1974,    0, 1974,
-     1975,    0,    0, 1975, 1976, 1976,    0, 1976, 1977, 1977,
-        0,    0, 1977, 1978, 1978,    0, 1978, 1979, 1979, 1980,
-     1980,    0,    0, 1980, 1981, 1981, 1981, 1982, 1982, 1982,
-     1983, 1983,    0, 1983, 1984, 1984, 1984,    0, 1984, 1984,
-     1985, 1985, 1985, 1986, 1986, 1986, 1987, 1987, 1987, 1988,
-     1988, 1988, 1989, 1989, 1989, 1990, 1990, 1990, 1991, 1991,
-     1991, 1992, 1992, 1992, 1993,    0, 1993, 1994, 1994, 1994,
-     1995, 1995,    0,    0, 1995, 1996, 1996, 1996, 1997, 1997,
-     1997, 1998, 1998,    0, 1998, 1999, 1999,    0,    0, 1999,
+        0, 2029, 2030,    0, 2030, 2031, 2031, 2031, 2032, 2032,
+     2032, 2033, 2033, 2033, 2034,    0, 2034, 2035,    0, 2035,
+     2036,    0,    0, 2036, 2037, 2037,    0, 2037, 2038, 2038,
+        0,    0, 2038, 2039, 2039,    0, 2039, 2040, 2040, 2041,
+     2041,    0,    0, 2041, 2042, 2042, 2042, 2043, 2043, 2043,
+     2044, 2044,    0, 2044, 2045, 2045, 2045,    0, 2045, 2045,
+     2046, 2046, 2046, 2047, 2047, 2047, 2048, 2048, 2048, 2049,
+     2049, 2049, 2050, 2050, 2050, 2051, 2051, 2051, 2052, 2052,
+     2052, 2053, 2053, 2053, 2054,    0, 2054, 2055, 2055, 2055,
+     2056, 2056,    0,    0, 2056, 2057, 2057, 2057, 2058, 2058,
 
-     2000, 2000,    0, 2000, 2001, 2001, 2002, 2002,    0,    0,
-     2002, 2003, 2003, 2003, 2004, 2004, 2004, 2005, 2005,    0,
-     2005, 2006,    0,    0, 2006, 2007, 2007,    0, 2007, 2008,
-     2008,    0,    0, 2008, 2009, 2009,    0, 2009, 2010, 2010,
-     2011, 2011,    0,    0, 2011, 2012, 2012, 2012, 2013, 2013,
-     2013, 2014, 2014,    0, 2014, 2015,    0, 2015, 2016,    0,
-        0, 2016, 2017, 2017,    0, 2017, 2018, 2018,    0,    0,
-     2018, 2019, 2019,    0, 2019, 2020, 2020, 2021, 2021,    0,
-        0, 2021, 2022, 2022, 2022, 2023, 2023, 2023, 2024, 2024,
-        0, 2024, 2025,    0, 2025, 2026,    0,    0, 2026, 2027,
+     2058, 2059, 2059,    0, 2059, 2060, 2060,    0,    0, 2060,
+     2061, 2061,    0, 2061, 2062, 2062, 2063, 2063,    0,    0,
+     2063, 2064, 2064, 2064, 2065, 2065, 2065, 2066, 2066,    0,
+     2066, 2067,    0,    0, 2067, 2068, 2068,    0, 2068, 2069,
+     2069,    0,    0, 2069, 2070, 2070,    0, 2070, 2071, 2071,
+     2072, 2072,    0,    0, 2072, 2073, 2073, 2073, 2074, 2074,
+     2074, 2075, 2075,    0, 2075, 2076,    0, 2076, 2077,    0,
+        0, 2077, 2078, 2078,    0, 2078, 2079, 2079,    0,    0,
+     2079, 2080, 2080,    0, 2080, 2081, 2081, 2082, 2082,    0,
+        0, 2082, 2083, 2083, 2083, 2084, 2084, 2084, 2085, 2085,
 
-     2027,    0, 2027, 2028, 2028,    0,    0, 2028, 2029, 2029,
-        0, 2029, 2030, 2030, 2031, 2031,    0,    0, 2031, 2032,
-     2032, 2032, 2033, 2033, 2033, 2034, 2034,    0, 2034, 2035,
-        0, 2035, 2036,    0, 2036, 2037,    0, 2037, 2038, 2038,
-     2038, 2039,    0, 2039, 2040, 2040, 2040, 2041,    0, 2041,
-     2042, 2042, 2042,    0, 2042, 2042, 2043,    0, 2043, 2044,
-     2044, 2044, 2045,    0, 2045, 2046, 2046, 2046, 2047,    0,
-     2047, 2048, 2048, 2048, 2049,    0, 2049, 2050, 2050, 2050,
-     2051,    0, 2051, 2052, 2052, 2052, 2053,    0, 2053, 2054,
-     2054, 2054, 2055, 2055,    0,    0, 2055, 2056, 2056, 2056,
+        0, 2085, 2086,    0, 2086, 2087,    0,    0, 2087, 2088,
+     2088,    0, 2088, 2089, 2089,    0,    0, 2089, 2090, 2090,
+        0, 2090, 2091, 2091, 2092, 2092,    0,    0, 2092, 2093,
+     2093, 2093, 2094, 2094, 2094, 2095, 2095,    0, 2095, 2096,
+        0, 2096, 2097,    0, 2097, 2098,    0, 2098, 2099, 2099,
+     2099, 2100,    0, 2100, 2101, 2101, 2101, 2102,    0, 2102,
+     2103, 2103, 2103,    0, 2103, 2103, 2104,    0, 2104, 2105,
+     2105, 2105, 2106,    0, 2106, 2107, 2107, 2107, 2108,    0,
+     2108, 2109, 2109, 2109, 2110,    0, 2110, 2111, 2111, 2111,
+     2112,    0, 2112, 2113, 2113, 2113, 2114,    0, 2114, 2115,
 
-     2057, 2057, 2057, 2058, 2058, 2058, 2059, 2059,    0, 2059,
-     2060, 2060, 2060, 2061,    0, 2061, 2062, 2062, 2062, 2063,
-     2063, 2063, 2064,    0, 2064, 2065,    0, 2065, 2066, 2066,
-     2066, 2067, 2067, 2067, 2068,    0, 2068, 2069,    0, 2069,
-     2070,    0, 2070, 2071, 2071, 2071, 2072, 2072, 2072, 2073,
-        0, 2073, 2074,    0, 2074, 2075,    0, 2075, 2076, 2076,
-     2076, 2077, 2077, 2077, 2078,    0, 2078, 2079,    0, 2079,
-     2080,    0, 2080, 2081, 2081, 2081, 2082, 2082, 2082, 2083,
-        0, 2083, 2084,    0,    0, 2084, 2085, 2085,    0, 2085,
-     2086, 2086,    0,    0, 2086, 2087, 2087,    0, 2087, 2088,
+     2115, 2115, 2116, 2116,    0,    0, 2116, 2117, 2117, 2117,
+     2118, 2118, 2118, 2119, 2119, 2119, 2120, 2120,    0, 2120,
+     2121, 2121, 2121, 2122,    0, 2122, 2123, 2123, 2123, 2124,
+     2124, 2124, 2125,    0, 2125, 2126,    0, 2126, 2127, 2127,
+     2127, 2128, 2128, 2128, 2129,    0, 2129, 2130,    0, 2130,
+     2131,    0, 2131, 2132, 2132, 2132, 2133, 2133, 2133, 2134,
+        0, 2134, 2135,    0, 2135, 2136,    0, 2136, 2137, 2137,
+     2137, 2138, 2138, 2138, 2139,    0, 2139, 2140,    0, 2140,
+     2141,    0, 2141, 2142, 2142, 2142, 2143, 2143, 2143, 2144,
+        0, 2144, 2145,    0,    0, 2145, 2146, 2146,    0, 2146,
 
-     2088, 2089, 2089,    0,    0, 2089, 2090, 2090, 2090, 2091,
-        0, 2091, 2092, 2092,    0, 2092, 2093, 2093, 2093,    0,
-     2093, 2093, 2094, 2094, 2094, 2095, 2095, 2095, 2096,    0,
-     2096, 2097,    0, 2097, 2098,    0, 2098, 2099,    0, 2099,
-     2100,    0, 2100, 2101,    0, 2101, 2102,    0, 2102, 2103,
-     2103, 2103, 2104, 2104, 2104, 2105,    0, 2105, 2106, 2106,
-        0,    0, 2106, 2107, 2107,    0, 2107, 2108, 2108, 2109,
-        0, 2109, 2110,    0,    0, 2110, 2111, 2111,    0, 2111,
-     2112, 2112,    0,    0, 2112, 2113, 2113,    0, 2113, 2114,
-     2114, 2115,    0, 2115, 2116,    0, 2116, 2117,    0,    0,
+     2147, 2147,    0,    0, 2147, 2148, 2148,    0, 2148, 2149,
+     2149, 2150, 2150,    0,    0, 2150, 2151, 2151, 2151, 2152,
+        0, 2152, 2153, 2153,    0, 2153, 2154, 2154, 2154,    0,
+     2154, 2154, 2155, 2155, 2155, 2156, 2156, 2156, 2157,    0,
+     2157, 2158,    0, 2158, 2159,    0, 2159, 2160,    0, 2160,
+     2161,    0, 2161, 2162,    0, 2162, 2163,    0, 2163, 2164,
+     2164, 2164, 2165, 2165, 2165, 2166,    0, 2166, 2167, 2167,
+        0,    0, 2167, 2168, 2168,    0, 2168, 2169, 2169, 2170,
+        0, 2170, 2171,    0,    0, 2171, 2172, 2172,    0, 2172,
+     2173, 2173,    0,    0, 2173, 2174, 2174,    0, 2174, 2175,
 
-     2117, 2118, 2118,    0, 2118, 2119, 2119,    0,    0, 2119,
-     2120, 2120,    0, 2120, 2121, 2121, 2122,    0, 2122, 2123,
-        0, 2123, 2124,    0,    0, 2124, 2125, 2125,    0, 2125,
-     2126, 2126,    0,    0, 2126, 2127, 2127,    0, 2127, 2128,
-     2128, 2129,    0, 2129, 2130,    0, 2130, 2131,    0,    0,
-     2131, 2132, 2132,    0, 2132, 2133, 2133,    0,    0, 2133,
-     2134, 2134,    0, 2134, 2135, 2135, 2136,    0, 2136, 2137,
-        0, 2137, 2138,    0, 2138, 2139,    0, 2139, 2140, 2140,
-     2140, 2141,    0, 2141, 2142, 2142, 2142,    0, 2142, 2142,
-     2143,    0, 2143, 2144,    0, 2144, 2145,    0, 2145, 2146,
+     2175, 2176,    0, 2176, 2177,    0, 2177, 2178,    0,    0,
+     2178, 2179, 2179,    0, 2179, 2180, 2180,    0,    0, 2180,
+     2181, 2181,    0, 2181, 2182, 2182, 2183,    0, 2183, 2184,
+        0, 2184, 2185,    0,    0, 2185, 2186, 2186,    0, 2186,
+     2187, 2187,    0,    0, 2187, 2188, 2188,    0, 2188, 2189,
+     2189, 2190,    0, 2190, 2191,    0, 2191, 2192,    0,    0,
+     2192, 2193, 2193,    0, 2193, 2194, 2194,    0,    0, 2194,
+     2195, 2195,    0, 2195, 2196, 2196, 2197,    0, 2197, 2198,
+        0, 2198, 2199,    0, 2199, 2200,    0, 2200, 2201, 2201,
+     2201, 2202,    0, 2202, 2203, 2203, 2203,    0, 2203, 2203,
 
-        0, 2146, 2147,    0, 2147, 2148,    0, 2148, 2149,    0,
-     2149, 2150, 2150,    0,    0, 2150, 2151, 2151,    0, 2151,
-     2152, 2152, 2153,    0, 2153, 2154,    0, 2154, 2155,    0,
-     2155, 2156,    0, 2156, 2157,    0, 2157, 2158,    0, 2158,
-     2159,    0, 2159, 2160,    0, 2160, 2161,    0, 2161, 2162,
-        0, 2162, 2163,    0,    0, 2163, 2164, 2164,    0,    0,
-     2164, 2165,    0, 2165, 2166,    0, 2166, 2167,    0, 2167,
-     2168,    0,    0, 2168, 2169,    0,    0, 2169, 2170,    0,
-        0, 2170, 2171,    0,    0, 2171, 2172,    0,    0, 2172,
-     2173,    0, 2173, 2174,    0, 2174, 2175,    0,    0, 2175,
+     2204,    0, 2204, 2205,    0, 2205, 2206,    0, 2206, 2207,
+        0, 2207, 2208,    0, 2208, 2209,    0, 2209, 2210,    0,
+     2210, 2211, 2211,    0,    0, 2211, 2212, 2212,    0, 2212,
+     2213, 2213, 2214,    0, 2214, 2215,    0, 2215, 2216,    0,
+     2216, 2217,    0, 2217, 2218,    0, 2218, 2219,    0, 2219,
+     2220,    0, 2220, 2221,    0, 2221, 2222,    0, 2222, 2223,
+        0, 2223, 2224,    0,    0, 2224, 2225, 2225,    0,    0,
+     2225, 2226,    0, 2226, 2227,    0, 2227, 2228,    0, 2228,
+     2229,    0,    0, 2229, 2230,    0,    0, 2230, 2231,    0,
+        0, 2231, 2232,    0,    0, 2232, 2233,    0,    0, 2233,
 
-     2176,    0, 2176, 2177,    0, 2177, 2178,    0, 2178, 2179,
-        0, 2179, 2180,    0, 2180, 2181,    0,    0, 2181, 2182,
-        0, 2182, 2183,    0, 2183, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723,
-     1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723
+     2234,    0, 2234, 2235,    0, 2235, 2236,    0,    0, 2236,
+     2237,    0, 2237, 2238,    0, 2238, 2239,    0, 2239, 2240,
+        0, 2240, 2241,    0, 2241, 2242,    0,    0, 2242, 2243,
+        0, 2243, 2244,    0, 2244, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784,
+     1784, 1784, 1784, 1784, 1784, 1784, 1784, 1784
     } ;
 
 /* The intent behind this definition is that it'll catch
@@ -3048,7 +3099,7 @@
  * We want to generate code that can be used by a reentrant parser
  * generated by Bison or Berkeley YACC.
  */
-#line 67 "scanner.l"
+#line 74 "scanner.l"
 /*
  * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
  *	The Regents of the University of California.  All rights reserved.
@@ -3070,15 +3121,10 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#include <ctype.h>
 #include <string.h>
 
 #include "pcap-int.h"
 
-#include "gencode.h"
-
-#include "grammar.h"
-
 /*
  * Earlier versions of Flex don't declare these, so we declare them
  * ourselves to squelch warnings.
@@ -3132,16 +3178,15 @@
 #include "os-proto.h"
 #endif
 
-static int stoi(char *);
-static inline int xdtoi(int);
+static int stou(char *, YYSTYPE *, compiler_state_t *);
 
 /*
  * Disable diagnostics in the code generated by Flex.
  */
 DIAG_OFF_FLEX
 
-#line 3144 "scanner.c"
-#line 3145 "scanner.c"
+#line 3189 "scanner.c"
+#line 3190 "scanner.c"
 
 #define INITIAL 0
 
@@ -3411,9 +3456,9 @@
 		}
 
 	{
-#line 254 "scanner.l"
+#line 255 "scanner.l"
 
-#line 3417 "scanner.c"
+#line 3462 "scanner.c"
 
 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 		{
@@ -3440,13 +3485,13 @@
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 1724 )
+				if ( yy_current_state >= 1785 )
 					yy_c = yy_meta[yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 			++yy_cp;
 			}
-		while ( yy_current_state != 1723 );
+		while ( yy_current_state != 1784 );
 		yy_cp = yyg->yy_last_accepting_cpos;
 		yy_current_state = yyg->yy_last_accepting_state;
 
@@ -3468,629 +3513,634 @@
 
 case 1:
 YY_RULE_SETUP
-#line 255 "scanner.l"
+#line 256 "scanner.l"
 return DST;
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 256 "scanner.l"
+#line 257 "scanner.l"
 return SRC;
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 258 "scanner.l"
+#line 259 "scanner.l"
 return LINK;
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 259 "scanner.l"
+#line 260 "scanner.l"
 return LINK;
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 260 "scanner.l"
+#line 261 "scanner.l"
 return ARP;
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 261 "scanner.l"
+#line 262 "scanner.l"
 return RARP;
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 262 "scanner.l"
+#line 263 "scanner.l"
 return IP;
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 263 "scanner.l"
+#line 264 "scanner.l"
 return SCTP;
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 264 "scanner.l"
+#line 265 "scanner.l"
 return TCP;
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 265 "scanner.l"
+#line 266 "scanner.l"
 return UDP;
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 266 "scanner.l"
+#line 267 "scanner.l"
 return ICMP;
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 267 "scanner.l"
+#line 268 "scanner.l"
 return IGMP;
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 268 "scanner.l"
+#line 269 "scanner.l"
 return IGRP;
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 269 "scanner.l"
+#line 270 "scanner.l"
 return PIM;
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 270 "scanner.l"
+#line 271 "scanner.l"
 return VRRP;
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 271 "scanner.l"
+#line 272 "scanner.l"
 return CARP;
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 272 "scanner.l"
+#line 273 "scanner.l"
 return RADIO;
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 274 "scanner.l"
+#line 275 "scanner.l"
 return IPV6;
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 275 "scanner.l"
+#line 276 "scanner.l"
 return ICMPV6;
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 276 "scanner.l"
+#line 277 "scanner.l"
 return AH;
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 277 "scanner.l"
+#line 278 "scanner.l"
 return ESP;
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 279 "scanner.l"
+#line 280 "scanner.l"
 return ATALK;
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 280 "scanner.l"
+#line 281 "scanner.l"
 return AARP;
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 281 "scanner.l"
+#line 282 "scanner.l"
 return DECNET;
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 282 "scanner.l"
+#line 283 "scanner.l"
 return LAT;
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 283 "scanner.l"
+#line 284 "scanner.l"
 return SCA;
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 284 "scanner.l"
+#line 285 "scanner.l"
 return MOPRC;
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 285 "scanner.l"
+#line 286 "scanner.l"
 return MOPDL;
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 287 "scanner.l"
+#line 288 "scanner.l"
 return ISO;
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 288 "scanner.l"
+#line 289 "scanner.l"
 return ESIS;
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 289 "scanner.l"
+#line 290 "scanner.l"
 return ESIS;
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 290 "scanner.l"
+#line 291 "scanner.l"
 return ISIS;
 	YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 291 "scanner.l"
+#line 292 "scanner.l"
 return ISIS;
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 292 "scanner.l"
+#line 293 "scanner.l"
 return L1;
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 293 "scanner.l"
+#line 294 "scanner.l"
 return L2;
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 294 "scanner.l"
+#line 295 "scanner.l"
 return IIH;
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 295 "scanner.l"
+#line 296 "scanner.l"
 return LSP;
 	YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 296 "scanner.l"
+#line 297 "scanner.l"
 return SNP;
 	YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 297 "scanner.l"
+#line 298 "scanner.l"
 return CSNP;
 	YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 298 "scanner.l"
+#line 299 "scanner.l"
 return PSNP;
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 300 "scanner.l"
+#line 301 "scanner.l"
 return CLNP;
 	YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 302 "scanner.l"
+#line 303 "scanner.l"
 return STP;
 	YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 304 "scanner.l"
+#line 305 "scanner.l"
 return IPX;
 	YY_BREAK
 case 44:
 YY_RULE_SETUP
-#line 306 "scanner.l"
+#line 307 "scanner.l"
 return NETBEUI;
 	YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 308 "scanner.l"
+#line 309 "scanner.l"
 return HOST;
 	YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 309 "scanner.l"
+#line 310 "scanner.l"
 return NET;
 	YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 310 "scanner.l"
+#line 311 "scanner.l"
 return NETMASK;
 	YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 311 "scanner.l"
+#line 312 "scanner.l"
 return PORT;
 	YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 312 "scanner.l"
+#line 313 "scanner.l"
 return PORTRANGE;
 	YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 313 "scanner.l"
+#line 314 "scanner.l"
 return PROTO;
 	YY_BREAK
 case 51:
 YY_RULE_SETUP
-#line 314 "scanner.l"
+#line 315 "scanner.l"
 return PROTOCHAIN;
 	YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 316 "scanner.l"
+#line 317 "scanner.l"
 return GATEWAY;
 	YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 318 "scanner.l"
+#line 319 "scanner.l"
 return TYPE;
 	YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 319 "scanner.l"
+#line 320 "scanner.l"
 return SUBTYPE;
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 320 "scanner.l"
+#line 321 "scanner.l"
 return DIR;
 	YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 321 "scanner.l"
+#line 322 "scanner.l"
 return ADDR1;
 	YY_BREAK
 case 57:
 YY_RULE_SETUP
-#line 322 "scanner.l"
+#line 323 "scanner.l"
 return ADDR2;
 	YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 323 "scanner.l"
+#line 324 "scanner.l"
 return ADDR3;
 	YY_BREAK
 case 59:
 YY_RULE_SETUP
-#line 324 "scanner.l"
+#line 325 "scanner.l"
 return ADDR4;
 	YY_BREAK
 case 60:
 YY_RULE_SETUP
-#line 325 "scanner.l"
+#line 326 "scanner.l"
 return RA;
 	YY_BREAK
 case 61:
 YY_RULE_SETUP
-#line 326 "scanner.l"
+#line 327 "scanner.l"
 return TA;
 	YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 328 "scanner.l"
+#line 329 "scanner.l"
 return LESS;
 	YY_BREAK
 case 63:
 YY_RULE_SETUP
-#line 329 "scanner.l"
+#line 330 "scanner.l"
 return GREATER;
 	YY_BREAK
 case 64:
 YY_RULE_SETUP
-#line 330 "scanner.l"
+#line 331 "scanner.l"
 return CBYTE;
 	YY_BREAK
 case 65:
 YY_RULE_SETUP
-#line 331 "scanner.l"
+#line 332 "scanner.l"
 return TK_BROADCAST;
 	YY_BREAK
 case 66:
 YY_RULE_SETUP
-#line 332 "scanner.l"
+#line 333 "scanner.l"
 return TK_MULTICAST;
 	YY_BREAK
 case 67:
 YY_RULE_SETUP
-#line 334 "scanner.l"
+#line 335 "scanner.l"
 return AND;
 	YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 335 "scanner.l"
+#line 336 "scanner.l"
 return OR;
 	YY_BREAK
 case 69:
 YY_RULE_SETUP
-#line 336 "scanner.l"
+#line 337 "scanner.l"
 return '!';
 	YY_BREAK
 case 70:
 YY_RULE_SETUP
-#line 338 "scanner.l"
+#line 339 "scanner.l"
 return LEN;
 	YY_BREAK
 case 71:
 YY_RULE_SETUP
-#line 339 "scanner.l"
+#line 340 "scanner.l"
 return INBOUND;
 	YY_BREAK
 case 72:
 YY_RULE_SETUP
-#line 340 "scanner.l"
+#line 341 "scanner.l"
 return OUTBOUND;
 	YY_BREAK
 case 73:
 YY_RULE_SETUP
-#line 342 "scanner.l"
-return VLAN;
+#line 343 "scanner.l"
+return IFINDEX;
 	YY_BREAK
 case 74:
 YY_RULE_SETUP
-#line 343 "scanner.l"
-return MPLS;
+#line 345 "scanner.l"
+return VLAN;
 	YY_BREAK
 case 75:
 YY_RULE_SETUP
-#line 344 "scanner.l"
-return PPPOED;
+#line 346 "scanner.l"
+return MPLS;
 	YY_BREAK
 case 76:
 YY_RULE_SETUP
-#line 345 "scanner.l"
-return PPPOES;
+#line 347 "scanner.l"
+return PPPOED;
 	YY_BREAK
 case 77:
 YY_RULE_SETUP
-#line 346 "scanner.l"
-return GENEVE;
+#line 348 "scanner.l"
+return PPPOES;
 	YY_BREAK
 case 78:
 YY_RULE_SETUP
-#line 348 "scanner.l"
-return LANE;
+#line 349 "scanner.l"
+return GENEVE;
 	YY_BREAK
 case 79:
 YY_RULE_SETUP
-#line 349 "scanner.l"
-return LLC;
+#line 351 "scanner.l"
+return LANE;
 	YY_BREAK
 case 80:
 YY_RULE_SETUP
-#line 350 "scanner.l"
-return METAC;
+#line 352 "scanner.l"
+return LLC;
 	YY_BREAK
 case 81:
 YY_RULE_SETUP
-#line 351 "scanner.l"
-return BCC;
+#line 353 "scanner.l"
+return METAC;
 	YY_BREAK
 case 82:
 YY_RULE_SETUP
-#line 352 "scanner.l"
-return OAM;
+#line 354 "scanner.l"
+return BCC;
 	YY_BREAK
 case 83:
 YY_RULE_SETUP
-#line 353 "scanner.l"
-return OAMF4;
+#line 355 "scanner.l"
+return OAM;
 	YY_BREAK
 case 84:
 YY_RULE_SETUP
-#line 354 "scanner.l"
-return OAMF4EC;
+#line 356 "scanner.l"
+return OAMF4;
 	YY_BREAK
 case 85:
 YY_RULE_SETUP
-#line 355 "scanner.l"
-return OAMF4SC;
+#line 357 "scanner.l"
+return OAMF4EC;
 	YY_BREAK
 case 86:
 YY_RULE_SETUP
-#line 356 "scanner.l"
-return SC;
+#line 358 "scanner.l"
+return OAMF4SC;
 	YY_BREAK
 case 87:
 YY_RULE_SETUP
-#line 357 "scanner.l"
-return ILMIC;
+#line 359 "scanner.l"
+return SC;
 	YY_BREAK
 case 88:
 YY_RULE_SETUP
-#line 358 "scanner.l"
-return VPI;
+#line 360 "scanner.l"
+return ILMIC;
 	YY_BREAK
 case 89:
 YY_RULE_SETUP
-#line 359 "scanner.l"
-return VCI;
+#line 361 "scanner.l"
+return VPI;
 	YY_BREAK
 case 90:
 YY_RULE_SETUP
-#line 360 "scanner.l"
-return CONNECTMSG;
+#line 362 "scanner.l"
+return VCI;
 	YY_BREAK
 case 91:
 YY_RULE_SETUP
-#line 361 "scanner.l"
-return METACONNECT;
+#line 363 "scanner.l"
+return CONNECTMSG;
 	YY_BREAK
 case 92:
 YY_RULE_SETUP
-#line 363 "scanner.l"
-return PF_IFNAME;
+#line 364 "scanner.l"
+return METACONNECT;
 	YY_BREAK
 case 93:
 YY_RULE_SETUP
-#line 364 "scanner.l"
-return PF_RSET;
+#line 366 "scanner.l"
+return PF_IFNAME;
 	YY_BREAK
 case 94:
 YY_RULE_SETUP
-#line 365 "scanner.l"
-return PF_RNR;
+#line 367 "scanner.l"
+return PF_RSET;
 	YY_BREAK
 case 95:
 YY_RULE_SETUP
-#line 366 "scanner.l"
-return PF_SRNR;
+#line 368 "scanner.l"
+return PF_RNR;
 	YY_BREAK
 case 96:
 YY_RULE_SETUP
-#line 367 "scanner.l"
-return PF_REASON;
+#line 369 "scanner.l"
+return PF_SRNR;
 	YY_BREAK
 case 97:
 YY_RULE_SETUP
-#line 368 "scanner.l"
-return PF_ACTION;
+#line 370 "scanner.l"
+return PF_REASON;
 	YY_BREAK
 case 98:
 YY_RULE_SETUP
-#line 370 "scanner.l"
-return FISU;
+#line 371 "scanner.l"
+return PF_ACTION;
 	YY_BREAK
 case 99:
 YY_RULE_SETUP
-#line 371 "scanner.l"
-return LSSU;
+#line 373 "scanner.l"
+return FISU;
 	YY_BREAK
 case 100:
 YY_RULE_SETUP
-#line 372 "scanner.l"
+#line 374 "scanner.l"
 return LSSU;
 	YY_BREAK
 case 101:
 YY_RULE_SETUP
-#line 373 "scanner.l"
-return MSU;
+#line 375 "scanner.l"
+return LSSU;
 	YY_BREAK
 case 102:
 YY_RULE_SETUP
-#line 374 "scanner.l"
-return HFISU;
+#line 376 "scanner.l"
+return MSU;
 	YY_BREAK
 case 103:
 YY_RULE_SETUP
-#line 375 "scanner.l"
-return HLSSU;
+#line 377 "scanner.l"
+return HFISU;
 	YY_BREAK
 case 104:
 YY_RULE_SETUP
-#line 376 "scanner.l"
-return HMSU;
+#line 378 "scanner.l"
+return HLSSU;
 	YY_BREAK
 case 105:
 YY_RULE_SETUP
-#line 377 "scanner.l"
-return SIO;
+#line 379 "scanner.l"
+return HMSU;
 	YY_BREAK
 case 106:
 YY_RULE_SETUP
-#line 378 "scanner.l"
-return OPC;
+#line 380 "scanner.l"
+return SIO;
 	YY_BREAK
 case 107:
 YY_RULE_SETUP
-#line 379 "scanner.l"
-return DPC;
+#line 381 "scanner.l"
+return OPC;
 	YY_BREAK
 case 108:
 YY_RULE_SETUP
-#line 380 "scanner.l"
-return SLS;
+#line 382 "scanner.l"
+return DPC;
 	YY_BREAK
 case 109:
 YY_RULE_SETUP
-#line 381 "scanner.l"
-return HSIO;
+#line 383 "scanner.l"
+return SLS;
 	YY_BREAK
 case 110:
 YY_RULE_SETUP
-#line 382 "scanner.l"
-return HOPC;
+#line 384 "scanner.l"
+return HSIO;
 	YY_BREAK
 case 111:
 YY_RULE_SETUP
-#line 383 "scanner.l"
-return HDPC;
+#line 385 "scanner.l"
+return HOPC;
 	YY_BREAK
 case 112:
 YY_RULE_SETUP
-#line 384 "scanner.l"
-return HSLS;
+#line 386 "scanner.l"
+return HDPC;
 	YY_BREAK
 case 113:
-/* rule 113 can match eol */
-YY_RULE_SETUP
-#line 386 "scanner.l"
-;
-	YY_BREAK
-case 114:
 YY_RULE_SETUP
 #line 387 "scanner.l"
-return yytext[0];
+return HSLS;
+	YY_BREAK
+case 114:
+/* rule 114 can match eol */
+YY_RULE_SETUP
+#line 389 "scanner.l"
+;
 	YY_BREAK
 case 115:
 YY_RULE_SETUP
-#line 388 "scanner.l"
-return GEQ;
+#line 390 "scanner.l"
+return yytext[0];
 	YY_BREAK
 case 116:
 YY_RULE_SETUP
-#line 389 "scanner.l"
-return LEQ;
+#line 391 "scanner.l"
+return GEQ;
 	YY_BREAK
 case 117:
 YY_RULE_SETUP
-#line 390 "scanner.l"
-return NEQ;
+#line 392 "scanner.l"
+return LEQ;
 	YY_BREAK
 case 118:
 YY_RULE_SETUP
-#line 391 "scanner.l"
-return '=';
+#line 393 "scanner.l"
+return NEQ;
 	YY_BREAK
 case 119:
 YY_RULE_SETUP
-#line 392 "scanner.l"
-return LSH;
+#line 394 "scanner.l"
+return '=';
 	YY_BREAK
 case 120:
 YY_RULE_SETUP
-#line 393 "scanner.l"
-return RSH;
+#line 395 "scanner.l"
+return LSH;
 	YY_BREAK
 case 121:
 YY_RULE_SETUP
-#line 394 "scanner.l"
-{ yylval->s = sdup(yyextra, yytext); return AID; }
+#line 396 "scanner.l"
+return RSH;
 	YY_BREAK
 case 122:
 YY_RULE_SETUP
-#line 395 "scanner.l"
-{ yylval->s = sdup(yyextra, yytext); return EID; }
+#line 397 "scanner.l"
+{ yylval->s = sdup(yyextra, yytext); return AID; }
 	YY_BREAK
 case 123:
 YY_RULE_SETUP
-#line 396 "scanner.l"
-{ yylval->i = stoi((char *)yytext); return NUM; }
+#line 398 "scanner.l"
+{ yylval->s = sdup(yyextra, yytext); return EID; }
 	YY_BREAK
 case 124:
 YY_RULE_SETUP
-#line 397 "scanner.l"
-{
-			yylval->s = sdup(yyextra, (char *)yytext); return HID; }
+#line 399 "scanner.l"
+{ return stou(yytext, yylval, yyextra); }
 	YY_BREAK
 case 125:
 YY_RULE_SETUP
-#line 399 "scanner.l"
+#line 400 "scanner.l"
+{
+			yylval->s = sdup(yyextra, (char *)yytext); return HID; }
+	YY_BREAK
+case 126:
+YY_RULE_SETUP
+#line 402 "scanner.l"
 {
 #ifdef INET6
 			  struct addrinfo hints, *res;
@@ -4111,298 +4161,318 @@
 			  return HID6;
 			}
 	YY_BREAK
-case 126:
-YY_RULE_SETUP
-#line 418 "scanner.l"
-{ bpf_set_error(yyextra, "bogus ethernet address %s", yytext); yylval->s = NULL; return EID; }
-	YY_BREAK
 case 127:
 YY_RULE_SETUP
-#line 419 "scanner.l"
-{ yylval->i = 0; return NUM; }
+#line 421 "scanner.l"
+{ bpf_set_error(yyextra, "bogus ethernet address %s", yytext); yylval->s = NULL; return EID; }
 	YY_BREAK
 case 128:
 YY_RULE_SETUP
-#line 420 "scanner.l"
-{ yylval->i = 1; return NUM; }
+#line 422 "scanner.l"
+{ yylval->h = 0; return NUM; }
 	YY_BREAK
 case 129:
 YY_RULE_SETUP
-#line 421 "scanner.l"
-{ yylval->i = 0; return NUM; }
+#line 423 "scanner.l"
+{ yylval->h = 1; return NUM; }
 	YY_BREAK
 case 130:
 YY_RULE_SETUP
-#line 422 "scanner.l"
-{ yylval->i = 3; return NUM; }
+#line 424 "scanner.l"
+{ yylval->h = 0; return NUM; }
 	YY_BREAK
 case 131:
 YY_RULE_SETUP
-#line 423 "scanner.l"
-{ yylval->i = 4; return NUM; }
+#line 425 "scanner.l"
+{ yylval->h = 3; return NUM; }
 	YY_BREAK
 case 132:
 YY_RULE_SETUP
-#line 424 "scanner.l"
-{ yylval->i = 5; return NUM; }
+#line 426 "scanner.l"
+{ yylval->h = 4; return NUM; }
 	YY_BREAK
 case 133:
 YY_RULE_SETUP
-#line 425 "scanner.l"
-{ yylval->i = 8; return NUM; }
+#line 427 "scanner.l"
+{ yylval->h = 5; return NUM; }
 	YY_BREAK
 case 134:
 YY_RULE_SETUP
-#line 426 "scanner.l"
-{ yylval->i = 9; return NUM; }
+#line 428 "scanner.l"
+{ yylval->h = 8; return NUM; }
 	YY_BREAK
 case 135:
 YY_RULE_SETUP
-#line 427 "scanner.l"
-{ yylval->i = 10; return NUM; }
+#line 429 "scanner.l"
+{ yylval->h = 9; return NUM; }
 	YY_BREAK
 case 136:
 YY_RULE_SETUP
-#line 428 "scanner.l"
-{ yylval->i = 11; return NUM; }
+#line 430 "scanner.l"
+{ yylval->h = 10; return NUM; }
 	YY_BREAK
 case 137:
 YY_RULE_SETUP
-#line 429 "scanner.l"
-{ yylval->i = 12; return NUM; }
+#line 431 "scanner.l"
+{ yylval->h = 11; return NUM; }
 	YY_BREAK
 case 138:
 YY_RULE_SETUP
-#line 430 "scanner.l"
-{ yylval->i = 13; return NUM; }
+#line 432 "scanner.l"
+{ yylval->h = 12; return NUM; }
 	YY_BREAK
 case 139:
 YY_RULE_SETUP
-#line 431 "scanner.l"
-{ yylval->i = 14; return NUM; }
+#line 433 "scanner.l"
+{ yylval->h = 13; return NUM; }
 	YY_BREAK
 case 140:
 YY_RULE_SETUP
-#line 432 "scanner.l"
-{ yylval->i = 15; return NUM; }
+#line 434 "scanner.l"
+{ yylval->h = 14; return NUM; }
 	YY_BREAK
 case 141:
 YY_RULE_SETUP
-#line 433 "scanner.l"
-{ yylval->i = 16; return NUM; }
+#line 435 "scanner.l"
+{ yylval->h = 15; return NUM; }
 	YY_BREAK
 case 142:
 YY_RULE_SETUP
-#line 434 "scanner.l"
-{ yylval->i = 17; return NUM; }
+#line 436 "scanner.l"
+{ yylval->h = 16; return NUM; }
 	YY_BREAK
 case 143:
 YY_RULE_SETUP
-#line 435 "scanner.l"
-{ yylval->i = 18; return NUM; }
+#line 437 "scanner.l"
+{ yylval->h = 17; return NUM; }
 	YY_BREAK
 case 144:
 YY_RULE_SETUP
-#line 437 "scanner.l"
-{ yylval->i = 0; return NUM; }
+#line 438 "scanner.l"
+{ yylval->h = 18; return NUM; }
 	YY_BREAK
 case 145:
 YY_RULE_SETUP
-#line 438 "scanner.l"
-{ yylval->i = 1; return NUM; }
+#line 440 "scanner.l"
+{ yylval->h = 0; return NUM; }
 	YY_BREAK
 case 146:
 YY_RULE_SETUP
-#line 440 "scanner.l"
-{ yylval->i = 128; return NUM; }
+#line 441 "scanner.l"
+{ yylval->h = 1; return NUM; }
 	YY_BREAK
 case 147:
 YY_RULE_SETUP
-#line 441 "scanner.l"
-{ yylval->i = 129; return NUM; }
+#line 443 "scanner.l"
+{ yylval->h = 1; return NUM; }
 	YY_BREAK
 case 148:
 YY_RULE_SETUP
-#line 442 "scanner.l"
-{ yylval->i = 130; return NUM; }
+#line 444 "scanner.l"
+{ yylval->h = 2; return NUM; }
 	YY_BREAK
 case 149:
 YY_RULE_SETUP
-#line 443 "scanner.l"
-{ yylval->i = 131; return NUM; }
+#line 445 "scanner.l"
+{ yylval->h = 3; return NUM; }
 	YY_BREAK
 case 150:
 YY_RULE_SETUP
-#line 444 "scanner.l"
-{ yylval->i = 132; return NUM; }
+#line 446 "scanner.l"
+{ yylval->h = 4; return NUM; }
 	YY_BREAK
 case 151:
 YY_RULE_SETUP
-#line 445 "scanner.l"
-{ yylval->i = 133; return NUM; }
+#line 447 "scanner.l"
+{ yylval->h = 128; return NUM; }
 	YY_BREAK
 case 152:
 YY_RULE_SETUP
-#line 446 "scanner.l"
-{ yylval->i = 134; return NUM; }
+#line 448 "scanner.l"
+{ yylval->h = 129; return NUM; }
 	YY_BREAK
 case 153:
 YY_RULE_SETUP
-#line 447 "scanner.l"
-{ yylval->i = 135; return NUM; }
+#line 449 "scanner.l"
+{ yylval->h = 130; return NUM; }
 	YY_BREAK
 case 154:
 YY_RULE_SETUP
-#line 448 "scanner.l"
-{ yylval->i = 136; return NUM; }
+#line 450 "scanner.l"
+{ yylval->h = 131; return NUM; }
 	YY_BREAK
 case 155:
 YY_RULE_SETUP
-#line 449 "scanner.l"
-{ yylval->i = 137; return NUM; }
+#line 451 "scanner.l"
+{ yylval->h = 132; return NUM; }
 	YY_BREAK
 case 156:
 YY_RULE_SETUP
-#line 450 "scanner.l"
-{ yylval->i = 138; return NUM; }
+#line 452 "scanner.l"
+{ yylval->h = 133; return NUM; }
 	YY_BREAK
 case 157:
 YY_RULE_SETUP
-#line 451 "scanner.l"
-{ yylval->i = 139; return NUM; }
+#line 453 "scanner.l"
+{ yylval->h = 134; return NUM; }
 	YY_BREAK
 case 158:
 YY_RULE_SETUP
-#line 452 "scanner.l"
-{ yylval->i = 140; return NUM; }
+#line 454 "scanner.l"
+{ yylval->h = 135; return NUM; }
 	YY_BREAK
 case 159:
 YY_RULE_SETUP
-#line 453 "scanner.l"
-{ yylval->i = 141; return NUM; }
+#line 455 "scanner.l"
+{ yylval->h = 136; return NUM; }
 	YY_BREAK
 case 160:
 YY_RULE_SETUP
-#line 454 "scanner.l"
-{ yylval->i = 142; return NUM; }
+#line 456 "scanner.l"
+{ yylval->h = 137; return NUM; }
 	YY_BREAK
 case 161:
 YY_RULE_SETUP
-#line 455 "scanner.l"
-{ yylval->i = 143; return NUM; }
+#line 457 "scanner.l"
+{ yylval->h = 138; return NUM; }
 	YY_BREAK
 case 162:
 YY_RULE_SETUP
-#line 456 "scanner.l"
-{ yylval->i = 144; return NUM; }
+#line 458 "scanner.l"
+{ yylval->h = 139; return NUM; }
 	YY_BREAK
 case 163:
 YY_RULE_SETUP
-#line 457 "scanner.l"
-{ yylval->i = 145; return NUM; }
+#line 459 "scanner.l"
+{ yylval->h = 140; return NUM; }
 	YY_BREAK
 case 164:
 YY_RULE_SETUP
-#line 458 "scanner.l"
-{ yylval->i = 146; return NUM; }
+#line 460 "scanner.l"
+{ yylval->h = 141; return NUM; }
 	YY_BREAK
 case 165:
 YY_RULE_SETUP
-#line 459 "scanner.l"
-{ yylval->i = 147; return NUM; }
+#line 461 "scanner.l"
+{ yylval->h = 142; return NUM; }
 	YY_BREAK
 case 166:
 YY_RULE_SETUP
-#line 460 "scanner.l"
-{ yylval->i = 148; return NUM; }
+#line 462 "scanner.l"
+{ yylval->h = 143; return NUM; }
 	YY_BREAK
 case 167:
 YY_RULE_SETUP
-#line 461 "scanner.l"
-{ yylval->i = 149; return NUM; }
+#line 463 "scanner.l"
+{ yylval->h = 144; return NUM; }
 	YY_BREAK
 case 168:
 YY_RULE_SETUP
-#line 462 "scanner.l"
-{ yylval->i = 151; return NUM; }
+#line 464 "scanner.l"
+{ yylval->h = 145; return NUM; }
 	YY_BREAK
 case 169:
 YY_RULE_SETUP
-#line 463 "scanner.l"
-{ yylval->i = 152; return NUM; }
+#line 465 "scanner.l"
+{ yylval->h = 146; return NUM; }
 	YY_BREAK
 case 170:
 YY_RULE_SETUP
-#line 464 "scanner.l"
-{ yylval->i = 153; return NUM; }
+#line 466 "scanner.l"
+{ yylval->h = 147; return NUM; }
 	YY_BREAK
 case 171:
 YY_RULE_SETUP
-#line 466 "scanner.l"
-{ yylval->i = 13; return NUM; }
+#line 467 "scanner.l"
+{ yylval->h = 148; return NUM; }
 	YY_BREAK
 case 172:
 YY_RULE_SETUP
-#line 467 "scanner.l"
-{ yylval->i = 0x01; return NUM; }
+#line 468 "scanner.l"
+{ yylval->h = 149; return NUM; }
 	YY_BREAK
 case 173:
 YY_RULE_SETUP
-#line 468 "scanner.l"
-{ yylval->i = 0x02; return NUM; }
+#line 469 "scanner.l"
+{ yylval->h = 151; return NUM; }
 	YY_BREAK
 case 174:
 YY_RULE_SETUP
-#line 469 "scanner.l"
-{ yylval->i = 0x04; return NUM; }
+#line 470 "scanner.l"
+{ yylval->h = 152; return NUM; }
 	YY_BREAK
 case 175:
 YY_RULE_SETUP
-#line 470 "scanner.l"
-{ yylval->i = 0x08; return NUM; }
+#line 471 "scanner.l"
+{ yylval->h = 153; return NUM; }
 	YY_BREAK
 case 176:
 YY_RULE_SETUP
-#line 471 "scanner.l"
-{ yylval->i = 0x10; return NUM; }
+#line 473 "scanner.l"
+{ yylval->h = 13; return NUM; }
 	YY_BREAK
 case 177:
 YY_RULE_SETUP
-#line 472 "scanner.l"
-{ yylval->i = 0x20; return NUM; }
+#line 474 "scanner.l"
+{ yylval->h = 0x01; return NUM; }
 	YY_BREAK
 case 178:
 YY_RULE_SETUP
-#line 473 "scanner.l"
-{ yylval->i = 0x40; return NUM; }
+#line 475 "scanner.l"
+{ yylval->h = 0x02; return NUM; }
 	YY_BREAK
 case 179:
 YY_RULE_SETUP
-#line 474 "scanner.l"
-{ yylval->i = 0x80; return NUM; }
+#line 476 "scanner.l"
+{ yylval->h = 0x04; return NUM; }
 	YY_BREAK
 case 180:
 YY_RULE_SETUP
-#line 475 "scanner.l"
-{
-			 yylval->s = sdup(yyextra, (char *)yytext); return ID; }
+#line 477 "scanner.l"
+{ yylval->h = 0x08; return NUM; }
 	YY_BREAK
 case 181:
 YY_RULE_SETUP
-#line 477 "scanner.l"
-{ yylval->s = sdup(yyextra, (char *)yytext + 1); return ID; }
+#line 478 "scanner.l"
+{ yylval->h = 0x10; return NUM; }
 	YY_BREAK
 case 182:
 YY_RULE_SETUP
-#line 478 "scanner.l"
-{ return LEX_ERROR; }
+#line 479 "scanner.l"
+{ yylval->h = 0x20; return NUM; }
 	YY_BREAK
 case 183:
 YY_RULE_SETUP
-#line 479 "scanner.l"
+#line 480 "scanner.l"
+{ yylval->h = 0x40; return NUM; }
+	YY_BREAK
+case 184:
+YY_RULE_SETUP
+#line 481 "scanner.l"
+{ yylval->h = 0x80; return NUM; }
+	YY_BREAK
+case 185:
+YY_RULE_SETUP
+#line 482 "scanner.l"
+{
+			 yylval->s = sdup(yyextra, (char *)yytext); return ID; }
+	YY_BREAK
+case 186:
+YY_RULE_SETUP
+#line 484 "scanner.l"
+{ yylval->s = sdup(yyextra, (char *)yytext + 1); return ID; }
+	YY_BREAK
+case 187:
+YY_RULE_SETUP
+#line 485 "scanner.l"
+{ return LEX_ERROR; }
+	YY_BREAK
+case 188:
+YY_RULE_SETUP
+#line 486 "scanner.l"
 ECHO;
 	YY_BREAK
-#line 4406 "scanner.c"
+#line 4476 "scanner.c"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -4702,7 +4772,7 @@
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 1724 )
+			if ( yy_current_state >= 1785 )
 				yy_c = yy_meta[yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -4731,11 +4801,11 @@
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 1724 )
+		if ( yy_current_state >= 1785 )
 			yy_c = yy_meta[yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-	yy_is_jam = (yy_current_state == 1723);
+	yy_is_jam = (yy_current_state == 1784);
 
 	(void)yyg;
 	return yy_is_jam ? 0 : yy_current_state;
@@ -5546,7 +5616,7 @@
 
 #define YYTABLES_NAME "yytables"
 
-#line 479 "scanner.l"
+#line 486 "scanner.l"
 
 
 /*
@@ -5554,41 +5624,111 @@
  */
 DIAG_ON_FLEX
 
-/* Hex digit to integer. */
-static inline int
-xdtoi(int c)
-{
-	if (isdigit(c))
-		return c - '0';
-	else if (islower(c))
-		return c - 'a' + 10;
-	else
-		return c - 'A' + 10;
-}
-
 /*
- * Convert string to integer.  Just like atoi(), but checks for
+ * Convert string to 32-bit unsigned integer.  Just like atoi(), but checks for
  * preceding 0x or 0 and uses hex or octal instead of decimal.
+ *
+ * On success, sets yylval->h to the value and returns NUM.
+ * On failure, sets the BPF error string and returns LEX_ERROR, to force
+ * the parse to stop.
  */
 static int
-stoi(char *s)
+stou(char *yytext_arg, YYSTYPE *yylval_arg, compiler_state_t *yyextra_arg)
 {
-	int base = 10;
-	int n = 0;
+	bpf_u_int32 n = 0;
+	unsigned int digit;
+	char *s = yytext_arg;
 
+	/*
+	 * yytext_arg is guaranteed either to be a string of decimal digits
+	 * or 0[xX] followed by a string of hex digits.
+	 */
 	if (*s == '0') {
 		if (s[1] == 'x' || s[1] == 'X') {
-			s += 2;
-			base = 16;
-		}
-		else {
-			base = 8;
+			/*
+			 * Begins with 0x or 0X, so hex.
+			 * Guaranteed to be all hex digits following the
+			 * prefix, so anything that's not 0-9 or a-f is
+			 * A-F.
+			 */
+			s += 2;	/* skip the prefix */
+			while ((digit = *s++) != '\0') {
+				if (digit >= '0' && digit <= '9')
+					digit = digit - '0';
+				else if (digit >= 'a' && digit <= 'f')
+					digit = digit - 'a' + 10;
+				else
+					digit = digit - 'A' + 10;
+
+				/*
+				 * Check for overflow.
+				 */
+				if (n > 0xFFFFFFFU) {
+					/*
+					 * We have more than 28 bits of
+					 * number, and are about to
+					 * add 4 more; that won't fit
+					 * in 32 bits.
+					 */
+					bpf_set_error(yyextra_arg,
+					    "number %s overflows 32 bits",
+					    yytext_arg);
+					return LEX_ERROR;
+				}
+				n = (n << 4) + digit;
+			}
+		} else {
+			/*
+			 * Begins with 0, but not 0x or 0X, so octal.
+			 * Guaranteed to be all *decimal* digits following
+			 * the prefix, so we need to catch 8 and 9 and
+			 * report an error.
+			 */
 			s += 1;
+			while ((digit = *s++) != '\0') {
+				if (digit >= '0' && digit <= '7')
+					digit = digit - '0';
+				else {
+					bpf_set_error(yyextra_arg,
+					    "number %s contains non-octal digit",
+					    yytext_arg);
+					return LEX_ERROR;
+				}
+				if (n > 03777777777U) {
+					/*
+					 * We have more than 29 bits of
+					 * number, and are about to add
+					 * 3 more; that won't fit in
+					 * 32 bits.
+					 */
+					bpf_set_error(yyextra_arg,
+					    "number %s overflows 32 bits",
+					    yytext_arg);
+					return LEX_ERROR;
+				}
+				n = (n << 3) + digit;
+			}
+		}
+	} else {
+		/*
+		 * Decimal.
+		 */
+		while ((digit = *s++) != '\0') {
+			digit = digit - '0';
+#define CUTOFF_DEC	(0xFFFFFFFFU / 10U)
+#define CUTLIM_DEC	(0xFFFFFFFFU % 10U)
+			if (n > CUTOFF_DEC ||
+			    (n == CUTOFF_DEC && digit > CUTLIM_DEC)) {
+				bpf_set_error(yyextra_arg,
+				    "number %s overflows 32 bits",
+				    yytext_arg);
+				return LEX_ERROR;
+			}
+			n = (n * 10) + digit;
 		}
 	}
-	while (*s)
-		n = n * base + xdtoi(*s++);
 
-	return n;
+	yylval_arg->h = n;
+	return NUM;
 }
 
diff --git a/scanner.h b/scanner.h
index 8efc470..9f406ed 100644
--- a/scanner.h
+++ b/scanner.h
@@ -28,9 +28,16 @@
  */
 #include <pcap/pcap-inttypes.h>
 
+/*
+ * grammar.h requires gencode.h and sometimes breaks in a polluted namespace
+ * (see ftmacros.h), so include it early.
+ */
+#include "gencode.h"
+#include "grammar.h"
+
 #include "diag-control.h"
 
-#line 34 "scanner.h"
+#line 41 "scanner.h"
 
 #define  YY_INT_ALIGNED short int
 
@@ -736,9 +743,9 @@
 #undef yyTABLES_NAME
 #endif
 
-#line 479 "scanner.l"
+#line 486 "scanner.l"
 
 
-#line 743 "scanner.h"
+#line 750 "scanner.h"
 #undef pcap_IN_HEADER
 #endif /* pcap_HEADER_H */
diff --git a/scanner.l b/scanner.l
index 06b9acc..85fe395 100644
--- a/scanner.l
+++ b/scanner.l
@@ -24,6 +24,13 @@
  */
 #include <pcap/pcap-inttypes.h>
 
+/*
+ * grammar.h requires gencode.h and sometimes breaks in a polluted namespace
+ * (see ftmacros.h), so include it early.
+ */
+#include "gencode.h"
+#include "grammar.h"
+
 #include "diag-control.h"
 }
 
@@ -89,10 +96,6 @@
 
 #include "pcap-int.h"
 
-#include "gencode.h"
-
-#include "grammar.h"
-
 /*
  * Earlier versions of Flex don't declare these, so we declare them
  * ourselves to squelch warnings.
diff --git a/sf-pcap.c b/sf-pcap.c
index d8443e9..4294933 100644
--- a/sf-pcap.c
+++ b/sf-pcap.c
@@ -46,6 +46,7 @@
 #include <limits.h> /* for INT_MAX */
 
 #include "pcap-int.h"
+#include "pcap-util.h"
 
 #include "pcap-common.h"
 
@@ -70,6 +71,10 @@
 
 /*
  * Standard libpcap format.
+ *
+ * The same value is used in the rpcap protocol as an indication of
+ * the server byte order, to let the client know whether it needs to
+ * byte-swap some host-byte-order metadata.
  */
 #define TCPDUMP_MAGIC		0xa1b2c3d4
 
@@ -434,7 +439,7 @@
 
 /*
  * Read and return the next packet from the savefile.  Return the header
- * in hdr and a pointer to the contents in data.  Return 0 on success, 1
+ * in hdr and a pointer to the contents in data.  Return 1 on success, 0
  * if there were no more packets, and -1 on an error.
  */
 static int
@@ -467,7 +472,7 @@
 				return (-1);
 			}
 			/* EOF */
-			return (1);
+			return (0);
 		}
 	}
 
@@ -579,7 +584,7 @@
 		 * userland.
 		 *
 		 * However, perhaps some versions of libpcap failed to
-		 * set the snapshot length currectly in the file header
+		 * set the snapshot length correctly in the file header
 		 * or the per-packet header, or perhaps this is a
 		 * corrupted safefile or a savefile built/modified by a
 		 * fuzz tester, so we check anyway.  We grow the buffer
@@ -622,7 +627,7 @@
 				 * the read finished.
 				 */
 				snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
-				    "truncated dump file; tried to read %u captured bytes, only got %zu",
+				    "truncated dump file; tried to read %d captured bytes, only got %zu",
 				    p->snapshot, amt_read);
 			}
 			return (-1);
@@ -706,10 +711,9 @@
 	}
 	*data = p->buffer;
 
-	if (p->swapped)
-		swap_pseudo_headers(p->linktype, hdr, *data);
+	pcap_post_process(p->linktype, p->swapped, hdr, *data);
 
-	return (0);
+	return (1);
 }
 
 static int
@@ -749,6 +753,24 @@
 
 	f = (FILE *)user;
 	/*
+	 * If the output file handle is in an error state, don't write
+	 * anything.
+	 *
+	 * While in principle a file handle can return from an error state
+	 * to a normal state (for example if a disk that is full has space
+	 * freed), we have possibly left a broken file already, and won't
+	 * be able to clean it up. The safest option is to do nothing.
+	 *
+	 * Note that if we could guarantee that fwrite() was atomic we
+	 * might be able to insure that we don't produce a corrupted file,
+	 * but the standard defines fwrite() as a series of fputc() calls,
+	 * so we really have no insurance that things are not fubared.
+	 *
+	 * http://pubs.opengroup.org/onlinepubs/009695399/functions/fwrite.html
+	 */
+	if (ferror(f))
+		return;
+	/*
 	 * Better not try writing pcap files after
 	 * 2038-01-19 03:14:07 UTC; switch to pcapng.
 	 */
@@ -756,9 +778,17 @@
 	sf_hdr.ts.tv_usec = (bpf_int32)h->ts.tv_usec;
 	sf_hdr.caplen     = h->caplen;
 	sf_hdr.len        = h->len;
-	/* XXX we should check the return status */
-	(void)fwrite(&sf_hdr, sizeof(sf_hdr), 1, f);
-	(void)fwrite(sp, h->caplen, 1, f);
+	/*
+	 * We only write the packet if we can write the header properly.
+	 *
+	 * This doesn't prevent us from having corrupted output, and if we
+	 * for some reason don't get a complete write we don't have any
+	 * way to set ferror() to prevent future writes from being
+	 * attempted, but it is better than nothing.
+	 */
+	if (fwrite(&sf_hdr, sizeof(sf_hdr), 1, f) == 1) {
+		(void)fwrite(sp, h->caplen, 1, f);
+	}
 }
 
 static pcap_dumper_t *
diff --git a/sf-pcapng.c b/sf-pcapng.c
index 3fd366c..058a724 100644
--- a/sf-pcapng.c
+++ b/sf-pcapng.c
@@ -34,6 +34,7 @@
 #include <string.h>
 
 #include "pcap-int.h"
+#include "pcap-util.h"
 
 #include "pcap-common.h"
 
@@ -1094,7 +1095,7 @@
 
 /*
  * Read and return the next packet from the savefile.  Return the header
- * in hdr and a pointer to the contents in data.  Return 0 on success, 1
+ * in hdr and a pointer to the contents in data.  Return 1 on success, 0
  * if there were no more packets, and -1 on an error.
  */
 static int
@@ -1123,7 +1124,7 @@
 		 */
 		status = read_block(fp, p, &cursor, p->errbuf);
 		if (status == 0)
-			return (1);	/* EOF */
+			return (0);	/* EOF */
 		if (status == -1)
 			return (-1);	/* error */
 		switch (cursor.block_type) {
@@ -1511,8 +1512,7 @@
 	if (*data == NULL)
 		return (-1);
 
-	if (p->swapped)
-		swap_pseudo_headers(p->linktype, hdr, *data);
+	pcap_post_process(p->linktype, p->swapped, hdr, *data);
 
-	return (0);
+	return (1);
 }
diff --git a/sockutils.c b/sockutils.c
index ca16bbf..933f326 100644
--- a/sockutils.c
+++ b/sockutils.c
@@ -93,7 +93,7 @@
  *
  * On Windows, send() and recv() return an int.
  *
- *   Wth MSVC, there *is* no ssize_t.
+ *   With MSVC, there *is* no ssize_t.
  *
  *   With MinGW, there is an ssize_t type; it is either an int (32 bit)
  *   or a long long (64 bit).
@@ -143,51 +143,164 @@
 }
 #endif
 
+int sock_geterrcode(void)
+{
+#ifdef _WIN32
+	return GetLastError();
+#else
+	return errno;
+#endif
+}
+
 /*
  * Format an error message given an errno value (UN*X) or a Winsock error
  * (Windows).
  */
-void sock_fmterror(const char *caller, int errcode, char *errbuf, int errbuflen)
+void sock_vfmterrmsg(char *errbuf, size_t errbuflen, int errcode,
+    const char *fmt, va_list ap)
 {
 	if (errbuf == NULL)
 		return;
 
 #ifdef _WIN32
-	pcap_fmt_errmsg_for_win32_err(errbuf, errbuflen, errcode,
-	    "%s", caller);
+	pcap_vfmt_errmsg_for_win32_err(errbuf, errbuflen, errcode,
+	    fmt, ap);
 #else
-	pcap_fmt_errmsg_for_errno(errbuf, errbuflen, errcode,
-	    "%s", caller);
+	pcap_vfmt_errmsg_for_errno(errbuf, errbuflen, errcode,
+	    fmt, ap);
 #endif
 }
 
-/*
- * \brief It retrieves the error message after an error occurred in the socket interface.
- *
- * This function is defined because of the different way errors are returned in UNIX
- * and Win32. This function provides a consistent way to retrieve the error message
- * (after a socket error occurred) on all the platforms.
- *
- * \param caller: a pointer to a user-allocated string which contains a message that has
- * to be printed *before* the true error message. It could be, for example, 'this error
- * comes from the recv() call at line 31'.
- *
- * \param errbuf: a pointer to an user-allocated buffer that will contain the complete
- * error message. This buffer has to be at least 'errbuflen' in length.
- * It can be NULL; in this case the error cannot be printed.
- *
- * \param errbuflen: length of the buffer that will contains the error. The error message cannot be
- * larger than 'errbuflen - 1' because the last char is reserved for the string terminator.
- *
- * \return No return values. The error message is returned in the 'string' parameter.
- */
-void sock_geterror(const char *caller, char *errbuf, int errbuflen)
+void sock_fmterrmsg(char *errbuf, size_t errbuflen, int errcode,
+    const char *fmt, ...)
 {
+	va_list ap;
+
+	va_start(ap, fmt);
+	sock_vfmterrmsg(errbuf, errbuflen, errcode, fmt, ap);
+	va_end(ap);
+}
+
+/*
+ * Format an error message for the last socket error.
+ */
+void sock_geterrmsg(char *errbuf, size_t errbuflen, const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	sock_vfmterrmsg(errbuf, errbuflen, sock_geterrcode(), fmt, ap);
+	va_end(ap);
+}
+
+/*
+ * Types of error.
+ *
+ * These are sorted by how likely they are to be the "underlying" problem,
+ * so that lower-rated errors for a given address in a given family
+ * should not overwrite higher-rated errors for another address in that
+ * family, and higher-rated errors should overwrit elower-rated errors.
+ */
+typedef enum {
+	SOCK_CONNERR,		/* connection error */
+	SOCK_HOSTERR,		/* host error */
+	SOCK_NETERR,		/* network error */
+	SOCK_AFNOTSUPERR,	/* address family not supported */
+	SOCK_UNKNOWNERR,	/* unknown error */
+	SOCK_NOERR		/* no error */
+} sock_errtype;
+
+static sock_errtype sock_geterrtype(int errcode)
+{
+	switch (errcode) {
+
 #ifdef _WIN32
-	sock_fmterror(caller, GetLastError(), errbuf, errbuflen);
+	case WSAECONNRESET:
+	case WSAECONNABORTED:
+	case WSAECONNREFUSED:
 #else
-	sock_fmterror(caller, errno, errbuf, errbuflen);
+	case ECONNRESET:
+	case ECONNABORTED:
+	case ECONNREFUSED:
 #endif
+		/*
+		 * Connection error; this means the problem is probably
+		 * that there's no server set up on the remote machine,
+		 * or that it is set up, but it's IPv4-only or IPv6-only
+		 * and we're trying the wrong address family.
+		 *
+		 * These overwrite all other errors, as they indicate
+		 * that, even if somethng else went wrong in another
+		 * attempt, this probably wouldn't work even if the
+		 * other problems were fixed.
+		 */
+		return (SOCK_CONNERR);
+
+#ifdef _WIN32
+	case WSAENETUNREACH:
+	case WSAETIMEDOUT:
+	case WSAEHOSTDOWN:
+	case WSAEHOSTUNREACH:
+#else
+	case ENETUNREACH:
+	case ETIMEDOUT:
+	case EHOSTDOWN:
+	case EHOSTUNREACH:
+#endif
+		/*
+		 * Network errors that could be IPv4-specific, IPv6-
+		 * specific, or present with both.
+		 *
+		 * Don't overwrite connection errors, but overwrite
+		 * everything else.
+		 */
+		return (SOCK_HOSTERR);
+
+#ifdef _WIN32
+	case WSAENETDOWN:
+	case WSAENETRESET:
+#else
+	case ENETDOWN:
+	case ENETRESET:
+#endif
+		/*
+		 * Network error; this means we don't know whether
+		 * there's a server set up on the remote machine,
+		 * and we don't have a reason to believe that IPv6
+		 * any worse or better than IPv4.
+		 *
+		 * These probably indicate a local failure, e.g.
+		 * an interface is down.
+		 *
+		 * Don't overwrite connection errors or host errors,
+		 * but overwrite everything else.
+		 */
+		return (SOCK_NETERR);
+
+#ifdef _WIN32
+	case WSAEAFNOSUPPORT:
+#else
+	case EAFNOSUPPORT:
+#endif
+		/*
+		 * "Address family not supported" probably means
+		 * "No soup^WIPv6 for you!".
+		 *
+		 * Don't overwrite connection errors, host errors, or
+		 * network errors (none of which we should get for this
+		 * address family if it's not supported), but overwrite
+		 * everything else.
+		 */
+		return (SOCK_AFNOTSUPERR);
+
+	default:
+		/*
+		 * Anything else.
+		 *
+		 * Don't overwrite any errors.
+		 */
+		return (SOCK_UNKNOWNERR);
+	}
 }
 
 /*
@@ -281,6 +394,79 @@
 	}
 }
 
+struct addr_status {
+	struct addrinfo *info;
+	int errcode;
+	sock_errtype errtype;
+};
+
+/*
+ * Sort by IPv4 address vs. IPv6 address.
+ */
+static int compare_addrs_to_try_by_address_family(const void *a, const void *b)
+{
+	const struct addr_status *addr_a = (const struct addr_status *)a;
+	const struct addr_status *addr_b = (const struct addr_status *)b;
+
+	return addr_a->info->ai_family - addr_b->info->ai_family;
+}
+
+/*
+ * Sort by error type and, within a given error type, by error code and,
+ * within a given error code, by IPv4 address vs. IPv6 address.
+ */
+static int compare_addrs_to_try_by_status(const void *a, const void *b)
+{
+	const struct addr_status *addr_a = (const struct addr_status *)a;
+	const struct addr_status *addr_b = (const struct addr_status *)b;
+
+	if (addr_a->errtype == addr_b->errtype)
+	{
+		if (addr_a->errcode == addr_b->errcode)
+		{
+			return addr_a->info->ai_family - addr_b->info->ai_family;
+		}
+		return addr_a->errcode - addr_b->errcode;
+	}
+
+	return addr_a->errtype - addr_b->errtype;
+}
+
+static SOCKET sock_create_socket(struct addrinfo *addrinfo, char *errbuf,
+    int errbuflen)
+{
+	SOCKET sock;
+#ifdef SO_NOSIGPIPE
+	int on = 1;
+#endif
+
+	sock = socket(addrinfo->ai_family, addrinfo->ai_socktype,
+	    addrinfo->ai_protocol);
+	if (sock == INVALID_SOCKET)
+	{
+		sock_geterrmsg(errbuf, errbuflen, "socket() failed");
+		return INVALID_SOCKET;
+	}
+
+	/*
+	 * Disable SIGPIPE, if we have SO_NOSIGPIPE.  We don't want to
+	 * have to deal with signals if the peer closes the connection,
+	 * especially in client programs, which may not even be aware that
+	 * they're sending to sockets.
+	 */
+#ifdef SO_NOSIGPIPE
+	if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (char *)&on,
+	    sizeof (int)) == -1)
+	{
+		sock_geterrmsg(errbuf, errbuflen,
+		    "setsockopt(SO_NOSIGPIPE) failed");
+		closesocket(sock);
+		return INVALID_SOCKET;
+	}
+#endif
+	return sock;
+}
+
 /*
  * \brief It initializes a network connection both from the client and the server side.
  *
@@ -292,6 +478,9 @@
  *
  * This function is usually preceded by the sock_initaddress().
  *
+ * \param host: for client sockets, the host name to which we're trying
+ * to connect.
+ *
  * \param addrinfo: pointer to an addrinfo variable which will be used to
  * open the socket and such. This variable is the one returned by the previous call to
  * sock_initaddress().
@@ -312,48 +501,33 @@
  * if everything is fine, INVALID_SOCKET if some errors occurred. The error message is returned
  * in the 'errbuf' variable.
  */
-SOCKET sock_open(struct addrinfo *addrinfo, int server, int nconn, char *errbuf, int errbuflen)
+SOCKET sock_open(const char *host, struct addrinfo *addrinfo, int server, int nconn, char *errbuf, int errbuflen)
 {
 	SOCKET sock;
-#if defined(SO_NOSIGPIPE) || defined(IPV6_V6ONLY) || defined(IPV6_BINDV6ONLY)
-	int on = 1;
-#endif
-
-	sock = socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol);
-	if (sock == INVALID_SOCKET)
-	{
-		sock_geterror("socket()", errbuf, errbuflen);
-		return INVALID_SOCKET;
-	}
-
-	/*
-	 * Disable SIGPIPE, if we have SO_NOSIGPIPE.  We don't want to
-	 * have to deal with signals if the peer closes the connection,
-	 * especially in client programs, which may not even be aware that
-	 * they're sending to sockets.
-	 */
-#ifdef SO_NOSIGPIPE
-	if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (char *)&on,
-	    sizeof (int)) == -1)
-	{
-		sock_geterror("setsockopt(SO_NOSIGPIPE)", errbuf, errbuflen);
-		closesocket(sock);
-		return INVALID_SOCKET;
-	}
-#endif
 
 	/* This is a server socket */
 	if (server)
 	{
+		int on;
+
+		/*
+		 * Attempt to create the socket.
+		 */
+		sock = sock_create_socket(addrinfo, errbuf, errbuflen);
+		if (sock == INVALID_SOCKET)
+		{
+			return INVALID_SOCKET;
+		}
+
 		/*
 		 * Allow a new server to bind the socket after the old one
 		 * exited, even if lingering sockets are still present.
 		 *
 		 * Don't treat an error as a failure.
 		 */
-		int optval = 1;
+		on = 1;
 		(void)setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
-		    (char *)&optval, sizeof (optval));
+		    (char *)&on, sizeof (on));
 
 #if defined(IPV6_V6ONLY) || defined(IPV6_BINDV6ONLY)
 		/*
@@ -390,6 +564,7 @@
 #endif /* IPV6_V6ONLY */
 		if (addrinfo->ai_family == PF_INET6)
 		{
+			on = 1;
 			if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
 			    (char *)&on, sizeof (int)) == -1)
 			{
@@ -404,7 +579,7 @@
 		/* WARNING: if the address is a mcast one, I should place the proper Win32 code here */
 		if (bind(sock, addrinfo->ai_addr, (int) addrinfo->ai_addrlen) != 0)
 		{
-			sock_geterror("bind()", errbuf, errbuflen);
+			sock_geterrmsg(errbuf, errbuflen, "bind() failed");
 			closesocket(sock);
 			return INVALID_SOCKET;
 		}
@@ -412,7 +587,8 @@
 		if (addrinfo->ai_socktype == SOCK_STREAM)
 			if (listen(sock, nconn) == -1)
 			{
-				sock_geterror("listen()", errbuf, errbuflen);
+				sock_geterrmsg(errbuf, errbuflen,
+				    "listen() failed");
 				closesocket(sock);
 				return INVALID_SOCKET;
 			}
@@ -422,70 +598,259 @@
 	}
 	else	/* we're the client */
 	{
+		struct addr_status *addrs_to_try;
 		struct addrinfo *tempaddrinfo;
-		char *errbufptr;
-		size_t bufspaceleft;
-
-		tempaddrinfo = addrinfo;
-		errbufptr = errbuf;
-		bufspaceleft = errbuflen;
-		*errbufptr = 0;
+		size_t numaddrinfos;
+		size_t i;
+		int current_af = AF_UNSPEC;
 
 		/*
-		 * We have to loop though all the addinfo returned.
-		 * For instance, we can have both IPv6 and IPv4 addresses, but the service we're trying
-		 * to connect to is unavailable in IPv6, so we have to try in IPv4 as well
+		 * We have to loop though all the addrinfos returned.
+		 * For instance, we can have both IPv6 and IPv4 addresses,
+		 * but the service we're trying to connect to is unavailable
+		 * in IPv6, so we have to try in IPv4 as well.
+		 *
+		 * How many addrinfos do we have?
 		 */
-		while (tempaddrinfo)
+		numaddrinfos =  0;
+		for (tempaddrinfo = addrinfo; tempaddrinfo != NULL;
+		    tempaddrinfo = tempaddrinfo->ai_next)
 		{
+			numaddrinfos++;
+		}
+
+		if (numaddrinfos == 0)
+		{
+			snprintf(errbuf, errbuflen,
+			    "There are no addresses in the address list");
+			return INVALID_SOCKET;
+		}
+
+		/*
+		 * Allocate an array of struct addr_status and fill it in.
+		 */
+		addrs_to_try = calloc(numaddrinfos, sizeof *addrs_to_try);
+		if (addrs_to_try == NULL)
+		{
+			snprintf(errbuf, errbuflen,
+			    "Out of memory connecting to %s", host);
+			return INVALID_SOCKET;
+		}
+
+		for (tempaddrinfo = addrinfo, i = 0; tempaddrinfo != NULL;
+		    tempaddrinfo = tempaddrinfo->ai_next, i++)
+		{
+			addrs_to_try[i].info = tempaddrinfo;
+			addrs_to_try[i].errcode = 0;
+			addrs_to_try[i].errtype = SOCK_NOERR;
+		}
+
+		/*
+		 * Sort the structures to put the IPv4 addresses before the
+		 * IPv6 addresses; we will have to create an IPv4 socket
+		 * for the IPv4 addresses and an IPv6 socket for the IPv6
+		 * addresses (one of the arguments to socket() is the
+		 * address/protocol family to use, and IPv4 and IPv6 are
+		 * separate address/protocol families).
+		 */
+		qsort(addrs_to_try, numaddrinfos, sizeof *addrs_to_try,
+		    compare_addrs_to_try_by_address_family);
+
+		/* Start out with no socket. */
+		sock = INVALID_SOCKET;
+
+		/*
+		 * Now try them all.
+		 */
+		for (i = 0; i < numaddrinfos; i++)
+		{
+			tempaddrinfo = addrs_to_try[i].info;
 #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 			break;
 #endif
+			/*
+			 * If we have a socket, but it's for a
+			 * different address family, close it.
+			 */
+			if (sock != INVALID_SOCKET &&
+			    current_af != tempaddrinfo->ai_family)
+			{
+				closesocket(sock);
+				sock = INVALID_SOCKET;
+			}
+
+			/*
+			 * If we don't have a socket, open one
+			 * for *this* address's address family.
+			 */
+			if (sock == INVALID_SOCKET)
+			{
+				sock = sock_create_socket(tempaddrinfo,
+				    errbuf, errbuflen);
+				if (sock == INVALID_SOCKET)
+				{
+					free(addrs_to_try);
+					return INVALID_SOCKET;
+				}
+			}
 			if (connect(sock, tempaddrinfo->ai_addr, (int) tempaddrinfo->ai_addrlen) == -1)
 			{
-				size_t msglen;
-				char TmpBuffer[100];
-				char SocketErrorMessage[SOCK_ERRBUF_SIZE];
-
-				/*
-				 * We have to retrieve the error message before any other socket call completes, otherwise
-				 * the error message is lost
-				 */
-				sock_geterror("Connect to socket failed",
-				    SocketErrorMessage, sizeof(SocketErrorMessage));
-
-				/* Returns the numeric address of the host that triggered the error */
-				sock_getascii_addrport((struct sockaddr_storage *) tempaddrinfo->ai_addr, TmpBuffer, sizeof(TmpBuffer), NULL, 0, NI_NUMERICHOST, TmpBuffer, sizeof(TmpBuffer));
-
-				snprintf(errbufptr, bufspaceleft,
-				    "Is the server properly installed on %s?  %s", TmpBuffer, SocketErrorMessage);
-
-				/* In case more then one 'connect' fails, we manage to keep all the error messages */
-				msglen = strlen(errbufptr);
-
-				errbufptr[msglen] = ' ';
-				errbufptr[msglen + 1] = 0;
-
-				bufspaceleft = bufspaceleft - (msglen + 1);
-				errbufptr += (msglen + 1);
-
-				tempaddrinfo = tempaddrinfo->ai_next;
+				addrs_to_try[i].errcode = sock_geterrcode();
+				addrs_to_try[i].errtype =
+				   sock_geterrtype(addrs_to_try[i].errcode);
 			}
 			else
 				break;
 		}
 
 		/*
-		 * Check how we exit from the previous loop
-		 * If tempaddrinfo is equal to NULL, it means that all the connect() failed.
+		 * Check how we exited from the previous loop.
+		 * If tempaddrinfo is equal to NULL, it means that all
+		 * the connect() attempts failed.  Construct an
+		 * error message.
 		 */
-		if (tempaddrinfo == NULL)
+		if (i == numaddrinfos)
 		{
+			int same_error_for_all;
+			int first_error;
+
 			closesocket(sock);
+
+			/*
+			 * Sort the statuses to group together categories
+			 * of errors, errors within categories, and
+			 * address families within error sets.
+			 */
+			qsort(addrs_to_try, numaddrinfos, sizeof *addrs_to_try,
+			    compare_addrs_to_try_by_status);
+
+			/*
+			 * Are all the errors the same?
+			 */
+			same_error_for_all = 1;
+			first_error = addrs_to_try[0].errcode;
+			for (i = 1; i < numaddrinfos; i++)
+			{
+				if (addrs_to_try[i].errcode != first_error)
+				{
+					same_error_for_all = 0;
+					break;
+				}
+			}
+
+			if (same_error_for_all) {
+				/*
+				 * Yes.  No need to show the IP
+				 * addresses.
+				 */
+				if (addrs_to_try[0].errtype == SOCK_CONNERR) {
+					/*
+					 * Connection error; note that
+					 * the daemon might not be set
+					 * up correctly, or set up at all.
+					 */
+					sock_fmterrmsg(errbuf, errbuflen,
+					    addrs_to_try[0].errcode,
+					    "Is the server properly installed? Cannot connect to %s",
+					    host);
+				} else {
+					sock_fmterrmsg(errbuf, errbuflen,
+					    addrs_to_try[0].errcode,
+					    "Cannot connect to %s", host);
+				}
+			} else {
+				/*
+				 * Show all the errors and the IP addresses
+				 * to which they apply.
+				 */
+				char *errbufptr;
+				size_t bufspaceleft;
+				size_t msglen;
+
+				snprintf(errbuf, errbuflen,
+				    "Connect to %s failed: ", host);
+
+				msglen = strlen(errbuf);
+				errbufptr = errbuf + msglen;
+				bufspaceleft = errbuflen - msglen;
+
+				for (i = 0; i < numaddrinfos &&
+				    addrs_to_try[i].errcode != SOCK_NOERR;
+				    i++)
+				{
+					/*
+					 * Get the string for the address
+					 * and port that got this error.
+					 */
+					sock_getascii_addrport((struct sockaddr_storage *) addrs_to_try[i].info->ai_addr,
+					    errbufptr, (int)bufspaceleft,
+					    NULL, 0, NI_NUMERICHOST, NULL, 0);
+					msglen = strlen(errbuf);
+					errbufptr = errbuf + msglen;
+					bufspaceleft = errbuflen - msglen;
+
+					if (i + 1 < numaddrinfos &&
+					    addrs_to_try[i + 1].errcode == addrs_to_try[i].errcode)
+					{
+						/*
+						 * There's another error
+						 * after this, and it has
+						 * the same error code.
+						 *
+						 * Append a comma, as the
+						 * list of addresses with
+						 * this error has another
+						 * entry.
+						 */
+						snprintf(errbufptr, bufspaceleft,
+						    ", ");
+					}
+					else
+					{
+						/*
+						 * Either there are no
+						 * more errors after this,
+						 * or the next error is
+						 * different.
+						 *
+						 * Append a colon and
+						 * the message for tis
+						 * error, followed by a
+						 * comma if there are
+						 * more errors.
+						 */
+						sock_fmterrmsg(errbufptr,
+						    bufspaceleft,
+						    addrs_to_try[i].errcode,
+						    "%s", "");
+						msglen = strlen(errbuf);
+						errbufptr = errbuf + msglen;
+						bufspaceleft = errbuflen - msglen;
+
+						if (i + 1 < numaddrinfos &&
+						    addrs_to_try[i + 1].errcode != SOCK_NOERR)
+						{
+							/*
+							 * More to come.
+							 */
+							snprintf(errbufptr,
+							    bufspaceleft,
+							    ", ");
+						}
+					}
+					msglen = strlen(errbuf);
+					errbufptr = errbuf + msglen;
+					bufspaceleft = errbuflen - msglen;
+				}
+			}
+			free(addrs_to_try);
 			return INVALID_SOCKET;
 		}
 		else
+		{
+			free(addrs_to_try);
 			return sock;
+		}
 	}
 }
 
@@ -516,7 +881,7 @@
 	 */
 	if (shutdown(sock, SHUT_WR))
 	{
-		sock_geterror("shutdown()", errbuf, errbuflen);
+		sock_geterrmsg(errbuf, errbuflen, "shutdown() feiled");
 		/* close the socket anyway */
 		closesocket(sock);
 		return -1;
@@ -548,13 +913,13 @@
 	char hostport[PCAP_ERRBUF_SIZE];
 
 	if (hostname != NULL && portname != NULL)
-		snprintf(hostport, PCAP_ERRBUF_SIZE, "%s:%s",
+		snprintf(hostport, PCAP_ERRBUF_SIZE, "host and port %s:%s",
 		    hostname, portname);
 	else if (hostname != NULL)
-		snprintf(hostport, PCAP_ERRBUF_SIZE, "%s",
+		snprintf(hostport, PCAP_ERRBUF_SIZE, "host %s",
 		    hostname);
 	else if (portname != NULL)
-		snprintf(hostport, PCAP_ERRBUF_SIZE, ":%s",
+		snprintf(hostport, PCAP_ERRBUF_SIZE, "port %s",
 		    portname);
 	else
 		snprintf(hostport, PCAP_ERRBUF_SIZE, "<no host or port!>");
@@ -618,7 +983,7 @@
 
 		case EAI_NONAME:
 			snprintf(errbuf, errbuflen,
-			    "%sThe host name %s couldn't be resolved",
+			    "%sThe %s couldn't be resolved",
 			    prefix, hostport);
 			break;
 
@@ -720,13 +1085,58 @@
 {
 	int retval;
 
-	retval = getaddrinfo(host, port, hints, addrinfo);
+	/*
+	 * We allow both the host and port to be null, but getaddrinfo()
+	 * is not guaranteed to do so; to handle that, if port is null,
+	 * we provide "0" as the port number.
+	 *
+	 * This results in better error messages from get_gai_errstring(),
+	 * as those messages won't talk about a problem with the port if
+	 * no port was specified.
+	 */
+	retval = getaddrinfo(host, port == NULL ? "0" : port, hints, addrinfo);
 	if (retval != 0)
 	{
 		if (errbuf)
 		{
-			get_gai_errstring(errbuf, errbuflen, "", retval,
-			    host, port);
+			if (host != NULL && port != NULL) {
+				/*
+				 * Try with just a host, to distinguish
+				 * between "host is bad" and "port is
+				 * bad".
+				 */
+				int try_retval;
+
+				try_retval = getaddrinfo(host, NULL, hints,
+				    addrinfo);
+				if (try_retval == 0) {
+					/*
+					 * Worked with just the host,
+					 * so assume the problem is
+					 * with the port.
+					 *
+					 * Free up the address info first.
+					 */
+					freeaddrinfo(*addrinfo);
+					get_gai_errstring(errbuf, errbuflen,
+					    "", retval, NULL, port);
+				} else {
+					/*
+					 * Didn't work with just the host,
+					 * so assume the problem is
+					 * with the host.
+					 */
+					get_gai_errstring(errbuf, errbuflen,
+					    "", retval, host, NULL);
+				}
+			} else {
+				/*
+				 * Either the host or port was null, so
+				 * there's nothing to determine.
+				 */
+				get_gai_errstring(errbuf, errbuflen, "",
+				    retval, host, port);
+			}
 		}
 		return -1;
 	}
@@ -857,7 +1267,8 @@
 				 */
 				return -2;
 			}
-			sock_fmterror("send()", errcode, errbuf, errbuflen);
+			sock_fmterrmsg(errbuf, errbuflen, errcode,
+			    "send() failed");
 #else
 			errcode = errno;
 			if (errcode == ECONNRESET || errcode == EPIPE)
@@ -869,7 +1280,8 @@
 				 */
 				return -2;
 			}
-			sock_fmterror("send()", errcode, errbuf, errbuflen);
+			sock_fmterrmsg(errbuf, errbuflen, errcode,
+			    "send() failed");
 #endif
 			return -1;
 		}
@@ -882,11 +1294,11 @@
 }
 
 /*
- * \brief It copies the amount of data contained into 'buffer' into 'tempbuf'.
+ * \brief It copies the amount of data contained in 'data' into 'outbuf'.
  * and it checks for buffer overflows.
  *
- * This function basically copies 'size' bytes of data contained into 'buffer'
- * into 'tempbuf', starting at offset 'offset'. Before that, it checks that the
+ * This function basically copies 'size' bytes of data contained in 'data'
+ * into 'outbuf', starting at offset 'offset'. Before that, it checks that the
  * resulting buffer will not be larger	than 'totsize'. Finally, it updates
  * the 'offset' variable in order to point to the first empty location of the buffer.
  *
@@ -895,25 +1307,24 @@
  * 'offset' variable. This mode can be useful when the buffer already contains the
  * data (maybe because the producer writes directly into the target buffer), so
  * only the buffer overflow check has to be made.
- * In this case, both 'buffer' and 'tempbuf' can be NULL values.
+ * In this case, both 'data' and 'outbuf' can be NULL values.
  *
  * This function is useful in case the userland application does not know immediately
  * all the data it has to write into the socket. This function provides a way to create
  * the "stream" step by step, appending the new data to the old one. Then, when all the
  * data has been bufferized, the application can call the sock_send() function.
  *
- * \param buffer: a char pointer to a user-allocated buffer that keeps the data
- * that has to be copied.
+ * \param data: a void pointer to the data that has to be copied.
  *
  * \param size: number of bytes that have to be copied.
  *
- * \param tempbuf: user-allocated buffer (of size 'totsize') in which data
+ * \param outbuf: user-allocated buffer (of size 'totsize') into which data
  * has to be copied.
  *
- * \param offset: an index into 'tempbuf' which keeps the location of its first
+ * \param offset: an index into 'outbuf' which keeps the location of its first
  * empty location.
  *
- * \param totsize: total size of the buffer in which data is being copied.
+ * \param totsize: total size of the buffer into which data is being copied.
  *
  * \param checkonly: '1' if we do not want to copy data into the buffer and we
  * want just do a buffer ovreflow control, '0' if data has to be copied as well.
@@ -926,7 +1337,7 @@
  * larger than 'errbuflen - 1' because the last char is reserved for the string terminator.
  *
  * \return '0' if everything is fine, '-1' if some errors occurred. The error message
- * is returned in the 'errbuf' variable. When the function returns, 'tempbuf' will
+ * is returned in the 'errbuf' variable. When the function returns, 'outbuf' will
  * have the new string appended, and 'offset' will keep the length of that buffer.
  * In case of 'checkonly == 1', data is not copied, but 'offset' is updated in any case.
  *
@@ -936,7 +1347,7 @@
  * \warning In case of 'checkonly', be carefully to call this function *before* copying
  * the data into the buffer. Otherwise, the control about the buffer overflow is useless.
  */
-int sock_bufferize(const char *buffer, int size, char *tempbuf, int *offset, int totsize, int checkonly, char *errbuf, int errbuflen)
+int sock_bufferize(const void *data, int size, char *outbuf, int *offset, int totsize, int checkonly, char *errbuf, int errbuflen)
 {
 	if ((*offset + size) > totsize)
 	{
@@ -946,7 +1357,7 @@
 	}
 
 	if (!checkonly)
-		memcpy(tempbuf + (*offset), buffer, size);
+		memcpy(outbuf + (*offset), data, size);
 
 	(*offset) += size;
 
@@ -1056,7 +1467,7 @@
 			if (errno == EINTR)
 				return -3;
 #endif
-			sock_geterror("recv()", errbuf, errbuflen);
+			sock_geterrmsg(errbuf, errbuflen, "recv() failed");
 			return -1;
 		}
 
@@ -1161,7 +1572,8 @@
 		 * supplied to us, the excess data is discarded,
 		 * and we'll report an error.
 		 */
-		sock_geterror("recv()", errbuf, errbuflen);
+		sock_fmterrmsg(errbuf, errbuflen, sock_geterrcode(),
+		    "recv() failed");
 		return -1;
 	}
 #else /* _WIN32 */
@@ -1198,7 +1610,7 @@
 	{
 		if (errno == EINTR)
 			return -3;
-		sock_geterror("recv()", errbuf, errbuflen);
+		sock_geterrmsg(errbuf, errbuflen, "recv() failed");
 		return -1;
 	}
 #ifdef HAVE_STRUCT_MSGHDR_MSG_FLAGS
@@ -1334,7 +1746,8 @@
 		temphostlist = strdup(hostlist);
 		if (temphostlist == NULL)
 		{
-			sock_geterror("sock_check_hostlist(), malloc() failed", errbuf, errbuflen);
+			sock_geterrmsg(errbuf, errbuflen,
+			    "sock_check_hostlist(), malloc() failed");
 			return -2;
 		}
 
@@ -1520,7 +1933,7 @@
 
 	if (getsockname(sock, (struct sockaddr *) &mysockaddr, &sockaddrlen) == -1)
 	{
-		sock_geterror("getsockname()", errbuf, errbuflen);
+		sock_geterrmsg(errbuf, errbuflen, "getsockname() failed");
 		return 0;
 	}
 
@@ -1576,7 +1989,7 @@
  * and 'port'.
  * In any case, the returned strings are '0' terminated.
  */
-int sock_getascii_addrport(const struct sockaddr_storage *sockaddr, char *address, int addrlen, char *port, int portlen, int flags, char *errbuf, int errbuflen)
+int sock_getascii_addrport(const struct sockaddr_storage *sockaddr, char *address, int addrlen, char *port, int portlen, int flags, char *errbuf, size_t errbuflen)
 {
 	socklen_t sockaddrlen;
 	int retval;					/* Variable that keeps the return value; */
@@ -1608,7 +2021,8 @@
 		/* If the user wants to receive an error message */
 		if (errbuf)
 		{
-			sock_geterror("getnameinfo()", errbuf, errbuflen);
+			sock_geterrmsg(errbuf, errbuflen,
+			    "getnameinfo() failed");
 			errbuf[errbuflen - 1] = 0;
 		}
 
diff --git a/sockutils.h b/sockutils.h
index e748662..a488d8f 100644
--- a/sockutils.h
+++ b/sockutils.h
@@ -37,6 +37,10 @@
 #pragma once
 #endif
 
+#include <stdarg.h>	/* we declare varargs functions */
+
+#include "pcap/funcattrs.h"
+
 #include "pcap/socket.h"
 
 #ifndef _WIN32
@@ -127,8 +131,13 @@
 
 int sock_init(char *errbuf, int errbuflen);
 void sock_cleanup(void);
-void sock_fmterror(const char *caller, int errcode, char *errbuf, int errbuflen);
-void sock_geterror(const char *caller, char *errbuf, int errbufsize);
+int sock_geterrcode(void);
+void sock_vfmterrmsg(char *errbuf, size_t errbuflen, int errcode,
+    PCAP_FORMAT_STRING(const char *fmt), va_list ap) PCAP_PRINTFLIKE(4, 0);
+void sock_fmterrmsg(char *errbuf, size_t errbuflen, int errcode,
+    PCAP_FORMAT_STRING(const char *fmt), ...) PCAP_PRINTFLIKE(4, 5);
+void sock_geterrmsg(char *errbuf, size_t errbuflen,
+    PCAP_FORMAT_STRING(const char *fmt), ...)  PCAP_PRINTFLIKE(3, 4);
 int sock_initaddress(const char *address, const char *port,
     struct addrinfo *hints, struct addrinfo **addrinfo,
     char *errbuf, int errbuflen);
@@ -136,19 +145,19 @@
     char *errbuf, int errbuflen);
 int sock_recv_dgram(SOCKET sock, SSL *, void *buffer, size_t size,
     char *errbuf, int errbuflen);
-SOCKET sock_open(struct addrinfo *addrinfo, int server, int nconn, char *errbuf, int errbuflen);
+SOCKET sock_open(const char *host, struct addrinfo *addrinfo, int server, int nconn, char *errbuf, int errbuflen);
 int sock_close(SOCKET sock, char *errbuf, int errbuflen);
 
 int sock_send(SOCKET sock, SSL *, const char *buffer, size_t size,
     char *errbuf, int errbuflen);
-int sock_bufferize(const char *buffer, int size, char *tempbuf, int *offset, int totsize, int checkonly, char *errbuf, int errbuflen);
+int sock_bufferize(const void *data, int size, char *outbuf, int *offset, int totsize, int checkonly, char *errbuf, int errbuflen);
 int sock_discard(SOCKET sock, SSL *, int size, char *errbuf, int errbuflen);
 int	sock_check_hostlist(char *hostlist, const char *sep, struct sockaddr_storage *from, char *errbuf, int errbuflen);
 int sock_cmpaddr(struct sockaddr_storage *first, struct sockaddr_storage *second);
 
 int sock_getmyinfo(SOCKET sock, char *address, int addrlen, char *port, int portlen, int flags, char *errbuf, int errbuflen);
 
-int sock_getascii_addrport(const struct sockaddr_storage *sockaddr, char *address, int addrlen, char *port, int portlen, int flags, char *errbuf, int errbuflen);
+int sock_getascii_addrport(const struct sockaddr_storage *sockaddr, char *address, int addrlen, char *port, int portlen, int flags, char *errbuf, size_t errbuflen);
 int sock_present2network(const char *address, struct sockaddr_storage *sockaddr, int addr_family, char *errbuf, int errbuflen);
 
 #ifdef __cplusplus
diff --git a/testprogs/.gitignore b/testprogs/.gitignore
index b57c7bb..ae08fcc 100644
--- a/testprogs/.gitignore
+++ b/testprogs/.gitignore
@@ -13,3 +13,4 @@
 selpolltest
 threadsignaltest
 writecaptest
+nonblocktest
diff --git a/testprogs/CMakeLists.txt b/testprogs/CMakeLists.txt
index bf57361..567f42a 100644
--- a/testprogs/CMakeLists.txt
+++ b/testprogs/CMakeLists.txt
@@ -41,7 +41,10 @@
 
 add_test_executable(threadsignaltest ${CMAKE_THREAD_LIBS_INIT})
 
-if(NOT WIN32)
+# Same as in configure.ac.
+if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
+   CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
+   CMAKE_SYSTEM_NAME STREQUAL "Linux")
   add_test_executable(valgrindtest)
 endif()
 
diff --git a/testprogs/Makefile.in b/testprogs/Makefile.in
index 43af561..f195693 100644
--- a/testprogs/Makefile.in
+++ b/testprogs/Makefile.in
@@ -63,7 +63,6 @@
 DYEXT = @DYEXT@
 V_RPATH_OPT = @V_RPATH_OPT@
 DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
-EXTRA_NETWORK_LIBS=@EXTRA_NETWORK_LIBS@
 
 # Standard CFLAGS for building test programs
 FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
@@ -86,6 +85,7 @@
 	findalldevstest-perf.c \
 	findalldevstest.c \
 	opentest.c \
+	nonblocktest.c \
 	reactivatetest.c \
 	selpolltest.c \
 	threadsignaltest.c \
@@ -101,37 +101,56 @@
 all: $(TESTS)
 
 capturetest: $(srcdir)/capturetest.c ../libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o capturetest $(srcdir)/capturetest.c ../libpcap.a $(LIBS)
+	$(CC) $(FULL_CFLAGS) -I. -L. -o capturetest $(srcdir)/capturetest.c \
+	    ../libpcap.a $(LIBS)
 
 can_set_rfmon_test: $(srcdir)/can_set_rfmon_test.c ../libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o can_set_rfmon_test $(srcdir)/can_set_rfmon_test.c ../libpcap.a $(LIBS)
+	$(CC) $(FULL_CFLAGS) -I. -L. -o can_set_rfmon_test \
+	    $(srcdir)/can_set_rfmon_test.c \
+	    ../libpcap.a $(LIBS)
 
 filtertest: $(srcdir)/filtertest.c ../libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o filtertest $(srcdir)/filtertest.c ../libpcap.a $(EXTRA_NETWORK_LIBS) $(LIBS)
+	$(CC) $(FULL_CFLAGS) -I. -L. -o filtertest $(srcdir)/filtertest.c \
+	    ../libpcap.a $(LIBS)
 
 findalldevstest: $(srcdir)/findalldevstest.c ../libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o findalldevstest $(srcdir)/findalldevstest.c ../libpcap.a $(EXTRA_NETWORK_LIBS) $(LIBS)
+	$(CC) $(FULL_CFLAGS) -I. -L. -o findalldevstest \
+	    $(srcdir)/findalldevstest.c \
+	    ../libpcap.a $(LIBS)
 
 findalldevstest-perf: $(srcdir)/findalldevstest-perf.c ../libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o findalldevstest-perf $(srcdir)/findalldevstest-perf.c ../libpcap.a $(EXTRA_NETWORK_LIBS) $(LIBS)
+	$(CC) $(FULL_CFLAGS) -I. -L. -o findalldevstest-perf \
+	    $(srcdir)/findalldevstest-perf.c \
+	    ../libpcap.a $(LIBS)
 
 opentest: $(srcdir)/opentest.c ../libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o opentest $(srcdir)/opentest.c ../libpcap.a $(LIBS)
+	$(CC) $(FULL_CFLAGS) -I. -L. -o opentest $(srcdir)/opentest.c \
+	    ../libpcap.a $(LIBS)
+
+nonblocktest: $(srcdir)/nonblocktest.c ../libpcap.a
+	$(CC) $(FULL_CFLAGS) -I. -L. -o nonblocktest $(srcdir)/nonblocktest.c \
+	    ../libpcap.a $(LIBS)
 
 reactivatetest: $(srcdir)/reactivatetest.c ../libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o reactivatetest $(srcdir)/reactivatetest.c ../libpcap.a $(LIBS)
+	$(CC) $(FULL_CFLAGS) -I. -L. -o reactivatetest \
+	    $(srcdir)/reactivatetest.c ../libpcap.a $(LIBS)
 
 selpolltest: $(srcdir)/selpolltest.c ../libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o selpolltest $(srcdir)/selpolltest.c ../libpcap.a $(LIBS)
+	$(CC) $(FULL_CFLAGS) -I. -L. -o selpolltest $(srcdir)/selpolltest.c \
+	    ../libpcap.a $(LIBS)
 
 threadsignaltest: $(srcdir)/threadsignaltest.c ../libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o threadsignaltest $(srcdir)/threadsignaltest.c ../libpcap.a $(LIBS) $(PTHREAD_LIBS)
+	$(CC) $(FULL_CFLAGS) -I. -L. -o threadsignaltest \
+	    $(srcdir)/threadsignaltest.c \
+	    ../libpcap.a $(LIBS) $(PTHREAD_LIBS)
 
 valgrindtest: $(srcdir)/valgrindtest.c ../libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o valgrindtest $(srcdir)/valgrindtest.c ../libpcap.a $(LIBS)
+	$(CC) $(FULL_CFLAGS) -I. -L. -o valgrindtest $(srcdir)/valgrindtest.c \
+	    ../libpcap.a $(LIBS)
 
 writecaptest: $(srcdir)/writecaptest.c ../libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o writecaptest $(srcdir)/writecaptest.c ../libpcap.a $(LIBS)
+	$(CC) $(FULL_CFLAGS) -I. -L. -o writecaptest $(srcdir)/writecaptest.c \
+	    ../libpcap.a $(LIBS)
 
 clean:
 	rm -f $(CLEANFILES)
diff --git a/testprogs/filtertest.c b/testprogs/filtertest.c
index 440b550..15556d0 100644
--- a/testprogs/filtertest.c
+++ b/testprogs/filtertest.c
@@ -217,7 +217,6 @@
 	int snaplen;
 	char *p;
 	int dlt;
-	int have_fcode = 0;
 	bpf_u_int32 netmask = PCAP_NETMASK_UNKNOWN;
 	char *cmdbuf;
 	pcap_t *pd;
@@ -340,7 +339,6 @@
 	if (pcap_compile(pd, &fcode, cmdbuf, Oflag, netmask) < 0)
 		error("%s", pcap_geterr(pd));
 
-	have_fcode = 1;
 	if (!bpf_validate(fcode.bf_insns, fcode.bf_len))
 		warn("Filter doesn't pass validation");
 
@@ -360,8 +358,7 @@
 
 	bpf_dump(&fcode, dflag);
 	free(cmdbuf);
-	if (have_fcode)
-		pcap_freecode (&fcode);
+	pcap_freecode (&fcode);
 	pcap_close(pd);
 	exit(0);
 }
diff --git a/testprogs/nonblocktest.c b/testprogs/nonblocktest.c
new file mode 100644
index 0000000..72700a3
--- /dev/null
+++ b/testprogs/nonblocktest.c
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#include "varattrs.h"
+
+/*
+ * Tests for pcap_set_nonblock / pcap_get_nonblock:
+ * - idempotency
+ * - set/get are symmetric
+ * - get returns the same before/after activate
+ * - pcap_breakloop works after setting nonblock on and then off
+ *
+ * Really this is meant to
+ * be run manually under strace, to check for extra
+ * calls to eventfd or close.
+ */
+#include <pcap.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+static pcap_t *pd;
+static char *program_name = "nonblocktest";
+/* Forwards */
+static void PCAP_NORETURN usage(void);
+static void PCAP_NORETURN error(const char *, ...) PCAP_PRINTFLIKE(1, 2);
+static void warning(const char *, ...) PCAP_PRINTFLIKE(1, 2);
+
+/* VARARGS */
+static void
+error(const char *fmt, ...)
+{
+	va_list ap;
+
+	(void)fprintf(stderr, "%s: ", program_name);
+	va_start(ap, fmt);
+	(void)vfprintf(stderr, fmt, ap);
+	va_end(ap);
+	if (*fmt) {
+		fmt += strlen(fmt);
+		if (fmt[-1] != '\n')
+			(void)fputc('\n', stderr);
+	}
+	exit(1);
+	/* NOTREACHED */
+}
+
+/* VARARGS */
+static void
+warning(const char *fmt, ...)
+{
+	va_list ap;
+
+	(void)fprintf(stderr, "%s: WARNING: ", program_name);
+	va_start(ap, fmt);
+	(void)vfprintf(stderr, fmt, ap);
+	va_end(ap);
+	if (*fmt) {
+		fmt += strlen(fmt);
+		if (fmt[-1] != '\n')
+			(void)fputc('\n', stderr);
+	}
+}
+
+static void
+usage(void)
+{
+	(void)fprintf(stderr, "Usage: %s [ -i interface ]\n",
+	    program_name);
+	exit(1);
+}
+
+static void
+breakme(u_char *user _U_, const struct pcap_pkthdr *h _U_, const u_char *sp _U_)
+{
+	warning("using pcap_breakloop()");
+	pcap_breakloop(pd);
+}
+
+int
+main(int argc, char **argv)
+{
+	int status, op, i, ret;
+	char *device;
+	pcap_if_t *devlist;
+	char ebuf[PCAP_ERRBUF_SIZE];
+
+	device = NULL;
+	while ((op = getopt(argc, argv, "i:sptnq")) != -1) {
+		switch (op) {
+
+		case 'i':
+			device = optarg;
+			break;
+
+		default:
+			usage();
+			/* NOTREACHED */
+		}
+	}
+	if (device == NULL) {
+		if (pcap_findalldevs(&devlist, ebuf) == -1)
+			error("%s", ebuf);
+		if (devlist == NULL)
+			error("no interfaces available for capture");
+		device = strdup(devlist->name);
+		warning("listening on %s", device);
+		pcap_freealldevs(devlist);
+	}
+	*ebuf = '\0';
+	pd = pcap_create(device, ebuf);
+	if (pd == NULL)
+		error("%s", ebuf);
+	else if (*ebuf)
+		warning("%s", ebuf);
+	/* set nonblock before activate */
+	if (pcap_setnonblock(pd, 1, ebuf) < 0)
+		error("pcap_setnonblock failed: %s", ebuf);
+	/* getnonblock just returns "not activated yet" */
+	ret = pcap_getnonblock(pd, ebuf);
+	if (ret != PCAP_ERROR_NOT_ACTIVATED)
+		error("pcap_getnonblock unexpectedly succeeded");
+	if ((status = pcap_activate(pd)) < 0)
+		error("pcap_activate failed");
+	ret = pcap_getnonblock(pd, ebuf);
+	if (ret != 1)
+		error( "pcap_getnonblock did not return nonblocking" );
+
+	/* Set nonblock multiple times, ensure with strace that it's a noop */
+	for (i=0; i<10; i++) {
+		if (pcap_setnonblock(pd, 1, ebuf) < 0)
+			error("pcap_setnonblock failed: %s", ebuf);
+		ret = pcap_getnonblock(pd, ebuf);
+		if (ret != 1)
+			error( "pcap_getnonblock did not return nonblocking" );
+	}
+	/* Set block multiple times, ensure with strace that it's a noop */
+	for (i=0; i<10; i++) {
+		if (pcap_setnonblock(pd, 0, ebuf) < 0)
+			error("pcap_setnonblock failed: %s", ebuf);
+		ret = pcap_getnonblock(pd, ebuf);
+		if (ret != 0)
+			error( "pcap_getnonblock did not return blocking" );
+	}
+
+	/* Now pcap_loop forever, with a callback that
+	 * uses pcap_breakloop to get out of forever */
+	pcap_loop(pd, -1, breakme, NULL);
+
+        /* Now test that pcap_setnonblock fails if we can't open the
+         * eventfd. */
+        if (pcap_setnonblock(pd, 1, ebuf) < 0)
+                error("pcap_setnonblock failed: %s", ebuf);
+        while (1) {
+                ret = open("/dev/null", O_RDONLY);
+                if (ret < 0)
+                        break;
+        }
+        ret = pcap_setnonblock(pd, 0, ebuf);
+        if (ret == 0)
+                error("pcap_setnonblock succeeded even though file table is full");
+        else
+                warning("pcap_setnonblock failed as expected: %s", ebuf);
+}
diff --git a/testprogs/pcap_compile_test.c b/testprogs/pcap_compile_test.c
deleted file mode 100644
index 924ec73..0000000
--- a/testprogs/pcap_compile_test.c
+++ /dev/null
@@ -1,11 +0,0 @@
-   pcap = pcap_open_dead(link, snaplen);
-   /* todo: hook together argv to a single string */
-   prog = argv[0];
-   if (pcap_compile(pcap, &p, prog, optimize, 0) < 0) {
-      fprintf(stderr, pcap_geterr(pcap));
-      exit(1);
-   }
-   bpf_dump(&p, option);
-   pcap_freecode(&p);
-   pcap_close(pcap);
-
diff --git a/testprogs/valgrindtest.c b/testprogs/valgrindtest.c
index 058b18b..55055ca 100644
--- a/testprogs/valgrindtest.c
+++ b/testprogs/valgrindtest.c
@@ -109,7 +109,7 @@
  * also include <pcap.h> to open the device in the first place, and that
  * means that we may get collisions between their definitions of
  * BPF_STMT and BPF_JUMP - and do, in fact, get them on Linux (the
- * definitons may be semantically the same, but that's not sufficient to
+ * definitions may be semantically the same, but that's not sufficient to
  * avoid the warnings, as the preprocessor doesn't know that u_short is
  * just unsigned short).
  *
diff --git a/testprogs/visopts.py b/testprogs/visopts.py
index 80c1463..97eafff 100755
--- a/testprogs/visopts.py
+++ b/testprogs/visopts.py
@@ -5,7 +5,7 @@
 each optimize phase.
 
 Usage guide:
-1. Enable optimizier debugging code when configure libpcap,
+1. Enable optimizer debugging code when configure libpcap,
    and build libpcap & the test programs
        ./configure --enable-optimizer-dbg
        make
diff --git a/tests/pcap-invalid-version-1.pcap b/tests/pcap-invalid-version-1.pcap
new file mode 100644
index 0000000..9dd0429
--- /dev/null
+++ b/tests/pcap-invalid-version-1.pcap
Binary files differ
diff --git a/tests/pcap-invalid-version-2.pcap b/tests/pcap-invalid-version-2.pcap
new file mode 100644
index 0000000..4217d1e
--- /dev/null
+++ b/tests/pcap-invalid-version-2.pcap
Binary files differ
diff --git a/tests/pcapng-invalid-vers-1.pcapng b/tests/pcapng-invalid-vers-1.pcapng
new file mode 100644
index 0000000..7bbb7ab
--- /dev/null
+++ b/tests/pcapng-invalid-vers-1.pcapng
Binary files differ
diff --git a/tests/pcapng-invalid-vers-2.pcapng b/tests/pcapng-invalid-vers-2.pcapng
new file mode 100644
index 0000000..77595f4
--- /dev/null
+++ b/tests/pcapng-invalid-vers-2.pcapng
Binary files differ