Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Feb 2017 08:23:39 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313695 - in head: contrib/libpcap contrib/libpcap/bpf/net contrib/libpcap/config contrib/libpcap/lbl contrib/libpcap/missing contrib/libpcap/pcap contrib/libpcap/tests lib/libpcap sbin...
Message-ID:  <201702130823.v1D8NdN1036002@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Mon Feb 13 08:23:39 2017
New Revision: 313695
URL: https://svnweb.freebsd.org/changeset/base/313695

Log:
  MFV r313676: libpcap 1.8.1
  
  MFC after:	1 month

Added:
  head/contrib/libpcap/config/
     - copied from r313676, vendor/libpcap/dist/config/
  head/contrib/libpcap/configure.ac
     - copied unchanged from r313676, vendor/libpcap/dist/configure.ac
  head/contrib/libpcap/extract.h
     - copied unchanged from r313676, vendor/libpcap/dist/extract.h
  head/contrib/libpcap/fad-helpers.c
     - copied unchanged from r313676, vendor/libpcap/dist/fad-helpers.c
  head/contrib/libpcap/gen_version_c.sh
     - copied unchanged from r313676, vendor/libpcap/dist/gen_version_c.sh
  head/contrib/libpcap/gen_version_header.sh
     - copied unchanged from r313676, vendor/libpcap/dist/gen_version_header.sh
  head/contrib/libpcap/lbl/os-aix7.h
     - copied unchanged from r313676, vendor/libpcap/dist/lbl/os-aix7.h
  head/contrib/libpcap/missing/getopt.c
     - copied unchanged from r313676, vendor/libpcap/dist/missing/getopt.c
  head/contrib/libpcap/missing/getopt.h
     - copied unchanged from r313676, vendor/libpcap/dist/missing/getopt.h
  head/contrib/libpcap/missing/strtok_r.c
     - copied unchanged from r313676, vendor/libpcap/dist/missing/strtok_r.c
  head/contrib/libpcap/missing/win_snprintf.c
     - copied unchanged from r313676, vendor/libpcap/dist/missing/win_snprintf.c
  head/contrib/libpcap/nametoaddr.h
     - copied unchanged from r313676, vendor/libpcap/dist/nametoaddr.h
  head/contrib/libpcap/pcap-new.c
     - copied unchanged from r313676, vendor/libpcap/dist/pcap-new.c
  head/contrib/libpcap/pcap-rpcap.c
     - copied unchanged from r313676, vendor/libpcap/dist/pcap-rpcap.c
  head/contrib/libpcap/pcap-rpcap.h
     - copied unchanged from r313676, vendor/libpcap/dist/pcap-rpcap.h
  head/contrib/libpcap/pcap-tc.c
     - copied unchanged from r313676, vendor/libpcap/dist/pcap-tc.c
  head/contrib/libpcap/pcap-tc.h
     - copied unchanged from r313676, vendor/libpcap/dist/pcap-tc.h
  head/contrib/libpcap/pcap/can_socketcan.h
     - copied unchanged from r313676, vendor/libpcap/dist/pcap/can_socketcan.h
  head/contrib/libpcap/pcap/dlt.h
     - copied unchanged from r313676, vendor/libpcap/dist/pcap/dlt.h
  head/contrib/libpcap/pcap/export-defs.h
     - copied unchanged from r313676, vendor/libpcap/dist/pcap/export-defs.h
  head/contrib/libpcap/pcap_version.h.in
     - copied unchanged from r313676, vendor/libpcap/dist/pcap_version.h.in
  head/contrib/libpcap/portability.h
     - copied unchanged from r313676, vendor/libpcap/dist/portability.h
  head/contrib/libpcap/remote-ext.h
     - copied unchanged from r313676, vendor/libpcap/dist/remote-ext.h
  head/contrib/libpcap/sockutils.c
     - copied unchanged from r313676, vendor/libpcap/dist/sockutils.c
  head/contrib/libpcap/sockutils.h
     - copied unchanged from r313676, vendor/libpcap/dist/sockutils.h
  head/contrib/libpcap/tests/can_set_rfmon_test.c
     - copied unchanged from r313676, vendor/libpcap/dist/tests/can_set_rfmon_test.c
  head/sys/net/dlt.h
     - copied, changed from r313694, head/sys/net/bpf.h
Deleted:
  head/contrib/libpcap/configure.in
  head/contrib/libpcap/fad-sita.c
  head/contrib/libpcap/pcap-can-linux.c
  head/contrib/libpcap/pcap-can-linux.h
  head/contrib/libpcap/pcap-canusb-linux.c
  head/contrib/libpcap/pcap-canusb-linux.h
  head/contrib/libpcap/runlex.sh
Modified:
  head/contrib/libpcap/CHANGES
  head/contrib/libpcap/CREDITS
  head/contrib/libpcap/INSTALL.txt
  head/contrib/libpcap/LICENSE
  head/contrib/libpcap/Makefile-devel-adds
  head/contrib/libpcap/Makefile.in
  head/contrib/libpcap/README
  head/contrib/libpcap/TODO
  head/contrib/libpcap/VERSION
  head/contrib/libpcap/bpf/net/bpf_filter.c
  head/contrib/libpcap/bpf_dump.c
  head/contrib/libpcap/bpf_image.c
  head/contrib/libpcap/config.guess
  head/contrib/libpcap/config.h.in
  head/contrib/libpcap/config.sub
  head/contrib/libpcap/configure
  head/contrib/libpcap/dlpisubs.c
  head/contrib/libpcap/etherent.c
  head/contrib/libpcap/ethertype.h
  head/contrib/libpcap/fad-getad.c
  head/contrib/libpcap/fad-gifc.c
  head/contrib/libpcap/fad-glifc.c
  head/contrib/libpcap/gencode.c
  head/contrib/libpcap/gencode.h
  head/contrib/libpcap/grammar.y
  head/contrib/libpcap/inet.c
  head/contrib/libpcap/install-sh
  head/contrib/libpcap/lbl/os-osf4.h
  head/contrib/libpcap/lbl/os-osf5.h
  head/contrib/libpcap/lbl/os-solaris2.h
  head/contrib/libpcap/lbl/os-sunos4.h
  head/contrib/libpcap/lbl/os-ultrix4.h
  head/contrib/libpcap/missing/snprintf.c
  head/contrib/libpcap/mkdep
  head/contrib/libpcap/nametoaddr.c
  head/contrib/libpcap/optimize.c
  head/contrib/libpcap/pcap-bpf.c
  head/contrib/libpcap/pcap-bpf.h
  head/contrib/libpcap/pcap-bt-linux.c
  head/contrib/libpcap/pcap-bt-linux.h
  head/contrib/libpcap/pcap-bt-monitor-linux.c
  head/contrib/libpcap/pcap-common.c
  head/contrib/libpcap/pcap-config.1
  head/contrib/libpcap/pcap-dag.c
  head/contrib/libpcap/pcap-dag.h
  head/contrib/libpcap/pcap-dbus.c
  head/contrib/libpcap/pcap-dlpi.c
  head/contrib/libpcap/pcap-dos.c
  head/contrib/libpcap/pcap-dos.h
  head/contrib/libpcap/pcap-filter.manmisc.in
  head/contrib/libpcap/pcap-int.h
  head/contrib/libpcap/pcap-libdlpi.c
  head/contrib/libpcap/pcap-linktype.manmisc.in
  head/contrib/libpcap/pcap-linux.c
  head/contrib/libpcap/pcap-netfilter-linux.c
  head/contrib/libpcap/pcap-netfilter-linux.h
  head/contrib/libpcap/pcap-nit.c
  head/contrib/libpcap/pcap-null.c
  head/contrib/libpcap/pcap-pf.c
  head/contrib/libpcap/pcap-savefile.manfile.in
  head/contrib/libpcap/pcap-septel.c
  head/contrib/libpcap/pcap-sita.c
  head/contrib/libpcap/pcap-snf.c
  head/contrib/libpcap/pcap-snit.c
  head/contrib/libpcap/pcap-snoop.c
  head/contrib/libpcap/pcap-stdinc.h
  head/contrib/libpcap/pcap-tstamp.manmisc.in
  head/contrib/libpcap/pcap-usb-linux.c
  head/contrib/libpcap/pcap-usb-linux.h
  head/contrib/libpcap/pcap-win32.c
  head/contrib/libpcap/pcap.3pcap.in
  head/contrib/libpcap/pcap.c
  head/contrib/libpcap/pcap/bluetooth.h
  head/contrib/libpcap/pcap/bpf.h
  head/contrib/libpcap/pcap/namedb.h
  head/contrib/libpcap/pcap/nflog.h
  head/contrib/libpcap/pcap/pcap.h
  head/contrib/libpcap/pcap/sll.h
  head/contrib/libpcap/pcap/usb.h
  head/contrib/libpcap/pcap_activate.3pcap
  head/contrib/libpcap/pcap_breakloop.3pcap
  head/contrib/libpcap/pcap_can_set_rfmon.3pcap
  head/contrib/libpcap/pcap_close.3pcap
  head/contrib/libpcap/pcap_compile.3pcap.in
  head/contrib/libpcap/pcap_create.3pcap
  head/contrib/libpcap/pcap_datalink.3pcap.in
  head/contrib/libpcap/pcap_datalink_name_to_val.3pcap
  head/contrib/libpcap/pcap_datalink_val_to_name.3pcap
  head/contrib/libpcap/pcap_dump.3pcap
  head/contrib/libpcap/pcap_dump_close.3pcap
  head/contrib/libpcap/pcap_dump_file.3pcap
  head/contrib/libpcap/pcap_dump_flush.3pcap
  head/contrib/libpcap/pcap_dump_ftell.3pcap
  head/contrib/libpcap/pcap_dump_open.3pcap.in
  head/contrib/libpcap/pcap_file.3pcap
  head/contrib/libpcap/pcap_fileno.3pcap
  head/contrib/libpcap/pcap_findalldevs.3pcap
  head/contrib/libpcap/pcap_freecode.3pcap
  head/contrib/libpcap/pcap_get_selectable_fd.3pcap
  head/contrib/libpcap/pcap_get_tstamp_precision.3pcap.in
  head/contrib/libpcap/pcap_geterr.3pcap
  head/contrib/libpcap/pcap_inject.3pcap
  head/contrib/libpcap/pcap_is_swapped.3pcap
  head/contrib/libpcap/pcap_lib_version.3pcap
  head/contrib/libpcap/pcap_list_datalinks.3pcap.in
  head/contrib/libpcap/pcap_list_tstamp_types.3pcap.in
  head/contrib/libpcap/pcap_lookupdev.3pcap
  head/contrib/libpcap/pcap_lookupnet.3pcap
  head/contrib/libpcap/pcap_loop.3pcap
  head/contrib/libpcap/pcap_major_version.3pcap
  head/contrib/libpcap/pcap_next_ex.3pcap
  head/contrib/libpcap/pcap_offline_filter.3pcap
  head/contrib/libpcap/pcap_open_dead.3pcap.in
  head/contrib/libpcap/pcap_open_live.3pcap
  head/contrib/libpcap/pcap_open_offline.3pcap.in
  head/contrib/libpcap/pcap_set_buffer_size.3pcap
  head/contrib/libpcap/pcap_set_datalink.3pcap
  head/contrib/libpcap/pcap_set_immediate_mode.3pcap
  head/contrib/libpcap/pcap_set_promisc.3pcap
  head/contrib/libpcap/pcap_set_rfmon.3pcap
  head/contrib/libpcap/pcap_set_snaplen.3pcap
  head/contrib/libpcap/pcap_set_timeout.3pcap
  head/contrib/libpcap/pcap_set_tstamp_precision.3pcap.in
  head/contrib/libpcap/pcap_set_tstamp_type.3pcap.in
  head/contrib/libpcap/pcap_setdirection.3pcap
  head/contrib/libpcap/pcap_setfilter.3pcap
  head/contrib/libpcap/pcap_setnonblock.3pcap
  head/contrib/libpcap/pcap_snapshot.3pcap
  head/contrib/libpcap/pcap_stats.3pcap
  head/contrib/libpcap/pcap_statustostr.3pcap
  head/contrib/libpcap/pcap_strerror.3pcap
  head/contrib/libpcap/pcap_tstamp_type_name_to_val.3pcap
  head/contrib/libpcap/pcap_tstamp_type_val_to_name.3pcap
  head/contrib/libpcap/savefile.c
  head/contrib/libpcap/scanner.l
  head/contrib/libpcap/sf-pcap-ng.c
  head/contrib/libpcap/sf-pcap.c
  head/contrib/libpcap/tests/capturetest.c
  head/contrib/libpcap/tests/filtertest.c
  head/contrib/libpcap/tests/findalldevstest.c
  head/contrib/libpcap/tests/opentest.c
  head/contrib/libpcap/tests/reactivatetest.c
  head/contrib/libpcap/tests/selpolltest.c
  head/contrib/libpcap/tests/valgrindtest.c
  head/lib/libpcap/Makefile
  head/lib/libpcap/config.h
  head/lib/libpcap/pcap-netmap.c
  head/sbin/pflogd/Makefile
  head/sys/net/bpf.h
  head/usr.sbin/ipfwpcap/Makefile
Directory Properties:
  head/contrib/libpcap/   (props changed)

Modified: head/contrib/libpcap/CHANGES
==============================================================================
--- head/contrib/libpcap/CHANGES	Mon Feb 13 02:15:56 2017	(r313694)
+++ head/contrib/libpcap/CHANGES	Mon Feb 13 08:23:39 2017	(r313695)
@@ -1,5 +1,80 @@
+Tuesday, Oct. 25, 2016 mcr@sandelman.ca
+  Summary for 1.8.1 libpcap release
+    Add a target in Makefile.in for Exuberant Ctags use: 'extags'.
+    Rename configure.in to configure.ac: autoconf 2.59
+    Clean up the name-to-DLT mapping table.
+    Add some newer DLT_ values: IPMI_HPM_2,ZWAVE_R1_R2,ZWAVE_R3,WATTSTOPPER_DLM,ISO_14443,RDS
+    Clarify what the return values are for both success and failure.
+    Many changes to build on windows
+    Check for the "break the loop" condition in the inner loop for TPACKET_V3.
+    Fix handling of packet count in the TPACKET_V3 inner loop: GitHub issue #493.
+    Filter out duplicate looped back CAN frames.
+    Fix the handling of loopback filters for IPv6 packets.
+    Add a link-layer header type for RDS (IEC 62106) groups.
+    Use different intermediate folders for x86 and x64 builds on Windows.
+    On Linux, handle all CAN captures with pcap-linux.c, in cooked mode.
+    Removes the need for the "host-endian" link-layer header type.
+    Compile with '-Wused-but-marked-unused' in devel mode if supported
+    Have separate DLTs for big-endian and host-endian SocketCAN headers.
+    Reflect version.h being renamed to pcap_version.h.
+    Require that version.h be generated: all build procedures we support generate version.h (autoconf, CMake, MSVC)!
+    Properly check for sock_recv() errors.
+    Re-impose some of Winsock's limitations on sock_recv().
+    Replace sprintf() with pcap_snprintf().
+    Fix signature of pcap_stats_ex_remote().
+    Initial cmake support for remote packet capture.
+    Have rpcap_remoteact_getsock() return a SOCKET and supply an "is active" flag.
+    Clean up {DAG, Septel, Myricom SNF}-only builds.
+    Do UTF-16-to-ASCII conversion into the right place.
+    pcap_create_interface() needs the interface name on Linux.
+    Clean up hardware time stamp support: the "any" device does not support any time stamp types.
+    Add support for capturing on FreeBSD usbusN interfaces.
+    Add a LINKTYPE/DLT_ value for FreeBSD USB.
+    Go back to using PCAP_API on Windows.
+    CMake support
+    Add TurboCap support from WinPcap.
+    Recognize 802.1ad nested VLAN tag in vlan filter.
+
+Thursday Sep. 3, 2015 guy@alum.mit.edu
+  Summary for 1.7.5 libpcap release
+	Man page cleanups.
+	Add some allocation failure checks.
+	Fix a number of Linux/ucLinux configure/build issues.
+	Fix some memory leaks.
+	Recognize 802.1ad nested VLAN tag in vlan filter.
+	Fix building Bluetooth Linux Monitor support with BlueZ 5.1+
+
+Saturday Jun. 27, 2015 mcr@sandelman.ca
+  Summary for 1.7.4 libpcap release
+	Include fix for GitHub issue #424 -- out of tree builds.
+
+Friday Apr. 10, 2015 guy@alum.mit.edu
+  Summary for 1.7.3 libpcap release
+	Work around a Linux bonding driver bug.
+
+Thursday Feb. 12, 2015 guy@alum.mit.edu/mcr@sandelman.ca
+  Summary for 1.7.2 libpcap release
+	Support for filtering Geneve encapsulated packets.
+	Generalize encapsulation handling, fixing some bugs.
+	Don't add null addresses to address lists.
+	Add pcap_dump_open_append() to open for appending.
+	Fix the swapping of isochronous descriptors in Linux USB.
+	Attempt to handle TPACKET_V1 with 32-bit userland and 64-bit kernel.
+
+Wednesday Nov. 12, 2014 guy@alum.mit.edu/mcr@sandelman.ca
+  Summary for 1.7.0 libpcap release
+	Fix handling of zones for BPF on Solaris
+	new DLT for ZWAVE
+	clarifications for read timeouts.
+	Use BPF extensions in compiled filters, fixing VLAN filters
+	some fixes to compilation without stdint.h
+	EBUSY can now be returned by SNFv3 code.
+	Fix the range checks in BPF loads
+	Various DAG fixes.
+	Various Linux fixes.
+
 Monday Aug. 12, 2014 guy@alum.mit.edu
-  Summary for 1.6.2 tcpdump release
+  Summary for 1.6.2 libpcap release
 	Don't crash on filters testing a non-existent link-layer type
 	    field.
 	Fix sending in non-blocking mode on Linux with memory-mapped
@@ -8,12 +83,12 @@ Monday Aug. 12, 2014 guy@alum.mit.edu
 	    machines.
 
 Saturday  Jul. 19, 2014 mcr@sandelman.ca
-  Summary for 1.6.1 tcpdump release
+  Summary for 1.6.1 libpcap release
 	some fixes for the any device
-	changes for how --enable-XXX works
+	changes for how --enable-XXX (--enable-sniffing, --enable-can) works
 
 Wednesday Jul. 2, 2014 mcr@sandelman.ca
-  Summary for 1.6.0 tcpdump release
+  Summary for 1.6.0 libpcap release
         Don't support D-Bus sniffing on OS X
         fixes for byte order issues with NFLOG captures
         Handle using cooked mode for DLT_NETLINK in activate_new().

Modified: head/contrib/libpcap/CREDITS
==============================================================================
--- head/contrib/libpcap/CREDITS	Mon Feb 13 02:15:56 2017	(r313694)
+++ head/contrib/libpcap/CREDITS	Mon Feb 13 08:23:39 2017	(r313695)
@@ -2,11 +2,12 @@ This file lists people who have contribu
 
 The current maintainers:
     Bill Fenner                   <fenner at research dot att dot com>
-    Denis Ovsienko                <infrastation at yandex dot ru>
+    Denis Ovsienko                <denis at ovsienko dot info>
     Fulvio Risso                  <risso at polito dot it>
     Guy Harris                    <guy at alum dot mit dot edu>
     Hannes Gredler                <hannes at juniper dot net>
     Michael Richardson            <mcr at sandelman dot ottawa dot on dot ca>
+    Francois-Xavier Le Bail       <fx dot lebail at yahoo dot com>
 
 Additional people who have contributed patches:
 
@@ -45,7 +46,7 @@ Additional people who have contributed p
     David Young                   <dyoung at ojctech dot com>
     Dean Gaudet                   <dean at arctic dot org>
     dhruv                         <rsrivat at sourceforge dot net>
-    Don Ebright                   <Don dot Ebright at compuware dot com> 
+    Don Ebright                   <Don dot Ebright at compuware dot com>
     Dug Song                      <dugsong at monkey dot org>
     Dustin Spicuzza               <dustin at virtualroadside dot com>
     dzejarczech                   <dzejarczech at sourceforge dot net>
@@ -83,6 +84,7 @@ Additional people who have contributed p
     Jefferson Ogata               <jogata at nodc dot noaa dot gov>
     Jesper Dangaard Brouer        <hawk at comx dot dk>
     Jesper Peterson               <jesper at endace dot com>
+    Jesse Gross                   <jesse at nicira dot com>
     Jiri Slaby                    <jirislaby at gmail dot com>
     Joerg Mayer                   <jmayer at loplof dot de>
     John Bankier                  <jbankier at rainfinity dot com>
@@ -105,6 +107,7 @@ Additional people who have contributed p
     Mansour Behabadi              <mansour at oxplot dot com>
     Marcus Felipe Pereira         <marcus at task dot com dot br>
     Mark C. Brown                 <mbrown at hp dot com>
+    Mark Johnston                 <markjdb at gmail dot com>
     Mark Pizzolato                <List-tcpdump-workers at subscriptions dot pizzolato dot net>
     Markus Mayer                  <markus_mayer at sourceforge dot net>
     Martin Husemann               <martin at netbsd dot org>

Modified: head/contrib/libpcap/INSTALL.txt
==============================================================================
--- head/contrib/libpcap/INSTALL.txt	Mon Feb 13 02:15:56 2017	(r313694)
+++ head/contrib/libpcap/INSTALL.txt	Mon Feb 13 08:23:39 2017	(r313695)
@@ -16,7 +16,7 @@ does support packet capture but libpcap 
 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.in.
+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
@@ -31,40 +31,22 @@ You will need an ANSI C compiler to buil
 will abort if your compiler is not ANSI compliant. If this happens, use
 the generally available GNU C compiler (GCC).
 
-If you use flex, you must use version 2.4.6 or higher. The configure
-script automatically detects the version of flex and will not use it
-unless it is new enough. You can use "flex -V" to see what version you
-have (unless it's really old). The current version of flex is available
-at flex.sourceforge.net and often comes packaged by means of the OS.
-As of this writing, the current version is 2.5.37.
-
-If you use bison, you must use flex (and visa versa). The configure
-script automatically falls back to lex and yacc if both flex and bison
-are not found.
-
-Sometimes the stock C compiler does not interact well with flex and
-bison. The list of problems includes undefined references for alloca.
-You can get around this by installing gcc or manually disabling flex
-and bison with:
-
-    ./configure --without-flex --without-bison
-
-If your system only has AT&T lex, this is okay unless your libpcap
-program uses other lex/yacc generated code. (Although it's possible to
-map the yy* identifiers with a script, we use flex and bison so we
-don't feel this is necessary.)
-
-Some systems support the Berkeley Packet Filter natively; for example
-out of the box OSF and BSD/OS have bpf. If your system does not support
-bpf, you will need to pick up:
-
-	ftp://ftp.ee.lbl.gov/bpf-*.tar.Z
-
-Note well: you MUST have kernel source for your operating system in
-order to install bpf. An exception is SunOS 4; the bpf distribution
-includes replacement kernel objects for some of the standard SunOS 4
-network device drivers. See the bpf INSTALL document for more
-information.
+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.
+
+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
+http://ftp.gnu.org/gnu/bison/ and the current version of Berkeley YACC
+can be found at http://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.
+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
@@ -178,14 +160,14 @@ packet timestamps aren't very good.  Thi
 handling of the timestamp in the kernel.
 
 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. 
+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. 
+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. 
+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. 
+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!
 
@@ -239,11 +221,11 @@ the libpcap 0.6.2 source release, so thi
 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
+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:
 
-	ftp://ftp.gnu.org/pub/gnu/bison
+	http://ftp.gnu.org/gnu/bison/
 
 or hack around it by inserting the lines:
 
@@ -289,6 +271,7 @@ FILES
 CHANGES		- description of differences between releases
 ChmodBPF/*	- Mac OS X startup item to set ownership and permissions
 		  on /dev/bpf*
+CMakeLists.txt	- CMake file
 CREDITS		- people that have helped libpcap along
 INSTALL.txt	- this file
 LICENSE		- the license under which tcpdump is distributed
@@ -317,7 +300,7 @@ config.guess	- autoconf support
 config.h.in	- autoconf input
 config.sub	- autoconf support
 configure	- configure script (run this first)
-configure.in	- configure script source
+configure.ac	- configure script source
 dlpisubs.c	- DLPI-related functions for pcap-dlpi.c and pcap-libdlpi.c
 dlpisubs.h	- DLPI-related function declarations
 etherent.c	- /etc/ethers support routines
@@ -325,9 +308,6 @@ ethertype.h	- Ethernet protocol types an
 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
-fad-null.c	- pcap_findalldevs() for systems without capture support
-fad-sita.c	- pcap_findalldevs() for systems with SITA support
-fad-win32.c	- pcap_findalldevs() for WinPcap
 filtertest.c	- test program for BPF compiler
 findalldevstest.c - test program for pcap_findalldevs()
 gencode.c	- BPF code generation routines
@@ -345,7 +325,6 @@ nametoaddr.c	- hostname to address routi
 nlpid.h		- OSI network layer protocol identifier definitions
 net		- symlink to bpf/net
 optimize.c	- BPF optimization routines
-packaging	- packaging information for building libpcap RPMs
 pcap/bluetooth.h - public definition of DLT_BLUETOOTH_HCI_H4_WITH_PHDR header
 pcap/bpf.h	- BPF definitions
 pcap/namedb.h	- public libpcap name database definitions
@@ -389,7 +368,6 @@ pcap_*.3pcap	- manual entries for librar
 pcap-filter.4	- manual entry for filter syntax
 pcap-linktype.4	- manual entry for link-layer header types
 ppp.h		- Point to Point Protocol definitions
-runlex.sh	- wrapper for Lex/Flex
 savefile.c	- offline support
 scanner.l	- filter string scanner
 sunatmpos.h	- definitions for SunATM capturing

Modified: head/contrib/libpcap/LICENSE
==============================================================================
--- head/contrib/libpcap/LICENSE	Mon Feb 13 02:15:56 2017	(r313694)
+++ head/contrib/libpcap/LICENSE	Mon Feb 13 08:23:39 2017	(r313695)
@@ -1,9 +1,9 @@
 License: BSD
- 
+
 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
@@ -13,7 +13,7 @@ are met:
   3. The names of the authors may not 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.

Modified: head/contrib/libpcap/Makefile-devel-adds
==============================================================================
--- head/contrib/libpcap/Makefile-devel-adds	Mon Feb 13 02:15:56 2017	(r313694)
+++ head/contrib/libpcap/Makefile-devel-adds	Mon Feb 13 08:23:39 2017	(r313695)
@@ -2,12 +2,12 @@
 # Auto-regenerate configure script or Makefile when things change.
 # From autoconf.info .  Works best with GNU Make.
 #
-${srcdir}/configure: configure.in aclocal.m4
+${srcdir}/configure: configure.ac aclocal.m4
 	cd ${srcdir} && autoconf
 
 # autoheader might not change config.h.in, so touch a stamp file.
 ${srcdir}/config.h.in: ${srcdir}/stamp-h.in
-${srcdir}/stamp-h.in: configure.in aclocal.m4
+${srcdir}/stamp-h.in: configure.ac aclocal.m4
 	cd ${srcdir} && autoheader
 	echo timestamp > ${srcdir}/stamp-h.in
 

Modified: head/contrib/libpcap/Makefile.in
==============================================================================
--- head/contrib/libpcap/Makefile.in	Mon Feb 13 02:15:56 2017	(r313694)
+++ head/contrib/libpcap/Makefile.in	Mon Feb 13 08:23:39 2017	(r313695)
@@ -49,12 +49,13 @@ LN_S = @LN_S@
 MKDEP = @MKDEP@
 CCOPT = @V_CCOPT@
 INCLS = -I. @V_INCLS@
-DEFS = @DEFS@ @V_DEFS@
+DEFS = -DBUILDING_PCAP @DEFS@ @V_DEFS@
 ADDLOBJS = @ADDLOBJS@
 ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
 LIBS = @LIBS@
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@
+CROSSFLAGS=
+CFLAGS = @CFLAGS@   ${CROSSFLAGS}
+LDFLAGS = @LDFLAGS@ ${CROSSFLAGS}
 DYEXT = @DYEXT@
 V_RPATH_OPT = @V_RPATH_OPT@
 DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
@@ -68,13 +69,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 RANLIB = @RANLIB@
 
-#
-# Flex and bison allow you to specify the prefixes of the global symbols
-# used by the generated parser.  This allows programs to use lex/yacc
-# and link against libpcap.  If you don't have flex or bison, get them.
-#
-LEX = @V_LEX@
-YACC = @V_YACC@
+LEX = @LEX@
+YACC = @YACC@
 
 # Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
 # Also, gcc does not remove the .o before forking 'as', which can be a
@@ -83,11 +79,11 @@ YACC = @V_YACC@
 	@rm -f $@
 	$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
 
-PSRC =	pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @CAN_SRC@ @NETFILTER_SRC@ @CANUSB_SRC@ @DBUS_SRC@
-FSRC =  fad-@V_FINDALLDEVS@.c
+PSRC =	pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @NETFILTER_SRC@ @DBUS_SRC@
+FSRC =  @V_FINDALLDEVS@
 SSRC =  @SSRC@
-CSRC =	pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \
-	savefile.c sf-pcap.c sf-pcap-ng.c pcap-common.c \
+CSRC =	pcap.c inet.c fad-helpers.c gencode.c optimize.c nametoaddr.c \
+	etherent.c savefile.c sf-pcap.c sf-pcap-ng.c pcap-common.c \
 	bpf_image.c bpf_dump.c
 GENSRC = scanner.c grammar.c bpf_filter.c version.c
 LIBOBJS = @LIBOBJS@
@@ -103,6 +99,9 @@ PUBHDR = \
 	pcap-namedb.h \
 	pcap/bpf.h \
 	pcap/bluetooth.h \
+	pcap/can_socketcan.h \
+	pcap/dlt.h \
+	pcap/export-defs.h \
 	pcap/ipnet.h \
 	pcap/namedb.h \
 	pcap/nflog.h \
@@ -115,37 +114,43 @@ HDR = $(PUBHDR) \
 	arcnet.h \
 	atmuni31.h \
 	ethertype.h \
+	extract.h \
 	gencode.h \
 	ieee80211.h \
 	llc.h \
+	nametoaddr.h \
 	nlpid.h \
 	pcap-common.h \
 	pcap-int.h \
 	pcap-stdinc.h \
+	portability.h \
 	ppp.h \
 	sf-pcap.h \
 	sf-pcap-ng.h \
 	sunatmpos.h
 
 TESTS = \
+	@VALGRINDTEST@ \
 	capturetest \
+	can_set_rfmon_test \
 	filtertest \
 	findalldevstest \
 	opentest \
-	selpolltest \
-	valgrindtest
+	reactivatetest \
+	selpolltest
 
 TESTS_SRC = \
+	tests/valgrindtest.c \
 	tests/capturetest.c \
+	tests/can_set_rfmon_test.c \
 	tests/filtertest.c \
 	tests/findalldevstest.c \
 	tests/opentest.c \
 	tests/reactivatetest.c \
-	tests/selpolltest.c \
-	tests/valgrindtest.c
+	tests/selpolltest.c
 
 GENHDR = \
-	scanner.h tokdefs.h version.h
+	scanner.h grammar.h pcap_version.h
 
 TAGFILES = \
 	$(SRC) $(HDR)
@@ -231,6 +236,8 @@ EXTRA_DIST = \
 	ChmodBPF/ChmodBPF \
 	ChmodBPF/StartupParameters.plist \
 	CREDITS \
+	CMakeLists.txt \
+	GenVersion.bat \
 	INSTALL.txt \
 	LICENSE \
 	Makefile.in \
@@ -253,29 +260,37 @@ EXTRA_DIST = \
 	aclocal.m4 \
 	bpf/net/bpf_filter.c \
 	chmod_bpf \
+	cmakeconfig.h.in \
+	cmake/preconfigure.cmake \
+	config/have_siocglifconf.c \
 	config.guess \
 	config.h.in \
 	config.sub \
 	configure \
-	configure.in \
+	configure.ac \
 	dlpisubs.c \
 	dlpisubs.h \
 	fad-getad.c \
 	fad-gifc.c \
 	fad-glifc.c \
-	fad-null.c \
-	fad-sita.c \
-	fad-win32.c \
+	fad-helpers.c \
+	gen_version_c.sh \
+	gen_version_header.sh \
 	grammar.y \
 	install-sh \
 	lbl/os-aix4.h \
+	lbl/os-aix7.h \
 	lbl/os-hpux11.h \
 	lbl/os-osf4.h \
 	lbl/os-osf5.h \
 	lbl/os-solaris2.h \
 	lbl/os-sunos4.h \
 	lbl/os-ultrix4.h \
+	missing/getopt.c \
+	missing/getopt.h \
 	missing/snprintf.c \
+	missing/strtok_r.c \
+	missing/win_snprintf.c \
 	mkdep \
 	msdos/bin2c.c \
 	msdos/common.dj \
@@ -291,16 +306,11 @@ EXTRA_DIST = \
 	msdos/pktdrvr.h \
 	msdos/readme.dos \
 	org.tcpdump.chmod_bpf.plist \
-	packaging/pcap.spec.in \
 	pcap-bpf.c \
 	pcap-bt-linux.c \
 	pcap-bt-linux.h \
 	pcap-bt-monitor-linux.c \
 	pcap-bt-monitor-linux.h \
-	pcap-can-linux.c \
-	pcap-can-linux.h \
-	pcap-canusb-linux.c \
-	pcap-canusb-linux.h \
 	pcap-config.in \
 	pcap-dag.c \
 	pcap-dag.h \
@@ -314,11 +324,14 @@ EXTRA_DIST = \
 	pcap-libdlpi.c \
 	pcap-linux.c \
 	pcap-namedb.h \
+	pcap-new.c \
 	pcap-netfilter-linux.c \
 	pcap-netfilter-linux.h \
 	pcap-nit.c \
 	pcap-null.c \
 	pcap-pf.c \
+	pcap-rpcap.c \
+	pcap-rpcap.h \
 	pcap-septel.c \
 	pcap-septel.h \
 	pcap-sita.h \
@@ -328,34 +341,22 @@ EXTRA_DIST = \
 	pcap-snf.h \
 	pcap-snit.c \
 	pcap-snoop.c \
+	pcap-tc.c \
+	pcap-tc.h \
 	pcap-usb-linux.c \
 	pcap-usb-linux.h \
 	pcap-win32.c \
-	runlex.sh \
+	remote-ext.h \
+	sockutils.c \
+	sockutils.h \
 	scanner.l \
+	tests/CMakeLists.txt \
+	pcap_version.h.in \
 	Win32/Include/Gnuc.h \
-	Win32/Include/addrinfo.h \
-	Win32/Include/bittypes.h \
-	Win32/Include/cdecl_ext.h \
-	Win32/Include/inetprivate.h \
-	Win32/Include/ip6_misc.h \
-	Win32/Include/sockstorage.h \
-	Win32/Include/arpa/nameser.h \
 	Win32/Include/net/if.h \
-	Win32/Include/net/netdb.h \
-	Win32/Include/net/paths.h \
-	Win32/Prj/libpcap.dsp \
-	Win32/Prj/libpcap.dsw \
-	Win32/Src/ffs.c \
-	Win32/Src/gai_strerror.c \
-	Win32/Src/getaddrinfo.c \
-	Win32/Src/getnetbynm.c \
-	Win32/Src/getnetent.c \
-	Win32/Src/getopt.c \
-	Win32/Src/getservent.c \
-	Win32/Src/inet_aton.c \
-	Win32/Src/inet_net.c \
-	Win32/Src/inet_pton.c
+	Win32/Prj/wpcap.sln \
+	Win32/Prj/wpcap.vcxproj \
+	Win32/Prj/wpcap.vcxproj.filters
 
 all: libpcap.a shared pcap-config
 
@@ -443,24 +444,33 @@ libpcap.shareda: $(OBJ)
 libpcap.none:
 
 scanner.c: $(srcdir)/scanner.l
-	@rm -f $@
-	$(srcdir)/runlex.sh $(LEX) -o$@ $<
+	$(LEX) -P pcap_ --header-file=scanner.h --nounput -o scanner.c $<
+scanner.h: scanner.c
+## Recover from the removal of $@
+	@if test -f $@; then :; else \
+		rm -f scanner.c; \
+		$(MAKE) $(MAKEFLAGS) scanner.c; \
+	fi
 
-scanner.o: scanner.c tokdefs.h
+scanner.o: scanner.c grammar.h
 	$(CC) $(FULL_CFLAGS) -c scanner.c
 
-pcap.o: version.h
+pcap.o: pcap_version.h
 
-tokdefs.h: grammar.c
 grammar.c: $(srcdir)/grammar.y
-	@rm -f grammar.c tokdefs.h
-	$(YACC) -d $<
-	mv y.tab.c grammar.c
-	mv y.tab.h tokdefs.h
+	$(YACC) -p pcap_ -o grammar.c -d $<
+grammar.h: grammar.c
+## Recover from the removal of $@
+	@if test -f $@; then :; else \
+		rm -f grammar.c; \
+		$(MAKE) $(MAKEFLAGS) grammar.c; \
+	fi
 
 grammar.o: grammar.c
-	@rm -f $@
-	$(CC) $(FULL_CFLAGS) -Dyylval=pcap_lval -c grammar.c
+	$(CC) $(FULL_CFLAGS) -c grammar.c
+
+gencode.o: $(srcdir)/gencode.c grammar.h scanner.h
+	$(CC) $(FULL_CFLAGS) -c $(srcdir)/gencode.c
 
 version.o: version.c
 	$(CC) $(FULL_CFLAGS) -c version.c
@@ -468,32 +478,21 @@ version.o: version.c
 snprintf.o: $(srcdir)/missing/snprintf.c
 	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
 
-version.c: $(srcdir)/VERSION
+strtok_r.o: $(srcdir)/missing/strtok_r.c
+	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strtok_r.c
+
+version.c: $(srcdir)/VERSION $(srcdir)/gen_version_c.sh
+	#
+	# Older programs import this if they want to show the
+	# libpcap version number, rather than calling
+	# pcap_lib_version(), so we need to export it.
+	#
 	@rm -f $@
-	if grep GIT ${srcdir}/VERSION >/dev/null; then \
-		read ver <${srcdir}/VERSION; \
-		echo $$ver | tr -d '\012'; \
-		date +_%Y_%m_%d; \
-	else \
-		cat ${srcdir}/VERSION; \
-	fi | sed -e 's/.*/char pcap_version[] = "&";/' > $@
-
-#
-# NOTE: this really is supposed to be static; importing a string
-# from a shared library does not work very well on many
-# versions of UNIX (Solaris, Linux, and the BSDs, for example),
-# so we make the version string static and return it from
-# a function, which does work.
-#
-version.h: $(srcdir)/VERSION
+	$(srcdir)/gen_version_c.sh $(srcdir)/VERSION $@
+
+pcap_version.h: $(srcdir)/VERSION $(srcdir)/pcap_version.h.in $(srcdir)/gen_version_header.sh
 	@rm -f $@
-	if grep GIT ${srcdir}/VERSION >/dev/null; then \
-		read ver <${srcdir}/VERSION; \
-		echo $$ver | tr -d '\012'; \
-		date +_%Y_%m_%d; \
-	else \
-		cat ${srcdir}/VERSION; \
-	fi | sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' > $@
+	$(srcdir)/gen_version_header.sh $(srcdir)/VERSION $(srcdir)/pcap_version.h.in $@
 
 bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
 	rm -f bpf_filter.c
@@ -530,6 +529,9 @@ tests: $(TESTS)
 capturetest: tests/capturetest.c libpcap.a
 	$(CC) $(FULL_CFLAGS) -I. -L. -o capturetest $(srcdir)/tests/capturetest.c libpcap.a $(LIBS)
 
+can_set_rfmon_test: tests/can_set_rfmon_test.c libpcap.a
+	$(CC) $(FULL_CFLAGS) -I. -L. -o can_set_rfmon_test $(srcdir)/tests/can_set_rfmon_test.c libpcap.a $(LIBS)
+
 filtertest: tests/filtertest.c libpcap.a
 	$(CC) $(FULL_CFLAGS) -I. -L. -o filtertest $(srcdir)/tests/filtertest.c libpcap.a $(LIBS)
 
@@ -539,6 +541,9 @@ findalldevstest: tests/findalldevstest.c
 opentest: tests/opentest.c libpcap.a
 	$(CC) $(FULL_CFLAGS) -I. -L. -o opentest $(srcdir)/tests/opentest.c libpcap.a $(LIBS)
 
+reactivatetest: tests/reactivatetest.c libpcap.a
+	$(CC) $(FULL_CFLAGS) -I. -L. -o reactivatetest $(srcdir)/tests/reactivatetest.c libpcap.a $(LIBS)
+
 selpolltest: tests/selpolltest.c libpcap.a
 	$(CC) $(FULL_CFLAGS) -I. -L. -o selpolltest $(srcdir)/tests/selpolltest.c libpcap.a $(LIBS)
 
@@ -728,13 +733,12 @@ distclean: clean
 	rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)
 	rm -rf autom4te.cache
 
+extags: $(TAGFILES)
+	ctags $(TAGFILES)
+
 tags: $(TAGFILES)
 	ctags -wtd $(TAGFILES)
 
-packaging/pcap.spec: packaging/pcap.spec.in VERSION
-	RPMVERSION=`cat VERSION | sed s/-.*//g`; \
-		sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $<   > $@
-
 releasetar:
 	@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
 	   mkdir $$name; \

Modified: head/contrib/libpcap/README
==============================================================================
--- head/contrib/libpcap/README	Mon Feb 13 02:15:56 2017	(r313694)
+++ head/contrib/libpcap/README	Mon Feb 13 08:23:39 2017	(r313695)
@@ -76,15 +76,15 @@ information on configuring that option.
 
 Note to Linux distributions and *BSD systems that include libpcap:
 
-There's now a rule to make a shared library, which should work on Linux 
+There's now a rule to make a shared library, which should work on Linux
 and *BSD, among other platforms.
 
-It sets the soname of the library to "libpcap.so.1"; this is what it 
-should be, *NOT* libpcap.so.1.x or libpcap.so.1.x.y or something such as 
+It sets the soname of the library to "libpcap.so.1"; this is what it
+should be, *NOT* libpcap.so.1.x or libpcap.so.1.x.y or something such as
 that.
 
-We've been maintaining binary compatibility between libpcap releases for 
-quite a while; there's no reason to tie a binary linked with libpcap to 
+We've been maintaining binary compatibility between libpcap releases for
+quite a while; there's no reason to tie a binary linked with libpcap to
 a particular release of libpcap.
 
 Problems, bugs, questions, desirable enhancements, etc. should be sent

Modified: head/contrib/libpcap/TODO
==============================================================================
--- head/contrib/libpcap/TODO	Mon Feb 13 02:15:56 2017	(r313694)
+++ head/contrib/libpcap/TODO	Mon Feb 13 08:23:39 2017	(r313695)
@@ -6,11 +6,11 @@ Important stuff (to be done before the n
 
 General
 
-- configure should not be in Git. Most open source projects have an 
-  autogen.sh script to run autoconf etc. after checkout. I think we 
-  should stick to the standard. 
+- configure should not be in Git. Most open source projects have an
+  autogen.sh script to run autoconf etc. after checkout. I think we
+  should stick to the standard.
 
-- The source files should be better documented. There is no official 
+- The source files should be better documented. There is no official
   design guideline for what is done where. There should be a common coding
   style (okay, you can guess that by looking at the code) and a guide for
   what needs to be documented.
@@ -18,7 +18,7 @@ General
 Less urgent items
 -----------------
 
-- Better documentation and cleanup of the interface. I am seeing a few  
+- Better documentation and cleanup of the interface. I am seeing a few
   problems at the first glance which needs fixing:
   + pcap_lookupnet makes little to no sense with protocols != IPv4
   + not very well suited for interactive programs (think ethereal). There

Modified: head/contrib/libpcap/VERSION
==============================================================================
--- head/contrib/libpcap/VERSION	Mon Feb 13 02:15:56 2017	(r313694)
+++ head/contrib/libpcap/VERSION	Mon Feb 13 08:23:39 2017	(r313695)
@@ -1 +1 @@
-1.6.2
+1.8.1

Modified: head/contrib/libpcap/bpf/net/bpf_filter.c
==============================================================================
--- head/contrib/libpcap/bpf/net/bpf_filter.c	Mon Feb 13 02:15:56 2017	(r313694)
+++ head/contrib/libpcap/bpf/net/bpf_filter.c	Mon Feb 13 08:23:39 2017	(r313695)
@@ -42,11 +42,11 @@
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #include <pcap-stdinc.h>
 
-#else /* WIN32 */
+#else /* _WIN32 */
 
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
@@ -73,7 +73,7 @@
 # define	MLEN(m)	((m)->m_len)
 #endif /* defined(__hpux) || SOLARIS */
 
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <pcap/bpf.h>
 
@@ -99,7 +99,7 @@
 #endif
 
 #ifndef LBL_ALIGN
-#ifndef WIN32
+#ifndef _WIN32
 #include <netinet/in.h>
 #endif
 
@@ -195,23 +195,41 @@ m_xhalf(m, k, err)
 }
 #endif
 
+#ifdef __linux__
+#include <linux/types.h>
+#include <linux/if_packet.h>
+#include <linux/filter.h>
+#endif
+
+enum {
+        BPF_S_ANC_NONE,
+        BPF_S_ANC_VLAN_TAG,
+        BPF_S_ANC_VLAN_TAG_PRESENT,
+};
+
 /*
  * Execute the filter program starting at pc on the packet p
  * wirelen is the length of the original packet
  * buflen is the amount of data present
+ * aux_data is auxiliary data, currently used only when interpreting
+ * filters intended for the Linux kernel in cases where the kernel
+ * rejects the filter; it contains VLAN tag information
  * For the kernel, p is assumed to be a pointer to an mbuf if buflen is 0,
  * in all other cases, p is a pointer to a buffer and buflen is its size.
+ *
+ * Thanks to Ani Sinha <ani@arista.com> for providing initial implementation
  */
 u_int
-bpf_filter(pc, p, wirelen, buflen)
+bpf_filter_with_aux_data(pc, p, wirelen, buflen, aux_data)
 	register const struct bpf_insn *pc;
 	register const u_char *p;
 	u_int wirelen;
 	register u_int buflen;
+	register const struct bpf_aux_data *aux_data;
 {
 	register u_int32 A, X;
-	register int k;
-	int32 mem[BPF_MEMWORDS];
+	register bpf_u_int32 k;
+	u_int32 mem[BPF_MEMWORDS];
 #if defined(KERNEL) || defined(_KERNEL)
 	struct mbuf *m, *n;
 	int merr, len;
@@ -250,7 +268,7 @@ bpf_filter(pc, p, wirelen, buflen)
 
 		case BPF_LD|BPF_W|BPF_ABS:
 			k = pc->k;
-			if (k + sizeof(int32) > buflen) {
+			if (k > buflen || sizeof(int32_t) > buflen - k) {
 #if defined(KERNEL) || defined(_KERNEL)
 				if (m == NULL)
 					return 0;
@@ -267,7 +285,7 @@ bpf_filter(pc, p, wirelen, buflen)
 
 		case BPF_LD|BPF_H|BPF_ABS:
 			k = pc->k;
-			if (k + sizeof(short) > buflen) {
+			if (k > buflen || sizeof(int16_t) > buflen - k) {
 #if defined(KERNEL) || defined(_KERNEL)
 				if (m == NULL)
 					return 0;
@@ -283,22 +301,50 @@ bpf_filter(pc, p, wirelen, buflen)
 			continue;
 
 		case BPF_LD|BPF_B|BPF_ABS:
-			k = pc->k;
-			if (k >= buflen) {
-#if defined(KERNEL) || defined(_KERNEL)
-				if (m == NULL)
-					return 0;
-				n = m;
-				MINDEX(len, n, k);
-				A = mtod(n, u_char *)[k];
-				continue;
-#else
-				return 0;
+			{
+#if defined(SKF_AD_VLAN_TAG) && defined(SKF_AD_VLAN_TAG_PRESENT)
+				int code = BPF_S_ANC_NONE;
+#define ANCILLARY(CODE) case SKF_AD_OFF + SKF_AD_##CODE:		\
+				code = BPF_S_ANC_##CODE;		\
+                                        if (!aux_data)                  \
+                                                return 0;               \
+                                        break;
+
+				switch (pc->k) {
+					ANCILLARY(VLAN_TAG);
+					ANCILLARY(VLAN_TAG_PRESENT);
+				default :
+#endif
+					k = pc->k;
+					if (k >= buflen) {
+#if defined(KERNEL) || defined(_KERNEL)
+						if (m == NULL)
+							return 0;
+						n = m;
+						MINDEX(len, n, k);
+						A = mtod(n, u_char *)[k];
+						continue;
+#else
+						return 0;
+#endif
+					}
+					A = p[k];
+#if defined(SKF_AD_VLAN_TAG) && defined(SKF_AD_VLAN_TAG_PRESENT)
+				}
+				switch (code) {
+				case BPF_S_ANC_VLAN_TAG:
+					if (aux_data)
+						A = aux_data->vlan_tag;
+					break;
+
+				case BPF_S_ANC_VLAN_TAG_PRESENT:
+					if (aux_data)
+						A = aux_data->vlan_tag_present;
+					break;
+				}
 #endif
+				continue;
 			}
-			A = p[k];
-			continue;
-
 		case BPF_LD|BPF_W|BPF_LEN:
 			A = wirelen;
 			continue;
@@ -309,7 +355,8 @@ bpf_filter(pc, p, wirelen, buflen)
 
 		case BPF_LD|BPF_W|BPF_IND:
 			k = X + pc->k;
-			if (k + sizeof(int32) > buflen) {
+			if (pc->k > buflen || X > buflen - pc->k ||
+			    sizeof(int32_t) > buflen - k) {
 #if defined(KERNEL) || defined(_KERNEL)
 				if (m == NULL)
 					return 0;
@@ -326,7 +373,8 @@ bpf_filter(pc, p, wirelen, buflen)
 
 		case BPF_LD|BPF_H|BPF_IND:
 			k = X + pc->k;
-			if (k + sizeof(short) > buflen) {
+			if (X > buflen || pc->k > buflen - X ||
+			    sizeof(int16_t) > buflen - k) {
 #if defined(KERNEL) || defined(_KERNEL)
 				if (m == NULL)
 					return 0;
@@ -343,7 +391,7 @@ bpf_filter(pc, p, wirelen, buflen)
 
 		case BPF_LD|BPF_B|BPF_IND:
 			k = X + pc->k;
-			if (k >= buflen) {
+			if (pc->k >= buflen || X >= buflen - pc->k) {
 #if defined(KERNEL) || defined(_KERNEL)
 				if (m == NULL)
 					return 0;
@@ -531,7 +579,12 @@ bpf_filter(pc, p, wirelen, buflen)
 			continue;
 
 		case BPF_ALU|BPF_NEG:
-			A = -A;
+			/*
+			 * Most BPF arithmetic is unsigned, but negation
+			 * can't be unsigned; throw some casts to
+			 * specify what we're trying to do.
+			 */
+			A = (u_int32)(-(int32)A);
 			continue;
 
 		case BPF_MISC|BPF_TAX:
@@ -545,6 +598,17 @@ bpf_filter(pc, p, wirelen, buflen)
 	}
 }
 
+u_int
+bpf_filter(pc, p, wirelen, buflen)
+	register const struct bpf_insn *pc;
+	register const u_char *p;
+	u_int wirelen;
+	register u_int buflen;
+{
+	return bpf_filter_with_aux_data(pc, p, wirelen, buflen, NULL);
+}
+
+
 /*
  * Return true if the 'fcode' is a valid filter program.
  * The constraints are that each jump be forward and to a valid
@@ -574,7 +638,7 @@ bpf_validate(f, len)
 		return 0;
 #endif
 
-	for (i = 0; i < len; ++i) {
+	for (i = 0; i < (u_int)len; ++i) {
 		p = &f[i];
 		switch (BPF_CLASS(p->code)) {
 		/*
@@ -675,7 +739,7 @@ bpf_validate(f, len)
 #if defined(KERNEL) || defined(_KERNEL)
 				if (from + p->k < from || from + p->k >= len)
 #else
-				if (from + p->k >= len)
+				if (from + p->k >= (u_int)len)
 #endif
 					return 0;
 				break;
@@ -683,7 +747,7 @@ bpf_validate(f, len)
 			case BPF_JGT:
 			case BPF_JGE:
 			case BPF_JSET:
-				if (from + p->jt >= len || from + p->jf >= len)
+				if (from + p->jt >= (u_int)len || from + p->jf >= (u_int)len)
 					return 0;
 				break;
 			default:

Modified: head/contrib/libpcap/bpf_dump.c
==============================================================================
--- head/contrib/libpcap/bpf_dump.c	Mon Feb 13 02:15:56 2017	(r313694)
+++ head/contrib/libpcap/bpf_dump.c	Mon Feb 13 08:23:39 2017	(r313695)
@@ -51,7 +51,10 @@ bpf_dump(const struct bpf_program *p, in
 	for (i = 0; i < n; ++insn, ++i) {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702130823.v1D8NdN1036002>