Merge "Upgrade to libpcap 1.7.4."
diff --git a/Android.mk b/Android.mk
index 16fafe4..0b916c0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,24 +1,48 @@
 LOCAL_PATH:= $(call my-dir)
+
+libpcap_cflags := \
+  -Wno-unused-parameter \
+  -D_U_="__attribute__((unused))" \
+
 include $(CLEAR_VARS)
 
-libpcap_PSRC =	pcap-linux.c pcap-usb-linux.c  pcap-can-linux.c pcap-netfilter-linux.c pcap-netfilter-linux-android.c
-libpcap_FSRC =  fad-gifc.c
-libpcap_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 \
-	bpf_image.c bpf_dump.c
-libpcap_GENSRC = scanner.c grammar.c bpf_filter.c version.c
+LOCAL_SRC_FILES := \
+  pcap-linux.c pcap-usb-linux.c pcap-can-linux.c pcap-netfilter-linux.c pcap-netfilter-linux-android.c \
+  fad-gifc.c \
+  pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \
+  savefile.c sf-pcap.c sf-pcap-ng.c pcap-common.c \
+  bpf/net/bpf_filter.c bpf_image.c bpf_dump.c \
+  version.c \
 
-libpcap_SRC =	$(libpcap_PSRC) $(libpcap_FSRC) $(libpcap_CSRC) $(libpcap_GENSRC)
+# Generated on the host with `configure && make` and copied across.
+LOCAL_SRC_FILES += grammar.c
+LOCAL_SRC_FILES += scanner.c
 
-
-LOCAL_SRC_FILES:=\
-	$(libpcap_SRC)
-
-LOCAL_CFLAGS:=-O2 -g
-LOCAL_CFLAGS+=-DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -Dlinux -D__GLIBC__ -D_GNU_SOURCE
+LOCAL_CFLAGS += $(libpcap_cflags)
+LOCAL_CFLAGS += -Wno-sign-compare
+LOCAL_CFLAGS += -DHAVE_CONFIG_H
+LOCAL_CFLAGS += -include strings.h # For ffs(3).
 
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
 
 LOCAL_MODULE:= libpcap
 
 include $(BUILD_STATIC_LIBRARY)
+
+libpcap_tests :=  \
+  tests/capturetest.c \
+  tests/filtertest.c \
+  tests/findalldevstest.c \
+  tests/opentest.c \
+  tests/reactivatetest.c \
+  tests/selpolltest.c \
+  tests/valgrindtest.c \
+
+$(foreach test,$(libpcap_tests), \
+  $(eval include $(CLEAR_VARS)) \
+  $(eval LOCAL_MODULE := libpcap_$(basename $(notdir $(test)))) \
+  $(eval LOCAL_SRC_FILES := $(test)) \
+  $(eval LOCAL_CFLAGS := $(libpcap_cflags)) \
+  $(eval LOCAL_STATIC_LIBRARIES := libpcap) \
+  $(eval include $(BUILD_NATIVE_TEST)) \
+)
diff --git a/CHANGES b/CHANGES
index 64734b5..ef90bbc 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,54 @@
+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 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
+	    capture.
+	Fix timestamps when reading pcap-ng files on big-endian
+	    machines.
+
+Saturday  Jul. 19, 2014 mcr@sandelman.ca
+  Summary for 1.6.1 libpcap release
+	some fixes for the any device
+	changes for how --enable-XXX (--enable-sniffing, --enable-can) works
+
+Wednesday Jul. 2, 2014 mcr@sandelman.ca
+  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().
+        on platforms where you can not capture on down interfaces, do not list them
+        but: do list interfaces which are down, if you can capture on them!
+
 Wednesday December 18, 2013 guy@alum.mit.edu
 Summary for 1.5.3 libpcap release
 	Don't let packets that don't match the current filter get to the
@@ -244,7 +295,7 @@
 	DLT: Add JUNIPER_ST
 	802.15.4 support
 	Variable length 802.11 header support
-	X2E data type support 
+	X2E data type support
 	SITA ACN Interface support - see README.sita
 	Support for memory-mapped capture on Linux
 	Support for zerocopy BPF on platforms that support it
@@ -256,7 +307,7 @@
 	 can print better diagnostic information
 	Return PCAP_ERROR_PERM_DENIED if we don't have permission to open a device, so
 	 applications can tell the user they need to go play with permissions
-	On Linux, ignore ENETDOWN so we can continue to capture packets if the 
+	On Linux, ignore ENETDOWN so we can continue to capture packets if the
 	 interface goes down and comes back up again.
 	On Linux, support new tpacket frame headers (2.6.27+)
 	On Mac OS X, add scripts for changing permissions on /dev/bpf* and launchd plist
@@ -269,14 +320,14 @@
         Change build process to put public libpcap headers into pcap subir
         DLT: Add value for IPMI IPMB packets
         DLT: Add value for u10 Networks boards
-        Require <net/pfvar.h> for pf definitions - allows reading of pflog formatted 
+        Require <net/pfvar.h> for pf definitions - allows reading of pflog formatted
          libpcap files on an OS other than where the file was generated
 
 Wed.	April 25, 2007.  ken@xelerance.com.  Summary for 0.9.6 libpcap release
 
 	Put the public libpcap headers into a pcap subdirectory in both the
 	 source directory and the target include directory, and have include
-	 files at the top-level directory to include those headers, for 
+	 files at the top-level directory to include those headers, for
 	 backwards compatibility.
 	Add Bluetooth support
 	Add USB capturing support on Linux
@@ -284,30 +335,30 @@
 	Add support for new FreeBSD BIOCSDIRECTION ioctl
 	Add additional filter operations for 802.11 frame types
 	Add support for filtering on MTP2 frame types
-	Propagate some changes from the main branch, so the x.9 branch has 
+	Propagate some changes from the main branch, so the x.9 branch has
 	 all the DLT_ and LINKTYPE_ values that the main branch does
-	Reserved a DLT_ and SAVEFILE_ value for PPI (Per Packet Info) 
+	Reserved a DLT_ and SAVEFILE_ value for PPI (Per Packet Info)
 	 encapsulated packets
-	Add LINKTYPE_ for IEEE 802.15.4, with address fields padded as done 
+	Add LINKTYPE_ for IEEE 802.15.4, with address fields padded as done
 	 by Linux drivers
 	Add LINKTYPE_ value corresponding to DLT_IEEE802_16_MAC_CPS.
 	Add DLT for IEEE 802.16 (WiMAX) MAC Common Part Sublayer
 	Add DLT for Bluetooth HCI UART transport layer
 	When building a shared library, build with "-fPIC" on Linux to support x86_64
-	Link with "$(CC) -shared" rather than "ld -shared" when building a 
+	Link with "$(CC) -shared" rather than "ld -shared" when building a
 	 ".so" shared library
 	Add support for autoconf 2.60
 	Fixes to discard unread packets when changing filters
-	Changes to handle name changes in the DAG library resulting from 
+	Changes to handle name changes in the DAG library resulting from
 	 switching to libtool.
 	Add support for new DAG ERF types.
-        Add an explicit "-ldag" when building the shared library, so the DAG 
+        Add an explicit "-ldag" when building the shared library, so the DAG
 	 library dependency is explicit.
 	Mac OSX fixes for dealing with "wlt" devices
 	Fixes in add_or_find_if() & pcap_findalldevs() to optimize generating
 	 device lists
 	Fixed a bug in pcap_open_live(). The return value of PacketSetHwFilter
-	 was not checked. 
+	 was not checked.
 
 Tue.	September 19, 2006. ken@xelerance.com. Summary for 0.9.5 libpcap release
 
@@ -319,19 +370,19 @@
 	OP_PACKET now matches the beginning of the packet, instead of
 	 beginning+link-layer
 	Add DLT/LINKTYPE for carrying FRF.16 Multi-link Frame Relay
-	Fix allocation of buffer for list of link-layer types  
+	Fix allocation of buffer for list of link-layer types
 	Added a new DLT and LINKTYPE value for ARINC 653 Interpartition Communcation Messages
 	Fixed a typo in a DLT value: it should start with DLT_ and not LINKTYPE_
 	Redefined DLT_CAN20B and LINKTYPE_CAN20B as #190 (as this is the right value for CAN).
 	Added definition for DLT_A429 and LINKTYPE_A429 as #184.
 	Added a new DLT and LINKTYPE value for CAN v2.0B frames.
 	Add support for DLT_JUNIPER_VP.
-	Don't double-count received packets on Linux systems that 
-	 support the PACKET_STATISTICS getsockopt() argument on 
+	Don't double-count received packets on Linux systems that
+	 support the PACKET_STATISTICS getsockopt() argument on
 	 PF_PACKET sockets.
-	Add support for DLT_IEEE802_11 and DLT_IEEE802_11_RADIO link 
+	Add support for DLT_IEEE802_11 and DLT_IEEE802_11_RADIO link
 	 layers in Windows
-	Add support to build libpcap.lib and wpcap.dll under Cygnus and 
+	Add support to build libpcap.lib and wpcap.dll under Cygnus and
 	 MingW32.
 
 Mon. 	September 5, 2005.  ken@xelerance.com. Summary for 0.9.4 libpcap release
diff --git a/CREDITS b/CREDITS
index 69cbbf0..b40152f 100644
--- a/CREDITS
+++ b/CREDITS
@@ -2,11 +2,12 @@
 
 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 @@
     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 @@
     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,13 +107,14 @@
     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>
     Márton Németh                 <nm127 at freemail dot hu>
     Matthew Luckie                <mjl at luckie dot org dot nz>
     Max Laier                     <max at love2party dot net>
-    Michal Labedzki               
+    Michal Labedzki               <michal dot labedzki at tieto dot com>
     Michal Sekletar               <msekleta at redhat dot com>
     Mike Frysinger                <vapier at gmail dot com>
     Mike Kershaw                  <dragorn at kismetwireless dot net>
diff --git a/INSTALL.txt b/INSTALL.txt
index 58d8e3c..18b489a 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -1,5 +1,3 @@
-@(#) $Header: /tcpdump/master/libpcap/INSTALL.txt,v 1.29 2008-06-12 20:21:51 guy Exp $ (LBL)
-
 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
@@ -31,19 +29,14 @@
 
 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 GNU C compiler, available via anonymous ftp:
-
-	ftp://ftp.gnu.org/pub/gnu/gcc/
+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
-via anonymous ftp:
-
-	ftp://ftp.ee.lbl.gov/flex-*.tar.Z
-
-As of this writing, the current version is 2.5.4.
+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
@@ -185,14 +178,14 @@
 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!
 
@@ -352,7 +345,6 @@
 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
diff --git a/LICENSE b/LICENSE
index dea5f7d..a10474d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -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 @@
   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.
diff --git a/MODULE_LICENSE_BSD b/MODULE_LICENSE_BSD
deleted file mode 100644
index e69de29..0000000
--- a/MODULE_LICENSE_BSD
+++ /dev/null
diff --git a/Makefile.in b/Makefile.in
index f6f26e5..4c35bde 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -16,8 +16,6 @@
 #  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.
-#
-# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.142 2008-11-22 17:30:24 guy Exp $ (LBL)
 
 #
 # Various configurable paths (remember to edit Makefile.in, not Makefile)
@@ -55,8 +53,9 @@
 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@
@@ -85,7 +84,7 @@
 	@rm -f $@
 	$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
 
-PSRC =	pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@ @NETFILTER_SRC@ @CANUSB_SRC@ @DBUS_SRC@
+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
 SSRC =  @SSRC@
 CSRC =	pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \
@@ -130,17 +129,17 @@
 	sunatmpos.h
 
 TESTS = \
+	capturetest \
 	filtertest \
 	findalldevstest \
-	nonblocktest \
 	opentest \
 	selpolltest \
 	valgrindtest
 
 TESTS_SRC = \
+	tests/capturetest.c \
 	tests/filtertest.c \
 	tests/findalldevstest.c \
-	tests/nonblocktest.c \
 	tests/opentest.c \
 	tests/reactivatetest.c \
 	tests/selpolltest.c \
@@ -293,10 +292,11 @@
 	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 \
@@ -332,6 +332,7 @@
 	pcap-usb-linux.h \
 	pcap-win32.c \
 	runlex.sh \
+	scanner.c.top \
 	scanner.l \
 	Win32/Include/Gnuc.h \
 	Win32/Include/addrinfo.h \
@@ -443,8 +444,11 @@
 libpcap.none:
 
 scanner.c: $(srcdir)/scanner.l
-	@rm -f $@
+	@rm -f $@ $@.bottom
 	$(srcdir)/runlex.sh $(LEX) -o$@ $<
+	mv $@ $@.bottom
+	cat $(srcdir)/$@.top $@.bottom > $@
+	@rm $@.bottom
 
 scanner.o: scanner.c tokdefs.h
 	$(CC) $(FULL_CFLAGS) -c scanner.c
@@ -527,15 +531,15 @@
 #
 tests: $(TESTS)
 
+capturetest: tests/capturetest.c libpcap.a
+	$(CC) $(FULL_CFLAGS) -I. -L. -o capturetest $(srcdir)/tests/capturetest.c libpcap.a $(LIBS)
+
 filtertest: tests/filtertest.c libpcap.a
 	$(CC) $(FULL_CFLAGS) -I. -L. -o filtertest $(srcdir)/tests/filtertest.c libpcap.a $(LIBS)
 
 findalldevstest: tests/findalldevstest.c libpcap.a
 	$(CC) $(FULL_CFLAGS) -I. -L. -o findalldevstest $(srcdir)/tests/findalldevstest.c libpcap.a $(LIBS)
 
-nonblocktest: tests/nonblocktest.c libpcap.a
-	$(CC) $(FULL_CFLAGS) -I. -L. -o nonblocktest $(srcdir)/tests/nonblocktest.c libpcap.a $(LIBS)
-
 opentest: tests/opentest.c libpcap.a
 	$(CC) $(FULL_CFLAGS) -I. -L. -o opentest $(srcdir)/tests/opentest.c libpcap.a $(LIBS)
 
@@ -606,6 +610,8 @@
 	$(LN_S) pcap_open_offline.3pcap pcap_fopen_offline.3pcap && \
 	rm -f pcap_fopen_offline_with_tstamp_precision.3pcap && \
 	$(LN_S) pcap_open_offline.3pcap pcap_fopen_offline_with_tstamp_precision.3pcap && \
+	rm -f pcap_tstamp_type_val_to_description.3pcap && \
+	$(LN_S) pcap_tstamp_type_val_to_name.3pcap pcap_tstamp_type_val_to_description.3pcap && \
 	rm -f pcap_getnonblock.3pcap && \
 	$(LN_S) pcap_setnonblock.3pcap pcap_getnonblock.3pcap)
 	for i in $(MANFILE); do \
@@ -689,6 +695,7 @@
 	rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
 	rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline_with_tstamp_precision.3pcap
 	rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
+	rm -f $(DESTDIR)$(mandir)/man3/pcap_tstamp_type_val_to_description.3pcap
 	for i in $(MANFILE); do \
 		rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
 	for i in $(MANMISC); do \
@@ -728,10 +735,6 @@
 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; \
@@ -742,4 +745,4 @@
 	   rm -rf $$name
 
 depend:	$(GENSRC) $(GENHDR) bpf_filter.c
-	$(MKDEP) -c $(CC) -m $(DEPENDENCY_CFLAG) $(DEFS) $(INCLS) $(SRC)
+	$(MKDEP) -c $(CC) -m $(CFLAGS) $(DEPENDENCY_CFLAG) $(DEFS) $(INCLS) $(SRC)
diff --git a/NOTICE b/NOTICE
deleted file mode 100644
index dea5f7d..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,19 +0,0 @@
-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
-     notice, this list of conditions and the following disclaimer in
-     the documentation and/or other materials provided with the
-     distribution.
-  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.
diff --git a/README b/README
index 2f14aac..9f65948 100644
--- a/README
+++ b/README
@@ -1,5 +1,3 @@
-@(#) $Header: /tcpdump/master/libpcap/README,v 1.34 2008-12-14 19:44:14 guy Exp $ (LBL)
-
 LIBPCAP 1.x.y
 
 www.tcpdump.org
@@ -78,15 +76,15 @@
 
 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
diff --git a/README.Win32 b/README.Win32
index 503836e..0a42dab 100644
--- a/README.Win32
+++ b/README.Win32
@@ -1,9 +1,9 @@
-Under Win32, libpcap is integrated in the WinPcap packet capture system. 
-WinPcap provides a framework that allows libpcap to capture the packets 
-under Windows 95, Windows 98, Windows ME, Windows NT 4, Windows 2000 
+Under Win32, libpcap is integrated in the WinPcap packet capture system.
+WinPcap provides a framework that allows libpcap to capture the packets
+under Windows 95, Windows 98, Windows ME, Windows NT 4, Windows 2000
 and Windows XP.
-WinPcap binaries and source code can be found at http://winpcap.polito.it: 
-they include also a developer's pack with all the necessary to compile 
+WinPcap binaries and source code can be found at http://winpcap.polito.it:
+they include also a developer's pack with all the necessary to compile
 libpcap-based applications under Windows.
 
 How to compile libpcap with Visual Studio
@@ -12,35 +12,35 @@
 In order to compile libpcap you will need:
 
 - version 6 (or higher) of Microsoft Visual Studio
-- The November 2001 (or later) edition of Microsoft Platform 
-Software Development Kit (SDK), that contains some necessary includes 
+- The November 2001 (or later) edition of Microsoft Platform
+Software Development Kit (SDK), that contains some necessary includes
 for IPv6 support. You can download it from http://www.microsoft.com/sdk
-- the latest WinPcap sources from http://winpcap.polito.it/install 
+- the latest WinPcap sources from http://winpcap.polito.it/install
 
-The WinPcap source code already contains a recent (usually the latest 
-stable) version of libpcap. If you need to compile a different one, 
-simply download it from www.tcpdump.org and copy the sources in the 
+The WinPcap source code already contains a recent (usually the latest
+stable) version of libpcap. If you need to compile a different one,
+simply download it from www.tcpdump.org and copy the sources in the
 winpcap\wpcap\libpcap folder of the WinPcap distribution. If you want to
-compile a libpcap source retrieved from the tcpdump.org Git, you will 
-have to create the scanner and the grammar by hand (with lex and yacc) 
+compile a libpcap source retrieved from the tcpdump.org Git, you will
+have to create the scanner and the grammar by hand (with lex and yacc)
 or with the cygnus makefile, since The Visual Studio project is not able
 to build them.
 
-Open the project file winpcap\wpcap\prj\wpcap.dsw with Visual Studio and 
-build wpcap.dll. wpcap.lib, the library file to link with the applications, 
-will be generated in winpcap\wpcap\lib\. wpcap.dll will be generated in 
-winpcap\wpcap\prj\release or winpcap\wpcap\prj\debug depending on the type 
+Open the project file winpcap\wpcap\prj\wpcap.dsw with Visual Studio and
+build wpcap.dll. wpcap.lib, the library file to link with the applications,
+will be generated in winpcap\wpcap\lib\. wpcap.dll will be generated in
+winpcap\wpcap\prj\release or winpcap\wpcap\prj\debug depending on the type
 of binary that is being created.
 
 How to compile libpcap with Cygnus
 ----------------------------------
 
-To build wpcap.dll, cd to the directory WPCAP/PRJ of the WinPcap source code 
-distribution and type "make". libwpcap.a, the library file to link with the 
-applications, will be generated in winpcap\wpcap\lib\. wpcap.dll will be 
+To build wpcap.dll, cd to the directory WPCAP/PRJ of the WinPcap source code
+distribution and type "make". libwpcap.a, the library file to link with the
+applications, will be generated in winpcap\wpcap\lib\. wpcap.dll will be
 generated in winpcap\wpcap\prj.
 
-Remember, you CANNOT use the MSVC-generated .lib files with gcc, use 
+Remember, you CANNOT use the MSVC-generated .lib files with gcc, use
 libwpcap.a instead.
 
 "make install" installs wpcap.dll in the Windows system folder.
diff --git a/README.aix b/README.aix
index 74cd9af..92e513f 100644
--- a/README.aix
+++ b/README.aix
@@ -11,6 +11,11 @@
     same, and the configure script should detect that it's on an AIX
     system and choose BPF even if the devices aren't there.
 
+    Also note that tcpdump _binary_ compiled on AIX 4 may have a problem
+    doing the initial loading of the BPF driver if copied to AIX 5 and
+    run there (GH #52). tcpdump binary natively compiled on AIX 5 should
+    not have this issue.
+
 (2) If libpcap doesn't compile on your machine when configured to use
     BPF, or if the workarounds fail to make it work correctly, you
     should send to tcpdump-workers@lists.tcpdump.org a detailed bug
@@ -71,8 +76,8 @@
     Then you need to type:
 
 	    strload -f /etc/dlpi.conf
- 
-    Check again with strload -q -d dlpi that the dlpi driver is loaded.  
+
+    Check again with strload -q -d dlpi that the dlpi driver is loaded.
 
     Alternatively, you can uncomment the lines for DLPI in
     /etc/pse.conf and reboot the machine; this way DLPI will always
diff --git a/README.hpux b/README.hpux
index 88c27f8..65ecff9 100644
--- a/README.hpux
+++ b/README.hpux
@@ -5,14 +5,14 @@
 HP-UX patches to fix packet capture problems
 
 Note that packet-capture programs such as tcpdump may, on HP-UX, not be
-able to see packets sent from the machine on which they're running. 
+able to see packets sent from the machine on which they're running.
 Some articles on groups.google.com discussing this are:
 
 	http://groups.google.com/groups?selm=82ld3v%2480i%241%40mamenchi.zrz.TU-Berlin.DE
 
 which says:
 
-  Newsgroups: comp.sys.hp.hpux 
+  Newsgroups: comp.sys.hp.hpux
   Subject:  Re: Did someone made tcpdump working on 10.20 ?
   Date: 12/08/1999
   From: Lutz Jaenicke <jaenicke@emserv1.ee.TU-Berlin.DE>
@@ -27,14 +27,14 @@
    >must me "patched" (poked) in order to see outbound data in promiscuous mode.
    >Many things to do .... So the question is : did someone has already this
    >"ready to use" PHNE_**** patch ?
-  
+
    Two things:
    1. You do need a late "LAN products cumulative patch" (e.g.  PHNE_18173
   for   s700/10.20).
    2. You must use
 echo 'lanc_outbound_promisc_flag/W1' | /usr/bin/adb -w /stand/vmunix /dev/kmem
      You can insert this e.g. into /sbin/init.d/lan
-  
+
    Best regards,
    Lutz
 
@@ -44,7 +44,7 @@
 
 which says:
 
-  Newsgroups: comp.sys.hp.hpux 
+  Newsgroups: comp.sys.hp.hpux
   Subject: Re: tcpdump only shows incoming packets
   Date: 02/15/2000
   From: Rick Jones <foo@bar.baz.invalid>
@@ -56,12 +56,12 @@
   > outgoing. I have tried tcpflow-0.12 which also uses libpcap and the
   > same thing happens.  Could someone please give me a hint on how to
   > get this right?
-  
+
   Search/Read the archives ?-)
-  
+
   What you are seeing is expected, un-patched, behaviour for an HP-UX
   system.  On 11.00, you need to install the latest lancommon/DLPI
-  patches, and then the latest driver patch for the interface(s) in use. 
+  patches, and then the latest driver patch for the interface(s) in use.
   At that point, a miracle happens and you should start seeing outbound
   traffic.
 
@@ -79,7 +79,7 @@
   From: Harald Skotnes <harald@cc.uit.no>
 
   Rick Jones wrote:
-  
+
 	...
 
   > What you are seeing is expected, un-patched, behaviour for an HP-UX
@@ -87,7 +87,7 @@
   > patches, and then the latest driver patch for the interface(s) in
   > use. At that point, a miracle happens and you should start seeing
   > outbound traffic.
-  
+
   Thanks a lot.  I have this problem on several machines running HPUX
   10.20 and 11.00.  The machines where patched up before y2k so did not
   know what to think.  Anyway I have now installed PHNE_19766,
@@ -101,7 +101,7 @@
 
   Date: Mon, 29 Apr 2002 15:59:55 -0700
   From: Rick Jones
-  To: tcpdump-workers@tcpdump.org 
+  To: tcpdump-workers@tcpdump.org
   Subject: Re: [tcpdump-workers] I Can't Capture the Outbound Traffic
 
 	...
@@ -130,21 +130,21 @@
 
   Dave Barr (barr@cis.ohio-state.edu) wrote:
   : Has anyone ported tcpdump (or something similar) to HP/UX 9.x?
-  
+
   I'm reasonably confident that any port of tcpdump to 9.X would require
   the (then optional) STREAMS product.  This would bring DLPI, which is
   what one uses to access interfaces in promiscuous mode.
-  
+
   I'm not sure that HP even sells the 9.X STREAMS product any longer,
   since HP-UX 9.X is off the pricelist (well, maybe 9.10 for the old 68K
-  devices). 
-  
+  devices).
+
   Your best bet is to be up on 10.20 or better if that is at all
-  possible.  If your hardware is supported by it, I'd go with HP-UX 11. 
+  possible.  If your hardware is supported by it, I'd go with HP-UX 11.
   If you want to see the system's own outbound traffic, you'll never get
   that functionality on 9.X, but it might happen at some point for 10.20
-  and 11.X. 
-  
+  and 11.X.
+
   rick jones
 
 (as per other messages cited here, the ability to see the system's own
@@ -178,12 +178,12 @@
 	(thanks to hildeb@www.stahl.bau.tu-bs.de (Ralf Hildebrandt) who
 	posted the security-part some time ago)
 
-		 <<hack_ip_stack>> 
+		 <<hack_ip_stack>>
 
 		(Don't switch IP-forwarding off, if you need it !)
 		Install the hack as /sbin/init.d/hacl_ip_stack (adjust
 	permissions !) and make a sequencing-symlink
-	/sbin/rc2.d/S350hack_ip_stack pointing to this script. 
+	/sbin/rc2.d/S350hack_ip_stack pointing to this script.
 		Now all this is done on every reboot.
 
 According to Rick Jones, the global promiscuous switch also has to be
diff --git a/README.linux b/README.linux
index f92cd22..ffcb928 100644
--- a/README.linux
+++ b/README.linux
@@ -19,13 +19,13 @@
 	  The Packet protocol is used by applications which communicate
 	  directly with network devices without an intermediate network
 	  protocol implemented in the kernel, e.g. tcpdump. If you want them
-	  to work, choose Y. 
+	  to work, choose Y.
 
 	  This driver is also available as a module called af_packet.o ( =
 	  code which can be inserted in and removed from the running kernel
 	  whenever you want). If you want to compile it as a module, say M
 	  here and read Documentation/modules.txt; if you use modprobe or
-	  kmod, you may also want to add "alias net-pf-17 af_packet" to 
+	  kmod, you may also want to add "alias net-pf-17 af_packet" to
 	  /etc/modules.conf.
 
 and the note for the 2.2[.x] kernel says:
@@ -47,7 +47,7 @@
 allow packet capture filters specified to programs such as tcpdump to be
 executed in the kernel, so that packets that don't pass the filter won't
 be copied from the kernel to the program, rather than having all packets
-copied to the program and libpcap doing the filtering in user mode. 
+copied to the program and libpcap doing the filtering in user mode.
 
 Copying packets from the kernel to the program consumes a significant
 amount of CPU, so filtering in the kernel can reduce the overhead of
diff --git a/README.septel b/README.septel
index fbc88df..483de6a 100644
--- a/README.septel
+++ b/README.septel
@@ -14,7 +14,7 @@
 /var/src/septel.
 
 By default (if you write only ./configure --with-septel) it takes
-./../septel as argument for DIR. 
+./../septel as argument for DIR.
 
 If the Septel software is correctly detected 'configure' will
 report:
diff --git a/README.tru64 b/README.tru64
index 7fe1ef0..2420d9e 100644
--- a/README.tru64
+++ b/README.tru64
@@ -1,4 +1,4 @@
-The following instructions are applicable to Tru64 UNIX 
+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.
diff --git a/TODO b/TODO
index 73325e1..aae24c2 100644
--- a/TODO
+++ b/TODO
@@ -6,11 +6,11 @@
 
 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 @@
 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
diff --git a/VERSION b/VERSION
index 4cda8f1..10c0880 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.5.2
+1.7.4
diff --git a/Win32/Include/Gnuc.h b/Win32/Include/Gnuc.h
index 0bf4b73..aa49598 100644
--- a/Win32/Include/Gnuc.h
+++ b/Win32/Include/Gnuc.h
@@ -1,5 +1,3 @@
-/* @(#) $Header: /tcpdump/master/libpcap/Win32/Include/Gnuc.h,v 1.1 2002-08-01 08:33:05 risso Exp $ (LBL) */
-
 /* Define __P() macro, if necessary */
 
 #ifndef __P
diff --git a/Win32/Include/addrinfo.h b/Win32/Include/addrinfo.h
index 8cb2e65..ac4fcce 100644
--- a/Win32/Include/addrinfo.h
+++ b/Win32/Include/addrinfo.h
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -13,7 +13,7 @@
  * 3. Neither the name of the project 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 PROJECT 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
@@ -27,8 +27,6 @@
  * SUCH DAMAGE.
  */
 
-/* $Id: addrinfo.h,v 1.1 2002-08-01 08:33:05 risso Exp $ */
-
 #ifndef HAVE_ADDRINFO
 
 /*
@@ -94,13 +92,13 @@
 
 #ifndef EAI_BADHINTS
 #define EAI_BADHINTS	12
-#endif 
+#endif
 
-#ifndef EAI_PROTOCOL	
+#ifndef EAI_PROTOCOL
 #define EAI_PROTOCOL	13
 #endif
 
-#ifndef EAI_MAX	
+#ifndef EAI_MAX
 #define EAI_MAX		14
 #endif
 
diff --git a/Win32/Include/arpa/nameser.h b/Win32/Include/arpa/nameser.h
index 18f185c..b20dc1e 100644
--- a/Win32/Include/arpa/nameser.h
+++ b/Win32/Include/arpa/nameser.h
@@ -3,7 +3,7 @@
  * -
  * Copyright (c) 1983, 1989, 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:
@@ -19,7 +19,7 @@
  * 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
@@ -33,14 +33,14 @@
  * SUCH DAMAGE.
  * -
  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- * 
+ *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies, and that
  * the name of Digital Equipment Corporation not be used in advertising or
  * publicity pertaining to distribution of the document or software without
  * specific, written prior permission.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
@@ -69,7 +69,7 @@
 # include <sys/types.h>
 #endif
 #include <sys/cdefs.h>
-#else 
+#else
 #include <pcap-stdinc.h>
 #define __LITTLE_ENDIAN 1
 #define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/Win32/Include/bittypes.h b/Win32/Include/bittypes.h
index 7c0cbde..95aa9fa 100644
--- a/Win32/Include/bittypes.h
+++ b/Win32/Include/bittypes.h
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1999 WIDE Project.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -13,7 +13,7 @@
  * 3. Neither the name of the project 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 PROJECT 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
@@ -34,7 +34,7 @@
 typedef signed char int8_t;
 #endif /* HAVE_U_INT8_T */
 
-#ifndef HAVE_U_INT16_T 
+#ifndef HAVE_U_INT16_T
 typedef unsigned short u_int16_t;
 typedef signed short int16_t;
 #endif /* HAVE_U_INT16_T */
diff --git a/Win32/Include/cdecl_ext.h b/Win32/Include/cdecl_ext.h
index 9591db2..9d40b84 100644
--- a/Win32/Include/cdecl_ext.h
+++ b/Win32/Include/cdecl_ext.h
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1999 WIDE Project.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -13,7 +13,7 @@
  * 3. Neither the name of the project 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 PROJECT 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
diff --git a/Win32/Include/ip6_misc.h b/Win32/Include/ip6_misc.h
index 562fa61..0b578c3 100644
--- a/Win32/Include/ip6_misc.h
+++ b/Win32/Include/ip6_misc.h
@@ -17,8 +17,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.5 2006-01-22 18:02:18 gianluca Exp $ (LBL)
  */
 
 /*
diff --git a/Win32/Include/net/if.h b/Win32/Include/net/if.h
index bf926b6..58d3c16 100644
--- a/Win32/Include/net/if.h
+++ b/Win32/Include/net/if.h
@@ -36,7 +36,7 @@
 
 #ifndef _NET_IF_H_
 #define	_NET_IF_H_
- 
+
 /*
  * <net/if.h> does not depend on <sys/time.h> on most other systems.  This
  * helps userland compatability.  (struct timeval ifi_lastchange)
diff --git a/Win32/Include/net/netdb.h b/Win32/Include/net/netdb.h
index b9d45ac..f7685d2 100644
--- a/Win32/Include/net/netdb.h
+++ b/Win32/Include/net/netdb.h
@@ -57,7 +57,9 @@
 #ifndef _NETDB_H_
 #define _NETDB_H_
 
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
+/* MingW64 defines _POSIX_THREAD_SAFE_FUNCTIONS.
+ */
+#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) && !defined(__MINGW64_VERSION_MAJOR)
 #include <stdio.h>
 #include <netinet/in.h>
 #endif
diff --git a/Win32/Include/sockstorage.h b/Win32/Include/sockstorage.h
index 557eb4d..cbad190 100644
--- a/Win32/Include/sockstorage.h
+++ b/Win32/Include/sockstorage.h
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1999 WIDE Project.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -13,7 +13,7 @@
  * 3. Neither the name of the project 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 PROJECT 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
diff --git a/Win32/Prj/libpcap.dsp b/Win32/Prj/libpcap.dsp
index 17e5a70..7082122 100644
--- a/Win32/Prj/libpcap.dsp
+++ b/Win32/Prj/libpcap.dsp
@@ -7,19 +7,19 @@
 CFG=libpcap - Win32 Debug
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
 !MESSAGE use the Export Makefile command and run
-!MESSAGE 
+!MESSAGE
 !MESSAGE NMAKE /f "libpcap.mak".
-!MESSAGE 
+!MESSAGE
 !MESSAGE You can specify a configuration when running NMAKE
 !MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
+!MESSAGE
 !MESSAGE NMAKE /f "libpcap.mak" CFG="libpcap - Win32 Debug"
-!MESSAGE 
+!MESSAGE
 !MESSAGE Possible choices for configuration are:
-!MESSAGE 
+!MESSAGE
 !MESSAGE "libpcap - Win32 Release" (based on "Win32 (x86) Static Library")
 !MESSAGE "libpcap - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE 
+!MESSAGE
 
 # Begin Project
 # PROP AllowPerConfigDependencies 0
@@ -74,7 +74,7 @@
 # ADD BASE LIB32 /nologo
 # ADD LIB32 /nologo
 
-!ENDIF 
+!ENDIF
 
 # Begin Target
 
diff --git a/Win32/Src/gai_strerror.c b/Win32/Src/gai_strerror.c
index edd970b..a36c35d 100644
--- a/Win32/Src/gai_strerror.c
+++ b/Win32/Src/gai_strerror.c
@@ -67,7 +67,7 @@
 #define EAI_MAX (sizeof(ai_errlist)/sizeof(ai_errlist[0]))
 #endif
 
-/* on MingW, gai_strerror is available. 
+/* on MingW, gai_strerror is available.
    We need to compile gai_strerrorA only for Cygwin
  */
 #ifndef gai_strerror
diff --git a/Win32/Src/getaddrinfo.c b/Win32/Src/getaddrinfo.c
index ebfe8c2..d3ebda0 100644
--- a/Win32/Src/getaddrinfo.c
+++ b/Win32/Src/getaddrinfo.c
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -13,7 +13,7 @@
  * 3. Neither the name of the project 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 PROJECT 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
@@ -49,15 +49,10 @@
  * Mingw64 has its own implementation of getaddrinfo, mingw32 no
  */
 #ifndef __MINGW64__
- 
+
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif 
-
-#ifndef lint
-static const char rcsid[] _U_ =
-     "@(#) $Header: /tcpdump/master/libpcap/Win32/Src/getaddrinfo.c,v 1.3 2008-09-15 23:37:51 guy Exp $";
 #endif
 
 #include <pcap-stdinc.h>
@@ -76,17 +71,17 @@
 
 #ifndef HAVE_PORTABLE_PROTOTYPE
 #include "cdecl_ext.h"
-#endif 
+#endif
 
 #ifndef HAVE_U_INT32_T
 #include "bittypes.h"
-#endif 
+#endif
 
 #ifndef HAVE_SOCKADDR_STORAGE
 #ifndef __MINGW32__
 #include "sockstorage.h"
 #endif
-#endif 
+#endif
 
 #ifdef NEED_ADDRINFO_H
 #include "addrinfo.h"
@@ -114,7 +109,7 @@
 static const char in6_addrany[] = {
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
-static const char in_loopback[] = { 127, 0, 0, 1 }; 
+static const char in_loopback[] = { 127, 0, 0, 1 };
 static const char in6_loopback[] = {
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
 };
@@ -132,7 +127,7 @@
 	int a_socklen;
 	int a_off;
 	const char *a_addrany;
-	const char *a_loopback;	
+	const char *a_loopback;
 	int a_scoped;
 } afdl [] = {
 #ifdef INET6
@@ -335,7 +330,7 @@
 	pai->ai_canonname = NULL;
 	pai->ai_addr = NULL;
 	pai->ai_next = NULL;
-	
+
 	if (hostname == NULL && servname == NULL)
 		return EAI_NONAME;
 	if (hints) {
@@ -825,7 +820,7 @@
 			}
 			while (cur && cur->ai_next)
 				cur = cur->ai_next;
-		} else 
+		} else
 			ERR(EAI_FAMILY);	/*xxx*/
 	}
 
@@ -960,7 +955,7 @@
 		GET_AI(cur, afd, numaddr);
 		GET_PORT(cur, servname);
 	}
-	
+
 #ifdef USE_GETIPNODEBY
 	if (hp)
 		freehostent(hp);
diff --git a/Win32/Src/getnetent.c b/Win32/Src/getnetent.c
index d4cceb3..95281a5 100644
--- a/Win32/Src/getnetent.c
+++ b/Win32/Src/getnetent.c
@@ -85,7 +85,7 @@
 	net.n_net = inet_network(cp);
 	net.n_addrtype = AF_INET;
 	q = net.n_aliases = net_aliases;
-	if (p != NULL) 
+	if (p != NULL)
 		cp = p;
 	while (cp && *cp) {
 		if (*cp == ' ' || *cp == '\t') {
diff --git a/Win32/Src/inet_aton.c b/Win32/Src/inet_aton.c
index 3da6667..db97bce 100644
--- a/Win32/Src/inet_aton.c
+++ b/Win32/Src/inet_aton.c
@@ -2,27 +2,27 @@
  * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
  * (Royal Institute of Technology, Stockholm, Sweden).
  * 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 Kungliga Tekniska
  *      Högskolan and its contributors.
- * 
+ *
  * 4. Neither the name of the Institute 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 INSTITUTE 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
@@ -36,13 +36,6 @@
  * SUCH DAMAGE.
  */
 
-/* $Id: inet_aton.c,v 1.2 2003-11-15 23:24:06 guy Exp $ */
-
-#ifndef lint
-static const char rcsid[] _U_ =
-     "@(#) $Header: /tcpdump/master/libpcap/Win32/Src/inet_aton.c,v 1.2 2003-11-15 23:24:06 guy Exp $";
-#endif
-
 #include <sys/types.h>
 #include <pcap-stdinc.h>
 
diff --git a/Win32/Src/inet_pton.c b/Win32/Src/inet_pton.c
index 7933a4e..7fe3813 100644
--- a/Win32/Src/inet_pton.c
+++ b/Win32/Src/inet_pton.c
@@ -2,27 +2,27 @@
  * Copyright (c) 1999 Kungliga Tekniska Högskolan
  * (Royal Institute of Technology, Stockholm, Sweden).
  * 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 Kungliga Tekniska
  *      Högskolan and its contributors.
- * 
+ *
  * 4. Neither the name of the Institute 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 INSTITUTE 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
@@ -36,13 +36,6 @@
  * SUCH DAMAGE.
  */
 
-/* $Id: inet_pton.c,v 1.3 2007-09-27 18:02:20 gianluca Exp $ */
-
-#ifndef lint
-static const char rcsid[] _U_ =
-     "@(#) $Header: /tcpdump/master/libpcap/Win32/Src/inet_pton.c,v 1.3 2007-09-27 18:02:20 gianluca Exp $";
-#endif
-
 #include <errno.h>
 
 #ifdef WIN32
diff --git a/aclocal.m4 b/aclocal.m4
index 4b643ef..02502b2 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,5 +1,3 @@
-dnl @(#) $Header: /tcpdump/master/libpcap/aclocal.m4,v 1.93 2008-11-18 07:29:48 guy Exp $ (LBL)
-dnl
 dnl Copyright (c) 1995, 1996, 1997, 1998
 dnl	The Regents of the University of California.  All rights reserved.
 dnl
@@ -233,7 +231,7 @@
 		# 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"
 	    ],
 	    [
@@ -1276,7 +1274,7 @@
 dnl	AC_LBL_DL_PASSIVE_REQ_T
 dnl
 dnl results:
-dnl 
+dnl
 dnl 	HAVE_DLPI_PASSIVE (defined)
 dnl
 AC_DEFUN(AC_LBL_DL_PASSIVE_REQ_T,
diff --git a/arcnet.h b/arcnet.h
index 4f86043..5869098 100644
--- a/arcnet.h
+++ b/arcnet.h
@@ -30,8 +30,6 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * @(#) $Id: arcnet.h,v 1.2 2001-04-24 02:17:52 guy Exp $ (LBL)
- *
  * from: NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp
  */
 
diff --git a/atmuni31.h b/atmuni31.h
index 880cc1a..0f85430 100644
--- a/atmuni31.h
+++ b/atmuni31.h
@@ -28,8 +28,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/atmuni31.h,v 1.3 2007-10-22 19:28:58 guy Exp $ (LBL)
  */
 
 /* Based on UNI3.1 standard by ATM Forum */
diff --git a/bpf/net/bpf_filter.c b/bpf/net/bpf_filter.c
index 0c4fb00..ffe04ce 100644
--- a/bpf/net/bpf_filter.c
+++ b/bpf/net/bpf_filter.c
@@ -38,11 +38,6 @@
  *	@(#)bpf.c	7.5 (Berkeley) 7/15/91
  */
 
-#if !(defined(lint) || defined(KERNEL) || defined(_KERNEL))
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/bpf/net/bpf_filter.c,v 1.46 2008-01-02 04:16:46 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -200,23 +195,39 @@
 }
 #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.
  */
 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;
@@ -255,7 +266,7 @@
 
 		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;
@@ -272,7 +283,7 @@
 
 		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;
@@ -288,22 +299,50 @@
 			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;
-#endif
-			}
-			A = p[k];
-			continue;
+			{
+#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;
+			}
 		case BPF_LD|BPF_W|BPF_LEN:
 			A = wirelen;
 			continue;
@@ -314,7 +353,8 @@
 
 		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;
@@ -331,7 +371,8 @@
 
 		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;
@@ -348,7 +389,7 @@
 
 		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;
@@ -469,6 +510,12 @@
 			A /= X;
 			continue;
 
+		case BPF_ALU|BPF_MOD|BPF_X:
+			if (X == 0)
+				return 0;
+			A %= X;
+			continue;
+
 		case BPF_ALU|BPF_AND|BPF_X:
 			A &= X;
 			continue;
@@ -477,6 +524,10 @@
 			A |= X;
 			continue;
 
+		case BPF_ALU|BPF_XOR|BPF_X:
+			A ^= X;
+			continue;
+
 		case BPF_ALU|BPF_LSH|BPF_X:
 			A <<= X;
 			continue;
@@ -501,6 +552,10 @@
 			A /= pc->k;
 			continue;
 
+		case BPF_ALU|BPF_MOD|BPF_K:
+			A %= pc->k;
+			continue;
+
 		case BPF_ALU|BPF_AND|BPF_K:
 			A &= pc->k;
 			continue;
@@ -509,6 +564,10 @@
 			A |= pc->k;
 			continue;
 
+		case BPF_ALU|BPF_XOR|BPF_K:
+			A ^= pc->k;
+			continue;
+
 		case BPF_ALU|BPF_LSH|BPF_K:
 			A <<= pc->k;
 			continue;
@@ -532,6 +591,17 @@
 	}
 }
 
+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
@@ -611,13 +681,16 @@
 			case BPF_MUL:
 			case BPF_OR:
 			case BPF_AND:
+			case BPF_XOR:
 			case BPF_LSH:
 			case BPF_RSH:
 			case BPF_NEG:
 				break;
 			case BPF_DIV:
+			case BPF_MOD:
 				/*
-				 * Check for constant division by 0.
+				 * Check for constant division or modulus
+				 * by 0.
 				 */
 				if (BPF_SRC(p->code) == BPF_K && p->k == 0)
 					return 0;
diff --git a/bpf_dump.c b/bpf_dump.c
index e4ff4a2..5eaadc0 100644
--- a/bpf_dump.c
+++ b/bpf_dump.c
@@ -18,10 +18,6 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/bpf_dump.c,v 1.15 2008-01-02 04:16:46 guy Exp $ (LBL)";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/bpf_filter.c b/bpf_filter.c
deleted file mode 120000
index 0605488..0000000
--- a/bpf_filter.c
+++ /dev/null
@@ -1 +0,0 @@
-./bpf/net/bpf_filter.c
\ No newline at end of file
diff --git a/bpf_image.c b/bpf_image.c
index e6c0f62..3e9a23f 100644
--- a/bpf_image.c
+++ b/bpf_image.c
@@ -19,11 +19,6 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/bpf_image.c,v 1.28 2008-01-02 04:16:46 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -216,6 +211,11 @@
 		fmt = "x";
 		break;
 
+	case BPF_ALU|BPF_MOD|BPF_X:
+		op = "mod";
+		fmt = "x";
+		break;
+
 	case BPF_ALU|BPF_AND|BPF_X:
 		op = "and";
 		fmt = "x";
@@ -226,6 +226,11 @@
 		fmt = "x";
 		break;
 
+	case BPF_ALU|BPF_XOR|BPF_X:
+		op = "xor";
+		fmt = "x";
+		break;
+
 	case BPF_ALU|BPF_LSH|BPF_X:
 		op = "lsh";
 		fmt = "x";
@@ -256,6 +261,11 @@
 		fmt = "#%d";
 		break;
 
+	case BPF_ALU|BPF_MOD|BPF_K:
+		op = "mod";
+		fmt = "#%d";
+		break;
+
 	case BPF_ALU|BPF_AND|BPF_K:
 		op = "and";
 		fmt = "#0x%x";
@@ -266,6 +276,11 @@
 		fmt = "#0x%x";
 		break;
 
+	case BPF_ALU|BPF_XOR|BPF_K:
+		op = "xor";
+		fmt = "#0x%x";
+		break;
+
 	case BPF_ALU|BPF_LSH|BPF_K:
 		op = "lsh";
 		fmt = "#%d";
diff --git a/config.guess b/config.guess
old mode 100755
new mode 100644
index c2246a4..44290b8
--- a/config.guess
+++ b/config.guess
@@ -1,14 +1,12 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-#   Free Software Foundation, Inc.
+#   Copyright 1992-2015 Free Software Foundation, Inc.
 
-timestamp='2009-12-30'
+timestamp='2015-02-23'
 
 # 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 2 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
@@ -17,26 +15,22 @@
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner.  Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 #
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches to <config-patches@gnu.org>.
+
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -56,9 +50,7 @@
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright 1992-2015 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."
@@ -140,12 +132,33 @@
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+	# If the system lacks a compiler, then just pick glibc.
+	# We could probably try harder.
+	LIBC=gnu
+
+	eval $set_cc_for_build
+	cat <<-EOF > $dummy.c
+	#include <features.h>
+	#if defined(__UCLIBC__)
+	LIBC=uclibc
+	#elif defined(__dietlibc__)
+	LIBC=dietlibc
+	#else
+	LIBC=gnu
+	#endif
+	EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+	;;
+esac
+
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
@@ -155,20 +168,27 @@
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+	    /sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || \
+	    echo unknown)`
 	case "${UNAME_MACHINE_ARCH}" in
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    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
+		;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
 	# to ELF recently, or will in the future.
 	case "${UNAME_MACHINE_ARCH}" in
-	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+	    arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
 			| grep -q __ELF__
@@ -181,7 +201,14 @@
 		fi
 		;;
 	    *)
-	        os=netbsd
+		os=netbsd
+		;;
+	esac
+	# Determine ABI tags.
+	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
 		;;
 	esac
 	# The OS release
@@ -200,7 +227,11 @@
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
+	echo "${machine}-${os}${release}${abi}"
+	exit ;;
+    *:Bitrig:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
 	exit ;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
@@ -224,7 +255,7 @@
 		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
@@ -270,7 +301,10 @@
 	# 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'`
-	exit ;;
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	exitcode=$?
+	trap '' 0
+	exit $exitcode ;;
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# Should we change UNAME_MACHINE based on the output of uname instead
@@ -296,12 +330,12 @@
 	echo s390-ibm-zvmoe
 	exit ;;
     *:OS400:*:*)
-        echo powerpc-ibm-os400
+	echo powerpc-ibm-os400
 	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
 	echo arm-unknown-riscos
 	exit ;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -395,23 +429,23 @@
     # 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}
+	echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
 	echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
+	exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-milan-mint${UNAME_RELEASE}
+	exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-hades-mint${UNAME_RELEASE}
+	exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-unknown-mint${UNAME_RELEASE}
+	exit ;;
     m68k:machten:*:*)
 	echo m68k-apple-machten${UNAME_RELEASE}
 	exit ;;
@@ -481,8 +515,8 @@
 	echo m88k-motorola-sysv3
 	exit ;;
     AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	# DG/UX returns AViiON for all architectures
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
 	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
 	then
 	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -495,7 +529,7 @@
 	else
 	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
- 	exit ;;
+	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
 	exit ;;
@@ -552,15 +586,16 @@
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[456])
+    *:AIX:*:[4567])
 	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 [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
+	if [ -x /usr/bin/lslpp ] ; then
+		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}
 	fi
@@ -595,52 +630,52 @@
 	    9000/[678][0-9][0-9])
 		if [ -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
-                      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
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
+		    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
+			  32) HP_ARCH="hppa2.0n" ;;
+			  64) HP_ARCH="hppa2.0w" ;;
 			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
+			esac ;;
+		    esac
 		fi
 		if [ "${HP_ARCH}" = "" ]; then
 		    eval $set_cc_for_build
-		    sed 's/^              //' << EOF >$dummy.c
+		    sed 's/^		//' << EOF >$dummy.c
 
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
+		#define _HPUX_SOURCE
+		#include <stdlib.h>
+		#include <unistd.h>
 
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
+		int main ()
+		{
+		#if defined(_SC_KERNEL_BITS)
+		    long bits = sysconf(_SC_KERNEL_BITS);
+		#endif
+		    long cpu  = sysconf (_SC_CPU_VERSION);
 
-                  switch (cpu)
-              	{
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-              	    switch (bits)
-              		{
-              		case 64: puts ("hppa2.0w"); break;
-              		case 32: puts ("hppa2.0n"); break;
-              		default: puts ("hppa2.0"); break;
-              		} break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-              	    puts ("hppa2.0"); break;
-              #endif
-              	default: puts ("hppa1.0"); break;
-              	}
-                  exit (0);
-              }
+		    switch (cpu)
+			{
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+			case CPU_PA_RISC2_0:
+		#if defined(_SC_KERNEL_BITS)
+			    switch (bits)
+				{
+				case 64: puts ("hppa2.0w"); break;
+				case 32: puts ("hppa2.0n"); break;
+				default: puts ("hppa2.0"); break;
+				} break;
+		#else  /* !defined(_SC_KERNEL_BITS) */
+			    puts ("hppa2.0"); break;
+		#endif
+			default: puts ("hppa1.0"); break;
+			}
+		    exit (0);
+		}
 EOF
 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -731,22 +766,22 @@
 	exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
-        exit ;;
+	exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-        exit ;;
+	exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
 	echo c34-convex-bsd
-        exit ;;
+	exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
 	echo c38-convex-bsd
-        exit ;;
+	exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
-        exit ;;
+	exit ;;
     CRAY*Y-MP:*:*:*)
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
@@ -770,14 +805,14 @@
 	exit ;;
     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_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 ;;
     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}"
+	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 ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -789,30 +824,35 @@
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit ;;
+    *:MINGW64*:*)
+	echo ${UNAME_MACHINE}-pc-mingw64
+	exit ;;
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
+    *:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
     i*:windows32*:*)
-    	# uname -m includes "-pc" on this system.
-    	echo ${UNAME_MACHINE}-mingw32
+	# uname -m includes "-pc" on this system.
+	echo ${UNAME_MACHINE}-mingw32
 	exit ;;
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
     *:Interix*:*)
-    	case ${UNAME_MACHINE} in
+	case ${UNAME_MACHINE} in
 	    x86)
 		echo i586-pc-interix${UNAME_RELEASE}
 		exit ;;
@@ -849,15 +889,22 @@
 	exit ;;
     *:GNU:*:*)
 	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -867,52 +914,56 @@
 	  EV6)   UNAME_MACHINE=alphaev6 ;;
 	  EV67)  UNAME_MACHINE=alphaev67 ;;
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
+	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	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 ;;
     arm*:Linux:*:*)
 	eval $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-gnu
+	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	else
-	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	    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
+	    else
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     cris:Linux:*:*)
-	echo cris-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
     crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
     frv:Linux:*:*)
-    	echo frv-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     i*86:Linux:*:*)
-	LIBC=gnu
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
-	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
@@ -931,51 +982,63 @@
 	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
-    or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
+    openrisc*:Linux:*:*)
+	echo or1k-unknown-linux-${LIBC}
+	exit ;;
+    or32:Linux:*:* | or1k*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-gnu
+	echo sparc-unknown-linux-${LIBC}
 	exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+	echo hppa64-unknown-linux-${LIBC}
 	exit ;;
     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-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
 	esac
 	exit ;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
+	echo powerpc64-unknown-linux-${LIBC}
 	exit ;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
+	echo powerpc-unknown-linux-${LIBC}
+	exit ;;
+    ppc64le:Linux:*:*)
+	echo powerpc64le-unknown-linux-${LIBC}
+	exit ;;
+    ppcle:Linux:*:*)
+	echo powerpcle-unknown-linux-${LIBC}
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux
+	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 	exit ;;
     sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    tile*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-gnu
+	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -984,11 +1047,11 @@
 	echo i386-sequent-sysv4
 	exit ;;
     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,
+	# 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.
+	# Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit ;;
     i*86:OS/2:*:*)
@@ -1020,7 +1083,7 @@
 	fi
 	exit ;;
     i*86:*:5:[678]*)
-    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
 	case `/bin/uname -X | grep "^Machine"` in
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
@@ -1048,13 +1111,13 @@
 	exit ;;
     pc:*:*:*)
 	# Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i586.
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
+	# the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
 	# prints for the "djgpp" host, or else GDB configury will decide that
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
-        exit ;;
+	exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
 	exit ;;
@@ -1089,8 +1152,8 @@
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
 	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4; exit; } ;;
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
 	OS_REL='.3'
 	test -r /etc/.relid \
@@ -1133,10 +1196,10 @@
 		echo 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 ;;
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+			# says <Richard.M.Bartel@ccMail.Census.GOV>
+	echo i586-unisys-sysv4
+	exit ;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes@openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
@@ -1162,11 +1225,11 @@
 	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
-	        echo mips-nec-sysv${UNAME_RELEASE}
+		echo mips-nec-sysv${UNAME_RELEASE}
 	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
+		echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
-        exit ;;
+	exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
 	echo powerpc-be-beos
 	exit ;;
@@ -1179,6 +1242,9 @@
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
 	echo i586-pc-haiku
 	exit ;;
+    x86_64:Haiku:*:*)
+	echo x86_64-unknown-haiku
+	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
 	exit ;;
@@ -1205,19 +1271,31 @@
 	exit ;;
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	case $UNAME_PROCESSOR in
-	    i386)
-		eval $set_cc_for_build
-		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-		      grep IS_64BIT_ARCH >/dev/null
-		  then
-		      UNAME_PROCESSOR="x86_64"
-		  fi
-		fi ;;
-	    unknown) UNAME_PROCESSOR=powerpc ;;
-	esac
+	eval $set_cc_for_build
+	if test "$UNAME_PROCESSOR" = unknown ; then
+	    UNAME_PROCESSOR=powerpc
+	fi
+	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		    grep IS_64BIT_ARCH >/dev/null
+		then
+		    case $UNAME_PROCESSOR in
+			i386) UNAME_PROCESSOR=x86_64 ;;
+			powerpc) UNAME_PROCESSOR=powerpc64 ;;
+		    esac
+		fi
+	    fi
+	elif test "$UNAME_PROCESSOR" = i386 ; then
+	    # Avoid executing cc on OS X 10.9, as it ships with a stub
+	    # that puts up a graphical alert prompting to install
+	    # developer tools.  Any system running Mac OS X 10.7 or
+	    # later (Darwin 11 and later) is required to have a 64-bit
+	    # processor. This is not true of the ARM version of Darwin
+	    # that Apple uses in portable devices.
+	    UNAME_PROCESSOR=x86_64
+	fi
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1231,7 +1309,10 @@
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
+    NEO-?:NONSTOP_KERNEL:*:*)
+	echo neo-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSE-*:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
     NSR-?:NONSTOP_KERNEL:*:*)
@@ -1276,13 +1357,13 @@
 	echo pdp10-unknown-its
 	exit ;;
     SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
+	echo mips-sei-seiux${UNAME_RELEASE}
 	exit ;;
     *:DragonFly:*:*)
 	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit ;;
     *:*VMS:*:*)
-    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
 	case "${UNAME_MACHINE}" in
 	    A*) echo alpha-dec-vms ; exit ;;
 	    I*) echo ia64-dec-vms ; exit ;;
@@ -1300,159 +1381,11 @@
     i*86:AROS:*:*)
 	echo ${UNAME_MACHINE}-pc-aros
 	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
 esac
 
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-          "4"
-#else
-	  ""
-#endif
-         ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  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
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-	printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-	printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$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.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-	echo c1-convex-bsd
-	exit ;;
-    c2*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-	exit ;;
-    c34*)
-	echo c34-convex-bsd
-	exit ;;
-    c38*)
-	echo c38-convex-bsd
-	exit ;;
-    c4*)
-	echo c4-convex-bsd
-	exit ;;
-    esac
-fi
-
 cat >&2 <<EOF
 $0: unable to guess system type
 
diff --git a/config.h b/config.h
index a693602..680bfd8 100644
--- a/config.h
+++ b/config.h
@@ -77,6 +77,9 @@
 /* Define to 1 if you have the <linux/ethtool.h> header file. */
 #define HAVE_LINUX_ETHTOOL_H 1
 
+/* 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/if_packet.h> header file. */
 #define HAVE_LINUX_IF_PACKET_H 1
 
diff --git a/config.h.in b/config.h.in
index c6bc68e..3b9f90a 100644
--- a/config.h.in
+++ b/config.h.in
@@ -76,12 +76,18 @@
 /* Define to 1 if you have the <linux/ethtool.h> header file. */
 #undef HAVE_LINUX_ETHTOOL_H
 
+/* Define to 1 if you have the <linux/if_bonding.h> header file. */
+#undef HAVE_LINUX_IF_BONDING_H
+
 /* Define to 1 if you have the <linux/if_packet.h> header file. */
 #undef HAVE_LINUX_IF_PACKET_H
 
 /* Define to 1 if you have the <linux/net_tstamp.h> header file. */
 #undef HAVE_LINUX_NET_TSTAMP_H
 
+/* Define to 1 if you have the <linux/sockios.h> header file. */
+#undef HAVE_LINUX_SOCKIOS_H
+
 /* if tp_vlan_tci exists */
 #undef HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
 
@@ -256,6 +262,9 @@
 /* target host supports Bluetooth sniffing */
 #undef PCAP_SUPPORT_BT
 
+/* target host supports Bluetooth Monitor */
+#undef PCAP_SUPPORT_BT_MONITOR
+
 /* target host supports CAN sniffing */
 #undef PCAP_SUPPORT_CAN
 
@@ -268,6 +277,9 @@
 /* target host supports netfilter sniffing */
 #undef PCAP_SUPPORT_NETFILTER
 
+/* use Linux packet ring capture if available */
+#undef PCAP_SUPPORT_PACKET_RING
+
 /* target host supports USB sniffing */
 #undef PCAP_SUPPORT_USB
 
diff --git a/config.sub b/config.sub
old mode 100755
new mode 100644
index 8518609..bc855a2
--- a/config.sub
+++ b/config.sub
@@ -1,38 +1,31 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-#   Free Software Foundation, Inc.
+#   Copyright 1992-2015 Free Software Foundation, Inc.
 
-timestamp='2009-12-31'
+timestamp='2015-02-22'
 
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# 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 2 of the License, or
+# 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
 # (at your option) any later version.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches to <config-patches@gnu.org>.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -75,9 +68,7 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright 1992-2015 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."
@@ -124,13 +115,18 @@
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
   kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
@@ -153,12 +149,12 @@
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray | -microblaze)
+	-apple | -axis | -knuth | -cray | -microblaze*)
 		os=
 		basic_machine=$1
 		;;
-        -bluegene*)
-	        os=-cnk
+	-bluegene*)
+		os=-cnk
 		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
@@ -174,10 +170,10 @@
 		os=-chorusos
 		basic_machine=$1
 		;;
- 	-chorusrdb)
- 		os=-chorusrdb
+	-chorusrdb)
+		os=-chorusrdb
 		basic_machine=$1
- 		;;
+		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
@@ -222,6 +218,12 @@
 	-isc*)
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
+	-lynx*178)
+		os=-lynxos178
+		;;
+	-lynx*5)
+		os=-lynxos5
+		;;
 	-lynx*)
 		os=-lynxos
 		;;
@@ -246,20 +248,28 @@
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	| a29k \
+	| aarch64 | aarch64_be \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| arc | arceb \
+	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+	| avr | avr32 \
+	| be32 | be64 \
 	| bfin \
-	| c4x | clipper \
+	| c4x | c8051 | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| fido | fr30 | frv \
+	| epiphany \
+	| fido | fr30 | frv | ft32 \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| k1om \
+	| le32 | le64 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore | mep | metag \
+	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -273,38 +283,55 @@
 	| mips64vr5900 | mips64vr5900el \
 	| mipsisa32 | mipsisa32el \
 	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa32r6 | mipsisa32r6el \
 	| mipsisa64 | mipsisa64el \
 	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64r6 | mipsisa64r6el \
 	| mipsisa64sb1 | mipsisa64sb1el \
 	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipsr5900 | mipsr5900el \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
 	| moxie \
 	| mt \
 	| msp430 \
-	| nios | nios2 \
+	| nds32 | nds32le | nds32be \
+	| nios | nios2 | nios2eb | nios2el \
 	| ns16k | ns32k \
-	| or32 \
+	| open8 | or1k | or1knd | or32 \
 	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pyramid \
-	| rx \
+	| riscv32 | riscv64 \
+	| rl78 | rx \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu | strongarm \
-	| tahoe | thumb | tic4x | tic80 | tron \
+	| spu \
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
-	| v850 | v850e \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| visium \
 	| we32k \
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
-		# Motorola 68HC11/12.
+	c54x)
+		basic_machine=tic54x-unknown
+		;;
+	c55x)
+		basic_machine=tic55x-unknown
+		;;
+	c6x)
+		basic_machine=tic6x-unknown
+		;;
+	leon|leon[3-9])
+		basic_machine=sparc-$basic_machine
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
@@ -314,6 +341,21 @@
 		basic_machine=mt-unknown
 		;;
 
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-unknown
+		;;
+
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
@@ -328,25 +370,31 @@
 	# Recognize the basic CPU types with company name.
 	580-* \
 	| a29k-* \
+	| aarch64-* | aarch64_be-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
-	| clipper-* | craynv-* | cydra-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
+	| c8051-* | clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| k1om-* \
+	| le32-* | le64-* \
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+	| microblaze-* | microblazeel-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -360,33 +408,42 @@
 	| mips64vr5900-* | mips64vr5900el-* \
 	| mipsisa32-* | mipsisa32el-* \
 	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa32r6-* | mipsisa32r6el-* \
 	| mipsisa64-* | mipsisa64el-* \
 	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64r6-* | mipsisa64r6el-* \
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipsr5900-* | mipsr5900el-* \
 	| mipstx39-* | mipstx39el-* \
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
-	| nios-* | nios2-* \
+	| nds32-* | nds32le-* | nds32be-* \
+	| nios-* | nios2-* | nios2eb-* | nios2el-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
+	| or1k*-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| pyramid-* \
-	| romp-* | rs6000-* | rx-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
-	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| tahoe-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile*-* \
 	| tron-* \
 	| ubicom32-* \
-	| v850-* | v850e-* | vax-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
+	| visium-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
 	| ymp-* \
 	| z8k-* | z80-*)
@@ -411,7 +468,7 @@
 		basic_machine=a29k-amd
 		os=-udi
 		;;
-    	abacus)
+	abacus)
 		basic_machine=abacus-unknown
 		;;
 	adobe68k)
@@ -481,11 +538,20 @@
 		basic_machine=powerpc-ibm
 		os=-cnk
 		;;
+	c54x-*)
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c55x-*)
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c6x-*)
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
 		;;
-        cegcc)
+	cegcc)
 		basic_machine=arm-unknown
 		os=-cegcc
 		;;
@@ -517,7 +583,7 @@
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16)
+	cr16 | cr16-*)
 		basic_machine=cr16-unknown
 		os=-elf
 		;;
@@ -675,7 +741,6 @@
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
@@ -714,6 +779,9 @@
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	leon-*|leon[3-9]-*)
+		basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+		;;
 	m68knommu)
 		basic_machine=m68k-unknown
 		os=-linux
@@ -733,11 +801,15 @@
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
-        microblaze)
+	microblaze*)
 		basic_machine=microblaze-xilinx
 		;;
+	mingw64)
+		basic_machine=x86_64-pc
+		os=-mingw64
+		;;
 	mingw32)
-		basic_machine=i386-pc
+		basic_machine=i686-pc
 		os=-mingw32
 		;;
 	mingw32ce)
@@ -765,6 +837,10 @@
 		basic_machine=powerpc-unknown
 		os=-morphos
 		;;
+	moxiebox)
+		basic_machine=moxie-unknown
+		os=-moxiebox
+		;;
 	msdos)
 		basic_machine=i386-pc
 		os=-msdos
@@ -772,10 +848,18 @@
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
+	msys)
+		basic_machine=i686-pc
+		os=-msys
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
@@ -840,6 +924,12 @@
 	np1)
 		basic_machine=np1-gould
 		;;
+	neo-tandem)
+		basic_machine=neo-tandem
+		;;
+	nse-tandem)
+		basic_machine=nse-tandem
+		;;
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
@@ -922,9 +1012,10 @@
 		;;
 	power)	basic_machine=power-ibm
 		;;
-	ppc)	basic_machine=powerpc-unknown
+	ppc | ppcbe)	basic_machine=powerpc-unknown
 		;;
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc-* | ppcbe-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
@@ -949,7 +1040,11 @@
 		basic_machine=i586-unknown
 		os=-pw32
 		;;
-	rdos)
+	rdos | rdos64)
+		basic_machine=x86_64-pc
+		os=-rdos
+		;;
+	rdos32)
 		basic_machine=i386-pc
 		os=-rdos
 		;;
@@ -1018,6 +1113,9 @@
 		basic_machine=i860-stratus
 		os=-sysv4
 		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	sun2)
 		basic_machine=m68000-sun
 		;;
@@ -1074,20 +1172,8 @@
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-	tic54x | c54x*)
-		basic_machine=tic54x-unknown
-		os=-coff
-		;;
-	tic55x | c55x*)
-		basic_machine=tic55x-unknown
-		os=-coff
-		;;
-	tic6x | c6x*)
-		basic_machine=tic6x-unknown
-		os=-coff
-		;;
 	tile*)
-		basic_machine=tile-unknown
+		basic_machine=$basic_machine-unknown
 		os=-linux-gnu
 		;;
 	tx39)
@@ -1157,6 +1243,9 @@
 	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
 	ymp)
 		basic_machine=ymp-cray
 		os=-unicos
@@ -1254,11 +1343,11 @@
 if [ x"$os" != x"" ]
 then
 case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
+	# First match some system type aliases
+	# that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
-        -auroraux)
-	        os=-auroraux
+	-auroraux)
+		os=-auroraux
 		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
@@ -1282,28 +1371,29 @@
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-	      | -sym* | -kopensolaris* \
+	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
 	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -openbsd* | -solidbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
-	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1342,7 +1432,7 @@
 	-opened*)
 		os=-openedition
 		;;
-        -os400*)
+	-os400*)
 		os=-os400
 		;;
 	-wince*)
@@ -1391,7 +1481,7 @@
 	-sinix*)
 		os=-sysv4
 		;;
-        -tpf*)
+	-tpf*)
 		os=-tpf
 		;;
 	-triton*)
@@ -1427,17 +1517,14 @@
 	-aros*)
 		os=-aros
 		;;
-	-kaos*)
-		os=-kaos
-		;;
 	-zvmoe)
 		os=-zvmoe
 		;;
 	-dicos*)
 		os=-dicos
 		;;
-        -nacl*)
-	        ;;
+	-nacl*)
+		;;
 	-none)
 		;;
 	*)
@@ -1460,10 +1547,10 @@
 # system, and we'll never get to this point.
 
 case $basic_machine in
-        score-*)
+	score-*)
 		os=-elf
 		;;
-        spu-*)
+	spu-*)
 		os=-elf
 		;;
 	*-acorn)
@@ -1475,8 +1562,23 @@
 	arm*-semi)
 		os=-aout
 		;;
-        c4x-* | tic4x-*)
-        	os=-coff
+	c4x-* | tic4x-*)
+		os=-coff
+		;;
+	c8051-*)
+		os=-elf
+		;;
+	hexagon-*)
+		os=-elf
+		;;
+	tic54x-*)
+		os=-coff
+		;;
+	tic55x-*)
+		os=-coff
+		;;
+	tic6x-*)
+		os=-coff
 		;;
 	# This must come before the *-dec entry.
 	pdp10-*)
@@ -1496,14 +1598,11 @@
 		;;
 	m68000-sun)
 		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
 		;;
 	m68*-cisco)
 		os=-aout
 		;;
-        mep-*)
+	mep-*)
 		os=-elf
 		;;
 	mips*-cisco)
@@ -1530,7 +1629,7 @@
 	*-ibm)
 		os=-aix
 		;;
-    	*-knuth)
+	*-knuth)
 		os=-mmixware
 		;;
 	*-wec)
diff --git a/configure b/configure
index 07c2d33..2b69b6d 100755
--- a/configure
+++ b/configure
@@ -623,6 +623,7 @@
 INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
+PCAP_SUPPORT_PACKET_RING
 DBUS_SRC
 PCAP_SUPPORT_DBUS
 PKGCONFIG
@@ -630,6 +631,7 @@
 PCAP_SUPPORT_CAN
 CANUSB_SRC
 PCAP_SUPPORT_CANUSB
+BT_MONITOR_SRC
 BT_SRC
 PCAP_SUPPORT_BT
 NETFILTER_SRC
@@ -744,10 +746,12 @@
 with_bison
 enable_universal
 enable_shared
+enable_usb
 enable_bluetooth
 enable_canusb
 enable_can
 enable_dbus
+enable_packet_ring
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1379,6 +1383,8 @@
   --disable-universal     don't build universal on OS X
   --enable-shared         build shared libraries [default=yes, if support
                           available]
+  --enable-usb            enable nusb support [default=yes, if support
+                          available]
   --enable-bluetooth      enable Bluetooth support [default=yes, if support
                           available]
   --enable-canusb         enable canusb support [default=yes, if support
@@ -1387,6 +1393,7 @@
                           available]
   --enable-dbus           enable D-Bus capture support [default=yes, if
                           support available]
+  --enable-packet-ring    enable Linux packet ring support [default=yes]
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -4703,6 +4710,28 @@
 
 fi
 
+case "$host_os" in
+linux*)
+	for ac_header in linux/sockios.h linux/if_bonding.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "
+#include <sys/socket.h>
+#include <linux/if.h>
+
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+	;;
+esac
+
 if test "$GCC" = yes ; then
 	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI ioctl definitions" >&5
 $as_echo_n "checking for ANSI ioctl definitions... " >&6; }
@@ -5511,6 +5540,13 @@
 	if test x$with_libnl != xno ; then
 		have_any_nl="no"
 
+                incdir=-I/usr/include/libnl3
+                libnldir=
+                if test x$withval != x ; then
+                  libnldir=-L${withval}/lib/.libs
+                  incdir=-I${withval}/include
+                fi
+
 		#
 		# Try libnl 3.x first.
 		#
@@ -5520,7 +5556,7 @@
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnl-3  $LIBS"
+LIBS="-lnl-3 ${incdir} ${libnldir} -lnl-genl-3 -lnl-3  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5555,7 +5591,7 @@
 			#
 			# Yes, we have libnl 3.x.
 			#
-			LIBS="-lnl-genl-3 -lnl-3 $LIBS"
+			LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
 
 $as_echo "#define HAVE_LIBNL 1" >>confdefs.h
 
@@ -5568,7 +5604,7 @@
 
 $as_echo "#define HAVE_LIBNL_SOCKETS 1" >>confdefs.h
 
-			V_INCLS="$V_INCLS -I/usr/include/libnl3"
+			V_INCLS="$V_INCLS ${incdir}"
 			have_any_nl="yes"
 
 fi
@@ -5619,7 +5655,7 @@
 				#
 				# Yes, we have libnl 2.x.
 				#
-				LIBS="-lnl-genl -lnl $LIBS"
+				LIBS="${libnldir} -lnl-genl -lnl $LIBS"
 
 $as_echo "#define HAVE_LIBNL 1" >>confdefs.h
 
@@ -5683,7 +5719,7 @@
 				#
 				# Yes.
 				#
-				LIBS="-lnl $LIBS"
+				LIBS="${libnldir} -lnl $LIBS"
 
 $as_echo "#define HAVE_LIBNL 1" >>confdefs.h
 
@@ -7806,10 +7842,19 @@
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for USB sniffing support" >&5
+# Check whether --enable-usb was given.
+if test "${enable_usb+set}" = set; then :
+  enableval=$enable_usb;
+else
+  enable_usb=yes
+fi
+
+
+if test "x$enable_usb" != "xno" ; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for USB sniffing support" >&5
 $as_echo_n "checking for USB sniffing support... " >&6; }
-case "$host_os" in
-linux*)
+   case "$host_os" in
+   linux*)
 
 $as_echo "#define PCAP_SUPPORT_USB 1" >>confdefs.h
 
@@ -7922,11 +7967,12 @@
 	    fi
 	fi
 	;;
-*)
+    *)
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 	;;
 esac
+fi
 
 
 
@@ -7999,7 +8045,7 @@
 if test "${enable_bluetooth+set}" = set; then :
   enableval=$enable_bluetooth;
 else
-  enable_bluetooth=yes
+  enable_bluetooth=ifsupportavailable
 fi
 
 
@@ -8053,58 +8099,167 @@
 
 $as_echo "#define SOCKADDR_HCI_HAS_HCI_CHANNEL /**/" >>confdefs.h
 
+
+		      #
+		      # OK, is HCI_CHANNEL_MONITOR defined?
+		      #
+		      { $as_echo "$as_me:${as_lineno-$LINENO}: checking if HCI_CHANNEL_MONITOR is defined" >&5
+$as_echo_n "checking if HCI_CHANNEL_MONITOR is defined... " >&6; }
+		      if ${ac_cv_lbl_hci_channel_monitor_is_defined+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
+
+int
+main ()
+{
+u_int i = HCI_CHANNEL_MONITOR
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_lbl_hci_channel_monitor_is_defined=yes
+else
+  ac_cv_lbl_hci_channel_monitor_is_defined=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_hci_channel_monitor_is_defined" >&5
+$as_echo "$ac_cv_lbl_hci_channel_monitor_is_defined" >&6; }
+		      if test $ac_cv_lbl_hci_channel_monitor_is_defined = yes ; then
+
+$as_echo "#define PCAP_SUPPORT_BT_MONITOR /**/" >>confdefs.h
+
+			BT_MONITOR_SRC=pcap-bt-monitor-linux.c
+		      fi
 		    fi
+		    ac_lbl_bluetooth_available=yes
 
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&5
-$as_echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&6;}
+  ac_lbl_bluetooth_available=no
 
 fi
 
 
+		if test "x$ac_lbl_bluetooth_available" == "xno" ; then
+		    if test "x$enable_bluetooth" = "xyes" ; then
+			as_fn_error $? "Bluetooth sniffing is not supported; install bluez-lib devel to enable it" "$LINENO" 5
+		    else
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&5
+$as_echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&6;}
+		    fi
+		fi
 		;;
 	*)
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: no Bluetooth sniffing support implemented for $host_os" >&5
+		if test "x$enable_bluetooth" = "xyes" ; then
+		    as_fn_error $? "no Bluetooth sniffing support implemented for $host_os" "$LINENO" 5
+		else
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: no Bluetooth sniffing support implemented for $host_os" >&5
 $as_echo "$as_me: no Bluetooth sniffing support implemented for $host_os" >&6;}
+		fi
 		;;
 	esac
 
 
+
 fi
 
 # Check whether --enable-canusb was given.
 if test "${enable_canusb+set}" = set; then :
   enableval=$enable_canusb;
 else
-  enable_canusb=yes
+  enable_canusb=ifsupportavailable
 fi
 
 
 if test "x$enable_canusb" != "xno" ; then
 		case "$host_os" in
-	linux*)
+	linux*|uclinux*)
 		ac_fn_c_check_header_mongrel "$LINENO" "libusb-1.0/libusb.h" "ac_cv_header_libusb_1_0_libusb_h" "$ac_includes_default"
 if test "x$ac_cv_header_libusb_1_0_libusb_h" = xyes; then :
 
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb_init in -lusb-1.0" >&5
+$as_echo_n "checking for libusb_init in -lusb-1.0... " >&6; }
+if ${ac_cv_lib_usb_1_0_libusb_init+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lusb-1.0 -lpthread
+		     $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 libusb_init ();
+int
+main ()
+{
+return libusb_init ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_usb_1_0_libusb_init=yes
+else
+  ac_cv_lib_usb_1_0_libusb_init=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_usb_1_0_libusb_init" >&5
+$as_echo "$ac_cv_lib_usb_1_0_libusb_init" >&6; }
+if test "x$ac_cv_lib_usb_1_0_libusb_init" = xyes; then :
+
 
 $as_echo "#define PCAP_SUPPORT_CANUSB 1" >>confdefs.h
 
-		    CANUSB_SRC=pcap-canusb-linux.c
-		    LIBS="-lusb-1.0 -lpthread $LIBS"
-		    { $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is supported" >&5
-$as_echo "$as_me: canusb sniffing is supported" >&6;}
+			CANUSB_SRC=pcap-canusb-linux.c
+			LIBS="-lusb-1.0 -lpthread $LIBS"
+			ac_lbl_has_libusb=yes
 
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
-$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
+  ac_lbl_has_libusb=no
+fi
+
+
+else
+  ac_lbl_has_libusb=no
 
 fi
 
 
+		if test "x$ac_lbl_has_libusb" = "xyes" ; then
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is supported" >&5
+$as_echo "$as_me: canusb sniffing is supported" >&6;}
+		else
+		    if test "x$enable_canusb" = "xyes" ; then
+			as_fn_error $? "canusb sniffing is not supported; install libusb1.0 lib devel to enable it" "$LINENO" 5
+		    else
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
+$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
+		    fi
+		fi
 		;;
 	*)
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: no canusb support implemented for $host_os" >&5
+		if test "x$enable_canusb" = "xyes" ; then
+		    as_fn_error $? "no canusb support implemented for $host_os" "$LINENO" 5
+		else
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: no canusb support implemented for $host_os" >&5
 $as_echo "$as_me: no canusb support implemented for $host_os" >&6;}
+		fi
 		;;
 	esac
 
@@ -8115,7 +8270,7 @@
 if test "${enable_can+set}" = set; then :
   enableval=$enable_can;
 else
-  enable_can=yes
+  enable_can=ifsupportavailable
 fi
 
 
@@ -8127,21 +8282,33 @@
 "
 if test "x$ac_cv_header_linux_can_h" = xyes; then :
 
+
 $as_echo "#define PCAP_SUPPORT_CAN 1" >>confdefs.h
 
-			CAN_SRC=pcap-can-linux.c
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is supported" >&5
+			    CAN_SRC=pcap-can-linux.c
+			    { $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is supported" >&5
 $as_echo "$as_me: CAN sniffing is supported" >&6;}
+
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is not supported" >&5
+
+			    if test "x$enable_can" = "xyes" ; then
+				as_fn_error $? "CAN sniffing is not supported" "$LINENO" 5
+			    else
+				{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is not supported" >&5
 $as_echo "$as_me: CAN sniffing is not supported" >&6;}
+			    fi
+
 fi
 
 
 		;;
 	*)
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: no CAN sniffing support implemented for $host_os" >&5
+		if test "x$enable_can" = "xyes" ; then
+		    as_fn_error $? "no CAN sniffing support implemented for $host_os" "$LINENO" 5
+		else
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: no CAN sniffing support implemented for $host_os" >&5
 $as_echo "$as_me: no CAN sniffing support implemented for $host_os" >&6;}
+		fi
 		;;
 	esac
 
@@ -8162,22 +8329,34 @@
 
 		darwin*)
 			#
+			# We don't support D-Bus sniffing on OS X; see
+			#
 			# https://bugs.freedesktop.org/show_bug.cgi?id=74029
 			#
+			# The user requested it, so fail.
+			#
 			as_fn_error $? "Due to freedesktop.org bug 74029, D-Bus capture support is not available on OS X" "$LINENO" 5
-			;;
 		esac
 	else
 		case "$host_os" in
 
 		darwin*)
 			#
+			# We don't support D-Bus sniffing on OS X; see
+			#
 			# https://bugs.freedesktop.org/show_bug.cgi?id=74029
 			#
+			# The user dind't explicitly request it, so just
+			# silently refuse to enable it.
+			#
+			enable_dbus="no"
 			;;
+		esac
+	fi
+fi
 
-		*)
-			# Extract the first word of "pkg-config", so it can be a program name with args.
+if test "x$enable_dbus" != "xno"; then
+	# 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; }
@@ -8215,28 +8394,28 @@
 fi
 
 
-			if test "x$PKGCONFIG" != "xno"; then
-				{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for D-Bus" >&5
+	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
+		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
+			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
 $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 ()
 {
@@ -8247,37 +8426,34 @@
 _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
 
-						DBUS_SRC=pcap-dbus.c
-						V_INCLS="$V_INCLS $DBUS_CFLAGS"
+				DBUS_SRC=pcap-dbus.c
+				V_INCLS="$V_INCLS $DBUS_CFLAGS"
 
 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
+				LIBS="$save_LIBS"
 
 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
+			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
+			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
-			;;
-		esac
+		fi
 	fi
 
 
@@ -8304,6 +8480,21 @@
 	;;
 esac
 
+# Check whether --enable-packet-ring was given.
+if test "${enable_packet_ring+set}" = set; then :
+  enableval=$enable_packet_ring;
+else
+  enable_packet_ring=yes
+fi
+
+
+if test "x$enable_packet_ring" != "xno" ; then
+
+$as_echo "#define PCAP_SUPPORT_PACKET_RING 1" >>confdefs.h
+
+
+fi
+
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
 # incompatible versions:
diff --git a/configure.in b/configure.in
index 3566f82..be4b29e 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,3 @@
-dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.168 2008-12-23 20:49:26 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1994, 1995, 1996, 1997
 dnl	The Regents of the University of California.  All rights reserved.
@@ -149,6 +148,16 @@
 #include <net/if.h>])
 fi
 
+case "$host_os" in
+linux*)
+	AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,
+	[
+#include <sys/socket.h>
+#include <linux/if.h>
+	])
+	;;
+esac
+
 AC_LBL_FIXINCLUDES
 
 AC_CHECK_FUNCS(strerror strlcpy)
@@ -361,11 +370,11 @@
 	#
 	# Checks to see if Solaris has the public libdlpi(3LIB) library.
 	# Note: The existence of /usr/include/libdlpi.h does not mean it is the
-	# public libdlpi(3LIB) version. Before libdlpi was made public, a 
-	# private version also existed, which did not have the same APIs. 
+	# public libdlpi(3LIB) version. Before libdlpi was made public, a
+	# private version also existed, which did not have the same APIs.
 	# Due to a gcc bug, the default search path for 32-bit libraries does
 	# not include /lib, we add it explicitly here.
-	# [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485]. 
+	# [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
 	# Also, due to the bug above applications that link to libpcap with
 	# libdlpi will have to add "-L/lib" option to "configure".
 	#
@@ -447,6 +456,13 @@
 	if test x$with_libnl != xno ; then
 		have_any_nl="no"
 
+                incdir=-I/usr/include/libnl3
+                libnldir=
+                if test x$withval != x ; then
+                  libnldir=-L${withval}/lib/.libs
+                  incdir=-I${withval}/include
+                fi
+
 		#
 		# Try libnl 3.x first.
 		#
@@ -455,14 +471,14 @@
 			#
 			# Yes, we have libnl 3.x.
 			#
-			LIBS="-lnl-genl-3 -lnl-3 $LIBS"
+			LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
 			AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
 			AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
 			AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
 			AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
-			V_INCLS="$V_INCLS -I/usr/include/libnl3"
+			V_INCLS="$V_INCLS ${incdir}"
 			have_any_nl="yes"
-		])
+		],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
 
 		if test x$have_any_nl = xno ; then
 			#
@@ -473,7 +489,7 @@
 				#
 				# Yes, we have libnl 2.x.
 				#
-				LIBS="-lnl-genl -lnl $LIBS"
+				LIBS="${libnldir} -lnl-genl -lnl $LIBS"
 				AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
 				AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
 				AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
@@ -491,7 +507,7 @@
 				#
 				# Yes.
 				#
-				LIBS="-lnl $LIBS"
+				LIBS="${libnldir} -lnl $LIBS"
 				AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
 				have_any_nl="yes"
 			])
@@ -529,7 +545,7 @@
 	    #include <net/if.h>
 	    #include <net/bpf.h>],
 	    [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
-	    [  
+	    [
 		AC_MSG_RESULT(yes)
 		AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
 		[define if the system supports zerocopy BPF])
@@ -777,7 +793,7 @@
 	if test -z "$dag_lib_dir"; then
 	    dag_lib_dir="$dag_root/lib"
 	fi
-	
+
 	if test -z "$dag_tools_dir"; then
 	    dag_tools_dir="$dag_root/tools"
 	fi
@@ -812,7 +828,7 @@
 		AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
 		LIBS="$LIBS -ldag"
 		LDFLAGS="$LDFLAGS -L$dag_lib_dir"
-		
+
 		AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
 		if test "$ac_dag_have_vdag" = 1; then
 			AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
@@ -1349,10 +1365,16 @@
 AC_SUBST(MAN_FILE_FORMATS)
 AC_SUBST(MAN_MISC_INFO)
 
-dnl check for USB sniffing support
-AC_MSG_CHECKING(for USB sniffing support)
-case "$host_os" in
-linux*)
+AC_ARG_ENABLE([usb],
+[AC_HELP_STRING([--enable-usb],[enable nusb support @<:@default=yes, if support available@:>@])],
+    [],
+    [enable_usb=yes])
+
+if test "x$enable_usb" != "xno" ; then
+   dnl check for USB sniffing support
+   AC_MSG_CHECKING(for USB sniffing support)
+   case "$host_os" in
+   linux*)
 	AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
 	USB_SRC=pcap-usb-linux.c
 	AC_MSG_RESULT(yes)
@@ -1403,10 +1425,11 @@
 	    fi
 	fi
 	;;
-*)
+    *)
 	AC_MSG_RESULT(no)
 	;;
 esac
+fi
 AC_SUBST(PCAP_SUPPORT_USB)
 AC_SUBST(USB_SRC)
 
@@ -1456,7 +1479,7 @@
 AC_ARG_ENABLE([bluetooth],
 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
     [],
-    [enable_bluetooth=yes])
+    [enable_bluetooth=ifsupportavailable])
 
 if test "x$enable_bluetooth" != "xno" ; then
 	dnl check for Bluetooth sniffing support
@@ -1486,40 +1509,92 @@
 		    if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then
 		      AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,,
 			[if struct sockaddr_hci has hci_channel member])
+
+		      #
+		      # OK, is HCI_CHANNEL_MONITOR defined?
+		      #
+		      AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
+		      AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
+		      AC_TRY_COMPILE(
+[
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
+],
+			[u_int i = HCI_CHANNEL_MONITOR],
+			ac_cv_lbl_hci_channel_monitor_is_defined=yes,
+			ac_cv_lbl_hci_channel_monitor_is_defined=no))
+		      AC_MSG_RESULT($ac_cv_lbl_hci_channel_monitor_is_defined)
+		      if test $ac_cv_lbl_hci_channel_monitor_is_defined = yes ; then
+			AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
+			  [target host supports Bluetooth Monitor])
+			BT_MONITOR_SRC=pcap-bt-monitor-linux.c
+		      fi
 		    fi
+		    ac_lbl_bluetooth_available=yes
 		],
-		AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
+		ac_lbl_bluetooth_available=no
 		)
+		if test "x$ac_lbl_bluetooth_available" == "xno" ; then
+		    if test "x$enable_bluetooth" = "xyes" ; then
+			AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
+		    else
+			AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
+		    fi
+		fi
 		;;
 	*)
-		AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
+		if test "x$enable_bluetooth" = "xyes" ; then
+		    AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
+		else
+		    AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
+		fi
 		;;
 	esac
 	AC_SUBST(PCAP_SUPPORT_BT)
 	AC_SUBST(BT_SRC)
+	AC_SUBST(BT_MONITOR_SRC)
 fi
 
 AC_ARG_ENABLE([canusb],
 [AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=yes, if support available@:>@])],
     [],
-    [enable_canusb=yes])
+    [enable_canusb=ifsupportavailable])
 
 if test "x$enable_canusb" != "xno" ; then
 	dnl check for canusb support
 	case "$host_os" in
-	linux*)
+	linux*|uclinux*)
 		AC_CHECK_HEADER(libusb-1.0/libusb.h,
 		[
-		    AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb])
-		    CANUSB_SRC=pcap-canusb-linux.c
-		    LIBS="-lusb-1.0 -lpthread $LIBS"
-		    AC_MSG_NOTICE(canusb sniffing is supported)
+		    AC_CHECK_LIB(usb-1.0, libusb_init,
+		    [
+			AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb])
+			CANUSB_SRC=pcap-canusb-linux.c
+			LIBS="-lusb-1.0 -lpthread $LIBS"
+			ac_lbl_has_libusb=yes
+		    ],
+		    ac_lbl_has_libusb=no,
+		    -lpthread
+		    )
 		],
-		AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
+		ac_lbl_has_libusb=no
 		)
+		if test "x$ac_lbl_has_libusb" = "xyes" ; then
+		    AC_MSG_NOTICE(canusb sniffing is supported)
+		else
+		    if test "x$enable_canusb" = "xyes" ; then
+			AC_MSG_ERROR(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
+		    else
+			AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
+		    fi
+		fi
 		;;
 	*)
-		AC_MSG_NOTICE(no canusb support implemented for $host_os)
+		if test "x$enable_canusb" = "xyes" ; then
+		    AC_MSG_ERROR(no canusb support implemented for $host_os)
+		else
+		    AC_MSG_NOTICE(no canusb support implemented for $host_os)
+		fi
 		;;
 	esac
 	AC_SUBST(PCAP_SUPPORT_CANUSB)
@@ -1529,22 +1604,34 @@
 AC_ARG_ENABLE([can],
 [AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])],
     [],
-    [enable_can=yes])
+    [enable_can=ifsupportavailable])
 
 if test "x$enable_can" != "xno" ; then
 	dnl check for CAN sniffing support
 	case "$host_os" in
 	linux*)
 		AC_CHECK_HEADER(linux/can.h,
-			[ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
-			CAN_SRC=pcap-can-linux.c
-			AC_MSG_NOTICE(CAN sniffing is supported)],
-			AC_MSG_NOTICE(CAN sniffing is not supported),
+			[
+			    AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
+			    CAN_SRC=pcap-can-linux.c
+			    AC_MSG_NOTICE(CAN sniffing is supported)
+			],
+			[
+			    if test "x$enable_can" = "xyes" ; then
+				AC_MSG_ERROR(CAN sniffing is not supported)
+			    else
+				AC_MSG_NOTICE(CAN sniffing is not supported)
+			    fi
+			],
 			[#include <sys/socket.h>]
 		   )
 		;;
 	*)
-		AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
+		if test "x$enable_can" = "xyes" ; then
+		    AC_MSG_ERROR(no CAN sniffing support implemented for $host_os)
+		else
+		    AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
+		fi
 		;;
 	esac
 	AC_SUBST(PCAP_SUPPORT_CAN)
@@ -1562,65 +1649,74 @@
 
 		darwin*)
 			#
+			# We don't support D-Bus sniffing on OS X; see
+			#
 			# https://bugs.freedesktop.org/show_bug.cgi?id=74029
 			#
+			# The user requested it, so fail.
+			#
 			AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on OS X])
-			;;
 		esac
-	else		
+	else
 		case "$host_os" in
 
 		darwin*)
 			#
+			# We don't support D-Bus sniffing on OS X; see
+			#
 			# https://bugs.freedesktop.org/show_bug.cgi?id=74029
 			#
+			# The user dind't explicitly request it, so just
+			# silently refuse to enable it.
+			#
+			enable_dbus="no"
 			;;
-
-		*)
-			AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
-			if test "x$PKGCONFIG" != "xno"; then
-				AC_MSG_CHECKING([for D-Bus])
-				if "$PKGCONFIG" dbus-1; then
-					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])
-						DBUS_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_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])
-					fi
-				fi
-			fi
-			;;	
 		esac
 	fi
+fi
+
+if test "x$enable_dbus" != "xno"; then
+	AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
+	if test "x$PKGCONFIG" != "xno"; then
+		AC_MSG_CHECKING([for D-Bus])
+		if "$PKGCONFIG" dbus-1; then
+			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])
+				DBUS_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_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])
+			fi
+		fi
+	fi
 	AC_SUBST(PCAP_SUPPORT_DBUS)
 	AC_SUBST(DBUS_SRC)
 fi
@@ -1635,6 +1731,24 @@
 	;;
 esac
 
+dnl The packet ring capture facility of Linux, described in
+dnl Documentation/networking/packet_mmap.txt, is not 32/64-bit compatible before
+dnl version 2.6.27. A 32-bit kernel requires a 32-bit userland, and likewise for
+dnl 64-bit. The effect of this is that a 32-bit libpcap binary will not run
+dnl correctly on a 64-bit kernel (the binary will use the wrong offsets into a
+dnl kernel struct). This problem was solved in Linux 2.6.27. Use
+dnl --disable-packet-ring whenever a 32-bit application must run on a 64-bit
+dnl target host, and either the build host or the target host run Linux 2.6.26
+dnl or earlier.
+AC_ARG_ENABLE([packet-ring],
+[AC_HELP_STRING([--enable-packet-ring],[enable Linux packet ring support @<:@default=yes@:>@])],
+,enable_packet_ring=yes)
+
+if test "x$enable_packet_ring" != "xno" ; then
+	AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use Linux packet ring capture if available])
+	AC_SUBST(PCAP_SUPPORT_PACKET_RING)
+fi
+
 AC_PROG_INSTALL
 
 AC_CONFIG_HEADER(config.h)
diff --git a/dlpisubs.c b/dlpisubs.c
index 671302f..131fa27 100644
--- a/dlpisubs.c
+++ b/dlpisubs.c
@@ -10,10 +10,6 @@
  * This file contains dlpi/libdlpi related common functions used
  * by pcap-[dlpi,libdlpi].c.
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-	"@(#) $Header: /tcpdump/master/libpcap/dlpisubs.c,v 1.3 2008-12-02 16:40:19 guy Exp $ (LBL)";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/dlpisubs.h b/dlpisubs.h
index 858bca3..cdc531c 100644
--- a/dlpisubs.h
+++ b/dlpisubs.h
@@ -1,7 +1,3 @@
-/*
- * @(#) $Header: /tcpdump/master/libpcap/dlpisubs.h,v 1.2 2008-04-04 19:37:45 guy Exp $
- */
-
 #ifndef dlpisubs_h
 #define	dlpisubs_h
 
diff --git a/doc/pcap.html b/doc/pcap.html
deleted file mode 100644
index 94e3514..0000000
--- a/doc/pcap.html
+++ /dev/null
@@ -1,997 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en"><head><title>PCAP New Generation Dump File Format</title>
-<meta name="description" content="PCAP New Generation Dump File Format">
-<meta name="keywords" content="Internet-Draft, Libpcap, dump file format">
-<meta name="generator" content="xml2rfc v1.22 (http://xml.resource.org/)">
-<style type='text/css'>
-<!--
-    body {
-        font-family: verdana, charcoal, helvetica, arial, sans-serif;
-        font-size: small ; color: #000000 ; background-color: #ffffff ; }
-    .title { color: #990000; font-size: x-large ;
-        font-weight: bold; text-align: right;
-        font-family: helvetica, monaco, "MS Sans Serif", arial, sans-serif;
-        background-color: transparent; }
-    .filename { color: #666666; font-size: 18px; line-height: 28px;
-        font-weight: bold; text-align: right;
-        font-family: helvetica, arial, sans-serif;
-        background-color: transparent; }
-    td.rfcbug { background-color: #000000 ; width: 30px ; height: 30px ; 
-        text-align: justify; vertical-align: middle ; padding-top: 2px ; }
-    td.rfcbug span.RFC { color: #666666; font-weight: bold; text-decoration: none;
-        background-color: #000000 ;
-        font-family: monaco, charcoal, geneva, "MS Sans Serif", helvetica, verdana, sans-serif;
-        font-size: x-small ; }
-    td.rfcbug span.hotText { color: #ffffff; font-weight: normal; text-decoration: none;
-        text-align: center ;
-        font-family: charcoal, monaco, geneva, "MS Sans Serif", helvetica, verdana, sans-serif;
-        font-size: x-small ; background-color: #000000; }
-
-     A { font-weight: bold; }
-     A:link { color: #990000; background-color: transparent ; }
-     A:visited { color: #333333; background-color: transparent ; }
-     A:active { color: #333333; background-color: transparent ; }
-
-    p { margin-left: 2em; margin-right: 2em; }
-    p.copyright { font-size: x-small ; }
-    p.toc { font-size: small ; font-weight: bold ; margin-left: 3em ;}
-
-    span.emph { font-style: italic; }
-    span.strong { font-weight: bold; }
-    span.verb { font-family: "Courier New", Courier, monospace ; }
-
-    ol.text { margin-left: 2em; margin-right: 2em; }
-    ul.text { margin-left: 2em; margin-right: 2em; }
-    li { margin-left: 3em;  }
-
-    pre { margin-left: 3em; color: #333333;  background-color: transparent;
-        font-family: "Courier New", Courier, monospace ; font-size: small ;
-        }
-
-    h3 { color: #333333; font-size: medium ;
-        font-family: helvetica, arial, sans-serif ;
-        background-color: transparent; }
-    h4 { font-size: small; font-family: helvetica, arial, sans-serif ; }
-
-    table.bug { width: 30px ; height: 15px ; }
-    td.bug { color: #ffffff ; background-color: #990000 ;
-        text-align: center ; width: 30px ; height: 15px ;
-         }
-    td.bug A.link2 { color: #ffffff ; font-weight: bold;
-        text-decoration: none;
-        font-family: monaco, charcoal, geneva, "MS Sans Serif", helvetica, sans-serif;
-        font-size: x-small ; background-color: transparent }
-
-    td.header { color: #ffffff; font-size: x-small ;
-        font-family: arial, helvetica, sans-serif; vertical-align: top;
-        background-color: #666666 ; width: 33% ; }
-    td.author { font-weight: bold; margin-left: 4em; font-size: x-small ; }
-    td.author-text { font-size: x-small; }
-    table.data { vertical-align: top ; border-collapse: collapse ;
-        border-style: solid solid solid solid ;
-        border-color: black black black black ;
-        font-size: small ; text-align: center ; }
-    table.data th { font-weight: bold ;
-        border-style: solid solid solid solid ;
-        border-color: black black black black ; }
-    table.data td {
-        border-style: solid solid solid solid ;
-        border-color: #333333 #333333 #333333 #333333 ; }
-
-    hr { height: 1px }
--->
-</style>
-</head>
-<body>
-<table summary="layout" cellpadding="0" cellspacing="2" class="bug" align="right"><tr><td class="bug"><a href="#toc" class="link2">&nbsp;TOC&nbsp;</a></td></tr></table>
-<table summary="layout" width="66%" border="0" cellpadding="0" cellspacing="0"><tr><td><table summary="layout" width="100%" border="0" cellpadding="2" cellspacing="1">
-<tr><td class="header">Network Working Group</td><td class="header">L. Degioanni</td></tr>
-<tr><td class="header">Internet-Draft</td><td class="header">F. Risso</td></tr>
-<tr><td class="header">Expires: August 30, 2004</td><td class="header">Politecnico di Torino</td></tr>
-<tr><td class="header">&nbsp;</td><td class="header">March 2004</td></tr>
-</table></td></tr></table>
-<div align="right"><span class="title"><br />PCAP New Generation Dump File Format</span></div>
-<div align="right"><span class="title"><br />pcap</span></div>
-
-<h3>Status of this Memo</h3>
-<p>
-This document is an Internet-Draft and is
-in full conformance with all provisions of Section 10 of RFC2026.</p>
-<p>
-Internet-Drafts are working documents of the Internet Engineering
-Task Force (IETF), its areas, and its working groups.
-Note that other groups may also distribute working documents as
-Internet-Drafts.</p>
-<p>
-Internet-Drafts are draft documents valid for a maximum of six months
-and may be updated, replaced, or obsoleted by other documents at any time.
-It is inappropriate to use Internet-Drafts as reference material or to cite
-them other than as "work in progress."</p>
-<p>
-The list of current Internet-Drafts can be accessed at
-<a href='http://www.ietf.org/ietf/1id-abstracts.txt'>http://www.ietf.org/ietf/1id-abstracts.txt</a>.</p>
-<p>
-The list of Internet-Draft Shadow Directories can be accessed at
-<a href='http://www.ietf.org/shadow.html'>http://www.ietf.org/shadow.html</a>.</p>
-<p>
-This Internet-Draft will expire on August 30, 2004.</p>
-
-<h3>Copyright Notice</h3>
-<p>
-Copyright (C) The Internet Society (2004). All Rights Reserved.</p>
-
-<h3>Abstract</h3>
-
-<p>This document describes a format to dump captured packets on a file. This format is extensible and it is currently proposed for implementation in the libpcap/WinPcap packet capture library.
-</p><a name="toc"></a><br /><hr />
-<h3>Table of Contents</h3>
-<p class="toc">
-<a href="#anchor1">1.</a>&nbsp;
-Objectives<br />
-<a href="#anchor2">2.</a>&nbsp;
-General File Structure<br />
-<a href="#sectionblock">2.1</a>&nbsp;
-General Block Structure<br />
-<a href="#anchor3">2.2</a>&nbsp;
-Block Types<br />
-<a href="#anchor4">2.3</a>&nbsp;
-Block Hierarchy and Precedence<br />
-<a href="#anchor5">2.4</a>&nbsp;
-Data format<br />
-<a href="#anchor6">3.</a>&nbsp;
-Block Definition<br />
-<a href="#sectionshb">3.1</a>&nbsp;
-Section Header Block (mandatory)<br />
-<a href="#sectionidb">3.2</a>&nbsp;
-Interface Description Block (mandatory)<br />
-<a href="#sectionpb">3.3</a>&nbsp;
-Packet Block (optional)<br />
-<a href="#anchor7">3.4</a>&nbsp;
-Simple Packet Block (optional)<br />
-<a href="#anchor8">3.5</a>&nbsp;
-Name Resolution Block (optional)<br />
-<a href="#anchor9">3.6</a>&nbsp;
-Interface Statistics Block (optional)<br />
-<a href="#sectionopt">4.</a>&nbsp;
-Options<br />
-<a href="#anchor10">5.</a>&nbsp;
-Experimental Blocks (deserved to a further investigation)<br />
-<a href="#anchor11">5.1</a>&nbsp;
-Other Packet Blocks (experimental)<br />
-<a href="#anchor12">5.2</a>&nbsp;
-Compression Block (experimental)<br />
-<a href="#anchor13">5.3</a>&nbsp;
-Encryption Block (experimental)<br />
-<a href="#anchor14">5.4</a>&nbsp;
-Fixed Length Block (experimental)<br />
-<a href="#anchor15">5.5</a>&nbsp;
-Directory Block (experimental)<br />
-<a href="#anchor16">5.6</a>&nbsp;
-Traffic Statistics and Monitoring Blocks (experimental)<br />
-<a href="#anchor17">5.7</a>&nbsp;
-Event/Security Block (experimental)<br />
-<a href="#anchor18">6.</a>&nbsp;
-Conclusions<br />
-<a href="#anchor19">7.</a>&nbsp;
-Most important open issues<br />
-<a href="#rfc.copyright">&#167;</a>&nbsp;
-Intellectual Property and Copyright Statements<br />
-</p>
-<br clear="all" />
-
-<a name="anchor1"></a><br /><hr />
-<table summary="layout" cellpadding="0" cellspacing="2" class="bug" align="right"><tr><td class="bug"><a href="#toc" class="link2">&nbsp;TOC&nbsp;</a></td></tr></table>
-<a name="rfc.section.1"></a><h3>1.&nbsp;Objectives</h3>
-
-<p>The problem of exchanging packet traces becomes more and more critical every day; unfortunately, no standard solutions exist for this task right now. One of the most accepted packet interchange formats is the one defined by libpcap, which is rather old and does not fit for some of the nowadays applications especially in terms of extensibility.
-</p>
-<p>This document proposes a new format for dumping packet traces. The following goals are being pursued:
-</p>
-<ul class="text">
-<li>Extensibility: aside of some common functionalities, third parties should be able to enrich the information embedded in the file with proprietary extensions, which will be ignored by tools that are not able to understand them.
-</li>
-<li>Portability: a capture trace must contain all the information needed to read data independently from network, hardware and operating system of the machine that made the capture.
-</li>
-<li>Merge/Append data: it should be possible to add data at the end of a given file, and the resulting file must still be readable.
-</li>
-</ul>
-<a name="anchor2"></a><br /><hr />
-<table summary="layout" cellpadding="0" cellspacing="2" class="bug" align="right"><tr><td class="bug"><a href="#toc" class="link2">&nbsp;TOC&nbsp;</a></td></tr></table>
-<a name="rfc.section.2"></a><h3>2.&nbsp;General File Structure</h3>
-
-<a name="rfc.section.2.1"></a><h4><a name="sectionblock">2.1</a>&nbsp;General Block Structure</h4>
-
-<p>A capture file is organized in blocks, that are appended one to another to form the file. All the blocks share a common format, which is shown in <a href="#formatblock">Figure 1</a>.
-</p><br /><hr />
-<a name="formatblock"></a>
-<pre>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                          Block Type                           |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                      Block Total Length                       |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                          Block Body                           /
-   /          /* variable length, aligned to 32 bits */            /
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                      Block Total Length                       |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-</pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;Basic block structure.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>The fields have the following meaning:
-</p>
-<ul class="text">
-<li>Block Type (32 bits): unique value that identifies the block. Values whose Most Significant Bit (MSB) is equal to 1 are reserved for local use. They allow to save private data to the file and to extend the file format.
-</li>
-<li>Block Total Length: total size of this block, in bytes. For instance, a block that does not have a body has a length of 12 bytes.
-</li>
-<li>Block Body: content of the block.
-</li>
-<li>Block Total Length: total size of this block, in bytes. This field is duplicated for permitting backward file navigation.
-</li>
-</ul>
-<p>This structure, shared among all blocks, makes easy to process a file and to skip unneeded or unknown blocks. Blocks can be nested one inside the others (NOTE: needed?). Some of the blocks are mandatory, i.e. a dump file is not valid if they are not present, other are optional.
-</p>
-<p>The structure of the blocks allows to define other blocks if needed. A parser that does non understand them can simply ignore their content.
-</p>
-<a name="rfc.section.2.2"></a><h4><a name="anchor3">2.2</a>&nbsp;Block Types</h4>
-
-<p>The currently defined blocks are the following:
-</p>
-<ol class="text">
-<li>Section Header Block: it defines the most important characteristics of the capture file.
-</li>
-<li>Interface Description Block: it defines the most important characteristics of the interface(s) used for capturing traffic.
-</li>
-<li>Packet Block: it contains a single captured packet, or a portion of it.
-</li>
-<li>Simple Packet Block: it contains a single captured packet, or a portion of it, with only a minimal set of information about it.
-</li>
-<li>Name Resolution Block: it defines the mapping from numeric addresses present in the packet dump and the canonical name counterpart.
-</li>
-<li>Capture Statistics Block: it defines how to store some statistical data (e.g. packet dropped, etc) which can be useful to undestand the conditions in which the capture has been made.
-</li>
-<li>Compression Marker Block: TODO
-</li>
-<li>Encryption Marker Block: TODO
-</li>
-<li>Fixed Length Marker Block: TODO
-</li>
-</ol>
-<p>The following blocks instead are considered interesting but the authors believe that they deserve more in-depth discussion before being defined:
-</p>
-<ol class="text">
-<li>Further Packet Blocks
-</li>
-<li>Directory Block
-</li>
-<li>Traffic Statistics and Monitoring Blocks
-</li>
-<li>Alert and Security Blocks
-</li>
-</ol>
-<p>TODO Currently standardized Block Type codes are specified in Appendix 1.
-</p>
-<a name="rfc.section.2.3"></a><h4><a name="anchor4">2.3</a>&nbsp;Block Hierarchy and Precedence</h4>
-
-<p>The file must begin with a Section Header Block. However, more than one Section Header Block can be present on the dump, each one covering the data following it till the next one (or the end of file). A Section includes the data delimited by two Section Header Blocks (or by a Section Header Block and the end of the file), including the first Section Header Block.
-</p>
-<p>In case an application cannot read a Section because of different version number, it must skip everything until the next Section Header Block. Note that, in order to properly skip the blocks until the next section, all blocks must have the fields Type and Length at the beginning. This is a mandatory requirement that must be maintained in future versions of the block format.
-</p>
-<p><a href="#fssample-SHB">Figure 2</a> shows two valid files: the first has a typical configuration, with a single Section Header that covers the whole file. The second one contains three headers, and is normally the result of file concatenation. An application that understands only version 1.0 of the file format skips the intermediate section and restart processing the packets after the third Section Header.
-</p><br /><hr />
-<a name="fssample-SHB"></a>
-<pre>
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   | SHB v1.0  |                      Data                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   Typical configuration with a single Section Header Block 
-
-
-   |--   1st Section   --|--   2nd Section   --|--  3rd Section  --|
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   | SHB v1.0  |  Data   | SHB V1.1  |  Data   | SHB V1.0  |  Data |  
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   Configuration with three different Section Header Blocks
-</pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;File structure example: the Section Header Block.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>NOTE: TO BE COMPLETED with some examples of other blocks
-</p>
-<a name="rfc.section.2.4"></a><h4><a name="anchor5">2.4</a>&nbsp;Data format</h4>
-
-<p>Data contained in each section will always be saved according to the characteristics (little endian / big endian) of the dumping machine. This refers to all fields that are saved as numbers and that span over two or more bytes.
-</p>
-<p>The approach of having each section saved in the native format of the generating host is more efficient because it avoids translation of data when reading / writing on the host itself, which is the most common case when generating/processing capture dumps.
-</p>
-<p>TODO Probably we have to specify something more here. Is what we're saying enough to avoid any kind of ambiguity?.
-</p>
-<a name="anchor6"></a><br /><hr />
-<table summary="layout" cellpadding="0" cellspacing="2" class="bug" align="right"><tr><td class="bug"><a href="#toc" class="link2">&nbsp;TOC&nbsp;</a></td></tr></table>
-<a name="rfc.section.3"></a><h3>3.&nbsp;Block Definition</h3>
-
-<p>This section details the format of the body of the blocks currently defined.
-</p>
-<a name="rfc.section.3.1"></a><h4><a name="sectionshb">3.1</a>&nbsp;Section Header Block (mandatory)</h4>
-
-<p>The Section Header Block is mandatory. It identifies the beginning of a section of the capture dump file. Its format is shown in <a href="#formatSHB">Figure 3</a>.
-</p><br /><hr />
-<a name="formatSHB"></a>
-<pre>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                            Magic                              |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |              Major            |             Minor             |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-</pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;Section Header Block format.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>The meaning of the fields is:
-</p>
-<ul class="text">
-<li>Magic: magic number, whose value is the hexadecimal number 0x1A2B3C4D. This number can be used to distinguish section that have been saved on little-endian machines from the one saved on big-endian machines.
-</li>
-<li>Major: number of the current mayor version of the format. Current value is 1.
-</li>
-<li>Minor: number of the current minor version of the format. Current value is 0.
-</li>
-<li>Options: optionally, a list of options (formatted according to the rules defined in <a href="#sectionopt">Section 4</a>) can be present.
-</li>
-</ul>
-<p>Aside form the options defined in <a href="#sectionopt">Section 4</a>, the following options are valid within this block:
-</p><a name="InterfaceOptions1"></a>
-<table class="data" align="center" border="1" cellpadding="2" cellspacing="2">
-<tr>
-<th align="left" width="25%">Name</th>
-<th align="left" width="25%">Code</th>
-<th align="left" width="25%">Length</th>
-<th align="left" width="25%">Description</th>
-</tr>
-<tr>
-<td align="left">Hardware</td>
-<td align="left">2</td>
-<td align="left">variable</td>
-<td align="left">An ascii string containing the description of the hardware used to create this section.</td>
-</tr>
-<tr>
-<td align="left">Operating System</td>
-<td align="left">3</td>
-<td align="left">variable</td>
-<td align="left">An ascii string containing the name of the operating system used to create this section.</td>
-</tr>
-<tr>
-<td align="left">User Application</td>
-<td align="left">3</td>
-<td align="left">variable</td>
-<td align="left">An ascii string containing the name of the application used to create this section.</td>
-</tr>
-</table>
-
-<p>The Section Header Block does not contain data but it rather identifies a list of blocks (interfaces, packets) that are logically correlated. This block does not contain any reference to the size of the section it is currently delimiting, therefore the reader cannot skip a whole section at once. In case a section must be skipped, the user has to repeatedly skip all the blocks contained within it; this makes the parsing of the file slower but it permits to append several capture dumps at the same file.
-</p>
-<a name="rfc.section.3.2"></a><h4><a name="sectionidb">3.2</a>&nbsp;Interface Description Block (mandatory)</h4>
-
-<p>The Interface Description Block is mandatory. This block is needed to specify the characteristics of the network interface on which the capture has been made. In order to properly associate the captured data to the corresponding interface, the Interface Description Block must be defined before any other block that uses it; therefore, this block is usually placed immediately after the Section Header Block.
-</p>
-<p>An Interface Description Block is valid only inside the section which it belongs to. The structure of a Interface Description Block is shown in <a href="#formatidb">Figure 4</a>.
-</p><br /><hr />
-<a name="formatidb"></a>
-<pre>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |          Interface ID         |           LinkType            |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                            SnapLen                            |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;Interface Description Block format.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>The meaning of the fields is:
-</p>
-<ul class="text">
-<li>Interface ID: a progressive number that identifies uniquely any interface inside current section. Two Interface Description Blocks can have the same Interface ID only if they are in different sections of the file. The Interface ID is referenced by the packet blocks.
-</li>
-<li>LinkType: a value that defines the link layer type of this interface.
-</li>
-<li>SnapLen: maximum number of bytes dumped from each packet. The portion of each packet that exceeds this value will not be stored in the file.
-</li>
-<li>Options: optionally, a list of options (formatted according to the rules defined in <a href="#sectionopt">Section 4</a>) can be present.
-</li>
-</ul>
-<p>In addition to the options defined in <a href="#sectionopt">Section 4</a>, the following options are valid within this block:
-</p><a name="InterfaceOptions2"></a>
-<table class="data" align="center" border="1" cellpadding="2" cellspacing="2">
-<tr>
-<th align="left" width="25%">Name</th>
-<th align="left" width="25%">Code</th>
-<th align="left" width="25%">Length</th>
-<th align="left" width="25%">Description</th>
-</tr>
-<tr>
-<td align="left">if_name</td>
-<td align="left">2</td>
-<td align="left">Variable</td>
-<td align="left">Name of the device used to capture data.</td>
-</tr>
-<tr>
-<td align="left">if_IPv4addr</td>
-<td align="left">3</td>
-<td align="left">8</td>
-<td align="left">Interface network address and netmask.</td>
-</tr>
-<tr>
-<td align="left">if_IPv6addr</td>
-<td align="left">4</td>
-<td align="left">17</td>
-<td align="left">Interface network address and prefix length (stored in the last byte).</td>
-</tr>
-<tr>
-<td align="left">if_MACaddr</td>
-<td align="left">5</td>
-<td align="left">6</td>
-<td align="left">Interface Hardware MAC address (48 bits).</td>
-</tr>
-<tr>
-<td align="left">if_EUIaddr</td>
-<td align="left">6</td>
-<td align="left">8</td>
-<td align="left">Interface Hardware EUI address (64 bits), if available.</td>
-</tr>
-<tr>
-<td align="left">if_speed</td>
-<td align="left">7</td>
-<td align="left">8</td>
-<td align="left">Interface speed (in bps).</td>
-</tr>
-<tr>
-<td align="left">if_tsaccur</td>
-<td align="left">8</td>
-<td align="left">1</td>
-<td align="left">Precision of timestamps. If the Most Significant Bit is equal to zero, the remaining bits indicates the accuracy as as a negative power of 10 (e.g. 6 means microsecond accuracy). If the Most Significant Bit is equal to zero, the remaining bits indicates the accuracy as as negative power of 2 (e.g. 10 means 1/1024 of second). If this option is not present, a precision of 10^-6 is assumed.</td>
-</tr>
-<tr>
-<td align="left">if_tzone</td>
-<td align="left">9</td>
-<td align="left">4</td>
-<td align="left">Time zone for GMT support (TODO: specify better).</td>
-</tr>
-<tr>
-<td align="left">if_flags</td>
-<td align="left">10</td>
-<td align="left">4</td>
-<td align="left">Interface flags. (TODO: specify better. Possible flags: promiscuous, inbound/outbound, traffic filtered during capture).</td>
-</tr>
-<tr>
-<td align="left">if_filter</td>
-<td align="left">11</td>
-<td align="left">variable</td>
-<td align="left">The filter (e.g. "capture only TCP traffic") used to capture traffic. The first byte of the Option Data keeps a code of the filter used (e.g. if this is a libpcap string, or BPF bytecode, and more). More details about this format will be presented in Appendix XXX (TODO).</td>
-</tr>
-<tr>
-<td align="left">if_opersystem</td>
-<td align="left">12</td>
-<td align="left">variable</td>
-<td align="left">An ascii string containing the name of the operating system of the machine that hosts this interface. This can be different from the same information that can be contained by the Section Header Block (<a href="#sectionshb">Section 3.1</a>) because the capture can have been done on a remote machine.</td>
-</tr>
-</table>
-
-<a name="rfc.section.3.3"></a><h4><a name="sectionpb">3.3</a>&nbsp;Packet Block (optional)</h4>
-
-<p>A Packet Block is the standard container for storing the packets coming from the network. The Packet Block is optional because packets can be stored either by means of this block or the Simple Packet Block, which can be used to speed up dump generation. The format of a packet block is shown in <a href="#formatpb">Figure 5</a>.
-</p><br /><hr />
-<a name="formatpb"></a>
-<pre>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |         Interface ID          |          Drops Count          |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                        Timestamp (High)                       |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                        Timestamp (Low)                        |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         Captured Len                          |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                          Packet Len                           |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                                                               |
-   |                          Packet Data                          |
-   |                                                               |
-   |              /* variable length, byte-aligned */              |
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-</pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;Packet Block format.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>The Packet Block has the following fields:
-</p>
-<ul class="text">
-<li>Interface ID: Specifies the interface this packet comes from, and corresponds to the ID of one of the Interface Description Blocks present in this section of the file (see <a href="#formatidb">Figure 4</a>).
-</li>
-<li>Drops Count: a local drop counter. It specified the number of packets lost (by the interface and the operating system) between this packet and the preceding one. The value xFFFF (in hexadecimal) is reserved for those systems in which this information is not available.
-</li>
-<li>Timestamp (High): the most significative part of the timestamp. in standard Unix format, i.e. from 1/1/1970.
-</li>
-<li>Timestamp (Low): the less significative part of the timestamp. The way to interpret this field is specified by the 'ts_accur' option (see <a href="#formatidb">Figure 4</a>) of the Interface Description block referenced by this packet. If the Interface Description block does not contain a 'ts_accur' option, then this field is expressed in microseconds.
-</li>
-<li>Captured Len: number of bytes captured from the packet (i.e. the length of the Packet Data field). It will be the minimum value among the actual Packet Length and the snapshot length (defined in <a href="#formatidb">Figure 4</a>).
-</li>
-<li>Packet Len: actual length of the packet when it was transmitted on the network. Can be different from Captured Len if the user wants only a snapshot of the packet.
-</li>
-<li>Packet Data: the data coming from the network, including link-layer headers. The length of this field is Captured Len. The format of the link-layer headers depends on the LinkType field specified in the Interface Description Block (see <a href="#sectionidb">Section 3.2</a>) and it is specified in Appendix XXX (TODO).
-</li>
-<li>Options: optionally, a list of options (formatted according to the rules defined in <a href="#sectionopt">Section 4</a>) can be present.
-</li>
-</ul>
-<p>
-</p>
-<a name="rfc.section.3.4"></a><h4><a name="anchor7">3.4</a>&nbsp;Simple Packet Block (optional)</h4>
-
-<p>The Simple Packet Block is a lightweight container for storing the packets coming from the network. Its presence is optional.
-</p>
-<p>A Simple Packet Block is similar to a Packet Block (see <a href="#sectionpb">Section 3.3</a>), but it is smaller, simpler to process and contains only a minimal set of information. This block is preferred to the standard Packet Block when performance or space occupation are critical factors, such as in sustained traffic dump applications. A capture file can contain both Packet Blocks and Simple Packet Blocks: for example, a capture tool could switch from Packet Blocks to Simple Packet Blocks when the hardware resources become critical.
-</p>
-<p>The Simple Packet Block does not contain the Interface ID field. Therefore, it must be assumed that all the Simple Packet Blocks have been captured on the interface previously specified in the Interface Description Block.
-</p>
-<p><a href="#formatpbs">Figure 6</a> shows the format of the Simple Packet Block.
-</p><br /><hr />
-<a name="formatpbs"></a>
-<pre>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                          Packet Len                           |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                                                               |
-   |                          Packet Data                          |
-   |                                                               |
-   |              /* variable length, byte-aligned */              |
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;Simple Packet Block format.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>The Packet Block has the following fields:
-</p>
-<ul class="text">
-<li>Packet Len: actual length of the packet when it was transmitted on the network. Can be different from captured len if the packet has been truncated.
-</li>
-<li>Packet data: the data coming from the network, including link-layers headers. The length of this field can be derived from the field Block Total Length, present in the Block Header.
-</li>
-</ul>
-<p>The Simple Packet Block does not contain the timestamp because this is one of the most costly operations on PCs. Additionally, there are applications that do not require it; e.g. an Intrusion Detection System is interested in packets, not in their timestamp.
-</p>
-<p>The Simple Packet Block is very efficient in term of disk space: a snapshot of length 100 bytes requires only 16 bytes of overhead, which corresponds to an efficiency of more than 86%.
-</p>
-<a name="rfc.section.3.5"></a><h4><a name="anchor8">3.5</a>&nbsp;Name Resolution Block (optional)</h4>
-
-<p>The Name Resolution Block is used to support the correlation of numeric addresses (present in the captured packets) and their corresponding canonical names and it is optional. Having the literal names saved in the file, this prevents the need of a name resolution in a delayed time, when the association between names and addresses can be different from the one in use at capture time. Moreover, The Name Resolution Block avoids the need of issuing a lot of DNS requests every time the trace capture is opened, and allows to have name resolution also when reading the capture with a machine not connected to the network.
-</p>
-<p>The format of the Name Resolution Block is shown in <a href="#formatnrb">Figure 7</a>.
-</p><br /><hr />
-<a name="formatnrb"></a>
-<pre>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |      Record Type              |         Record Length         | 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                       Record Value                            |
-   |              /* variable length, byte-aligned */              |
-   |               + + + + + + + + + + + + + + + + + + + + + + + + +
-   |               |               |               |               |
-   +-+-+-+-+-+-+-+-+ + + + + + + + + + + + + + + + + + + + + + + + +
-             . . . other records . . .
-   |  Record Type == end_of_recs   |  Record Length == 00          |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;Name Resolution Block format.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>A Name Resolution Block is a zero-terminated list of records (in the TLV format), each of which contains an association between a network address and a name. There are three possible types of records:
-</p><a name="nrrecords"></a>
-<table class="data" align="center" border="1" cellpadding="2" cellspacing="2">
-<tr>
-<th align="left" width="25%">Name</th>
-<th align="left" width="25%">Code</th>
-<th align="left" width="25%">Length</th>
-<th align="left" width="25%">Description</th>
-</tr>
-<tr>
-<td align="left">end_of_recs</td>
-<td align="left">0</td>
-<td align="left">0</td>
-<td align="left">End of records</td>
-</tr>
-<tr>
-<td align="left">ip4_rec</td>
-<td align="left">1</td>
-<td align="left">Variable</td>
-<td align="left">Specifies an IPv4 address (contained in the first 4 bytes), followed by one or more zero-terminated strings containing the DNS entries for that address.</td>
-</tr>
-<tr>
-<td align="left">ip6_rec</td>
-<td align="left">1</td>
-<td align="left">Variable</td>
-<td align="left">Specifies an IPv6 address (contained in the first 16 bytes), followed by one or more zero-terminated strings containing the DNS entries for that address.</td>
-</tr>
-</table>
-
-<p>After the list or Name Resolution Records, optionally, a list of options (formatted according to the rules defined in <a href="#sectionopt">Section 4</a>) can be present.
-</p>
-<p>A Name Resolution Block is normally placed at the beginning of the file, but no assumptions can be taken about its position. Name Resolution Blocks can be added in a second time by tools that process the file, like network analyzers.
-</p>
-<p>In addiction to the options defined in <a href="#sectionopt">Section 4</a>, the following options are valid within this block:
-</p><table class="data" align="center" border="1" cellpadding="2" cellspacing="2">
-<tr>
-<th align="left" width="25%">Name</th>
-<th align="left" width="25%">Code</th>
-<th align="left" width="25%">Length</th>
-<th align="left" width="25%">Description</th>
-</tr>
-<tr>
-<td align="left">ns_dnsname</td>
-<td align="left">2</td>
-<td align="left">Variable</td>
-<td align="left">An ascii string containing the name of the machine (DNS server) used to perform the name resolution.</td>
-</tr>
-</table>
-
-<a name="rfc.section.3.6"></a><h4><a name="anchor9">3.6</a>&nbsp;Interface Statistics Block (optional)</h4>
-
-<p>The Interface Statistics Block contains the capture statistics for a given interface and it is optional. The statistics are referred to the interface defined in the current Section identified by the Interface ID field.
-</p>
-<p>The format of the Interface Statistics Block is shown in <a href="#formatisb">Figure 8</a>.
-</p><br /><hr />
-<a name="formatisb"></a>
-<pre>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         IfRecv                                |
-   |                          (high + low)                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         IfDrop                                |
-   |                          (high + low)                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         FilterAccept                          |
-   |                          (high + low)                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         OSDrop                                |
-   |                          (high + low)                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         UsrDelivered                          |
-   |                          (high + low)                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |          Interface ID         |           Reserved            |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;Interface Statistics Block format.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>The fields have the following meaning:
-</p>
-<ul class="text">
-<li>IfRecv: number of packets received from the interface during the capture. This number is reported as a 64 bits value, in which the most significat bits are located in the first four bytes of the field.
-</li>
-<li>IfDrop: number of packets dropped by the interface during the capture due to lack of resources.
-</li>
-<li>FilterAccept: number of packets accepeted by filter during current capture.
-</li>
-<li>OSDrop: number of packets dropped by the operating system during the capture.
-</li>
-<li>UsrDelivered: number of packets delivered to the user. UsrDelivered can be different from the value 'FilterAccept - OSDropped' because some packets could still lay in the OS buffers when the capture ended.
-</li>
-<li>Interface ID: reference to an Interface Description Block.
-</li>
-<li>Reserved: Reserved to future use.
-</li>
-<li>Options: optionally, a list of options (formatted according to the rules defined in <a href="#sectionopt">Section 4</a>) can be present.
-</li>
-</ul>
-<p>In addiction to the options defined in <a href="#sectionopt">Section 4</a>, the following options are valid within this block:
-</p><table class="data" align="center" border="1" cellpadding="2" cellspacing="2">
-<tr>
-<th align="left" width="25%">Name</th>
-<th align="left" width="25%">Code</th>
-<th align="left" width="25%">Length</th>
-<th align="left" width="25%">Description</th>
-</tr>
-<tr>
-<td align="left">isb_starttime</td>
-<td align="left">2</td>
-<td align="left">8</td>
-<td align="left">Time in which the capture started; time will be stored in two blocks of four bytes each, containing the timestamp in seconds and nanoseconds.</td>
-</tr>
-<tr>
-<td align="left">isb_endtime</td>
-<td align="left">3</td>
-<td align="left">8</td>
-<td align="left">Time in which the capture started; time will be stored in two blocks of four bytes each, containing the timestamp in seconds and nanoseconds.</td>
-</tr>
-</table>
-
-<a name="sectionopt"></a><br /><hr />
-<table summary="layout" cellpadding="0" cellspacing="2" class="bug" align="right"><tr><td class="bug"><a href="#toc" class="link2">&nbsp;TOC&nbsp;</a></td></tr></table>
-<a name="rfc.section.4"></a><h3>4.&nbsp;Options</h3>
-
-<p>Almost all blocks have the possibility to embed optional fields. Optional fields can be used to insert some information that may be useful when reading data, but that it is not really needed for packet processing. Therefore, each tool can be either read the content of the optional fields (if any), or skip them at once.
-</p>
-<p>Skipping all the optional fields at once is straightforward because most of the blocks have a fixed length, therefore the field Block Length (present in the General Block Structure, see  <a href="#sectionblock">Section 2.1</a>) can be used to skip everything till the next block.
-</p>
-<p>Options are a list of Type - Length - Value fields, each one containing a single value:
-</p>
-<ul class="text">
-<li>Option Type (2 bytes): it contains the code that specifies the type of the current TLV record. Option types whose Most Significant Bit is equal to one are reserved for local use; therefore, there is no guarantee that the code used is unique among all capture files (generated by other applications). In case of vendor-specific extensions that have to be identified uniquely, vendors must request an Option Code whose MSB is equal to zero.
-</li>
-<li>Option Length (2 bytes): it contains the length of the following 'Option Value' field.
-</li>
-<li>Option Value (variable length): it contains the value of the given option. The length of this field as been specified by the Option Length field.
-</li>
-</ul>
-<p>Options may be repeated several times (e.g. an interface that has several IP addresses associated to it). The option list is terminated by a special code which is the 'End of Option'.
-</p>
-<p>The format of the optional fields is shown in <a href="#formatopt">Figure 9</a>.
-</p><br /><hr />
-<a name="formatopt"></a>
-<pre>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |      Option Code              |         Option Length         | 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                       Option Value                            |
-   |              /* variable length, byte-aligned */              |
-   |               + + + + + + + + + + + + + + + + + + + + + + + + +
-   |               /               /               /               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               /
-   /                 . . . other options . . .                     /
-   /                                                               /
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |   Option Code == opt_endofopt  |  Option Length == 0          |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;Options format.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>The following codes can always be present in any optional field:
-</p><table class="data" align="center" border="1" cellpadding="2" cellspacing="2">
-<tr>
-<th align="left" width="25%">Name</th>
-<th align="left" width="25%">Code</th>
-<th align="left" width="25%">Length</th>
-<th align="left" width="25%">Description</th>
-</tr>
-<tr>
-<td align="left">opt_endofopt</td>
-<td align="left">0</td>
-<td align="left">0</td>
-<td align="left">End of options: it is used to delimit the end of the optional fields. This block cannot be repeated within a given list of options.</td>
-</tr>
-<tr>
-<td align="left">opt_comment</td>
-<td align="left">1</td>
-<td align="left">variable</td>
-<td align="left">Comment: it is an ascii string containing a comment that is associated to the current block.</td>
-</tr>
-</table>
-
-<a name="anchor10"></a><br /><hr />
-<table summary="layout" cellpadding="0" cellspacing="2" class="bug" align="right"><tr><td class="bug"><a href="#toc" class="link2">&nbsp;TOC&nbsp;</a></td></tr></table>
-<a name="rfc.section.5"></a><h3>5.&nbsp;Experimental Blocks (deserved to a further investigation)</h3>
-
-<a name="rfc.section.5.1"></a><h4><a name="anchor11">5.1</a>&nbsp;Other Packet Blocks (experimental)</h4>
-
-<p>Can some other packet blocks (besides the two described in the previous paragraphs) be useful?
-</p>
-<a name="rfc.section.5.2"></a><h4><a name="anchor12">5.2</a>&nbsp;Compression Block (experimental)</h4>
-
-<p>The Compression Block is optional. A file can contain an arbitrary number of these blocks. A Compression Block, as the name says, is used to store compressed data. Its format is shown in <a href="#formatcb">Figure 10</a>.
-</p><br /><hr />
-<a name="formatcb"></a>
-<pre>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |  Compr. Type  |                                               |
-   +-+-+-+-+-+-+-+-+                                               |
-   |                                                               |
-   |                       Compressed Data                         |
-   |                                                               |
-   |              /* variable length, byte-aligned */              |
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;Compression Block format.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>The fields have the following meaning:
-</p>
-<ul class="text">
-<li>Compression Type: specifies the compression algorithm. Possible values for this field are 0 (uncompressed), 1 (Lempel Ziv), 2 (Gzip), other?? Probably some kind of dumb and fast compression algorithm could be effective with some types of traffic (for example web), but which?
-</li>
-<li>Compressed Data: data of this block. Once decompressed, it is made of other blocks.
-</li>
-</ul>
-<a name="rfc.section.5.3"></a><h4><a name="anchor13">5.3</a>&nbsp;Encryption Block (experimental)</h4>
-
-<p>The Encryption Block is optional. A file can contain an arbitrary number of these blocks. An Encryption Block is used to sotre encrypted data. Its format is shown in <a href="#formateb">Figure 11</a>.
-</p><br /><hr />
-<a name="formateb"></a>
-<pre>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |   Encr. Type  |                                               |
-   +-+-+-+-+-+-+-+-+                                               |
-   |                                                               |
-   |                       Compressed Data                         |
-   |                                                               |
-   |              /* variable length, byte-aligned */              |
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;Encryption Block format.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>The fields have the following meaning:
-</p>
-<ul class="text">
-<li>Compression Type: specifies the encryption algorithm. Possible values for this field are ??? NOTE: this block should probably contain other fields, depending on the encryption algorithm. To be define precisely.
-</li>
-<li>Encrypted Data: data of this block. Once decripted, it consists of other blocks.
-</li>
-</ul>
-<a name="rfc.section.5.4"></a><h4><a name="anchor14">5.4</a>&nbsp;Fixed Length Block (experimental)</h4>
-
-<p>The Fixed Length Block is optional. A file can contain an arbitrary number of these blocks. A Fixed Length Block can be used to optimize the access to the file. Its format is shown in <a href="#formatflm">Figure 12</a>.
-A Fixed Length Block stores records with constant size. It contains a set of Blocks (normally Packet Blocks or Simple Packet Blocks), of wihich it specifies the size. Knowing this size a priori helps to scan the file and to load some portions of it without truncating a block, and is particularly useful with cell-based networks like ATM.
-</p><br /><hr />
-<a name="formatflm"></a>
-<pre>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |          Cell Size            |                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
-   |                                                               |
-   |                        Fixed Size Data                        |
-   |                                                               |
-   |              /* variable length, byte-aligned */              |
-   |                                                               |
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </pre>
-<table border="0" cellpadding="0" cellspacing="2" align="center"><tr><td align="center"><font face="monaco, MS Sans Serif" size="1"><b>&nbsp;Fixed Length Block format.&nbsp;</b></font><br /></td></tr></table><hr size="1" shade="0">
-
-<p>The fields have the following meaning:
-</p>
-<ul class="text">
-<li>Cell size: the size of the blocks contained in the data field.
-</li>
-<li>Fixed Size Data: data of this block.
-</li>
-</ul>
-<a name="rfc.section.5.5"></a><h4><a name="anchor15">5.5</a>&nbsp;Directory Block (experimental)</h4>
-
-<p>If present, this block contains the following information:
-</p>
-<ul class="text">
-<li>number of indexed packets (N)
-</li>
-<li>table with position and length of any indexed packet (N entries)
-</li>
-</ul>
-<p>A directory block must be followed by at least N packets, otherwise it must be considered invalid. It can be used to efficiently load portions of the file to memory and to support operations on memory mapped files. This block can be added by tools like network analyzers as a consequence of file processing.
-</p>
-<a name="rfc.section.5.6"></a><h4><a name="anchor16">5.6</a>&nbsp;Traffic Statistics and Monitoring Blocks (experimental)</h4>
-
-<p>One or more blocks could be defined to contain network statistics or traffic monitoring information. They could be use to store data collected from RMON or Netflow probes, or from other network monitoring tools.
-</p>
-<a name="rfc.section.5.7"></a><h4><a name="anchor17">5.7</a>&nbsp;Event/Security Block (experimental)</h4>
-
-<p>This block could be used to store events. Events could contain generic information (for example network load over 50%, server down...) or security alerts. An event could be:
-</p>
-<ul class="text">
-<li>skipped, if the application doesn't know how to do with it
-</li>
-<li>processed independently by the packets. In other words, the applications skips the packets and processes only the alerts
-</li>
-<li>processed in relation to packets: for example, a security tool could load only the packets of the file that are near a security alert; a monitorg tool could skip the packets captured while the server was down.
-</li>
-</ul>
-<a name="anchor18"></a><br /><hr />
-<table summary="layout" cellpadding="0" cellspacing="2" class="bug" align="right"><tr><td class="bug"><a href="#toc" class="link2">&nbsp;TOC&nbsp;</a></td></tr></table>
-<a name="rfc.section.6"></a><h3>6.&nbsp;Conclusions</h3>
-
-<p>The file format proposed in this document should be very versatile and satisfy a wide range of applications.
-In the simplest case, it can contain a raw dump of the network data, made of a series of Simple Packet Blocks.
-In the most complex case, it can be used as a repository for heterogeneous information.
-In every case, the file remains easy to parse and an application can always skip the data it is not interested in; at the same time, different applications can share the file, and each of them can benfit of the information produced by the others.
-Two or more files can be concatenated obtaining another valid file.
-</p>
-<a name="anchor19"></a><br /><hr />
-<table summary="layout" cellpadding="0" cellspacing="2" class="bug" align="right"><tr><td class="bug"><a href="#toc" class="link2">&nbsp;TOC&nbsp;</a></td></tr></table>
-<a name="rfc.section.7"></a><h3>7.&nbsp;Most important open issues</h3>
-
-<ul class="text">
-<li>Data, in the file, must be byte or word aligned? Currently, the structure of this document is not consistent with respect to this point.
-</li>
-</ul><a name="rfc.copyright"></a><br /><hr />
-<table summary="layout" cellpadding="0" cellspacing="2" class="bug" align="right"><tr><td class="bug"><a href="#toc" class="link2">&nbsp;TOC&nbsp;</a></td></tr></table>
-<h3>Intellectual Property Statement</h3>
-<p class='copyright'>
-The IETF takes no position regarding the validity or scope of
-any intellectual property or other rights that might be claimed
-to  pertain to the implementation or use of the technology
-described in this document or the extent to which any license
-under such rights might or might not be available; neither does
-it represent that it has made any effort to identify any such
-rights. Information on the IETF's procedures with respect to
-rights in standards-track and standards-related documentation
-can be found in BCP-11. Copies of claims of rights made
-available for publication and any assurances of licenses to
-be made available, or the result of an attempt made
-to obtain a general license or permission for the use of such
-proprietary rights by implementors or users of this
-specification can be obtained from the IETF Secretariat.</p>
-<p class='copyright'>
-The IETF invites any interested party to bring to its
-attention any copyrights, patents or patent applications, or
-other proprietary rights which may cover technology that may be
-required to practice this standard. Please address the
-information to the IETF Executive Director.</p>
-<h3>Full Copyright Statement</h3>
-<p class='copyright'>
-Copyright (C) The Internet Society (2004). All Rights Reserved.</p>
-<p class='copyright'>
-This document and translations of it may be copied and furnished to
-others, and derivative works that comment on or otherwise explain it
-or assist in its implementation may be prepared, copied, published and
-distributed, in whole or in part, without restriction of any kind,
-provided that the above copyright notice and this paragraph are
-included on all such copies and derivative works. However, this
-document itself may not be modified in any way, such as by removing
-the copyright notice or references to the Internet Society or other
-Internet organizations, except as needed for the purpose of
-developing Internet standards in which case the procedures for
-copyrights defined in the Internet Standards process must be
-followed, or as required to translate it into languages other than
-English.</p>
-<p class='copyright'>
-The limited permissions granted above are perpetual and will not be
-revoked by the Internet Society or its successors or assignees.</p>
-<p class='copyright'>
-This document and the information contained herein is provided on an
-&quot;AS IS&quot; basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
-TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
-BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
-HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.</p>
-<h3>Acknowledgment</h3>
-<p class='copyright'>
-Funding for the RFC Editor function is currently provided by the
-Internet Society.</p>
-</body></html>
diff --git a/doc/pcap.txt b/doc/pcap.txt
deleted file mode 100644
index cfa6645..0000000
--- a/doc/pcap.txt
+++ /dev/null
@@ -1,1680 +0,0 @@
-
-
-Network Working Group                                       L. Degioanni
-Internet-Draft                                                  F. Risso
-Expires: August 30, 2004                           Politecnico di Torino
-                                                              March 2004
-
-
-                  PCAP New Generation Dump File Format
-                                  pcap
-
-Status of this Memo
-
-   This document is an Internet-Draft and is in full conformance with
-   all provisions of Section 10 of RFC2026.
-
-   Internet-Drafts are working documents of the Internet Engineering
-   Task Force (IETF), its areas, and its working groups. Note that other
-   groups may also distribute working documents as Internet-Drafts.
-
-   Internet-Drafts are draft documents valid for a maximum of six months
-   and may be updated, replaced, or obsoleted by other documents at any
-   time. It is inappropriate to use Internet-Drafts as reference
-   material or to cite them other than as "work in progress."
-
-   The list of current Internet-Drafts can be accessed at http://
-   www.ietf.org/ietf/1id-abstracts.txt.
-
-   The list of Internet-Draft Shadow Directories can be accessed at
-   http://www.ietf.org/shadow.html.
-
-   This Internet-Draft will expire on August 30, 2004.
-
-Copyright Notice
-
-   Copyright (C) The Internet Society (2004). All Rights Reserved.
-
-Abstract
-
-   This document describes a format to dump captured packets on a file.
-   This format is extensible and it is currently proposed for
-   implementation in the libpcap/WinPcap packet capture library.
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                 [Page 1]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-Table of Contents
-
-   1.  Objectives . . . . . . . . . . . . . . . . . . . . . . . . . .  3
-   2.  General File Structure . . . . . . . . . . . . . . . . . . . .  4
-   2.1 General Block Structure  . . . . . . . . . . . . . . . . . . .  4
-   2.2 Block Types  . . . . . . . . . . . . . . . . . . . . . . . . .  5
-   2.3 Block Hierarchy and Precedence . . . . . . . . . . . . . . . .  5
-   2.4 Data format  . . . . . . . . . . . . . . . . . . . . . . . . .  6
-   3.  Block Definition . . . . . . . . . . . . . . . . . . . . . . .  8
-   3.1 Section Header Block (mandatory) . . . . . . . . . . . . . . .  8
-   3.2 Interface Description Block (mandatory)  . . . . . . . . . . .  9
-   3.3 Packet Block (optional)  . . . . . . . . . . . . . . . . . . . 13
-   3.4 Simple Packet Block (optional) . . . . . . . . . . . . . . . . 15
-   3.5 Name Resolution Block (optional) . . . . . . . . . . . . . . . 16
-   3.6 Interface Statistics Block (optional)  . . . . . . . . . . . . 18
-   4.  Options  . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
-   5.  Experimental Blocks (deserved to a further investigation)  . . 23
-   5.1 Other Packet Blocks (experimental) . . . . . . . . . . . . . . 23
-   5.2 Compression Block (experimental) . . . . . . . . . . . . . . . 23
-   5.3 Encryption Block (experimental)  . . . . . . . . . . . . . . . 23
-   5.4 Fixed Length Block (experimental)  . . . . . . . . . . . . . . 24
-   5.5 Directory Block (experimental) . . . . . . . . . . . . . . . . 25
-   5.6 Traffic Statistics and Monitoring Blocks (experimental)  . . . 25
-   5.7 Event/Security Block (experimental)  . . . . . . . . . . . . . 25
-   6.  Conclusions  . . . . . . . . . . . . . . . . . . . . . . . . . 27
-   7.  Most important open issues . . . . . . . . . . . . . . . . . . 28
-       Intellectual Property and Copyright Statements . . . . . . . . 29
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                 [Page 2]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-1. Objectives
-
-   The problem of exchanging packet traces becomes more and more
-   critical every day; unfortunately, no standard solutions exist for
-   this task right now. One of the most accepted packet interchange
-   formats is the one defined by libpcap, which is rather old and does
-   not fit for some of the nowadays applications especially in terms of
-   extensibility.
-
-   This document proposes a new format for dumping packet traces. The
-   following goals are being pursued:
-
-   o  Extensibility: aside of some common functionalities, third parties
-      should be able to enrich the information embedded in the file with
-      proprietary extensions, which will be ignored by tools that are
-      not able to understand them.
-
-   o  Portability: a capture trace must contain all the information
-      needed to read data independently from network, hardware and
-      operating system of the machine that made the capture.
-
-   o  Merge/Append data: it should be possible to add data at the end of
-      a given file, and the resulting file must still be readable.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                 [Page 3]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-2. General File Structure
-
-2.1 General Block Structure
-
-   A capture file is organized in blocks, that are appended one to
-   another to form the file. All the blocks share a common format, which
-   is shown in Figure 1.
-
-       0                   1                   2                   3
-       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                          Block Type                           |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                      Block Total Length                       |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      /                          Block Body                           /
-      /          /* variable length, aligned to 32 bits */            /
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                      Block Total Length                       |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-                    Figure 1: Basic block structure.
-
-   The fields have the following meaning:
-
-   o  Block Type (32 bits): unique value that identifies the block.
-      Values whose Most Significant Bit (MSB) is equal to 1 are reserved
-      for local use. They allow to save private data to the file and to
-      extend the file format.
-
-   o  Block Total Length: total size of this block, in bytes. For
-      instance, a block that does not have a body has a length of 12
-      bytes.
-
-   o  Block Body: content of the block.
-
-   o  Block Total Length: total size of this block, in bytes. This field
-      is duplicated for permitting backward file navigation.
-
-   This structure, shared among all blocks, makes easy to process a file
-   and to skip unneeded or unknown blocks. Blocks can be nested one
-   inside the others (NOTE: needed?). Some of the blocks are mandatory,
-   i.e. a dump file is not valid if they are not present, other are
-   optional.
-
-   The structure of the blocks allows to define other blocks if needed.
-   A parser that does non understand them can simply ignore their
-   content.
-
-
-
-Degioanni & Risso       Expires August 30, 2004                 [Page 4]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-2.2 Block Types
-
-   The currently defined blocks are the following:
-
-   1.  Section Header Block: it defines the most important
-       characteristics of the capture file.
-
-   2.  Interface Description Block: it defines the most important
-       characteristics of the interface(s) used for capturing traffic.
-
-   3.  Packet Block: it contains a single captured packet, or a portion
-       of it.
-
-   4.  Simple Packet Block: it contains a single captured packet, or a
-       portion of it, with only a minimal set of information about it.
-
-   5.  Name Resolution Block: it defines the mapping from numeric
-       addresses present in the packet dump and the canonical name
-       counterpart.
-
-   6.  Capture Statistics Block: it defines how to store some
-       statistical data (e.g. packet dropped, etc) which can be useful
-       to undestand the conditions in which the capture has been made.
-
-   7.  Compression Marker Block: TODO
-
-   8.  Encryption Marker Block: TODO
-
-   9.  Fixed Length Marker Block: TODO
-
-   The following blocks instead are considered interesting but the
-   authors believe that they deserve more in-depth discussion before
-   being defined:
-
-   1.  Further Packet Blocks
-
-   2.  Directory Block
-
-   3.  Traffic Statistics and Monitoring Blocks
-
-   4.  Alert and Security Blocks
-
-   TODO Currently standardized Block Type codes are specified in
-   Appendix 1.
-
-2.3 Block Hierarchy and Precedence
-
-   The file must begin with a Section Header Block. However, more than
-
-
-
-Degioanni & Risso       Expires August 30, 2004                 [Page 5]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-   one Section Header Block can be present on the dump, each one
-   covering the data following it till the next one (or the end of
-   file). A Section includes the data delimited by two Section Header
-   Blocks (or by a Section Header Block and the end of the file),
-   including the first Section Header Block.
-
-   In case an application cannot read a Section because of different
-   version number, it must skip everything until the next Section Header
-   Block. Note that, in order to properly skip the blocks until the next
-   section, all blocks must have the fields Type and Length at the
-   beginning. This is a mandatory requirement that must be maintained in
-   future versions of the block format.
-
-   Figure 2 shows two valid files: the first has a typical
-   configuration, with a single Section Header that covers the whole
-   file. The second one contains three headers, and is normally the
-   result of file concatenation. An application that understands only
-   version 1.0 of the file format skips the intermediate section and
-   restart processing the packets after the third Section Header.
-
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      | SHB v1.0  |                      Data                         |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      Typical configuration with a single Section Header Block
-
-
-      |--   1st Section   --|--   2nd Section   --|--  3rd Section  --|
-      |                                                               |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      | SHB v1.0  |  Data   | SHB V1.1  |  Data   | SHB V1.0  |  Data |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      Configuration with three different Section Header Blocks
-
-      Figure 2: File structure example: the Section Header Block.
-
-   NOTE: TO BE COMPLETED with some examples of other blocks
-
-2.4 Data format
-
-   Data contained in each section will always be saved according to the
-   characteristics (little endian / big endian) of the dumping machine.
-   This refers to all fields that are saved as numbers and that span
-   over two or more bytes.
-
-   The approach of having each section saved in the native format of the
-   generating host is more efficient because it avoids translation of
-   data when reading / writing on the host itself, which is the most
-   common case when generating/processing capture dumps.
-
-
-
-Degioanni & Risso       Expires August 30, 2004                 [Page 6]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-   TODO Probably we have to specify something more here. Is what we're
-   saying enough to avoid any kind of ambiguity?.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                 [Page 7]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-3. Block Definition
-
-   This section details the format of the body of the blocks currently
-   defined.
-
-3.1 Section Header Block (mandatory)
-
-   The Section Header Block is mandatory. It identifies the beginning of
-   a section of the capture dump file. Its format is shown in Figure 3.
-
-       0                   1                   2                   3
-       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                            Magic                              |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |              Major            |             Minor             |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      /                                                               /
-      /                      Options (variable)                       /
-      /                                                               /
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-                 Figure 3: Section Header Block format.
-
-   The meaning of the fields is:
-
-   o  Magic: magic number, whose value is the hexadecimal number
-      0x1A2B3C4D. This number can be used to distinguish section that
-      have been saved on little-endian machines from the one saved on
-      big-endian machines.
-
-   o  Major: number of the current mayor version of the format. Current
-      value is 1.
-
-   o  Minor: number of the current minor version of the format. Current
-      value is 0.
-
-   o  Options: optionally, a list of options (formatted according to the
-      rules defined in Section 4) can be present.
-
-   Aside form the options defined in Section 4, the following options
-   are valid within this block:
-
-   +----------------+----------------+----------------+----------------+
-   | Name           | Code           | Length         | Description    |
-   +----------------+----------------+----------------+----------------+
-   | Hardware       | 2              | variable       | An ascii       |
-   |                |                |                | string         |
-
-
-
-Degioanni & Risso       Expires August 30, 2004                 [Page 8]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-   |                |                |                | containing the |
-   |                |                |                | description of |
-   |                |                |                | the hardware   |
-   |                |                |                | used to create |
-   |                |                |                | this section.  |
-   |                |                |                |                |
-   | Operating      | 3              | variable       | An ascii       |
-   | System         |                |                | string         |
-   |                |                |                | containing the |
-   |                |                |                | name of the    |
-   |                |                |                | operating      |
-   |                |                |                | system used to |
-   |                |                |                | create this    |
-   |                |                |                | section.       |
-   |                |                |                |                |
-   | User           | 3              | variable       | An ascii       |
-   | Application    |                |                | string         |
-   |                |                |                | containing the |
-   |                |                |                | name of the    |
-   |                |                |                | application    |
-   |                |                |                | used to create |
-   |                |                |                | this section.  |
-   +----------------+----------------+----------------+----------------+
-
-                                Table 1
-
-   The Section Header Block does not contain data but it rather
-   identifies a list of blocks (interfaces, packets) that are logically
-   correlated. This block does not contain any reference to the size of
-   the section it is currently delimiting, therefore the reader cannot
-   skip a whole section at once. In case a section must be skipped, the
-   user has to repeatedly skip all the blocks contained within it; this
-   makes the parsing of the file slower but it permits to append several
-   capture dumps at the same file.
-
-3.2 Interface Description Block (mandatory)
-
-   The Interface Description Block is mandatory. This block is needed to
-   specify the characteristics of the network interface on which the
-   capture has been made. In order to properly associate the captured
-   data to the corresponding interface, the Interface Description Block
-   must be defined before any other block that uses it; therefore, this
-   block is usually placed immediately after the Section Header Block.
-
-   An Interface Description Block is valid only inside the section which
-   it belongs to. The structure of a Interface Description Block is
-   shown in Figure 4.
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                 [Page 9]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-       0                   1                   2                   3
-       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |          Interface ID         |           LinkType            |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                            SnapLen                            |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      /                                                               /
-      /                      Options (variable)                       /
-      /                                                               /
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-             Figure 4: Interface Description Block format.
-
-   The meaning of the fields is:
-
-   o  Interface ID: a progressive number that identifies uniquely any
-      interface inside current section. Two Interface Description Blocks
-      can have the same Interface ID only if they are in different
-      sections of the file. The Interface ID is referenced by the packet
-      blocks.
-
-   o  LinkType: a value that defines the link layer type of this
-      interface.
-
-   o  SnapLen: maximum number of bytes dumped from each packet. The
-      portion of each packet that exceeds this value will not be stored
-      in the file.
-
-   o  Options: optionally, a list of options (formatted according to the
-      rules defined in Section 4) can be present.
-
-   In addition to the options defined in Section 4, the following
-   options are valid within this block:
-
-   +----------------+----------------+----------------+----------------+
-   | Name           | Code           | Length         | Description    |
-   +----------------+----------------+----------------+----------------+
-   | if_name        | 2              | Variable       | Name of the    |
-   |                |                |                | device used to |
-   |                |                |                | capture data.  |
-   |                |                |                |                |
-   | if_IPv4addr    | 3              | 8              | Interface      |
-   |                |                |                | network        |
-   |                |                |                | address and    |
-   |                |                |                | netmask.       |
-   |                |                |                |                |
-   | if_IPv6addr    | 4              | 17             | Interface      |
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 10]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-   |                |                |                | network        |
-   |                |                |                | address and    |
-   |                |                |                | prefix length  |
-   |                |                |                | (stored in the |
-   |                |                |                | last byte).    |
-   |                |                |                |                |
-   | if_MACaddr     | 5              | 6              | Interface      |
-   |                |                |                | Hardware MAC   |
-   |                |                |                | address (48    |
-   |                |                |                | bits).         |
-   |                |                |                |                |
-   | if_EUIaddr     | 6              | 8              | Interface      |
-   |                |                |                | Hardware EUI   |
-   |                |                |                | address (64    |
-   |                |                |                | bits), if      |
-   |                |                |                | available.     |
-   |                |                |                |                |
-   | if_speed       | 7              | 8              | Interface      |
-   |                |                |                | speed (in      |
-   |                |                |                | bps).          |
-   |                |                |                |                |
-   | if_tsaccur     | 8              | 1              | Precision of   |
-   |                |                |                | timestamps. If |
-   |                |                |                | the Most       |
-   |                |                |                | Significant    |
-   |                |                |                | Bit is equal   |
-   |                |                |                | to zero, the   |
-   |                |                |                | remaining bits |
-   |                |                |                | indicates the  |
-   |                |                |                | accuracy as as |
-   |                |                |                | a negative     |
-   |                |                |                | power of 10    |
-   |                |                |                | (e.g. 6 means  |
-   |                |                |                | microsecond    |
-   |                |                |                | accuracy). If  |
-   |                |                |                | the Most       |
-   |                |                |                | Significant    |
-   |                |                |                | Bit is equal   |
-   |                |                |                | to zero, the   |
-   |                |                |                | remaining bits |
-   |                |                |                | indicates the  |
-   |                |                |                | accuracy as as |
-   |                |                |                | negative power |
-   |                |                |                | of 2 (e.g. 10  |
-   |                |                |                | means 1/1024   |
-   |                |                |                | of second). If |
-   |                |                |                | this option is |
-   |                |                |                | not present, a |
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 11]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-   |                |                |                | precision of   |
-   |                |                |                | 10^-6 is       |
-   |                |                |                | assumed.       |
-   |                |                |                |                |
-   | if_tzone       | 9              | 4              | Time zone for  |
-   |                |                |                | GMT support    |
-   |                |                |                | (TODO: specify |
-   |                |                |                | better).       |
-   |                |                |                |                |
-   | if_flags       | 10             | 4              | Interface      |
-   |                |                |                | flags. (TODO:  |
-   |                |                |                | specify        |
-   |                |                |                | better.        |
-   |                |                |                | Possible       |
-   |                |                |                | flags:         |
-   |                |                |                | promiscuous,   |
-   |                |                |                | inbound/outbou |
-   |                |                |                | nd, traffic    |
-   |                |                |                | filtered       |
-   |                |                |                | during         |
-   |                |                |                | capture).      |
-   |                |                |                |                |
-   | if_filter      | 11             | variable       | The filter     |
-   |                |                |                | (e.g. "capture |
-   |                |                |                | only TCP       |
-   |                |                |                | traffic") used |
-   |                |                |                | to capture     |
-   |                |                |                | traffic. The   |
-   |                |                |                | first byte of  |
-   |                |                |                | the Option     |
-   |                |                |                | Data keeps a   |
-   |                |                |                | code of the    |
-   |                |                |                | filter used    |
-   |                |                |                | (e.g. if this  |
-   |                |                |                | is a libpcap   |
-   |                |                |                | string, or BPF |
-   |                |                |                | bytecode, and  |
-   |                |                |                | more). More    |
-   |                |                |                | details about  |
-   |                |                |                | this format    |
-   |                |                |                | will be        |
-   |                |                |                | presented in   |
-   |                |                |                | Appendix XXX   |
-   |                |                |                | (TODO).        |
-   |                |                |                |                |
-   | if_opersystem  | 12             | variable       | An ascii       |
-   |                |                |                | string         |
-   |                |                |                | containing the |
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 12]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-   |                |                |                | name of the    |
-   |                |                |                | operating      |
-   |                |                |                | system of the  |
-   |                |                |                | machine that   |
-   |                |                |                | hosts this     |
-   |                |                |                | interface.     |
-   |                |                |                | This can be    |
-   |                |                |                | different from |
-   |                |                |                | the same       |
-   |                |                |                | information    |
-   |                |                |                | that can be    |
-   |                |                |                | contained by   |
-   |                |                |                | the Section    |
-   |                |                |                | Header Block   |
-   |                |                |                | (Section 3.1)  |
-   |                |                |                | because the    |
-   |                |                |                | capture can    |
-   |                |                |                | have been done |
-   |                |                |                | on a remote    |
-   |                |                |                | machine.       |
-   +----------------+----------------+----------------+----------------+
-
-                                Table 2
-
-
-3.3 Packet Block (optional)
-
-   A Packet Block is the standard container for storing the packets
-   coming from the network. The Packet Block is optional because packets
-   can be stored either by means of this block or the Simple Packet
-   Block, which can be used to speed up dump generation. The format of a
-   packet block is shown in Figure 5.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 13]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-       0                   1                   2                   3
-       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |         Interface ID          |          Drops Count          |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                        Timestamp (High)                       |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                        Timestamp (Low)                        |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                         Captured Len                          |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                          Packet Len                           |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                                                               |
-      |                          Packet Data                          |
-      |                                                               |
-      |              /* variable length, byte-aligned */              |
-      |                                                               |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      /                                                               /
-      /                      Options (variable)                       /
-      /                                                               /
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-                     Figure 5: Packet Block format.
-
-   The Packet Block has the following fields:
-
-   o  Interface ID: Specifies the interface this packet comes from, and
-      corresponds to the ID of one of the Interface Description Blocks
-      present in this section of the file (see Figure 4).
-
-   o  Drops Count: a local drop counter. It specified the number of
-      packets lost (by the interface and the operating system) between
-      this packet and the preceding one. The value xFFFF (in
-      hexadecimal) is reserved for those systems in which this
-      information is not available.
-
-   o  Timestamp (High): the most significative part of the timestamp. in
-      standard Unix format, i.e. from 1/1/1970.
-
-   o  Timestamp (Low): the less significative part of the timestamp. The
-      way to interpret this field is specified by the 'ts_accur' option
-      (see Figure 4) of the Interface Description block referenced by
-      this packet. If the Interface Description block does not contain a
-      'ts_accur' option, then this field is expressed in microseconds.
-
-   o  Captured Len: number of bytes captured from the packet (i.e. the
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 14]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-      length of the Packet Data field). It will be the minimum value
-      among the actual Packet Length and the snapshot length (defined in
-      Figure 4).
-
-   o  Packet Len: actual length of the packet when it was transmitted on
-      the network. Can be different from Captured Len if the user wants
-      only a snapshot of the packet.
-
-   o  Packet Data: the data coming from the network, including
-      link-layer headers. The length of this field is Captured Len. The
-      format of the link-layer headers depends on the LinkType field
-      specified in the Interface Description Block (see Section 3.2) and
-      it is specified in Appendix XXX (TODO).
-
-   o  Options: optionally, a list of options (formatted according to the
-      rules defined in Section 4) can be present.
-
-
-3.4 Simple Packet Block (optional)
-
-   The Simple Packet Block is a lightweight container for storing the
-   packets coming from the network. Its presence is optional.
-
-   A Simple Packet Block is similar to a Packet Block (see Section 3.3),
-   but it is smaller, simpler to process and contains only a minimal set
-   of information. This block is preferred to the standard Packet Block
-   when performance or space occupation are critical factors, such as in
-   sustained traffic dump applications. A capture file can contain both
-   Packet Blocks and Simple Packet Blocks: for example, a capture tool
-   could switch from Packet Blocks to Simple Packet Blocks when the
-   hardware resources become critical.
-
-   The Simple Packet Block does not contain the Interface ID field.
-   Therefore, it must be assumed that all the Simple Packet Blocks have
-   been captured on the interface previously specified in the Interface
-   Description Block.
-
-   Figure 6 shows the format of the Simple Packet Block.
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 15]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-       0                   1                   2                   3
-       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                          Packet Len                           |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                                                               |
-      |                          Packet Data                          |
-      |                                                               |
-      |              /* variable length, byte-aligned */              |
-      |                                                               |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-                 Figure 6: Simple Packet Block format.
-
-   The Packet Block has the following fields:
-
-   o  Packet Len: actual length of the packet when it was transmitted on
-      the network. Can be different from captured len if the packet has
-      been truncated.
-
-   o  Packet data: the data coming from the network, including
-      link-layers headers. The length of this field can be derived from
-      the field Block Total Length, present in the Block Header.
-
-   The Simple Packet Block does not contain the timestamp because this
-   is one of the most costly operations on PCs. Additionally, there are
-   applications that do not require it; e.g. an Intrusion Detection
-   System is interested in packets, not in their timestamp.
-
-   The Simple Packet Block is very efficient in term of disk space: a
-   snapshot of length 100 bytes requires only 16 bytes of overhead,
-   which corresponds to an efficiency of more than 86%.
-
-3.5 Name Resolution Block (optional)
-
-   The Name Resolution Block is used to support the correlation of
-   numeric addresses (present in the captured packets) and their
-   corresponding canonical names and it is optional. Having the literal
-   names saved in the file, this prevents the need of a name resolution
-   in a delayed time, when the association between names and addresses
-   can be different from the one in use at capture time. Moreover, The
-   Name Resolution Block avoids the need of issuing a lot of DNS
-   requests every time the trace capture is opened, and allows to have
-   name resolution also when reading the capture with a machine not
-   connected to the network.
-
-   The format of the Name Resolution Block is shown in Figure 7.
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 16]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-       0                   1                   2                   3
-       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |      Record Type              |         Record Length         |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                       Record Value                            |
-      |              /* variable length, byte-aligned */              |
-      |               + + + + + + + + + + + + + + + + + + + + + + + + +
-      |               |               |               |               |
-      +-+-+-+-+-+-+-+-+ + + + + + + + + + + + + + + + + + + + + + + + +
-                . . . other records . . .
-      |  Record Type == end_of_recs   |  Record Length == 00          |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      /                                                               /
-      /                      Options (variable)                       /
-      /                                                               /
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-                Figure 7: Name Resolution Block format.
-
-   A Name Resolution Block is a zero-terminated list of records (in the
-   TLV format), each of which contains an association between a network
-   address and a name. There are three possible types of records:
-
-   +----------------+----------------+----------------+----------------+
-   | Name           | Code           | Length         | Description    |
-   +----------------+----------------+----------------+----------------+
-   | end_of_recs    | 0              | 0              | End of records |
-   |                |                |                |                |
-   | ip4_rec        | 1              | Variable       | Specifies an   |
-   |                |                |                | IPv4 address   |
-   |                |                |                | (contained in  |
-   |                |                |                | the first 4    |
-   |                |                |                | bytes),        |
-   |                |                |                | followed by    |
-   |                |                |                | one or more    |
-   |                |                |                | zero-terminate |
-   |                |                |                | d strings      |
-   |                |                |                | containing the |
-   |                |                |                | DNS entries    |
-   |                |                |                | for that       |
-   |                |                |                | address.       |
-   |                |                |                |                |
-   | ip6_rec        | 1              | Variable       | Specifies an   |
-   |                |                |                | IPv6 address   |
-   |                |                |                | (contained in  |
-   |                |                |                | the first 16   |
-   |                |                |                | bytes),        |
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 17]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-   |                |                |                | followed by    |
-   |                |                |                | one or more    |
-   |                |                |                | zero-terminate |
-   |                |                |                | d strings      |
-   |                |                |                | containing the |
-   |                |                |                | DNS entries    |
-   |                |                |                | for that       |
-   |                |                |                | address.       |
-   +----------------+----------------+----------------+----------------+
-
-                                Table 3
-
-   After the list or Name Resolution Records, optionally, a list of
-   options (formatted according to the rules defined in Section 4) can
-   be present.
-
-   A Name Resolution Block is normally placed at the beginning of the
-   file, but no assumptions can be taken about its position. Name
-   Resolution Blocks can be added in a second time by tools that process
-   the file, like network analyzers.
-
-   In addiction to the options defined in Section 4, the following
-   options are valid within this block:
-
-   +----------------+----------------+----------------+----------------+
-   | Name           | Code           | Length         | Description    |
-   +----------------+----------------+----------------+----------------+
-   | ns_dnsname     | 2              | Variable       | An ascii       |
-   |                |                |                | string         |
-   |                |                |                | containing the |
-   |                |                |                | name of the    |
-   |                |                |                | machine (DNS   |
-   |                |                |                | server) used   |
-   |                |                |                | to perform the |
-   |                |                |                | name           |
-   |                |                |                | resolution.    |
-   +----------------+----------------+----------------+----------------+
-
-
-3.6 Interface Statistics Block (optional)
-
-   The Interface Statistics Block contains the capture statistics for a
-   given interface and it is optional. The statistics are referred to
-   the interface defined in the current Section identified by the
-   Interface ID field.
-
-   The format of the Interface Statistics Block is shown in Figure 8.
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 18]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-       0                   1                   2                   3
-       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                         IfRecv                                |
-      |                          (high + low)                         |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                         IfDrop                                |
-      |                          (high + low)                         |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                         FilterAccept                          |
-      |                          (high + low)                         |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                         OSDrop                                |
-      |                          (high + low)                         |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                         UsrDelivered                          |
-      |                          (high + low)                         |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |          Interface ID         |           Reserved            |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      /                                                               /
-      /                      Options (variable)                       /
-      /                                                               /
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-              Figure 8: Interface Statistics Block format.
-
-   The fields have the following meaning:
-
-   o  IfRecv: number of packets received from the interface during the
-      capture. This number is reported as a 64 bits value, in which the
-      most significat bits are located in the first four bytes of the
-      field.
-
-   o  IfDrop: number of packets dropped by the interface during the
-      capture due to lack of resources.
-
-   o  FilterAccept: number of packets accepeted by filter during current
-      capture.
-
-   o  OSDrop: number of packets dropped by the operating system during
-      the capture.
-
-   o  UsrDelivered: number of packets delivered to the user.
-      UsrDelivered can be different from the value 'FilterAccept -
-      OSDropped' because some packets could still lay in the OS buffers
-      when the capture ended.
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 19]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-   o  Interface ID: reference to an Interface Description Block.
-
-   o  Reserved: Reserved to future use.
-
-   o  Options: optionally, a list of options (formatted according to the
-      rules defined in Section 4) can be present.
-
-   In addiction to the options defined in Section 4, the following
-   options are valid within this block:
-
-   +----------------+----------------+----------------+----------------+
-   | Name           | Code           | Length         | Description    |
-   +----------------+----------------+----------------+----------------+
-   | isb_starttime  | 2              | 8              | Time in which  |
-   |                |                |                | the capture    |
-   |                |                |                | started; time  |
-   |                |                |                | will be stored |
-   |                |                |                | in two blocks  |
-   |                |                |                | of four bytes  |
-   |                |                |                | each,          |
-   |                |                |                | containing the |
-   |                |                |                | timestamp in   |
-   |                |                |                | seconds and    |
-   |                |                |                | nanoseconds.   |
-   |                |                |                |                |
-   | isb_endtime    | 3              | 8              | Time in which  |
-   |                |                |                | the capture    |
-   |                |                |                | started; time  |
-   |                |                |                | will be stored |
-   |                |                |                | in two blocks  |
-   |                |                |                | of four bytes  |
-   |                |                |                | each,          |
-   |                |                |                | containing the |
-   |                |                |                | timestamp in   |
-   |                |                |                | seconds and    |
-   |                |                |                | nanoseconds.   |
-   +----------------+----------------+----------------+----------------+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 20]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-4. Options
-
-   Almost all blocks have the possibility to embed optional fields.
-   Optional fields can be used to insert some information that may be
-   useful when reading data, but that it is not really needed for packet
-   processing. Therefore, each tool can be either read the content of
-   the optional fields (if any), or skip them at once.
-
-   Skipping all the optional fields at once is straightforward because
-   most of the blocks have a fixed length, therefore the field Block
-   Length (present in the General Block Structure, see  Section 2.1) can
-   be used to skip everything till the next block.
-
-   Options are a list of Type - Length - Value fields, each one
-   containing a single value:
-
-   o  Option Type (2 bytes): it contains the code that specifies the
-      type of the current TLV record. Option types whose Most
-      Significant Bit is equal to one are reserved for local use;
-      therefore, there is no guarantee that the code used is unique
-      among all capture files (generated by other applications). In case
-      of vendor-specific extensions that have to be identified uniquely,
-      vendors must request an Option Code whose MSB is equal to zero.
-
-   o  Option Length (2 bytes): it contains the length of the following
-      'Option Value' field.
-
-   o  Option Value (variable length): it contains the value of the given
-      option. The length of this field as been specified by the Option
-      Length field.
-
-   Options may be repeated several times (e.g. an interface that has
-   several IP addresses associated to it). The option list is terminated
-   by a special code which is the 'End of Option'.
-
-   The format of the optional fields is shown in Figure 9.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 21]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-       0                   1                   2                   3
-       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |      Option Code              |         Option Length         |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |                       Option Value                            |
-      |              /* variable length, byte-aligned */              |
-      |               + + + + + + + + + + + + + + + + + + + + + + + + +
-      |               /               /               /               |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      /                                                               /
-      /                 . . . other options . . .                     /
-      /                                                               /
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |   Option Code == opt_endofopt  |  Option Length == 0          |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-                       Figure 9: Options format.
-
-   The following codes can always be present in any optional field:
-
-   +----------------+----------------+----------------+----------------+
-   | Name           | Code           | Length         | Description    |
-   +----------------+----------------+----------------+----------------+
-   | opt_endofopt   | 0              | 0              | End of         |
-   |                |                |                | options: it is |
-   |                |                |                | used to        |
-   |                |                |                | delimit the    |
-   |                |                |                | end of the     |
-   |                |                |                | optional       |
-   |                |                |                | fields. This   |
-   |                |                |                | block cannot   |
-   |                |                |                | be repeated    |
-   |                |                |                | within a given |
-   |                |                |                | list of        |
-   |                |                |                | options.       |
-   |                |                |                |                |
-   | opt_comment    | 1              | variable       | Comment: it is |
-   |                |                |                | an ascii       |
-   |                |                |                | string         |
-   |                |                |                | containing a   |
-   |                |                |                | comment that   |
-   |                |                |                | is associated  |
-   |                |                |                | to the current |
-   |                |                |                | block.         |
-   +----------------+----------------+----------------+----------------+
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 22]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-5. Experimental Blocks (deserved to a further investigation)
-
-5.1 Other Packet Blocks (experimental)
-
-   Can some other packet blocks (besides the two described in the
-   previous paragraphs) be useful?
-
-5.2 Compression Block (experimental)
-
-   The Compression Block is optional. A file can contain an arbitrary
-   number of these blocks. A Compression Block, as the name says, is
-   used to store compressed data. Its format is shown in Figure 10.
-
-       0                   1                   2                   3
-       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |  Compr. Type  |                                               |
-      +-+-+-+-+-+-+-+-+                                               |
-      |                                                               |
-      |                       Compressed Data                         |
-      |                                                               |
-      |              /* variable length, byte-aligned */              |
-      |                                                               |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-                  Figure 10: Compression Block format.
-
-   The fields have the following meaning:
-
-   o  Compression Type: specifies the compression algorithm. Possible
-      values for this field are 0 (uncompressed), 1 (Lempel Ziv), 2
-      (Gzip), other?? Probably some kind of dumb and fast compression
-      algorithm could be effective with some types of traffic (for
-      example web), but which?
-
-   o  Compressed Data: data of this block. Once decompressed, it is made
-      of other blocks.
-
-
-5.3 Encryption Block (experimental)
-
-   The Encryption Block is optional. A file can contain an arbitrary
-   number of these blocks. An Encryption Block is used to sotre
-   encrypted data. Its format is shown in Figure 11.
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 23]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-       0                   1                   2                   3
-       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |   Encr. Type  |                                               |
-      +-+-+-+-+-+-+-+-+                                               |
-      |                                                               |
-      |                       Compressed Data                         |
-      |                                                               |
-      |              /* variable length, byte-aligned */              |
-      |                                                               |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-                  Figure 11: Encryption Block format.
-
-   The fields have the following meaning:
-
-   o  Compression Type: specifies the encryption algorithm. Possible
-      values for this field are ??? NOTE: this block should probably
-      contain other fields, depending on the encryption algorithm. To be
-      define precisely.
-
-   o  Encrypted Data: data of this block. Once decripted, it consists of
-      other blocks.
-
-
-5.4 Fixed Length Block (experimental)
-
-   The Fixed Length Block is optional. A file can contain an arbitrary
-   number of these blocks. A Fixed Length Block can be used to optimize
-   the access to the file. Its format is shown in Figure 12. A Fixed
-   Length Block stores records with constant size. It contains a set of
-   Blocks (normally Packet Blocks or Simple Packet Blocks), of wihich it
-   specifies the size. Knowing this size a priori helps to scan the file
-   and to load some portions of it without truncating a block, and is
-   particularly useful with cell-based networks like ATM.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 24]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-       0                   1                   2                   3
-       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-      |          Cell Size            |                               |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
-      |                                                               |
-      |                        Fixed Size Data                        |
-      |                                                               |
-      |              /* variable length, byte-aligned */              |
-      |                                                               |
-      |                                                               |
-      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-                 Figure 12: Fixed Length Block format.
-
-   The fields have the following meaning:
-
-   o  Cell size: the size of the blocks contained in the data field.
-
-   o  Fixed Size Data: data of this block.
-
-
-5.5 Directory Block (experimental)
-
-   If present, this block contains the following information:
-
-   o  number of indexed packets (N)
-
-   o  table with position and length of any indexed packet (N entries)
-
-   A directory block must be followed by at least N packets, otherwise
-   it must be considered invalid. It can be used to efficiently load
-   portions of the file to memory and to support operations on memory
-   mapped files. This block can be added by tools like network analyzers
-   as a consequence of file processing.
-
-5.6 Traffic Statistics and Monitoring Blocks (experimental)
-
-   One or more blocks could be defined to contain network statistics or
-   traffic monitoring information. They could be use to store data
-   collected from RMON or Netflow probes, or from other network
-   monitoring tools.
-
-5.7 Event/Security Block (experimental)
-
-   This block could be used to store events. Events could contain
-   generic information (for example network load over 50%, server
-   down...) or security alerts. An event could be:
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 25]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-   o  skipped, if the application doesn't know how to do with it
-
-   o  processed independently by the packets. In other words, the
-      applications skips the packets and processes only the alerts
-
-   o  processed in relation to packets: for example, a security tool
-      could load only the packets of the file that are near a security
-      alert; a monitorg tool could skip the packets captured while the
-      server was down.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 26]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-6. Conclusions
-
-   The file format proposed in this document should be very versatile
-   and satisfy a wide range of applications. In the simplest case, it
-   can contain a raw dump of the network data, made of a series of
-   Simple Packet Blocks. In the most complex case, it can be used as a
-   repository for heterogeneous information. In every case, the file
-   remains easy to parse and an application can always skip the data it
-   is not interested in; at the same time, different applications can
-   share the file, and each of them can benfit of the information
-   produced by the others. Two or more files can be concatenated
-   obtaining another valid file.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 27]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-7. Most important open issues
-
-   o  Data, in the file, must be byte or word aligned? Currently, the
-      structure of this document is not consistent with respect to this
-      point.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 28]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-Intellectual Property Statement
-
-   The IETF takes no position regarding the validity or scope of any
-   intellectual property or other rights that might be claimed to
-   pertain to the implementation or use of the technology described in
-   this document or the extent to which any license under such rights
-   might or might not be available; neither does it represent that it
-   has made any effort to identify any such rights. Information on the
-   IETF's procedures with respect to rights in standards-track and
-   standards-related documentation can be found in BCP-11. Copies of
-   claims of rights made available for publication and any assurances of
-   licenses to be made available, or the result of an attempt made to
-   obtain a general license or permission for the use of such
-   proprietary rights by implementors or users of this specification can
-   be obtained from the IETF Secretariat.
-
-   The IETF invites any interested party to bring to its attention any
-   copyrights, patents or patent applications, or other proprietary
-   rights which may cover technology that may be required to practice
-   this standard. Please address the information to the IETF Executive
-   Director.
-
-
-Full Copyright Statement
-
-   Copyright (C) The Internet Society (2004). All Rights Reserved.
-
-   This document and translations of it may be copied and furnished to
-   others, and derivative works that comment on or otherwise explain it
-   or assist in its implementation may be prepared, copied, published
-   and distributed, in whole or in part, without restriction of any
-   kind, provided that the above copyright notice and this paragraph are
-   included on all such copies and derivative works. However, this
-   document itself may not be modified in any way, such as by removing
-   the copyright notice or references to the Internet Society or other
-   Internet organizations, except as needed for the purpose of
-   developing Internet standards in which case the procedures for
-   copyrights defined in the Internet Standards process must be
-   followed, or as required to translate it into languages other than
-   English.
-
-   The limited permissions granted above are perpetual and will not be
-   revoked by the Internet Society or its successors or assignees.
-
-   This document and the information contained herein is provided on an
-   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
-   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
-   BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 29]
-
-Internet-Draft    PCAP New Generation Dump File Format        March 2004
-
-
-   HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
-   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-Acknowledgment
-
-   Funding for the RFC Editor function is currently provided by the
-   Internet Society.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Degioanni & Risso       Expires August 30, 2004                [Page 30]
-
diff --git a/doc/pcap.xml b/doc/pcap.xml
deleted file mode 100644
index ebbf321..0000000
--- a/doc/pcap.xml
+++ /dev/null
@@ -1,746 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
-
-<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
-<?rfc toc="yes"?>
-<rfc ipr="full2026" docname="draft-libpcap-dump-format-00.txt">
-   <front>
-       <title>PCAP New Generation Dump File Format</title>
-       <author initials="L." surname="Degioanni" fullname="Loris Degioanni">
-         <organization>Politecnico di Torino</organization>
-         <address>
-            <postal>
-               <street>Corso Duca degli Abruzzi, 24</street>
-               <city>Torino</city>
-               <code>10129</code>
-               <country>Italy</country>
-            </postal>
-            <phone>+39 011 564 7008</phone>
-            <email>loris.degioanni@polito.it</email>
-            <uri>http://netgroup.polito.it/loris/</uri>
-         </address>
-      </author>
-       <author initials="F." surname="Risso" fullname="Fulvio Risso">
-         <organization>Politecnico di Torino</organization>
-         <address>
-            <postal>
-               <street>Corso Duca degli Abruzzi, 24</street>
-               <city>Torino</city>
-               <code>10129</code>
-               <country>Italy</country>
-            </postal>
-            <phone>+39 011 564 7008</phone>
-            <email>fulvio.risso@polito.it</email>
-            <uri>http://netgroup.polito.it/fulvio.risso/</uri>
-         </address>
-      </author>
-
-   <!-- Other authors go here -->
-
-      <date month="March" year="2004"/>
-      <area>General</area>
-<!--
-       <workgroup>
--->
-      <keyword>Internet-Draft</keyword>
-      <keyword>Libpcap, dump file format</keyword>
-         <abstract>
-<t>This document describes a format to dump captured packets on a file. This format is extensible and it is currently proposed for implementation in the libpcap/WinPcap packet capture library.</t>
-         </abstract>
-<!--
-      <note ...>
--->
-   </front>
-   <middle>
-
-<section title="Objectives">
-<t>The problem of exchanging packet traces becomes more and more critical every day; unfortunately, no standard solutions exist for this task right now. One of the most accepted packet interchange formats is the one defined by libpcap, which is rather old and does not fit for some of the nowadays applications especially in terms of extensibility.</t>
-<t>This document proposes a new format for dumping packet traces. The following goals are being pursued:</t>
-<list style="symbols">
-<t>Extensibility: aside of some common functionalities, third parties should be able to enrich the information embedded in the file with proprietary extensions, which will be ignored by tools that are not able to understand them.</t>
-<t>Portability: a capture trace must contain all the information needed to read data independently from network, hardware and operating system of the machine that made the capture.</t>
-<t>Merge/Append data: it should be possible to add data at the end of a given file, and the resulting file must still be readable.</t>
-</list>
-
-</section>
-
-
-<section title="General File Structure">
-
-<section anchor="sectionblock" title="General Block Structure">
-<t>A capture file is organized in blocks, that are appended one to another to form the file. All the blocks share a common format, which is shown in <xref target="formatblock"/>.</t>
-
-<figure anchor="formatblock" title="Basic block structure.">
-<artwork>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                          Block Type                           |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                      Block Total Length                       |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                          Block Body                           /
-   /          /* variable length, aligned to 32 bits */            /
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                      Block Total Length                       |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-</artwork>
-</figure>
-
-<t>The fields have the following meaning:</t>
-
-<list style="symbols">
-<t>Block Type (32 bits): unique value that identifies the block. Values whose Most Significant Bit (MSB) is equal to 1 are reserved for local use. They allow to save private data to the file and to extend the file format.</t>
-<t>Block Total Length: total size of this block, in bytes. For instance, a block that does not have a body has a length of 12 bytes.</t>
-<t>Block Body: content of the block.</t>
-<t>Block Total Length: total size of this block, in bytes. This field is duplicated for permitting backward file navigation.</t>
-</list>
-
-<t>This structure, shared among all blocks, makes easy to process a file and to skip unneeded or unknown blocks. Blocks can be nested one inside the others (NOTE: needed?). Some of the blocks are mandatory, i.e. a dump file is not valid if they are not present, other are optional.</t>
-<t>The structure of the blocks allows to define other blocks if needed. A parser that does non understand them can simply ignore their content.</t>
-</section>
-
-<section title="Block Types">
-<t>The currently defined blocks are the following:</t>
-<list style="numbers">
-<t>Section Header Block: it defines the most important characteristics of the capture file.</t>
-<t>Interface Description Block: it defines the most important characteristics of the interface(s) used for capturing traffic.</t>
-<t>Packet Block: it contains a single captured packet, or a portion of it.</t>
-<t>Simple Packet Block: it contains a single captured packet, or a portion of it, with only a minimal set of information about it.</t>
-<t>Name Resolution Block: it defines the mapping from numeric addresses present in the packet dump and the canonical name counterpart.</t>
-<t>Capture Statistics Block: it defines how to store some statistical data (e.g. packet dropped, etc) which can be useful to undestand the conditions in which the capture has been made.</t>
-<t>Compression Marker Block: TODO</t>
-<t>Encryption Marker Block: TODO</t>
-<t>Fixed Length Marker Block: TODO</t>
-</list>
-
-<t>The following blocks instead are considered interesting but the authors believe that they deserve more in-depth discussion before being defined:</t>
-<list style="numbers">
-<t>Further Packet Blocks</t>
-<t>Directory Block</t>
-<t>Traffic Statistics and Monitoring Blocks</t>
-<t>Alert and Security Blocks</t>
-</list>
-
-<t>TODO Currently standardized Block Type codes are specified in Appendix 1.</t>
-
-</section>
-
-<section title="Block Hierarchy and Precedence">
-<t>The file must begin with a Section Header Block. However, more than one Section Header Block can be present on the dump, each one covering the data following it till the next one (or the end of file). A Section includes the data delimited by two Section Header Blocks (or by a Section Header Block and the end of the file), including the first Section Header Block.</t>
-<t>In case an application cannot read a Section because of different version number, it must skip everything until the next Section Header Block. Note that, in order to properly skip the blocks until the next section, all blocks must have the fields Type and Length at the beginning. This is a mandatory requirement that must be maintained in future versions of the block format.</t>
-<t><xref target="fssample-SHB"/> shows two valid files: the first has a typical configuration, with a single Section Header that covers the whole file. The second one contains three headers, and is normally the result of file concatenation. An application that understands only version 1.0 of the file format skips the intermediate section and restart processing the packets after the third Section Header.</t>
-
-<figure anchor="fssample-SHB" title="File structure example: the Section Header Block.">
-<artwork>
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   | SHB v1.0  |                      Data                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   Typical configuration with a single Section Header Block 
-
-
-   |--   1st Section   --|--   2nd Section   --|--  3rd Section  --|
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   | SHB v1.0  |  Data   | SHB V1.1  |  Data   | SHB V1.0  |  Data |  
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   Configuration with three different Section Header Blocks
-</artwork>
-</figure>
-
-<t>NOTE: TO BE COMPLETED with some examples of other blocks</t>
-
-</section>
-
-<section title="Data format">
-<t>Data contained in each section will always be saved according to the characteristics (little endian / big endian) of the dumping machine. This refers to all fields that are saved as numbers and that span over two or more bytes.</t>
-<t>The approach of having each section saved in the native format of the generating host is more efficient because it avoids translation of data when reading / writing on the host itself, which is the most common case when generating/processing capture dumps.</t>
-<t>TODO Probably we have to specify something more here. Is what we're saying enough to avoid any kind of ambiguity?.</t>
-</section>
-
-</section>
-
-
-
-
-<section title="Block Definition">
-<t>This section details the format of the body of the blocks currently defined.</t>
-
-<section anchor="sectionshb" title="Section Header Block (mandatory)">
-<t>The Section Header Block is mandatory. It identifies the beginning of a section of the capture dump file. Its format is shown in <xref target="formatSHB"/>.</t>
-<figure anchor="formatSHB" title="Section Header Block format.">
-<artwork>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                            Magic                              |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |              Major            |             Minor             |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-</artwork>
-</figure>
-
-<t>The meaning of the fields is:</t>
-<list style="symbols">
-<t>Magic: magic number, whose value is the hexadecimal number 0x1A2B3C4D. This number can be used to distinguish section that have been saved on little-endian machines from the one saved on big-endian machines.</t>
-<t>Major: number of the current mayor version of the format. Current value is 1.</t>
-<t>Minor: number of the current minor version of the format. Current value is 0.</t>
-<t>Options: optionally, a list of options (formatted according to the rules defined in <xref target="sectionopt"/>) can be present.</t>
-</list>
-
-<t>Aside form the options defined in <xref target="sectionopt"/>, the following options are valid within this block:</t>
-
-<texttable anchor="InterfaceOptions1">
-  <ttcol>Name</ttcol>
-  <ttcol>Code</ttcol>
-  <ttcol>Length</ttcol>
-  <ttcol>Description</ttcol>
-
-  <c>Hardware</c>
-  <c>2</c>
-  <c>variable</c>
-  <c>An ascii string containing the description of the hardware used to create this section.</c>
-
-  <c>Operating System</c>
-  <c>3</c>
-  <c>variable</c>
-  <c>An ascii string containing the name of the operating system used to create this section.</c>
-
-  <c>User Application</c>
-  <c>3</c>
-  <c>variable</c>
-  <c>An ascii string containing the name of the application used to create this section.</c>
-</texttable>
-
-
-<t>The Section Header Block does not contain data but it rather identifies a list of blocks (interfaces, packets) that are logically correlated. This block does not contain any reference to the size of the section it is currently delimiting, therefore the reader cannot skip a whole section at once. In case a section must be skipped, the user has to repeatedly skip all the blocks contained within it; this makes the parsing of the file slower but it permits to append several capture dumps at the same file.</t>
-</section>
-
-<section anchor="sectionidb" title="Interface Description Block (mandatory)">
-<t>The Interface Description Block is mandatory. This block is needed to specify the characteristics of the network interface on which the capture has been made. In order to properly associate the captured data to the corresponding interface, the Interface Description Block must be defined before any other block that uses it; therefore, this block is usually placed immediately after the Section Header Block.</t>
-
-<t>An Interface Description Block is valid only inside the section which it belongs to. The structure of a Interface Description Block is shown in <xref target="formatidb"/>.</t>
-
-<figure anchor="formatidb" title="Interface Description Block format.">
-<artwork>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |          Interface ID         |           LinkType            |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                            SnapLen                            |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </artwork>
-</figure>
-
-<t>The meaning of the fields is:</t>
-<list style="symbols">
-<t>Interface ID: a progressive number that identifies uniquely any interface inside current section. Two Interface Description Blocks can have the same Interface ID only if they are in different sections of the file. The Interface ID is referenced by the packet blocks.</t>
-<t>LinkType: a value that defines the link layer type of this interface.</t>
-<t>SnapLen: maximum number of bytes dumped from each packet. The portion of each packet that exceeds this value will not be stored in the file.</t>
-<t>Options: optionally, a list of options (formatted according to the rules defined in <xref target="sectionopt"/>) can be present.</t>
-</list>
-
-<t>In addition to the options defined in <xref target="sectionopt"/>, the following options are valid within this block:</t>
-
-<texttable anchor="InterfaceOptions2">
-  <ttcol>Name</ttcol>
-  <ttcol>Code</ttcol>
-  <ttcol>Length</ttcol>
-  <ttcol>Description</ttcol>
-
-  <c>if_name</c>
-  <c>2</c>
-  <c>Variable</c>
-  <c>Name of the device used to capture data.</c>
-
-  <c>if_IPv4addr</c>
-  <c>3</c>
-  <c>8</c>
-  <c>Interface network address and netmask.</c>
-
-  <c>if_IPv6addr</c>
-  <c>4</c>
-  <c>17</c>
-  <c>Interface network address and prefix length (stored in the last byte).</c>
-
-  <c>if_MACaddr</c>
-  <c>5</c>
-  <c>6</c>
-  <c>Interface Hardware MAC address (48 bits).</c>
-
-  <c>if_EUIaddr</c>
-  <c>6</c>
-  <c>8</c>
-  <c>Interface Hardware EUI address (64 bits), if available.</c>
-
-  <c>if_speed</c>
-  <c>7</c>
-  <c>8</c>
-  <c>Interface speed (in bps).</c>
-
-  <c>if_tsaccur</c>
-  <c>8</c>
-  <c>1</c>
-  <c>Precision of timestamps. If the Most Significant Bit is equal to zero, the remaining bits indicates the accuracy as as a negative power of 10 (e.g. 6 means microsecond accuracy). If the Most Significant Bit is equal to zero, the remaining bits indicates the accuracy as as negative power of 2 (e.g. 10 means 1/1024 of second). If this option is not present, a precision of 10^-6 is assumed.</c>
-
-  <c>if_tzone</c>
-  <c>9</c>
-  <c>4</c>
-  <c>Time zone for GMT support (TODO: specify better).</c>
-  
-  <c>if_flags</c>
-  <c>10</c>
-  <c>4</c>
-  <c>Interface flags. (TODO: specify better. Possible flags: promiscuous, inbound/outbound, traffic filtered during capture).</c>
-
-  <c>if_filter</c>
-  <c>11</c>
-  <c>variable</c>
-  <c>The filter (e.g. "capture only TCP traffic") used to capture traffic. The first byte of the Option Data keeps a code of the filter used (e.g. if this is a libpcap string, or BPF bytecode, and more). More details about this format will be presented in Appendix XXX (TODO).</c>
-
-  <c>if_opersystem</c>
-  <c>12</c>
-  <c>variable</c>
-  <c>An ascii string containing the name of the operating system of the machine that hosts this interface. This can be different from the same information that can be contained by the Section Header Block (<xref target="sectionshb"/>) because the capture can have been done on a remote machine.</c>
-
-</texttable>
-
-</section>
-
-
-
-<section anchor="sectionpb" title="Packet Block (optional)">
-<t>A Packet Block is the standard container for storing the packets coming from the network. The Packet Block is optional because packets can be stored either by means of this block or the Simple Packet Block, which can be used to speed up dump generation. The format of a packet block is shown in <xref target="formatpb"/>.</t>
-
-<figure anchor="formatpb" title="Packet Block format.">
-<artwork>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |         Interface ID          |          Drops Count          |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                        Timestamp (High)                       |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                        Timestamp (Low)                        |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         Captured Len                          |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                          Packet Len                           |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                                                               |
-   |                          Packet Data                          |
-   |                                                               |
-   |              /* variable length, byte-aligned */              |
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-</artwork>
-</figure>
-
-<t>The Packet Block has the following fields:</t>
-
-<list style="symbols">
-<t>Interface ID: Specifies the interface this packet comes from, and corresponds to the ID of one of the Interface Description Blocks present in this section of the file (see <xref target="formatidb"/>).</t>
-<t>Drops Count: a local drop counter. It specified the number of packets lost (by the interface and the operating system) between this packet and the preceding one. The value xFFFF (in hexadecimal) is reserved for those systems in which this information is not available.</t>
-<t>Timestamp (High): the most significative part of the timestamp. in standard Unix format, i.e. from 1/1/1970.</t>
-<t>Timestamp (Low): the less significative part of the timestamp. The way to interpret this field is specified by the 'ts_accur' option (see <xref target="formatidb"/>) of the Interface Description block referenced by this packet. If the Interface Description block does not contain a 'ts_accur' option, then this field is expressed in microseconds.</t>
-<t>Captured Len: number of bytes captured from the packet (i.e. the length of the Packet Data field). It will be the minimum value among the actual Packet Length and the snapshot length (defined in <xref target="formatidb"/>).</t>
-<t>Packet Len: actual length of the packet when it was transmitted on the network. Can be different from Captured Len if the user wants only a snapshot of the packet.</t>
-<t>Packet Data: the data coming from the network, including link-layer headers. The length of this field is Captured Len. The format of the link-layer headers depends on the LinkType field specified in the Interface Description Block (see <xref target="sectionidb"/>) and it is specified in Appendix XXX (TODO).</t>
-<t>Options: optionally, a list of options (formatted according to the rules defined in <xref target="sectionopt"/>) can be present.</t>
-</list>
-
-<t></t>
-</section>
-
-
-<section title="Simple Packet Block (optional)">
-<t>The Simple Packet Block is a lightweight container for storing the packets coming from the network. Its presence is optional.</t>
-<t>A Simple Packet Block is similar to a Packet Block (see <xref target="sectionpb"/>), but it is smaller, simpler to process and contains only a minimal set of information. This block is preferred to the standard Packet Block when performance or space occupation are critical factors, such as in sustained traffic dump applications. A capture file can contain both Packet Blocks and Simple Packet Blocks: for example, a capture tool could switch from Packet Blocks to Simple Packet Blocks when the hardware resources become critical.</t>
-<t>The Simple Packet Block does not contain the Interface ID field. Therefore, it must be assumed that all the Simple Packet Blocks have been captured on the interface previously specified in the Interface Description Block.</t>
-<t><xref target="formatpbs"/> shows the format of the Simple Packet Block.</t>
-
-<figure anchor="formatpbs" title="Simple Packet Block format.">
-<artwork>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                          Packet Len                           |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                                                               |
-   |                          Packet Data                          |
-   |                                                               |
-   |              /* variable length, byte-aligned */              |
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </artwork>
-</figure>
-
-<t>The Packet Block has the following fields:</t>
-<list style="symbols">
-<t>Packet Len: actual length of the packet when it was transmitted on the network. Can be different from captured len if the packet has been truncated.</t>
-<t>Packet data: the data coming from the network, including link-layers headers. The length of this field can be derived from the field Block Total Length, present in the Block Header.</t>
-</list>
-
-<t>The Simple Packet Block does not contain the timestamp because this is one of the most costly operations on PCs. Additionally, there are applications that do not require it; e.g. an Intrusion Detection System is interested in packets, not in their timestamp.</t>
-
-<t>The Simple Packet Block is very efficient in term of disk space: a snapshot of length 100 bytes requires only 16 bytes of overhead, which corresponds to an efficiency of more than 86%.</t>
-
-</section>
-
-
-
-<section title="Name Resolution Block (optional)">
-<t>The Name Resolution Block is used to support the correlation of numeric addresses (present in the captured packets) and their corresponding canonical names and it is optional. Having the literal names saved in the file, this prevents the need of a name resolution in a delayed time, when the association between names and addresses can be different from the one in use at capture time. Moreover, The Name Resolution Block avoids the need of issuing a lot of DNS requests every time the trace capture is opened, and allows to have name resolution also when reading the capture with a machine not connected to the network.</t>
-<t>The format of the Name Resolution Block is shown in <xref target="formatnrb"/>.</t>
-
-<figure anchor="formatnrb" title="Name Resolution Block format.">
-<artwork>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |      Record Type              |         Record Length         | 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                       Record Value                            |
-   |              /* variable length, byte-aligned */              |
-   |               + + + + + + + + + + + + + + + + + + + + + + + + +
-   |               |               |               |               |
-   +-+-+-+-+-+-+-+-+ + + + + + + + + + + + + + + + + + + + + + + + +
-             . . . other records . . .
-   |  Record Type == end_of_recs   |  Record Length == 00          |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </artwork>
-</figure>
-
-<t>A Name Resolution Block is a zero-terminated list of records (in the TLV format), each of which contains an association between a network address and a name. There are three possible types of records:</t>
-
-<texttable anchor="nrrecords">
-  <ttcol>Name</ttcol>
-  <ttcol>Code</ttcol>
-  <ttcol>Length</ttcol>
-  <ttcol>Description</ttcol>
-
-  <c>end_of_recs</c>
-  <c>0</c>
-  <c>0</c>
-  <c>End of records</c>
-
-  <c>ip4_rec</c>
-  <c>1</c>
-  <c>Variable</c>
-  <c>Specifies an IPv4 address (contained in the first 4 bytes), followed by one or more zero-terminated strings containing the DNS entries for that address.</c>
-
-  <c>ip6_rec</c>
-  <c>1</c>
-  <c>Variable</c>
-  <c>Specifies an IPv6 address (contained in the first 16 bytes), followed by one or more zero-terminated strings containing the DNS entries for that address.</c>
-</texttable>
-
-<t>After the list or Name Resolution Records, optionally, a list of options (formatted according to the rules defined in <xref target="sectionopt"/>) can be present.</t>
-
-<t>A Name Resolution Block is normally placed at the beginning of the file, but no assumptions can be taken about its position. Name Resolution Blocks can be added in a second time by tools that process the file, like network analyzers.</t>
-
-<t>In addiction to the options defined in <xref target="sectionopt"/>, the following options are valid within this block:</t>
-
-<texttable>
-  <ttcol>Name</ttcol>
-  <ttcol>Code</ttcol>
-  <ttcol>Length</ttcol>
-  <ttcol>Description</ttcol>
-
-  <c>ns_dnsname</c>
-  <c>2</c>
-  <c>Variable</c>
-  <c>An ascii string containing the name of the machine (DNS server) used to perform the name resolution.</c>
-</texttable>
-
-</section>
-
-
-<section title="Interface Statistics Block (optional)">
-<t>The Interface Statistics Block contains the capture statistics for a given interface and it is optional. The statistics are referred to the interface defined in the current Section identified by the Interface ID field.</t>
-<t>The format of the Interface Statistics Block is shown in <xref target="formatisb"/>.</t>
-
-<figure anchor="formatisb" title="Interface Statistics Block format.">
-<artwork>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         IfRecv                                |
-   |                          (high + low)                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         IfDrop                                |
-   |                          (high + low)                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         FilterAccept                          |
-   |                          (high + low)                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         OSDrop                                |
-   |                          (high + low)                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                         UsrDelivered                          |
-   |                          (high + low)                         |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |          Interface ID         |           Reserved            |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               / 
-   /                      Options (variable)                       / 
-   /                                                               / 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </artwork>
-</figure>
-
-<t>The fields have the following meaning:</t>
-
-<list style="symbols">
-<t>IfRecv: number of packets received from the interface during the capture. This number is reported as a 64 bits value, in which the most significat bits are located in the first four bytes of the field.</t>
-<t>IfDrop: number of packets dropped by the interface during the capture due to lack of resources.</t>
-<t>FilterAccept: number of packets accepeted by filter during current capture.</t>
-<t>OSDrop: number of packets dropped by the operating system during the capture.</t>
-<t>UsrDelivered: number of packets delivered to the user. UsrDelivered can be different from the value 'FilterAccept - OSDropped' because some packets could still lay in the OS buffers when the capture ended.</t>
-<t>Interface ID: reference to an Interface Description Block.</t>
-<t>Reserved: Reserved to future use.</t>
-<t>Options: optionally, a list of options (formatted according to the rules defined in <xref target="sectionopt"/>) can be present.</t>
-</list>
-
-<t>In addiction to the options defined in <xref target="sectionopt"/>, the following options are valid within this block:</t>
-
-<texttable>
-  <ttcol>Name</ttcol>
-  <ttcol>Code</ttcol>
-  <ttcol>Length</ttcol>
-  <ttcol>Description</ttcol>
-
-  <c>isb_starttime</c>
-  <c>2</c>
-  <c>8</c>
-  <c>Time in which the capture started; time will be stored in two blocks of four bytes each, containing the timestamp in seconds and nanoseconds.</c>
-
-  <c>isb_endtime</c>
-  <c>3</c>
-  <c>8</c>
-  <c>Time in which the capture started; time will be stored in two blocks of four bytes each, containing the timestamp in seconds and nanoseconds.</c>
-</texttable>
-
-</section>
-</section>
-
-
-
-<section anchor="sectionopt" title="Options">
-<t>Almost all blocks have the possibility to embed optional fields. Optional fields can be used to insert some information that may be useful when reading data, but that it is not really needed for packet processing. Therefore, each tool can be either read the content of the optional fields (if any), or skip them at once.</t>
-<t>Skipping all the optional fields at once is straightforward because most of the blocks have a fixed length, therefore the field Block Length (present in the General Block Structure, see  <xref target="sectionblock"/>) can be used to skip everything till the next block.</t>
-
-<t>Options are a list of Type - Length - Value fields, each one containing a single value:</t>
-
-<list style="symbols">
-<t>Option Type (2 bytes): it contains the code that specifies the type of the current TLV record. Option types whose Most Significant Bit is equal to one are reserved for local use; therefore, there is no guarantee that the code used is unique among all capture files (generated by other applications). In case of vendor-specific extensions that have to be identified uniquely, vendors must request an Option Code whose MSB is equal to zero.</t>
-<t>Option Length (2 bytes): it contains the length of the following 'Option Value' field.</t>
-<t>Option Value (variable length): it contains the value of the given option. The length of this field as been specified by the Option Length field.</t>
-</list>
-
-<t>Options may be repeated several times (e.g. an interface that has several IP addresses associated to it). The option list is terminated by a special code which is the 'End of Option'.</t>
-
-<t>The format of the optional fields is shown in <xref target="formatopt"/>.</t>
-
-<figure anchor="formatopt" title="Options format.">
-<artwork>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |      Option Code              |         Option Length         | 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                       Option Value                            |
-   |              /* variable length, byte-aligned */              |
-   |               + + + + + + + + + + + + + + + + + + + + + + + + +
-   |               /               /               /               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   /                                                               /
-   /                 . . . other options . . .                     /
-   /                                                               /
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |   Option Code == opt_endofopt  |  Option Length == 0          |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </artwork>
-</figure>
-
-<t>The following codes can always be present in any optional field:</t>
-
-<texttable>
-  <ttcol>Name</ttcol>
-  <ttcol>Code</ttcol>
-  <ttcol>Length</ttcol>
-  <ttcol>Description</ttcol>
-
-  <c>opt_endofopt</c>
-  <c>0</c>
-  <c>0</c>
-  <c>End of options: it is used to delimit the end of the optional fields. This block cannot be repeated within a given list of options.</c>
-
-  <c>opt_comment</c>
-  <c>1</c>
-  <c>variable</c>
-  <c>Comment: it is an ascii string containing a comment that is associated to the current block.</c>
-</texttable>
-
-</section>
-
-
-
-
-<section title="Experimental Blocks (deserved to a further investigation)">
-
-<section title="Other Packet Blocks (experimental)">
-<t>Can some other packet blocks (besides the two described in the previous paragraphs) be useful?</t>
-</section>
-
-<section title="Compression Block (experimental)">
-<t>The Compression Block is optional. A file can contain an arbitrary number of these blocks. A Compression Block, as the name says, is used to store compressed data. Its format is shown in <xref target="formatcb"/>.</t>
-
-<figure anchor="formatcb" title="Compression Block format.">
-<artwork>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |  Compr. Type  |                                               |
-   +-+-+-+-+-+-+-+-+                                               |
-   |                                                               |
-   |                       Compressed Data                         |
-   |                                                               |
-   |              /* variable length, byte-aligned */              |
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </artwork>
-</figure>
-
-<t>The fields have the following meaning:</t>
-
-<list style="symbols">
-<t>Compression Type: specifies the compression algorithm. Possible values for this field are 0 (uncompressed), 1 (Lempel Ziv), 2 (Gzip), other?? Probably some kind of dumb and fast compression algorithm could be effective with some types of traffic (for example web), but which?</t>
-<t>Compressed Data: data of this block. Once decompressed, it is made of other blocks.</t>
-</list>
-
-</section>
-
-
-<section title="Encryption Block (experimental)">
-<t>The Encryption Block is optional. A file can contain an arbitrary number of these blocks. An Encryption Block is used to sotre encrypted data. Its format is shown in <xref target="formateb"/>.</t>
-
-<figure anchor="formateb" title="Encryption Block format.">
-<artwork>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |   Encr. Type  |                                               |
-   +-+-+-+-+-+-+-+-+                                               |
-   |                                                               |
-   |                       Compressed Data                         |
-   |                                                               |
-   |              /* variable length, byte-aligned */              |
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </artwork>
-</figure>
-
-<t>The fields have the following meaning:</t>
-<list style="symbols">
-<t>Compression Type: specifies the encryption algorithm. Possible values for this field are ??? NOTE: this block should probably contain other fields, depending on the encryption algorithm. To be define precisely.</t>
-<t>Encrypted Data: data of this block. Once decripted, it consists of other blocks.</t>
-</list>
-
-</section>
-
-
-<section title="Fixed Length Block (experimental)">
-<t>The Fixed Length Block is optional. A file can contain an arbitrary number of these blocks. A Fixed Length Block can be used to optimize the access to the file. Its format is shown in <xref target="formatflm"/>.
-A Fixed Length Block stores records with constant size. It contains a set of Blocks (normally Packet Blocks or Simple Packet Blocks), of wihich it specifies the size. Knowing this size a priori helps to scan the file and to load some portions of it without truncating a block, and is particularly useful with cell-based networks like ATM.</t>
-
-<figure anchor="formatflm" title="Fixed Length Block format.">
-<artwork>
-    0                   1                   2                   3   
-    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |          Cell Size            |                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
-   |                                                               |
-   |                        Fixed Size Data                        |
-   |                                                               |
-   |              /* variable length, byte-aligned */              |
-   |                                                               |
-   |                                                               |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- </artwork>
-</figure>
-
-<t>The fields have the following meaning:</t>
-<list style="symbols">
-<t>Cell size: the size of the blocks contained in the data field.</t>
-<t>Fixed Size Data: data of this block.</t>
-</list>
-
-</section>
-
-<section title="Directory Block (experimental)">
-<t>If present, this block contains the following information:</t>
-<list style="symbols">
-<t>number of indexed packets (N)</t>
-<t>table with position and length of any indexed packet (N entries)</t>
-</list>
-
-<t>A directory block must be followed by at least N packets, otherwise it must be considered invalid. It can be used to efficiently load portions of the file to memory and to support operations on memory mapped files. This block can be added by tools like network analyzers as a consequence of file processing.</t>
-</section>
-
-<section title="Traffic Statistics and Monitoring Blocks (experimental)">
-<t>One or more blocks could be defined to contain network statistics or traffic monitoring information. They could be use to store data collected from RMON or Netflow probes, or from other network monitoring tools.</t>
-</section>
-
-<section title="Event/Security Block (experimental)">
-<t>This block could be used to store events. Events could contain generic information (for example network load over 50%, server down...) or security alerts. An event could be:</t>
-
-<list style="symbols">
-<t>skipped, if the application doesn't know how to do with it</t>
-<t>processed independently by the packets. In other words, the applications skips the packets and processes only the alerts</t>
-<t>processed in relation to packets: for example, a security tool could load only the packets of the file that are near a security alert; a monitorg tool could skip the packets captured while the server was down.</t>
-</list>
-
-</section>
-
-</section>
-
-
-
-
-<section title="Conclusions">
-<t>The file format proposed in this document should be very versatile and satisfy a wide range of applications.
-In the simplest case, it can contain a raw dump of the network data, made of a series of Simple Packet Blocks.
-In the most complex case, it can be used as a repository for heterogeneous information.
-In every case, the file remains easy to parse and an application can always skip the data it is not interested in; at the same time, different applications can share the file, and each of them can benfit of the information produced by the others.
-Two or more files can be concatenated obtaining another valid file.</t>
-</section>
-
-
-<section title="Most important open issues">
-<list style="symbols">
-<t>Data, in the file, must be byte or word aligned? Currently, the structure of this document is not consistent with respect to this point.</t>
-</list>
-</section>
-
-</middle>
-
-</rfc>
diff --git a/etherent.c b/etherent.c
index d9de114..707fd9d 100644
--- a/etherent.c
+++ b/etherent.c
@@ -19,11 +19,6 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/etherent.c,v 1.23 2006-10-04 18:09:22 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/ethertype.h b/ethertype.h
index 2d6bbeb..8bab881 100644
--- a/ethertype.h
+++ b/ethertype.h
@@ -17,8 +17,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/ethertype.h,v 1.14 2005-09-05 09:06:58 guy Exp $ (LBL)
  */
 
 /*
diff --git a/fad-getad.c b/fad-getad.c
index af371d4..6fd3360 100644
--- a/fad-getad.c
+++ b/fad-getad.c
@@ -32,11 +32,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/fad-getad.c,v 1.12 2007-09-14 00:44:55 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -146,7 +141,7 @@
  * Get a list of all interfaces that are up and that we can open.
  * Returns -1 on error, 0 otherwise.
  * The list, as returned through "alldevsp", may be null if no interfaces
- * were up and could be opened.
+ * could be opened.
  */
 int
 pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
@@ -162,10 +157,10 @@
 	 * Get the list of interface addresses.
 	 *
 	 * Note: this won't return information about interfaces
-	 * with no addresses; are there any such interfaces
-	 * that would be capable of receiving packets?
-	 * (Interfaces incapable of receiving packets aren't
-	 * very interesting from libpcap's point of view.)
+	 * with no addresses, so, if a platform has interfaces
+	 * with no interfaces on which traffic can be captured,
+	 * we must check for those interfaces as well (see, for
+	 * example, what's done on Linux).
 	 *
 	 * LAN interfaces will probably have link-layer
 	 * addresses; I don't know whether all implementations
@@ -179,34 +174,11 @@
 	}
 	for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
 		/*
-		 * Is this interface up?
-		 */
-		if (!(ifa->ifa_flags & IFF_UP)) {
-			/*
-			 * No, so don't add it to the list.
-			 */
-			continue;
-		}
-
-		/*
 		 * "ifa_addr" was apparently null on at least one
-		 * interface on some system.
-		 *
-		 * "ifa_broadaddr" may be non-null even on
-		 * non-broadcast interfaces, and was null on
-		 * at least one OpenBSD 3.4 system on at least
-		 * one interface with IFF_BROADCAST set.
-		 *
-		 * "ifa_dstaddr" was, on at least one FreeBSD 4.1
-		 * system, non-null on a non-point-to-point
-		 * interface.
-		 *
-		 * Therefore, we supply the address and netmask only
-		 * if "ifa_addr" is non-null (if there's no address,
-		 * there's obviously no netmask), and supply the
-		 * broadcast and destination addresses if the appropriate
-		 * flag is set *and* the appropriate "ifa_" entry doesn't
-		 * evaluate to a null pointer.
+		 * interface on some system.  Therefore, we supply
+		 * the address and netmask only if "ifa_addr" is
+		 * non-null (if there's no address, there's obviously
+		 * no netmask).
 		 */
 		if (ifa->ifa_addr != NULL) {
 			addr = ifa->ifa_addr;
@@ -217,6 +189,22 @@
 			addr_size = 0;
 			netmask = NULL;
 		}
+
+		/*
+		 * Note that, on some platforms, ifa_broadaddr and
+		 * ifa_dstaddr could be the same field (true on at
+		 * least some versions of *BSD and OS X), so we
+		 * can't just check whether the broadcast address
+		 * is null and add it if so and check whether the
+		 * destination address is null and add it if so.
+		 *
+		 * Therefore, we must also check the IFF_BROADCAST
+		 * flag, and only add a broadcast address if it's
+		 * set, and check the IFF_POINTTOPOINT flag, and
+		 * only add a destination address if it's set (as
+		 * per man page recommendations on some of those
+		 * platforms).
+		 */
 		if (ifa->ifa_flags & IFF_BROADCAST &&
 		    ifa->ifa_broadaddr != NULL) {
 			broadaddr = ifa->ifa_broadaddr;
diff --git a/fad-gifc.c b/fad-gifc.c
index d453518..b0a4105 100644
--- a/fad-gifc.c
+++ b/fad-gifc.c
@@ -32,11 +32,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/fad-gifc.c,v 1.12 2008-08-06 07:34:09 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -222,12 +217,12 @@
 		/*
 		 * XXX - The 32-bit compatibility layer for Linux on IA-64
 		 * is slightly broken. It correctly converts the structures
-		 * to and from kernel land from 64 bit to 32 bit but 
-		 * doesn't update ifc.ifc_len, leaving it larger than the 
-		 * amount really used. This means we read off the end 
-		 * of the buffer and encounter an interface with an 
-		 * "empty" name. Since this is highly unlikely to ever 
-		 * occur in a valid case we can just finish looking for 
+		 * to and from kernel land from 64 bit to 32 bit but
+		 * doesn't update ifc.ifc_len, leaving it larger than the
+		 * amount really used. This means we read off the end
+		 * of the buffer and encounter an interface with an
+		 * "empty" name. Since this is highly unlikely to ever
+		 * occur in a valid case we can just finish looking for
 		 * interfaces if we see an empty name.
 		 */
 		if (!(*ifrp->ifr_name))
@@ -242,8 +237,7 @@
 			continue;
 
 		/*
-		 * Get the flags for this interface, and skip it if it's
-		 * not up.
+		 * Get the flags for this interface.
 		 */
 		strncpy(ifrflags.ifr_name, ifrp->ifr_name,
 		    sizeof(ifrflags.ifr_name));
@@ -258,8 +252,6 @@
 			ret = -1;
 			break;
 		}
-		if (!(ifrflags.ifr_flags & IFF_UP))
-			continue;
 
 		/*
 		 * Get the netmask for this address on this interface.
diff --git a/fad-glifc.c b/fad-glifc.c
index b24b564..1a820ad 100644
--- a/fad-glifc.c
+++ b/fad-glifc.c
@@ -32,11 +32,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/fad-glifc.c,v 1.7 2008-01-30 09:35:48 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -208,8 +203,7 @@
 #endif
 
 		/*
-		 * Get the flags for this interface, and skip it if it's
-		 * not up.
+		 * Get the flags for this interface.
 		 */
 		strncpy(ifrflags.lifr_name, ifrp->lifr_name,
 		    sizeof(ifrflags.lifr_name));
@@ -224,8 +218,6 @@
 			ret = -1;
 			break;
 		}
-		if (!(ifrflags.lifr_flags & IFF_UP))
-			continue;
 
 		/*
 		 * Get the netmask for this address on this interface.
diff --git a/fad-null.c b/fad-null.c
index f6384fd..cecfbcb 100644
--- a/fad-null.c
+++ b/fad-null.c
@@ -32,11 +32,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/fad-null.c,v 1.2 2003-11-15 23:23:58 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/fad-sita.c b/fad-sita.c
index 76dcb2e..34ddf1d 100644
--- a/fad-sita.c
+++ b/fad-sita.c
@@ -24,8 +24,6 @@
  *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
- /* $Id: fad-sita.c */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/fad-win32.c b/fad-win32.c
index 6536695..0c856b1 100644
--- a/fad-win32.c
+++ b/fad-win32.c
@@ -12,9 +12,9 @@
  * 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. Neither the name of the Politecnico di Torino, CACE Technologies 
- * nor the names of its contributors may be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. Neither the name of the Politecnico di Torino, CACE Technologies
+ * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -31,11 +31,6 @@
  *
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/fad-win32.c,v 1.15 2007-09-25 20:34:36 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -45,102 +40,6 @@
 #include <Packet32.h>
 
 #include <errno.h>
-	
-/*
- * Add an entry to the list of addresses for an interface.
- * "curdev" is the entry for that interface.
- */
-static int
-add_addr_to_list(pcap_if_t *curdev, struct sockaddr *addr,
-    struct sockaddr *netmask, struct sockaddr *broadaddr,
-    struct sockaddr *dstaddr, char *errbuf)
-{
-	pcap_addr_t *curaddr, *prevaddr, *nextaddr;
-
-	/*
-	 * Allocate the new entry and fill it in.
-	 */
-	curaddr = (pcap_addr_t*)malloc(sizeof(pcap_addr_t));
-	if (curaddr == NULL) {
-		(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
-		    "malloc: %s", pcap_strerror(errno));
-		return (-1);
-	}
-
-	curaddr->next = NULL;
-	if (addr != NULL) {
-		curaddr->addr = (struct sockaddr*)dup_sockaddr(addr, sizeof(struct sockaddr_storage));
-		if (curaddr->addr == NULL) {
-			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
-			    "malloc: %s", pcap_strerror(errno));
-			free(curaddr);
-			return (-1);
-		}
-	} else
-		curaddr->addr = NULL;
-
-	if (netmask != NULL) {
-		curaddr->netmask = (struct sockaddr*)dup_sockaddr(netmask, sizeof(struct sockaddr_storage));
-		if (curaddr->netmask == NULL) {
-			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
-			    "malloc: %s", pcap_strerror(errno));
-			free(curaddr);
-			return (-1);
-		}
-	} else
-		curaddr->netmask = NULL;
-		
-	if (broadaddr != NULL) {
-		curaddr->broadaddr = (struct sockaddr*)dup_sockaddr(broadaddr, sizeof(struct sockaddr_storage));
-		if (curaddr->broadaddr == NULL) {
-			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
-			    "malloc: %s", pcap_strerror(errno));
-			free(curaddr);
-			return (-1);
-		}
-	} else
-		curaddr->broadaddr = NULL;
-		
-	if (dstaddr != NULL) {
-		curaddr->dstaddr = (struct sockaddr*)dup_sockaddr(dstaddr, sizeof(struct sockaddr_storage));
-		if (curaddr->dstaddr == NULL) {
-			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
-			    "malloc: %s", pcap_strerror(errno));
-			free(curaddr);
-			return (-1);
-		}
-	} else
-		curaddr->dstaddr = NULL;
-		
-	/*
-	 * Find the end of the list of addresses.
-	 */
-	for (prevaddr = curdev->addresses; prevaddr != NULL; prevaddr = nextaddr) {
-		nextaddr = prevaddr->next;
-		if (nextaddr == NULL) {
-			/*
-			 * This is the end of the list.
-			 */
-			break;
-		}
-	}
-
-	if (prevaddr == NULL) {
-		/*
-		 * The list was empty; this is the first member.
-		 */
-		curdev->addresses = curaddr;
-	} else {
-		/*
-		 * "prevaddr" is the last member of the list; append
-		 * this member to it.
-		 */
-		prevaddr->next = curaddr;
-	}
-
-	return (0);
-}
-
 
 static int
 pcap_add_if_win32(pcap_if_t **devlist, char *name, const char *desc,
@@ -189,12 +88,16 @@
 		 */
 		if(curdev == NULL)
 			break;
-		res = add_addr_to_list(curdev,
+		res = add_addr_to_dev(curdev,
 		    (struct sockaddr *)&if_addrs[if_addr_size].IPAddress,
+		    sizeof (struct sockaddr_storage),
 		    (struct sockaddr *)&if_addrs[if_addr_size].SubnetMask,
+		    sizeof (struct sockaddr_storage),
 		    (struct sockaddr *)&if_addrs[if_addr_size].Broadcast,
+		    sizeof (struct sockaddr_storage),
 		    NULL,
-			errbuf);
+		    0,
+		    errbuf);
 		if (res == -1) {
 			/*
 			 * Failure.
@@ -224,7 +127,7 @@
 	char *AdaptersName;
 	ULONG NameLength;
 	char *name;
-	
+
 	/*
 	 * Find out how big a buffer we need.
 	 *
@@ -267,7 +170,7 @@
 	{
 		snprintf(errbuf, PCAP_ERRBUF_SIZE, "Cannot allocate enough memory to list the adapters.");
 		return (-1);
-	}			
+	}
 
 	if (!PacketGetAdapterNames(AdaptersName, &NameLength)) {
 		snprintf(errbuf, PCAP_ERRBUF_SIZE,
@@ -276,7 +179,7 @@
 		free(AdaptersName);
 		return (-1);
 	}
-	
+
 	/*
 	 * "PacketGetAdapterNames()" returned a list of
 	 * null-terminated ASCII interface name strings,
@@ -292,7 +195,7 @@
 	desc = &AdaptersName[0];
 	while (*desc != '\0' || *(desc + 1) != '\0')
 		desc++;
-	
+
 	/*
  	 * Found it - "desc" points to the first of the two
 	 * nulls at the end of the list of names, so the
@@ -300,7 +203,7 @@
 	 * after it.
 	 */
 	desc += 2;
-	
+
 	/*
 	 * Loop over the elements in the first list.
 	 */
@@ -328,7 +231,7 @@
 		if (pcap_platform_finddevs(&devlist, errbuf) < 0)
 			ret = -1;
 	}
-	
+
 	if (ret == -1) {
 		/*
 		 * We had an error; free the list we've been constructing.
@@ -338,7 +241,7 @@
 			devlist = NULL;
 		}
 	}
-	
+
 	*alldevsp = devlist;
 	free(AdaptersName);
 	return (ret);
diff --git a/gencode.c b/gencode.c
index 7bb07fb..ad938d4 100644
--- a/gencode.c
+++ b/gencode.c
@@ -19,10 +19,6 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.309 2008-12-23 20:13:29 guy Exp $ (LBL)";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -107,6 +103,10 @@
 
 #define ETHERMTU	1500
 
+#ifndef ETHERTYPE_TEB
+#define ETHERTYPE_TEB 0x6558
+#endif
+
 #ifndef IPPROTO_HOPOPTS
 #define IPPROTO_HOPOPTS 0
 #endif
@@ -123,6 +123,8 @@
 #define IPPROTO_SCTP 132
 #endif
 
+#define GENEVE_PORT 6081
+
 #ifdef HAVE_OS_PROTO_H
 #include "os-proto.h"
 #endif
@@ -133,11 +135,11 @@
 static jmp_buf top_ctx;
 static pcap_t *bpf_pcap;
 
-/* Hack for updating VLAN, MPLS, and PPPoE offsets. */
+/* Hack for handling VLAN and MPLS stacks. */
 #ifdef WIN32
-static u_int	orig_linktype = (u_int)-1, orig_nl = (u_int)-1, label_stack_depth = (u_int)-1;
+static u_int	label_stack_depth = (u_int)-1, vlan_stack_depth = (u_int)-1;
 #else
-static u_int	orig_linktype = -1U, orig_nl = -1U, label_stack_depth = -1U;
+static u_int	label_stack_depth = -1U, vlan_stack_depth = -1U;
 #endif
 
 /* XXX */
@@ -167,17 +169,43 @@
 static struct block *root;
 
 /*
+ * Absolute offsets, which are offsets from the beginning of the raw
+ * packet data, are, in the general case, the sum of a variable value
+ * and a constant value; the variable value may be absent, in which
+ * case the offset is only the constant value, and the constant value
+ * may be zero, in which case the offset is only the variable value.
+ *
+ * bpf_abs_offset is a structure containing all that information:
+ *
+ *   is_variable is 1 if there's a variable part.
+ *
+ *   constant_part is the constant part of the value, possibly zero;
+ *
+ *   if is_variable is 1, reg is the register number for a register
+ *   containing the variable value if the register has been assigned,
+ *   and -1 otherwise.
+ */
+typedef struct {
+	int	is_variable;
+	u_int	constant_part;
+	int	reg;
+} bpf_abs_offset;
+
+/*
  * Value passed to gen_load_a() to indicate what the offset argument
- * is relative to.
+ * is relative to the beginning of.
  */
 enum e_offrel {
-	OR_PACKET,	/* relative to the beginning of the packet */
-	OR_LINK,	/* relative to the beginning of the link-layer header */
-	OR_MACPL,	/* relative to the end of the MAC-layer header */
-	OR_NET,		/* relative to the network-layer header */
-	OR_NET_NOSNAP,	/* relative to the network-layer header, with no SNAP header at the link layer */
-	OR_TRAN_IPV4,	/* relative to the transport-layer header, with IPv4 network layer */
-	OR_TRAN_IPV6	/* relative to the transport-layer header, with IPv6 network layer */
+	OR_PACKET,		/* full packet data */
+	OR_LINKHDR,		/* link-layer header */
+	OR_PREVLINKHDR,		/* previous link-layer header */
+	OR_LLC,			/* 802.2 LLC header */
+	OR_PREVMPLSHDR,		/* previous MPLS header */
+	OR_LINKTYPE,		/* link-layer type */
+	OR_LINKPL,		/* link-layer payload */
+	OR_LINKPL_NOSNAP,	/* link-layer payload, with no SNAP header at the link layer */
+	OR_TRAN_IPV4,		/* transport-layer header, with IPv4 network layer */
+	OR_TRAN_IPV6		/* transport-layer header, with IPv6 network layer */
 };
 
 #ifdef INET6
@@ -228,8 +256,7 @@
 static struct block *gen_bcmp(enum e_offrel, u_int, u_int, const u_char *);
 static struct block *gen_ncmp(enum e_offrel, bpf_u_int32, bpf_u_int32,
     bpf_u_int32, bpf_u_int32, int, bpf_int32);
-static struct slist *gen_load_llrel(u_int, u_int);
-static struct slist *gen_load_macplrel(u_int, u_int);
+static struct slist *gen_load_absoffsetrel(bpf_abs_offset *, u_int, u_int);
 static struct slist *gen_load_a(enum e_offrel, u_int, u_int);
 static struct slist *gen_loadx_iphdrlen(void);
 static struct block *gen_uncond(int);
@@ -243,8 +270,7 @@
 static struct slist *gen_load_radiotap_llprefixlen(void);
 static struct slist *gen_load_ppi_llprefixlen(void);
 static void insert_compute_vloffsets(struct block *);
-static struct slist *gen_llprefixlen(void);
-static struct slist *gen_off_macpl(void);
+static struct slist *gen_abs_offset_varpart(bpf_abs_offset *);
 static int ethertype_to_ppptype(int);
 static struct block *gen_linktype(int);
 static struct block *gen_snap(bpf_u_int32, bpf_u_int32);
@@ -289,6 +315,7 @@
 static struct block *gen_mac_multicast(int);
 static struct block *gen_len(int, int);
 static struct block *gen_check_802_11_data_frame(void);
+static struct block *gen_geneve_ll_check(void);
 
 static struct block *gen_ppi_dlt_check(void);
 static struct block *gen_msg_abbrev(int type);
@@ -398,38 +425,30 @@
 static bpf_u_int32 netmask;
 static int snaplen;
 int no_optimize;
-#ifdef WIN32
-static int
-pcap_compile_unsafe(pcap_t *p, struct bpf_program *program,
-	     const char *buf, int optimize, bpf_u_int32 mask);
 
 int
 pcap_compile(pcap_t *p, struct bpf_program *program,
 	     const char *buf, int optimize, bpf_u_int32 mask)
 {
-	int result;
-
-	EnterCriticalSection(&g_PcapCompileCriticalSection);
-
-	result = pcap_compile_unsafe(p, program, buf, optimize, mask);
-
-	LeaveCriticalSection(&g_PcapCompileCriticalSection);
-	
-	return result;
-}
-
-static int
-pcap_compile_unsafe(pcap_t *p, struct bpf_program *program,
-	     const char *buf, int optimize, bpf_u_int32 mask)
-#else /* WIN32 */
-int
-pcap_compile(pcap_t *p, struct bpf_program *program,
-	     const char *buf, int optimize, bpf_u_int32 mask)
-#endif /* WIN32 */
-{
 	extern int n_errors;
 	const char * volatile xbuf = buf;
 	u_int len;
+	int  rc;
+
+	/*
+	 * XXX - single-thread this code path with pthread calls on
+	 * UN*X, if the platform supports pthreads?  If that requires
+	 * a separate -lpthread, we might not want to do that.
+	 */
+#ifdef WIN32
+	extern int wsockinit (void);
+	static int done = 0;
+
+	if (!done)
+		wsockinit();
+	done = 1;
+	EnterCriticalSection(&g_PcapCompileCriticalSection);
+#endif
 
 	/*
 	 * If this pcap_t hasn't been activated, it doesn't have a
@@ -438,13 +457,15 @@
 	if (!p->activated) {
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
 		    "not-yet-activated pcap_t passed to pcap_compile");
-		return (-1);
+		rc = -1;
+		goto quit;
 	}
 	no_optimize = 0;
 	n_errors = 0;
 	root = NULL;
 	bpf_pcap = p;
 	init_regs();
+
 	if (setjmp(top_ctx)) {
 #ifdef INET6
 		if (ai != NULL) {
@@ -454,7 +475,8 @@
 #endif
 		lex_cleanup();
 		freechunks();
-		return (-1);
+		rc = -1;
+		goto quit;
 	}
 
 	netmask = mask;
@@ -463,7 +485,8 @@
 	if (snaplen == 0) {
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
 			 "snaplen of 0 rejects all packets");
-		return -1;
+		rc = -1;
+		goto quit;
 	}
 
 	lex_init(xbuf ? xbuf : "");
@@ -487,7 +510,16 @@
 
 	lex_cleanup();
 	freechunks();
-	return (0);
+
+	rc = 0;  /* We're all okay */
+
+quit:
+
+#ifdef WIN32
+	LeaveCriticalSection(&g_PcapCompileCriticalSection);
+#endif
+
+	return (rc);
 }
 
 /*
@@ -592,7 +624,7 @@
 	 * worth the effort.
 	 */
 	insert_compute_vloffsets(p->head);
-	
+
 	/*
 	 * For DLT_PPI captures, generate a check of the per-packet
 	 * DLT value to make sure it's DLT_IEEE802_11.
@@ -764,74 +796,62 @@
 }
 
 /*
- * Various code constructs need to know the layout of the data link
- * layer.  These variables give the necessary offsets from the beginning
+ * Various code constructs need to know the layout of the packet.
+ * These variables give the necessary offsets from the beginning
  * of the packet data.
  */
 
 /*
- * This is the offset of the beginning of the link-layer header from
- * the beginning of the raw packet data.
- *
- * It's usually 0, except for 802.11 with a fixed-length radio header.
- * (For 802.11 with a variable-length radio header, we have to generate
- * code to compute that offset; off_ll is 0 in that case.)
+ * Absolute offset of the beginning of the link-layer header.
  */
-static u_int off_ll;
+static bpf_abs_offset off_linkhdr;
 
 /*
- * If there's a variable-length header preceding the link-layer header,
- * "reg_off_ll" is the register number for a register containing the
- * length of that header, and therefore the offset of the link-layer
- * header from the beginning of the raw packet data.  Otherwise,
- * "reg_off_ll" is -1.
+ * If we're checking a link-layer header for a packet encapsulated in
+ * another protocol layer, this is the equivalent information for the
+ * previous layers' link-layer header from the beginning of the raw
+ * packet data.
  */
-static int reg_off_ll;
+static bpf_abs_offset off_prevlinkhdr;
 
 /*
- * This is the offset of the beginning of the MAC-layer header from
- * the beginning of the link-layer header.
- * It's usually 0, except for ATM LANE, where it's the offset, relative
- * to the beginning of the raw packet data, of the Ethernet header, and
- * for Ethernet with various additional information.
+ * This is the equivalent information for the outermost layers' link-layer
+ * header.
  */
-static u_int off_mac;
+static bpf_abs_offset off_outermostlinkhdr;
 
 /*
- * This is the offset of the beginning of the MAC-layer payload,
- * from the beginning of the raw packet data.
- *
- * I.e., it's the sum of the length of the link-layer header (without,
- * for example, any 802.2 LLC header, so it's the MAC-layer
- * portion of that header), plus any prefix preceding the
- * link-layer header.
+ * "Push" the current value of the link-layer header type and link-layer
+ * header offset onto a "stack", and set a new value.  (It's not a
+ * full-blown stack; we keep only the top two items.)
  */
-static u_int off_macpl;
+#define PUSH_LINKHDR(new_linktype, new_is_variable, new_constant_part, new_reg) \
+{ \
+	prevlinktype = new_linktype; \
+	off_prevlinkhdr = off_linkhdr; \
+	linktype = new_linktype; \
+	off_linkhdr.is_variable = new_is_variable; \
+	off_linkhdr.constant_part = new_constant_part; \
+	off_linkhdr.reg = new_reg; \
+	is_geneve = 0; \
+}
 
 /*
- * This is 1 if the offset of the beginning of the MAC-layer payload
- * from the beginning of the link-layer header is variable-length.
+ * Absolute offset of the beginning of the link-layer payload.
  */
-static int off_macpl_is_variable;
-
-/*
- * If the link layer has variable_length headers, "reg_off_macpl"
- * is the register number for a register containing the length of the
- * link-layer header plus the length of any variable-length header
- * preceding the link-layer header.  Otherwise, "reg_off_macpl"
- * is -1.
- */
-static int reg_off_macpl;
+static bpf_abs_offset off_linkpl;
 
 /*
  * "off_linktype" is the offset to information in the link-layer header
- * giving the packet type.  This offset is relative to the beginning
- * of the link-layer header (i.e., it doesn't include off_ll).
+ * giving the packet type. This is an absolute offset from the beginning
+ * of the packet.
  *
- * For Ethernet, it's the offset of the Ethernet type field.
+ * For Ethernet, it's the offset of the Ethernet type field; this
+ * means that it must have a value that skips VLAN tags.
  *
  * For link-layer types that always use 802.2 headers, it's the
- * offset of the LLC header.
+ * offset of the LLC header; this means that it must have a value
+ * that skips VLAN tags.
  *
  * For PPP, it's the offset of the PPP type field.
  *
@@ -841,16 +861,10 @@
  *
  * For Linux cooked sockets, it's the offset of the type field.
  *
- * It's set to -1 for no encapsulation, in which case, IP is assumed.
+ * off_linktype.constant_part is set to -1 for no encapsulation,
+ * in which case, IP is assumed.
  */
-static u_int off_linktype;
-
-/*
- * TRUE if "pppoes" appeared in the filter; it causes link-layer type
- * checks to check the PPP header, assumed to follow a LAN-style link-
- * layer header and a PPPoE session header.
- */
-static int is_pppoes = 0;
+static bpf_abs_offset off_linktype;
 
 /*
  * TRUE if the link layer includes an ATM pseudo-header.
@@ -858,10 +872,11 @@
 static int is_atm = 0;
 
 /*
- * TRUE if "lane" appeared in the filter; it causes us to generate
- * code that assumes LANE rather than LLC-encapsulated traffic in SunATM.
+ * TRUE if "geneve" appeared in the filter; it causes us to generate
+ * code that checks for a Geneve header and assume that later filters
+ * apply to the encapsulated payload.
  */
-static int is_lane = 0;
+static int is_geneve = 0;
 
 /*
  * These are offsets for the ATM pseudo-header.
@@ -892,8 +907,8 @@
 
 /*
  * These are offsets to the beginning of the network-layer header.
- * They are relative to the beginning of the MAC-layer payload (i.e.,
- * they don't include off_ll or off_macpl).
+ * They are relative to the beginning of the link-layer payload (i.e.,
+ * they don't include off_linkhdr.constant_part or off_linkpl.constant_part).
  *
  * If the link layer never uses 802.2 LLC:
  *
@@ -918,29 +933,57 @@
 static u_int off_nl_nosnap;
 
 static int linktype;
+static int prevlinktype;
+static int outermostlinktype;
 
 static void
 init_linktype(p)
 	pcap_t *p;
 {
-	linktype = pcap_datalink(p);
 	pcap_fddipad = p->fddipad;
 
 	/*
+	 * We start out with only one link-layer header.
+	 */
+	outermostlinktype = pcap_datalink(p);
+	off_outermostlinkhdr.constant_part = 0;
+	off_outermostlinkhdr.is_variable = 0;
+	off_outermostlinkhdr.reg = -1;
+
+	prevlinktype = outermostlinktype;
+	off_prevlinkhdr.constant_part = 0;
+	off_prevlinkhdr.is_variable = 0;
+	off_prevlinkhdr.reg = -1;
+
+	linktype = outermostlinktype;
+	off_linkhdr.constant_part = 0;
+	off_linkhdr.is_variable = 0;
+	off_linkhdr.reg = -1;
+
+	/*
+	 * XXX
+	 */
+	off_linkpl.constant_part = 0;
+	off_linkpl.is_variable = 0;
+	off_linkpl.reg = -1;
+
+	off_linktype.constant_part = 0;
+	off_linktype.is_variable = 0;
+	off_linktype.reg = -1;
+
+	/*
 	 * Assume it's not raw ATM with a pseudo-header, for now.
 	 */
-	off_mac = 0;
 	is_atm = 0;
-	is_lane = 0;
 	off_vpi = -1;
 	off_vci = -1;
 	off_proto = -1;
 	off_payload = -1;
 
 	/*
-	 * And that we're not doing PPPoE.
+	 * And not Geneve.
 	 */
-	is_pppoes = 0;
+	is_geneve = 0;
 
 	/*
 	 * And assume we're not doing SS7.
@@ -952,105 +995,94 @@
 	off_dpc = -1;
 	off_sls = -1;
 
-	/*
-	 * Also assume it's not 802.11.
-	 */
-	off_ll = 0;
-	off_macpl = 0;
-	off_macpl_is_variable = 0;
-
-	orig_linktype = -1;
-	orig_nl = -1;
         label_stack_depth = 0;
-
-	reg_off_ll = -1;
-	reg_off_macpl = -1;
+        vlan_stack_depth = 0;
 
 	switch (linktype) {
 
 	case DLT_ARCNET:
-		off_linktype = 2;
-		off_macpl = 6;
+		off_linktype.constant_part = 2;
+		off_linkpl.constant_part = 6;
 		off_nl = 0;		/* XXX in reality, variable! */
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_ARCNET_LINUX:
-		off_linktype = 4;
-		off_macpl = 8;
+		off_linktype.constant_part = 4;
+		off_linkpl.constant_part = 8;
 		off_nl = 0;		/* XXX in reality, variable! */
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_EN10MB:
-		off_linktype = 12;
-		off_macpl = 14;		/* Ethernet header length */
+		off_linktype.constant_part = 12;
+		off_linkpl.constant_part = 14;	/* Ethernet header length */
 		off_nl = 0;		/* Ethernet II */
 		off_nl_nosnap = 3;	/* 802.3+802.2 */
-		return;
+		break;
 
 	case DLT_SLIP:
 		/*
 		 * SLIP doesn't have a link level type.  The 16 byte
 		 * header is hacked into our SLIP driver.
 		 */
-		off_linktype = -1;
-		off_macpl = 16;
+		off_linktype.constant_part = -1;
+		off_linkpl.constant_part = 16;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_SLIP_BSDOS:
 		/* XXX this may be the same as the DLT_PPP_BSDOS case */
-		off_linktype = -1;
+		off_linktype.constant_part = -1;
 		/* XXX end */
-		off_macpl = 24;
+		off_linkpl.constant_part = 24;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_NULL:
 	case DLT_LOOP:
-		off_linktype = 0;
-		off_macpl = 4;
+		off_linktype.constant_part = 0;
+		off_linkpl.constant_part = 4;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_ENC:
-		off_linktype = 0;
-		off_macpl = 12;
+		off_linktype.constant_part = 0;
+		off_linkpl.constant_part = 12;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_PPP:
 	case DLT_PPP_PPPD:
 	case DLT_C_HDLC:		/* BSD/OS Cisco HDLC */
 	case DLT_PPP_SERIAL:		/* NetBSD sync/async serial PPP */
-		off_linktype = 2;
-		off_macpl = 4;
+		off_linktype.constant_part = 2;	/* skip HDLC-like framing */
+		off_linkpl.constant_part = 4;	/* skip HDLC-like framing and protocol field */
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_PPP_ETHER:
 		/*
 		 * This does no include the Ethernet header, and
 		 * only covers session state.
 		 */
-		off_linktype = 6;
-		off_macpl = 8;
+		off_linktype.constant_part = 6;
+		off_linkpl.constant_part = 8;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_PPP_BSDOS:
-		off_linktype = 5;
-		off_macpl = 24;
+		off_linktype.constant_part = 5;
+		off_linkpl.constant_part = 24;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_FDDI:
 		/*
@@ -1061,13 +1093,13 @@
 		 * is being used and pick out the encapsulated Ethernet type.
 		 * XXX - should we generate code to check for SNAP?
 		 */
-		off_linktype = 13;
-		off_linktype += pcap_fddipad;
-		off_macpl = 13;		/* FDDI MAC header length */
-		off_macpl += pcap_fddipad;
+		off_linktype.constant_part = 13;
+		off_linktype.constant_part += pcap_fddipad;
+		off_linkpl.constant_part = 13;	/* FDDI MAC header length */
+		off_linkpl.constant_part += pcap_fddipad;
 		off_nl = 8;		/* 802.2+SNAP */
 		off_nl_nosnap = 3;	/* 802.2 */
-		return;
+		break;
 
 	case DLT_IEEE802:
 		/*
@@ -1093,19 +1125,24 @@
 		 * the 16-bit value at an offset of 14 (shifted right
 		 * 8 - figure out which byte that is).
 		 */
-		off_linktype = 14;
-		off_macpl = 14;		/* Token Ring MAC header length */
+		off_linktype.constant_part = 14;
+		off_linkpl.constant_part = 14;	/* Token Ring MAC header length */
 		off_nl = 8;		/* 802.2+SNAP */
 		off_nl_nosnap = 3;	/* 802.2 */
-		return;
+		break;
 
-	case DLT_IEEE802_11:
 	case DLT_PRISM_HEADER:
 	case DLT_IEEE802_11_RADIO_AVS:
 	case DLT_IEEE802_11_RADIO:
+		off_linkhdr.is_variable = 1;
+		/* Fall through, 802.11 doesn't have a variable link
+		 * prefix but is otherwise the same. */
+
+	case DLT_IEEE802_11:
 		/*
 		 * 802.11 doesn't really have a link-level type field.
-		 * We set "off_linktype" to the offset of the LLC header.
+		 * We set "off_linktype.constant_part" to the offset of
+		 * the LLC header.
 		 *
 		 * To check for Ethernet types, we assume that SSAP = SNAP
 		 * is being used and pick out the encapsulated Ethernet type.
@@ -1120,15 +1157,15 @@
 		 * header or an AVS header, so, in practice, it's
 		 * variable-length.
 		 */
-		off_linktype = 24;
-		off_macpl = 0;		/* link-layer header is variable-length */
-		off_macpl_is_variable = 1;
+		off_linktype.constant_part = 24;
+		off_linkpl.constant_part = 0;	/* link-layer header is variable-length */
+		off_linkpl.is_variable = 1;
 		off_nl = 8;		/* 802.2+SNAP */
 		off_nl_nosnap = 3;	/* 802.2 */
-		return;
+		break;
 
 	case DLT_PPI:
-		/* 
+		/*
 		 * At the moment we treat PPI the same way that we treat
 		 * normal Radiotap encoded packets. The difference is in
 		 * the function that generates the code at the beginning
@@ -1137,12 +1174,13 @@
 		 * the encapsulated DLT should be DLT_IEEE802_11) we
 		 * generate code to check for this too.
 		 */
-		off_linktype = 24;
-		off_macpl = 0;		/* link-layer header is variable-length */
-		off_macpl_is_variable = 1;
+		off_linktype.constant_part = 24;
+		off_linkpl.constant_part = 0;	/* link-layer header is variable-length */
+		off_linkpl.is_variable = 1;
+		off_linkhdr.is_variable = 1;
 		off_nl = 8;		/* 802.2+SNAP */
 		off_nl_nosnap = 3;	/* 802.2 */
-		return;
+		break;
 
 	case DLT_ATM_RFC1483:
 	case DLT_ATM_CLIP:	/* Linux ATM defines this */
@@ -1157,11 +1195,11 @@
 		 * or "pppoa and tcp port 80" and have it check for
 		 * PPPo{A,E} and a PPP protocol of IP and....
 		 */
-		off_linktype = 0;
-		off_macpl = 0;		/* packet begins with LLC header */
+		off_linktype.constant_part = 0;
+		off_linkpl.constant_part = 0;	/* packet begins with LLC header */
 		off_nl = 8;		/* 802.2+SNAP */
 		off_nl_nosnap = 3;	/* 802.2 */
-		return;
+		break;
 
 	case DLT_SUNATM:
 		/*
@@ -1172,29 +1210,28 @@
 		off_vpi = SUNATM_VPI_POS;
 		off_vci = SUNATM_VCI_POS;
 		off_proto = PROTO_POS;
-		off_mac = -1;	/* assume LLC-encapsulated, so no MAC-layer header */
 		off_payload = SUNATM_PKT_BEGIN_POS;
-		off_linktype = off_payload;
-		off_macpl = off_payload;	/* if LLC-encapsulated */
+		off_linktype.constant_part = off_payload;
+		off_linkpl.constant_part = off_payload;	/* if LLC-encapsulated */
 		off_nl = 8;		/* 802.2+SNAP */
 		off_nl_nosnap = 3;	/* 802.2 */
-		return;
+		break;
 
 	case DLT_RAW:
 	case DLT_IPV4:
 	case DLT_IPV6:
-		off_linktype = -1;
-		off_macpl = 0;
+		off_linktype.constant_part = -1;
+		off_linkpl.constant_part = 0;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_LINUX_SLL:	/* fake header for Linux cooked socket */
-		off_linktype = 14;
-		off_macpl = 16;
+		off_linktype.constant_part = 14;
+		off_linkpl.constant_part = 16;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_LTALK:
 		/*
@@ -1202,11 +1239,11 @@
 		 * but really it just indicates whether there is a "short" or
 		 * "long" DDP packet following.
 		 */
-		off_linktype = -1;
-		off_macpl = 0;
+		off_linktype.constant_part = -1;
+		off_linkpl.constant_part = 0;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_IP_OVER_FC:
 		/*
@@ -1219,22 +1256,22 @@
 		 * XXX - should we generate code to check for SNAP? RFC
 		 * 2625 says SNAP should be used.
 		 */
-		off_linktype = 16;
-		off_macpl = 16;
+		off_linktype.constant_part = 16;
+		off_linkpl.constant_part = 16;
 		off_nl = 8;		/* 802.2+SNAP */
 		off_nl_nosnap = 3;	/* 802.2 */
-		return;
+		break;
 
 	case DLT_FRELAY:
 		/*
 		 * XXX - we should set this to handle SNAP-encapsulated
 		 * frames (NLPID of 0x80).
 		 */
-		off_linktype = -1;
-		off_macpl = 0;
+		off_linktype.constant_part = -1;
+		off_linkpl.constant_part = 0;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
                 /*
                  * the only BPF-interesting FRF.16 frames are non-control frames;
@@ -1242,33 +1279,33 @@
                  * so lets start with offset 4 for now and increments later on (FIXME);
                  */
 	case DLT_MFR:
-		off_linktype = -1;
-		off_macpl = 0;
+		off_linktype.constant_part = -1;
+		off_linkpl.constant_part = 0;
 		off_nl = 4;
 		off_nl_nosnap = 0;	/* XXX - for now -> no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_APPLE_IP_OVER_IEEE1394:
-		off_linktype = 16;
-		off_macpl = 18;
+		off_linktype.constant_part = 16;
+		off_linkpl.constant_part = 18;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_SYMANTEC_FIREWALL:
-		off_linktype = 6;
-		off_macpl = 44;
+		off_linktype.constant_part = 6;
+		off_linkpl.constant_part = 44;
 		off_nl = 0;		/* Ethernet II */
 		off_nl_nosnap = 0;	/* XXX - what does it do with 802.3 packets? */
-		return;
+		break;
 
 #ifdef HAVE_NET_PFVAR_H
 	case DLT_PFLOG:
-		off_linktype = 0;
-		off_macpl = PFLOG_HDRLEN;
+		off_linktype.constant_part = 0;
+		off_linkpl.constant_part = PFLOG_HDRLEN;
 		off_nl = 0;
 		off_nl_nosnap = 0;	/* no 802.2 LLC */
-		return;
+		break;
 #endif
 
         case DLT_JUNIPER_MFR:
@@ -1277,108 +1314,108 @@
         case DLT_JUNIPER_PPP:
         case DLT_JUNIPER_CHDLC:
         case DLT_JUNIPER_FRELAY:
-                off_linktype = 4;
-		off_macpl = 4;
+                off_linktype.constant_part = 4;
+		off_linkpl.constant_part = 4;
 		off_nl = 0;
 		off_nl_nosnap = -1;	/* no 802.2 LLC */
-                return;
+                break;
 
 	case DLT_JUNIPER_ATM1:
-		off_linktype = 4;	/* in reality variable between 4-8 */
-		off_macpl = 4;	/* in reality variable between 4-8 */
+		off_linktype.constant_part = 4;		/* in reality variable between 4-8 */
+		off_linkpl.constant_part = 4;	/* in reality variable between 4-8 */
 		off_nl = 0;
 		off_nl_nosnap = 10;
-		return;
+		break;
 
 	case DLT_JUNIPER_ATM2:
-		off_linktype = 8;	/* in reality variable between 8-12 */
-		off_macpl = 8;	/* in reality variable between 8-12 */
+		off_linktype.constant_part = 8;		/* in reality variable between 8-12 */
+		off_linkpl.constant_part = 8;	/* in reality variable between 8-12 */
 		off_nl = 0;
 		off_nl_nosnap = 10;
-		return;
+		break;
 
 		/* frames captured on a Juniper PPPoE service PIC
 		 * contain raw ethernet frames */
 	case DLT_JUNIPER_PPPOE:
         case DLT_JUNIPER_ETHER:
-        	off_macpl = 14;
-		off_linktype = 16;
+        	off_linkpl.constant_part = 14;
+		off_linktype.constant_part = 16;
 		off_nl = 18;		/* Ethernet II */
 		off_nl_nosnap = 21;	/* 802.3+802.2 */
-		return;
+		break;
 
 	case DLT_JUNIPER_PPPOE_ATM:
-		off_linktype = 4;
-		off_macpl = 6;
+		off_linktype.constant_part = 4;
+		off_linkpl.constant_part = 6;
 		off_nl = 0;
 		off_nl_nosnap = -1;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_JUNIPER_GGSN:
-		off_linktype = 6;
-		off_macpl = 12;
+		off_linktype.constant_part = 6;
+		off_linkpl.constant_part = 12;
 		off_nl = 0;
 		off_nl_nosnap = -1;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_JUNIPER_ES:
-		off_linktype = 6;
-		off_macpl = -1;		/* not really a network layer but raw IP addresses */
+		off_linktype.constant_part = 6;
+		off_linkpl.constant_part = -1;	/* not really a network layer but raw IP addresses */
 		off_nl = -1;		/* not really a network layer but raw IP addresses */
 		off_nl_nosnap = -1;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_JUNIPER_MONITOR:
-		off_linktype = 12;
-		off_macpl = 12;
+		off_linktype.constant_part = 12;
+		off_linkpl.constant_part = 12;
 		off_nl = 0;		/* raw IP/IP6 header */
 		off_nl_nosnap = -1;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_BACNET_MS_TP:
-		off_linktype = -1;
-		off_macpl = -1;
+		off_linktype.constant_part = -1;
+		off_linkpl.constant_part = -1;
 		off_nl = -1;
 		off_nl_nosnap = -1;
-		return;
+		break;
 
 	case DLT_JUNIPER_SERVICES:
-		off_linktype = 12;
-		off_macpl = -1;		/* L3 proto location dep. on cookie type */
+		off_linktype.constant_part = 12;
+		off_linkpl.constant_part = -1;	/* L3 proto location dep. on cookie type */
 		off_nl = -1;		/* L3 proto location dep. on cookie type */
 		off_nl_nosnap = -1;	/* no 802.2 LLC */
-		return;
+		break;
 
 	case DLT_JUNIPER_VP:
-		off_linktype = 18;
-		off_macpl = -1;
+		off_linktype.constant_part = 18;
+		off_linkpl.constant_part = -1;
 		off_nl = -1;
 		off_nl_nosnap = -1;
-		return;
+		break;
 
 	case DLT_JUNIPER_ST:
-		off_linktype = 18;
-		off_macpl = -1;
+		off_linktype.constant_part = 18;
+		off_linkpl.constant_part = -1;
 		off_nl = -1;
 		off_nl_nosnap = -1;
-		return;
+		break;
 
 	case DLT_JUNIPER_ISM:
-		off_linktype = 8;
-		off_macpl = -1;
+		off_linktype.constant_part = 8;
+		off_linkpl.constant_part = -1;
 		off_nl = -1;
 		off_nl_nosnap = -1;
-		return;
+		break;
 
 	case DLT_JUNIPER_VS:
 	case DLT_JUNIPER_SRX_E2E:
 	case DLT_JUNIPER_FIBRECHANNEL:
 	case DLT_JUNIPER_ATM_CEMIC:
-		off_linktype = 8;
-		off_macpl = -1;
+		off_linktype.constant_part = 8;
+		off_linkpl.constant_part = -1;
 		off_nl = -1;
 		off_nl_nosnap = -1;
-		return;
+		break;
 
 	case DLT_MTP2:
 		off_li = 2;
@@ -1387,11 +1424,11 @@
 		off_opc = 4;
 		off_dpc = 4;
 		off_sls = 7;
-		off_linktype = -1;
-		off_macpl = -1;
+		off_linktype.constant_part = -1;
+		off_linkpl.constant_part = -1;
 		off_nl = -1;
 		off_nl_nosnap = -1;
-		return;
+		break;
 
 	case DLT_MTP2_WITH_PHDR:
 		off_li = 6;
@@ -1400,11 +1437,11 @@
 		off_opc = 8;
 		off_dpc = 8;
 		off_sls = 11;
-		off_linktype = -1;
-		off_macpl = -1;
+		off_linktype.constant_part = -1;
+		off_linkpl.constant_part = -1;
 		off_nl = -1;
 		off_nl_nosnap = -1;
-		return;
+		break;
 
 	case DLT_ERF:
 		off_li = 22;
@@ -1413,52 +1450,51 @@
 		off_opc = 24;
 		off_dpc = 24;
 		off_sls = 27;
-		off_linktype = -1;
-		off_macpl = -1;
+		off_linktype.constant_part = -1;
+		off_linkpl.constant_part = -1;
 		off_nl = -1;
 		off_nl_nosnap = -1;
-		return;
+		break;
 
 	case DLT_PFSYNC:
-		off_linktype = -1;
-		off_macpl = 4;
+		off_linktype.constant_part = -1;
+		off_linkpl.constant_part = 4;
 		off_nl = 0;
 		off_nl_nosnap = 0;
-		return;
+		break;
 
 	case DLT_AX25_KISS:
 		/*
 		 * Currently, only raw "link[N:M]" filtering is supported.
 		 */
-		off_linktype = -1;	/* variable, min 15, max 71 steps of 7 */
-		off_macpl = -1;
+		off_linktype.constant_part = -1;	/* variable, min 15, max 71 steps of 7 */
+		off_linkpl.constant_part = -1;
 		off_nl = -1;		/* variable, min 16, max 71 steps of 7 */
 		off_nl_nosnap = -1;	/* no 802.2 LLC */
-		off_mac = 1;		/* step over the kiss length byte */
-		return;
+		break;
 
 	case DLT_IPNET:
-		off_linktype = 1;
-		off_macpl = 24;		/* ipnet header length */
+		off_linktype.constant_part = 1;
+		off_linkpl.constant_part = 24;	/* ipnet header length */
 		off_nl = 0;
 		off_nl_nosnap = -1;
-		return;
+		break;
 
 	case DLT_NETANALYZER:
-		off_mac = 4;		/* MAC header is past 4-byte pseudo-header */
-		off_linktype = 16;	/* includes 4-byte pseudo-header */
-		off_macpl = 18;		/* pseudo-header+Ethernet header length */
+		off_linkhdr.constant_part = 4;	/* Ethernet header is past 4-byte pseudo-header */
+		off_linktype.constant_part = off_linkhdr.constant_part + 12;
+		off_linkpl.constant_part = off_linkhdr.constant_part + 14;	/* pseudo-header+Ethernet header length */
 		off_nl = 0;		/* Ethernet II */
 		off_nl_nosnap = 3;	/* 802.3+802.2 */
-		return;
+		break;
 
 	case DLT_NETANALYZER_TRANSPARENT:
-		off_mac = 12;		/* MAC header is past 4-byte pseudo-header, preamble, and SFD */
-		off_linktype = 24;	/* includes 4-byte pseudo-header+preamble+SFD */
-		off_macpl = 26;		/* pseudo-header+preamble+SFD+Ethernet header length */
+		off_linkhdr.constant_part = 12;	/* MAC header is past 4-byte pseudo-header, preamble, and SFD */
+		off_linktype.constant_part = off_linkhdr.constant_part + 12;
+		off_linkpl.constant_part = off_linkhdr.constant_part + 14;	/* pseudo-header+preamble+SFD+Ethernet header length */
 		off_nl = 0;		/* Ethernet II */
 		off_nl_nosnap = 3;	/* 802.3+802.2 */
-		return;
+		break;
 
 	default:
 		/*
@@ -1467,99 +1503,54 @@
 		 */
 		if (linktype >= DLT_MATCHING_MIN &&
 		    linktype <= DLT_MATCHING_MAX) {
-			off_linktype = -1;
-			off_macpl = -1;
+			off_linktype.constant_part = -1;
+			off_linkpl.constant_part = -1;
 			off_nl = -1;
 			off_nl_nosnap = -1;
-			return;
+		} else {
+			bpf_error("unknown data link type %d", linktype);
 		}
-
+		break;
 	}
-	bpf_error("unknown data link type %d", linktype);
-	/* NOTREACHED */
+
+	off_outermostlinkhdr = off_prevlinkhdr = off_linkhdr;
 }
 
 /*
- * Load a value relative to the beginning of the link-layer header.
- * The link-layer header doesn't necessarily begin at the beginning
- * of the packet data; there might be a variable-length prefix containing
- * radio information.
+ * Load a value relative to the specified absolute offset.
  */
 static struct slist *
-gen_load_llrel(offset, size)
-	u_int offset, size;
+gen_load_absoffsetrel(bpf_abs_offset *abs_offset, u_int offset, u_int size)
 {
 	struct slist *s, *s2;
 
-	s = gen_llprefixlen();
+	s = gen_abs_offset_varpart(abs_offset);
 
 	/*
 	 * If "s" is non-null, it has code to arrange that the X register
-	 * contains the length of the prefix preceding the link-layer
-	 * header.
+	 * contains the variable part of the absolute offset, so we
+	 * generate a load relative to that, with an offset of
+	 * abs_offset->constant_part + offset.
 	 *
-	 * Otherwise, the length of the prefix preceding the link-layer
-	 * header is "off_ll".
+	 * Otherwise, we can do an absolute load with an offset of
+	 * abs_offset->constant_part + offset.
 	 */
 	if (s != NULL) {
 		/*
-		 * There's a variable-length prefix preceding the
-		 * link-layer header.  "s" points to a list of statements
-		 * that put the length of that prefix into the X register.
-		 * do an indirect load, to use the X register as an offset.
+		 * "s" points to a list of statements that puts the
+		 * variable part of the absolute offset into the X register.
+		 * Do an indirect load, to use the X register as an offset.
 		 */
 		s2 = new_stmt(BPF_LD|BPF_IND|size);
-		s2->s.k = offset;
+		s2->s.k = abs_offset->constant_part + offset;
 		sappend(s, s2);
 	} else {
 		/*
-		 * There is no variable-length header preceding the
-		 * link-layer header; add in off_ll, which, if there's
-		 * a fixed-length header preceding the link-layer header,
-		 * is the length of that header.
+		 * There is no variable part of the absolute offset, so
+		 * just do an absolute load.
 		 */
 		s = new_stmt(BPF_LD|BPF_ABS|size);
-		s->s.k = offset + off_ll;
-	}
-	return s;
-}
-
-/*
- * Load a value relative to the beginning of the MAC-layer payload.
- */
-static struct slist *
-gen_load_macplrel(offset, size)
-	u_int offset, size;
-{
-	struct slist *s, *s2;
-
-	s = gen_off_macpl();
-
-	/*
-	 * If s is non-null, the offset of the MAC-layer payload is
-	 * variable, and s points to a list of instructions that
-	 * arrange that the X register contains that offset.
-	 *
-	 * Otherwise, the offset of the MAC-layer payload is constant,
-	 * and is in off_macpl.
-	 */
-	if (s != NULL) {
-		/*
-		 * The offset of the MAC-layer payload is in the X
-		 * register.  Do an indirect load, to use the X register
-		 * as an offset.
-		 */
-		s2 = new_stmt(BPF_LD|BPF_IND|size);
-		s2->s.k = offset;
-		sappend(s, s2);
-	} else {
-		/*
-		 * The offset of the MAC-layer payload is constant,
-		 * and is in off_macpl; load the value at that offset
-		 * plus the specified offset.
-		 */
-		s = new_stmt(BPF_LD|BPF_ABS|size);
-		s->s.k = off_macpl + offset;
+		s->s.k = abs_offset->constant_part + offset;
 	}
 	return s;
 }
@@ -1581,20 +1572,32 @@
                 s->s.k = offset;
 		break;
 
-	case OR_LINK:
-		s = gen_load_llrel(offset, size);
+	case OR_LINKHDR:
+		s = gen_load_absoffsetrel(&off_linkhdr, offset, size);
 		break;
 
-	case OR_MACPL:
-		s = gen_load_macplrel(offset, size);
+	case OR_PREVLINKHDR:
+		s = gen_load_absoffsetrel(&off_prevlinkhdr, offset, size);
 		break;
 
-	case OR_NET:
-		s = gen_load_macplrel(off_nl + offset, size);
+	case OR_LLC:
+		s = gen_load_absoffsetrel(&off_linkpl, offset, size);
 		break;
 
-	case OR_NET_NOSNAP:
-		s = gen_load_macplrel(off_nl_nosnap + offset, size);
+	case OR_PREVMPLSHDR:
+		s = gen_load_absoffsetrel(&off_linkpl, off_nl - 4 + offset, size);
+		break;
+
+	case OR_LINKPL:
+		s = gen_load_absoffsetrel(&off_linkpl, off_nl + offset, size);
+		break;
+
+	case OR_LINKPL_NOSNAP:
+		s = gen_load_absoffsetrel(&off_linkpl, off_nl_nosnap + offset, size);
+		break;
+
+	case OR_LINKTYPE:
+		s = gen_load_absoffsetrel(&off_linktype, offset, size);
 		break;
 
 	case OR_TRAN_IPV4:
@@ -1607,22 +1610,23 @@
 		s = gen_loadx_iphdrlen();
 
 		/*
-		 * Load the item at {offset of the MAC-layer payload} +
-		 * {offset, relative to the start of the MAC-layer
+		 * Load the item at {offset of the link-layer payload} +
+		 * {offset, relative to the start of the link-layer
 		 * paylod, of the IPv4 header} + {length of the IPv4 header} +
 		 * {specified offset}.
 		 *
-		 * (If the offset of the MAC-layer payload is variable,
-		 * it's included in the value in the X register, and
-		 * off_macpl is 0.)
+		 * If the offset of the link-layer payload is variable,
+		 * the variable part of that offset is included in the
+		 * value in the X register, and we include the constant
+		 * part in the offset of the load.
 		 */
 		s2 = new_stmt(BPF_LD|BPF_IND|size);
-		s2->s.k = off_macpl + off_nl + offset;
+		s2->s.k = off_linkpl.constant_part + off_nl + offset;
 		sappend(s, s2);
 		break;
 
 	case OR_TRAN_IPV6:
-		s = gen_load_macplrel(off_nl + 40 + offset, size);
+		s = gen_load_absoffsetrel(&off_linkpl, off_nl + 40 + offset, size);
 		break;
 
 	default:
@@ -1634,22 +1638,20 @@
 
 /*
  * Generate code to load into the X register the sum of the length of
- * the IPv4 header and any variable-length header preceding the link-layer
- * header.
+ * the IPv4 header and the variable part of the offset of the link-layer
+ * payload.
  */
 static struct slist *
 gen_loadx_iphdrlen()
 {
 	struct slist *s, *s2;
 
-	s = gen_off_macpl();
+	s = gen_abs_offset_varpart(&off_linkpl);
 	if (s != NULL) {
 		/*
-		 * There's a variable-length prefix preceding the
-		 * link-layer header, or the link-layer header is itself
-		 * variable-length.  "s" points to a list of statements
-		 * that put the offset of the MAC-layer payload into
-		 * the X register.
+		 * The offset of the link-layer payload has a variable
+		 * part.  "s" points to a list of statements that put
+		 * the variable part of that offset into the X register.
 		 *
 		 * The 4*([k]&0xf) addressing mode can't be used, as we
 		 * don't have a constant offset, so we have to load the
@@ -1657,7 +1659,7 @@
 		 * the value from the X register.
 		 */
 		s2 = new_stmt(BPF_LD|BPF_IND|BPF_B);
-		s2->s.k = off_nl;
+		s2->s.k = off_linkpl.constant_part + off_nl;
 		sappend(s, s2);
 		s2 = new_stmt(BPF_ALU|BPF_AND|BPF_K);
 		s2->s.k = 0xf;
@@ -1667,25 +1669,28 @@
 		sappend(s, s2);
 
 		/*
-		 * The A register now contains the length of the
-		 * IP header.  We need to add to it the offset of
-		 * the MAC-layer payload, which is still in the X
+		 * The A register now contains the length of the IP header.
+		 * We need to add to it the variable part of the offset of
+		 * the link-layer payload, which is still in the X
 		 * register, and move the result into the X register.
 		 */
 		sappend(s, new_stmt(BPF_ALU|BPF_ADD|BPF_X));
 		sappend(s, new_stmt(BPF_MISC|BPF_TAX));
 	} else {
 		/*
-		 * There is no variable-length header preceding the
-		 * link-layer header, and the link-layer header is
-		 * fixed-length; load the length of the IPv4 header,
-		 * which is at an offset of off_nl from the beginning
-		 * of the MAC-layer payload, and thus at an offset
-		 * of off_mac_pl + off_nl from the beginning of the
-		 * raw packet data.
+		 * The offset of the link-layer payload is a constant,
+		 * so no code was generated to load the (non-existent)
+		 * variable part of that offset.
+		 *
+		 * This means we can use the 4*([k]&0xf) addressing
+		 * mode.  Load the length of the IPv4 header, which
+		 * is at an offset of off_nl from the beginning of
+		 * the link-layer payload, and thus at an offset of
+		 * off_linkpl.constant_part + off_nl from the beginning
+		 * of the raw packet data, using that addressing mode.
 		 */
 		s = new_stmt(BPF_LDX|BPF_MSH|BPF_B);
-		s->s.k = off_macpl + off_nl;
+		s->s.k = off_linkpl.constant_part + off_nl;
 	}
 	return s;
 }
@@ -1757,9 +1762,9 @@
 		 * DSAP, as we do for other types <= ETHERMTU
 		 * (i.e., other SAP values)?
 		 */
-		b0 = gen_cmp_gt(OR_LINK, off_linktype, BPF_H, ETHERMTU);
+		b0 = gen_cmp_gt(OR_LINKTYPE, 0, BPF_H, ETHERMTU);
 		gen_not(b0);
-		b1 = gen_cmp(OR_MACPL, 0, BPF_H, (bpf_int32)
+		b1 = gen_cmp(OR_LLC, 0, BPF_H, (bpf_int32)
 			     ((proto << 8) | proto));
 		gen_and(b0, b1);
 		return b1;
@@ -1797,8 +1802,8 @@
 		 * This generates code to check both for the
 		 * IPX LSAP (Ethernet_802.2) and for Ethernet_802.3.
 		 */
-		b0 = gen_cmp(OR_MACPL, 0, BPF_B, (bpf_int32)LLCSAP_IPX);
-		b1 = gen_cmp(OR_MACPL, 0, BPF_H, (bpf_int32)0xFFFF);
+		b0 = gen_cmp(OR_LLC, 0, BPF_B, (bpf_int32)LLCSAP_IPX);
+		b1 = gen_cmp(OR_LLC, 0, BPF_H, (bpf_int32)0xFFFF);
 		gen_or(b0, b1);
 
 		/*
@@ -1812,7 +1817,7 @@
 		 * Now we generate code to check for 802.3
 		 * frames in general.
 		 */
-		b0 = gen_cmp_gt(OR_LINK, off_linktype, BPF_H, ETHERMTU);
+		b0 = gen_cmp_gt(OR_LINKTYPE, 0, BPF_H, ETHERMTU);
 		gen_not(b0);
 
 		/*
@@ -1828,8 +1833,7 @@
 		 * do that before checking for the other frame
 		 * types.
 		 */
-		b0 = gen_cmp(OR_LINK, off_linktype, BPF_H,
-		    (bpf_int32)ETHERTYPE_IPX);
+		b0 = gen_cmp(OR_LINKTYPE, 0, BPF_H, (bpf_int32)ETHERTYPE_IPX);
 		gen_or(b0, b1);
 		return b1;
 
@@ -1845,7 +1849,7 @@
 		 * we check for an Ethernet type field less than
 		 * 1500, which means it's an 802.3 length field.
 		 */
-		b0 = gen_cmp_gt(OR_LINK, off_linktype, BPF_H, ETHERMTU);
+		b0 = gen_cmp_gt(OR_LINKTYPE, 0, BPF_H, ETHERMTU);
 		gen_not(b0);
 
 		/*
@@ -1870,7 +1874,7 @@
 		 * phase 1?); we just check for the Ethernet
 		 * protocol type.
 		 */
-		b0 = gen_cmp(OR_LINK, off_linktype, BPF_H, (bpf_int32)proto);
+		b0 = gen_cmp(OR_LINKTYPE, 0, BPF_H, (bpf_int32)proto);
 
 		gen_or(b0, b1);
 		return b1;
@@ -1885,10 +1889,9 @@
 			 * a length field, <= ETHERMTU) and
 			 * then check the DSAP.
 			 */
-			b0 = gen_cmp_gt(OR_LINK, off_linktype, BPF_H, ETHERMTU);
+			b0 = gen_cmp_gt(OR_LINKTYPE, 0, BPF_H, ETHERMTU);
 			gen_not(b0);
-			b1 = gen_cmp(OR_LINK, off_linktype + 2, BPF_B,
-			    (bpf_int32)proto);
+			b1 = gen_cmp(OR_LINKTYPE, 2, BPF_B, (bpf_int32)proto);
 			gen_and(b0, b1);
 			return b1;
 		} else {
@@ -1901,7 +1904,7 @@
 			 * will fail and the frame won't match,
 			 * which is what we want).
 			 */
-			return gen_cmp(OR_LINK, off_linktype, BPF_H,
+			return gen_cmp(OR_LINKTYPE, 0, BPF_H,
 			    (bpf_int32)proto);
 		}
 	}
@@ -1918,12 +1921,11 @@
 	switch (proto) {
 
 	case ETHERTYPE_IP:
-		return gen_cmp(OR_LINK, off_linktype, BPF_B,
-		    (bpf_int32)IPH_AF_INET);
+		return gen_cmp(OR_LINKTYPE, 0, BPF_B, (bpf_int32)IPH_AF_INET);
 		/* NOTREACHED */
 
 	case ETHERTYPE_IPV6:
-		return gen_cmp(OR_LINK, off_linktype, BPF_B,
+		return gen_cmp(OR_LINKTYPE, 0, BPF_B,
 		    (bpf_int32)IPH_AF_INET6);
 		/* NOTREACHED */
 
@@ -1965,8 +1967,8 @@
 		 * DSAP, as we do for other types <= ETHERMTU
 		 * (i.e., other SAP values)?
 		 */
-		b0 = gen_cmp(OR_LINK, off_linktype, BPF_H, LINUX_SLL_P_802_2);
-		b1 = gen_cmp(OR_MACPL, 0, BPF_H, (bpf_int32)
+		b0 = gen_cmp(OR_LINKTYPE, 0, BPF_H, LINUX_SLL_P_802_2);
+		b1 = gen_cmp(OR_LLC, 0, BPF_H, (bpf_int32)
 			     ((proto << 8) | proto));
 		gen_and(b0, b1);
 		return b1;
@@ -1997,17 +1999,17 @@
 		 * then put a check for LINUX_SLL_P_802_2 frames
 		 * before it.
 		 */
-		b0 = gen_cmp(OR_MACPL, 0, BPF_B, (bpf_int32)LLCSAP_IPX);
+		b0 = gen_cmp(OR_LLC, 0, BPF_B, (bpf_int32)LLCSAP_IPX);
 		b1 = gen_snap(0x000000, ETHERTYPE_IPX);
 		gen_or(b0, b1);
-		b0 = gen_cmp(OR_LINK, off_linktype, BPF_H, LINUX_SLL_P_802_2);
+		b0 = gen_cmp(OR_LINKTYPE, 0, BPF_H, LINUX_SLL_P_802_2);
 		gen_and(b0, b1);
 
 		/*
 		 * Now check for 802.3 frames and OR that with
 		 * the previous test.
 		 */
-		b0 = gen_cmp(OR_LINK, off_linktype, BPF_H, LINUX_SLL_P_802_3);
+		b0 = gen_cmp(OR_LINKTYPE, 0, BPF_H, LINUX_SLL_P_802_3);
 		gen_or(b0, b1);
 
 		/*
@@ -2015,8 +2017,7 @@
 		 * do that before checking for the other frame
 		 * types.
 		 */
-		b0 = gen_cmp(OR_LINK, off_linktype, BPF_H,
-		    (bpf_int32)ETHERTYPE_IPX);
+		b0 = gen_cmp(OR_LINKTYPE, 0, BPF_H, (bpf_int32)ETHERTYPE_IPX);
 		gen_or(b0, b1);
 		return b1;
 
@@ -2032,7 +2033,7 @@
 		 * we check for the 802.2 protocol type in the
 		 * "Ethernet type" field.
 		 */
-		b0 = gen_cmp(OR_LINK, off_linktype, BPF_H, LINUX_SLL_P_802_2);
+		b0 = gen_cmp(OR_LINKTYPE, 0, BPF_H, LINUX_SLL_P_802_2);
 
 		/*
 		 * 802.2-encapsulated ETHERTYPE_ATALK packets are
@@ -2056,7 +2057,7 @@
 		 * phase 1?); we just check for the Ethernet
 		 * protocol type.
 		 */
-		b0 = gen_cmp(OR_LINK, off_linktype, BPF_H, (bpf_int32)proto);
+		b0 = gen_cmp(OR_LINKTYPE, 0, BPF_H, (bpf_int32)proto);
 
 		gen_or(b0, b1);
 		return b1;
@@ -2070,9 +2071,8 @@
 			 * in the "Ethernet type" field, and
 			 * then check the DSAP.
 			 */
-			b0 = gen_cmp(OR_LINK, off_linktype, BPF_H,
-			    LINUX_SLL_P_802_2);
-			b1 = gen_cmp(OR_LINK, off_macpl, BPF_B,
+			b0 = gen_cmp(OR_LINKTYPE, 0, BPF_H, LINUX_SLL_P_802_2);
+			b1 = gen_cmp(OR_LINKHDR, off_linkpl.constant_part, BPF_B,
 			     (bpf_int32)proto);
 			gen_and(b0, b1);
 			return b1;
@@ -2086,8 +2086,7 @@
 			 * will fail and the frame won't match,
 			 * which is what we want).
 			 */
-			return gen_cmp(OR_LINK, off_linktype, BPF_H,
-			    (bpf_int32)proto);
+			return gen_cmp(OR_LINKTYPE, 0, BPF_H, (bpf_int32)proto);
 		}
 	}
 }
@@ -2125,7 +2124,7 @@
 	 * but no known software generates headers that aren't 144
 	 * bytes long.
 	 */
-	if (reg_off_ll != -1) {
+	if (off_linkhdr.reg != -1) {
 		/*
 		 * Load the cookie.
 		 */
@@ -2187,7 +2186,7 @@
 		 * loading the length of the AVS header.
 		 */
 		s2 = new_stmt(BPF_ST);
-		s2->s.k = reg_off_ll;
+		s2->s.k = off_linkhdr.reg;
 		sappend(s1, s2);
 		sjcommon->s.jf = s2;
 
@@ -2214,7 +2213,7 @@
 	 * generated uses that prefix, so we don't need to generate any
 	 * code to load it.)
 	 */
-	if (reg_off_ll != -1) {
+	if (off_linkhdr.reg != -1) {
 		/*
 		 * The 4 bytes at an offset of 4 from the beginning of
 		 * the AVS header are the length of the AVS header.
@@ -2228,7 +2227,7 @@
 		 * it.
 		 */
 		s2 = new_stmt(BPF_ST);
-		s2->s.k = reg_off_ll;
+		s2->s.k = off_linkhdr.reg;
 		sappend(s1, s2);
 
 		/*
@@ -2254,7 +2253,7 @@
 	 * generated uses that prefix, so we don't need to generate any
 	 * code to load it.)
 	 */
-	if (reg_off_ll != -1) {
+	if (off_linkhdr.reg != -1) {
 		/*
 		 * The 2 bytes at offsets of 2 and 3 from the beginning
 		 * of the radiotap header are the length of the radiotap
@@ -2289,7 +2288,7 @@
 		 * it.
 		 */
 		s2 = new_stmt(BPF_ST);
-		s2->s.k = reg_off_ll;
+		s2->s.k = off_linkhdr.reg;
 		sappend(s1, s2);
 
 		/*
@@ -2303,7 +2302,7 @@
 		return (NULL);
 }
 
-/* 
+/*
  * At the moment we treat PPI as normal Radiotap encoded
  * packets. The difference is in the function that generates
  * the code at the beginning to compute the header length.
@@ -2316,13 +2315,13 @@
 gen_load_ppi_llprefixlen()
 {
 	struct slist *s1, *s2;
-	
+
 	/*
 	 * Generate code to load the length of the radiotap header
 	 * into the register assigned to hold that length, if one has
 	 * been assigned.
 	 */
-	if (reg_off_ll != -1) {
+	if (off_linkhdr.reg != -1) {
 		/*
 		 * The 2 bytes at offsets of 2 and 3 from the beginning
 		 * of the radiotap header are the length of the radiotap
@@ -2357,7 +2356,7 @@
 		 * it.
 		 */
 		s2 = new_stmt(BPF_ST);
-		s2->s.k = reg_off_ll;
+		s2->s.k = off_linkhdr.reg;
 		sappend(s1, s2);
 
 		/*
@@ -2390,10 +2389,10 @@
 	struct slist *sjset_tsft_datapad, *sjset_notsft_datapad;
 	struct slist *s_roundup;
 
-	if (reg_off_macpl == -1) {
+	if (off_linkpl.reg == -1) {
 		/*
 		 * No register has been assigned to the offset of
-		 * the MAC-layer payload, which means nobody needs
+		 * the link-layer payload, which means nobody needs
 		 * it; don't bother computing it - just return
 		 * what we already have.
 		 */
@@ -2406,14 +2405,14 @@
 	 * slist of instructions
 	 */
 	no_optimize = 1;
-	
+
 	/*
 	 * If "s" is non-null, it has code to arrange that the X register
 	 * contains the length of the prefix preceding the link-layer
 	 * header.
 	 *
 	 * Otherwise, the length of the prefix preceding the link-layer
-	 * header is "off_ll".
+	 * header is "off_outermostlinkhdr.constant_part".
 	 */
 	if (s == NULL) {
 		/*
@@ -2422,18 +2421,18 @@
 		 *
 		 * Load the length of the fixed-length prefix preceding
 		 * the link-layer header (if any) into the X register,
-		 * and store it in the reg_off_macpl register.
-		 * That length is off_ll.
+		 * and store it in the off_linkpl.reg register.
+		 * That length is off_outermostlinkhdr.constant_part.
 		 */
 		s = new_stmt(BPF_LDX|BPF_IMM);
-		s->s.k = off_ll;
+		s->s.k = off_outermostlinkhdr.constant_part;
 	}
 
 	/*
 	 * The X register contains the offset of the beginning of the
 	 * link-layer header; add 24, which is the minimum length
 	 * of the MAC header for a data frame, to that, and store it
-	 * in reg_off_macpl, and then load the Frame Control field,
+	 * in off_linkpl.reg, and then load the Frame Control field,
 	 * which is at the offset in the X register, with an indexed load.
 	 */
 	s2 = new_stmt(BPF_MISC|BPF_TXA);
@@ -2442,7 +2441,7 @@
 	s2->s.k = 24;
 	sappend(s, s2);
 	s2 = new_stmt(BPF_ST);
-	s2->s.k = reg_off_macpl;
+	s2->s.k = off_linkpl.reg;
 	sappend(s, s2);
 
 	s2 = new_stmt(BPF_LD|BPF_IND|BPF_B);
@@ -2457,7 +2456,7 @@
 	sjset_data_frame_1 = new_stmt(JMP(BPF_JSET));
 	sjset_data_frame_1->s.k = 0x08;
 	sappend(s, sjset_data_frame_1);
-		
+
 	/*
 	 * If b3 is set, test b2, otherwise go to the first statement of
 	 * the rest of the program.
@@ -2476,21 +2475,21 @@
 	sjset_data_frame_2->s.jf = sjset_qos = new_stmt(JMP(BPF_JSET));
 	sjset_qos->s.k = 0x80;	/* QoS bit */
 	sappend(s, sjset_qos);
-		
+
 	/*
-	 * If it's set, add 2 to reg_off_macpl, to skip the QoS
+	 * If it's set, add 2 to off_linkpl.reg, to skip the QoS
 	 * field.
 	 * Otherwise, go to the first statement of the rest of the
 	 * program.
 	 */
 	sjset_qos->s.jt = s2 = new_stmt(BPF_LD|BPF_MEM);
-	s2->s.k = reg_off_macpl;
+	s2->s.k = off_linkpl.reg;
 	sappend(s, s2);
 	s2 = new_stmt(BPF_ALU|BPF_ADD|BPF_IMM);
 	s2->s.k = 2;
 	sappend(s, s2);
 	s2 = new_stmt(BPF_ST);
-	s2->s.k = reg_off_macpl;
+	s2->s.k = off_linkpl.reg;
 	sappend(s, s2);
 
 	/*
@@ -2570,7 +2569,7 @@
 		 * ANDing with ~3.
 		 */
 		s_roundup = new_stmt(BPF_LD|BPF_MEM);
-		s_roundup->s.k = reg_off_macpl;
+		s_roundup->s.k = off_linkpl.reg;
 		sappend(s, s_roundup);
 		s2 = new_stmt(BPF_ALU|BPF_ADD|BPF_IMM);
 		s2->s.k = 3;
@@ -2579,7 +2578,7 @@
 		s2->s.k = ~3;
 		sappend(s, s2);
 		s2 = new_stmt(BPF_ST);
-		s2->s.k = reg_off_macpl;
+		s2->s.k = off_linkpl.reg;
 		sappend(s, s2);
 
 		sjset_tsft_datapad->s.jt = s_roundup;
@@ -2598,13 +2597,27 @@
 {
 	struct slist *s;
 
+	/* There is an implicit dependency between the link
+	 * payload and link header since the payload computation
+	 * includes the variable part of the header. Therefore,
+	 * if nobody else has allocated a register for the link
+	 * header and we need it, do it now. */
+	if (off_linkpl.reg != -1 && off_linkhdr.is_variable &&
+	    off_linkhdr.reg == -1)
+		off_linkhdr.reg = alloc_reg();
+
 	/*
 	 * For link-layer types that have a variable-length header
 	 * preceding the link-layer header, generate code to load
 	 * the offset of the link-layer header into the register
 	 * assigned to that offset, if any.
+	 *
+	 * XXX - this, and the next switch statement, won't handle
+	 * encapsulation of 802.11 or 802.11+radio information in
+	 * some other protocol stack.  That's significantly more
+	 * complicated.
 	 */
-	switch (linktype) {
+	switch (outermostlinktype) {
 
 	case DLT_PRISM_HEADER:
 		s = gen_load_prism_llprefixlen();
@@ -2629,10 +2642,10 @@
 
 	/*
 	 * For link-layer types that have a variable-length link-layer
-	 * header, generate code to load the offset of the MAC-layer
+	 * header, generate code to load the offset of the link-layer
 	 * payload into the register assigned to that offset, if any.
 	 */
-	switch (linktype) {
+	switch (outermostlinktype) {
 
 	case DLT_IEEE802_11:
 	case DLT_PRISM_HEADER:
@@ -2681,160 +2694,45 @@
 	return b;
 }
 
-static struct slist *
-gen_prism_llprefixlen(void)
-{
-	struct slist *s;
-
-	if (reg_off_ll == -1) {
-		/*
-		 * We haven't yet assigned a register for the length
-		 * of the radio header; allocate one.
-		 */
-		reg_off_ll = alloc_reg();
-	}
-
-	/*
-	 * Load the register containing the radio length
-	 * into the X register.
-	 */
-	s = new_stmt(BPF_LDX|BPF_MEM);
-	s->s.k = reg_off_ll;
-	return s;
-}
-
-static struct slist *
-gen_avs_llprefixlen(void)
-{
-	struct slist *s;
-
-	if (reg_off_ll == -1) {
-		/*
-		 * We haven't yet assigned a register for the length
-		 * of the AVS header; allocate one.
-		 */
-		reg_off_ll = alloc_reg();
-	}
-
-	/*
-	 * Load the register containing the AVS length
-	 * into the X register.
-	 */
-	s = new_stmt(BPF_LDX|BPF_MEM);
-	s->s.k = reg_off_ll;
-	return s;
-}
-
-static struct slist *
-gen_radiotap_llprefixlen(void)
-{
-	struct slist *s;
-
-	if (reg_off_ll == -1) {
-		/*
-		 * We haven't yet assigned a register for the length
-		 * of the radiotap header; allocate one.
-		 */
-		reg_off_ll = alloc_reg();
-	}
-
-	/*
-	 * Load the register containing the radiotap length
-	 * into the X register.
-	 */
-	s = new_stmt(BPF_LDX|BPF_MEM);
-	s->s.k = reg_off_ll;
-	return s;
-}
-
-/* 
- * At the moment we treat PPI as normal Radiotap encoded
- * packets. The difference is in the function that generates
- * the code at the beginning to compute the header length.
- * Since this code generator of PPI supports bare 802.11
- * encapsulation only (i.e. the encapsulated DLT should be
- * DLT_IEEE802_11) we generate code to check for this too.
- */
-static struct slist *
-gen_ppi_llprefixlen(void)
-{
-	struct slist *s;
-
-	if (reg_off_ll == -1) {
-		/*
-		 * We haven't yet assigned a register for the length
-		 * of the radiotap header; allocate one.
-		 */
-		reg_off_ll = alloc_reg();
-	}
-
-	/*
-	 * Load the register containing the PPI length
-	 * into the X register.
-	 */
-	s = new_stmt(BPF_LDX|BPF_MEM);
-	s->s.k = reg_off_ll;
-	return s;
-}
-
 /*
- * Generate code to compute the link-layer header length, if necessary,
- * putting it into the X register, and to return either a pointer to a
- * "struct slist" for the list of statements in that code, or NULL if
- * no code is necessary.
+ * Take an absolute offset, and:
+ *
+ *    if it has no variable part, return NULL;
+ *
+ *    if it has a variable part, generate code to load the register
+ *    containing that variable part into the X register, returning
+ *    a pointer to that code - if no register for that offset has
+ *    been allocated, allocate it first.
+ *
+ * (The code to set that register will be generated later, but will
+ * be placed earlier in the code sequence.)
  */
 static struct slist *
-gen_llprefixlen(void)
-{
-	switch (linktype) {
-
-	case DLT_PRISM_HEADER:
-		return gen_prism_llprefixlen();
-
-	case DLT_IEEE802_11_RADIO_AVS:
-		return gen_avs_llprefixlen();
-
-	case DLT_IEEE802_11_RADIO:
-		return gen_radiotap_llprefixlen();
-
-	case DLT_PPI:
-		return gen_ppi_llprefixlen();
-
-	default:
-		return NULL;
-	}
-}
-
-/*
- * Generate code to load the register containing the offset of the
- * MAC-layer payload into the X register; if no register for that offset
- * has been allocated, allocate it first.
- */
-static struct slist *
-gen_off_macpl(void)
+gen_abs_offset_varpart(bpf_abs_offset *off)
 {
 	struct slist *s;
 
-	if (off_macpl_is_variable) {
-		if (reg_off_macpl == -1) {
+	if (off->is_variable) {
+		if (off->reg == -1) {
 			/*
-			 * We haven't yet assigned a register for the offset
-			 * of the MAC-layer payload; allocate one.
+			 * We haven't yet assigned a register for the
+			 * variable part of the offset of the link-layer
+			 * header; allocate one.
 			 */
-			reg_off_macpl = alloc_reg();
+			off->reg = alloc_reg();
 		}
 
 		/*
-		 * Load the register containing the offset of the MAC-layer
-		 * payload into the X register.
+		 * Load the register containing the variable part of the
+		 * offset of the link-layer header into the X register.
 		 */
 		s = new_stmt(BPF_LDX|BPF_MEM);
-		s->s.k = reg_off_macpl;
+		s->s.k = off->reg;
 		return s;
 	} else {
 		/*
-		 * That offset isn't variable, so we don't need to
-		 * generate any code.
+		 * That offset isn't variable, there's no variable part,
+		 * so we don't need to generate any code.
 		 */
 		return NULL;
 	}
@@ -2890,6 +2788,43 @@
 }
 
 /*
+ * Generate any tests that, for encapsulation of a link-layer packet
+ * inside another protocol stack, need to be done to check for those
+ * link-layer packets (and that haven't already been done by a check
+ * for that encapsulation).
+ */
+static struct block *
+gen_prevlinkhdr_check(void)
+{
+	struct block *b0;
+
+	if (is_geneve)
+		return gen_geneve_ll_check();
+
+	switch (prevlinktype) {
+
+	case DLT_SUNATM:
+		/*
+		 * This is LANE-encapsulated Ethernet; check that the LANE
+		 * packet doesn't begin with an LE Control marker, i.e.
+		 * that it's data, not a control message.
+		 *
+		 * (We've already generated a test for LANE.)
+		 */
+		b0 = gen_cmp(OR_PREVLINKHDR, SUNATM_PKT_BEGIN_POS, BPF_H, 0xFF00);
+		gen_not(b0);
+		return b0;
+
+	default:
+		/*
+		 * No such tests are necessary.
+		 */
+		return NULL;
+	}
+	/*NOTREACHED*/
+}
+
+/*
  * Generate code to match a particular packet type by matching the
  * link-layer type field or fields in the 802.2 LLC header.
  *
@@ -2901,6 +2836,7 @@
 	register int proto;
 {
 	struct block *b0, *b1, *b2;
+	const char *description;
 
 	/* are we checking MPLS-encapsulated packets? */
 	if (label_stack_depth > 0) {
@@ -2908,12 +2844,12 @@
 		case ETHERTYPE_IP:
 		case PPP_IP:
 			/* FIXME add other L3 proto IDs */
-			return gen_mpls_linktype(Q_IP); 
+			return gen_mpls_linktype(Q_IP);
 
 		case ETHERTYPE_IPV6:
 		case PPP_IPV6:
 			/* FIXME add other L3 proto IDs */
-			return gen_mpls_linktype(Q_IPV6); 
+			return gen_mpls_linktype(Q_IPV6);
 
 		default:
 			bpf_error("unsupported protocol over mpls");
@@ -2921,31 +2857,22 @@
 		}
 	}
 
-	/*
-	 * Are we testing PPPoE packets?
-	 */
-	if (is_pppoes) {
-		/*
-		 * The PPPoE session header is part of the
-		 * MAC-layer payload, so all references
-		 * should be relative to the beginning of
-		 * that payload.
-		 */
-
-		/*
-		 * We use Ethernet protocol types inside libpcap;
-		 * map them to the corresponding PPP protocol types.
-		 */
-		proto = ethertype_to_ppptype(proto);
-		return gen_cmp(OR_MACPL, off_linktype, BPF_H, (bpf_int32)proto);
-	}
-
 	switch (linktype) {
 
 	case DLT_EN10MB:
 	case DLT_NETANALYZER:
 	case DLT_NETANALYZER_TRANSPARENT:
-		return gen_ether_linktype(proto);
+		/* Geneve has an EtherType regardless of whether there is an
+		 * L2 header. */
+		if (!is_geneve)
+			b0 = gen_prevlinkhdr_check();
+		else
+			b0 = NULL;
+
+		b1 = gen_ether_linktype(proto);
+		if (b0 != NULL)
+			gen_and(b0, b1);
+		return b1;
 		/*NOTREACHED*/
 		break;
 
@@ -2957,8 +2884,7 @@
 			/* fall through */
 
 		default:
-			return gen_cmp(OR_LINK, off_linktype, BPF_H,
-			    (bpf_int32)proto);
+			return gen_cmp(OR_LINKTYPE, 0, BPF_H, (bpf_int32)proto);
 			/*NOTREACHED*/
 			break;
 		}
@@ -2985,7 +2911,7 @@
 
 	case DLT_FDDI:
 		/*
-		 * XXX - check for asynchronous frames, as per RFC 1103.
+		 * XXX - check for LLC frames.
 		 */
 		return gen_llc_linktype(proto);
 		/*NOTREACHED*/
@@ -3008,38 +2934,16 @@
 
 	case DLT_SUNATM:
 		/*
-		 * If "is_lane" is set, check for a LANE-encapsulated
-		 * version of this protocol, otherwise check for an
-		 * LLC-encapsulated version of this protocol.
+		 * Check for an LLC-encapsulated version of this protocol;
+		 * if we were checking for LANE, linktype would no longer
+		 * be DLT_SUNATM.
 		 *
-		 * We assume LANE means Ethernet, not Token Ring.
+		 * Check for LLC encapsulation and then check the protocol.
 		 */
-		if (is_lane) {
-			/*
-			 * Check that the packet doesn't begin with an
-			 * LE Control marker.  (We've already generated
-			 * a test for LANE.)
-			 */
-			b0 = gen_cmp(OR_LINK, SUNATM_PKT_BEGIN_POS, BPF_H,
-			    0xFF00);
-			gen_not(b0);
-
-			/*
-			 * Now generate an Ethernet test.
-			 */
-			b1 = gen_ether_linktype(proto);
-			gen_and(b0, b1);
-			return b1;
-		} else {
-			/*
-			 * Check for LLC encapsulation and then check the
-			 * protocol.
-			 */
-			b0 = gen_atmfield_code(A_PROTOTYPE, PT_LLC, BPF_JEQ, 0);
-			b1 = gen_llc_linktype(proto);
-			gen_and(b0, b1);
-			return b1;
-		}
+		b0 = gen_atmfield_code(A_PROTOTYPE, PT_LLC, BPF_JEQ, 0);
+		b1 = gen_llc_linktype(proto);
+		gen_and(b0, b1);
+		return b1;
 		/*NOTREACHED*/
 		break;
 
@@ -3062,11 +2966,11 @@
 
 		case ETHERTYPE_IP:
 			/* Check for a version number of 4. */
-			return gen_mcmp(OR_LINK, 0, BPF_B, 0x40, 0xF0);
+			return gen_mcmp(OR_LINKHDR, 0, BPF_B, 0x40, 0xF0);
 
 		case ETHERTYPE_IPV6:
 			/* Check for a version number of 6. */
-			return gen_mcmp(OR_LINK, 0, BPF_B, 0x60, 0xF0);
+			return gen_mcmp(OR_LINKHDR, 0, BPF_B, 0x60, 0xF0);
 
 		default:
 			return gen_false();		/* always false */
@@ -3107,7 +3011,7 @@
 		 * map them to the corresponding PPP protocol types.
 		 */
 		proto = ethertype_to_ppptype(proto);
-		return gen_cmp(OR_LINK, off_linktype, BPF_H, (bpf_int32)proto);
+		return gen_cmp(OR_LINKTYPE, 0, BPF_H, (bpf_int32)proto);
 		/*NOTREACHED*/
 		break;
 
@@ -3123,16 +3027,16 @@
 			 * Also check for Van Jacobson-compressed IP.
 			 * XXX - do this for other forms of PPP?
 			 */
-			b0 = gen_cmp(OR_LINK, off_linktype, BPF_H, PPP_IP);
-			b1 = gen_cmp(OR_LINK, off_linktype, BPF_H, PPP_VJC);
+			b0 = gen_cmp(OR_LINKTYPE, 0, BPF_H, PPP_IP);
+			b1 = gen_cmp(OR_LINKTYPE, 0, BPF_H, PPP_VJC);
 			gen_or(b0, b1);
-			b0 = gen_cmp(OR_LINK, off_linktype, BPF_H, PPP_VJNC);
+			b0 = gen_cmp(OR_LINKTYPE, 0, BPF_H, PPP_VJNC);
 			gen_or(b1, b0);
 			return b0;
 
 		default:
 			proto = ethertype_to_ppptype(proto);
-			return gen_cmp(OR_LINK, off_linktype, BPF_H,
+			return gen_cmp(OR_LINKTYPE, 0, BPF_H,
 				(bpf_int32)proto);
 		}
 		/*NOTREACHED*/
@@ -3201,7 +3105,7 @@
 				proto = SWAPLONG(proto);
 			proto = htonl(proto);
 		}
-		return (gen_cmp(OR_LINK, 0, BPF_W, (bpf_int32)proto));
+		return (gen_cmp(OR_LINKHDR, 0, BPF_W, (bpf_int32)proto));
 
 #ifdef HAVE_NET_PFVAR_H
 	case DLT_PFLOG:
@@ -3210,10 +3114,10 @@
 		 * the packet.
 		 */
 		if (proto == ETHERTYPE_IP)
-			return (gen_cmp(OR_LINK, offsetof(struct pfloghdr, af),
+			return (gen_cmp(OR_LINKHDR, offsetof(struct pfloghdr, af),
 			    BPF_B, (bpf_int32)AF_INET));
 		else if (proto == ETHERTYPE_IPV6)
-			return (gen_cmp(OR_LINK, offsetof(struct pfloghdr, af),
+			return (gen_cmp(OR_LINKHDR, offsetof(struct pfloghdr, af),
 			    BPF_B, (bpf_int32)AF_INET6));
 		else
 			return gen_false();
@@ -3233,31 +3137,31 @@
 			return gen_false();
 
 		case ETHERTYPE_IPV6:
-			return (gen_cmp(OR_LINK, off_linktype, BPF_B,
+			return (gen_cmp(OR_LINKTYPE, 0, BPF_B,
 				(bpf_int32)ARCTYPE_INET6));
 
 		case ETHERTYPE_IP:
-			b0 = gen_cmp(OR_LINK, off_linktype, BPF_B,
+			b0 = gen_cmp(OR_LINKTYPE, 0, BPF_B,
 				     (bpf_int32)ARCTYPE_IP);
-			b1 = gen_cmp(OR_LINK, off_linktype, BPF_B,
+			b1 = gen_cmp(OR_LINKTYPE, 0, BPF_B,
 				     (bpf_int32)ARCTYPE_IP_OLD);
 			gen_or(b0, b1);
 			return (b1);
 
 		case ETHERTYPE_ARP:
-			b0 = gen_cmp(OR_LINK, off_linktype, BPF_B,
+			b0 = gen_cmp(OR_LINKTYPE, 0, BPF_B,
 				     (bpf_int32)ARCTYPE_ARP);
-			b1 = gen_cmp(OR_LINK, off_linktype, BPF_B,
+			b1 = gen_cmp(OR_LINKTYPE, 0, BPF_B,
 				     (bpf_int32)ARCTYPE_ARP_OLD);
 			gen_or(b0, b1);
 			return (b1);
 
 		case ETHERTYPE_REVARP:
-			return (gen_cmp(OR_LINK, off_linktype, BPF_B,
+			return (gen_cmp(OR_LINKTYPE, 0, BPF_B,
 					(bpf_int32)ARCTYPE_REVARP));
 
 		case ETHERTYPE_ATALK:
-			return (gen_cmp(OR_LINK, off_linktype, BPF_B,
+			return (gen_cmp(OR_LINKTYPE, 0, BPF_B,
 					(bpf_int32)ARCTYPE_ATALK));
 		}
 		/*NOTREACHED*/
@@ -3284,13 +3188,13 @@
 			/*
 			 * Check for the special NLPID for IP.
 			 */
-			return gen_cmp(OR_LINK, 2, BPF_H, (0x03<<8) | 0xcc);
+			return gen_cmp(OR_LINKHDR, 2, BPF_H, (0x03<<8) | 0xcc);
 
 		case ETHERTYPE_IPV6:
 			/*
 			 * Check for the special NLPID for IPv6.
 			 */
-			return gen_cmp(OR_LINK, 2, BPF_H, (0x03<<8) | 0x8e);
+			return gen_cmp(OR_LINKHDR, 2, BPF_H, (0x03<<8) | 0x8e);
 
 		case LLCSAP_ISONS:
 			/*
@@ -3304,9 +3208,9 @@
 			 * control field of UI, i.e. 0x03 followed
 			 * by the NLPID.
 			 */
-			b0 = gen_cmp(OR_LINK, 2, BPF_H, (0x03<<8) | ISO8473_CLNP);
-			b1 = gen_cmp(OR_LINK, 2, BPF_H, (0x03<<8) | ISO9542_ESIS);
-			b2 = gen_cmp(OR_LINK, 2, BPF_H, (0x03<<8) | ISO10589_ISIS);
+			b0 = gen_cmp(OR_LINKHDR, 2, BPF_H, (0x03<<8) | ISO8473_CLNP);
+			b1 = gen_cmp(OR_LINKHDR, 2, BPF_H, (0x03<<8) | ISO9542_ESIS);
+			b2 = gen_cmp(OR_LINKHDR, 2, BPF_H, (0x03<<8) | ISO10589_ISIS);
 			gen_or(b1, b2);
 			gen_or(b0, b2);
 			return b2;
@@ -3350,10 +3254,10 @@
 		 *
 		 * FIXME encapsulation specific BPF_ filters
 		 */
-		return gen_mcmp(OR_LINK, 0, BPF_W, 0x4d474300, 0xffffff00); /* compare the magic number */
+		return gen_mcmp(OR_LINKHDR, 0, BPF_W, 0x4d474300, 0xffffff00); /* compare the magic number */
 
 	case DLT_BACNET_MS_TP:
-		return gen_mcmp(OR_LINK, 0, BPF_W, 0x55FF0000, 0xffff0000);
+		return gen_mcmp(OR_LINKHDR, 0, BPF_W, 0x55FF0000, 0xffff0000);
 
 	case DLT_IPNET:
 		return gen_ipnet_linktype(proto);
@@ -3410,26 +3314,43 @@
 
 	case DLT_AX25_KISS:
 		bpf_error("AX.25 link-layer type filtering not implemented");
+
+	case DLT_NFLOG:
+		/* Using the fixed-size NFLOG header it is possible to tell only
+		 * the address family of the packet, other meaningful data is
+		 * either missing or behind TLVs.
+		 */
+		bpf_error("NFLOG link-layer type filtering not implemented");
+
+	default:
+		/*
+		 * Does this link-layer header type have a field
+		 * indicating the type of the next protocol?  If
+		 * so, off_linktype.constant_part will be the offset of that
+		 * field in the packet; if not, it will be -1.
+		 */
+		if (off_linktype.constant_part != (u_int)-1) {
+			/*
+			 * Yes; assume it's an Ethernet type.  (If
+			 * it's not, it needs to be handled specially
+			 * above.)
+			 */
+			return gen_cmp(OR_LINKTYPE, 0, BPF_H, (bpf_int32)proto);
+		} else {
+			/*
+			 * No; report an error.
+			 */
+			description = pcap_datalink_val_to_description(linktype);
+			if (description != NULL) {
+				bpf_error("%s link-layer type filtering not implemented",
+				    description);
+			} else {
+				bpf_error("DLT %u link-layer type filtering not implemented",
+				    linktype);
+			}
+		}
+		break;
 	}
-
-	/*
-	 * All the types that have no encapsulation should either be
-	 * handled as DLT_SLIP, DLT_SLIP_BSDOS, and DLT_RAW are, if
-	 * all packets are IP packets, or should be handled in some
-	 * special case, if none of them are (if some are and some
-	 * aren't, the lack of encapsulation is a problem, as we'd
-	 * have to find some other way of determining the packet type).
-	 *
-	 * Therefore, if "off_linktype" is -1, there's an error.
-	 */
-	if (off_linktype == (u_int)-1)
-		abort();
-
-	/*
-	 * Any type not handled above should always have an Ethernet
-	 * type at an offset of "off_linktype".
-	 */
-	return gen_cmp(OR_LINK, off_linktype, BPF_H, (bpf_int32)proto);
 }
 
 /*
@@ -3454,7 +3375,179 @@
 	snapblock[5] = (orgcode >> 0);	/* lower 8 bits of organization code */
 	snapblock[6] = (ptype >> 8);	/* upper 8 bits of protocol type */
 	snapblock[7] = (ptype >> 0);	/* lower 8 bits of protocol type */
-	return gen_bcmp(OR_MACPL, 0, 8, snapblock);
+	return gen_bcmp(OR_LLC, 0, 8, snapblock);
+}
+
+/*
+ * Generate code to match frames with an LLC header.
+ */
+struct block *
+gen_llc(void)
+{
+	struct block *b0, *b1;
+
+	switch (linktype) {
+
+	case DLT_EN10MB:
+		/*
+		 * We check for an Ethernet type field less than
+		 * 1500, which means it's an 802.3 length field.
+		 */
+		b0 = gen_cmp_gt(OR_LINKTYPE, 0, BPF_H, ETHERMTU);
+		gen_not(b0);
+
+		/*
+		 * Now check for the purported DSAP and SSAP not being
+		 * 0xFF, to rule out NetWare-over-802.3.
+		 */
+		b1 = gen_cmp(OR_LLC, 0, BPF_H, (bpf_int32)0xFFFF);
+		gen_not(b1);
+		gen_and(b0, b1);
+		return b1;
+
+	case DLT_SUNATM:
+		/*
+		 * We check for LLC traffic.
+		 */
+		b0 = gen_atmtype_abbrev(A_LLC);
+		return b0;
+
+	case DLT_IEEE802:	/* Token Ring */
+		/*
+		 * XXX - check for LLC frames.
+		 */
+		return gen_true();
+
+	case DLT_FDDI:
+		/*
+		 * XXX - check for LLC frames.
+		 */
+		return gen_true();
+
+	case DLT_ATM_RFC1483:
+		/*
+		 * For LLC encapsulation, these are defined to have an
+		 * 802.2 LLC header.
+		 *
+		 * For VC encapsulation, they don't, but there's no
+		 * way to check for that; the protocol used on the VC
+		 * is negotiated out of band.
+		 */
+		return gen_true();
+
+	case DLT_IEEE802_11:
+	case DLT_PRISM_HEADER:
+	case DLT_IEEE802_11_RADIO:
+	case DLT_IEEE802_11_RADIO_AVS:
+	case DLT_PPI:
+		/*
+		 * Check that we have a data frame.
+		 */
+		b0 = gen_check_802_11_data_frame();
+		return b0;
+
+	default:
+		bpf_error("'llc' not supported for linktype %d", linktype);
+		/* NOTREACHED */
+	}
+}
+
+struct block *
+gen_llc_i(void)
+{
+	struct block *b0, *b1;
+	struct slist *s;
+
+	/*
+	 * Check whether this is an LLC frame.
+	 */
+	b0 = gen_llc();
+
+	/*
+	 * Load the control byte and test the low-order bit; it must
+	 * be clear for I frames.
+	 */
+	s = gen_load_a(OR_LLC, 2, BPF_B);
+	b1 = new_block(JMP(BPF_JSET));
+	b1->s.k = 0x01;
+	b1->stmts = s;
+	gen_not(b1);
+	gen_and(b0, b1);
+	return b1;
+}
+
+struct block *
+gen_llc_s(void)
+{
+	struct block *b0, *b1;
+
+	/*
+	 * Check whether this is an LLC frame.
+	 */
+	b0 = gen_llc();
+
+	/*
+	 * Now compare the low-order 2 bit of the control byte against
+	 * the appropriate value for S frames.
+	 */
+	b1 = gen_mcmp(OR_LLC, 2, BPF_B, LLC_S_FMT, 0x03);
+	gen_and(b0, b1);
+	return b1;
+}
+
+struct block *
+gen_llc_u(void)
+{
+	struct block *b0, *b1;
+
+	/*
+	 * Check whether this is an LLC frame.
+	 */
+	b0 = gen_llc();
+
+	/*
+	 * Now compare the low-order 2 bit of the control byte against
+	 * the appropriate value for U frames.
+	 */
+	b1 = gen_mcmp(OR_LLC, 2, BPF_B, LLC_U_FMT, 0x03);
+	gen_and(b0, b1);
+	return b1;
+}
+
+struct block *
+gen_llc_s_subtype(bpf_u_int32 subtype)
+{
+	struct block *b0, *b1;
+
+	/*
+	 * Check whether this is an LLC frame.
+	 */
+	b0 = gen_llc();
+
+	/*
+	 * Now check for an S frame with the appropriate type.
+	 */
+	b1 = gen_mcmp(OR_LLC, 2, BPF_B, subtype, LLC_S_CMD_MASK);
+	gen_and(b0, b1);
+	return b1;
+}
+
+struct block *
+gen_llc_u_subtype(bpf_u_int32 subtype)
+{
+	struct block *b0, *b1;
+
+	/*
+	 * Check whether this is an LLC frame.
+	 */
+	b0 = gen_llc();
+
+	/*
+	 * Now check for a U frame with the appropriate type.
+	 */
+	b1 = gen_mcmp(OR_LLC, 2, BPF_B, subtype, LLC_U_CMD_MASK);
+	gen_and(b0, b1);
+	return b1;
 }
 
 /*
@@ -3484,10 +3577,9 @@
 		/*
 		 * XXX - should we check both the DSAP and the
 		 * SSAP, like this, or should we check just the
-		 * DSAP, as we do for other types <= ETHERMTU
-		 * (i.e., other SAP values)?
+		 * DSAP, as we do for other SAP values?
 		 */
-		return gen_cmp(OR_MACPL, 0, BPF_H, (bpf_u_int32)
+		return gen_cmp(OR_LLC, 0, BPF_H, (bpf_u_int32)
 			     ((proto << 8) | proto));
 
 	case LLCSAP_IPX:
@@ -3495,7 +3587,7 @@
 		 * XXX - are there ever SNAP frames for IPX on
 		 * non-Ethernet 802.x networks?
 		 */
-		return gen_cmp(OR_MACPL, 0, BPF_B,
+		return gen_cmp(OR_LLC, 0, BPF_B,
 		    (bpf_int32)LLCSAP_IPX);
 
 	case ETHERTYPE_ATALK:
@@ -3520,7 +3612,7 @@
 			 * This is an LLC SAP value, so check
 			 * the DSAP.
 			 */
-			return gen_cmp(OR_MACPL, 0, BPF_B, (bpf_int32)proto);
+			return gen_cmp(OR_LLC, 0, BPF_B, (bpf_int32)proto);
 		} else {
 			/*
 			 * This is an Ethernet type; we assume that it's
@@ -3541,7 +3633,7 @@
 			 * I don't know whether it's worth the extra CPU
 			 * time to do the right check or not.
 			 */
-			return gen_cmp(OR_MACPL, 6, BPF_H, (bpf_int32)proto);
+			return gen_cmp(OR_LLC, 6, BPF_H, (bpf_int32)proto);
 		}
 	}
 }
@@ -3583,7 +3675,7 @@
 		abort();
 	}
 	b0 = gen_linktype(proto);
-	b1 = gen_mcmp(OR_NET, offset, BPF_W, (bpf_int32)addr, mask);
+	b1 = gen_mcmp(OR_LINKPL, offset, BPF_W, (bpf_int32)addr, mask);
 	gen_and(b0, b1);
 	return b1;
 }
@@ -3629,12 +3721,12 @@
 	/* this order is important */
 	a = (u_int32_t *)addr;
 	m = (u_int32_t *)mask;
-	b1 = gen_mcmp(OR_NET, offset + 12, BPF_W, ntohl(a[3]), ntohl(m[3]));
-	b0 = gen_mcmp(OR_NET, offset + 8, BPF_W, ntohl(a[2]), ntohl(m[2]));
+	b1 = gen_mcmp(OR_LINKPL, offset + 12, BPF_W, ntohl(a[3]), ntohl(m[3]));
+	b0 = gen_mcmp(OR_LINKPL, offset + 8, BPF_W, ntohl(a[2]), ntohl(m[2]));
 	gen_and(b0, b1);
-	b0 = gen_mcmp(OR_NET, offset + 4, BPF_W, ntohl(a[1]), ntohl(m[1]));
+	b0 = gen_mcmp(OR_LINKPL, offset + 4, BPF_W, ntohl(a[1]), ntohl(m[1]));
 	gen_and(b0, b1);
-	b0 = gen_mcmp(OR_NET, offset + 0, BPF_W, ntohl(a[0]), ntohl(m[0]));
+	b0 = gen_mcmp(OR_LINKPL, offset + 0, BPF_W, ntohl(a[0]), ntohl(m[0]));
 	gen_and(b0, b1);
 	b0 = gen_linktype(proto);
 	gen_and(b0, b1);
@@ -3651,10 +3743,10 @@
 
 	switch (dir) {
 	case Q_SRC:
-		return gen_bcmp(OR_LINK, off_mac + 6, 6, eaddr);
+		return gen_bcmp(OR_LINKHDR, 6, 6, eaddr);
 
 	case Q_DST:
-		return gen_bcmp(OR_LINK, off_mac + 0, 6, eaddr);
+		return gen_bcmp(OR_LINKHDR, 0, 6, eaddr);
 
 	case Q_AND:
 		b0 = gen_ehostop(eaddr, Q_SRC);
@@ -3709,10 +3801,10 @@
 
 	switch (dir) {
 	case Q_SRC:
-		return gen_bcmp(OR_LINK, 6 + 1 + pcap_fddipad, 6, eaddr);
+		return gen_bcmp(OR_LINKHDR, 6 + 1 + pcap_fddipad, 6, eaddr);
 
 	case Q_DST:
-		return gen_bcmp(OR_LINK, 0 + 1 + pcap_fddipad, 6, eaddr);
+		return gen_bcmp(OR_LINKHDR, 0 + 1 + pcap_fddipad, 6, eaddr);
 
 	case Q_AND:
 		b0 = gen_fhostop(eaddr, Q_SRC);
@@ -3767,10 +3859,10 @@
 
 	switch (dir) {
 	case Q_SRC:
-		return gen_bcmp(OR_LINK, 8, 6, eaddr);
+		return gen_bcmp(OR_LINKHDR, 8, 6, eaddr);
 
 	case Q_DST:
-		return gen_bcmp(OR_LINK, 2, 6, eaddr);
+		return gen_bcmp(OR_LINKHDR, 2, 6, eaddr);
 
 	case Q_AND:
 		b0 = gen_thostop(eaddr, Q_SRC);
@@ -3862,7 +3954,7 @@
 		 *
 		 * First, check for To DS set, i.e. check "link[1] & 0x01".
 		 */
-		s = gen_load_a(OR_LINK, 1, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 1, BPF_B);
 		b1 = new_block(JMP(BPF_JSET));
 		b1->s.k = 0x01;	/* To DS */
 		b1->stmts = s;
@@ -3870,14 +3962,14 @@
 		/*
 		 * If To DS is set, the SA is at 24.
 		 */
-		b0 = gen_bcmp(OR_LINK, 24, 6, eaddr);
+		b0 = gen_bcmp(OR_LINKHDR, 24, 6, eaddr);
 		gen_and(b1, b0);
 
 		/*
 		 * Now, check for To DS not set, i.e. check
 		 * "!(link[1] & 0x01)".
 		 */
-		s = gen_load_a(OR_LINK, 1, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 1, BPF_B);
 		b2 = new_block(JMP(BPF_JSET));
 		b2->s.k = 0x01;	/* To DS */
 		b2->stmts = s;
@@ -3886,7 +3978,7 @@
 		/*
 		 * If To DS is not set, the SA is at 16.
 		 */
-		b1 = gen_bcmp(OR_LINK, 16, 6, eaddr);
+		b1 = gen_bcmp(OR_LINKHDR, 16, 6, eaddr);
 		gen_and(b2, b1);
 
 		/*
@@ -3900,7 +3992,7 @@
 		 * Now check for From DS being set, and AND that with
 		 * the ORed-together checks.
 		 */
-		s = gen_load_a(OR_LINK, 1, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 1, BPF_B);
 		b1 = new_block(JMP(BPF_JSET));
 		b1->s.k = 0x02;	/* From DS */
 		b1->stmts = s;
@@ -3909,7 +4001,7 @@
 		/*
 		 * Now check for data frames with From DS not set.
 		 */
-		s = gen_load_a(OR_LINK, 1, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 1, BPF_B);
 		b2 = new_block(JMP(BPF_JSET));
 		b2->s.k = 0x02;	/* From DS */
 		b2->stmts = s;
@@ -3918,7 +4010,7 @@
 		/*
 		 * If From DS isn't set, the SA is at 10.
 		 */
-		b1 = gen_bcmp(OR_LINK, 10, 6, eaddr);
+		b1 = gen_bcmp(OR_LINKHDR, 10, 6, eaddr);
 		gen_and(b2, b1);
 
 		/*
@@ -3932,7 +4024,7 @@
 		 * Now check for a data frame.
 		 * I.e, check "link[0] & 0x08".
 		 */
-		s = gen_load_a(OR_LINK, 0, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 		b1 = new_block(JMP(BPF_JSET));
 		b1->s.k = 0x08;
 		b1->stmts = s;
@@ -3947,7 +4039,7 @@
 		 * is a management frame.
 		 * I.e, check "!(link[0] & 0x08)".
 		 */
-		s = gen_load_a(OR_LINK, 0, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 		b2 = new_block(JMP(BPF_JSET));
 		b2->s.k = 0x08;
 		b2->stmts = s;
@@ -3956,7 +4048,7 @@
 		/*
 		 * For management frames, the SA is at 10.
 		 */
-		b1 = gen_bcmp(OR_LINK, 10, 6, eaddr);
+		b1 = gen_bcmp(OR_LINKHDR, 10, 6, eaddr);
 		gen_and(b2, b1);
 
 		/*
@@ -3974,7 +4066,7 @@
 		 *
 		 * I.e., check "!(link[0] & 0x04)".
 		 */
-		s = gen_load_a(OR_LINK, 0, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 		b1 = new_block(JMP(BPF_JSET));
 		b1->s.k = 0x04;
 		b1->stmts = s;
@@ -4009,7 +4101,7 @@
 		 *
 		 * First, check for To DS set, i.e. "link[1] & 0x01".
 		 */
-		s = gen_load_a(OR_LINK, 1, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 1, BPF_B);
 		b1 = new_block(JMP(BPF_JSET));
 		b1->s.k = 0x01;	/* To DS */
 		b1->stmts = s;
@@ -4017,14 +4109,14 @@
 		/*
 		 * If To DS is set, the DA is at 16.
 		 */
-		b0 = gen_bcmp(OR_LINK, 16, 6, eaddr);
+		b0 = gen_bcmp(OR_LINKHDR, 16, 6, eaddr);
 		gen_and(b1, b0);
 
 		/*
 		 * Now, check for To DS not set, i.e. check
 		 * "!(link[1] & 0x01)".
 		 */
-		s = gen_load_a(OR_LINK, 1, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 1, BPF_B);
 		b2 = new_block(JMP(BPF_JSET));
 		b2->s.k = 0x01;	/* To DS */
 		b2->stmts = s;
@@ -4033,7 +4125,7 @@
 		/*
 		 * If To DS is not set, the DA is at 4.
 		 */
-		b1 = gen_bcmp(OR_LINK, 4, 6, eaddr);
+		b1 = gen_bcmp(OR_LINKHDR, 4, 6, eaddr);
 		gen_and(b2, b1);
 
 		/*
@@ -4046,7 +4138,7 @@
 		 * Now check for a data frame.
 		 * I.e, check "link[0] & 0x08".
 		 */
-		s = gen_load_a(OR_LINK, 0, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 		b1 = new_block(JMP(BPF_JSET));
 		b1->s.k = 0x08;
 		b1->stmts = s;
@@ -4061,7 +4153,7 @@
 		 * is a management frame.
 		 * I.e, check "!(link[0] & 0x08)".
 		 */
-		s = gen_load_a(OR_LINK, 0, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 		b2 = new_block(JMP(BPF_JSET));
 		b2->s.k = 0x08;
 		b2->stmts = s;
@@ -4070,7 +4162,7 @@
 		/*
 		 * For management frames, the DA is at 4.
 		 */
-		b1 = gen_bcmp(OR_LINK, 4, 6, eaddr);
+		b1 = gen_bcmp(OR_LINKHDR, 4, 6, eaddr);
 		gen_and(b2, b1);
 
 		/*
@@ -4088,7 +4180,7 @@
 		 *
 		 * I.e., check "!(link[0] & 0x04)".
 		 */
-		s = gen_load_a(OR_LINK, 0, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 		b1 = new_block(JMP(BPF_JSET));
 		b1->s.k = 0x04;
 		b1->stmts = s;
@@ -4112,7 +4204,7 @@
 		 * is a management frame.
 		 * I.e, check "(link[0] & 0x08)".
 		 */
-		s = gen_load_a(OR_LINK, 0, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 		b1 = new_block(JMP(BPF_JSET));
 		b1->s.k = 0x08;
 		b1->stmts = s;
@@ -4120,7 +4212,7 @@
 		/*
 		 * Check addr1.
 		 */
-		b0 = gen_bcmp(OR_LINK, 4, 6, eaddr);
+		b0 = gen_bcmp(OR_LINKHDR, 4, 6, eaddr);
 
 		/*
 		 * AND that with the check of addr1.
@@ -4137,13 +4229,13 @@
 		/*
 		 * Not present in CTS or ACK control frames.
 		 */
-		b0 = gen_mcmp(OR_LINK, 0, BPF_B, IEEE80211_FC0_TYPE_CTL,
+		b0 = gen_mcmp(OR_LINKHDR, 0, BPF_B, IEEE80211_FC0_TYPE_CTL,
 			IEEE80211_FC0_TYPE_MASK);
 		gen_not(b0);
-		b1 = gen_mcmp(OR_LINK, 0, BPF_B, IEEE80211_FC0_SUBTYPE_CTS,
+		b1 = gen_mcmp(OR_LINKHDR, 0, BPF_B, IEEE80211_FC0_SUBTYPE_CTS,
 			IEEE80211_FC0_SUBTYPE_MASK);
 		gen_not(b1);
-		b2 = gen_mcmp(OR_LINK, 0, BPF_B, IEEE80211_FC0_SUBTYPE_ACK,
+		b2 = gen_mcmp(OR_LINKHDR, 0, BPF_B, IEEE80211_FC0_SUBTYPE_ACK,
 			IEEE80211_FC0_SUBTYPE_MASK);
 		gen_not(b2);
 		gen_and(b1, b2);
@@ -4154,7 +4246,7 @@
 		 * is a management frame.
 		 * I.e, check "(link[0] & 0x08)".
 		 */
-		s = gen_load_a(OR_LINK, 0, BPF_B);
+		s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 		b1 = new_block(JMP(BPF_JSET));
 		b1->s.k = 0x08;
 		b1->stmts = s;
@@ -4168,7 +4260,7 @@
 		/*
 		 * Check addr2.
 		 */
-		b1 = gen_bcmp(OR_LINK, 10, 6, eaddr);
+		b1 = gen_bcmp(OR_LINKHDR, 10, 6, eaddr);
 		gen_and(b2, b1);
 		return b1;
 
@@ -4176,24 +4268,24 @@
 	 * XXX - add BSSID keyword?
 	 */
 	case Q_ADDR1:
-		return (gen_bcmp(OR_LINK, 4, 6, eaddr));
+		return (gen_bcmp(OR_LINKHDR, 4, 6, eaddr));
 
 	case Q_ADDR2:
 		/*
 		 * Not present in CTS or ACK control frames.
 		 */
-		b0 = gen_mcmp(OR_LINK, 0, BPF_B, IEEE80211_FC0_TYPE_CTL,
+		b0 = gen_mcmp(OR_LINKHDR, 0, BPF_B, IEEE80211_FC0_TYPE_CTL,
 			IEEE80211_FC0_TYPE_MASK);
 		gen_not(b0);
-		b1 = gen_mcmp(OR_LINK, 0, BPF_B, IEEE80211_FC0_SUBTYPE_CTS,
+		b1 = gen_mcmp(OR_LINKHDR, 0, BPF_B, IEEE80211_FC0_SUBTYPE_CTS,
 			IEEE80211_FC0_SUBTYPE_MASK);
 		gen_not(b1);
-		b2 = gen_mcmp(OR_LINK, 0, BPF_B, IEEE80211_FC0_SUBTYPE_ACK,
+		b2 = gen_mcmp(OR_LINKHDR, 0, BPF_B, IEEE80211_FC0_SUBTYPE_ACK,
 			IEEE80211_FC0_SUBTYPE_MASK);
 		gen_not(b2);
 		gen_and(b1, b2);
 		gen_or(b0, b2);
-		b1 = gen_bcmp(OR_LINK, 10, 6, eaddr);
+		b1 = gen_bcmp(OR_LINKHDR, 10, 6, eaddr);
 		gen_and(b2, b1);
 		return b1;
 
@@ -4201,10 +4293,10 @@
 		/*
 		 * Not present in control frames.
 		 */
-		b0 = gen_mcmp(OR_LINK, 0, BPF_B, IEEE80211_FC0_TYPE_CTL,
+		b0 = gen_mcmp(OR_LINKHDR, 0, BPF_B, IEEE80211_FC0_TYPE_CTL,
 			IEEE80211_FC0_TYPE_MASK);
 		gen_not(b0);
-		b1 = gen_bcmp(OR_LINK, 16, 6, eaddr);
+		b1 = gen_bcmp(OR_LINKHDR, 16, 6, eaddr);
 		gen_and(b0, b1);
 		return b1;
 
@@ -4215,9 +4307,9 @@
 		 * frames should have both of those set, so we don't
 		 * check the frame type.
 		 */
-		b0 = gen_mcmp(OR_LINK, 1, BPF_B,
+		b0 = gen_mcmp(OR_LINKHDR, 1, BPF_B,
 			IEEE80211_FC1_DIR_DSTODS, IEEE80211_FC1_DIR_MASK);
-		b1 = gen_bcmp(OR_LINK, 24, 6, eaddr);
+		b1 = gen_bcmp(OR_LINKHDR, 24, 6, eaddr);
 		gen_and(b0, b1);
 		return b1;
 
@@ -4252,10 +4344,10 @@
 
 	switch (dir) {
 	case Q_SRC:
-		return gen_bcmp(OR_LINK, 10, 6, eaddr);
+		return gen_bcmp(OR_LINKHDR, 10, 6, eaddr);
 
 	case Q_DST:
-		return gen_bcmp(OR_LINK, 2, 6, eaddr);
+		return gen_bcmp(OR_LINKHDR, 2, 6, eaddr);
 
 	case Q_AND:
 		b0 = gen_ipfchostop(eaddr, Q_SRC);
@@ -4360,25 +4452,25 @@
 	}
 	b0 = gen_linktype(ETHERTYPE_DN);
 	/* Check for pad = 1, long header case */
-	tmp = gen_mcmp(OR_NET, 2, BPF_H,
+	tmp = gen_mcmp(OR_LINKPL, 2, BPF_H,
 	    (bpf_int32)ntohs(0x0681), (bpf_int32)ntohs(0x07FF));
-	b1 = gen_cmp(OR_NET, 2 + 1 + offset_lh,
+	b1 = gen_cmp(OR_LINKPL, 2 + 1 + offset_lh,
 	    BPF_H, (bpf_int32)ntohs((u_short)addr));
 	gen_and(tmp, b1);
 	/* Check for pad = 0, long header case */
-	tmp = gen_mcmp(OR_NET, 2, BPF_B, (bpf_int32)0x06, (bpf_int32)0x7);
-	b2 = gen_cmp(OR_NET, 2 + offset_lh, BPF_H, (bpf_int32)ntohs((u_short)addr));
+	tmp = gen_mcmp(OR_LINKPL, 2, BPF_B, (bpf_int32)0x06, (bpf_int32)0x7);
+	b2 = gen_cmp(OR_LINKPL, 2 + offset_lh, BPF_H, (bpf_int32)ntohs((u_short)addr));
 	gen_and(tmp, b2);
 	gen_or(b2, b1);
 	/* Check for pad = 1, short header case */
-	tmp = gen_mcmp(OR_NET, 2, BPF_H,
+	tmp = gen_mcmp(OR_LINKPL, 2, BPF_H,
 	    (bpf_int32)ntohs(0x0281), (bpf_int32)ntohs(0x07FF));
-	b2 = gen_cmp(OR_NET, 2 + 1 + offset_sh, BPF_H, (bpf_int32)ntohs((u_short)addr));
+	b2 = gen_cmp(OR_LINKPL, 2 + 1 + offset_sh, BPF_H, (bpf_int32)ntohs((u_short)addr));
 	gen_and(tmp, b2);
 	gen_or(b2, b1);
 	/* Check for pad = 0, short header case */
-	tmp = gen_mcmp(OR_NET, 2, BPF_B, (bpf_int32)0x02, (bpf_int32)0x7);
-	b2 = gen_cmp(OR_NET, 2 + offset_sh, BPF_H, (bpf_int32)ntohs((u_short)addr));
+	tmp = gen_mcmp(OR_LINKPL, 2, BPF_B, (bpf_int32)0x02, (bpf_int32)0x7);
+	b2 = gen_cmp(OR_LINKPL, 2 + offset_sh, BPF_H, (bpf_int32)ntohs((u_short)addr));
 	gen_and(tmp, b2);
 	gen_or(b2, b1);
 
@@ -4402,20 +4494,20 @@
 
         case Q_IP:
                 /* match the bottom-of-stack bit */
-                b0 = gen_mcmp(OR_NET, -2, BPF_B, 0x01, 0x01);
+                b0 = gen_mcmp(OR_LINKPL, -2, BPF_B, 0x01, 0x01);
                 /* match the IPv4 version number */
-                b1 = gen_mcmp(OR_NET, 0, BPF_B, 0x40, 0xf0);
+                b1 = gen_mcmp(OR_LINKPL, 0, BPF_B, 0x40, 0xf0);
                 gen_and(b0, b1);
                 return b1;
- 
+
        case Q_IPV6:
                 /* match the bottom-of-stack bit */
-                b0 = gen_mcmp(OR_NET, -2, BPF_B, 0x01, 0x01);
+                b0 = gen_mcmp(OR_LINKPL, -2, BPF_B, 0x01, 0x01);
                 /* match the IPv4 version number */
-                b1 = gen_mcmp(OR_NET, 0, BPF_B, 0x60, 0xf0);
+                b1 = gen_mcmp(OR_LINKPL, 0, BPF_B, 0x60, 0xf0);
                 gen_and(b0, b1);
                 return b1;
- 
+
        default:
                 abort();
         }
@@ -4698,7 +4790,10 @@
 		case DLT_EN10MB:
 		case DLT_NETANALYZER:
 		case DLT_NETANALYZER_TRANSPARENT:
+			b1 = gen_prevlinkhdr_check();
 			b0 = gen_ehostop(eaddr, Q_OR);
+			if (b1 != NULL)
+				gen_and(b1, b0);
 			break;
 		case DLT_FDDI:
 			b0 = gen_fhostop(eaddr, Q_OR);
@@ -4714,23 +4809,13 @@
 			b0 = gen_wlanhostop(eaddr, Q_OR);
 			break;
 		case DLT_SUNATM:
-			if (!is_lane)
-				bpf_error(
-				    "'gateway' supported only on ethernet/FDDI/token ring/802.11/ATM LANE/Fibre Channel");
 			/*
-			 * Check that the packet doesn't begin with an
-			 * LE Control marker.  (We've already generated
-			 * a test for LANE.)
+			 * This is LLC-multiplexed traffic; if it were
+			 * LANE, linktype would have been set to
+			 * DLT_EN10MB.
 			 */
-			b1 = gen_cmp(OR_LINK, SUNATM_PKT_BEGIN_POS,
-			    BPF_H, 0xFF00);
-			gen_not(b1);
-
-			/*
-			 * Now check the MAC address.
-			 */
-			b0 = gen_ehostop(eaddr, Q_OR);
-			gen_and(b1, b0);
+			bpf_error(
+			    "'gateway' supported only on ethernet/FDDI/token ring/802.11/ATM LANE/Fibre Channel");
 			break;
 		case DLT_IP_OVER_FC:
 			b0 = gen_ipfchostop(eaddr, Q_OR);
@@ -5003,7 +5088,7 @@
 	struct block *b;
 
 	/* not IPv4 frag other than the first frag */
-	s = gen_load_a(OR_NET, 6, BPF_H);
+	s = gen_load_a(OR_LINKPL, 6, BPF_H);
 	b = new_block(JMP(BPF_JSET));
 	b->s.k = 0x1fff;
 	b->stmts = s;
@@ -5044,7 +5129,7 @@
 	struct block *b0, *b1, *tmp;
 
 	/* ip proto 'proto' and not a fragment other than the first fragment */
-	tmp = gen_cmp(OR_NET, 9, BPF_B, (bpf_int32)proto);
+	tmp = gen_cmp(OR_LINKPL, 9, BPF_B, (bpf_int32)proto);
 	b0 = gen_ipfrag();
 	gen_and(tmp, b0);
 
@@ -5135,7 +5220,7 @@
 
 	/* ip6 proto 'proto' */
 	/* XXX - catch the first fragment of a fragmented packet? */
-	b0 = gen_cmp(OR_NET, 6, BPF_B, (bpf_int32)proto);
+	b0 = gen_cmp(OR_LINKPL, 6, BPF_B, (bpf_int32)proto);
 
 	switch (dir) {
 	case Q_SRC:
@@ -5222,7 +5307,7 @@
 	b1 = gen_cmp_ge(OR_TRAN_IPV4, off, BPF_H, v1);
 	b2 = gen_cmp_le(OR_TRAN_IPV4, off, BPF_H, v2);
 
-	gen_and(b1, b2); 
+	gen_and(b1, b2);
 
 	return b2;
 }
@@ -5236,7 +5321,7 @@
 	struct block *b0, *b1, *tmp;
 
 	/* ip proto 'proto' and not a fragment other than the first fragment */
-	tmp = gen_cmp(OR_NET, 9, BPF_B, (bpf_int32)proto);
+	tmp = gen_cmp(OR_LINKPL, 9, BPF_B, (bpf_int32)proto);
 	b0 = gen_ipfrag();
 	gen_and(tmp, b0);
 
@@ -5324,7 +5409,7 @@
 	b1 = gen_cmp_ge(OR_TRAN_IPV6, off, BPF_H, v1);
 	b2 = gen_cmp_le(OR_TRAN_IPV6, off, BPF_H, v2);
 
-	gen_and(b1, b2); 
+	gen_and(b1, b2);
 
 	return b2;
 }
@@ -5339,7 +5424,7 @@
 
 	/* ip6 proto 'proto' */
 	/* XXX - catch the first fragment of a fragmented packet? */
-	b0 = gen_cmp(OR_NET, 6, BPF_B, (bpf_int32)proto);
+	b0 = gen_cmp(OR_LINKPL, 6, BPF_B, (bpf_int32)proto);
 
 	switch (dir) {
 	case Q_SRC:
@@ -5503,15 +5588,8 @@
 	 * branches, and backward branch support is unlikely to appear
 	 * in kernel BPF engines.)
 	 */
-	switch (linktype) {
-
-	case DLT_IEEE802_11:
-	case DLT_PRISM_HEADER:
-	case DLT_IEEE802_11_RADIO_AVS:
-	case DLT_IEEE802_11_RADIO:
-	case DLT_PPI:
-		bpf_error("'protochain' not supported with 802.11");
-	}
+	if (off_linkpl.is_variable)
+		bpf_error("'protochain' not supported with variable length headers");
 
 	no_optimize = 1; /*this code is not compatible with optimzer yet */
 
@@ -5530,11 +5608,11 @@
 
 		/* A = ip->ip_p */
 		s[i] = new_stmt(BPF_LD|BPF_ABS|BPF_B);
-		s[i]->s.k = off_macpl + off_nl + 9;
+		s[i]->s.k = off_linkpl.constant_part + off_nl + 9;
 		i++;
 		/* X = ip->ip_hl << 2 */
 		s[i] = new_stmt(BPF_LDX|BPF_MSH|BPF_B);
-		s[i]->s.k = off_macpl + off_nl;
+		s[i]->s.k = off_linkpl.constant_part + off_nl;
 		i++;
 		break;
 
@@ -5543,7 +5621,7 @@
 
 		/* A = ip6->ip_nxt */
 		s[i] = new_stmt(BPF_LD|BPF_ABS|BPF_B);
-		s[i]->s.k = off_macpl + off_nl + 6;
+		s[i]->s.k = off_linkpl.constant_part + off_nl + 6;
 		i++;
 		/* X = sizeof(struct ip6_hdr) */
 		s[i] = new_stmt(BPF_LDX|BPF_IMM);
@@ -5619,7 +5697,7 @@
 		 */
 		/* A = P[X + packet head] */
 		s[i] = new_stmt(BPF_LD|BPF_IND|BPF_B);
-		s[i]->s.k = off_macpl + off_nl;
+		s[i]->s.k = off_linkpl.constant_part + off_nl;
 		i++;
 		/* MEM[reg2] = A */
 		s[i] = new_stmt(BPF_ST);
@@ -5627,7 +5705,7 @@
 		i++;
 		/* A = P[X + packet head + 1]; */
 		s[i] = new_stmt(BPF_LD|BPF_IND|BPF_B);
-		s[i]->s.k = off_macpl + off_nl + 1;
+		s[i]->s.k = off_linkpl.constant_part + off_nl + 1;
 		i++;
 		/* A += 1 */
 		s[i] = new_stmt(BPF_ALU|BPF_ADD|BPF_K);
@@ -5688,7 +5766,7 @@
 	i++;
 	/* A = P[X + packet head]; */
 	s[i] = new_stmt(BPF_LD|BPF_IND|BPF_B);
-	s[i]->s.k = off_macpl + off_nl;
+	s[i]->s.k = off_linkpl.constant_part + off_nl;
 	i++;
 	/* MEM[reg2] = A */
 	s[i] = new_stmt(BPF_ST);
@@ -5706,7 +5784,7 @@
 	i++;
 	/* A = P[X + packet head] */
 	s[i] = new_stmt(BPF_LD|BPF_IND|BPF_B);
-	s[i]->s.k = off_macpl + off_nl;
+	s[i]->s.k = off_linkpl.constant_part + off_nl;
 	i++;
 	/* A += 2 */
 	s[i] = new_stmt(BPF_ALU|BPF_ADD|BPF_K);
@@ -5770,12 +5848,12 @@
 	 * A data frame has the 0x08 bit (b3) in the frame control field set
 	 * and the 0x04 bit (b2) clear.
 	 */
-	s = gen_load_a(OR_LINK, 0, BPF_B);
+	s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 	b0 = new_block(JMP(BPF_JSET));
 	b0->s.k = 0x08;
 	b0->stmts = s;
-	
-	s = gen_load_a(OR_LINK, 0, BPF_B);
+
+	s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 	b1 = new_block(JMP(BPF_JSET));
 	b1->s.k = 0x04;
 	b1->stmts = s;
@@ -5834,7 +5912,7 @@
 		 */
 		b0 = gen_linktype(ETHERTYPE_IP);
 #ifndef CHASE_CHAIN
-		b1 = gen_cmp(OR_NET, 9, BPF_B, (bpf_int32)v);
+		b1 = gen_cmp(OR_LINKPL, 9, BPF_B, (bpf_int32)v);
 #else
 		b1 = gen_protochain(v, Q_IP);
 #endif
@@ -5863,7 +5941,7 @@
 			 *
 			 * XXX - what about SNAP-encapsulated frames?
 			 */
-			return gen_cmp(OR_LINK, 2, BPF_H, (0x03<<8) | v);
+			return gen_cmp(OR_LINKHDR, 2, BPF_H, (0x03<<8) | v);
 			/*NOTREACHED*/
 			break;
 
@@ -5874,13 +5952,13 @@
 			 */
 			b0 = gen_linktype(LLCSAP_ISONS<<8 | LLCSAP_ISONS);
 			/* OSI in C-HDLC is stuffed with a fudge byte */
-			b1 = gen_cmp(OR_NET_NOSNAP, 1, BPF_B, (long)v);
+			b1 = gen_cmp(OR_LINKPL_NOSNAP, 1, BPF_B, (long)v);
 			gen_and(b0, b1);
 			return b1;
 
 		default:
 			b0 = gen_linktype(LLCSAP_ISONS);
-			b1 = gen_cmp(OR_NET_NOSNAP, 0, BPF_B, (long)v);
+			b1 = gen_cmp(OR_LINKPL_NOSNAP, 0, BPF_B, (long)v);
 			gen_and(b0, b1);
 			return b1;
 		}
@@ -5891,7 +5969,7 @@
 		 * 4 is the offset of the PDU type relative to the IS-IS
 		 * header.
 		 */
-		b1 = gen_cmp(OR_NET_NOSNAP, 4, BPF_B, (long)v);
+		b1 = gen_cmp(OR_LINKPL_NOSNAP, 4, BPF_B, (long)v);
 		gen_and(b0, b1);
 		return b1;
 
@@ -5973,10 +6051,10 @@
 		 * Also check for a fragment header before the final
 		 * header.
 		 */
-		b2 = gen_cmp(OR_NET, 6, BPF_B, IPPROTO_FRAGMENT);
-		b1 = gen_cmp(OR_NET, 40, BPF_B, (bpf_int32)v);
+		b2 = gen_cmp(OR_LINKPL, 6, BPF_B, IPPROTO_FRAGMENT);
+		b1 = gen_cmp(OR_LINKPL, 40, BPF_B, (bpf_int32)v);
 		gen_and(b2, b1);
-		b2 = gen_cmp(OR_NET, 6, BPF_B, (bpf_int32)v);
+		b2 = gen_cmp(OR_LINKPL, 6, BPF_B, (bpf_int32)v);
 		gen_or(b2, b1);
 #else
 		b1 = gen_protochain(v, Q_IPV6);
@@ -6061,7 +6139,10 @@
 				if (eaddr == NULL)
 					bpf_error(
 					    "unknown ether host '%s'", name);
+				tmp = gen_prevlinkhdr_check();
 				b = gen_ehostop(eaddr, dir);
+				if (tmp != NULL)
+					gen_and(tmp, b);
 				free(eaddr);
 				return b;
 
@@ -6104,28 +6185,6 @@
 				b = gen_ipfchostop(eaddr, dir);
 				free(eaddr);
 				return b;
-
-			case DLT_SUNATM:
-				if (!is_lane)
-					break;
-
-				/*
-				 * Check that the packet doesn't begin
-				 * with an LE Control marker.  (We've
-				 * already generated a test for LANE.)
-				 */
-				tmp = gen_cmp(OR_LINK, SUNATM_PKT_BEGIN_POS,
-				    BPF_H, 0xFF00);
-				gen_not(tmp);
-
-				eaddr = pcap_ether_hostton(name);
-				if (eaddr == NULL)
-					bpf_error(
-					    "unknown ether host '%s'", name);
-				b = gen_ehostop(eaddr, dir);
-				gen_and(tmp, b);
-				free(eaddr);
-				return b;
 			}
 
 			bpf_error("only ethernet/FDDI/token ring/802.11/ATM LANE/Fibre Channel supports link-level host name");
@@ -6142,7 +6201,8 @@
 			if (alist == NULL || *alist == NULL)
 				bpf_error("unknown host '%s'", name);
 			tproto = proto;
-			if (off_linktype == (u_int)-1 && tproto == Q_DEFAULT)
+			if (off_linktype.constant_part == (u_int)-1 &&
+			    tproto == Q_DEFAULT)
 				tproto = Q_IP;
 			b = gen_host(**alist++, 0xffffffff, tproto, dir, q.addr);
 			while (*alist) {
@@ -6160,7 +6220,8 @@
 			ai = res;
 			b = tmp = NULL;
 			tproto = tproto6 = proto;
-			if (off_linktype == -1 && tproto == Q_DEFAULT) {
+			if (off_linktype.constant_part == -1 &&
+			    tproto == Q_DEFAULT) {
 				tproto = Q_IP;
 				tproto6 = Q_IPV6;
 			}
@@ -6250,7 +6311,7 @@
 		if (proto != Q_DEFAULT &&
 		    proto != Q_UDP && proto != Q_TCP && proto != Q_SCTP)
 			bpf_error("illegal qualifier of 'portrange'");
-		if (pcap_nametoportrange(name, &port1, &port2, &real_proto) == 0) 
+		if (pcap_nametoportrange(name, &port1, &port2, &real_proto) == 0)
 			bpf_error("unknown port in range '%s'", name);
 		if (proto == Q_UDP) {
 			if (real_proto == IPPROTO_TCP)
@@ -6277,7 +6338,7 @@
 				bpf_error("port in range '%s' is tcp", name);
 			else
 				/* override PROTO_UNDEF */
-				real_proto = IPPROTO_SCTP;	
+				real_proto = IPPROTO_SCTP;
 		}
 		if (port1 < 0)
 			bpf_error("illegal port number %d < 0", port1);
@@ -6333,7 +6394,7 @@
 struct block *
 gen_mcode(s1, s2, masklen, q)
 	register const char *s1, *s2;
-	register int masklen;
+	register unsigned int masklen;
 	struct qual q;
 {
 	register int nlen, mlen;
@@ -6492,7 +6553,7 @@
 struct block *
 gen_mcode6(s1, s2, masklen, q)
 	register const char *s1, *s2;
-	register int masklen;
+	register unsigned int masklen;
 	struct qual q;
 {
 	struct addrinfo *res;
@@ -6562,7 +6623,11 @@
 		case DLT_EN10MB:
 		case DLT_NETANALYZER:
 		case DLT_NETANALYZER_TRANSPARENT:
-			return gen_ehostop(eaddr, (int)q.dir);
+			tmp = gen_prevlinkhdr_check();
+			b = gen_ehostop(eaddr, (int)q.dir);
+			if (tmp != NULL)
+				gen_and(tmp, b);
+			return b;
 		case DLT_FDDI:
 			return gen_fhostop(eaddr, (int)q.dir);
 		case DLT_IEEE802:
@@ -6573,25 +6638,6 @@
 		case DLT_IEEE802_11_RADIO:
 		case DLT_PPI:
 			return gen_wlanhostop(eaddr, (int)q.dir);
-		case DLT_SUNATM:
-			if (is_lane) {
-				/*
-				 * Check that the packet doesn't begin with an
-				 * LE Control marker.  (We've already generated
-				 * a test for LANE.)
-				 */
-				tmp = gen_cmp(OR_LINK, SUNATM_PKT_BEGIN_POS, BPF_H,
-					0xFF00);
-				gen_not(tmp);
-
-				/*
-				 * Now check the MAC address.
-				 */
-				b = gen_ehostop(eaddr, (int)q.dir);
-				gen_and(tmp, b);
-				return b;
-			}
-			break;
 		case DLT_IP_OVER_FC:
 			return gen_ipfchostop(eaddr, (int)q.dir);
 		default:
@@ -6715,7 +6761,7 @@
 		 * frame, so that 0 refers, for Ethernet LANE, to
 		 * the beginning of the destination address?
 		 */
-		s = gen_llprefixlen();
+		s = gen_abs_offset_varpart(&off_linkhdr);
 
 		/*
 		 * If "s" is non-null, it has code to arrange that the
@@ -6741,7 +6787,7 @@
 		 * into the X register and then added to the index).
 		 */
 		tmp = new_stmt(BPF_LD|BPF_IND|size);
-		tmp->s.k = off_ll;
+		tmp->s.k = off_linkhdr.constant_part;
 		sappend(s, tmp);
 		sappend(inst->s, s);
 		break;
@@ -6762,16 +6808,16 @@
 		 * XXX - are there any cases where we want
 		 * off_nl_nosnap?
 		 */
-		s = gen_off_macpl();
+		s = gen_abs_offset_varpart(&off_linkpl);
 
 		/*
 		 * If "s" is non-null, it has code to arrange that the
-		 * X register contains the offset of the MAC-layer
-		 * payload.  Add to it the offset computed into the
-		 * register specified by "index", and move that into
-		 * the X register.  Otherwise, just load into the X
-		 * register the offset computed into the register specified
-		 * by "index".
+		 * X register contains the variable part of the offset
+		 * of the link-layer payload.  Add to it the offset
+		 * computed into the register specified by "index",
+		 * and move that into the X register.  Otherwise, just
+		 * load into the X register the offset computed into
+		 * the register specified by "index".
 		 */
 		if (s != NULL) {
 			sappend(s, xfer_to_a(inst));
@@ -6783,17 +6829,12 @@
 		/*
 		 * Load the item at the sum of the offset we've put in the
 		 * X register, the offset of the start of the network
-		 * layer header from the beginning of the MAC-layer
-		 * payload, and the purported offset of the start of the
-		 * MAC-layer payload (which might be 0 if there's a
-		 * variable-length prefix before the link-layer header
-		 * or the link-layer header itself is variable-length;
-		 * the variable-length offset of the start of the
-		 * MAC-layer payload is what we put into the X register
-		 * and then added to the index).
+		 * layer header from the beginning of the link-layer
+		 * payload, and the constant part of the offset of the
+		 * start of the link-layer payload.
 		 */
 		tmp = new_stmt(BPF_LD|BPF_IND|size);
-		tmp->s.k = off_macpl + off_nl;
+		tmp->s.k = off_linkpl.constant_part + off_nl;
 		sappend(s, tmp);
 		sappend(inst->s, s);
 
@@ -6833,26 +6874,24 @@
 		s = gen_loadx_iphdrlen();
 
 		/*
-		 * The X register now contains the sum of the length
-		 * of any variable-length header preceding the link-layer
-		 * header, any variable-length link-layer header, and the
+		 * The X register now contains the sum of the variable
+		 * part of the offset of the link-layer payload and the
 		 * length of the network-layer header.
 		 *
 		 * Load into the A register the offset relative to
 		 * the beginning of the transport layer header,
 		 * add the X register to that, move that to the
 		 * X register, and load with an offset from the
-		 * X register equal to the offset of the network
-		 * layer header relative to the beginning of
-		 * the MAC-layer payload plus the fixed-length
-		 * portion of the offset of the MAC-layer payload
-		 * from the beginning of the raw packet data.
+		 * X register equal to the sum of the constant part of
+		 * the offset of the link-layer payload and the offset,
+		 * relative to the beginning of the link-layer payload,
+		 * of the network-layer header.
 		 */
 		sappend(s, xfer_to_a(inst));
 		sappend(s, new_stmt(BPF_ALU|BPF_ADD|BPF_X));
 		sappend(s, new_stmt(BPF_MISC|BPF_TAX));
 		sappend(s, tmp = new_stmt(BPF_LD|BPF_IND|size));
-		tmp->s.k = off_macpl + off_nl;
+		tmp->s.k = off_linkpl.constant_part + off_nl;
 		sappend(inst->s, s);
 
 		/*
@@ -7115,14 +7154,14 @@
 		abort();
 
 	case '=':
-		return gen_cmp(OR_LINK, (u_int)idx, BPF_B, (bpf_int32)val);
+		return gen_cmp(OR_LINKHDR, (u_int)idx, BPF_B, (bpf_int32)val);
 
 	case '<':
-		b = gen_cmp_lt(OR_LINK, (u_int)idx, BPF_B, (bpf_int32)val);
+		b = gen_cmp_lt(OR_LINKHDR, (u_int)idx, BPF_B, (bpf_int32)val);
 		return b;
 
 	case '>':
-		b = gen_cmp_gt(OR_LINK, (u_int)idx, BPF_B, (bpf_int32)val);
+		b = gen_cmp_gt(OR_LINKHDR, (u_int)idx, BPF_B, (bpf_int32)val);
 		return b;
 
 	case '|':
@@ -7162,7 +7201,11 @@
 		case DLT_EN10MB:
 		case DLT_NETANALYZER:
 		case DLT_NETANALYZER_TRANSPARENT:
-			return gen_ehostop(ebroadcast, Q_DST);
+			b1 = gen_prevlinkhdr_check();
+			b0 = gen_ehostop(ebroadcast, Q_DST);
+			if (b1 != NULL)
+				gen_and(b1, b0);
+			return b0;
 		case DLT_FDDI:
 			return gen_fhostop(ebroadcast, Q_DST);
 		case DLT_IEEE802:
@@ -7175,25 +7218,6 @@
 			return gen_wlanhostop(ebroadcast, Q_DST);
 		case DLT_IP_OVER_FC:
 			return gen_ipfchostop(ebroadcast, Q_DST);
-		case DLT_SUNATM:
-			if (is_lane) {
-				/*
-				 * Check that the packet doesn't begin with an
-				 * LE Control marker.  (We've already generated
-				 * a test for LANE.)
-				 */
-				b1 = gen_cmp(OR_LINK, SUNATM_PKT_BEGIN_POS,
-				    BPF_H, 0xFF00);
-				gen_not(b1);
-
-				/*
-				 * Now check the MAC address.
-				 */
-				b0 = gen_ehostop(ebroadcast, Q_DST);
-				gen_and(b1, b0);
-				return b0;
-			}
-			break;
 		default:
 			bpf_error("not a broadcast link");
 		}
@@ -7209,8 +7233,8 @@
 			bpf_error("netmask not known, so 'ip broadcast' not supported");
 		b0 = gen_linktype(ETHERTYPE_IP);
 		hostmask = ~netmask;
-		b1 = gen_mcmp(OR_NET, 16, BPF_W, (bpf_int32)0, hostmask);
-		b2 = gen_mcmp(OR_NET, 16, BPF_W,
+		b1 = gen_mcmp(OR_LINKPL, 16, BPF_W, (bpf_int32)0, hostmask);
+		b2 = gen_mcmp(OR_LINKPL, 16, BPF_W,
 			      (bpf_int32)(~0 & hostmask), hostmask);
 		gen_or(b1, b2);
 		gen_and(b0, b2);
@@ -7233,7 +7257,7 @@
 	register struct slist *s;
 
 	/* link[offset] & 1 != 0 */
-	s = gen_load_a(OR_LINK, offset, BPF_B);
+	s = gen_load_a(OR_LINKHDR, offset, BPF_B);
 	b0 = new_block(JMP(BPF_JSET));
 	b0->s.k = 1;
 	b0->stmts = s;
@@ -7259,8 +7283,12 @@
 		case DLT_EN10MB:
 		case DLT_NETANALYZER:
 		case DLT_NETANALYZER_TRANSPARENT:
+			b1 = gen_prevlinkhdr_check();
 			/* ether[0] & 1 != 0 */
-			return gen_mac_multicast(0);
+			b0 = gen_mac_multicast(0);
+			if (b1 != NULL)
+				gen_and(b1, b0);
+			return b0;
 		case DLT_FDDI:
 			/*
 			 * XXX TEST THIS: MIGHT NOT PORT PROPERLY XXX
@@ -7298,7 +7326,7 @@
 			 *
 			 * First, check for To DS set, i.e. "link[1] & 0x01".
 			 */
-			s = gen_load_a(OR_LINK, 1, BPF_B);
+			s = gen_load_a(OR_LINKHDR, 1, BPF_B);
 			b1 = new_block(JMP(BPF_JSET));
 			b1->s.k = 0x01;	/* To DS */
 			b1->stmts = s;
@@ -7313,7 +7341,7 @@
 			 * Now, check for To DS not set, i.e. check
 			 * "!(link[1] & 0x01)".
 			 */
-			s = gen_load_a(OR_LINK, 1, BPF_B);
+			s = gen_load_a(OR_LINKHDR, 1, BPF_B);
 			b2 = new_block(JMP(BPF_JSET));
 			b2->s.k = 0x01;	/* To DS */
 			b2->stmts = s;
@@ -7335,7 +7363,7 @@
 			 * Now check for a data frame.
 			 * I.e, check "link[0] & 0x08".
 			 */
-			s = gen_load_a(OR_LINK, 0, BPF_B);
+			s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 			b1 = new_block(JMP(BPF_JSET));
 			b1->s.k = 0x08;
 			b1->stmts = s;
@@ -7350,7 +7378,7 @@
 			 * is a management frame.
 			 * I.e, check "!(link[0] & 0x08)".
 			 */
-			s = gen_load_a(OR_LINK, 0, BPF_B);
+			s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 			b2 = new_block(JMP(BPF_JSET));
 			b2->s.k = 0x08;
 			b2->stmts = s;
@@ -7377,7 +7405,7 @@
 			 *
 			 * I.e., check "!(link[0] & 0x04)".
 			 */
-			s = gen_load_a(OR_LINK, 0, BPF_B);
+			s = gen_load_a(OR_LINKHDR, 0, BPF_B);
 			b1 = new_block(JMP(BPF_JSET));
 			b1->s.k = 0x04;
 			b1->stmts = s;
@@ -7392,23 +7420,6 @@
 		case DLT_IP_OVER_FC:
 			b0 = gen_mac_multicast(2);
 			return b0;
-		case DLT_SUNATM:
-			if (is_lane) {
-				/*
-				 * Check that the packet doesn't begin with an
-				 * LE Control marker.  (We've already generated
-				 * a test for LANE.)
-				 */
-				b1 = gen_cmp(OR_LINK, SUNATM_PKT_BEGIN_POS,
-				    BPF_H, 0xFF00);
-				gen_not(b1);
-
-				/* ether[off_mac] & 1 != 0 */
-				b0 = gen_mac_multicast(off_mac);
-				gen_and(b1, b0);
-				return b0;
-			}
-			break;
 		default:
 			break;
 		}
@@ -7417,13 +7428,13 @@
 
 	case Q_IP:
 		b0 = gen_linktype(ETHERTYPE_IP);
-		b1 = gen_cmp_ge(OR_NET, 16, BPF_B, (bpf_int32)224);
+		b1 = gen_cmp_ge(OR_LINKPL, 16, BPF_B, (bpf_int32)224);
 		gen_and(b0, b1);
 		return b1;
 
 	case Q_IPV6:
 		b0 = gen_linktype(ETHERTYPE_IPV6);
-		b1 = gen_cmp(OR_NET, 24, BPF_B, (bpf_int32)255);
+		b1 = gen_cmp(OR_LINKPL, 24, BPF_B, (bpf_int32)255);
 		gen_and(b0, b1);
 		return b1;
 	}
@@ -7461,16 +7472,16 @@
 	case DLT_IPNET:
 		if (dir) {
 			/* match outgoing packets */
-			b0 = gen_cmp(OR_LINK, 2, BPF_H, IPNET_OUTBOUND);
+			b0 = gen_cmp(OR_LINKHDR, 2, BPF_H, IPNET_OUTBOUND);
 		} else {
 			/* match incoming packets */
-			b0 = gen_cmp(OR_LINK, 2, BPF_H, IPNET_INBOUND);
+			b0 = gen_cmp(OR_LINKHDR, 2, BPF_H, IPNET_INBOUND);
 		}
 		break;
 
 	case DLT_LINUX_SLL:
 		/* match outgoing packets */
-		b0 = gen_cmp(OR_LINK, 0, BPF_H, LINUX_SLL_OUTGOING);
+		b0 = gen_cmp(OR_LINKHDR, 0, BPF_H, LINUX_SLL_OUTGOING);
 		if (!dir) {
 			/* to filter on inbound traffic, invert the match */
 			gen_not(b0);
@@ -7479,7 +7490,7 @@
 
 #ifdef HAVE_NET_PFVAR_H
 	case DLT_PFLOG:
-		b0 = gen_cmp(OR_LINK, offsetof(struct pfloghdr, dir), BPF_B,
+		b0 = gen_cmp(OR_LINKHDR, offsetof(struct pfloghdr, dir), BPF_B,
 		    (bpf_int32)((dir == 0) ? PF_IN : PF_OUT));
 		break;
 #endif
@@ -7487,10 +7498,10 @@
 	case DLT_PPP_PPPD:
 		if (dir) {
 			/* match outgoing packets */
-			b0 = gen_cmp(OR_LINK, 0, BPF_B, PPP_PPPD_OUT);
+			b0 = gen_cmp(OR_LINKHDR, 0, BPF_B, PPP_PPPD_OUT);
 		} else {
 			/* match incoming packets */
-			b0 = gen_cmp(OR_LINK, 0, BPF_B, PPP_PPPD_IN);
+			b0 = gen_cmp(OR_LINKHDR, 0, BPF_B, PPP_PPPD_IN);
 		}
 		break;
 
@@ -7521,10 +7532,10 @@
 		 * the byte after the 3-byte magic number */
 		if (dir) {
 			/* match outgoing packets */
-			b0 = gen_mcmp(OR_LINK, 3, BPF_B, 0, 0x01);
+			b0 = gen_mcmp(OR_LINKHDR, 3, BPF_B, 0, 0x01);
 		} else {
 			/* match incoming packets */
-			b0 = gen_mcmp(OR_LINK, 3, BPF_B, 1, 0x01);
+			b0 = gen_mcmp(OR_LINKHDR, 3, BPF_B, 1, 0x01);
 		}
 		break;
 
@@ -7549,7 +7560,7 @@
 			/* NOTREACHED */
 		}
 		/* match outgoing packets */
-		b0 = gen_cmp(OR_LINK, SKF_AD_OFF + SKF_AD_PKTTYPE, BPF_H,
+		b0 = gen_cmp(OR_LINKHDR, SKF_AD_OFF + SKF_AD_PKTTYPE, BPF_H,
 		             PACKET_OUTGOING);
 		if (!dir) {
 			/* to filter on inbound traffic, invert the match */
@@ -7584,7 +7595,7 @@
 		    len-1);
 		/* NOTREACHED */
 	}
-	b0 = gen_bcmp(OR_LINK, off, strlen(ifname), (const u_char *)ifname);
+	b0 = gen_bcmp(OR_LINKHDR, off, strlen(ifname), (const u_char *)ifname);
 	return (b0);
 }
 
@@ -7605,7 +7616,7 @@
 		/* NOTREACHED */
 	}
 
-	b0 = gen_bcmp(OR_LINK, offsetof(struct pfloghdr, ruleset),
+	b0 = gen_bcmp(OR_LINKHDR, offsetof(struct pfloghdr, ruleset),
 	    strlen(ruleset), (const u_char *)ruleset);
 	return (b0);
 }
@@ -7621,7 +7632,7 @@
 		/* NOTREACHED */
 	}
 
-	b0 = gen_cmp(OR_LINK, offsetof(struct pfloghdr, rulenr), BPF_W,
+	b0 = gen_cmp(OR_LINKHDR, offsetof(struct pfloghdr, rulenr), BPF_W,
 		 (bpf_int32)rnr);
 	return (b0);
 }
@@ -7637,7 +7648,7 @@
 		/* NOTREACHED */
 	}
 
-	b0 = gen_cmp(OR_LINK, offsetof(struct pfloghdr, subrulenr), BPF_W,
+	b0 = gen_cmp(OR_LINKHDR, offsetof(struct pfloghdr, subrulenr), BPF_W,
 	    (bpf_int32)srnr);
 	return (b0);
 }
@@ -7653,7 +7664,7 @@
 		/* NOTREACHED */
 	}
 
-	b0 = gen_cmp(OR_LINK, offsetof(struct pfloghdr, reason), BPF_B,
+	b0 = gen_cmp(OR_LINKHDR, offsetof(struct pfloghdr, reason), BPF_B,
 	    (bpf_int32)reason);
 	return (b0);
 }
@@ -7669,7 +7680,7 @@
 		/* NOTREACHED */
 	}
 
-	b0 = gen_cmp(OR_LINK, offsetof(struct pfloghdr, action), BPF_B,
+	b0 = gen_cmp(OR_LINKHDR, offsetof(struct pfloghdr, action), BPF_B,
 	    (bpf_int32)action);
 	return (b0);
 }
@@ -7735,7 +7746,7 @@
 	case DLT_PRISM_HEADER:
 	case DLT_IEEE802_11_RADIO_AVS:
 	case DLT_IEEE802_11_RADIO:
-		b0 = gen_mcmp(OR_LINK, 0, BPF_B, (bpf_int32)type,
+		b0 = gen_mcmp(OR_LINKHDR, 0, BPF_B, (bpf_int32)type,
 		    (bpf_int32)mask);
 		break;
 
@@ -7765,7 +7776,7 @@
 		/* NOTREACHED */
 	}
 
-	b0 = gen_mcmp(OR_LINK, 1, BPF_B, (bpf_int32)fcdir,
+	b0 = gen_mcmp(OR_LINKHDR, 1, BPF_B, (bpf_int32)fcdir,
 		(bpf_u_int32)IEEE80211_FC1_DIR_MASK);
 
 	return (b0);
@@ -7808,10 +7819,10 @@
 	switch (dir) {
 	/* src comes first, different from Ethernet */
 	case Q_SRC:
-		return gen_bcmp(OR_LINK, 0, 1, eaddr);
+		return gen_bcmp(OR_LINKHDR, 0, 1, eaddr);
 
 	case Q_DST:
-		return gen_bcmp(OR_LINK, 1, 1, eaddr);
+		return gen_bcmp(OR_LINKHDR, 1, 1, eaddr);
 
 	case Q_AND:
 		b0 = gen_ahostop(eaddr, Q_SRC);
@@ -7854,6 +7865,72 @@
 	/* NOTREACHED */
 }
 
+#if defined(SKF_AD_VLAN_TAG) && defined(SKF_AD_VLAN_TAG_PRESENT)
+static struct block *
+gen_vlan_bpf_extensions(int vlan_num)
+{
+        struct block *b0, *b1;
+        struct slist *s;
+
+        /* generate new filter code based on extracting packet
+         * metadata */
+        s = new_stmt(BPF_LD|BPF_B|BPF_ABS);
+        s->s.k = SKF_AD_OFF + SKF_AD_VLAN_TAG_PRESENT;
+
+        b0 = new_block(JMP(BPF_JEQ));
+        b0->stmts = s;
+        b0->s.k = 1;
+
+        if (vlan_num >= 0) {
+                s = new_stmt(BPF_LD|BPF_B|BPF_ABS);
+                s->s.k = SKF_AD_OFF + SKF_AD_VLAN_TAG;
+
+                b1 = new_block(JMP(BPF_JEQ));
+                b1->stmts = s;
+                b1->s.k = (bpf_int32) vlan_num;
+
+                gen_and(b0,b1);
+                b0 = b1;
+        }
+
+        return b0;
+}
+#endif
+
+static struct block *
+gen_vlan_no_bpf_extensions(int vlan_num)
+{
+        struct block *b0, *b1;
+
+        /* check for VLAN, including QinQ */
+        b0 = gen_linktype(ETHERTYPE_8021Q);
+        b1 = gen_linktype(ETHERTYPE_8021QINQ);
+        gen_or(b0,b1);
+        b0 = b1;
+
+        /* If a specific VLAN is requested, check VLAN id */
+        if (vlan_num >= 0) {
+                b1 = gen_mcmp(OR_LINKPL, 0, BPF_H,
+                              (bpf_int32)vlan_num, 0x0fff);
+                gen_and(b0, b1);
+                b0 = b1;
+        }
+
+	/*
+	 * The payload follows the full header, including the
+	 * VLAN tags, so skip past this VLAN tag.
+	 */
+        off_linkpl.constant_part += 4;
+
+	/*
+	 * The link-layer type information follows the VLAN tags, so
+	 * skip past this VLAN tag.
+	 */
+        off_linktype.constant_part += 4;
+
+        return b0;
+}
+
 /*
  * support IEEE 802.1Q VLAN trunk over ethernet
  */
@@ -7861,7 +7938,7 @@
 gen_vlan(vlan_num)
 	int vlan_num;
 {
-	struct	block	*b0, *b1;
+	struct	block	*b0;
 
 	/* can't check for VLAN-encapsulated packets inside MPLS */
 	if (label_stack_depth > 0)
@@ -7898,35 +7975,34 @@
 	 * be done assuming a VLAN, even though the "or" could be viewed
 	 * as meaning "or, if this isn't a VLAN packet...".
 	 */
-	orig_nl = off_nl;
-
 	switch (linktype) {
 
 	case DLT_EN10MB:
 	case DLT_NETANALYZER:
 	case DLT_NETANALYZER_TRANSPARENT:
-		/* check for VLAN, including QinQ */
-		b0 = gen_cmp(OR_LINK, off_linktype, BPF_H,
-		    (bpf_int32)ETHERTYPE_8021Q);
-		b1 = gen_cmp(OR_LINK, off_linktype, BPF_H,
-		    (bpf_int32)ETHERTYPE_8021QINQ);
-		gen_or(b0,b1);
-		b0 = b1;
-
-		/* If a specific VLAN is requested, check VLAN id */
-		if (vlan_num >= 0) {
-			b1 = gen_mcmp(OR_MACPL, 0, BPF_H,
-			    (bpf_int32)vlan_num, 0x0fff);
-			gen_and(b0, b1);
-			b0 = b1;
-		}
-
-		off_macpl += 4;
-		off_linktype += 4;
-#if 0
-		off_nl_nosnap += 4;
-		off_nl += 4;
+#if defined(SKF_AD_VLAN_TAG) && defined(SKF_AD_VLAN_TAG_PRESENT)
+		/* Verify that this is the outer part of the packet and
+		 * not encapsulated somehow. */
+		if (vlan_stack_depth == 0 && !off_linkhdr.is_variable &&
+		    off_linkhdr.constant_part ==
+		    off_outermostlinkhdr.constant_part) {
+			/*
+			 * Do we need special VLAN handling?
+			 */
+			if (bpf_pcap->bpf_codegen_flags & BPF_SPECIAL_VLAN_HANDLING)
+				b0 = gen_vlan_bpf_extensions(vlan_num);
+			else
+				b0 = gen_vlan_no_bpf_extensions(vlan_num);
+		} else
 #endif
+			b0 = gen_vlan_no_bpf_extensions(vlan_num);
+                break;
+
+	case DLT_IEEE802_11:
+	case DLT_PRISM_HEADER:
+	case DLT_IEEE802_11_RADIO_AVS:
+	case DLT_IEEE802_11_RADIO:
+		b0 = gen_vlan_no_bpf_extensions(vlan_num);
 		break;
 
 	default:
@@ -7935,6 +8011,8 @@
 		/*NOTREACHED*/
 	}
 
+        vlan_stack_depth++;
+
 	return (b0);
 }
 
@@ -7945,46 +8023,33 @@
 gen_mpls(label_num)
 	int label_num;
 {
-	struct	block	*b0,*b1;
-
-	/*
-	 * Change the offsets to point to the type and data fields within
-	 * the MPLS packet.  Just increment the offsets, so that we
-	 * can support a hierarchy, e.g. "mpls 100000 && mpls 1024" to
-	 * capture packets with an outer label of 100000 and an inner
-	 * label of 1024.
-	 *
-	 * XXX - this is a bit of a kludge.  See comments in gen_vlan().
-	 */
-        orig_nl = off_nl;
+	struct	block	*b0, *b1;
 
         if (label_stack_depth > 0) {
             /* just match the bottom-of-stack bit clear */
-            b0 = gen_mcmp(OR_MACPL, orig_nl-2, BPF_B, 0, 0x01);
+            b0 = gen_mcmp(OR_PREVMPLSHDR, 2, BPF_B, 0, 0x01);
         } else {
             /*
-             * Indicate that we're checking MPLS-encapsulated headers,
-             * to make sure higher level code generators don't try to
-             * match against IP-related protocols such as Q_ARP, Q_RARP
-             * etc.
+             * We're not in an MPLS stack yet, so check the link-layer
+             * type against MPLS.
              */
             switch (linktype) {
-                
+
             case DLT_C_HDLC: /* fall through */
             case DLT_EN10MB:
             case DLT_NETANALYZER:
             case DLT_NETANALYZER_TRANSPARENT:
                     b0 = gen_linktype(ETHERTYPE_MPLS);
                     break;
-                
+
             case DLT_PPP:
                     b0 = gen_linktype(PPP_MPLS_UCAST);
                     break;
-                
+
                     /* FIXME add other DLT_s ...
                      * for Frame-Relay/and ATM this may get messy due to SNAP headers
                      * leave it for now */
-                
+
             default:
                     bpf_error("no MPLS support for data link type %d",
                           linktype);
@@ -7997,12 +8062,26 @@
 	/* If a specific MPLS label is requested, check it */
 	if (label_num >= 0) {
 		label_num = label_num << 12; /* label is shifted 12 bits on the wire */
-		b1 = gen_mcmp(OR_MACPL, orig_nl, BPF_W, (bpf_int32)label_num,
+		b1 = gen_mcmp(OR_LINKPL, 0, BPF_W, (bpf_int32)label_num,
 		    0xfffff000); /* only compare the first 20 bits */
 		gen_and(b0, b1);
 		b0 = b1;
 	}
 
+        /*
+         * Change the offsets to point to the type and data fields within
+         * the MPLS packet.  Just increment the offsets, so that we
+         * can support a hierarchy, e.g. "mpls 100000 && mpls 1024" to
+         * capture packets with an outer label of 100000 and an inner
+         * label of 1024.
+         *
+         * Increment the MPLS stack depth as well; this indicates that
+         * we're checking MPLS-encapsulated headers, to make sure higher
+         * level code generators don't try to match against IP-related
+         * protocols such as Q_ARP, Q_RARP etc.
+         *
+         * XXX - this is a bit of a kludge.  See comments in gen_vlan().
+         */
         off_nl_nosnap += 4;
         off_nl += 4;
         label_stack_depth++;
@@ -8030,6 +8109,14 @@
 	 */
 	b0 = gen_linktype((bpf_int32)ETHERTYPE_PPPOES);
 
+	/* If a specific session is requested, check PPPoE session id */
+	if (sess_num >= 0) {
+		b1 = gen_mcmp(OR_LINKPL, 0, BPF_W,
+		    (bpf_int32)sess_num, 0x0000ffff);
+		gen_and(b0, b1);
+		b0 = b1;
+	}
+
 	/*
 	 * Change the offsets to point to the type and data fields within
 	 * the PPP packet, and note that this is PPPoE rather than
@@ -8058,20 +8145,7 @@
 	 * as all the "or ..." tests would be done assuming PPPoE, even
 	 * though the "or" could be viewed as meaning "or, if this isn't
 	 * a PPPoE packet...".
-	 */
-	orig_linktype = off_linktype;	/* save original values */
-	orig_nl = off_nl;
-	is_pppoes = 1;
-
-	/* If a specific session is requested, check PPPoE session id */
-	if (sess_num >= 0) {
-		b1 = gen_mcmp(OR_MACPL, orig_nl, BPF_W,
-		    (bpf_int32)sess_num, 0x0000ffff);
-		gen_and(b0, b1);
-		b0 = b1;
-	}
-
-	/*
+	 *
 	 * The "network-layer" protocol is PPPoE, which has a 6-byte
 	 * PPPoE header, followed by a PPP packet.
 	 *
@@ -8082,15 +8156,309 @@
 	 * link-layer payload, including any 802.2 LLC header, so
 	 * it's 6 bytes past off_nl.
 	 */
-	off_linktype = off_nl + 6;
+	PUSH_LINKHDR(DLT_PPP, off_linkpl.is_variable,
+	    off_linkpl.constant_part + off_nl + 6, /* 6 bytes past the PPPoE header */
+	    off_linkpl.reg);
 
-	/*
-	 * The network-layer offsets are relative to the beginning
-	 * of the MAC-layer payload; that's past the 6-byte
-	 * PPPoE header and the 2-byte PPP header.
-	 */
-	off_nl = 6+2;
-	off_nl_nosnap = 6+2;
+	off_linktype = off_linkhdr;
+	off_linkpl.constant_part = off_linkhdr.constant_part + 2;
+
+	off_nl = 0;
+	off_nl_nosnap = 0;	/* no 802.2 LLC */
+
+	return b0;
+}
+
+/* Check that this is Geneve and the VNI is correct if
+ * specified. Parameterized to handle both IPv4 and IPv6. */
+static struct block *
+gen_geneve_check(struct block *(*gen_portfn)(int, int, int),
+		 enum e_offrel offrel, int vni)
+{
+	struct block *b0, *b1;
+
+	b0 = gen_portfn(GENEVE_PORT, IPPROTO_UDP, Q_DST);
+
+	/* Check that we are operating on version 0. Otherwise, we
+	 * can't decode the rest of the fields. The version is 2 bits
+	 * in the first byte of the Geneve header. */
+	b1 = gen_mcmp(offrel, 8, BPF_B, (bpf_int32)0, 0xc0);
+	gen_and(b0, b1);
+	b0 = b1;
+
+	if (vni >= 0) {
+		vni <<= 8; /* VNI is in the upper 3 bytes */
+		b1 = gen_mcmp(offrel, 12, BPF_W, (bpf_int32)vni,
+			      0xffffff00);
+		gen_and(b0, b1);
+		b0 = b1;
+	}
+
+	return b0;
+}
+
+/* The IPv4 and IPv6 Geneve checks need to do two things:
+ * - Verify that this actually is Geneve with the right VNI.
+ * - Place the IP header length (plus variable link prefix if
+ *   needed) into register A to be used later to compute
+ *   the inner packet offsets. */
+static struct block *
+gen_geneve4(int vni)
+{
+	struct block *b0, *b1;
+	struct slist *s, *s1;
+
+	b0 = gen_geneve_check(gen_port, OR_TRAN_IPV4, vni);
+
+	/* Load the IP header length into A. */
+	s = gen_loadx_iphdrlen();
+
+	s1 = new_stmt(BPF_MISC|BPF_TXA);
+	sappend(s, s1);
+
+	/* Forcibly append these statements to the true condition
+	 * of the protocol check by creating a new block that is
+	 * always true and ANDing them. */
+	b1 = new_block(BPF_JMP|BPF_JEQ|BPF_X);
+	b1->stmts = s;
+	b1->s.k = 0;
+
+	gen_and(b0, b1);
+
+	return b1;
+}
+
+static struct block *
+gen_geneve6(int vni)
+{
+	struct block *b0, *b1;
+	struct slist *s, *s1;
+
+	b0 = gen_geneve_check(gen_port6, OR_TRAN_IPV6, vni);
+
+	/* Load the IP header length. We need to account for a
+	 * variable length link prefix if there is one. */
+	s = gen_abs_offset_varpart(&off_linkpl);
+	if (s) {
+		s1 = new_stmt(BPF_LD|BPF_IMM);
+		s1->s.k = 40;
+		sappend(s, s1);
+
+		s1 = new_stmt(BPF_ALU|BPF_ADD|BPF_X);
+		s1->s.k = 0;
+		sappend(s, s1);
+	} else {
+		s = new_stmt(BPF_LD|BPF_IMM);
+		s->s.k = 40;;
+	}
+
+	/* Forcibly append these statements to the true condition
+	 * of the protocol check by creating a new block that is
+	 * always true and ANDing them. */
+	s1 = new_stmt(BPF_MISC|BPF_TAX);
+	sappend(s, s1);
+
+	b1 = new_block(BPF_JMP|BPF_JEQ|BPF_X);
+	b1->stmts = s;
+	b1->s.k = 0;
+
+	gen_and(b0, b1);
+
+	return b1;
+}
+
+/* We need to store three values based on the Geneve header::
+ * - The offset of the linktype.
+ * - The offset of the end of the Geneve header.
+ * - The offset of the end of the encapsulated MAC header. */
+static struct slist *
+gen_geneve_offsets(void)
+{
+	struct slist *s, *s1, *s_proto;
+
+	/* First we need to calculate the offset of the Geneve header
+	 * itself. This is composed of the IP header previously calculated
+	 * (include any variable link prefix) and stored in A plus the
+	 * fixed sized headers (fixed link prefix, MAC length, and UDP
+	 * header). */
+	s = new_stmt(BPF_ALU|BPF_ADD|BPF_K);
+	s->s.k = off_linkpl.constant_part + off_nl + 8;
+
+	/* Stash this in X since we'll need it later. */
+	s1 = new_stmt(BPF_MISC|BPF_TAX);
+	sappend(s, s1);
+
+	/* The EtherType in Geneve is 2 bytes in. Calculate this and
+	 * store it. */
+	s1 = new_stmt(BPF_ALU|BPF_ADD|BPF_K);
+	s1->s.k = 2;
+	sappend(s, s1);
+
+	off_linktype.reg = alloc_reg();
+	off_linktype.is_variable = 1;
+	off_linktype.constant_part = 0;
+
+	s1 = new_stmt(BPF_ST);
+	s1->s.k = off_linktype.reg;
+	sappend(s, s1);
+
+	/* Load the Geneve option length and mask and shift to get the
+	 * number of bytes. It is stored in the first byte of the Geneve
+	 * header. */
+	s1 = new_stmt(BPF_LD|BPF_IND|BPF_B);
+	s1->s.k = 0;
+	sappend(s, s1);
+
+	s1 = new_stmt(BPF_ALU|BPF_AND|BPF_K);
+	s1->s.k = 0x3f;
+	sappend(s, s1);
+
+	s1 = new_stmt(BPF_ALU|BPF_MUL|BPF_K);
+	s1->s.k = 4;
+	sappend(s, s1);
+
+	/* Add in the rest of the Geneve base header. */
+	s1 = new_stmt(BPF_ALU|BPF_ADD|BPF_K);
+	s1->s.k = 8;
+	sappend(s, s1);
+
+	/* Add the Geneve header length to its offset and store. */
+	s1 = new_stmt(BPF_ALU|BPF_ADD|BPF_X);
+	s1->s.k = 0;
+	sappend(s, s1);
+
+	/* Set the encapsulated type as Ethernet. Even though we may
+	 * not actually have Ethernet inside there are two reasons this
+	 * is useful:
+	 * - The linktype field is always in EtherType format regardless
+	 *   of whether it is in Geneve or an inner Ethernet frame.
+	 * - The only link layer that we have specific support for is
+	 *   Ethernet. We will confirm that the packet actually is
+	 *   Ethernet at runtime before executing these checks. */
+	PUSH_LINKHDR(DLT_EN10MB, 1, 0, alloc_reg());
+
+	s1 = new_stmt(BPF_ST);
+	s1->s.k = off_linkhdr.reg;
+	sappend(s, s1);
+
+	/* Calculate whether we have an Ethernet header or just raw IP/
+	 * MPLS/etc. If we have Ethernet, advance the end of the MAC offset
+	 * and linktype by 14 bytes so that the network header can be found
+	 * seamlessly. Otherwise, keep what we've calculated already. */
+
+	/* We have a bare jmp so we can't use the optimizer. */
+	no_optimize = 1;
+
+	/* Load the EtherType in the Geneve header, 2 bytes in. */
+	s1 = new_stmt(BPF_LD|BPF_IND|BPF_H);
+	s1->s.k = 2;
+	sappend(s, s1);
+
+	/* Load X with the end of the Geneve header. */
+	s1 = new_stmt(BPF_LDX|BPF_MEM);
+	s1->s.k = off_linkhdr.reg;
+	sappend(s, s1);
+
+	/* Check if the EtherType is Transparent Ethernet Bridging. At the
+	 * end of this check, we should have the total length in X. In
+	 * the non-Ethernet case, it's already there. */
+	s_proto = new_stmt(JMP(BPF_JEQ));
+	s_proto->s.k = ETHERTYPE_TEB;
+	sappend(s, s_proto);
+
+	s1 = new_stmt(BPF_MISC|BPF_TXA);
+	sappend(s, s1);
+	s_proto->s.jt = s1;
+
+	/* Since this is Ethernet, use the EtherType of the payload
+	 * directly as the linktype. Overwrite what we already have. */
+	s1 = new_stmt(BPF_ALU|BPF_ADD|BPF_K);
+	s1->s.k = 12;
+	sappend(s, s1);
+
+	s1 = new_stmt(BPF_ST);
+	s1->s.k = off_linktype.reg;
+	sappend(s, s1);
+
+	/* Advance two bytes further to get the end of the Ethernet
+	 * header. */
+	s1 = new_stmt(BPF_ALU|BPF_ADD|BPF_K);
+	s1->s.k = 2;
+	sappend(s, s1);
+
+	/* Move the result to X. */
+	s1 = new_stmt(BPF_MISC|BPF_TAX);
+	sappend(s, s1);
+
+	/* Store the final result of our linkpl calculation. */
+	off_linkpl.reg = alloc_reg();
+	off_linkpl.is_variable = 1;
+	off_linkpl.constant_part = 0;
+
+	s1 = new_stmt(BPF_STX);
+	s1->s.k = off_linkpl.reg;
+	sappend(s, s1);
+	s_proto->s.jf = s1;
+
+	off_nl = 0;
+
+	return s;
+}
+
+/* Check to see if this is a Geneve packet. */
+struct block *
+gen_geneve(int vni)
+{
+	struct block *b0, *b1;
+	struct slist *s;
+
+	b0 = gen_geneve4(vni);
+	b1 = gen_geneve6(vni);
+
+	gen_or(b0, b1);
+	b0 = b1;
+
+	/* Later filters should act on the payload of the Geneve frame,
+	 * update all of the header pointers. Attach this code so that
+	 * it gets executed in the event that the Geneve filter matches. */
+	s = gen_geneve_offsets();
+
+	b1 = gen_true();
+	sappend(s, b1->stmts);
+	b1->stmts = s;
+
+	gen_and(b0, b1);
+
+	is_geneve = 1;
+
+	return b1;
+}
+
+/* Check that the encapsulated frame has a link layer header
+ * for Ethernet filters. */
+static struct block *
+gen_geneve_ll_check()
+{
+	struct block *b0;
+	struct slist *s, *s1;
+
+	/* The easiest way to see if there is a link layer present
+	 * is to check if the link layer header and payload are not
+	 * the same. */
+
+	/* Geneve always generates pure variable offsets so we can
+	 * compare only the registers. */
+	s = new_stmt(BPF_LD|BPF_MEM);
+	s->s.k = off_linkhdr.reg;
+
+	s1 = new_stmt(BPF_LDX|BPF_MEM);
+	s1->s.k = off_linkpl.reg;
+	sappend(s, s1);
+
+	b0 = new_block(BPF_JMP|BPF_JEQ|BPF_X);
+	b0->stmts = s;
+	b0->s.k = 0;
+	gen_not(b0);
 
 	return b0;
 }
@@ -8111,7 +8479,7 @@
 			bpf_error("'vpi' supported only on raw ATM");
 		if (off_vpi == (u_int)-1)
 			abort();
-		b0 = gen_ncmp(OR_LINK, off_vpi, BPF_B, 0xffffffff, jtype,
+		b0 = gen_ncmp(OR_LINKHDR, off_vpi, BPF_B, 0xffffffff, jtype,
 		    reverse, jvalue);
 		break;
 
@@ -8120,21 +8488,21 @@
 			bpf_error("'vci' supported only on raw ATM");
 		if (off_vci == (u_int)-1)
 			abort();
-		b0 = gen_ncmp(OR_LINK, off_vci, BPF_H, 0xffffffff, jtype,
+		b0 = gen_ncmp(OR_LINKHDR, off_vci, BPF_H, 0xffffffff, jtype,
 		    reverse, jvalue);
 		break;
 
 	case A_PROTOTYPE:
 		if (off_proto == (u_int)-1)
 			abort();	/* XXX - this isn't on FreeBSD */
-		b0 = gen_ncmp(OR_LINK, off_proto, BPF_B, 0x0f, jtype,
+		b0 = gen_ncmp(OR_LINKHDR, off_proto, BPF_B, 0x0f, jtype,
 		    reverse, jvalue);
 		break;
 
 	case A_MSGTYPE:
 		if (off_payload == (u_int)-1)
 			abort();
-		b0 = gen_ncmp(OR_LINK, off_payload + MSG_TYPE_POS, BPF_B,
+		b0 = gen_ncmp(OR_LINKHDR, off_payload + MSG_TYPE_POS, BPF_B,
 		    0xffffffff, jtype, reverse, jvalue);
 		break;
 
@@ -8143,7 +8511,7 @@
 			bpf_error("'callref' supported only on raw ATM");
 		if (off_proto == (u_int)-1)
 			abort();
-		b0 = gen_ncmp(OR_LINK, off_proto, BPF_B, 0xffffffff,
+		b0 = gen_ncmp(OR_LINKHDR, off_proto, BPF_B, 0xffffffff,
 		    jtype, reverse, jvalue);
 		break;
 
@@ -8227,16 +8595,13 @@
 		 * the offsets appropriately for LANE-encapsulated
 		 * Ethernet.
 		 *
-		 * "off_mac" is the offset of the Ethernet header,
-		 * which is 2 bytes past the ATM pseudo-header
-		 * (skipping the pseudo-header and 2-byte LE Client
-		 * field).  The other offsets are Ethernet offsets
-		 * relative to "off_mac".
+		 * We assume LANE means Ethernet, not Token Ring.
 		 */
-		is_lane = 1;
-		off_mac = off_payload + 2;	/* MAC header */
-		off_linktype = off_mac + 12;
-		off_macpl = off_mac + 14;	/* Ethernet */
+		PUSH_LINKHDR(DLT_EN10MB, 0,
+		    off_payload + 2,	/* Ethernet header */
+		    -1);
+		off_linktype.constant_part = off_linkhdr.constant_part + 12;
+		off_linkpl.constant_part = off_linkhdr.constant_part + 14;	/* Ethernet */
 		off_nl = 0;			/* Ethernet II */
 		off_nl_nosnap = 3;		/* 802.3+802.2 */
 		break;
@@ -8246,7 +8611,7 @@
 		if (!is_atm)
 			bpf_error("'llc' supported only on raw ATM");
 		b1 = gen_atmfield_code(A_PROTOTYPE, PT_LLC, BPF_JEQ, 0);
-		is_lane = 0;
+		linktype = prevlinktype;
 		break;
 
 	default:
@@ -8255,7 +8620,7 @@
 	return b1;
 }
 
-/* 
+/*
  * Filtering for MTP2 messages based on li value
  * FISU, length is null
  * LSSU, length is 1 or 2
diff --git a/gencode.h b/gencode.h
index afb6933..67ed0dc 100644
--- a/gencode.h
+++ b/gencode.h
@@ -17,8 +17,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.71 2007-11-18 02:03:52 guy Exp $ (LBL)
  */
 
 /*
@@ -163,7 +161,7 @@
 #define A_CONNECTACK	44	/* Connect Ack message */
 #define A_RELEASE	45	/* Release message */
 #define A_RELEASE_DONE	46	/* Release message */
- 
+
 /* ATM field types */
 #define A_VPI		51
 #define A_VCI		52
@@ -296,9 +294,9 @@
 struct block *gen_scode(const char *, struct qual);
 struct block *gen_ecode(const u_char *, struct qual);
 struct block *gen_acode(const u_char *, struct qual);
-struct block *gen_mcode(const char *, const char *, int, struct qual);
+struct block *gen_mcode(const char *, const char *, unsigned int, struct qual);
 #ifdef INET6
-struct block *gen_mcode6(const char *, const char *, int, struct qual);
+struct block *gen_mcode6(const char *, const char *, unsigned int, struct qual);
 #endif
 struct block *gen_ncode(const char *, bpf_u_int32, struct qual);
 struct block *gen_proto_abbrev(int);
@@ -310,12 +308,21 @@
 struct block *gen_multicast(int);
 struct block *gen_inbound(int);
 
+struct block *gen_llc(void);
+struct block *gen_llc_i(void);
+struct block *gen_llc_s(void);
+struct block *gen_llc_u(void);
+struct block *gen_llc_s_subtype(bpf_u_int32);
+struct block *gen_llc_u_subtype(bpf_u_int32);
+
 struct block *gen_vlan(int);
 struct block *gen_mpls(int);
 
 struct block *gen_pppoed(void);
 struct block *gen_pppoes(int);
 
+struct block *gen_geneve(int);
+
 struct block *gen_atmfield_code(int atmfield, bpf_int32 jvalue, bpf_u_int32 jtype, int reverse);
 struct block *gen_atmtype_abbrev(int type);
 struct block *gen_atmmulti_abbrev(int type);
diff --git a/grammar.c b/grammar.c
index ea3169c..f5aa791 100644
--- a/grammar.c
+++ b/grammar.c
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.5.  */
+/* A Bison parser, made by GNU Bison 3.0.2.  */
 
 /* Bison implementation for Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
-   
+
+   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+
    This program 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
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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/>.  */
 
@@ -26,7 +26,7 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-   
+
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
@@ -44,7 +44,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.5"
+#define YYBISON_VERSION "3.0.2"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -58,23 +58,19 @@
 /* Pull parsers.  */
 #define YYPULL 1
 
-/* Using locations.  */
-#define YYLSP_NEEDED 0
 
 /* Substitute the variable and function names.  */
 #define yyparse         pcap_parse
 #define yylex           pcap_lex
 #define yyerror         pcap_error
-#define yylval          pcap_lval
-#define yychar          pcap_char
 #define yydebug         pcap_debug
 #define yynerrs         pcap_nerrs
 
+#define yylval          pcap_lval
+#define yychar          pcap_char
 
 /* Copy the first part of user declarations.  */
-
-/* Line 268 of yacc.c  */
-#line 1 "grammar.y"
+#line 1 "grammar.y" /* yacc.c:339  */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
@@ -97,10 +93,6 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.101 2007-11-18 02:03:52 guy Exp $ (LBL)";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -135,6 +127,7 @@
 #include <net/pfvar.h>
 #include <net/if_pflog.h>
 #endif
+#include "llc.h"
 #include "ieee80211.h"
 #include <pcap/namedb.h>
 
@@ -209,6 +202,23 @@
 	{ IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL, "qos-cf-ack-poll" },
 	{ 0, NULL }
 };
+static const struct tok llc_s_subtypes[] = {
+	{ LLC_RR, "rr" },
+	{ LLC_RNR, "rnr" },
+	{ LLC_REJ, "rej" },
+	{ 0, NULL }
+};
+static const struct tok llc_u_subtypes[] = {
+	{ LLC_UI, "ui" },
+	{ LLC_UA, "ua" },
+	{ LLC_DISC, "disc" },
+	{ LLC_DM, "dm" },
+	{ LLC_SABME, "sabme" },
+	{ LLC_TEST, "test" },
+	{ LLC_XID, "xid" },
+	{ LLC_FRMR, "frmr" },
+	{ 0, NULL }
+};
 struct type2tok {
 	int type;
 	const struct tok *tok;
@@ -315,14 +325,15 @@
 }
 #endif /* HAVE_NET_PFVAR_H */
 
+#line 329 "y.tab.c" /* yacc.c:339  */
 
-/* Line 268 of yacc.c  */
-#line 321 "y.tab.c"
-
-/* Enabling traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
+# ifndef YY_NULLPTR
+#  if defined __cplusplus && 201103L <= __cplusplus
+#   define YY_NULLPTR nullptr
+#  else
+#   define YY_NULLPTR 0
+#  endif
+# endif
 
 /* Enabling verbose error messages.  */
 #ifdef YYERROR_VERBOSE
@@ -332,137 +343,143 @@
 # define YYERROR_VERBOSE 0
 #endif
 
-/* Enabling the token table.  */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
+/* In a future release of Bison, this section will be replaced
+   by #include "y.tab.h".  */
+#ifndef YY_PCAP_Y_TAB_H_INCLUDED
+# define YY_PCAP_Y_TAB_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int pcap_debug;
 #endif
 
-
-/* Tokens.  */
+/* Token type.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   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,
-     ISO = 330,
-     ESIS = 331,
-     CLNP = 332,
-     ISIS = 333,
-     L1 = 334,
-     L2 = 335,
-     IIH = 336,
-     LSP = 337,
-     SNP = 338,
-     CSNP = 339,
-     PSNP = 340,
-     STP = 341,
-     IPX = 342,
-     NETBEUI = 343,
-     LANE = 344,
-     LLC = 345,
-     METAC = 346,
-     BCC = 347,
-     SC = 348,
-     ILMIC = 349,
-     OAMF4EC = 350,
-     OAMF4SC = 351,
-     OAM = 352,
-     OAMF4 = 353,
-     CONNECTMSG = 354,
-     METACONNECT = 355,
-     VPI = 356,
-     VCI = 357,
-     RADIO = 358,
-     FISU = 359,
-     LSSU = 360,
-     MSU = 361,
-     HFISU = 362,
-     HLSSU = 363,
-     HMSU = 364,
-     SIO = 365,
-     OPC = 366,
-     DPC = 367,
-     SLS = 368,
-     HSIO = 369,
-     HOPC = 370,
-     HDPC = 371,
-     HSLS = 372,
-     AND = 373,
-     OR = 374,
-     UMINUS = 375
-   };
+  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,
+    OR = 374,
+    AND = 375,
+    UMINUS = 376
+  };
 #endif
 /* Tokens.  */
 #define DST 258
@@ -537,62 +554,60 @@
 #define MPLS 327
 #define PPPOED 328
 #define PPPOES 329
-#define ISO 330
-#define ESIS 331
-#define CLNP 332
-#define ISIS 333
-#define L1 334
-#define L2 335
-#define IIH 336
-#define LSP 337
-#define SNP 338
-#define CSNP 339
-#define PSNP 340
-#define STP 341
-#define IPX 342
-#define NETBEUI 343
-#define LANE 344
-#define LLC 345
-#define METAC 346
-#define BCC 347
-#define SC 348
-#define ILMIC 349
-#define OAMF4EC 350
-#define OAMF4SC 351
-#define OAM 352
-#define OAMF4 353
-#define CONNECTMSG 354
-#define METACONNECT 355
-#define VPI 356
-#define VCI 357
-#define RADIO 358
-#define FISU 359
-#define LSSU 360
-#define MSU 361
-#define HFISU 362
-#define HLSSU 363
-#define HMSU 364
-#define SIO 365
-#define OPC 366
-#define DPC 367
-#define SLS 368
-#define HSIO 369
-#define HOPC 370
-#define HDPC 371
-#define HSLS 372
-#define AND 373
+#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 OR 374
-#define UMINUS 375
+#define AND 375
+#define UMINUS 376
 
-
-
-
+/* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
 {
-
-/* Line 293 of yacc.c  */
-#line 242 "grammar.y"
+#line 256 "grammar.y" /* yacc.c:355  */
 
 	int i;
 	bpf_u_int32 h;
@@ -608,22 +623,22 @@
 	} blk;
 	struct block *rblk;
 
-
-
-/* Line 293 of yacc.c  */
-#line 615 "y.tab.c"
-} YYSTYPE;
+#line 627 "y.tab.c" /* yacc.c:355  */
+};
 # define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 #endif
 
 
+extern YYSTYPE pcap_lval;
+
+int pcap_parse (void);
+
+#endif /* !YY_PCAP_Y_TAB_H_INCLUDED  */
+
 /* Copy the second part of user declarations.  */
 
-
-/* Line 343 of yacc.c  */
-#line 627 "y.tab.c"
+#line 642 "y.tab.c" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -637,11 +652,8 @@
 
 #ifdef YYTYPE_INT8
 typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
 #else
-typedef short int yytype_int8;
+typedef signed char yytype_int8;
 #endif
 
 #ifdef YYTYPE_UINT16
@@ -661,8 +673,7 @@
 #  define YYSIZE_T __SIZE_TYPE__
 # elif defined size_t
 #  define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
+# elif ! defined YYSIZE_T
 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 #  define YYSIZE_T size_t
 # else
@@ -676,38 +687,67 @@
 # if defined YYENABLE_NLS && YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-#   define YY_(msgid) dgettext ("bison-runtime", msgid)
+#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
 #  endif
 # endif
 # ifndef YY_
-#  define YY_(msgid) msgid
+#  define YY_(Msgid) Msgid
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__                                               \
+      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
+     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+#  define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
 # endif
 #endif
 
 /* Suppress unused-variable warnings by "using" E.  */
 #if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
+# define YYUSE(E) ((void) (E))
 #else
-# define YYUSE(e) /* empty */
+# define YYUSE(E) /* empty */
 #endif
 
-/* Identity function, used to suppress warnings about constant conditions.  */
-#ifndef lint
-# define YYID(n) (n)
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+    _Pragma ("GCC diagnostic push") \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+    _Pragma ("GCC diagnostic pop")
 #else
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
-#else
-static int
-YYID (yyi)
-    int yyi;
+# define YY_INITIAL_VALUE(Value) Value
 #endif
-{
-  return yyi;
-}
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
 #endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
 
 #if ! defined yyoverflow || YYERROR_VERBOSE
 
@@ -726,9 +766,9 @@
 #    define alloca _alloca
 #   else
 #    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
 #     ifndef EXIT_SUCCESS
 #      define EXIT_SUCCESS 0
 #     endif
@@ -738,8 +778,8 @@
 # endif
 
 # ifdef YYSTACK_ALLOC
-   /* Pacify GCC's `empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+   /* Pacify GCC's 'empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
 #  ifndef YYSTACK_ALLOC_MAXIMUM
     /* The OS might guarantee only one guard page at the bottom of the stack,
        and a page size can be as small as 4096 bytes.  So we cannot safely
@@ -755,7 +795,7 @@
 #  endif
 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
        && ! ((defined YYMALLOC || defined malloc) \
-	     && (defined YYFREE || defined free)))
+             && (defined YYFREE || defined free)))
 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 #   ifndef EXIT_SUCCESS
 #    define EXIT_SUCCESS 0
@@ -763,15 +803,13 @@
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
-#   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
+#   if ! defined malloc && ! defined EXIT_SUCCESS
 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
 #  ifndef YYFREE
 #   define YYFREE free
-#   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
+#   if ! defined free && ! defined EXIT_SUCCESS
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
@@ -781,7 +819,7 @@
 
 #if (! defined yyoverflow \
      && (! defined __cplusplus \
-	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
 
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
@@ -806,35 +844,35 @@
    elements in the stack, and YYPTR gives the new location of the
    stack.  Advance YYPTR to a properly aligned location for the next
    stack.  */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
-    do									\
-      {									\
-	YYSIZE_T yynewbytes;						\
-	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
-	Stack = &yyptr->Stack_alloc;					\
-	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-	yyptr += yynewbytes / sizeof (*yyptr);				\
-      }									\
-    while (YYID (0))
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
+    do                                                                  \
+      {                                                                 \
+        YYSIZE_T yynewbytes;                                            \
+        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+        Stack = &yyptr->Stack_alloc;                                    \
+        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / sizeof (*yyptr);                          \
+      }                                                                 \
+    while (0)
 
 #endif
 
 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from FROM to TO.  The source and destination do
+/* Copy COUNT objects from SRC to DST.  The source and destination do
    not overlap.  */
 # ifndef YYCOPY
 #  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(To, From, Count) \
-      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+#   define YYCOPY(Dst, Src, Count) \
+      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
 #  else
-#   define YYCOPY(To, From, Count)		\
-      do					\
-	{					\
-	  YYSIZE_T yyi;				\
-	  for (yyi = 0; yyi < (Count); yyi++)	\
-	    (To)[yyi] = (From)[yyi];		\
-	}					\
-      while (YYID (0))
+#   define YYCOPY(Dst, Src, Count)              \
+      do                                        \
+        {                                       \
+          YYSIZE_T yyi;                         \
+          for (yyi = 0; yyi < (Count); yyi++)   \
+            (Dst)[yyi] = (Src)[yyi];            \
+        }                                       \
+      while (0)
 #  endif
 # endif
 #endif /* !YYCOPY_NEEDED */
@@ -842,40 +880,42 @@
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  3
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   710
+#define YYLAST   788
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  136
+#define YYNTOKENS  139
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  46
+#define YYNNTS  47
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  213
-/* YYNRULES -- Number of states.  */
-#define YYNSTATES  285
+#define YYNRULES  220
+/* YYNSTATES -- Number of states.  */
+#define YYNSTATES  294
 
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+   by yylex, with out-of-bounds checking.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   375
+#define YYMAXUTOK   376
 
-#define YYTRANSLATE(YYX)						\
+#define YYTRANSLATE(YYX)                                                \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, without out-of-bounds checking.  */
 static const yytype_uint8 yytranslate[] =
 {
        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,   120,     2,     2,     2,     2,   122,     2,
-     129,   128,   125,   123,     2,   124,     2,   126,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,   135,     2,
-     132,   131,   130,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,   121,     2,     2,     2,   137,   123,     2,
+     130,   129,   126,   124,     2,   125,     2,   127,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,   136,     2,
+     133,   132,   131,     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,   133,     2,   134,     2,     2,     2,     2,     2,     2,
+       2,   134,     2,   135,   138,     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,   121,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,   122,     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,
@@ -900,126 +940,40 @@
       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,   127
+     115,   116,   117,   118,   119,   120,   128
 };
 
 #if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
-   YYRHS.  */
-static const yytype_uint16 yyprhs[] =
-{
-       0,     0,     3,     6,     8,     9,    11,    15,    19,    23,
-      27,    29,    31,    33,    35,    39,    41,    45,    49,    51,
-      55,    57,    59,    61,    64,    66,    68,    70,    74,    78,
-      80,    82,    84,    87,    91,    94,    97,   100,   103,   106,
-     109,   113,   115,   119,   123,   125,   127,   129,   132,   134,
-     137,   139,   140,   142,   144,   148,   152,   156,   160,   162,
-     164,   166,   168,   170,   172,   174,   176,   178,   180,   182,
-     184,   186,   188,   190,   192,   194,   196,   198,   200,   202,
-     204,   206,   208,   210,   212,   214,   216,   218,   220,   222,
-     224,   226,   228,   230,   232,   234,   236,   238,   240,   242,
-     244,   246,   248,   250,   252,   254,   256,   258,   260,   263,
-     266,   269,   272,   277,   279,   281,   284,   286,   289,   291,
-     293,   296,   298,   300,   303,   306,   309,   312,   315,   318,
-     321,   326,   329,   332,   335,   337,   339,   341,   343,   345,
-     347,   349,   351,   353,   355,   357,   359,   361,   363,   365,
-     367,   369,   371,   376,   383,   387,   391,   395,   399,   403,
-     407,   411,   415,   418,   422,   424,   426,   428,   430,   432,
-     434,   436,   440,   442,   444,   446,   448,   450,   452,   454,
-     456,   458,   460,   462,   464,   466,   468,   470,   473,   476,
-     480,   482,   484,   488,   490,   492,   494,   496,   498,   500,
-     502,   504,   506,   508,   510,   512,   514,   516,   518,   521,
-     524,   528,   530,   532
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
-static const yytype_int16 yyrhs[] =
-{
-     137,     0,    -1,   138,   139,    -1,   138,    -1,    -1,   148,
-      -1,   139,   140,   148,    -1,   139,   140,   142,    -1,   139,
-     141,   148,    -1,   139,   141,   142,    -1,   118,    -1,   119,
-      -1,   143,    -1,   170,    -1,   145,   146,   128,    -1,    59,
-      -1,    61,   126,    37,    -1,    61,     8,    61,    -1,    61,
-      -1,    62,   126,    37,    -1,    62,    -1,    60,    -1,    63,
-      -1,   144,   142,    -1,   120,    -1,   129,    -1,   143,    -1,
-     147,   140,   142,    -1,   147,   141,   142,    -1,   170,    -1,
-     146,    -1,   150,    -1,   144,   148,    -1,   151,   152,   153,
-      -1,   151,   152,    -1,   151,   153,    -1,   151,    13,    -1,
-     151,    14,    -1,   151,   154,    -1,   149,   142,    -1,   145,
-     139,   128,    -1,   155,    -1,   167,   165,   167,    -1,   167,
-     166,   167,    -1,   156,    -1,   171,    -1,   172,    -1,   173,
-     174,    -1,   177,    -1,   178,   179,    -1,   155,    -1,    -1,
-       4,    -1,     3,    -1,     4,   119,     3,    -1,     3,   119,
-       4,    -1,     4,   118,     3,    -1,     3,   118,     4,    -1,
-      49,    -1,    50,    -1,    51,    -1,    52,    -1,    53,    -1,
-      54,    -1,     5,    -1,     7,    -1,     9,    -1,    10,    -1,
-       6,    -1,    55,    -1,    18,    -1,    16,    -1,    17,    -1,
-      19,    -1,    20,    -1,    21,    -1,    22,    -1,    23,    -1,
-      24,    -1,    25,    -1,    26,    -1,    27,    -1,    28,    -1,
-      29,    -1,    30,    -1,    31,    -1,    32,    -1,    34,    -1,
-      33,    -1,    67,    -1,    68,    -1,    69,    -1,    70,    -1,
-      75,    -1,    76,    -1,    78,    -1,    79,    -1,    80,    -1,
-      81,    -1,    82,    -1,    83,    -1,    85,    -1,    84,    -1,
-      77,    -1,    86,    -1,    87,    -1,    88,    -1,   103,    -1,
-     151,    35,    -1,   151,    36,    -1,    11,    37,    -1,    12,
-      37,    -1,    15,    37,   169,    37,    -1,    38,    -1,    39,
-      -1,    71,   170,    -1,    71,    -1,    72,   170,    -1,    72,
-      -1,    73,    -1,    74,   170,    -1,    74,    -1,   157,    -1,
-     151,   158,    -1,    40,    59,    -1,    41,    59,    -1,    42,
-      37,    -1,    43,    37,    -1,    44,   163,    -1,    45,   164,
-      -1,    46,   159,    47,   160,    -1,    46,   159,    -1,    47,
-     161,    -1,    48,   162,    -1,    37,    -1,    59,    -1,    37,
-      -1,    59,    -1,    59,    -1,    37,    -1,    59,    -1,    37,
-      -1,    59,    -1,    59,    -1,   130,    -1,    56,    -1,   131,
-      -1,    57,    -1,   132,    -1,    58,    -1,   170,    -1,   168,
-      -1,   155,   133,   167,   134,    -1,   155,   133,   167,   135,
-      37,   134,    -1,   167,   123,   167,    -1,   167,   124,   167,
-      -1,   167,   125,   167,    -1,   167,   126,   167,    -1,   167,
-     122,   167,    -1,   167,   121,   167,    -1,   167,    64,   167,
-      -1,   167,    65,   167,    -1,   124,   167,    -1,   145,   168,
-     128,    -1,    66,    -1,   122,    -1,   121,    -1,   132,    -1,
-     130,    -1,   131,    -1,    37,    -1,   145,   170,   128,    -1,
-      89,    -1,    90,    -1,    91,    -1,    92,    -1,    95,    -1,
-      96,    -1,    93,    -1,    94,    -1,    97,    -1,    98,    -1,
-      99,    -1,   100,    -1,   101,    -1,   102,    -1,   175,    -1,
-     165,    37,    -1,   166,    37,    -1,   145,   176,   128,    -1,
-      37,    -1,   175,    -1,   176,   141,   175,    -1,   104,    -1,
-     105,    -1,   106,    -1,   107,    -1,   108,    -1,   109,    -1,
-     110,    -1,   111,    -1,   112,    -1,   113,    -1,   114,    -1,
-     115,    -1,   116,    -1,   117,    -1,   180,    -1,   165,    37,
-      -1,   166,    37,    -1,   145,   181,   128,    -1,    37,    -1,
-     180,    -1,   181,   141,   180,    -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   316,   316,   320,   322,   324,   325,   326,   327,   328,
-     330,   332,   334,   335,   337,   339,   340,   342,   344,   357,
-     366,   375,   384,   393,   395,   397,   399,   400,   401,   403,
-     405,   407,   408,   410,   411,   412,   413,   414,   415,   417,
-     418,   419,   420,   422,   424,   425,   426,   427,   428,   429,
-     432,   433,   436,   437,   438,   439,   440,   441,   442,   443,
-     444,   445,   446,   447,   450,   451,   452,   453,   456,   458,
-     459,   460,   461,   462,   463,   464,   465,   466,   467,   468,
-     469,   470,   471,   472,   473,   474,   475,   476,   477,   478,
-     479,   480,   481,   482,   483,   484,   485,   486,   487,   488,
-     489,   490,   491,   492,   493,   494,   495,   496,   498,   499,
-     500,   501,   502,   503,   504,   505,   506,   507,   508,   509,
-     510,   511,   512,   513,   516,   517,   518,   519,   520,   521,
-     524,   529,   532,   536,   539,   540,   546,   547,   567,   583,
-     584,   597,   598,   601,   604,   605,   606,   608,   609,   610,
-     612,   613,   615,   616,   617,   618,   619,   620,   621,   622,
-     623,   624,   625,   626,   627,   629,   630,   631,   632,   633,
-     635,   636,   638,   639,   640,   641,   642,   643,   644,   645,
-     647,   648,   649,   650,   653,   654,   656,   657,   658,   659,
-     661,   668,   669,   672,   673,   674,   675,   676,   677,   680,
-     681,   682,   683,   684,   685,   686,   687,   689,   690,   691,
-     692,   694,   707,   708
+       0,   330,   330,   334,   336,   338,   339,   340,   341,   342,
+     344,   346,   348,   349,   351,   353,   354,   356,   358,   371,
+     380,   389,   398,   407,   409,   411,   413,   414,   415,   417,
+     419,   421,   422,   424,   425,   426,   427,   428,   429,   431,
+     432,   433,   434,   436,   438,   439,   440,   441,   442,   443,
+     446,   447,   450,   451,   452,   453,   454,   455,   456,   457,
+     458,   459,   460,   461,   464,   465,   466,   467,   470,   472,
+     473,   474,   475,   476,   477,   478,   479,   480,   481,   482,
+     483,   484,   485,   486,   487,   488,   489,   490,   491,   492,
+     493,   494,   495,   496,   497,   498,   499,   500,   501,   502,
+     503,   504,   505,   506,   507,   508,   509,   510,   512,   513,
+     514,   515,   516,   517,   518,   519,   520,   521,   522,   523,
+     524,   525,   526,   527,   528,   529,   530,   533,   534,   535,
+     536,   537,   538,   541,   546,   549,   553,   556,   557,   563,
+     564,   584,   600,   601,   622,   625,   626,   639,   640,   643,
+     646,   647,   648,   650,   651,   652,   654,   655,   657,   658,
+     659,   660,   661,   662,   663,   664,   665,   666,   667,   668,
+     669,   670,   671,   673,   674,   675,   676,   677,   679,   680,
+     682,   683,   684,   685,   686,   687,   688,   690,   691,   692,
+     693,   696,   697,   699,   700,   701,   702,   704,   711,   712,
+     715,   716,   717,   718,   719,   720,   723,   724,   725,   726,
+     727,   728,   729,   730,   732,   733,   734,   735,   737,   750,
+     751
 };
 #endif
 
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+#if YYDEBUG || YYERROR_VERBOSE || 0
 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
 static const char *const yytname[] =
@@ -1033,26 +987,27 @@
   "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", "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", "AND", "OR", "'!'", "'|'", "'&'",
-  "'+'", "'-'", "'*'", "'/'", "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", "dir", "reason", "action",
-  "relop", "irelop", "arth", "narth", "byteop", "pnum", "atmtype",
-  "atmmultitype", "atmfield", "atmvalue", "atmfieldvalue", "atmlistvalue",
-  "mtp2type", "mtp3field", "mtp3value", "mtp3fieldvalue", "mtp3listvalue", 0
+  "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", "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
 };
 #endif
 
 # ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
-   token YYLEX-NUM.  */
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+   (internal) symbol number NUM (which must be that of a token).  */
 static const yytype_uint16 yytoknum[] =
 {
        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
@@ -1067,39 +1022,348 @@
      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,
-      33,   124,    38,    43,    45,    42,    47,   375,    41,    40,
-      62,    61,    60,    91,    93,    58
+     375,    33,   124,    38,    43,    45,    42,    47,   376,    41,
+      40,    62,    61,    60,    91,    93,    58,    37,    94
 };
 # endif
 
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
+#define YYPACT_NINF -216
+
+#define yypact_value_is_default(Yystate) \
+  (!!((Yystate) == (-216)))
+
+#define YYTABLE_NINF -42
+
+#define yytable_value_is_error(Yytable_value) \
+  0
+
+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
+static const yytype_int16 yypact[] =
 {
-       0,   136,   137,   137,   138,   139,   139,   139,   139,   139,
-     140,   141,   142,   142,   142,   143,   143,   143,   143,   143,
-     143,   143,   143,   143,   144,   145,   146,   146,   146,   147,
-     147,   148,   148,   149,   149,   149,   149,   149,   149,   150,
-     150,   150,   150,   150,   150,   150,   150,   150,   150,   150,
-     151,   151,   152,   152,   152,   152,   152,   152,   152,   152,
-     152,   152,   152,   152,   153,   153,   153,   153,   154,   155,
-     155,   155,   155,   155,   155,   155,   155,   155,   155,   155,
-     155,   155,   155,   155,   155,   155,   155,   155,   155,   155,
-     155,   155,   155,   155,   155,   155,   155,   155,   155,   155,
-     155,   155,   155,   155,   155,   155,   155,   155,   156,   156,
-     156,   156,   156,   156,   156,   156,   156,   156,   156,   156,
-     156,   156,   156,   156,   157,   157,   157,   157,   157,   157,
-     158,   158,   158,   158,   159,   159,   160,   160,   161,   162,
-     162,   163,   163,   164,   165,   165,   165,   166,   166,   166,
-     167,   167,   168,   168,   168,   168,   168,   168,   168,   168,
-     168,   168,   168,   168,   168,   169,   169,   169,   169,   169,
-     170,   170,   171,   171,   171,   171,   171,   171,   171,   171,
-     172,   172,   172,   172,   173,   173,   174,   174,   174,   174,
-     175,   176,   176,   177,   177,   177,   177,   177,   177,   178,
-     178,   178,   178,   178,   178,   178,   178,   179,   179,   179,
-     179,   180,   181,   181
+    -216,    24,   257,  -216,     0,    12,    17,  -216,  -216,  -216,
+    -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,
+    -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,    16,
+      25,    29,    72,   -18,    55,  -216,  -216,  -216,  -216,  -216,
+    -216,   -25,   -25,  -216,   -25,   -25,  -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,
+     604,  -216,   -30,   489,   489,  -216,   125,  -216,   734,     3,
+    -216,  -216,  -216,   183,  -216,  -216,  -216,  -216,    -5,  -216,
+      39,  -216,  -216,   -54,  -216,  -216,  -216,  -216,  -216,  -216,
+    -216,  -216,  -216,   -25,  -216,  -216,  -216,  -216,  -216,  -216,
+     604,   -16,  -108,  -216,  -216,   373,   373,  -216,  -103,   -10,
+       2,  -216,  -216,    -7,    11,  -216,  -216,  -216,   125,   125,
+    -216,    -3,    21,  -216,  -216,  -216,  -216,  -216,  -216,  -216,
+    -216,  -216,   -12,    77,    -9,  -216,  -216,  -216,  -216,  -216,
+    -216,    78,  -216,  -216,  -216,   604,  -216,  -216,  -216,   604,
+     604,   604,   604,   604,   604,   604,   604,  -216,  -216,  -216,
+     604,   604,   604,   604,  -216,   111,   113,   114,  -216,  -216,
+    -216,   115,   124,   126,  -216,  -216,  -216,  -216,  -216,  -216,
+    -216,   131,     2,   575,  -216,   373,   373,  -216,    10,  -216,
+    -216,  -216,  -216,  -216,   112,   137,   138,  -216,  -216,    47,
+     -30,     2,   173,   176,   178,   186,  -216,  -216,   143,  -216,
+    -216,  -216,  -216,  -216,  -216,   127,   -64,   -64,   580,   598,
+    -104,  -104,  -108,  -108,   575,   575,   575,   575,  -216,   -98,
+    -216,  -216,  -216,   -47,  -216,  -216,  -216,   -49,  -216,  -216,
+    -216,  -216,   125,   125,  -216,  -216,  -216,  -216,    -1,  -216,
+     156,  -216,   111,  -216,   115,  -216,  -216,  -216,  -216,  -216,
+      59,  -216,  -216,  -216
 };
 
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
+  /* 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
+};
+
+  /* YYPGOTO[NTERM-NUM].  */
+static const yytype_int16 yypgoto[] =
+{
+    -216,  -216,  -216,   193,   -34,  -215,   -90,  -135,     7,    -2,
+    -216,  -216,   -80,  -216,  -216,  -216,  -216,    26,  -216,     9,
+    -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,  -216,
+     -43,     5,   -26,   -92,  -216,   -37,  -216,  -216,  -216,  -216,
+    -175,  -216,  -216,  -216,  -216,  -174,  -216
+};
+
+  /* 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
+};
+
+  /* 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,   224,   139,   -41,   124,   125,   146,   126,   127,    93,
+     -13,    99,    26,   137,   228,   273,   133,   134,   128,   118,
+     258,   133,   185,   186,     3,   236,   221,   262,   241,   190,
+     191,   281,   194,   190,   191,   129,   287,   111,   139,   123,
+     123,   119,   123,   123,   282,   214,   219,   237,   284,   112,
+     242,   176,   177,   178,   113,   217,   220,   140,   288,   150,
+     183,   184,   185,   186,   132,   196,   116,   202,   206,   207,
+     -29,   -29,   133,   190,   191,   114,   200,   208,   209,   210,
+     223,   228,   283,   153,   115,   155,   212,   156,   157,   133,
+     134,    94,    94,   140,   149,   176,   177,   178,   218,   218,
+      93,    93,    99,    99,   213,    91,   195,   291,   201,   117,
+     292,   150,   231,   197,   121,   203,   232,   233,   175,   222,
+     225,   123,   -41,   -41,   139,    91,   187,   188,   189,   -13,
+     -13,   223,   -41,   216,   216,   137,   239,   175,   226,   -13,
+     234,   235,   215,   215,    99,    99,   149,   123,   194,   245,
+     260,   261,   200,   246,   247,   248,   249,   250,   251,   252,
+     253,   264,    26,   265,   254,   255,   256,   257,   266,    91,
+     187,   188,   189,   268,   269,   270,   271,   274,   218,   267,
+     275,   276,   285,   286,   141,   142,   143,   144,   145,   277,
+     278,   179,   180,   290,   293,    92,   272,   244,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   216,    94,     0,     0,     0,     0,     0,
+       0,     0,   215,   215,    99,    99,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   150,   150,     0,     0,   176,
+     177,   178,     0,     0,     0,     0,    89,   179,   180,   181,
+     182,   183,   184,   185,   186,    91,     0,    -3,     0,     0,
+       0,     0,   279,   280,   190,   191,     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,     0,   181,   182,   183,   184,   185,
+     186,     0,    35,     0,   187,   188,   189,     0,     0,     0,
+     190,   191,     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,    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,    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,     0,     0,
+       0,     0,     0,     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,
+      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,     0,   179,   180,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,    35,
+       0,     0,   179,   180,     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,   181,   182,   183,
+     184,   185,   186,   182,   183,   184,   185,   186,    74,     0,
+       0,     0,   190,   191,     0,     0,     0,   190,   191,     0,
+       0,     0,   183,   184,   185,   186,     0,     0,     0,    90,
+       0,     0,     0,     0,    91,   190,   191,   151,   152,   153,
+     154,   155,     0,   156,   157,     0,     0,   158,   159,     0,
+       0,     0,     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
+};
+
+static const yytype_int16 yycheck[] =
+{
+       2,     8,    94,     0,    41,    42,    96,    44,    45,     2,
+       0,     2,    37,    93,   149,   230,   119,   120,    42,    37,
+     195,   119,   126,   127,     0,    37,   129,   201,    37,   137,
+     138,   129,    37,   137,   138,    59,    37,    37,   130,    41,
+      42,    59,    44,    45,   259,   135,   136,    59,   263,    37,
+      59,    56,    57,    58,    37,   135,   136,    94,    59,    96,
+     124,   125,   126,   127,    90,   108,    37,   110,   122,   123,
+     119,   120,   119,   137,   138,    59,    37,   131,   132,   133,
+     129,   216,   129,     5,    59,     7,   123,     9,    10,   119,
+     120,    93,    94,   130,    96,    56,    57,    58,   135,   136,
+      93,    94,    93,    94,   130,   130,   108,   282,   110,    37,
+     284,   148,   149,   108,    59,   110,   119,   120,   134,   129,
+     127,   123,   119,   120,   216,   130,   131,   132,   133,   119,
+     120,   129,   129,   135,   136,   215,    59,   134,   127,   129,
+     119,   120,   135,   136,   135,   136,   148,   149,    37,   175,
+      37,    37,    37,   179,   180,   181,   182,   183,   184,   185,
+     186,    37,    37,    37,   190,   191,   192,   193,    37,   130,
+     131,   132,   133,    61,    37,    37,   129,     4,   215,   216,
+       4,     3,   272,   273,    59,    60,    61,    62,    63,     3,
+      47,    64,    65,    37,   135,     2,   230,   171,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,   215,   216,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,   215,   216,   215,   216,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   272,   273,    -1,    -1,    56,
+      57,    58,    -1,    -1,    -1,    -1,   121,    64,    65,   122,
+     123,   124,   125,   126,   127,   130,    -1,     0,    -1,    -1,
+      -1,    -1,   135,   136,   137,   138,    -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,    -1,   122,   123,   124,   125,   126,
+     127,    -1,    55,    -1,   131,   132,   133,    -1,    -1,    -1,
+     137,   138,    -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,   121,    -1,
+      -1,    -1,   125,    -1,    11,    12,    -1,   130,    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,   121,    -1,    -1,    -1,   125,    -1,
+      11,    12,    -1,   130,    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,    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,
+     121,    -1,    -1,    -1,   125,    -1,    -1,    -1,    -1,   130,
+      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,    29,    30,    31,    32,    33,    34,    64,
+      65,    37,    -1,    -1,    64,    65,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    55,
+      -1,    -1,    64,    65,    -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,   122,   123,   124,
+     125,   126,   127,   123,   124,   125,   126,   127,   104,    -1,
+      -1,    -1,   137,   138,    -1,    -1,    -1,   137,   138,    -1,
+      -1,    -1,   124,   125,   126,   127,    -1,    -1,    -1,   125,
+      -1,    -1,    -1,    -1,   130,   137,   138,     3,     4,     5,
+       6,     7,    -1,     9,    10,    -1,    -1,    13,    14,    -1,
+      -1,    -1,    -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
+};
+
+  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+     symbol of state STATE-NUM.  */
+static const yytype_uint8 yystos[] =
+{
+       0,   140,   141,     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,
+      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,   121,
+     125,   130,   142,   147,   148,   151,   152,   153,   154,   158,
+     159,   160,   165,   171,   172,   174,   175,   176,   177,   181,
+     182,    37,    37,    37,    59,    59,    37,    37,    37,    59,
+     167,    59,   168,   148,   174,   174,   174,   174,    42,    59,
+     148,   158,   171,   119,   120,   143,   144,   151,   142,   172,
+     174,    59,    60,    61,    62,    63,   145,   146,   147,   148,
+     174,     3,     4,     5,     6,     7,     9,    10,    13,    14,
+      35,    36,    46,    47,    48,    49,    50,    51,    52,    53,
+      54,   155,   156,   157,   161,   134,    56,    57,    58,    64,
+      65,   122,   123,   124,   125,   126,   127,   131,   132,   133,
+     137,   138,   169,   170,    37,   148,   169,   170,   178,   179,
+      37,   148,   169,   170,   183,   184,   122,   123,   131,   132,
+     133,   173,   174,   171,   145,   147,   148,   151,   174,   145,
+     151,   129,   129,   129,     8,   127,   127,   145,   146,   149,
+     150,   174,   119,   120,   119,   120,    37,    59,   162,    59,
+     164,    37,    59,   166,   156,   171,   171,   171,   171,   171,
+     171,   171,   171,   171,   171,   171,   171,   171,   179,   180,
+      37,    37,   184,   185,    37,    37,    37,   174,    61,    37,
+      37,   129,   143,   144,     4,     4,     3,     3,    47,   135,
+     136,   129,   144,   129,   144,   145,   145,    37,    59,   163,
+      37,   179,   184,   135
+};
+
+  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,   139,   140,   140,   141,   142,   142,   142,   142,   142,
+     143,   144,   145,   145,   145,   146,   146,   146,   146,   146,
+     146,   146,   146,   146,   147,   148,   149,   149,   149,   150,
+     150,   151,   151,   152,   152,   152,   152,   152,   152,   153,
+     153,   153,   153,   153,   153,   153,   153,   153,   153,   153,
+     154,   154,   155,   155,   155,   155,   155,   155,   155,   155,
+     155,   155,   155,   155,   156,   156,   156,   156,   157,   158,
+     158,   158,   158,   158,   158,   158,   158,   158,   158,   158,
+     158,   158,   158,   158,   158,   158,   158,   158,   158,   158,
+     158,   158,   158,   158,   158,   158,   158,   158,   158,   158,
+     158,   158,   158,   158,   158,   158,   158,   158,   159,   159,
+     159,   159,   159,   159,   159,   159,   159,   159,   159,   159,
+     159,   159,   159,   159,   159,   159,   159,   160,   160,   160,
+     160,   160,   160,   161,   161,   161,   161,   162,   162,   163,
+     163,   164,   165,   165,   165,   166,   166,   167,   167,   168,
+     169,   169,   169,   170,   170,   170,   171,   171,   172,   172,
+     172,   172,   172,   172,   172,   172,   172,   172,   172,   172,
+     172,   172,   172,   173,   173,   173,   173,   173,   174,   174,
+     175,   175,   175,   175,   175,   175,   175,   176,   176,   176,
+     176,   177,   177,   178,   178,   178,   178,   179,   180,   180,
+     181,   181,   181,   181,   181,   181,   182,   182,   182,   182,
+     182,   182,   182,   182,   183,   183,   183,   183,   184,   185,
+     185
+};
+
+  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
 static const yytype_uint8 yyr2[] =
 {
        0,     2,     2,     1,     0,     1,     3,     3,     3,     3,
@@ -1114,395 +1378,54 @@
        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,     1,     2,     2,     2,     2,     2,     2,     2,
-       4,     2,     2,     2,     1,     1,     1,     1,     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,     4,     6,     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,     1,     2,     2,     3,
-       1,     1,     3,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     2,     2,
-       3,     1,     1,     3
+       1,     1,     1,     1,     2,     2,     3,     1,     1,     3,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     2,     2,     3,     1,     1,
+       3
 };
 
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
-   Performed when YYTABLE doesn't 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,   170,   113,   114,     0,
-       0,     0,     0,     0,     0,    69,   164,    89,    90,    91,
-      92,   116,   118,   119,   121,    93,    94,   103,    95,    96,
-      97,    98,    99,   100,   102,   101,   104,   105,   106,   172,
-     173,   174,   175,   178,   179,   176,   177,   180,   181,   182,
-     183,   184,   185,   107,   193,   194,   195,   196,   197,   198,
-     199,   200,   201,   202,   203,   204,   205,   206,    24,     0,
-      25,     2,    51,    51,     5,     0,    31,     0,    50,    44,
-     122,     0,   151,   150,    45,    46,     0,    48,     0,   110,
-     111,     0,   124,   125,   126,   127,   141,   142,   128,   143,
-     129,     0,   115,   117,   120,     0,     0,   162,    10,    11,
-      51,    51,    32,     0,   151,   150,    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,   123,
-       0,   145,   147,   149,     0,     0,     0,     0,     0,     0,
-       0,     0,   144,   146,   148,     0,     0,   190,     0,     0,
-       0,    47,   186,   211,     0,     0,     0,    49,   207,   166,
-     165,   168,   169,   167,     0,     0,     0,     7,    51,    51,
-       6,   150,     9,     8,    40,   163,   171,     0,     0,     0,
-      23,    26,    30,     0,    29,     0,     0,     0,     0,   134,
-     135,   131,   138,   132,   139,   140,   133,    33,     0,   160,
-     161,   159,   158,   154,   155,   156,   157,    42,    43,   191,
-       0,   187,   188,   212,     0,   208,   209,   112,   150,    17,
-      16,    19,    14,     0,     0,    57,    55,    56,    54,     0,
-     152,     0,   189,     0,   210,     0,    27,    28,   136,   137,
-     130,     0,   192,   213,   153
-};
 
-/* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int16 yydefgoto[] =
-{
-      -1,     1,     2,   133,   130,   131,   220,   142,   143,   125,
-     222,   223,    94,    95,    96,    97,   166,   167,   168,   126,
-      99,   100,   169,   231,   280,   233,   236,   118,   120,   185,
-     186,   101,   102,   204,   103,   104,   105,   106,   191,   192,
-     250,   107,   108,   197,   198,   254
-};
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = YYEMPTY)
+#define YYEMPTY         (-2)
+#define YYEOF           0
 
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
-#define YYPACT_NINF -208
-static const yytype_int16 yypact[] =
-{
-    -208,    20,   226,  -208,   -10,    -3,     1,  -208,  -208,  -208,
-    -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,
-    -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,   -28,
-     -15,    49,    68,   -18,    62,  -208,  -208,  -208,  -208,  -208,
-    -208,   -26,   -26,  -208,   -26,  -208,  -208,  -208,  -208,  -208,
-    -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,
-    -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,
-    -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,
-    -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,   570,
-    -208,   -42,   456,   456,  -208,    19,  -208,   656,    12,  -208,
-    -208,   153,  -208,  -208,  -208,  -208,    55,  -208,    59,  -208,
-    -208,   -69,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,
-    -208,   -26,  -208,  -208,  -208,   570,   -19,  -208,  -208,  -208,
-     341,   341,  -208,   -93,    -1,    21,  -208,  -208,    -6,    34,
-    -208,  -208,  -208,    19,    19,  -208,    -9,     6,  -208,  -208,
-    -208,  -208,  -208,  -208,  -208,  -208,  -208,   -14,    74,   -13,
-    -208,  -208,  -208,  -208,  -208,  -208,    23,  -208,  -208,  -208,
-     570,  -208,  -208,  -208,   570,   570,   570,   570,   570,   570,
-     570,   570,  -208,  -208,  -208,   570,   570,  -208,    81,   134,
-     139,  -208,  -208,  -208,   140,   141,   142,  -208,  -208,  -208,
-    -208,  -208,  -208,  -208,   143,    21,    79,  -208,   341,   341,
-    -208,     4,  -208,  -208,  -208,  -208,  -208,    86,   144,   145,
-    -208,  -208,    64,   -42,    21,   179,   189,   191,   192,  -208,
-    -208,   149,  -208,  -208,  -208,  -208,  -208,  -208,   -51,    42,
-      42,    99,   110,    33,    33,  -208,  -208,    79,    79,  -208,
-     -61,  -208,  -208,  -208,   -59,  -208,  -208,  -208,   -64,  -208,
-    -208,  -208,  -208,    19,    19,  -208,  -208,  -208,  -208,    -8,
-    -208,   160,  -208,    81,  -208,   140,  -208,  -208,  -208,  -208,
-    -208,    65,  -208,  -208,  -208
-};
+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
 
-/* YYPGOTO[NTERM-NUM].  */
-static const yytype_int16 yypgoto[] =
-{
-    -208,  -208,  -208,   196,   -11,  -207,   -94,  -122,     5,    -2,
-    -208,  -208,   -82,  -208,  -208,  -208,  -208,    53,  -208,     7,
-    -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,  -208,   -91,
-     -40,   -24,   -75,  -208,   -36,  -208,  -208,  -208,  -208,  -185,
-    -208,  -208,  -208,  -208,  -173,  -208
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
-   positive, shift that token.  If negative, reduce the rule which
-   number is the opposite.  If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -42
-static const yytype_int16 yytable[] =
-{
-      93,   141,   217,   249,   -13,   122,   123,    92,   124,    98,
-     132,    26,   -41,   174,   175,   189,   264,   195,   134,   116,
-       3,   253,   221,   229,   234,   128,   129,   109,   148,   278,
-     150,   112,   151,   152,   110,   214,   207,   212,   111,   121,
-     121,   117,   121,   273,   113,   230,   235,   275,   210,   213,
-     134,   279,   199,   200,   -29,   -29,    26,   135,   129,   145,
-     129,   201,   202,   203,   216,   127,   190,   272,   196,   274,
-     176,   177,   178,   179,   180,   181,   128,   129,   136,   137,
-     138,   139,   140,   270,   271,   205,   114,   221,   282,   135,
-      93,    93,   187,   144,   211,   211,   193,    92,    92,    98,
-      98,   206,   283,    90,   188,   115,   194,   145,   224,   225,
-     226,   171,   172,   173,   170,   171,   172,   173,   187,   121,
-     218,   119,   -13,   -13,   227,   228,   132,   215,   209,   209,
-     -41,   -41,   -13,   232,   134,   208,   208,    98,    98,    88,
-     -41,   144,   121,   174,   175,   170,   238,   259,    90,   216,
-     239,   240,   241,   242,   243,   244,   245,   246,   180,   181,
-     219,   247,   248,   174,   175,   178,   179,   180,   181,   276,
-     277,   251,   211,   258,   174,   175,   252,   193,   255,   256,
-     257,   260,   261,   265,    90,   182,   183,   184,    90,   182,
-     183,   184,   262,   266,   267,   268,   269,   281,    91,   284,
-     176,   177,   178,   179,   180,   181,   209,    93,     0,   171,
-     172,   173,   263,   208,   208,    98,    98,   174,   175,   237,
-       0,   177,   178,   179,   180,   181,    -3,   145,   145,     0,
-       0,     0,     0,   178,   179,   180,   181,     4,     5,     0,
-       0,     6,     7,     8,     9,    10,    11,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,   144,   144,    26,    27,    28,    29,    30,    31,    32,
-      33,    34,     0,     0,   176,   177,   178,   179,   180,   181,
-       0,    35,     0,   182,   183,   184,     0,     0,     0,     0,
-       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,     0,     0,    88,     0,     0,     0,
-      89,     0,     4,     5,     0,    90,     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,
-     136,   137,   138,   139,   140,     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,     0,
-       0,    88,     0,     0,     0,    89,     0,     4,     5,     0,
-      90,     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,    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,     0,     0,    88,     0,     0,     0,
-      89,     0,     0,     0,     0,    90,     7,     8,     9,    10,
-      11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
-      21,    22,    23,    24,    25,     0,     0,    26,     0,     0,
-       0,     0,     0,     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,    45,    46,    47,    48,    49,
-      50,    51,    52,    53,    54,    55,    56,    57,    58,   146,
-     147,   148,   149,   150,     0,   151,   152,     0,     0,   153,
-     154,     0,     0,    73,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,   155,   156,     0,    89,     0,     0,     0,     0,    90,
-       0,     0,   157,   158,   159,   160,   161,   162,   163,   164,
-     165
-};
-
-#define yypact_value_is_default(yystate) \
-  ((yystate) == (-208))
-
-#define yytable_value_is_error(yytable_value) \
-  YYID (0)
-
-static const yytype_int16 yycheck[] =
-{
-       2,    95,     8,   188,     0,    41,    42,     2,    44,     2,
-      92,    37,     0,    64,    65,   106,   223,   108,    93,    37,
-       0,   194,   144,    37,    37,   118,   119,    37,     5,    37,
-       7,    59,     9,    10,    37,   128,   130,   131,    37,    41,
-      42,    59,    44,   250,    59,    59,    59,   254,   130,   131,
-     125,    59,   121,   122,   118,   119,    37,    93,   119,    95,
-     119,   130,   131,   132,   128,    89,   106,   128,   108,   128,
-     121,   122,   123,   124,   125,   126,   118,   119,    59,    60,
-      61,    62,    63,   134,   135,   121,    37,   209,   273,   125,
-      92,    93,    37,    95,   130,   131,    37,    92,    93,    92,
-      93,   125,   275,   129,   106,    37,   108,   143,   144,   118,
-     119,    56,    57,    58,   133,    56,    57,    58,    37,   121,
-     126,    59,   118,   119,   118,   119,   208,   128,   130,   131,
-     118,   119,   128,    59,   209,   130,   131,   130,   131,   120,
-     128,   143,   144,    64,    65,   133,   170,    61,   129,   128,
-     174,   175,   176,   177,   178,   179,   180,   181,   125,   126,
-     126,   185,   186,    64,    65,   123,   124,   125,   126,   263,
-     264,    37,   208,   209,    64,    65,    37,    37,    37,    37,
-      37,    37,    37,     4,   129,   130,   131,   132,   129,   130,
-     131,   132,   128,     4,     3,     3,    47,    37,     2,   134,
-     121,   122,   123,   124,   125,   126,   208,   209,    -1,    56,
-      57,    58,   223,   208,   209,   208,   209,    64,    65,   166,
-      -1,   122,   123,   124,   125,   126,     0,   263,   264,    -1,
-      -1,    -1,    -1,   123,   124,   125,   126,    11,    12,    -1,
-      -1,    15,    16,    17,    18,    19,    20,    21,    22,    23,
-      24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
-      34,   263,   264,    37,    38,    39,    40,    41,    42,    43,
-      44,    45,    -1,    -1,   121,   122,   123,   124,   125,   126,
-      -1,    55,    -1,   130,   131,   132,    -1,    -1,    -1,    -1,
-      -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,    -1,    -1,   120,    -1,    -1,    -1,
-     124,    -1,    11,    12,    -1,   129,    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,    -1,
-      -1,   120,    -1,    -1,    -1,   124,    -1,    11,    12,    -1,
-     129,    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,    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,    -1,    -1,   120,    -1,    -1,    -1,
-     124,    -1,    -1,    -1,    -1,   129,    16,    17,    18,    19,
-      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
-      30,    31,    32,    33,    34,    -1,    -1,    37,    -1,    -1,
-      -1,    -1,    -1,    -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,    75,    76,    77,    78,    79,
-      80,    81,    82,    83,    84,    85,    86,    87,    88,     3,
-       4,     5,     6,     7,    -1,     9,    10,    -1,    -1,    13,
-      14,    -1,    -1,   103,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    35,    36,    -1,   124,    -1,    -1,    -1,    -1,   129,
-      -1,    -1,    46,    47,    48,    49,    50,    51,    52,    53,
-      54
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
-static const yytype_uint8 yystos[] =
-{
-       0,   137,   138,     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,
-      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,   120,   124,
-     129,   139,   144,   145,   148,   149,   150,   151,   155,   156,
-     157,   167,   168,   170,   171,   172,   173,   177,   178,    37,
-      37,    37,    59,    59,    37,    37,    37,    59,   163,    59,
-     164,   145,   170,   170,   170,   145,   155,   167,   118,   119,
-     140,   141,   148,   139,   168,   170,    59,    60,    61,    62,
-      63,   142,   143,   144,   145,   170,     3,     4,     5,     6,
-       7,     9,    10,    13,    14,    35,    36,    46,    47,    48,
-      49,    50,    51,    52,    53,    54,   152,   153,   154,   158,
-     133,    56,    57,    58,    64,    65,   121,   122,   123,   124,
-     125,   126,   130,   131,   132,   165,   166,    37,   145,   165,
-     166,   174,   175,    37,   145,   165,   166,   179,   180,   121,
-     122,   130,   131,   132,   169,   170,   167,   142,   144,   145,
-     148,   170,   142,   148,   128,   128,   128,     8,   126,   126,
-     142,   143,   146,   147,   170,   118,   119,   118,   119,    37,
-      59,   159,    59,   161,    37,    59,   162,   153,   167,   167,
-     167,   167,   167,   167,   167,   167,   167,   167,   167,   175,
-     176,    37,    37,   180,   181,    37,    37,    37,   170,    61,
-      37,    37,   128,   140,   141,     4,     4,     3,     3,    47,
-     134,   135,   128,   141,   128,   141,   142,   142,    37,    59,
-     160,    37,   175,   180,   134
-};
-
-#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
-
-
-/* Like YYERROR except do call yyerror.  This remains here temporarily
-   to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  However,
-   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
-   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
-   discussed.  */
-
-#define YYFAIL		goto yyerrlab
-#if defined YYFAIL
-  /* This is here to suppress warnings from the GCC cpp's
-     -Wunused-macros.  Normally we don't worry about that warning, but
-     some users do, and we want to make it easy for users to remove
-     YYFAIL uses, which will produce warnings from Bison 2.5.  */
-#endif
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
-#define YYBACKUP(Token, Value)					\
-do								\
-  if (yychar == YYEMPTY && yylen == 1)				\
-    {								\
-      yychar = (Token);						\
-      yylval = (Value);						\
-      YYPOPSTACK (1);						\
-      goto yybackup;						\
-    }								\
-  else								\
-    {								\
+#define YYBACKUP(Token, Value)                                  \
+do                                                              \
+  if (yychar == YYEMPTY)                                        \
+    {                                                           \
+      yychar = (Token);                                         \
+      yylval = (Value);                                         \
+      YYPOPSTACK (yylen);                                       \
+      yystate = *yyssp;                                         \
+      goto yybackup;                                            \
+    }                                                           \
+  else                                                          \
+    {                                                           \
       yyerror (YY_("syntax error: cannot back up")); \
-      YYERROR;							\
-    }								\
-while (YYID (0))
+      YYERROR;                                                  \
+    }                                                           \
+while (0)
+
+/* Error token number */
+#define YYTERROR        1
+#define YYERRCODE       256
 
 
-#define YYTERROR	1
-#define YYERRCODE	256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
-   If N is 0, then set CURRENT to the empty location which ends
-   the previous symbol: RHS[0] (always defined).  */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)				\
-    do									\
-      if (YYID (N))                                                    \
-	{								\
-	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
-	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
-	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
-	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
-	}								\
-      else								\
-	{								\
-	  (Current).first_line   = (Current).last_line   =		\
-	    YYRHSLOC (Rhs, 0).last_line;				\
-	  (Current).first_column = (Current).last_column =		\
-	    YYRHSLOC (Rhs, 0).last_column;				\
-	}								\
-    while (YYID (0))
-#endif
-
-
-/* This macro is provided for backward compatibility. */
-
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments.  */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (YYLEX_PARAM)
-#else
-# define YYLEX yylex ()
-#endif
 
 /* Enable debugging if requested.  */
 #if YYDEBUG
@@ -1512,54 +1435,46 @@
 #  define YYFPRINTF fprintf
 # endif
 
-# define YYDPRINTF(Args)			\
-do {						\
-  if (yydebug)					\
-    YYFPRINTF Args;				\
-} while (YYID (0))
+# define YYDPRINTF(Args)                        \
+do {                                            \
+  if (yydebug)                                  \
+    YYFPRINTF Args;                             \
+} while (0)
 
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
-do {									  \
-  if (yydebug)								  \
-    {									  \
-      YYFPRINTF (stderr, "%s ", Title);					  \
-      yy_symbol_print (stderr,						  \
-		  Type, Value); \
-      YYFPRINTF (stderr, "\n");						  \
-    }									  \
-} while (YYID (0))
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
 
 
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, "%s ", Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Type, Value); \
+      YYFPRINTF (stderr, "\n");                                           \
+    }                                                                     \
+} while (0)
 
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT.  |
+`----------------------------------------*/
+
 static void
 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-#endif
 {
+  FILE *yyo = yyoutput;
+  YYUSE (yyo);
   if (!yyvaluep)
     return;
 # ifdef YYPRINT
   if (yytype < YYNTOKENS)
     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
-  YYUSE (yyoutput);
 # endif
-  switch (yytype)
-    {
-      default:
-	break;
-    }
+  YYUSE (yytype);
 }
 
 
@@ -1567,22 +1482,11 @@
 | Print this symbol on YYOUTPUT.  |
 `--------------------------------*/
 
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-#endif
 {
-  if (yytype < YYNTOKENS)
-    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
-  else
-    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+  YYFPRINTF (yyoutput, "%s %s (",
+             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
 
   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
   YYFPRINTF (yyoutput, ")");
@@ -1593,16 +1497,8 @@
 | TOP (included).                                                   |
 `------------------------------------------------------------------*/
 
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
-    yytype_int16 *yybottom;
-    yytype_int16 *yytop;
-#endif
 {
   YYFPRINTF (stderr, "Stack now");
   for (; yybottom <= yytop; yybottom++)
@@ -1613,49 +1509,42 @@
   YYFPRINTF (stderr, "\n");
 }
 
-# define YY_STACK_PRINT(Bottom, Top)				\
-do {								\
-  if (yydebug)							\
-    yy_stack_print ((Bottom), (Top));				\
-} while (YYID (0))
+# define YY_STACK_PRINT(Bottom, Top)                            \
+do {                                                            \
+  if (yydebug)                                                  \
+    yy_stack_print ((Bottom), (Top));                           \
+} while (0)
 
 
 /*------------------------------------------------.
 | Report that the YYRULE is going to be reduced.  |
 `------------------------------------------------*/
 
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule)
-    YYSTYPE *yyvsp;
-    int yyrule;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
 {
+  unsigned long int yylno = yyrline[yyrule];
   int yynrhs = yyr2[yyrule];
   int yyi;
-  unsigned long int yylno = yyrline[yyrule];
   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
-	     yyrule - 1, yylno);
+             yyrule - 1, yylno);
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
-		       &(yyvsp[(yyi + 1) - (yynrhs)])
-		       		       );
+      yy_symbol_print (stderr,
+                       yystos[yyssp[yyi + 1 - yynrhs]],
+                       &(yyvsp[(yyi + 1) - (yynrhs)])
+                                              );
       YYFPRINTF (stderr, "\n");
     }
 }
 
-# define YY_REDUCE_PRINT(Rule)		\
-do {					\
-  if (yydebug)				\
-    yy_reduce_print (yyvsp, Rule); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, Rule); \
+} while (0)
 
 /* Nonzero means print parse trace.  It is left uninitialized so that
    multiple parsers can coexist.  */
@@ -1669,7 +1558,7 @@
 
 
 /* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef	YYINITDEPTH
+#ifndef YYINITDEPTH
 # define YYINITDEPTH 200
 #endif
 
@@ -1692,15 +1581,8 @@
 #   define yystrlen strlen
 #  else
 /* Return the length of YYSTR.  */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static YYSIZE_T
 yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
-    const char *yystr;
-#endif
 {
   YYSIZE_T yylen;
   for (yylen = 0; yystr[yylen]; yylen++)
@@ -1716,16 +1598,8 @@
 #  else
 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
    YYDEST.  */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static char *
 yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
-    char *yydest;
-    const char *yysrc;
-#endif
 {
   char *yyd = yydest;
   const char *yys = yysrc;
@@ -1755,27 +1629,27 @@
       char const *yyp = yystr;
 
       for (;;)
-	switch (*++yyp)
-	  {
-	  case '\'':
-	  case ',':
-	    goto do_not_strip_quotes;
+        switch (*++yyp)
+          {
+          case '\'':
+          case ',':
+            goto do_not_strip_quotes;
 
-	  case '\\':
-	    if (*++yyp != '\\')
-	      goto do_not_strip_quotes;
-	    /* Fall through.  */
-	  default:
-	    if (yyres)
-	      yyres[yyn] = *yyp;
-	    yyn++;
-	    break;
+          case '\\':
+            if (*++yyp != '\\')
+              goto do_not_strip_quotes;
+            /* Fall through.  */
+          default:
+            if (yyres)
+              yyres[yyn] = *yyp;
+            yyn++;
+            break;
 
-	  case '"':
-	    if (yyres)
-	      yyres[yyn] = '\0';
-	    return yyn;
-	  }
+          case '"':
+            if (yyres)
+              yyres[yyn] = '\0';
+            return yyn;
+          }
     do_not_strip_quotes: ;
     }
 
@@ -1798,12 +1672,11 @@
 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                 yytype_int16 *yyssp, int yytoken)
 {
-  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
   YYSIZE_T yysize = yysize0;
-  YYSIZE_T yysize1;
   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
   /* Internationalized format string. */
-  const char *yyformat = 0;
+  const char *yyformat = YY_NULLPTR;
   /* Arguments of yyformat. */
   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
   /* Number of reported tokens (one for the "unexpected", one per
@@ -1811,10 +1684,6 @@
   int yycount = 0;
 
   /* There are many possibilities here to consider:
-     - Assume YYFAIL is not used.  It's too flawed to consider.  See
-       <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
-       for details.  YYERROR is fine as it does not invoke this
-       function.
      - 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
@@ -1863,11 +1732,13 @@
                     break;
                   }
                 yyarg[yycount++] = yytname[yyx];
-                yysize1 = yysize + yytnamerr (0, yytname[yyx]);
-                if (! (yysize <= yysize1
-                       && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-                  return 2;
-                yysize = yysize1;
+                {
+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+                  if (! (yysize <= yysize1
+                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                    return 2;
+                  yysize = yysize1;
+                }
               }
         }
     }
@@ -1887,10 +1758,12 @@
 # undef YYCASE_
     }
 
-  yysize1 = yysize + yystrlen (yyformat);
-  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-    return 2;
-  yysize = yysize1;
+  {
+    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+      return 2;
+    yysize = yysize1;
+  }
 
   if (*yymsg_alloc < yysize)
     {
@@ -1927,48 +1800,20 @@
 | Release the memory associated to this symbol.  |
 `-----------------------------------------------*/
 
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep)
-    const char *yymsg;
-    int yytype;
-    YYSTYPE *yyvaluep;
-#endif
 {
   YYUSE (yyvaluep);
-
   if (!yymsg)
     yymsg = "Deleting";
   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 
-  switch (yytype)
-    {
-
-      default:
-	break;
-    }
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YYUSE (yytype);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
-/* Prevent warnings from -Wmissing-prototypes.  */
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
 
 
 /* The lookahead symbol.  */
@@ -1976,7 +1821,6 @@
 
 /* The semantic value of the lookahead symbol.  */
 YYSTYPE yylval;
-
 /* Number of syntax errors so far.  */
 int yynerrs;
 
@@ -1985,37 +1829,18 @@
 | yyparse.  |
 `----------*/
 
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
-    void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 int
 yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
 {
     int yystate;
     /* Number of tokens to shift before error messages enabled.  */
     int yyerrstatus;
 
     /* The stacks and their tools:
-       `yyss': related to states.
-       `yyvs': related to semantic values.
+       'yyss': related to states.
+       'yyvs': related to semantic values.
 
-       Refer to the stacks thru separate pointers, to allow yyoverflow
+       Refer to the stacks through separate pointers, to allow yyoverflow
        to reallocate them elsewhere.  */
 
     /* The state stack.  */
@@ -2033,7 +1858,7 @@
   int yyn;
   int yyresult;
   /* Lookahead token as an internal (translated) token number.  */
-  int yytoken;
+  int yytoken = 0;
   /* The variables used to return semantic value and location from the
      action routines.  */
   YYSTYPE yyval;
@@ -2051,9 +1876,8 @@
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
-  yytoken = 0;
-  yyss = yyssa;
-  yyvs = yyvsa;
+  yyssp = yyss = yyssa;
+  yyvsp = yyvs = yyvsa;
   yystacksize = YYINITDEPTH;
 
   YYDPRINTF ((stderr, "Starting parse\n"));
@@ -2062,14 +1886,6 @@
   yyerrstatus = 0;
   yynerrs = 0;
   yychar = YYEMPTY; /* Cause a token to be read.  */
-
-  /* Initialize stack pointers.
-     Waste one element of value and location stack
-     so that they stay on the same level as the state stack.
-     The wasted elements are never initialized.  */
-  yyssp = yyss;
-  yyvsp = yyvs;
-
   goto yysetstate;
 
 /*------------------------------------------------------------.
@@ -2090,23 +1906,23 @@
 
 #ifdef yyoverflow
       {
-	/* Give user a chance to reallocate the stack.  Use copies of
-	   these so that the &'s don't force the real ones into
-	   memory.  */
-	YYSTYPE *yyvs1 = yyvs;
-	yytype_int16 *yyss1 = yyss;
+        /* Give user a chance to reallocate the stack.  Use copies of
+           these so that the &'s don't force the real ones into
+           memory.  */
+        YYSTYPE *yyvs1 = yyvs;
+        yytype_int16 *yyss1 = yyss;
 
-	/* Each stack pointer address is followed by the size of the
-	   data in use in that stack, in bytes.  This used to be a
-	   conditional around just the two extra args, but that might
-	   be undefined if yyoverflow is a macro.  */
-	yyoverflow (YY_("memory exhausted"),
-		    &yyss1, yysize * sizeof (*yyssp),
-		    &yyvs1, yysize * sizeof (*yyvsp),
-		    &yystacksize);
+        /* Each stack pointer address is followed by the size of the
+           data in use in that stack, in bytes.  This used to be a
+           conditional around just the two extra args, but that might
+           be undefined if yyoverflow is a macro.  */
+        yyoverflow (YY_("memory exhausted"),
+                    &yyss1, yysize * sizeof (*yyssp),
+                    &yyvs1, yysize * sizeof (*yyvsp),
+                    &yystacksize);
 
-	yyss = yyss1;
-	yyvs = yyvs1;
+        yyss = yyss1;
+        yyvs = yyvs1;
       }
 #else /* no yyoverflow */
 # ifndef YYSTACK_RELOCATE
@@ -2114,22 +1930,22 @@
 # else
       /* Extend the stack our own way.  */
       if (YYMAXDEPTH <= yystacksize)
-	goto yyexhaustedlab;
+        goto yyexhaustedlab;
       yystacksize *= 2;
       if (YYMAXDEPTH < yystacksize)
-	yystacksize = YYMAXDEPTH;
+        yystacksize = YYMAXDEPTH;
 
       {
-	yytype_int16 *yyss1 = yyss;
-	union yyalloc *yyptr =
-	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-	if (! yyptr)
-	  goto yyexhaustedlab;
-	YYSTACK_RELOCATE (yyss_alloc, yyss);
-	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+        yytype_int16 *yyss1 = yyss;
+        union yyalloc *yyptr =
+          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+        if (! yyptr)
+          goto yyexhaustedlab;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 #  undef YYSTACK_RELOCATE
-	if (yyss1 != yyssa)
-	  YYSTACK_FREE (yyss1);
+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
       }
 # endif
 #endif /* no yyoverflow */
@@ -2138,10 +1954,10 @@
       yyvsp = yyvs + yysize - 1;
 
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-		  (unsigned long int) yystacksize));
+                  (unsigned long int) yystacksize));
 
       if (yyss + yystacksize - 1 <= yyssp)
-	YYABORT;
+        YYABORT;
     }
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -2170,7 +1986,7 @@
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
-      yychar = YYLEX;
+      yychar = yylex ();
     }
 
   if (yychar <= YYEOF)
@@ -2210,7 +2026,9 @@
   yychar = YYEMPTY;
 
   yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
   goto yynewstate;
 
@@ -2233,7 +2051,7 @@
   yylen = yyr2[yyn];
 
   /* If YYLEN is nonzero, implement the default value of the action:
-     `$$ = $1'.
+     '$$ = $1'.
 
      Otherwise, the following line sets YYVAL to garbage.
      This behavior is undocumented and Bison
@@ -2247,108 +2065,93 @@
   switch (yyn)
     {
         case 2:
-
-/* Line 1806 of yacc.c  */
-#line 317 "grammar.y"
+#line 331 "grammar.y" /* yacc.c:1646  */
     {
-	finish_parse((yyvsp[(2) - (2)].blk).b);
+	finish_parse((yyvsp[0].blk).b);
 }
+#line 2073 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 4:
-
-/* Line 1806 of yacc.c  */
-#line 322 "grammar.y"
+#line 336 "grammar.y" /* yacc.c:1646  */
     { (yyval.blk).q = qerr; }
+#line 2079 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 6:
-
-/* Line 1806 of yacc.c  */
-#line 325 "grammar.y"
-    { gen_and((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); }
+#line 339 "grammar.y" /* yacc.c:1646  */
+    { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
+#line 2085 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 7:
-
-/* Line 1806 of yacc.c  */
-#line 326 "grammar.y"
-    { gen_and((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); }
+#line 340 "grammar.y" /* yacc.c:1646  */
+    { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
+#line 2091 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 8:
-
-/* Line 1806 of yacc.c  */
-#line 327 "grammar.y"
-    { gen_or((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); }
+#line 341 "grammar.y" /* yacc.c:1646  */
+    { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
+#line 2097 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 9:
-
-/* Line 1806 of yacc.c  */
-#line 328 "grammar.y"
-    { gen_or((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); }
+#line 342 "grammar.y" /* yacc.c:1646  */
+    { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
+#line 2103 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 10:
-
-/* Line 1806 of yacc.c  */
-#line 330 "grammar.y"
-    { (yyval.blk) = (yyvsp[(0) - (1)].blk); }
+#line 344 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk) = (yyvsp[-1].blk); }
+#line 2109 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 11:
-
-/* Line 1806 of yacc.c  */
-#line 332 "grammar.y"
-    { (yyval.blk) = (yyvsp[(0) - (1)].blk); }
+#line 346 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk) = (yyvsp[-1].blk); }
+#line 2115 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 13:
-
-/* Line 1806 of yacc.c  */
-#line 335 "grammar.y"
-    { (yyval.blk).b = gen_ncode(NULL, (bpf_u_int32)(yyvsp[(1) - (1)].i),
-						   (yyval.blk).q = (yyvsp[(0) - (1)].blk).q); }
+#line 349 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_ncode(NULL, (bpf_u_int32)(yyvsp[0].i),
+						   (yyval.blk).q = (yyvsp[-1].blk).q); }
+#line 2122 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 14:
-
-/* Line 1806 of yacc.c  */
-#line 337 "grammar.y"
-    { (yyval.blk) = (yyvsp[(2) - (3)].blk); }
+#line 351 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk) = (yyvsp[-1].blk); }
+#line 2128 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 15:
-
-/* Line 1806 of yacc.c  */
-#line 339 "grammar.y"
-    { (yyval.blk).b = gen_scode((yyvsp[(1) - (1)].s), (yyval.blk).q = (yyvsp[(0) - (1)].blk).q); }
+#line 353 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_scode((yyvsp[0].s), (yyval.blk).q = (yyvsp[-1].blk).q); }
+#line 2134 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 16:
-
-/* Line 1806 of yacc.c  */
-#line 340 "grammar.y"
-    { (yyval.blk).b = gen_mcode((yyvsp[(1) - (3)].s), NULL, (yyvsp[(3) - (3)].i),
-				    (yyval.blk).q = (yyvsp[(0) - (3)].blk).q); }
+#line 354 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_mcode((yyvsp[-2].s), NULL, (yyvsp[0].i),
+				    (yyval.blk).q = (yyvsp[-3].blk).q); }
+#line 2141 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 17:
-
-/* Line 1806 of yacc.c  */
-#line 342 "grammar.y"
-    { (yyval.blk).b = gen_mcode((yyvsp[(1) - (3)].s), (yyvsp[(3) - (3)].s), 0,
-				    (yyval.blk).q = (yyvsp[(0) - (3)].blk).q); }
+#line 356 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_mcode((yyvsp[-2].s), (yyvsp[0].s), 0,
+				    (yyval.blk).q = (yyvsp[-3].blk).q); }
+#line 2148 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 18:
-
-/* Line 1806 of yacc.c  */
-#line 344 "grammar.y"
+#line 358 "grammar.y" /* yacc.c:1646  */
     {
 				  /* Decide how to parse HID based on proto */
-				  (yyval.blk).q = (yyvsp[(0) - (1)].blk).q;
+				  (yyval.blk).q = (yyvsp[-1].blk).q;
 				  if ((yyval.blk).q.addr == Q_PORT)
 				  	bpf_error("'port' modifier applied to ip host");
 				  else if ((yyval.blk).q.addr == Q_PORTRANGE)
@@ -2357,844 +2160,749 @@
 				  	bpf_error("'proto' modifier applied to ip host");
 				  else if ((yyval.blk).q.addr == Q_PROTOCHAIN)
 				  	bpf_error("'protochain' modifier applied to ip host");
-				  (yyval.blk).b = gen_ncode((yyvsp[(1) - (1)].s), 0, (yyval.blk).q);
+				  (yyval.blk).b = gen_ncode((yyvsp[0].s), 0, (yyval.blk).q);
 				}
+#line 2166 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 19:
-
-/* Line 1806 of yacc.c  */
-#line 357 "grammar.y"
+#line 371 "grammar.y" /* yacc.c:1646  */
     {
 #ifdef INET6
-				  (yyval.blk).b = gen_mcode6((yyvsp[(1) - (3)].s), NULL, (yyvsp[(3) - (3)].i),
-				    (yyval.blk).q = (yyvsp[(0) - (3)].blk).q);
+				  (yyval.blk).b = gen_mcode6((yyvsp[-2].s), NULL, (yyvsp[0].i),
+				    (yyval.blk).q = (yyvsp[-3].blk).q);
 #else
 				  bpf_error("'ip6addr/prefixlen' not supported "
 					"in this configuration");
 #endif /*INET6*/
 				}
+#line 2180 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 20:
-
-/* Line 1806 of yacc.c  */
-#line 366 "grammar.y"
+#line 380 "grammar.y" /* yacc.c:1646  */
     {
 #ifdef INET6
-				  (yyval.blk).b = gen_mcode6((yyvsp[(1) - (1)].s), 0, 128,
-				    (yyval.blk).q = (yyvsp[(0) - (1)].blk).q);
+				  (yyval.blk).b = gen_mcode6((yyvsp[0].s), 0, 128,
+				    (yyval.blk).q = (yyvsp[-1].blk).q);
 #else
 				  bpf_error("'ip6addr' not supported "
 					"in this configuration");
 #endif /*INET6*/
 				}
+#line 2194 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 21:
-
-/* Line 1806 of yacc.c  */
-#line 375 "grammar.y"
-    { 
-				  (yyval.blk).b = gen_ecode((yyvsp[(1) - (1)].e), (yyval.blk).q = (yyvsp[(0) - (1)].blk).q);
+#line 389 "grammar.y" /* yacc.c:1646  */
+    {
+				  (yyval.blk).b = gen_ecode((yyvsp[0].e), (yyval.blk).q = (yyvsp[-1].blk).q);
 				  /*
 				   * $1 was allocated by "pcap_ether_aton()",
 				   * so we must free it now that we're done
 				   * with it.
 				   */
-				  free((yyvsp[(1) - (1)].e));
+				  free((yyvsp[0].e));
 				}
+#line 2208 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 22:
-
-/* Line 1806 of yacc.c  */
-#line 384 "grammar.y"
+#line 398 "grammar.y" /* yacc.c:1646  */
     {
-				  (yyval.blk).b = gen_acode((yyvsp[(1) - (1)].e), (yyval.blk).q = (yyvsp[(0) - (1)].blk).q);
+				  (yyval.blk).b = gen_acode((yyvsp[0].e), (yyval.blk).q = (yyvsp[-1].blk).q);
 				  /*
 				   * $1 was allocated by "pcap_ether_aton()",
 				   * so we must free it now that we're done
 				   * with it.
 				   */
-				  free((yyvsp[(1) - (1)].e));
+				  free((yyvsp[0].e));
 				}
+#line 2222 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 23:
-
-/* Line 1806 of yacc.c  */
-#line 393 "grammar.y"
-    { gen_not((yyvsp[(2) - (2)].blk).b); (yyval.blk) = (yyvsp[(2) - (2)].blk); }
+#line 407 "grammar.y" /* yacc.c:1646  */
+    { gen_not((yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
+#line 2228 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 24:
-
-/* Line 1806 of yacc.c  */
-#line 395 "grammar.y"
-    { (yyval.blk) = (yyvsp[(0) - (1)].blk); }
+#line 409 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk) = (yyvsp[-1].blk); }
+#line 2234 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 25:
-
-/* Line 1806 of yacc.c  */
-#line 397 "grammar.y"
-    { (yyval.blk) = (yyvsp[(0) - (1)].blk); }
+#line 411 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk) = (yyvsp[-1].blk); }
+#line 2240 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 27:
-
-/* Line 1806 of yacc.c  */
-#line 400 "grammar.y"
-    { gen_and((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); }
+#line 414 "grammar.y" /* yacc.c:1646  */
+    { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
+#line 2246 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 28:
-
-/* Line 1806 of yacc.c  */
-#line 401 "grammar.y"
-    { gen_or((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); }
+#line 415 "grammar.y" /* yacc.c:1646  */
+    { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
+#line 2252 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 29:
-
-/* Line 1806 of yacc.c  */
-#line 403 "grammar.y"
-    { (yyval.blk).b = gen_ncode(NULL, (bpf_u_int32)(yyvsp[(1) - (1)].i),
-						   (yyval.blk).q = (yyvsp[(0) - (1)].blk).q); }
+#line 417 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_ncode(NULL, (bpf_u_int32)(yyvsp[0].i),
+						   (yyval.blk).q = (yyvsp[-1].blk).q); }
+#line 2259 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 32:
-
-/* Line 1806 of yacc.c  */
-#line 408 "grammar.y"
-    { gen_not((yyvsp[(2) - (2)].blk).b); (yyval.blk) = (yyvsp[(2) - (2)].blk); }
+#line 422 "grammar.y" /* yacc.c:1646  */
+    { gen_not((yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
+#line 2265 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 33:
-
-/* Line 1806 of yacc.c  */
-#line 410 "grammar.y"
-    { QSET((yyval.blk).q, (yyvsp[(1) - (3)].i), (yyvsp[(2) - (3)].i), (yyvsp[(3) - (3)].i)); }
+#line 424 "grammar.y" /* yacc.c:1646  */
+    { QSET((yyval.blk).q, (yyvsp[-2].i), (yyvsp[-1].i), (yyvsp[0].i)); }
+#line 2271 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 34:
-
-/* Line 1806 of yacc.c  */
-#line 411 "grammar.y"
-    { QSET((yyval.blk).q, (yyvsp[(1) - (2)].i), (yyvsp[(2) - (2)].i), Q_DEFAULT); }
+#line 425 "grammar.y" /* yacc.c:1646  */
+    { QSET((yyval.blk).q, (yyvsp[-1].i), (yyvsp[0].i), Q_DEFAULT); }
+#line 2277 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 35:
-
-/* Line 1806 of yacc.c  */
-#line 412 "grammar.y"
-    { QSET((yyval.blk).q, (yyvsp[(1) - (2)].i), Q_DEFAULT, (yyvsp[(2) - (2)].i)); }
+#line 426 "grammar.y" /* yacc.c:1646  */
+    { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, (yyvsp[0].i)); }
+#line 2283 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 36:
-
-/* Line 1806 of yacc.c  */
-#line 413 "grammar.y"
-    { QSET((yyval.blk).q, (yyvsp[(1) - (2)].i), Q_DEFAULT, Q_PROTO); }
+#line 427 "grammar.y" /* yacc.c:1646  */
+    { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, Q_PROTO); }
+#line 2289 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 37:
-
-/* Line 1806 of yacc.c  */
-#line 414 "grammar.y"
-    { QSET((yyval.blk).q, (yyvsp[(1) - (2)].i), Q_DEFAULT, Q_PROTOCHAIN); }
+#line 428 "grammar.y" /* yacc.c:1646  */
+    { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, Q_PROTOCHAIN); }
+#line 2295 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 38:
-
-/* Line 1806 of yacc.c  */
-#line 415 "grammar.y"
-    { QSET((yyval.blk).q, (yyvsp[(1) - (2)].i), Q_DEFAULT, (yyvsp[(2) - (2)].i)); }
+#line 429 "grammar.y" /* yacc.c:1646  */
+    { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, (yyvsp[0].i)); }
+#line 2301 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 39:
-
-/* Line 1806 of yacc.c  */
-#line 417 "grammar.y"
-    { (yyval.blk) = (yyvsp[(2) - (2)].blk); }
+#line 431 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk) = (yyvsp[0].blk); }
+#line 2307 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 40:
-
-/* Line 1806 of yacc.c  */
-#line 418 "grammar.y"
-    { (yyval.blk).b = (yyvsp[(2) - (3)].blk).b; (yyval.blk).q = (yyvsp[(1) - (3)].blk).q; }
+#line 432 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = (yyvsp[-2].blk).q; }
+#line 2313 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 41:
-
-/* Line 1806 of yacc.c  */
-#line 419 "grammar.y"
-    { (yyval.blk).b = gen_proto_abbrev((yyvsp[(1) - (1)].i)); (yyval.blk).q = qerr; }
+#line 433 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_proto_abbrev((yyvsp[0].i)); (yyval.blk).q = qerr; }
+#line 2319 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 42:
-
-/* Line 1806 of yacc.c  */
-#line 420 "grammar.y"
-    { (yyval.blk).b = gen_relation((yyvsp[(2) - (3)].i), (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a), 0);
+#line 434 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_relation((yyvsp[-1].i), (yyvsp[-2].a), (yyvsp[0].a), 0);
 				  (yyval.blk).q = qerr; }
+#line 2326 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 43:
-
-/* Line 1806 of yacc.c  */
-#line 422 "grammar.y"
-    { (yyval.blk).b = gen_relation((yyvsp[(2) - (3)].i), (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a), 1);
+#line 436 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_relation((yyvsp[-1].i), (yyvsp[-2].a), (yyvsp[0].a), 1);
 				  (yyval.blk).q = qerr; }
+#line 2333 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 44:
-
-/* Line 1806 of yacc.c  */
-#line 424 "grammar.y"
-    { (yyval.blk).b = (yyvsp[(1) - (1)].rblk); (yyval.blk).q = qerr; }
+#line 438 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = (yyvsp[0].rblk); (yyval.blk).q = qerr; }
+#line 2339 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 45:
-
-/* Line 1806 of yacc.c  */
-#line 425 "grammar.y"
-    { (yyval.blk).b = gen_atmtype_abbrev((yyvsp[(1) - (1)].i)); (yyval.blk).q = qerr; }
+#line 439 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_atmtype_abbrev((yyvsp[0].i)); (yyval.blk).q = qerr; }
+#line 2345 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 46:
-
-/* Line 1806 of yacc.c  */
-#line 426 "grammar.y"
-    { (yyval.blk).b = gen_atmmulti_abbrev((yyvsp[(1) - (1)].i)); (yyval.blk).q = qerr; }
+#line 440 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_atmmulti_abbrev((yyvsp[0].i)); (yyval.blk).q = qerr; }
+#line 2351 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 47:
-
-/* Line 1806 of yacc.c  */
-#line 427 "grammar.y"
-    { (yyval.blk).b = (yyvsp[(2) - (2)].blk).b; (yyval.blk).q = qerr; }
+#line 441 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = (yyvsp[0].blk).b; (yyval.blk).q = qerr; }
+#line 2357 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 48:
-
-/* Line 1806 of yacc.c  */
-#line 428 "grammar.y"
-    { (yyval.blk).b = gen_mtp2type_abbrev((yyvsp[(1) - (1)].i)); (yyval.blk).q = qerr; }
+#line 442 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_mtp2type_abbrev((yyvsp[0].i)); (yyval.blk).q = qerr; }
+#line 2363 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 49:
-
-/* Line 1806 of yacc.c  */
-#line 429 "grammar.y"
-    { (yyval.blk).b = (yyvsp[(2) - (2)].blk).b; (yyval.blk).q = qerr; }
+#line 443 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = (yyvsp[0].blk).b; (yyval.blk).q = qerr; }
+#line 2369 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 51:
-
-/* Line 1806 of yacc.c  */
-#line 433 "grammar.y"
+#line 447 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_DEFAULT; }
+#line 2375 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 52:
-
-/* Line 1806 of yacc.c  */
-#line 436 "grammar.y"
+#line 450 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_SRC; }
+#line 2381 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 53:
-
-/* Line 1806 of yacc.c  */
-#line 437 "grammar.y"
+#line 451 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_DST; }
+#line 2387 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 54:
-
-/* Line 1806 of yacc.c  */
-#line 438 "grammar.y"
+#line 452 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_OR; }
+#line 2393 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 55:
-
-/* Line 1806 of yacc.c  */
-#line 439 "grammar.y"
+#line 453 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_OR; }
+#line 2399 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 56:
-
-/* Line 1806 of yacc.c  */
-#line 440 "grammar.y"
+#line 454 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_AND; }
+#line 2405 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 57:
-
-/* Line 1806 of yacc.c  */
-#line 441 "grammar.y"
+#line 455 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_AND; }
+#line 2411 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 58:
-
-/* Line 1806 of yacc.c  */
-#line 442 "grammar.y"
+#line 456 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ADDR1; }
+#line 2417 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 59:
-
-/* Line 1806 of yacc.c  */
-#line 443 "grammar.y"
+#line 457 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ADDR2; }
+#line 2423 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 60:
-
-/* Line 1806 of yacc.c  */
-#line 444 "grammar.y"
+#line 458 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ADDR3; }
+#line 2429 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 61:
-
-/* Line 1806 of yacc.c  */
-#line 445 "grammar.y"
+#line 459 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ADDR4; }
+#line 2435 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 62:
-
-/* Line 1806 of yacc.c  */
-#line 446 "grammar.y"
+#line 460 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_RA; }
+#line 2441 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 63:
-
-/* Line 1806 of yacc.c  */
-#line 447 "grammar.y"
+#line 461 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_TA; }
+#line 2447 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 64:
-
-/* Line 1806 of yacc.c  */
-#line 450 "grammar.y"
+#line 464 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_HOST; }
+#line 2453 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 65:
-
-/* Line 1806 of yacc.c  */
-#line 451 "grammar.y"
+#line 465 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_NET; }
+#line 2459 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 66:
-
-/* Line 1806 of yacc.c  */
-#line 452 "grammar.y"
+#line 466 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_PORT; }
+#line 2465 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 67:
-
-/* Line 1806 of yacc.c  */
-#line 453 "grammar.y"
+#line 467 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_PORTRANGE; }
+#line 2471 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 68:
-
-/* Line 1806 of yacc.c  */
-#line 456 "grammar.y"
+#line 470 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_GATEWAY; }
+#line 2477 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 69:
-
-/* Line 1806 of yacc.c  */
-#line 458 "grammar.y"
+#line 472 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_LINK; }
+#line 2483 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 70:
-
-/* Line 1806 of yacc.c  */
-#line 459 "grammar.y"
+#line 473 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_IP; }
+#line 2489 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 71:
-
-/* Line 1806 of yacc.c  */
-#line 460 "grammar.y"
+#line 474 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ARP; }
+#line 2495 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 72:
-
-/* Line 1806 of yacc.c  */
-#line 461 "grammar.y"
+#line 475 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_RARP; }
+#line 2501 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 73:
-
-/* Line 1806 of yacc.c  */
-#line 462 "grammar.y"
+#line 476 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_SCTP; }
+#line 2507 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 74:
-
-/* Line 1806 of yacc.c  */
-#line 463 "grammar.y"
+#line 477 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_TCP; }
+#line 2513 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 75:
-
-/* Line 1806 of yacc.c  */
-#line 464 "grammar.y"
+#line 478 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_UDP; }
+#line 2519 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 76:
-
-/* Line 1806 of yacc.c  */
-#line 465 "grammar.y"
+#line 479 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ICMP; }
+#line 2525 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 77:
-
-/* Line 1806 of yacc.c  */
-#line 466 "grammar.y"
+#line 480 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_IGMP; }
+#line 2531 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 78:
-
-/* Line 1806 of yacc.c  */
-#line 467 "grammar.y"
+#line 481 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_IGRP; }
+#line 2537 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 79:
-
-/* Line 1806 of yacc.c  */
-#line 468 "grammar.y"
+#line 482 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_PIM; }
+#line 2543 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 80:
-
-/* Line 1806 of yacc.c  */
-#line 469 "grammar.y"
+#line 483 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_VRRP; }
+#line 2549 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 81:
-
-/* Line 1806 of yacc.c  */
-#line 470 "grammar.y"
+#line 484 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_CARP; }
+#line 2555 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 82:
-
-/* Line 1806 of yacc.c  */
-#line 471 "grammar.y"
+#line 485 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ATALK; }
+#line 2561 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 83:
-
-/* Line 1806 of yacc.c  */
-#line 472 "grammar.y"
+#line 486 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_AARP; }
+#line 2567 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 84:
-
-/* Line 1806 of yacc.c  */
-#line 473 "grammar.y"
+#line 487 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_DECNET; }
+#line 2573 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 85:
-
-/* Line 1806 of yacc.c  */
-#line 474 "grammar.y"
+#line 488 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_LAT; }
+#line 2579 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 86:
-
-/* Line 1806 of yacc.c  */
-#line 475 "grammar.y"
+#line 489 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_SCA; }
+#line 2585 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 87:
-
-/* Line 1806 of yacc.c  */
-#line 476 "grammar.y"
+#line 490 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_MOPDL; }
+#line 2591 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 88:
-
-/* Line 1806 of yacc.c  */
-#line 477 "grammar.y"
+#line 491 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_MOPRC; }
+#line 2597 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 89:
-
-/* Line 1806 of yacc.c  */
-#line 478 "grammar.y"
+#line 492 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_IPV6; }
+#line 2603 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 90:
-
-/* Line 1806 of yacc.c  */
-#line 479 "grammar.y"
+#line 493 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ICMPV6; }
+#line 2609 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 91:
-
-/* Line 1806 of yacc.c  */
-#line 480 "grammar.y"
+#line 494 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_AH; }
+#line 2615 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 92:
-
-/* Line 1806 of yacc.c  */
-#line 481 "grammar.y"
+#line 495 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ESP; }
+#line 2621 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 93:
-
-/* Line 1806 of yacc.c  */
-#line 482 "grammar.y"
+#line 496 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ISO; }
+#line 2627 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 94:
-
-/* Line 1806 of yacc.c  */
-#line 483 "grammar.y"
+#line 497 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ESIS; }
+#line 2633 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 95:
-
-/* Line 1806 of yacc.c  */
-#line 484 "grammar.y"
+#line 498 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ISIS; }
+#line 2639 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 96:
-
-/* Line 1806 of yacc.c  */
-#line 485 "grammar.y"
+#line 499 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ISIS_L1; }
+#line 2645 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 97:
-
-/* Line 1806 of yacc.c  */
-#line 486 "grammar.y"
+#line 500 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ISIS_L2; }
+#line 2651 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 98:
-
-/* Line 1806 of yacc.c  */
-#line 487 "grammar.y"
+#line 501 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ISIS_IIH; }
+#line 2657 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 99:
-
-/* Line 1806 of yacc.c  */
-#line 488 "grammar.y"
+#line 502 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ISIS_LSP; }
+#line 2663 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 100:
-
-/* Line 1806 of yacc.c  */
-#line 489 "grammar.y"
+#line 503 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ISIS_SNP; }
+#line 2669 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 101:
-
-/* Line 1806 of yacc.c  */
-#line 490 "grammar.y"
+#line 504 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ISIS_PSNP; }
+#line 2675 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 102:
-
-/* Line 1806 of yacc.c  */
-#line 491 "grammar.y"
+#line 505 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_ISIS_CSNP; }
+#line 2681 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 103:
-
-/* Line 1806 of yacc.c  */
-#line 492 "grammar.y"
+#line 506 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_CLNP; }
+#line 2687 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 104:
-
-/* Line 1806 of yacc.c  */
-#line 493 "grammar.y"
+#line 507 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_STP; }
+#line 2693 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 105:
-
-/* Line 1806 of yacc.c  */
-#line 494 "grammar.y"
+#line 508 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_IPX; }
+#line 2699 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 106:
-
-/* Line 1806 of yacc.c  */
-#line 495 "grammar.y"
+#line 509 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_NETBEUI; }
+#line 2705 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 107:
-
-/* Line 1806 of yacc.c  */
-#line 496 "grammar.y"
+#line 510 "grammar.y" /* yacc.c:1646  */
     { (yyval.i) = Q_RADIO; }
+#line 2711 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 108:
-
-/* Line 1806 of yacc.c  */
-#line 498 "grammar.y"
-    { (yyval.rblk) = gen_broadcast((yyvsp[(1) - (2)].i)); }
+#line 512 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_broadcast((yyvsp[-1].i)); }
+#line 2717 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 109:
-
-/* Line 1806 of yacc.c  */
-#line 499 "grammar.y"
-    { (yyval.rblk) = gen_multicast((yyvsp[(1) - (2)].i)); }
+#line 513 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_multicast((yyvsp[-1].i)); }
+#line 2723 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 110:
-
-/* Line 1806 of yacc.c  */
-#line 500 "grammar.y"
-    { (yyval.rblk) = gen_less((yyvsp[(2) - (2)].i)); }
+#line 514 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_less((yyvsp[0].i)); }
+#line 2729 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 111:
-
-/* Line 1806 of yacc.c  */
-#line 501 "grammar.y"
-    { (yyval.rblk) = gen_greater((yyvsp[(2) - (2)].i)); }
+#line 515 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_greater((yyvsp[0].i)); }
+#line 2735 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 112:
-
-/* Line 1806 of yacc.c  */
-#line 502 "grammar.y"
-    { (yyval.rblk) = gen_byteop((yyvsp[(3) - (4)].i), (yyvsp[(2) - (4)].i), (yyvsp[(4) - (4)].i)); }
+#line 516 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_byteop((yyvsp[-1].i), (yyvsp[-2].i), (yyvsp[0].i)); }
+#line 2741 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 113:
-
-/* Line 1806 of yacc.c  */
-#line 503 "grammar.y"
+#line 517 "grammar.y" /* yacc.c:1646  */
     { (yyval.rblk) = gen_inbound(0); }
+#line 2747 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 114:
-
-/* Line 1806 of yacc.c  */
-#line 504 "grammar.y"
+#line 518 "grammar.y" /* yacc.c:1646  */
     { (yyval.rblk) = gen_inbound(1); }
+#line 2753 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 115:
-
-/* Line 1806 of yacc.c  */
-#line 505 "grammar.y"
-    { (yyval.rblk) = gen_vlan((yyvsp[(2) - (2)].i)); }
+#line 519 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_vlan((yyvsp[0].i)); }
+#line 2759 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 116:
-
-/* Line 1806 of yacc.c  */
-#line 506 "grammar.y"
+#line 520 "grammar.y" /* yacc.c:1646  */
     { (yyval.rblk) = gen_vlan(-1); }
+#line 2765 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 117:
-
-/* Line 1806 of yacc.c  */
-#line 507 "grammar.y"
-    { (yyval.rblk) = gen_mpls((yyvsp[(2) - (2)].i)); }
+#line 521 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_mpls((yyvsp[0].i)); }
+#line 2771 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 118:
-
-/* Line 1806 of yacc.c  */
-#line 508 "grammar.y"
+#line 522 "grammar.y" /* yacc.c:1646  */
     { (yyval.rblk) = gen_mpls(-1); }
+#line 2777 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 119:
-
-/* Line 1806 of yacc.c  */
-#line 509 "grammar.y"
+#line 523 "grammar.y" /* yacc.c:1646  */
     { (yyval.rblk) = gen_pppoed(); }
+#line 2783 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 120:
-
-/* Line 1806 of yacc.c  */
-#line 510 "grammar.y"
-    { (yyval.rblk) = gen_pppoes((yyvsp[(2) - (2)].i)); }
+#line 524 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_pppoes((yyvsp[0].i)); }
+#line 2789 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 121:
-
-/* Line 1806 of yacc.c  */
-#line 511 "grammar.y"
+#line 525 "grammar.y" /* yacc.c:1646  */
     { (yyval.rblk) = gen_pppoes(-1); }
+#line 2795 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 122:
-
-/* Line 1806 of yacc.c  */
-#line 512 "grammar.y"
-    { (yyval.rblk) = (yyvsp[(1) - (1)].rblk); }
+#line 526 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_geneve((yyvsp[0].i)); }
+#line 2801 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 123:
-
-/* Line 1806 of yacc.c  */
-#line 513 "grammar.y"
-    { (yyval.rblk) = (yyvsp[(2) - (2)].rblk); }
+#line 527 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_geneve(-1); }
+#line 2807 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 124:
-
-/* Line 1806 of yacc.c  */
-#line 516 "grammar.y"
-    { (yyval.rblk) = gen_pf_ifname((yyvsp[(2) - (2)].s)); }
+#line 528 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = (yyvsp[0].rblk); }
+#line 2813 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 125:
-
-/* Line 1806 of yacc.c  */
-#line 517 "grammar.y"
-    { (yyval.rblk) = gen_pf_ruleset((yyvsp[(2) - (2)].s)); }
+#line 529 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = (yyvsp[0].rblk); }
+#line 2819 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 126:
-
-/* Line 1806 of yacc.c  */
-#line 518 "grammar.y"
-    { (yyval.rblk) = gen_pf_rnr((yyvsp[(2) - (2)].i)); }
+#line 530 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = (yyvsp[0].rblk); }
+#line 2825 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 127:
-
-/* Line 1806 of yacc.c  */
-#line 519 "grammar.y"
-    { (yyval.rblk) = gen_pf_srnr((yyvsp[(2) - (2)].i)); }
+#line 533 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_pf_ifname((yyvsp[0].s)); }
+#line 2831 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 128:
-
-/* Line 1806 of yacc.c  */
-#line 520 "grammar.y"
-    { (yyval.rblk) = gen_pf_reason((yyvsp[(2) - (2)].i)); }
+#line 534 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_pf_ruleset((yyvsp[0].s)); }
+#line 2837 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 129:
-
-/* Line 1806 of yacc.c  */
-#line 521 "grammar.y"
-    { (yyval.rblk) = gen_pf_action((yyvsp[(2) - (2)].i)); }
+#line 535 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_pf_rnr((yyvsp[0].i)); }
+#line 2843 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 130:
-
-/* Line 1806 of yacc.c  */
-#line 525 "grammar.y"
-    { (yyval.rblk) = gen_p80211_type((yyvsp[(2) - (4)].i) | (yyvsp[(4) - (4)].i),
-					IEEE80211_FC0_TYPE_MASK |
-					IEEE80211_FC0_SUBTYPE_MASK);
-				}
+#line 536 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_pf_srnr((yyvsp[0].i)); }
+#line 2849 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 131:
-
-/* Line 1806 of yacc.c  */
-#line 529 "grammar.y"
-    { (yyval.rblk) = gen_p80211_type((yyvsp[(2) - (2)].i),
-					IEEE80211_FC0_TYPE_MASK);
-				}
+#line 537 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_pf_reason((yyvsp[0].i)); }
+#line 2855 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 132:
-
-/* Line 1806 of yacc.c  */
-#line 532 "grammar.y"
-    { (yyval.rblk) = gen_p80211_type((yyvsp[(2) - (2)].i),
-					IEEE80211_FC0_TYPE_MASK |
-					IEEE80211_FC0_SUBTYPE_MASK);
-				}
+#line 538 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_pf_action((yyvsp[0].i)); }
+#line 2861 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 133:
+#line 542 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_p80211_type((yyvsp[-2].i) | (yyvsp[0].i),
+					IEEE80211_FC0_TYPE_MASK |
+					IEEE80211_FC0_SUBTYPE_MASK);
+				}
+#line 2870 "y.tab.c" /* yacc.c:1646  */
+    break;
 
-/* Line 1806 of yacc.c  */
-#line 536 "grammar.y"
-    { (yyval.rblk) = gen_p80211_fcdir((yyvsp[(2) - (2)].i)); }
+  case 134:
+#line 546 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_p80211_type((yyvsp[0].i),
+					IEEE80211_FC0_TYPE_MASK);
+				}
+#line 2878 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 135:
+#line 549 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_p80211_type((yyvsp[0].i),
+					IEEE80211_FC0_TYPE_MASK |
+					IEEE80211_FC0_SUBTYPE_MASK);
+				}
+#line 2887 "y.tab.c" /* yacc.c:1646  */
+    break;
 
-/* Line 1806 of yacc.c  */
-#line 540 "grammar.y"
-    { (yyval.i) = str2tok((yyvsp[(1) - (1)].s), ieee80211_types);
+  case 136:
+#line 553 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_p80211_fcdir((yyvsp[0].i)); }
+#line 2893 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 138:
+#line 557 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = str2tok((yyvsp[0].s), ieee80211_types);
 				  if ((yyval.i) == -1)
 				  	bpf_error("unknown 802.11 type name");
 				}
+#line 2902 "y.tab.c" /* yacc.c:1646  */
     break;
 
-  case 137:
-
-/* Line 1806 of yacc.c  */
-#line 547 "grammar.y"
+  case 140:
+#line 564 "grammar.y" /* yacc.c:1646  */
     { const struct tok *types = NULL;
 				  int i;
 				  for (i = 0;; i++) {
@@ -3209,16 +2917,15 @@
 					}
 				  }
 
-				  (yyval.i) = str2tok((yyvsp[(1) - (1)].s), types);
+				  (yyval.i) = str2tok((yyvsp[0].s), types);
 				  if ((yyval.i) == -1)
 					bpf_error("unknown 802.11 subtype name");
 				}
+#line 2925 "y.tab.c" /* yacc.c:1646  */
     break;
 
-  case 138:
-
-/* Line 1806 of yacc.c  */
-#line 567 "grammar.y"
+  case 141:
+#line 584 "grammar.y" /* yacc.c:1646  */
     { int i;
 				  for (i = 0;; i++) {
 				  	if (ieee80211_type_subtypes[i].tok == NULL) {
@@ -3226,498 +2933,474 @@
 						bpf_error("unknown 802.11 type name");
 						break;
 					}
-					(yyval.i) = str2tok((yyvsp[(1) - (1)].s), ieee80211_type_subtypes[i].tok);
+					(yyval.i) = str2tok((yyvsp[0].s), ieee80211_type_subtypes[i].tok);
 					if ((yyval.i) != -1) {
 						(yyval.i) |= ieee80211_type_subtypes[i].type;
 						break;
 					}
 				  }
 				}
+#line 2944 "y.tab.c" /* yacc.c:1646  */
     break;
 
-  case 140:
+  case 142:
+#line 600 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_llc(); }
+#line 2950 "y.tab.c" /* yacc.c:1646  */
+    break;
 
-/* Line 1806 of yacc.c  */
-#line 584 "grammar.y"
-    { if (pcap_strcasecmp((yyvsp[(1) - (1)].s), "nods") == 0)
+  case 143:
+#line 601 "grammar.y" /* yacc.c:1646  */
+    { if (pcap_strcasecmp((yyvsp[0].s), "i") == 0)
+					(yyval.rblk) = gen_llc_i();
+				  else if (pcap_strcasecmp((yyvsp[0].s), "s") == 0)
+					(yyval.rblk) = gen_llc_s();
+				  else if (pcap_strcasecmp((yyvsp[0].s), "u") == 0)
+					(yyval.rblk) = gen_llc_u();
+				  else {
+				  	u_int subtype;
+
+					subtype = str2tok((yyvsp[0].s), llc_s_subtypes);
+					if (subtype != -1)
+						(yyval.rblk) = gen_llc_s_subtype(subtype);
+					else {
+						subtype = str2tok((yyvsp[0].s), llc_u_subtypes);
+						if (subtype == -1)
+					  		bpf_error("unknown LLC type name \"%s\"", (yyvsp[0].s));
+						(yyval.rblk) = gen_llc_u_subtype(subtype);
+					}
+				  }
+				}
+#line 2975 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 144:
+#line 622 "grammar.y" /* yacc.c:1646  */
+    { (yyval.rblk) = gen_llc_s_subtype(LLC_RNR); }
+#line 2981 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 146:
+#line 626 "grammar.y" /* yacc.c:1646  */
+    { if (pcap_strcasecmp((yyvsp[0].s), "nods") == 0)
 					(yyval.i) = IEEE80211_FC1_DIR_NODS;
-				  else if (pcap_strcasecmp((yyvsp[(1) - (1)].s), "tods") == 0)
+				  else if (pcap_strcasecmp((yyvsp[0].s), "tods") == 0)
 					(yyval.i) = IEEE80211_FC1_DIR_TODS;
-				  else if (pcap_strcasecmp((yyvsp[(1) - (1)].s), "fromds") == 0)
+				  else if (pcap_strcasecmp((yyvsp[0].s), "fromds") == 0)
 					(yyval.i) = IEEE80211_FC1_DIR_FROMDS;
-				  else if (pcap_strcasecmp((yyvsp[(1) - (1)].s), "dstods") == 0)
+				  else if (pcap_strcasecmp((yyvsp[0].s), "dstods") == 0)
 					(yyval.i) = IEEE80211_FC1_DIR_DSTODS;
 				  else
 					bpf_error("unknown 802.11 direction");
 				}
-    break;
-
-  case 141:
-
-/* Line 1806 of yacc.c  */
-#line 597 "grammar.y"
-    { (yyval.i) = (yyvsp[(1) - (1)].i); }
-    break;
-
-  case 142:
-
-/* Line 1806 of yacc.c  */
-#line 598 "grammar.y"
-    { (yyval.i) = pfreason_to_num((yyvsp[(1) - (1)].s)); }
-    break;
-
-  case 143:
-
-/* Line 1806 of yacc.c  */
-#line 601 "grammar.y"
-    { (yyval.i) = pfaction_to_num((yyvsp[(1) - (1)].s)); }
-    break;
-
-  case 144:
-
-/* Line 1806 of yacc.c  */
-#line 604 "grammar.y"
-    { (yyval.i) = BPF_JGT; }
-    break;
-
-  case 145:
-
-/* Line 1806 of yacc.c  */
-#line 605 "grammar.y"
-    { (yyval.i) = BPF_JGE; }
-    break;
-
-  case 146:
-
-/* Line 1806 of yacc.c  */
-#line 606 "grammar.y"
-    { (yyval.i) = BPF_JEQ; }
+#line 2997 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 147:
-
-/* Line 1806 of yacc.c  */
-#line 608 "grammar.y"
-    { (yyval.i) = BPF_JGT; }
+#line 639 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = (yyvsp[0].i); }
+#line 3003 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 148:
-
-/* Line 1806 of yacc.c  */
-#line 609 "grammar.y"
-    { (yyval.i) = BPF_JGE; }
+#line 640 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = pfreason_to_num((yyvsp[0].s)); }
+#line 3009 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 149:
-
-/* Line 1806 of yacc.c  */
-#line 610 "grammar.y"
-    { (yyval.i) = BPF_JEQ; }
+#line 643 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = pfaction_to_num((yyvsp[0].s)); }
+#line 3015 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 150:
+#line 646 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = BPF_JGT; }
+#line 3021 "y.tab.c" /* yacc.c:1646  */
+    break;
 
-/* Line 1806 of yacc.c  */
-#line 612 "grammar.y"
-    { (yyval.a) = gen_loadi((yyvsp[(1) - (1)].i)); }
+  case 151:
+#line 647 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = BPF_JGE; }
+#line 3027 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 152:
-
-/* Line 1806 of yacc.c  */
-#line 615 "grammar.y"
-    { (yyval.a) = gen_load((yyvsp[(1) - (4)].i), (yyvsp[(3) - (4)].a), 1); }
+#line 648 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = BPF_JEQ; }
+#line 3033 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 153:
-
-/* Line 1806 of yacc.c  */
-#line 616 "grammar.y"
-    { (yyval.a) = gen_load((yyvsp[(1) - (6)].i), (yyvsp[(3) - (6)].a), (yyvsp[(5) - (6)].i)); }
+#line 650 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = BPF_JGT; }
+#line 3039 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 154:
-
-/* Line 1806 of yacc.c  */
-#line 617 "grammar.y"
-    { (yyval.a) = gen_arth(BPF_ADD, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); }
+#line 651 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = BPF_JGE; }
+#line 3045 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 155:
-
-/* Line 1806 of yacc.c  */
-#line 618 "grammar.y"
-    { (yyval.a) = gen_arth(BPF_SUB, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); }
+#line 652 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = BPF_JEQ; }
+#line 3051 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 156:
-
-/* Line 1806 of yacc.c  */
-#line 619 "grammar.y"
-    { (yyval.a) = gen_arth(BPF_MUL, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); }
-    break;
-
-  case 157:
-
-/* Line 1806 of yacc.c  */
-#line 620 "grammar.y"
-    { (yyval.a) = gen_arth(BPF_DIV, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); }
+#line 654 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_loadi((yyvsp[0].i)); }
+#line 3057 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 158:
-
-/* Line 1806 of yacc.c  */
-#line 621 "grammar.y"
-    { (yyval.a) = gen_arth(BPF_AND, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); }
+#line 657 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_load((yyvsp[-3].i), (yyvsp[-1].a), 1); }
+#line 3063 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 159:
-
-/* Line 1806 of yacc.c  */
-#line 622 "grammar.y"
-    { (yyval.a) = gen_arth(BPF_OR, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); }
+#line 658 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_load((yyvsp[-5].i), (yyvsp[-3].a), (yyvsp[-1].i)); }
+#line 3069 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 160:
-
-/* Line 1806 of yacc.c  */
-#line 623 "grammar.y"
-    { (yyval.a) = gen_arth(BPF_LSH, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); }
+#line 659 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_arth(BPF_ADD, (yyvsp[-2].a), (yyvsp[0].a)); }
+#line 3075 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 161:
-
-/* Line 1806 of yacc.c  */
-#line 624 "grammar.y"
-    { (yyval.a) = gen_arth(BPF_RSH, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); }
+#line 660 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_arth(BPF_SUB, (yyvsp[-2].a), (yyvsp[0].a)); }
+#line 3081 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 162:
-
-/* Line 1806 of yacc.c  */
-#line 625 "grammar.y"
-    { (yyval.a) = gen_neg((yyvsp[(2) - (2)].a)); }
+#line 661 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_arth(BPF_MUL, (yyvsp[-2].a), (yyvsp[0].a)); }
+#line 3087 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 163:
-
-/* Line 1806 of yacc.c  */
-#line 626 "grammar.y"
-    { (yyval.a) = (yyvsp[(2) - (3)].a); }
+#line 662 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_arth(BPF_DIV, (yyvsp[-2].a), (yyvsp[0].a)); }
+#line 3093 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 164:
-
-/* Line 1806 of yacc.c  */
-#line 627 "grammar.y"
-    { (yyval.a) = gen_loadlen(); }
+#line 663 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_arth(BPF_MOD, (yyvsp[-2].a), (yyvsp[0].a)); }
+#line 3099 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 165:
-
-/* Line 1806 of yacc.c  */
-#line 629 "grammar.y"
-    { (yyval.i) = '&'; }
+#line 664 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_arth(BPF_AND, (yyvsp[-2].a), (yyvsp[0].a)); }
+#line 3105 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 166:
-
-/* Line 1806 of yacc.c  */
-#line 630 "grammar.y"
-    { (yyval.i) = '|'; }
+#line 665 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_arth(BPF_OR, (yyvsp[-2].a), (yyvsp[0].a)); }
+#line 3111 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 167:
-
-/* Line 1806 of yacc.c  */
-#line 631 "grammar.y"
-    { (yyval.i) = '<'; }
+#line 666 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_arth(BPF_XOR, (yyvsp[-2].a), (yyvsp[0].a)); }
+#line 3117 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 168:
-
-/* Line 1806 of yacc.c  */
-#line 632 "grammar.y"
-    { (yyval.i) = '>'; }
+#line 667 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_arth(BPF_LSH, (yyvsp[-2].a), (yyvsp[0].a)); }
+#line 3123 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 169:
+#line 668 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_arth(BPF_RSH, (yyvsp[-2].a), (yyvsp[0].a)); }
+#line 3129 "y.tab.c" /* yacc.c:1646  */
+    break;
 
-/* Line 1806 of yacc.c  */
-#line 633 "grammar.y"
-    { (yyval.i) = '='; }
+  case 170:
+#line 669 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_neg((yyvsp[0].a)); }
+#line 3135 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 171:
-
-/* Line 1806 of yacc.c  */
-#line 636 "grammar.y"
-    { (yyval.i) = (yyvsp[(2) - (3)].i); }
+#line 670 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = (yyvsp[-1].a); }
+#line 3141 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 172:
-
-/* Line 1806 of yacc.c  */
-#line 638 "grammar.y"
-    { (yyval.i) = A_LANE; }
+#line 671 "grammar.y" /* yacc.c:1646  */
+    { (yyval.a) = gen_loadlen(); }
+#line 3147 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 173:
-
-/* Line 1806 of yacc.c  */
-#line 639 "grammar.y"
-    { (yyval.i) = A_LLC; }
+#line 673 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = '&'; }
+#line 3153 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 174:
-
-/* Line 1806 of yacc.c  */
-#line 640 "grammar.y"
-    { (yyval.i) = A_METAC;	}
+#line 674 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = '|'; }
+#line 3159 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 175:
-
-/* Line 1806 of yacc.c  */
-#line 641 "grammar.y"
-    { (yyval.i) = A_BCC; }
+#line 675 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = '<'; }
+#line 3165 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 176:
-
-/* Line 1806 of yacc.c  */
-#line 642 "grammar.y"
-    { (yyval.i) = A_OAMF4EC; }
+#line 676 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = '>'; }
+#line 3171 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 177:
-
-/* Line 1806 of yacc.c  */
-#line 643 "grammar.y"
-    { (yyval.i) = A_OAMF4SC; }
-    break;
-
-  case 178:
-
-/* Line 1806 of yacc.c  */
-#line 644 "grammar.y"
-    { (yyval.i) = A_SC; }
+#line 677 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = '='; }
+#line 3177 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 179:
-
-/* Line 1806 of yacc.c  */
-#line 645 "grammar.y"
-    { (yyval.i) = A_ILMIC; }
+#line 680 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = (yyvsp[-1].i); }
+#line 3183 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 180:
-
-/* Line 1806 of yacc.c  */
-#line 647 "grammar.y"
-    { (yyval.i) = A_OAM; }
+#line 682 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = A_LANE; }
+#line 3189 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 181:
-
-/* Line 1806 of yacc.c  */
-#line 648 "grammar.y"
-    { (yyval.i) = A_OAMF4; }
+#line 683 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = A_METAC;	}
+#line 3195 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 182:
-
-/* Line 1806 of yacc.c  */
-#line 649 "grammar.y"
-    { (yyval.i) = A_CONNECTMSG; }
+#line 684 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = A_BCC; }
+#line 3201 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 183:
-
-/* Line 1806 of yacc.c  */
-#line 650 "grammar.y"
-    { (yyval.i) = A_METACONNECT; }
+#line 685 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = A_OAMF4EC; }
+#line 3207 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 184:
-
-/* Line 1806 of yacc.c  */
-#line 653 "grammar.y"
-    { (yyval.blk).atmfieldtype = A_VPI; }
+#line 686 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = A_OAMF4SC; }
+#line 3213 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 185:
+#line 687 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = A_SC; }
+#line 3219 "y.tab.c" /* yacc.c:1646  */
+    break;
 
-/* Line 1806 of yacc.c  */
-#line 654 "grammar.y"
-    { (yyval.blk).atmfieldtype = A_VCI; }
+  case 186:
+#line 688 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = A_ILMIC; }
+#line 3225 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 187:
-
-/* Line 1806 of yacc.c  */
-#line 657 "grammar.y"
-    { (yyval.blk).b = gen_atmfield_code((yyvsp[(0) - (2)].blk).atmfieldtype, (bpf_int32)(yyvsp[(2) - (2)].i), (bpf_u_int32)(yyvsp[(1) - (2)].i), 0); }
+#line 690 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = A_OAM; }
+#line 3231 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 188:
-
-/* Line 1806 of yacc.c  */
-#line 658 "grammar.y"
-    { (yyval.blk).b = gen_atmfield_code((yyvsp[(0) - (2)].blk).atmfieldtype, (bpf_int32)(yyvsp[(2) - (2)].i), (bpf_u_int32)(yyvsp[(1) - (2)].i), 1); }
+#line 691 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = A_OAMF4; }
+#line 3237 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 189:
-
-/* Line 1806 of yacc.c  */
-#line 659 "grammar.y"
-    { (yyval.blk).b = (yyvsp[(2) - (3)].blk).b; (yyval.blk).q = qerr; }
+#line 692 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = A_CONNECTMSG; }
+#line 3243 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 190:
+#line 693 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = A_METACONNECT; }
+#line 3249 "y.tab.c" /* yacc.c:1646  */
+    break;
 
-/* Line 1806 of yacc.c  */
-#line 661 "grammar.y"
-    {
-	(yyval.blk).atmfieldtype = (yyvsp[(0) - (1)].blk).atmfieldtype;
-	if ((yyval.blk).atmfieldtype == A_VPI ||
-	    (yyval.blk).atmfieldtype == A_VCI)
-		(yyval.blk).b = gen_atmfield_code((yyval.blk).atmfieldtype, (bpf_int32) (yyvsp[(1) - (1)].i), BPF_JEQ, 0);
-	}
+  case 191:
+#line 696 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).atmfieldtype = A_VPI; }
+#line 3255 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 192:
-
-/* Line 1806 of yacc.c  */
-#line 669 "grammar.y"
-    { gen_or((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); }
-    break;
-
-  case 193:
-
-/* Line 1806 of yacc.c  */
-#line 672 "grammar.y"
-    { (yyval.i) = M_FISU; }
+#line 697 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).atmfieldtype = A_VCI; }
+#line 3261 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 194:
-
-/* Line 1806 of yacc.c  */
-#line 673 "grammar.y"
-    { (yyval.i) = M_LSSU; }
+#line 700 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_atmfield_code((yyvsp[-2].blk).atmfieldtype, (bpf_int32)(yyvsp[0].i), (bpf_u_int32)(yyvsp[-1].i), 0); }
+#line 3267 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 195:
-
-/* Line 1806 of yacc.c  */
-#line 674 "grammar.y"
-    { (yyval.i) = M_MSU; }
+#line 701 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_atmfield_code((yyvsp[-2].blk).atmfieldtype, (bpf_int32)(yyvsp[0].i), (bpf_u_int32)(yyvsp[-1].i), 1); }
+#line 3273 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 196:
-
-/* Line 1806 of yacc.c  */
-#line 675 "grammar.y"
-    { (yyval.i) = MH_FISU; }
+#line 702 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = qerr; }
+#line 3279 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 197:
-
-/* Line 1806 of yacc.c  */
-#line 676 "grammar.y"
-    { (yyval.i) = MH_LSSU; }
-    break;
-
-  case 198:
-
-/* Line 1806 of yacc.c  */
-#line 677 "grammar.y"
-    { (yyval.i) = MH_MSU; }
+#line 704 "grammar.y" /* yacc.c:1646  */
+    {
+	(yyval.blk).atmfieldtype = (yyvsp[-1].blk).atmfieldtype;
+	if ((yyval.blk).atmfieldtype == A_VPI ||
+	    (yyval.blk).atmfieldtype == A_VCI)
+		(yyval.blk).b = gen_atmfield_code((yyval.blk).atmfieldtype, (bpf_int32) (yyvsp[0].i), BPF_JEQ, 0);
+	}
+#line 3290 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 199:
-
-/* Line 1806 of yacc.c  */
-#line 680 "grammar.y"
-    { (yyval.blk).mtp3fieldtype = M_SIO; }
+#line 712 "grammar.y" /* yacc.c:1646  */
+    { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
+#line 3296 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 200:
-
-/* Line 1806 of yacc.c  */
-#line 681 "grammar.y"
-    { (yyval.blk).mtp3fieldtype = M_OPC; }
+#line 715 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = M_FISU; }
+#line 3302 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 201:
-
-/* Line 1806 of yacc.c  */
-#line 682 "grammar.y"
-    { (yyval.blk).mtp3fieldtype = M_DPC; }
+#line 716 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = M_LSSU; }
+#line 3308 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 202:
-
-/* Line 1806 of yacc.c  */
-#line 683 "grammar.y"
-    { (yyval.blk).mtp3fieldtype = M_SLS; }
+#line 717 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = M_MSU; }
+#line 3314 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 203:
-
-/* Line 1806 of yacc.c  */
-#line 684 "grammar.y"
-    { (yyval.blk).mtp3fieldtype = MH_SIO; }
+#line 718 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = MH_FISU; }
+#line 3320 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 204:
-
-/* Line 1806 of yacc.c  */
-#line 685 "grammar.y"
-    { (yyval.blk).mtp3fieldtype = MH_OPC; }
+#line 719 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = MH_LSSU; }
+#line 3326 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 205:
-
-/* Line 1806 of yacc.c  */
-#line 686 "grammar.y"
-    { (yyval.blk).mtp3fieldtype = MH_DPC; }
+#line 720 "grammar.y" /* yacc.c:1646  */
+    { (yyval.i) = MH_MSU; }
+#line 3332 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 206:
+#line 723 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).mtp3fieldtype = M_SIO; }
+#line 3338 "y.tab.c" /* yacc.c:1646  */
+    break;
 
-/* Line 1806 of yacc.c  */
-#line 687 "grammar.y"
-    { (yyval.blk).mtp3fieldtype = MH_SLS; }
+  case 207:
+#line 724 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).mtp3fieldtype = M_OPC; }
+#line 3344 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 208:
-
-/* Line 1806 of yacc.c  */
-#line 690 "grammar.y"
-    { (yyval.blk).b = gen_mtp3field_code((yyvsp[(0) - (2)].blk).mtp3fieldtype, (u_int)(yyvsp[(2) - (2)].i), (u_int)(yyvsp[(1) - (2)].i), 0); }
+#line 725 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).mtp3fieldtype = M_DPC; }
+#line 3350 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 209:
-
-/* Line 1806 of yacc.c  */
-#line 691 "grammar.y"
-    { (yyval.blk).b = gen_mtp3field_code((yyvsp[(0) - (2)].blk).mtp3fieldtype, (u_int)(yyvsp[(2) - (2)].i), (u_int)(yyvsp[(1) - (2)].i), 1); }
+#line 726 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).mtp3fieldtype = M_SLS; }
+#line 3356 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 210:
-
-/* Line 1806 of yacc.c  */
-#line 692 "grammar.y"
-    { (yyval.blk).b = (yyvsp[(2) - (3)].blk).b; (yyval.blk).q = qerr; }
+#line 727 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).mtp3fieldtype = MH_SIO; }
+#line 3362 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 211:
+#line 728 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).mtp3fieldtype = MH_OPC; }
+#line 3368 "y.tab.c" /* yacc.c:1646  */
+    break;
 
-/* Line 1806 of yacc.c  */
-#line 694 "grammar.y"
+  case 212:
+#line 729 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).mtp3fieldtype = MH_DPC; }
+#line 3374 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 213:
+#line 730 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).mtp3fieldtype = MH_SLS; }
+#line 3380 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 215:
+#line 733 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_mtp3field_code((yyvsp[-2].blk).mtp3fieldtype, (u_int)(yyvsp[0].i), (u_int)(yyvsp[-1].i), 0); }
+#line 3386 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 216:
+#line 734 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = gen_mtp3field_code((yyvsp[-2].blk).mtp3fieldtype, (u_int)(yyvsp[0].i), (u_int)(yyvsp[-1].i), 1); }
+#line 3392 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 217:
+#line 735 "grammar.y" /* yacc.c:1646  */
+    { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = qerr; }
+#line 3398 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 218:
+#line 737 "grammar.y" /* yacc.c:1646  */
     {
-	(yyval.blk).mtp3fieldtype = (yyvsp[(0) - (1)].blk).mtp3fieldtype;
+	(yyval.blk).mtp3fieldtype = (yyvsp[-1].blk).mtp3fieldtype;
 	if ((yyval.blk).mtp3fieldtype == M_SIO ||
 	    (yyval.blk).mtp3fieldtype == M_OPC ||
 	    (yyval.blk).mtp3fieldtype == M_DPC ||
@@ -3726,21 +3409,19 @@
 	    (yyval.blk).mtp3fieldtype == MH_OPC ||
 	    (yyval.blk).mtp3fieldtype == MH_DPC ||
 	    (yyval.blk).mtp3fieldtype == MH_SLS)
-		(yyval.blk).b = gen_mtp3field_code((yyval.blk).mtp3fieldtype, (u_int) (yyvsp[(1) - (1)].i), BPF_JEQ, 0);
+		(yyval.blk).b = gen_mtp3field_code((yyval.blk).mtp3fieldtype, (u_int) (yyvsp[0].i), BPF_JEQ, 0);
 	}
+#line 3415 "y.tab.c" /* yacc.c:1646  */
     break;
 
-  case 213:
-
-/* Line 1806 of yacc.c  */
-#line 708 "grammar.y"
-    { gen_or((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); }
+  case 220:
+#line 751 "grammar.y" /* yacc.c:1646  */
+    { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
+#line 3421 "y.tab.c" /* yacc.c:1646  */
     break;
 
 
-
-/* Line 1806 of yacc.c  */
-#line 3744 "y.tab.c"
+#line 3425 "y.tab.c" /* yacc.c:1646  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -3762,7 +3443,7 @@
 
   *++yyvsp = yyval;
 
-  /* Now `shift' the result of the reduction.  Determine what state
+  /* Now 'shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
 
@@ -3777,9 +3458,9 @@
   goto yynewstate;
 
 
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| yyerrlab -- here on detecting error.  |
+`--------------------------------------*/
 yyerrlab:
   /* Make sure we have latest lookahead translation.  See comments at
      user semantic actions for why this is necessary.  */
@@ -3830,20 +3511,20 @@
   if (yyerrstatus == 3)
     {
       /* If just tried and failed to reuse lookahead token after an
-	 error, discard it.  */
+         error, discard it.  */
 
       if (yychar <= YYEOF)
-	{
-	  /* Return failure if at end of input.  */
-	  if (yychar == YYEOF)
-	    YYABORT;
-	}
+        {
+          /* Return failure if at end of input.  */
+          if (yychar == YYEOF)
+            YYABORT;
+        }
       else
-	{
-	  yydestruct ("Error: discarding",
-		      yytoken, &yylval);
-	  yychar = YYEMPTY;
-	}
+        {
+          yydestruct ("Error: discarding",
+                      yytoken, &yylval);
+          yychar = YYEMPTY;
+        }
     }
 
   /* Else will try to reuse lookahead token after shifting the error
@@ -3862,7 +3543,7 @@
   if (/*CONSTCOND*/ 0)
      goto yyerrorlab;
 
-  /* Do not reclaim the symbols of the rule which action triggered
+  /* Do not reclaim the symbols of the rule whose action triggered
      this YYERROR.  */
   YYPOPSTACK (yylen);
   yylen = 0;
@@ -3875,35 +3556,37 @@
 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
 `-------------------------------------------------------------*/
 yyerrlab1:
-  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
+  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
   for (;;)
     {
       yyn = yypact[yystate];
       if (!yypact_value_is_default (yyn))
-	{
-	  yyn += YYTERROR;
-	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
-	    {
-	      yyn = yytable[yyn];
-	      if (0 < yyn)
-		break;
-	    }
-	}
+        {
+          yyn += YYTERROR;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+            {
+              yyn = yytable[yyn];
+              if (0 < yyn)
+                break;
+            }
+        }
 
       /* Pop the current state because it cannot handle the error token.  */
       if (yyssp == yyss)
-	YYABORT;
+        YYABORT;
 
 
       yydestruct ("Error: popping",
-		  yystos[yystate], yyvsp);
+                  yystos[yystate], yyvsp);
       YYPOPSTACK (1);
       yystate = *yyssp;
       YY_STACK_PRINT (yyss, yyssp);
     }
 
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
 
   /* Shift the error token.  */
@@ -3927,7 +3610,7 @@
   yyresult = 1;
   goto yyreturn;
 
-#if !defined(yyoverflow) || YYERROR_VERBOSE
+#if !defined yyoverflow || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
@@ -3946,14 +3629,14 @@
       yydestruct ("Cleanup: discarding lookahead",
                   yytoken, &yylval);
     }
-  /* Do not reclaim the symbols of the rule which action triggered
+  /* Do not reclaim the symbols of the rule whose action triggered
      this YYABORT or YYACCEPT.  */
   YYPOPSTACK (yylen);
   YY_STACK_PRINT (yyss, yyssp);
   while (yyssp != yyss)
     {
       yydestruct ("Cleanup: popping",
-		  yystos[*yyssp], yyvsp);
+                  yystos[*yyssp], yyvsp);
       YYPOPSTACK (1);
     }
 #ifndef yyoverflow
@@ -3964,13 +3647,7 @@
   if (yymsg != yymsgbuf)
     YYSTACK_FREE (yymsg);
 #endif
-  /* Make sure YYID is used.  */
-  return YYID (yyresult);
+  return yyresult;
 }
-
-
-
-/* Line 2067 of yacc.c  */
-#line 710 "grammar.y"
-
+#line 753 "grammar.y" /* yacc.c:1906  */
 
diff --git a/grammar.y b/grammar.y
index e9cc6e6..995a514 100644
--- a/grammar.y
+++ b/grammar.y
@@ -20,10 +20,6 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.101 2007-11-18 02:03:52 guy Exp $ (LBL)";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -58,6 +54,7 @@
 #include <net/pfvar.h>
 #include <net/if_pflog.h>
 #endif
+#include "llc.h"
 #include "ieee80211.h"
 #include <pcap/namedb.h>
 
@@ -132,6 +129,23 @@
 	{ IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL, "qos-cf-ack-poll" },
 	{ 0, NULL }
 };
+static const struct tok llc_s_subtypes[] = {
+	{ LLC_RR, "rr" },
+	{ LLC_RNR, "rnr" },
+	{ LLC_REJ, "rej" },
+	{ 0, NULL }
+};
+static const struct tok llc_u_subtypes[] = {
+	{ LLC_UI, "ui" },
+	{ LLC_UA, "ua" },
+	{ LLC_DISC, "disc" },
+	{ LLC_DM, "dm" },
+	{ LLC_SABME, "sabme" },
+	{ LLC_TEST, "test" },
+	{ LLC_XID, "xid" },
+	{ LLC_FRMR, "frmr" },
+	{ 0, NULL }
+};
 struct type2tok {
 	int type;
 	const struct tok *tok;
@@ -261,7 +275,7 @@
 %type	<a>	arth narth
 %type	<i>	byteop pname pnum relop irelop
 %type	<blk>	and or paren not null prog
-%type	<rblk>	other pfvar p80211
+%type	<rblk>	other pfvar p80211 pllc
 %type	<i>	atmtype atmmultitype
 %type	<blk>	atmfield
 %type	<blk>	atmfieldvalue atmvalue atmlistvalue
@@ -285,8 +299,8 @@
 %token  LEN
 %token  IPV6 ICMPV6 AH ESP
 %token	VLAN MPLS
-%token	PPPOED PPPOES
-%token  ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP 
+%token	PPPOED PPPOES GENEVE
+%token  ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP
 %token  STP
 %token  IPX
 %token  NETBEUI
@@ -296,7 +310,7 @@
 %token	RADIO
 %token	FISU LSSU MSU HFISU HLSSU HMSU
 %token	SIO OPC DPC SLS HSIO HOPC HDPC HSLS
- 
+
 
 %type	<s> ID
 %type	<e> EID
@@ -372,7 +386,7 @@
 					"in this configuration");
 #endif /*INET6*/
 				}
-	| EID			{ 
+	| EID			{
 				  $$.b = gen_ecode($1, $$.q = $<blk>0.q);
 				  /*
 				   * $1 was allocated by "pcap_ether_aton()",
@@ -509,8 +523,11 @@
 	| PPPOED		{ $$ = gen_pppoed(); }
 	| PPPOES pnum		{ $$ = gen_pppoes($2); }
 	| PPPOES		{ $$ = gen_pppoes(-1); }
+	| GENEVE pnum		{ $$ = gen_geneve($2); }
+	| GENEVE		{ $$ = gen_geneve(-1); }
 	| pfvar			{ $$ = $1; }
 	| pqual p80211		{ $$ = $2; }
+	| pllc			{ $$ = $1; }
 	;
 
 pfvar:	  PF_IFNAME ID		{ $$ = gen_pf_ifname($2); }
@@ -580,6 +597,31 @@
 				}
 		;
 
+pllc:	LLC			{ $$ = gen_llc(); }
+	| LLC ID		{ if (pcap_strcasecmp($2, "i") == 0)
+					$$ = gen_llc_i();
+				  else if (pcap_strcasecmp($2, "s") == 0)
+					$$ = gen_llc_s();
+				  else if (pcap_strcasecmp($2, "u") == 0)
+					$$ = gen_llc_u();
+				  else {
+				  	u_int subtype;
+
+					subtype = str2tok($2, llc_s_subtypes);
+					if (subtype != -1)
+						$$ = gen_llc_s_subtype(subtype);
+					else {
+						subtype = str2tok($2, llc_u_subtypes);
+						if (subtype == -1)
+					  		bpf_error("unknown LLC type name \"%s\"", $2);
+						$$ = gen_llc_u_subtype(subtype);
+					}
+				  }
+				}
+				/* sigh, "rnr" is already a keyword for PF */
+	| LLC PF_RNR		{ $$ = gen_llc_s_subtype(LLC_RNR); }
+	;
+
 dir:	  NUM
 	| ID			{ if (pcap_strcasecmp($1, "nods") == 0)
 					$$ = IEEE80211_FC1_DIR_NODS;
@@ -618,8 +660,10 @@
 	| arth '-' arth			{ $$ = gen_arth(BPF_SUB, $1, $3); }
 	| arth '*' arth			{ $$ = gen_arth(BPF_MUL, $1, $3); }
 	| arth '/' arth			{ $$ = gen_arth(BPF_DIV, $1, $3); }
+	| arth '%' arth			{ $$ = gen_arth(BPF_MOD, $1, $3); }
 	| arth '&' arth			{ $$ = gen_arth(BPF_AND, $1, $3); }
 	| arth '|' arth			{ $$ = gen_arth(BPF_OR, $1, $3); }
+	| arth '^' arth			{ $$ = gen_arth(BPF_XOR, $1, $3); }
 	| arth LSH arth			{ $$ = gen_arth(BPF_LSH, $1, $3); }
 	| arth RSH arth			{ $$ = gen_arth(BPF_RSH, $1, $3); }
 	| '-' arth %prec UMINUS		{ $$ = gen_neg($2); }
@@ -636,7 +680,6 @@
 	| paren pnum ')'	{ $$ = $2; }
 	;
 atmtype: LANE			{ $$ = A_LANE; }
-	| LLC			{ $$ = A_LLC; }
 	| METAC			{ $$ = A_METAC;	}
 	| BCC			{ $$ = A_BCC; }
 	| OAMF4EC		{ $$ = A_OAMF4EC; }
diff --git a/inet.c b/inet.c
index 6ae46ef..e7d2104 100644
--- a/inet.c
+++ b/inet.c
@@ -32,11 +32,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.79 2008-04-20 18:19:02 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -90,6 +85,18 @@
     (isdigit((unsigned char)((name)[2])) || (name)[2] == '\0'))
 #endif
 
+#ifdef IFF_UP
+#define ISUP(flags) ((flags) & IFF_UP)
+#else
+#define ISUP(flags) 0
+#endif
+
+#ifdef IFF_RUNNING
+#define ISRUNNING(flags) ((flags) & IFF_RUNNING)
+#else
+#define ISRUNNING(flags) 0
+#endif
+
 struct sockaddr *
 dup_sockaddr(struct sockaddr *sa, size_t sa_length)
 {
@@ -100,40 +107,85 @@
 	return (memcpy(newsa, sa, sa_length));
 }
 
-static int
-get_instance(const char *name)
+/*
+ * Construct a "figure of merit" for an interface, for use when sorting
+ * the list of interfaces, in which interfaces that are up are superior
+ * to interfaces that aren't up, interfaces that are up and running are
+ * superior to interfaces that are up but not running, and non-loopback
+ * interfaces that are up and running are superior to loopback interfaces,
+ * and interfaces with the same flags have a figure of merit that's higher
+ * the lower the instance number.
+ *
+ * The goal is to try to put the interfaces most likely to be useful for
+ * capture at the beginning of the list.
+ *
+ * The figure of merit, which is lower the "better" the interface is,
+ * has the uppermost bit set if the interface isn't running, the bit
+ * below that set if the interface isn't up, the bit below that set
+ * if the interface is a loopback interface, and the interface index
+ * in the 29 bits below that.  (Yes, we assume u_int is 32 bits.)
+ */
+static u_int
+get_figure_of_merit(pcap_if_t *dev)
 {
-	const char *cp, *endcp;
-	int n;
+	const char *cp;
+	u_int n;
 
-	if (strcmp(name, "any") == 0) {
+	if (strcmp(dev->name, "any") == 0) {
 		/*
 		 * Give the "any" device an artificially high instance
 		 * number, so it shows up after all other non-loopback
 		 * interfaces.
 		 */
-		return INT_MAX;
+		n = 0x1FFFFFFF;	/* 29 all-1 bits */
+	} else {
+		/*
+		 * A number at the end of the device name string is
+		 * assumed to be a unit number.
+		 */
+		cp = dev->name + strlen(dev->name) - 1;
+		while (cp-1 >= dev->name && *(cp-1) >= '0' && *(cp-1) <= '9')
+			cp--;
+		if (*cp >= '0' && *cp <= '9')
+			n = atoi(cp);
+		else
+			n = 0;
 	}
-
-	endcp = name + strlen(name);
-	for (cp = name; cp < endcp && !isdigit((unsigned char)*cp); ++cp)
-		continue;
-
-	if (isdigit((unsigned char)*cp))
-		n = atoi(cp);
-	else
-		n = 0;
+	if (!(dev->flags & PCAP_IF_RUNNING))
+		n |= 0x80000000;
+	if (!(dev->flags & PCAP_IF_UP))
+		n |= 0x40000000;
+	if (dev->flags & PCAP_IF_LOOPBACK)
+		n |= 0x20000000;
 	return (n);
 }
 
+/*
+ * Look for a given device in the specified list of devices.
+ *
+ * If we find it, return 0 and set *curdev_ret to point to it.
+ *
+ * If we don't find it, check whether we can open it:
+ *
+ *     If that fails with PCAP_ERROR_NO_SUCH_DEVICE or
+ *     PCAP_ERROR_IFACE_NOT_UP, don't attempt to add an entry for
+ *     it, as that probably means it exists but doesn't support
+ *     packet capture.
+ *
+ *     Otherwise, attempt to add an entry for it, with the specified
+ *     ifnet flags and description, and, if that succeeds, return 0
+ *     and set *curdev_ret to point to the new entry, otherwise
+ *     return PCAP_ERROR and set errbuf to an error message.
+ */
 int
 add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name,
     u_int flags, const char *description, char *errbuf)
 {
 	pcap_t *p;
 	pcap_if_t *curdev, *prevdev, *nextdev;
-	int this_instance;
+	u_int this_figure_of_merit, nextdev_figure_of_merit;
 	char open_errbuf[PCAP_ERRBUF_SIZE];
+	int ret;
 
 	/*
 	 * Is there already an entry in the list for this interface?
@@ -193,23 +245,72 @@
 			}
 			strcpy(en_name, "en");
 			strcat(en_name, name + 3);
-			p = pcap_open_live(en_name, 68, 0, 0, open_errbuf);
+			p = pcap_create(en_name, open_errbuf);
 			free(en_name);
 		} else
 #endif /* __APPLE */
-		p = pcap_open_live(name, 68, 0, 0, open_errbuf);
+		p = pcap_create(name, open_errbuf);
 		if (p == NULL) {
 			/*
-			 * No.  Don't bother including it.
-			 * Don't treat this as an error, though.
+			 * The attempt to create the pcap_t failed;
+			 * that's probably an indication that we're
+			 * out of memory.
+			 *
+			 * Don't bother including this interface,
+			 * but don't treat it as an error.
 			 */
 			*curdev_ret = NULL;
 			return (0);
 		}
+		/* Small snaplen, so we don't try to allocate much memory. */
+		pcap_set_snaplen(p, 68);
+		ret = pcap_activate(p);
 		pcap_close(p);
+		switch (ret) {
+
+		case PCAP_ERROR_NO_SUCH_DEVICE:
+		case PCAP_ERROR_IFACE_NOT_UP:
+			/*
+			 * We expect these two errors - they're the
+			 * reason we try to open the device.
+			 *
+			 * PCAP_ERROR_NO_SUCH_DEVICE typically means
+			 * "there's no such device *known to the
+			 * OS's capture mechanism*", so, even though
+			 * it might be a valid network interface, you
+			 * can't capture on it (e.g., the loopback
+			 * device in Solaris up to Solaris 10, or
+			 * the vmnet devices in OS X with VMware
+			 * Fusion).  We don't include those devices
+			 * in our list of devices, as there's no
+			 * point in doing so - they're not available
+			 * for capture.
+			 *
+			 * PCAP_ERROR_IFACE_NOT_UP means that the
+			 * OS's capture mechanism doesn't work on
+			 * interfaces not marked as up; some capture
+			 * mechanisms *do* support that, so we no
+			 * longer reject those interfaces out of hand,
+			 * but we *do* want to reject them if they
+			 * can't be opened for capture.
+			 */
+			*curdev_ret = NULL;
+			return (0);
+		}
 
 		/*
-		 * Yes, we can open it.
+		 * Yes, we can open it, or we can't, for some other
+		 * reason.
+		 *
+		 * If we can open it, we want to offer it for
+		 * capture, as you can capture on it.  If we can't,
+		 * we want to offer it for capture, so that, if
+		 * the user tries to capture on it, they'll get
+		 * an error and they'll know why they can't
+		 * capture on it (e.g., insufficient permissions)
+		 * or they'll report it as a problem (and then
+		 * have the error message to provide as information).
+		 *
 		 * Allocate a new entry.
 		 */
 		curdev = malloc(sizeof(pcap_if_t));
@@ -252,20 +353,22 @@
 		curdev->flags = 0;
 		if (ISLOOPBACK(name, flags))
 			curdev->flags |= PCAP_IF_LOOPBACK;
+		if (ISUP(flags))
+			curdev->flags |= PCAP_IF_UP;
+		if (ISRUNNING(flags))
+			curdev->flags |= PCAP_IF_RUNNING;
 
 		/*
 		 * Add it to the list, in the appropriate location.
-		 * First, get the instance number of this interface.
+		 * First, get the "figure of merit" for this
+		 * interface.
 		 */
-		this_instance = get_instance(name);
+		this_figure_of_merit = get_figure_of_merit(curdev);
 
 		/*
-		 * Now look for the last interface with an instance number
-		 * less than or equal to the new interface's instance
-		 * number - except that non-loopback interfaces are
-		 * arbitrarily treated as having interface numbers less
-		 * than those of loopback interfaces, so the loopback
-		 * interfaces are put at the end of the list.
+		 * Now look for the last interface with an figure of merit
+		 * less than or equal to the new interface's figure of
+		 * merit.
 		 *
 		 * We start with "prevdev" being NULL, meaning we're before
 		 * the first element in the list.
@@ -295,34 +398,13 @@
 			}
 
 			/*
-			 * Is the new interface a non-loopback interface
-			 * and the next interface a loopback interface?
+			 * Is the new interface's figure of merit less
+			 * than the next interface's figure of merit,
+			 * meaning that the new interface is better
+			 * than the next interface?
 			 */
-			if (!(curdev->flags & PCAP_IF_LOOPBACK) &&
-			    (nextdev->flags & PCAP_IF_LOOPBACK)) {
-				/*
-				 * Yes, we should put the new entry
-				 * before "nextdev", i.e. after "prevdev".
-				 */
-				break;
-			}
-
-			/*
-			 * Is the new interface's instance number less
-			 * than the next interface's instance number,
-			 * and is it the case that the new interface is a
-			 * non-loopback interface or the next interface is
-			 * a loopback interface?
-			 *
-			 * (The goal of both loopback tests is to make
-			 * sure that we never put a loopback interface
-			 * before any non-loopback interface and that we
-			 * always put a non-loopback interface before all
-			 * loopback interfaces.)
-			 */
-			if (this_instance < get_instance(nextdev->name) &&
-			    (!(curdev->flags & PCAP_IF_LOOPBACK) ||
-			       (nextdev->flags & PCAP_IF_LOOPBACK))) {
+			nextdev_figure_of_merit = get_figure_of_merit(nextdev);
+			if (this_figure_of_merit < nextdev_figure_of_merit) {
 				/*
 				 * Yes - we should put the new entry
 				 * before "nextdev", i.e. after "prevdev".
@@ -358,6 +440,9 @@
 }
 
 /*
+ * Try to get a description for a given device.
+ * Returns a mallocated description if it could and NULL if it couldn't.
+ *
  * XXX - on FreeBSDs that support it, should it get the sysctl named
  * "dev.{adapter family name}.{adapter unit}.%desc" to get a description
  * of the adapter?  Note that "dev.an.0.%desc" is "Aironet PC4500/PC4800"
@@ -403,18 +488,11 @@
  * Do any other UN*Xes, or desktop environments support getting a
  * description?
  */
-int
-add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags,
-    struct sockaddr *addr, size_t addr_size,
-    struct sockaddr *netmask, size_t netmask_size,
-    struct sockaddr *broadaddr, size_t broadaddr_size,
-    struct sockaddr *dstaddr, size_t dstaddr_size,
-    char *errbuf)
+static char *
+get_if_description(const char *name)
 {
-	pcap_if_t *curdev;
-	char *description = NULL;
-	pcap_addr_t *curaddr, *prevaddr, *nextaddr;
 #ifdef SIOCGIFDESCR
+	char *description = NULL;
 	int s;
 	struct ifreq ifrdesc;
 #ifndef IFDESCRSIZE
@@ -422,9 +500,7 @@
 #else
 	size_t descrlen = IFDESCRSIZE;
 #endif /* IFDESCRSIZE */
-#endif /* SIOCGIFDESCR */
 
-#ifdef SIOCGIFDESCR
 	/*
 	 * Get the description for the interface.
 	 */
@@ -485,8 +561,53 @@
 			description = NULL;
 		}
 	}
-#endif /* SIOCGIFDESCR */
 
+	return (description);
+#else /* SIOCGIFDESCR */
+	return (NULL);
+#endif /* SIOCGIFDESCR */
+}
+
+/*
+ * Try to get a description for a given device, and then look for that
+ * device in the specified list of devices.
+ *
+ * If we find it, then, if the specified address isn't null, add it to
+ * the list of addresses for the device and return 0.
+ *
+ * If we don't find it, check whether we can open it:
+ *
+ *     If that fails with PCAP_ERROR_NO_SUCH_DEVICE or
+ *     PCAP_ERROR_IFACE_NOT_UP, don't attempt to add an entry for
+ *     it, as that probably means it exists but doesn't support
+ *     packet capture.
+ *
+ *     Otherwise, attempt to add an entry for it, with the specified
+ *     ifnet flags and description, and, if that succeeds, add the
+ *     specified address to its list of addresses if that address is
+ *     non-null, set *curdev_ret to point to the new entry, and
+ *     return 0, otherwise return PCAP_ERROR and set errbuf to an
+ *     error message.
+ *
+ * (We can get called with a null address because we might get a list
+ * of interface name/address combinations from the underlying OS, with
+ * the address being absent in some cases, rather than a list of
+ * interfaces with each interface having a list of addresses, so this
+ * call may be the only call made to add to the list, and we want to
+ * add interfaces even if they have no addresses.)
+ */
+int
+add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags,
+    struct sockaddr *addr, size_t addr_size,
+    struct sockaddr *netmask, size_t netmask_size,
+    struct sockaddr *broadaddr, size_t broadaddr_size,
+    struct sockaddr *dstaddr, size_t dstaddr_size,
+    char *errbuf)
+{
+	char *description;
+	pcap_if_t *curdev;
+
+	description = get_if_description(name);
 	if (add_or_find_if(&curdev, alldevs, name, flags, description,
 	    errbuf) == -1) {
 		free(description);
@@ -504,12 +625,42 @@
 		return (0);
 	}
 
+	if (addr == NULL) {
+		/*
+		 * There's no address to add; this entry just meant
+		 * "here's a new interface".
+		 */
+		return (0);
+	}
+
 	/*
-	 * "curdev" is an entry for this interface; add an entry for this
-	 * address to its list of addresses.
+	 * "curdev" is an entry for this interface, and we have an
+	 * address for it; add an entry for that address to the
+	 * interface's list of addresses.
 	 *
 	 * Allocate the new entry and fill it in.
 	 */
+	return (add_addr_to_dev(curdev, addr, addr_size, netmask,
+	    netmask_size, broadaddr, broadaddr_size, dstaddr,
+	    dstaddr_size, errbuf));
+}
+
+/*
+ * Add an entry to the list of addresses for an interface.
+ * "curdev" is the entry for that interface.
+ * If this is the first IP address added to the interface, move it
+ * in the list as appropriate.
+ */
+int
+add_addr_to_dev(pcap_if_t *curdev,
+    struct sockaddr *addr, size_t addr_size,
+    struct sockaddr *netmask, size_t netmask_size,
+    struct sockaddr *broadaddr, size_t broadaddr_size,
+    struct sockaddr *dstaddr, size_t dstaddr_size,
+    char *errbuf)
+{
+	pcap_addr_t *curaddr, *prevaddr, *nextaddr;
+
 	curaddr = malloc(sizeof(pcap_addr_t));
 	if (curaddr == NULL) {
 		(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
@@ -603,6 +754,23 @@
 	return (0);
 }
 
+/*
+ * Look for a given device in the specified list of devices.
+ *
+ * If we find it, return 0.
+ *
+ * If we don't find it, check whether we can open it:
+ *
+ *     If that fails with PCAP_ERROR_NO_SUCH_DEVICE or
+ *     PCAP_ERROR_IFACE_NOT_UP, don't attempt to add an entry for
+ *     it, as that probably means it exists but doesn't support
+ *     packet capture.
+ *
+ *     Otherwise, attempt to add an entry for it, with the specified
+ *     ifnet flags and description, and, if that succeeds, return 0
+ *     and set *curdev_ret to point to the new entry, otherwise
+ *     return PCAP_ERROR and set errbuf to an error message.
+ */
 int
 pcap_add_if(pcap_if_t **devlist, const char *name, u_int flags,
     const char *description, char *errbuf)
@@ -756,7 +924,7 @@
 	/* XXX Work around Linux kernel bug */
 	ifr.ifr_addr.sa_family = AF_INET;
 #endif
-	(void)strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+	(void)strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
 	if (ioctl(fd, SIOCGIFADDR, (char *)&ifr) < 0) {
 		if (errno == EADDRNOTAVAIL) {
 			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
@@ -776,7 +944,7 @@
 	/* XXX Work around Linux kernel bug */
 	ifr.ifr_addr.sa_family = AF_INET;
 #endif
-	(void)strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+	(void)strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
 	if (ioctl(fd, SIOCGIFNETMASK, (char *)&ifr) < 0) {
 		(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
 		    "SIOCGIFNETMASK: %s: %s", device, pcap_strerror(errno));
@@ -817,14 +985,14 @@
 	DWORD dwWindowsMajorVersion;
 	dwVersion = GetVersion();	/* get the OS version */
 	dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
-	
+
 	if (dwVersion >= 0x80000000 && dwWindowsMajorVersion >= 4) {
 		/*
 		 * Windows 95, 98, ME.
 		 */
 		ULONG NameLength = 8192;
 		static char AdaptersName[8192];
-		
+
 		if (PacketGetAdapterNames(AdaptersName,&NameLength) )
 			return (AdaptersName);
 		else
@@ -887,7 +1055,7 @@
 
 		free(TAdaptersName);
 		return (char *)(AdaptersName);
-	}	
+	}
 }
 
 
@@ -897,7 +1065,7 @@
 	register bpf_u_int32 *netp, *maskp;
 	register char *errbuf;
 {
-	/* 
+	/*
 	 * We need only the first IPv4 address, so we must scan the array returned by PacketGetNetInfo()
 	 * in order to skip non IPv4 (i.e. IPv6 addresses)
 	 */
@@ -923,7 +1091,7 @@
 			*netp &= *maskp;
 			return (0);
 		}
-				
+
 	}
 
 	*netp = *maskp = 0;
diff --git a/install-sh b/install-sh
index ebc6691..b44de09 100755
--- a/install-sh
+++ b/install-sh
@@ -115,7 +115,7 @@
 if [ x"$dir_arg" != x ]; then
 	dst=$src
 	src=""
-	
+
 	if [ -d $dst ]; then
 		instcmd=:
 	else
@@ -124,7 +124,7 @@
 else
 
 # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad 
+# might cause directories to be created, which would be especially bad
 # if $src (and thus $dsttmp) contains '*'.
 
 	if [ -f $src -o -d $src ]
@@ -134,7 +134,7 @@
 		echo "install:  $src does not exist"
 		exit 1
 	fi
-	
+
 	if [ x"$dst" = x ]
 	then
 		echo "install:	no destination specified"
@@ -201,17 +201,17 @@
 
 # If we're going to rename the final executable, determine the name now.
 
-	if [ x"$transformarg" = x ] 
+	if [ x"$transformarg" = x ]
 	then
 		dstfile=`basename $dst`
 	else
-		dstfile=`basename $dst $transformbasename | 
+		dstfile=`basename $dst $transformbasename |
 			sed $transformarg`$transformbasename
 	fi
 
 # don't allow the sed command to completely eliminate the filename
 
-	if [ x"$dstfile" = x ] 
+	if [ x"$dstfile" = x ]
 	then
 		dstfile=`basename $dst`
 	else
@@ -242,7 +242,7 @@
 # Now rename the file to the real destination.
 
 	$doit $rmcmd -f $dstdir/$dstfile &&
-	$doit $mvcmd $dsttmp $dstdir/$dstfile 
+	$doit $mvcmd $dsttmp $dstdir/$dstfile
 
 fi &&
 
diff --git a/lbl/os-aix4.h b/lbl/os-aix4.h
index c5dfce2..5cf4586 100644
--- a/lbl/os-aix4.h
+++ b/lbl/os-aix4.h
@@ -17,8 +17,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/lbl/os-aix4.h,v 1.1 2002-06-01 09:37:40 guy Exp $
  */
 
 /* Prototypes missing in AIX 4.x */
diff --git a/lbl/os-hpux11.h b/lbl/os-hpux11.h
index 5e325a9..42c6b60 100644
--- a/lbl/os-hpux11.h
+++ b/lbl/os-hpux11.h
@@ -17,8 +17,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/lbl/os-hpux11.h,v 1.1 2002-06-01 09:37:41 guy Exp $
  */
 
 /* Prototypes missing in HP-UX 11.x */
diff --git a/lbl/os-osf4.h b/lbl/os-osf4.h
index 60abcd9..f461eea 100644
--- a/lbl/os-osf4.h
+++ b/lbl/os-osf4.h
@@ -17,12 +17,10 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/lbl/os-osf4.h,v 1.2 2000-12-22 11:51:33 guy Exp $ (LBL)
  */
 
 /* Prototypes missing in Digital UNIX 4.x */
 int	snprintf(char *, size_t, const char *, ...);
 int	vsnprintf(char *, size_t, const char *, va_list);
 int	pfopen(char *, int);
-   
+
diff --git a/lbl/os-osf5.h b/lbl/os-osf5.h
index 1ebcac6..52ab175 100644
--- a/lbl/os-osf5.h
+++ b/lbl/os-osf5.h
@@ -17,8 +17,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/lbl/os-osf5.h,v 1.2 2002-08-02 03:24:15 guy Exp $ (LBL)
  */
 
 /*
@@ -29,4 +27,4 @@
 int	snprintf(char *, size_t, const char *, ...);
 int	vsnprintf(char *, size_t, const char *, va_list);
 int	pfopen(char *, int);
-   
+
diff --git a/lbl/os-solaris2.h b/lbl/os-solaris2.h
index fae2aa3..22948b4 100644
--- a/lbl/os-solaris2.h
+++ b/lbl/os-solaris2.h
@@ -17,8 +17,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/lbl/os-solaris2.h,v 1.19 2000-10-11 04:02:52 guy Exp $ (LBL)
  */
 
 /* Prototypes missing in SunOS 5 */
diff --git a/lbl/os-sunos4.h b/lbl/os-sunos4.h
index cfd4b04..b735857 100644
--- a/lbl/os-sunos4.h
+++ b/lbl/os-sunos4.h
@@ -17,8 +17,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/lbl/os-sunos4.h,v 1.32 1999-10-07 23:46:41 mcr Exp $ (LBL)
  */
 
 /* Prototypes missing in SunOS 4 */
diff --git a/lbl/os-ultrix4.h b/lbl/os-ultrix4.h
index 9f2a155..fa1f770 100644
--- a/lbl/os-ultrix4.h
+++ b/lbl/os-ultrix4.h
@@ -17,8 +17,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/lbl/os-ultrix4.h,v 1.19 1999-10-07 23:46:41 mcr Exp $ (LBL)
  */
 
 /* Prototypes missing in Ultrix 4 */
diff --git a/llc.h b/llc.h
index b8c221f..b0cf881 100644
--- a/llc.h
+++ b/llc.h
@@ -17,11 +17,40 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/llc.h,v 1.2 2001-01-28 09:44:50 guy Exp $ (LBL)
  */
 
 /*
+ * Definitions for information in the LLC header.
+ */
+
+#define	LLC_U_FMT	3
+#define	LLC_GSAP	1
+#define	LLC_IG	        1 /* Individual / Group */
+#define LLC_S_FMT	1
+
+#define	LLC_U_POLL	0x10
+#define	LLC_IS_POLL	0x0100
+#define	LLC_XID_FI	0x81
+
+#define LLC_U_CMD_MASK	0xef
+#define	LLC_UI		0x03
+#define	LLC_UA		0x63
+#define	LLC_DISC	0x43
+#define	LLC_DM		0x0f
+#define	LLC_SABME	0x6f
+#define	LLC_TEST	0xe3
+#define	LLC_XID		0xaf
+#define	LLC_FRMR	0x87
+
+#define LLC_S_CMD_MASK	0x0f
+#define	LLC_RR		0x0001
+#define	LLC_RNR		0x0005
+#define	LLC_REJ		0x0009
+
+#define LLC_IS_NR(is)	(((is) >> 9) & 0x7f)
+#define LLC_I_NS(is)	(((is) >> 1) & 0x7f)
+
+/*
  * 802.2 LLC SAP values.
  */
 
@@ -31,10 +60,10 @@
 #ifndef LLCSAP_GLOBAL
 #define	LLCSAP_GLOBAL		0xff
 #endif
-#ifndef LLCSAP_8021B
+#ifndef LLCSAP_8021B_I
 #define	LLCSAP_8021B_I		0x02
 #endif
-#ifndef LLCSAP_8021B
+#ifndef LLCSAP_8021B_G
 #define	LLCSAP_8021B_G		0x03
 #endif
 #ifndef LLCSAP_IP
diff --git a/missing/snprintf.c b/missing/snprintf.c
index 8991f24..9b63f8b 100644
--- a/missing/snprintf.c
+++ b/missing/snprintf.c
@@ -31,17 +31,10 @@
  * SUCH DAMAGE.
  */
 
-/* $Id: snprintf.c,v 1.1 2004-04-05 22:43:51 guy Exp $ */
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifndef lint
-static const char rcsid[] _U_ =
-     "@(#) $Header: /tcpdump/master/libpcap/missing/snprintf.c,v 1.1 2004-04-05 22:43:51 guy Exp $";
-#endif
-
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>
diff --git a/mkdep b/mkdep
index bfe4a26..1486b18 100755
--- a/mkdep
+++ b/mkdep
@@ -13,9 +13,6 @@
 #	@(#)mkdep.sh	5.11 (Berkeley) 5/5/88
 #
 
-PATH=/bin:/usr/bin:/usr/ucb:/usr/local:/usr/local/bin:/usr/sfw/bin
-export PATH
-
 MAKE=Makefile			# default makefile name is "Makefile"
 CC=cc				# default C compiler is "cc"
 DEPENDENCY_CFLAG=-M		# default dependency-generation flag is -M
diff --git a/msdos/common.dj b/msdos/common.dj
index 3f64d14..ec0ce02 100644
--- a/msdos/common.dj
+++ b/msdos/common.dj
@@ -1,7 +1,6 @@
 #
 # Common defines for libpcap and 16/32-bit network drivers (djgpp)
 #
-# @(#) $Header: /tcpdump/master/libpcap/msdos/common.dj,v 1.2 2004-12-19 19:36:33 guy Exp $ (LBL)
 
 .SUFFIXES: .exe .wlm .dxe .l .y
 .PHONY:    check_gcclib
diff --git a/msdos/makefile.dj b/msdos/makefile.dj
index 7ce58b4..ae20ada 100644
--- a/msdos/makefile.dj
+++ b/msdos/makefile.dj
@@ -6,7 +6,6 @@
 #
 #  c:\net\pcap> make -f msdos/makefile.dj
 #
-# @(#) $Header: /tcpdump/master/libpcap/msdos/makefile.dj,v 1.2 2004-12-19 19:41:06 guy Exp $ (LBL)
 
 VPATH = missing msdos
 
@@ -105,7 +104,7 @@
 
 #
 # Manually generated dependencies
-#             
+#
 msdos/pktdrvr.c: msdos/pkt_stub.inc
 scanner.c: scanner.l
 grammar.c tokdefs.h: grammar.y
diff --git a/msdos/readme.dos b/msdos/readme.dos
index 02ef1f7..353d0cc 100644
--- a/msdos/readme.dos
+++ b/msdos/readme.dos
@@ -1,5 +1,3 @@
-@(#) $Header: /tcpdump/master/libpcap/msdos/readme.dos,v 1.3 2004-12-19 19:47:01 guy Exp $ (LBL)
-
 libpcap for DOS
 ---------------
 
@@ -134,7 +132,7 @@
 
 I've included some extra functions to DOS-libpcap:
 
-  `pcap_config_hook (const char *name, const char *value)' 
+  `pcap_config_hook (const char *name, const char *value)'
 
     Allows an application to set values of internal libpcap variables.
     `name' is typically a left-side keyword with an associated `value'
diff --git a/nametoaddr.c b/nametoaddr.c
index 55439f7..e6483a3 100644
--- a/nametoaddr.c
+++ b/nametoaddr.c
@@ -22,11 +22,6 @@
  * These functions are not time critical.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.83 2008-02-06 10:21:30 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
diff --git a/nlpid.h b/nlpid.h
index 5327a36..9dfa752 100644
--- a/nlpid.h
+++ b/nlpid.h
@@ -14,8 +14,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/nlpid.h,v 1.2 2002-12-06 00:01:34 hannes Exp $ (Juniper)
  */
 
 /* Types missing from some systems */
diff --git a/optimize.c b/optimize.c
index 8215543..ada2019 100644
--- a/optimize.c
+++ b/optimize.c
@@ -20,10 +20,6 @@
  *
  *  Optimization module for tcpdump intermediate representation.
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/optimize.c,v 1.91 2008-01-02 04:16:46 guy Exp $ (LBL)";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -610,6 +606,12 @@
 		a /= b;
 		break;
 
+	case BPF_MOD:
+		if (b == 0)
+			bpf_error("modulus by zero");
+		a %= b;
+		break;
+
 	case BPF_AND:
 		a &= b;
 		break;
@@ -618,6 +620,10 @@
 		a |= b;
 		break;
 
+	case BPF_XOR:
+		a ^= b;
+		break;
+
 	case BPF_LSH:
 		a <<= b;
 		break;
@@ -978,8 +984,10 @@
 	case BPF_ALU|BPF_SUB|BPF_K:
 	case BPF_ALU|BPF_MUL|BPF_K:
 	case BPF_ALU|BPF_DIV|BPF_K:
+	case BPF_ALU|BPF_MOD|BPF_K:
 	case BPF_ALU|BPF_AND|BPF_K:
 	case BPF_ALU|BPF_OR|BPF_K:
+	case BPF_ALU|BPF_XOR|BPF_K:
 	case BPF_ALU|BPF_LSH|BPF_K:
 	case BPF_ALU|BPF_RSH|BPF_K:
 		op = BPF_OP(s->code);
@@ -990,7 +998,7 @@
 				 * fixup the generated math code */
 				if (op == BPF_ADD ||
 				    op == BPF_LSH || op == BPF_RSH ||
-				    op == BPF_OR) {
+				    op == BPF_OR || op == BPF_XOR) {
 					s->code = NOP;
 					break;
 				}
@@ -1013,8 +1021,10 @@
 	case BPF_ALU|BPF_SUB|BPF_X:
 	case BPF_ALU|BPF_MUL|BPF_X:
 	case BPF_ALU|BPF_DIV|BPF_X:
+	case BPF_ALU|BPF_MOD|BPF_X:
 	case BPF_ALU|BPF_AND|BPF_X:
 	case BPF_ALU|BPF_OR|BPF_X:
+	case BPF_ALU|BPF_XOR|BPF_X:
 	case BPF_ALU|BPF_LSH|BPF_X:
 	case BPF_ALU|BPF_RSH|BPF_X:
 		op = BPF_OP(s->code);
@@ -1041,12 +1051,12 @@
 		 */
 		if (alter && vmap[val[A_ATOM]].is_const
 		    && vmap[val[A_ATOM]].const_val == 0) {
-			if (op == BPF_ADD || op == BPF_OR) {
+			if (op == BPF_ADD || op == BPF_OR || op == BPF_XOR) {
 				s->code = BPF_MISC|BPF_TXA;
 				vstore(s, &val[A_ATOM], val[X_ATOM], alter);
 				break;
 			}
-			else if (op == BPF_MUL || op == BPF_DIV ||
+			else if (op == BPF_MUL || op == BPF_DIV || op == BPF_MOD ||
 				 op == BPF_AND || op == BPF_LSH || op == BPF_RSH) {
 				s->code = BPF_LD|BPF_IMM;
 				s->k = 0;
@@ -2234,7 +2244,92 @@
 
 #ifdef BDEBUG
 static void
-opt_dump(struct block *root)
+dot_dump_node(struct block *block, struct bpf_program *prog, FILE *out)
+{
+	int icount, noffset;
+	int i;
+
+	if (block == NULL || isMarked(block))
+		return;
+	Mark(block);
+
+	icount = slength(block->stmts) + 1 + block->longjt + block->longjf;
+	noffset = min(block->offset + icount, (int)prog->bf_len);
+
+	fprintf(out, "\tblock%d [shape=ellipse, id=\"block-%d\" label=\"BLOCK%d\\n", block->id, block->id, block->id);
+	for (i = block->offset; i < noffset; i++) {
+		fprintf(out, "\\n%s", bpf_image(prog->bf_insns + i, i));
+	}
+	fprintf(out, "\" tooltip=\"");
+	for (i = 0; i < BPF_MEMWORDS; i++)
+		if (block->val[i] != 0)
+			fprintf(out, "val[%d]=%d ", i, block->val[i]);
+	fprintf(out, "val[A]=%d ", block->val[A_ATOM]);
+	fprintf(out, "val[X]=%d", block->val[X_ATOM]);
+	fprintf(out, "\"");
+	if (JT(block) == NULL)
+		fprintf(out, ", peripheries=2");
+	fprintf(out, "];\n");
+
+	dot_dump_node(JT(block), prog, out);
+	dot_dump_node(JF(block), prog, out);
+}
+static void
+dot_dump_edge(struct block *block, FILE *out)
+{
+	if (block == NULL || isMarked(block))
+		return;
+	Mark(block);
+
+	if (JT(block)) {
+		fprintf(out, "\t\"block%d\":se -> \"block%d\":n [label=\"T\"]; \n",
+				block->id, JT(block)->id);
+		fprintf(out, "\t\"block%d\":sw -> \"block%d\":n [label=\"F\"]; \n",
+			   block->id, JF(block)->id);
+	}
+	dot_dump_edge(JT(block), out);
+	dot_dump_edge(JF(block), out);
+}
+/* Output the block CFG using graphviz/DOT language
+ * In the CFG, block's code, value index for each registers at EXIT,
+ * and the jump relationship is show.
+ *
+ * example DOT for BPF `ip src host 1.1.1.1' is:
+    digraph BPF {
+    	block0 [shape=ellipse, id="block-0" label="BLOCK0\n\n(000) ldh      [12]\n(001) jeq      #0x800           jt 2	jf 5" tooltip="val[A]=0 val[X]=0"];
+    	block1 [shape=ellipse, id="block-1" label="BLOCK1\n\n(002) ld       [26]\n(003) jeq      #0x1010101       jt 4	jf 5" tooltip="val[A]=0 val[X]=0"];
+    	block2 [shape=ellipse, id="block-2" label="BLOCK2\n\n(004) ret      #68" tooltip="val[A]=0 val[X]=0", peripheries=2];
+    	block3 [shape=ellipse, id="block-3" label="BLOCK3\n\n(005) ret      #0" tooltip="val[A]=0 val[X]=0", peripheries=2];
+    	"block0":se -> "block1":n [label="T"];
+    	"block0":sw -> "block3":n [label="F"];
+    	"block1":se -> "block2":n [label="T"];
+    	"block1":sw -> "block3":n [label="F"];
+    }
+ *
+ *  After install graphviz on http://www.graphviz.org/, save it as bpf.dot
+ *  and run `dot -Tpng -O bpf.dot' to draw the graph.
+ */
+static void
+dot_dump(struct block *root)
+{
+	struct bpf_program f;
+	FILE *out = stdout;
+
+	memset(bids, 0, sizeof bids);
+	f.bf_insns = icode_to_fcode(root, &f.bf_len);
+
+	fprintf(out, "digraph BPF {\n");
+	unMarkAll();
+	dot_dump_node(root, &f, out);
+	unMarkAll();
+	dot_dump_edge(root, out);
+	fprintf(out, "}\n");
+
+	free((char *)f.bf_insns);
+}
+
+static void
+plain_dump(struct block *root)
 {
 	struct bpf_program f;
 
@@ -2244,4 +2339,17 @@
 	putchar('\n');
 	free((char *)f.bf_insns);
 }
+static void
+opt_dump(struct block *root)
+{
+	/* if optimizer debugging is enabled, output DOT graph
+	 * `dflag=4' is equivalent to -dddd to follow -d/-dd/-ddd
+     * convention in tcpdump command line
+	 */
+	if (dflag > 3)
+		dot_dump(root);
+	else
+		plain_dump(root);
+}
+
 #endif
diff --git a/packaging/pcap.spec.in b/packaging/pcap.spec.in
deleted file mode 100644
index ff7b996..0000000
--- a/packaging/pcap.spec.in
+++ /dev/null
@@ -1,77 +0,0 @@
-%define prefix   /usr
-%define version @VERSION@
-
-Summary: A system-independent interface for user-level packet capture
-Name: libpcap
-Version: %version
-Release: 1
-Group: Development/Libraries
-License: BSD with advertising
-Source: @NAME@.tar.gz
-BuildRoot: /tmp/%{name}-buildroot
-URL: http://www.tcpdump.org
-
-Source: http://www.tcpdump.org/release/%{name}-%{version}.tar.gz
-
-%description
-Libpcap provides a portable framework for low-level network
-monitoring.  Libpcap can provide network statistics collection,
-security monitoring and network debugging.  Since almost every system
-vendor provides a different interface for packet capture, the libpcap
-authors created this system-independent API to ease in porting and to
-alleviate the need for several system-dependent packet capture modules
-in each application.
-
-Install libpcap if you need to do low-level network traffic monitoring
-on your network.
-
-%package devel
-Summary: Libraries and header files for the libpcap library
-Group: Development/Libraries
-
-%description devel
-Libpcap provides a portable framework for low-level network
-monitoring.  Libpcap can provide network statistics collection,
-security monitoring and network debugging.  Since almost every system
-vendor provides a different interface for packet capture, the libpcap
-authors created this system-independent API to ease in porting and to
-alleviate the need for several system-dependent packet capture modules
-in each application.
-
-This package provides the libraries, include files, and other 
-resources needed for developing libpcap applications.
- 
-%prep
-%setup -q
-
-%build
-export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
-%configure
-make %{?_smp_mflags}
-
-%install
-rm -rf $RPM_BUILD_ROOT
-
-make DESTDIR=$RPM_BUILD_ROOT install
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root)
-%doc LICENSE README CHANGES INSTALL.txt README.linux TODO VERSION CREDITS packaging/pcap.spec
-%{_libdir}/libpcap.so.*
-%{_mandir}/man7/pcap*.7*
-
-%files devel
-%defattr(-,root,root)
-%{_bindir}/pcap-config
-%{_includedir}/pcap/*.h
-%{_includedir}/pcap.h
-%{_includedir}/pcap-bpf.h
-%{_includedir}/pcap-namedb.h
-%{_libdir}/libpcap.so
-%{_libdir}/libpcap.a
-%{_mandir}/man1/pcap-config.1*
-%{_mandir}/man3/pcap*.3*
-%{_mandir}/man5/pcap*.5*
diff --git a/pcap-bpf.c b/pcap-bpf.c
index 250298a..b1da1a0 100644
--- a/pcap-bpf.c
+++ b/pcap-bpf.c
@@ -18,10 +18,6 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.116 2008-09-16 18:42:29 guy Exp $ (LBL)";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -239,7 +235,7 @@
  */
 static int
 pcap_getnonblock_bpf(pcap_t *p, char *errbuf)
-{ 
+{
 #ifdef HAVE_ZEROCOPY_BPF
 	struct pcap_bpf *pb = p->priv;
 
@@ -251,7 +247,7 @@
 
 static int
 pcap_setnonblock_bpf(pcap_t *p, int nonblock, char *errbuf)
-{   
+{
 #ifdef HAVE_ZEROCOPY_BPF
 	struct pcap_bpf *pb = p->priv;
 
@@ -1480,6 +1476,9 @@
 {
 	struct pcap_bpf *pb = p->priv;
 	int status = 0;
+#ifdef HAVE_BSD_IEEE80211
+	int retv;
+#endif
 	int fd;
 #ifdef LIFNAMSIZ
 	char *zonesep;
@@ -1539,22 +1538,43 @@
 
 #if defined(LIFNAMSIZ) && defined(ZONENAME_MAX) && defined(lifr_zoneid)
 	/*
-	 * Check if the given source network device has a '/' separated
-	 * zonename prefix string. The zonename prefixed source device
-	 * can be used by libpcap consumers to capture network traffic
-	 * in non-global zones from the global zone on Solaris 11 and
-	 * above. If the zonename prefix is present then we strip the
-	 * prefix and pass the zone ID as part of lifr_zoneid.
+	 * Retrieve the zoneid of the zone we are currently executing in.
+	 */
+	if ((ifr.lifr_zoneid = getzoneid()) == -1) {
+		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "getzoneid(): %s",
+		    pcap_strerror(errno));
+		status = PCAP_ERROR;
+		goto bad;
+	}
+	/*
+	 * Check if the given source datalink name has a '/' separated
+	 * zonename prefix string.  The zonename prefixed source datalink can
+	 * be used by pcap consumers in the Solaris global zone to capture
+	 * traffic on datalinks in non-global zones.  Non-global zones
+	 * do not have access to datalinks outside of their own namespace.
 	 */
 	if ((zonesep = strchr(p->opt.source, '/')) != NULL) {
-		char zonename[ZONENAME_MAX];
+		char path_zname[ZONENAME_MAX];
 		int  znamelen;
 		char *lnamep;
 
+		if (ifr.lifr_zoneid != GLOBAL_ZONEID) {
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "zonename/linkname only valid in global zone.");
+			status = PCAP_ERROR;
+			goto bad;
+		}
 		znamelen = zonesep - p->opt.source;
-		(void) strlcpy(zonename, p->opt.source, znamelen + 1);
+		(void) strlcpy(path_zname, p->opt.source, znamelen + 1);
+		ifr.lifr_zoneid = getzoneidbyname(path_zname);
+		if (ifr.lifr_zoneid == -1) {
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "getzoneidbyname(%s): %s", path_zname,
+			pcap_strerror(errno));
+			status = PCAP_ERROR;
+			goto bad;
+		}
 		lnamep = strdup(zonesep + 1);
-		ifr.lifr_zoneid = getzoneidbyname(zonename);
 		free(p->opt.source);
 		p->opt.source = lnamep;
 	}
@@ -1683,6 +1703,7 @@
 		if (ioctl(fd, BIOCGETZMAX, (caddr_t)&zbufmax) < 0) {
 			snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCGETZMAX: %s",
 			    pcap_strerror(errno));
+			status = PCAP_ERROR;
 			goto bad;
 		}
 
@@ -1709,6 +1730,7 @@
 		if (pb->zbuf1 == MAP_FAILED || pb->zbuf2 == MAP_FAILED) {
 			snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "mmap: %s",
 			    pcap_strerror(errno));
+			status = PCAP_ERROR;
 			goto bad;
 		}
 		memset(&bz, 0, sizeof(bz)); /* bzero() deprecated, replaced with memset() */
@@ -1718,12 +1740,14 @@
 		if (ioctl(fd, BIOCSETZBUF, (caddr_t)&bz) < 0) {
 			snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSETZBUF: %s",
 			    pcap_strerror(errno));
+			status = PCAP_ERROR;
 			goto bad;
 		}
 		(void)strncpy(ifrname, p->opt.source, ifnamsiz);
 		if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) {
 			snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSETIF: %s: %s",
 			    p->opt.source, pcap_strerror(errno));
+			status = PCAP_ERROR;
 			goto bad;
 		}
 		v = pb->zbufsize - sizeof(struct bpf_zbuf_header);
@@ -1977,11 +2001,12 @@
 		/*
 		 * Try to put the interface into monitor mode.
 		 */
-		status = monitor_mode(p, 1);
-		if (status != 0) {
+		retv = monitor_mode(p, 1);
+		if (retv != 0) {
 			/*
 			 * We failed.
 			 */
+			status = retv;
 			goto bad;
 		}
 
diff --git a/pcap-bpf.h b/pcap-bpf.h
index 7b7e90a..ebb64c3 100644
--- a/pcap-bpf.h
+++ b/pcap-bpf.h
@@ -4,7 +4,7 @@
  *
  * This code is derived from the Stanford/CMU enet packet filter,
  * (net/enet.c) distributed as part of 4.3BSD, and code contributed
- * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 
+ * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
  * Berkeley Laboratory.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,8 +34,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.50 2007-04-01 21:43:55 guy Exp $ (LBL)
  */
 
 /*
diff --git a/pcap-bt-linux.c b/pcap-bt-linux.c
index 6435bcf..56df687 100644
--- a/pcap-bt-linux.c
+++ b/pcap-bt-linux.c
@@ -11,8 +11,8 @@
  * 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. The name of the author may not be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
  * permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -31,11 +31,7 @@
  * By Paolo Abeni <paolo.abeni@email.it>
  *
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-bt-linux.c,v 1.15 2008-07-01 07:05:54 guy Exp $ (LBL)";
-#endif
- 
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -77,7 +73,7 @@
 	int dev_id;		/* device ID of device we're bound to */
 };
 
-int 
+int
 bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
 {
 	struct hci_dev_list_req *dev_list;
@@ -88,7 +84,7 @@
 	sock  = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
 	if (sock < 0)
 	{
-		/* if bluetooth is not supported this this is not fatal*/ 
+		/* if bluetooth is not supported this this is not fatal*/
 		if (errno == EAFNOSUPPORT)
 			return 0;
 		snprintf(err_str, PCAP_ERRBUF_SIZE,
@@ -97,7 +93,7 @@
 	}
 
 	dev_list = malloc(HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
-	if (!dev_list) 
+	if (!dev_list)
 	{
 		snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't allocate %zu bytes for Bluetooth device list",
 			HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
@@ -107,7 +103,7 @@
 
 	dev_list->dev_num = HCI_MAX_DEV;
 
-	if (ioctl(sock, HCIGETDEVLIST, (void *) dev_list) < 0) 
+	if (ioctl(sock, HCIGETDEVLIST, (void *) dev_list) < 0)
 	{
 		snprintf(err_str, PCAP_ERRBUF_SIZE,
 		    "Can't get Bluetooth device list via ioctl: %s",
@@ -119,11 +115,11 @@
 	dev_req = dev_list->dev_req;
 	for (i = 0; i < dev_list->dev_num; i++, dev_req++) {
 		char dev_name[20], dev_descr[30];
-		
+
 		snprintf(dev_name, 20, BT_IFACE"%d", dev_req->dev_id);
 		snprintf(dev_descr, 30, "Bluetooth adapter number %d", i);
-			
-		if (pcap_add_if(alldevsp, dev_name, 0, 
+
+		if (pcap_add_if(alldevsp, dev_name, 0,
 		       dev_descr, err_str) < 0)
 		{
 			ret = -1;
@@ -197,7 +193,7 @@
 	if (sscanf(handle->opt.source, BT_IFACE"%d", &dev_id) != 1)
 	{
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
-			"Can't get Bluetooth device index from %s", 
+			"Can't get Bluetooth device index from %s",
 			 handle->opt.source);
 		return PCAP_ERROR;
 	}
@@ -216,7 +212,7 @@
 	handle->setnonblock_op = pcap_setnonblock_fd;
 	handle->stats_op = bt_stats_linux;
 	handlep->dev_id = dev_id;
-	
+
 	/* Create HCI socket */
 	handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
 	if (handle->fd < 0) {
@@ -246,10 +242,10 @@
 		goto close_fail;
 	}
 
-	/* Setup filter, do not call hci function to avoid dependence on 
+	/* Setup filter, do not call hci function to avoid dependence on
 	 * external libs	*/
 	memset(&flt, 0, sizeof(flt));
-	memset((void *) &flt.type_mask, 0xff, sizeof(flt.type_mask));	
+	memset((void *) &flt.type_mask, 0xff, sizeof(flt.type_mask));
 	memset((void *) &flt.event_mask, 0xff, sizeof(flt.event_mask));
 	if (setsockopt(handle->fd, SOL_HCI, HCI_FILTER, &flt, sizeof(flt)) < 0) {
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
@@ -313,7 +309,7 @@
 	bthdr = (pcap_bluetooth_h4_header*) &handle->buffer[handle->offset];
 	iv.iov_base = &handle->buffer[handle->offset+sizeof(pcap_bluetooth_h4_header)];
 	iv.iov_len  = handle->snapshot;
-	
+
 	memset(&msg, 0, sizeof(msg));
 	msg.msg_iov = &iv;
 	msg.msg_iovlen = 1;
@@ -338,7 +334,7 @@
 
 	pkth.caplen = ret;
 
-	/* get direction and timestamp*/ 
+	/* get direction and timestamp*/
 	cmsg = CMSG_FIRSTHDR(&msg);
 	int in=0;
 	while (cmsg) {
@@ -353,7 +349,7 @@
 		}
 		cmsg = CMSG_NXTHDR(&msg, cmsg);
 	}
-	if ((in && (handle->direction == PCAP_D_OUT)) || 
+	if ((in && (handle->direction == PCAP_D_OUT)) ||
 				((!in) && (handle->direction == PCAP_D_IN)))
 		return 0;
 
@@ -375,10 +371,10 @@
 	snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported on "
     		"bluetooth devices");
 	return (-1);
-}                           
+}
 
 
-static int 
+static int
 bt_stats_linux(pcap_t *handle, struct pcap_stat *stats)
 {
 	struct pcap_bt *handlep = handle->priv;
@@ -386,28 +382,28 @@
 	struct hci_dev_info dev_info;
 	struct hci_dev_stats * s = &dev_info.stat;
 	dev_info.dev_id = handlep->dev_id;
-	
+
 	/* ignore eintr */
 	do {
 		ret = ioctl(handle->fd, HCIGETDEVINFO, (void *)&dev_info);
 	} while ((ret == -1) && (errno == EINTR));
-	    
+
 	if (ret < 0) {
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
 		    "Can't get stats via ioctl: %s", strerror(errno));
 		return (-1);
-		
+
 	}
 
-	/* we receive both rx and tx frames, so comulate all stats */	
-	stats->ps_recv = s->evt_rx + s->acl_rx + s->sco_rx + s->cmd_tx + 
+	/* we receive both rx and tx frames, so comulate all stats */
+	stats->ps_recv = s->evt_rx + s->acl_rx + s->sco_rx + s->cmd_tx +
 		s->acl_tx +s->sco_tx;
 	stats->ps_drop = s->err_rx + s->err_tx;
 	stats->ps_ifdrop = 0;
 	return 0;
 }
 
-static int 
+static int
 bt_setdirection_linux(pcap_t *p, pcap_direction_t d)
 {
 	p->direction = d;
diff --git a/pcap-bt-linux.h b/pcap-bt-linux.h
index fbe8f48..e098654 100644
--- a/pcap-bt-linux.h
+++ b/pcap-bt-linux.h
@@ -11,8 +11,8 @@
  * 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. The name of the author may not be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
  * permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -29,8 +29,6 @@
  *
  * Bluetooth sniffing API implementation for Linux platform
  * By Paolo Abeni <paolo.abeni@email.it>
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-bt-linux.h,v 1.5 2008-04-04 19:37:45 guy Exp $ (LBL)
  */
 
 /*
diff --git a/pcap-bt-monitor-linux.c b/pcap-bt-monitor-linux.c
new file mode 100644
index 0000000..f193e26
--- /dev/null
+++ b/pcap-bt-monitor-linux.c
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2014 Michal Labedzki for Tieto Corporation
+ * 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. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
+ * OWNER 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.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
+#include <bluetooth/mgmt.h>
+
+#include "pcap/bluetooth.h"
+#include "pcap-int.h"
+
+#include "pcap-bt-monitor-linux.h"
+
+#define BT_CONTROL_SIZE 32
+#define INTERFACE_NAME "bluetooth-monitor"
+
+int
+bt_monitor_findalldevs(pcap_if_t **alldevsp, char *err_str)
+{
+    int         ret = 0;
+
+    if (pcap_add_if(alldevsp, INTERFACE_NAME, 0,
+               "Bluetooth Linux Monitor", err_str) < 0)
+    {
+        ret = -1;
+    }
+
+    return ret;
+}
+
+static int
+bt_monitor_read(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_char *user)
+{
+    struct cmsghdr *cmsg;
+    struct msghdr msg;
+    struct iovec  iv[2];
+    ssize_t ret;
+    struct pcap_pkthdr pkth;
+    pcap_bluetooth_linux_monitor_header *bthdr;
+    struct mgmt_hdr hdr;
+
+    bthdr = (pcap_bluetooth_linux_monitor_header*) &handle->buffer[handle->offset];
+
+    iv[0].iov_base = &hdr;
+    iv[0].iov_len = MGMT_HDR_SIZE;
+    iv[1].iov_base = &handle->buffer[handle->offset + sizeof(pcap_bluetooth_linux_monitor_header)];
+    iv[1].iov_len = handle->snapshot;
+
+    memset(&pkth.ts, 0, sizeof(pkth.ts));
+    memset(&msg, 0, sizeof(msg));
+    msg.msg_iov = iv;
+    msg.msg_iovlen = 2;
+    msg.msg_control = handle->buffer;
+    msg.msg_controllen = handle->offset;
+
+    do {
+        ret = recvmsg(handle->fd, &msg, 0);
+        if (handle->break_loop)
+        {
+            handle->break_loop = 0;
+            return -2;
+        }
+    } while ((ret == -1) && (errno == EINTR));
+
+    if (ret < 0) {
+        snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+            "Can't receive packet: %s", strerror(errno));
+        return -1;
+    }
+
+    pkth.caplen = ret - MGMT_HDR_SIZE + sizeof(pcap_bluetooth_linux_monitor_header);
+    pkth.len = pkth.caplen;
+
+    for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+        if (cmsg->cmsg_level != SOL_SOCKET) continue;
+
+        if (cmsg->cmsg_type == SCM_TIMESTAMP) {
+            memcpy(&pkth.ts, CMSG_DATA(cmsg), sizeof(pkth.ts));
+        }
+    }
+
+    bthdr->adapter_id = htons(hdr.index);
+    bthdr->opcode = htons(hdr.opcode);
+
+    if (handle->fcode.bf_insns == NULL ||
+        bpf_filter(handle->fcode.bf_insns, &handle->buffer[handle->offset],
+          pkth.len, pkth.caplen)) {
+        callback(user, &pkth, &handle->buffer[handle->offset]);
+        return 1;
+    }
+    return 0;   /* didn't pass filter */
+}
+
+static int
+bt_monitor_inject(pcap_t *handle, const void *buf _U_, size_t size _U_)
+{
+    snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported yet");
+    return -1;
+}
+
+static int
+bt_monitor_setdirection(pcap_t *p, pcap_direction_t d)
+{
+    p->direction = d;
+    return 0;
+}
+
+static int
+bt_monitor_stats(pcap_t *handle _U_, struct pcap_stat *stats)
+{
+    stats->ps_recv = 0;
+    stats->ps_drop = 0;
+    stats->ps_ifdrop = 0;
+
+    return 0;
+}
+
+static int
+bt_monitor_activate(pcap_t* handle)
+{
+    struct sockaddr_hci addr;
+    int err = PCAP_ERROR;
+    int opt;
+
+    if (handle->opt.rfmon) {
+        /* monitor mode doesn't apply here */
+        return PCAP_ERROR_RFMON_NOTSUP;
+    }
+
+    handle->bufsize = handle->snapshot + BT_CONTROL_SIZE + sizeof(pcap_bluetooth_linux_monitor_header);
+    handle->offset = BT_CONTROL_SIZE;
+    handle->linktype = DLT_BLUETOOTH_LINUX_MONITOR;
+
+    handle->read_op = bt_monitor_read;
+    handle->inject_op = bt_monitor_inject;
+    handle->setfilter_op = install_bpf_program; /* no kernel filtering */
+    handle->setdirection_op = bt_monitor_setdirection;
+    handle->set_datalink_op = NULL; /* can't change data link type */
+    handle->getnonblock_op = pcap_getnonblock_fd;
+    handle->setnonblock_op = pcap_setnonblock_fd;
+    handle->stats_op = bt_monitor_stats;
+
+    handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+    if (handle->fd < 0) {
+        snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+            "Can't create raw socket: %s", strerror(errno));
+        return PCAP_ERROR;
+    }
+
+    handle->buffer = malloc(handle->bufsize);
+    if (!handle->buffer) {
+        snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't allocate dump buffer: %s",
+            pcap_strerror(errno));
+        goto close_fail;
+    }
+
+    /* Bind socket to the HCI device */
+    addr.hci_family = AF_BLUETOOTH;
+    addr.hci_dev = HCI_DEV_NONE;
+    addr.hci_channel = HCI_CHANNEL_MONITOR;
+
+    if (bind(handle->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+        snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+            "Can't attach to interface: %s", strerror(errno));
+        goto close_fail;
+    }
+
+    opt = 1;
+    if (setsockopt(handle->fd, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) {
+        snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+            "Can't enable time stamp: %s", strerror(errno));
+        goto close_fail;
+    }
+
+    handle->selectable_fd = handle->fd;
+
+    return 0;
+
+close_fail:
+    pcap_cleanup_live_common(handle);
+    return err;
+}
+
+pcap_t *
+bt_monitor_create(const char *device, char *ebuf, int *is_ours)
+{
+    pcap_t      *p;
+    const char  *cp;
+
+    cp = strrchr(device, '/');
+    if (cp == NULL)
+        cp = device;
+
+    if (strcmp(cp, INTERFACE_NAME) != 0) {
+        *is_ours = 0;
+        return NULL;
+    }
+
+    *is_ours = 1;
+    p = pcap_create_common(device, ebuf, 0);
+    if (p == NULL)
+        return NULL;
+
+    p->activate_op = bt_monitor_activate;
+
+    return p;
+}
diff --git a/pcap-bt-monitor-linux.h b/pcap-bt-monitor-linux.h
new file mode 100644
index 0000000..aada2bc
--- /dev/null
+++ b/pcap-bt-monitor-linux.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2014 Michal Labedzki for Tieto Corporation
+ * 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. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
+ * OWNER 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.
+ */
+
+int bt_monitor_findalldevs(pcap_if_t **alldevsp, char *err_str);
+pcap_t *bt_monitor_create(const char *device, char *ebuf, int *is_ours);
diff --git a/pcap-can-linux.c b/pcap-can-linux.c
index 80fa41c..a8e1e35 100644
--- a/pcap-can-linux.c
+++ b/pcap-can-linux.c
@@ -171,7 +171,7 @@
 
 	/* get interface index */
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name));
+	strlcpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name));
 	if (ioctl(handle->fd, SIOCGIFINDEX, &ifr) < 0)
 	{
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
@@ -243,7 +243,7 @@
 		}
 	} while ((pkth.caplen == -1) && (errno == EINTR));
 
-	if (pkth.caplen < 0)
+	if (pkth.caplen == -1)
 	{
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't receive packet %d:%s",
 			errno, strerror(errno));
diff --git a/pcap-canusb-linux.c b/pcap-canusb-linux.c
index a72f469..f44c45e 100644
--- a/pcap-canusb-linux.c
+++ b/pcap-canusb-linux.c
@@ -41,6 +41,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <errno.h>
 #include <string.h>
 #include <pthread.h>
 
@@ -92,7 +93,7 @@
     libusb_device** devs;
     unsigned char sernum[65];
     int cnt, i;
-    
+
     if (libusb_init(&fdctx) != 0) {
         /*
          * XXX - if this doesn't just mean "no USB file system mounted",
@@ -100,7 +101,7 @@
          * saying "no CANUSB devices".
          */
         return 0;
-    } 
+    }
 
     cnt = libusb_get_device_list(fdctx,&devs);
 
@@ -111,24 +112,24 @@
         struct libusb_device_descriptor desc;
         libusb_get_device_descriptor(devs[i],&desc);
 
-        if ((desc.idVendor != CANUSB_VID) || (desc.idProduct != CANUSB_PID)) 
+        if ((desc.idVendor != CANUSB_VID) || (desc.idProduct != CANUSB_PID))
             continue; //It is not, check next device
-          
+
         //It is!
         libusb_device_handle *dh = NULL;
 
         if ((ret = libusb_open(devs[i],&dh)) == 0)
         {
             char dev_name[30];
-            char dev_descr[50]; 
+            char dev_descr[50];
             int n = libusb_get_string_descriptor_ascii(dh,desc.iSerialNumber,sernum,64);
             sernum[n] = 0;
 
             snprintf(dev_name, 30, CANUSB_IFACE"%s", sernum);
             snprintf(dev_descr, 50, "CanUSB [%s]", sernum);
-            
+
             libusb_close(dh);
-            
+
             if (pcap_add_if(alldevsp, dev_name, 0, dev_descr, err_str) < 0)
             {
                 libusb_free_device_list(devs,1);
@@ -148,18 +149,18 @@
     libusb_device** devs;
     unsigned char serial[65];
     int cnt,i,n;
-    
+
     cnt = libusb_get_device_list(ctx,&devs);
 
     for(i=0;i<cnt;i++)
-    {    
+    {
         // Check if this device is interesting.
         struct libusb_device_descriptor desc;
         libusb_get_device_descriptor(devs[i],&desc);
 
         if ((desc.idVendor != CANUSB_VID) || (desc.idProduct != CANUSB_PID))
           continue;
-          
+
         //Found one!
         libusb_device_handle *dh = NULL;
 
@@ -191,9 +192,9 @@
             libusb_close(dh);
             continue;
         }
-        
+
         //Fount it!
-        libusb_free_device_list(devs,1);        
+        libusb_free_device_list(devs,1);
         return dh;
     }
 
@@ -204,7 +205,7 @@
 
 pcap_t *
 canusb_create(const char *device, char *ebuf, int *is_ours)
-{ 
+{
     const char *cp;
     char *cpend;
     long devnum;
@@ -258,30 +259,31 @@
 {
     struct pcap_canusb *canusb = arg;
     int i;
-    struct 
+    struct
     {
       uint8_t rxsz, txsz;
     } status;
-  
-    fcntl(canusb->wrpipe, F_SETFL, O_NONBLOCK);  
+
+    fcntl(canusb->wrpipe, F_SETFL, O_NONBLOCK);
 
     while(canusb->loop)
     {
         int sz;
         struct CAN_Msg msg;
-    
+
         libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100);
-        //HACK!!!!! -> drop buffered data, read new one by reading twice.        
-        libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100);                                   
+        //HACK!!!!! -> drop buffered data, read new one by reading twice.
+        libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100);
 
         for(i = 0; i<status.rxsz; i++)
         {
-            libusb_bulk_transfer(canusb->dev, 0x85, (unsigned char*)&msg, sizeof(msg), &sz, 100);      
-            write(canusb->wrpipe, &msg, sizeof(msg));
+            libusb_bulk_transfer(canusb->dev, 0x85, (unsigned char*)&msg, sizeof(msg), &sz, 100);
+            if(write(canusb->wrpipe, &msg, sizeof(msg)) < 0)
+                fprintf(stderr,"write() error: %s\n", strerror(errno));
         }
 
     }
-  
+
     return NULL;
 }
 
@@ -295,7 +297,7 @@
     this->rdpipe = pipefd[0];
     this->wrpipe = pipefd[1];
 
-    this->loop = 1;  
+    this->loop = 1;
     pthread_create(&this->worker, NULL, canusb_capture_thread, this);
 
     return this->rdpipe;
@@ -310,7 +312,7 @@
     cmd[1] = 1;  //Empty outgoing buffer
     cmd[3] = 0;  //Not a write to serial number
     memset(&cmd[4],0,16-4);
-        
+
     libusb_interrupt_transfer(this->dev, 0x1,cmd,16,&al,100);
 }
 
@@ -326,7 +328,7 @@
     {
         libusb_close(canusb->dev);
         canusb->dev = NULL;
-    }    
+    }
     if (canusb->ctx)
     {
         libusb_exit(canusb->ctx);
@@ -345,9 +347,9 @@
         /*
          * XXX - what causes this to fail?
          */
-        snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "libusb_init() failed");  
+        snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "libusb_init() failed");
         return PCAP_ERROR;
-    } 
+    }
 
     handle->read_op = canusb_read_linux;
 
@@ -371,7 +373,7 @@
     if (!canusb->dev)
     {
         libusb_exit(canusb->ctx);
-        snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't open USB Device");  
+        snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't open USB Device");
         return PCAP_ERROR;
     }
 
@@ -393,7 +395,7 @@
     int i = 0;
     struct CAN_Msg msg;
     struct pcap_pkthdr pkth;
-  
+
     while(i < max_packets)
     {
         int n;
@@ -404,10 +406,10 @@
         pkth.caplen = pkth.len = n;
         pkth.caplen -= 4;
         pkth.caplen -= 8 - msg.length;
-    
+
         if ((firstpacket.tv_sec == -1) && (firstpacket.tv_usec == -1))
             gettimeofday(&firstpacket, NULL);
-      
+
         pkth.ts.tv_usec = firstpacket.tv_usec + (msg.timestamp % 100) * 10000;
         pkth.ts.tv_sec = firstpacket.tv_usec + (msg.timestamp / 100);
         if (pkth.ts.tv_usec > 1000000)
@@ -419,7 +421,7 @@
         callback(user, &pkth, (void*)&msg.id);
         i++;
     }
-  
+
     return i;
 }
 
diff --git a/pcap-common.c b/pcap-common.c
index e8fc631..4db4968 100644
--- a/pcap-common.c
+++ b/pcap-common.c
@@ -386,7 +386,7 @@
 
 /*
  * Juniper-private data link type, as per request from
- * Hannes Gredler <hannes@juniper.net>. 
+ * Hannes Gredler <hannes@juniper.net>.
  * The Link Types are used for prepending meta-information
  * like interface index, interface name
  * before standard Ethernet, PPP, Frelay & C-HDLC Frames
@@ -403,7 +403,7 @@
 
 /*
  * Juniper-private data link type, as per request from
- * Hannes Gredler <hannes@juniper.net>. 
+ * Hannes Gredler <hannes@juniper.net>.
  * The DLT_ is used for internal communication with a
  * voice Adapter Card (PIC)
  */
@@ -478,7 +478,7 @@
 
 /*
  * Juniper-private data link type, as per request from
- * Hannes Gredler <hannes@juniper.net>. 
+ * Hannes Gredler <hannes@juniper.net>.
  * The DLT_ is used for internal communication with a
  * integrated service module (ISM).
  */
@@ -519,7 +519,7 @@
 
 /*
  * Juniper-private data link type, as per request from
- * Hannes Gredler <hannes@juniper.net>. 
+ * Hannes Gredler <hannes@juniper.net>.
  * The DLT_ is used for capturing data on a secure tunnel interface.
  */
 #define LINKTYPE_JUNIPER_ST     200
@@ -611,11 +611,11 @@
  */
 #define LINKTYPE_IEEE802_15_4_NONASK_PHY	215
 
-/* 
+/*
  * David Gibson <david@gibson.dropbear.id.au> requested this for
  * captures from the Linux kernel /dev/input/eventN devices. This
  * is used to communicate keystrokes and mouse movements from the
- * Linux kernel to display systems, such as Xorg. 
+ * Linux kernel to display systems, such as Xorg.
  */
 #define LINKTYPE_LINUX_EVDEV	216
 
@@ -777,7 +777,7 @@
 
 /*
  * Juniper-private data link type, as per request from
- * Hannes Gredler <hannes@juniper.net>. 
+ * Hannes Gredler <hannes@juniper.net>.
  */
 #define LINKTYPE_JUNIPER_VS			232
 #define LINKTYPE_JUNIPER_SRX_E2E		233
@@ -809,12 +809,12 @@
 
 /*
  * Juniper-private data link type, as per request from
- * Hannes Gredler <hannes@juniper.net>. 
+ * Hannes Gredler <hannes@juniper.net>.
  */
 #define LINKTYPE_JUNIPER_ATM_CEMIC		238
 
 /*
- * NetFilter LOG messages 
+ * NetFilter LOG messages
  * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets)
  *
  * Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl>
@@ -922,7 +922,7 @@
 
 /*
  * 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
@@ -933,7 +933,74 @@
  */
 #define LINKTYPE_WIRESHARK_UPPER_PDU	252
 
-#define LINKTYPE_MATCHING_MAX	252		/* highest value in the "matching" range */
+/*
+ * Link-layer header type for the netlink protocol (nlmon devices).
+ */
+#define LINKTYPE_NETLINK		253
+
+/*
+ * Bluetooth Linux Monitor headers for the BlueZ stack.
+ */
+#define LINKTYPE_BLUETOOTH_LINUX_MONITOR	254
+
+/*
+ * Bluetooth Basic Rate/Enhanced Data Rate baseband packets, as
+ * captured by Ubertooth.
+ */
+#define LINKTYPE_BLUETOOTH_BREDR_BB	255
+
+/*
+ * Bluetooth Low Energy link layer packets, as captured by Ubertooth.
+ */
+#define LINKTYPE_BLUETOOTH_LE_LL_WITH_PHDR	256
+
+/*
+ * PROFIBUS data link layer.
+ */
+#define LINKTYPE_PROFIBUS_DL		257
+
+
+/*
+ * Apple's DLT_PKTAP headers.
+ *
+ * Sadly, the folks at Apple either had no clue that the DLT_USERn values
+ * are for internal use within an organization and partners only, and
+ * didn't know that the right way to get a link-layer header type is to
+ * ask tcpdump.org for one, or knew and didn't care, so they just
+ * used DLT_USER2, which causes problems for everything except for
+ * their version of tcpdump.
+ *
+ * So I'll just give them one; hopefully this will show up in a
+ * libpcap release in time for them to get this into 10.10 Big Sur
+ * or whatever Mavericks' successor is called.  LINKTYPE_PKTAP
+ * will be 258 *even on OS X*; that is *intentional*, so that
+ * PKTAP files look the same on *all* OSes (different OSes can have
+ * different numerical values for a given DLT_, but *MUST NOT* have
+ * different values for what goes in a file, as files can be moved
+ * between OSes!).
+ */
+#define LINKTYPE_PKTAP		258
+
+/*
+ * Ethernet packets preceded by a header giving the last 6 octets
+ * of the preamble specified by 802.3-2012 Clause 65, section
+ * 65.1.3.2 "Transmit".
+ */
+#define LINKTYPE_EPON		259
+
+/*
+ * IPMI trace packets, as specified by Table 3-20 "Trace Data Block Format"
+ * in the PICMG HPM.2 specification.
+ */
+#define LINKTYPE_IPMI_HPM_2	260
+
+/*
+ * per  Joshua Wright <jwright@hasborg.com>, formats for Zwave captures.
+ */
+#define LINKTYPE_ZWAVE_R1_R2	261
+#define LINKTYPE_ZWAVE_R3	262
+
+#define LINKTYPE_MATCHING_MAX	262		/* highest value in the "matching" range */
 
 static struct linktype_map {
 	int	dlt;
@@ -1006,13 +1073,20 @@
 	int i;
 
 	/*
-	 * Map DLT_PFSYNC, whatever it might be, to LINKTYPE_PFSYNC.
+	 * DLTs that, on some platforms, have values in the matching range
+	 * but that *don't* have the same value as the corresponding
+	 * LINKTYPE because, for some reason, not all OSes have the
+	 * same value for that DLT (note that the DLT's value might be
+	 * outside the matching range on some of those OSes).
 	 */
 	if (dlt == DLT_PFSYNC)
 		return (LINKTYPE_PFSYNC);
+	if (dlt == DLT_PKTAP)
+		return (LINKTYPE_PKTAP);
 
 	/*
-	 * Map the values in the matching range.
+	 * For all other values in the matching range, the DLT
+	 * value is the same as the LINKTYPE value.
 	 */
 	if (dlt >= DLT_MATCHING_MIN && dlt <= DLT_MATCHING_MAX)
 		return (dlt);
@@ -1026,9 +1100,9 @@
 	}
 
 	/*
-	 * If we don't have a mapping for this DLT_ code, return an
+	 * If we don't have a mapping for this DLT, return an
 	 * error; that means that this is a value with no corresponding
-	 * LINKTYPE_ code, and we need to assign one.
+	 * LINKTYPE, and we need to assign one.
 	 */
 	return (-1);
 }
@@ -1039,16 +1113,19 @@
 	int i;
 
 	/*
-	 * Map LINKTYPE_PFSYNC to DLT_PFSYNC, whatever it might be.
-	 * LINKTYPE_PFSYNC is in the matching range, to make sure
-	 * it's as safe from reuse as we can arrange, so we do
-	 * this test first.
+	 * LINKTYPEs in the matching range that *don't*
+	 * have the same value as the corresponding DLTs
+	 * because, for some reason, not all OSes have the
+	 * same value for that DLT.
 	 */
 	if (linktype == LINKTYPE_PFSYNC)
 		return (DLT_PFSYNC);
+	if (linktype == LINKTYPE_PKTAP)
+		return (DLT_PKTAP);
 
 	/*
-	 * Map the values in the matching range.
+	 * For all other values in the matching range, the LINKTYPE
+	 * value is the same as the DLT value.
 	 */
 	if (linktype >= LINKTYPE_MATCHING_MIN &&
 	    linktype <= LINKTYPE_MATCHING_MAX)
@@ -1063,9 +1140,9 @@
 	}
 
 	/*
-	 * If we don't have an entry for this link type, return
-	 * the link type value; it may be a DLT_ value from an
-	 * older version of libpcap.
+	 * If we don't have an entry for this LINKTYPE, return
+	 * the link type value; it may be a DLT from an older
+	 * version of libpcap.
 	 */
 	return linktype;
 }
@@ -1085,8 +1162,6 @@
 {
 	pcap_usb_header_mmapped *uhdr = (pcap_usb_header_mmapped *)buf;
 	bpf_u_int32 offset = 0;
-	usb_isodesc *pisodesc;
-	int32_t numdesc, i;
 
 	/*
 	 * "offset" is the offset *past* the field we're swapping;
@@ -1095,7 +1170,7 @@
 	 */
 
 	/*
-	 * The URB id is a totally opaque value; do we really need to 
+	 * 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 */
@@ -1150,6 +1225,17 @@
 	} 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
@@ -1178,31 +1264,33 @@
 		if (hdr->caplen < offset)
 			return;
 		uhdr->ndesc = SWAPLONG(uhdr->ndesc);
-	}	
 
-	if (uhdr->transfer_type == URB_ISOCHRONOUS) {
-		/* swap the values in struct linux_usb_isodesc */
-		pisodesc = (usb_isodesc *)(void *)(buf+offset);
-		numdesc = uhdr->s.iso.numdesc;
-		for (i = 0; i < numdesc; i++) {
-			offset += 4;		/* skip past status */
-			if (hdr->caplen < offset)
-				return;
-			pisodesc->status = SWAPLONG(pisodesc->status);
+		if (uhdr->transfer_type == URB_ISOCHRONOUS) {
+			/* swap the values in struct linux_usb_isodesc */
+			usb_isodesc *pisodesc;
+			u_int32_t i;
 
-			offset += 4;		/* skip past offset */
-			if (hdr->caplen < offset)
-				return;
-			pisodesc->offset = SWAPLONG(pisodesc->offset);
+			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 len */
-			if (hdr->caplen < offset)
-				return;
-			pisodesc->len = SWAPLONG(pisodesc->len);
+				offset += 4;		/* skip past offset */
+				if (hdr->caplen < offset)
+					return;
+				pisodesc->offset = SWAPLONG(pisodesc->offset);
 
-			offset += 4;		/* skip past padding */
+				offset += 4;		/* skip past len */
+				if (hdr->caplen < offset)
+					return;
+				pisodesc->len = SWAPLONG(pisodesc->len);
 
-			pisodesc++;
+				offset += 4;		/* skip past padding */
+
+				pisodesc++;
+			}
 		}
 	}
 }
diff --git a/pcap-config.1 b/pcap-config.1
index 021f450..2a2272b 100644
--- a/pcap-config.1
+++ b/pcap-config.1
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap-config.1,v 1.1 2008-09-23 18:04:01 guy Exp $ (LBL)
-.\"
 .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\" All rights reserved.
@@ -20,7 +18,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP-CONFIG 1 "26 March 2009"
+.TH PCAP-CONFIG 1 "22 May 2009"
 .SH NAME
 pcap-config \- write libpcap compiler and linker flags to standard output
 .SH SYNOPSIS
diff --git a/pcap-dag.c b/pcap-dag.c
index 70a6d6c..4915248 100644
--- a/pcap-dag.c
+++ b/pcap-dag.c
@@ -1,5 +1,5 @@
 /*
- * pcap-dag.c: Packet capture interface for Endace DAG card.
+ * pcap-dag.c: Packet capture interface for Emulex EndaceDAG cards.
  *
  * The functionality of this code attempts to mimic that of pcap-linux as much
  * as possible.  This code is compiled in several different ways depending on
@@ -10,16 +10,11 @@
  * called as required from their pcap-linux/bpf equivalents.
  *
  * Authors: Richard Littin, Sean Irvine ({richard,sean}@reeltwo.com)
- * Modifications: Jesper Peterson  <support@endace.com>
- *                Koryn Grant      <support@endace.com>
- *                Stephen Donnelly <support@endace.com>
+ * Modifications: Jesper Peterson
+ *                Koryn Grant
+ *                Stephen Donnelly <stephen.donnelly@emulex.com>
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-	"@(#) $Header: /tcpdump/master/libpcap/pcap-dag.c,v 1.39 2008-04-14 20:40:58 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -45,6 +40,7 @@
 
 #include "dagnew.h"
 #include "dagapi.h"
+#include "dagpci.h"
 
 #include "pcap-dag.h"
 
@@ -155,7 +151,7 @@
 #ifdef HAVE_DAG_STREAMS_API
 		if(dag_stop_stream(p->fd, pd->dag_stream) < 0)
 			fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno));
-		
+
 		if(dag_detach_stream(p->fd, pd->dag_stream) < 0)
 			fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno));
 #else
@@ -226,7 +222,7 @@
 
 	/* loop over the extension headers */
 	do {
-	
+
 		/* sanity check we have enough bytes */
 		if ( len < (24 + (hdr_num * 8)) )
 			return hdr_num;
@@ -253,10 +249,11 @@
 	int flags = pd->dag_offset_flags;
 	unsigned int nonblocking = flags & DAGF_NONBLOCK;
 	unsigned int num_ext_hdr = 0;
+	unsigned int ticks_per_second;
 
 	/* Get the next bufferful of packets (if necessary). */
 	while (pd->dag_mem_top - pd->dag_mem_bottom < dag_record_size) {
- 
+
 		/*
 		 * Has "pcap_breakloop()" been called?
 		 */
@@ -295,7 +292,7 @@
 			/* Pcap is configured to process only available packets, and there aren't any, return immediately. */
 			return 0;
 		}
-		
+
 		if(!nonblocking &&
 		   pd->dag_timeout &&
 		   (pd->dag_mem_top - pd->dag_mem_bottom < dag_record_size))
@@ -305,14 +302,14 @@
 		}
 
 	}
-	
+
 	/* Process the packets. */
 	while (pd->dag_mem_top - pd->dag_mem_bottom >= dag_record_size) {
-		
+
 		unsigned short packet_len = 0;
 		int caplen = 0;
 		struct pcap_pkthdr	pcap_header;
-		
+
 #ifdef HAVE_DAG_STREAMS_API
 		dag_record_t *header = (dag_record_t *)(pd->dag_mem_bottom);
 #else
@@ -321,7 +318,7 @@
 
 		u_char *dp = ((u_char *)header); /* + dag_record_size; */
 		unsigned short rlen;
- 
+
 		/*
 		 * Has "pcap_breakloop()" been called?
 		 */
@@ -334,7 +331,7 @@
 			p->break_loop = 0;
 			return -2;
 		}
- 
+
 		rlen = ntohs(header->rlen);
 		if (rlen < dag_record_size)
 		{
@@ -364,7 +361,7 @@
 				}
 			}
 		}
-		
+
 		if ((header->type & 0x7f) == TYPE_PAD) {
 			continue;
 		}
@@ -372,13 +369,13 @@
 		num_ext_hdr = dag_erf_ext_header_count(dp, rlen);
 
 		/* ERF encapsulation */
-		/* The Extensible Record Format is not dropped for this kind of encapsulation, 
+		/* The Extensible Record Format is not dropped for this kind of encapsulation,
 		 * and will be handled as a pseudo header by the decoding application.
 		 * The information carried in the ERF header and in the optional subheader (if present)
 		 * could be merged with the libpcap information, to offer a better decoding.
 		 * The packet length is
 		 * o the length of the packet on the link (header->wlen),
-		 * o plus the length of the ERF header (dag_record_size), as the length of the 
+		 * o plus the length of the ERF header (dag_record_size), as the length of the
 		 *   pseudo header will be adjusted during the decoding,
 		 * o plus the length of the optional subheader (if present).
 		 *
@@ -420,7 +417,7 @@
 			dp += dag_record_size;
 			/* Skip over extension headers */
 			dp += 8 * num_ext_hdr;
-			
+
 			switch((header->type & 0x7f)) {
 			case TYPE_ATM:
 			case TYPE_AAL5:
@@ -439,19 +436,22 @@
 					caplen = rlen - dag_record_size - 4;
 					dp+=4;
 				}
+				/* Skip over extension headers */
+				caplen -= (8 * num_ext_hdr);
+
 				if (header->type == TYPE_ATM) {
 					caplen = packet_len = ATM_CELL_SIZE;
 				}
 				if (p->linktype == DLT_SUNATM) {
 					struct sunatm_hdr *sunatm = (struct sunatm_hdr *)dp;
 					unsigned long rawatm;
-					
+
 					rawatm = ntohl(*((unsigned long *)dp));
 					sunatm->vci = htons((rawatm >>  4) & 0xffff);
 					sunatm->vpi = (rawatm >> 20) & 0x00ff;
-					sunatm->flags = ((header->flags.iface & 1) ? 0x80 : 0x00) | 
+					sunatm->flags = ((header->flags.iface & 1) ? 0x80 : 0x00) |
 						((sunatm->vpi == 0 && sunatm->vci == htons(5)) ? 6 :
-						 ((sunatm->vpi == 0 && sunatm->vci == htons(16)) ? 5 : 
+						 ((sunatm->vpi == 0 && sunatm->vci == htons(16)) ? 5 :
 						  ((dp[ATM_HDR_SIZE] == 0xaa &&
 						    dp[ATM_HDR_SIZE+1] == 0xaa &&
 						    dp[ATM_HDR_SIZE+2] == 0x03) ? 2 : 1)));
@@ -470,6 +470,8 @@
 				packet_len = ntohs(header->wlen);
 				packet_len -= (pd->dag_fcs_bits >> 3);
 				caplen = rlen - dag_record_size - 2;
+				/* Skip over extension headers */
+				caplen -= (8 * num_ext_hdr);
 				if (caplen > packet_len) {
 					caplen = packet_len;
 				}
@@ -483,6 +485,8 @@
 				packet_len = ntohs(header->wlen);
 				packet_len -= (pd->dag_fcs_bits >> 3);
 				caplen = rlen - dag_record_size;
+				/* Skip over extension headers */
+				caplen -= (8 * num_ext_hdr);
 				if (caplen > packet_len) {
 					caplen = packet_len;
 				}
@@ -493,6 +497,8 @@
 				packet_len = ntohs(header->wlen);
 				packet_len -= (pd->dag_fcs_bits >> 3);
 				caplen = rlen - dag_record_size - 4;
+				/* Skip over extension headers */
+				caplen -= (8 * num_ext_hdr);
 				if (caplen > packet_len) {
 					caplen = packet_len;
 				}
@@ -503,7 +509,7 @@
 					/* Add the MTP2 Pseudo Header */
 					caplen += MTP2_HDR_LEN;
 					packet_len += MTP2_HDR_LEN;
-					
+
 					TempPkt[MTP2_SENT_OFFSET] = 0;
 					TempPkt[MTP2_ANNEX_A_USED_OFFSET] = MTP2_ANNEX_A_USED_UNKNOWN;
 					*(TempPkt+MTP2_LINK_NUMBER_OFFSET) = ((header->rec.mc_hdlc.mc_header>>16)&0x01);
@@ -518,6 +524,8 @@
 			case TYPE_IPV6:
 				packet_len = ntohs(header->wlen);
 				caplen = rlen - dag_record_size;
+				/* Skip over extension headers */
+				caplen -= (8 * num_ext_hdr);
 				if (caplen > packet_len) {
 					caplen = packet_len;
 				}
@@ -538,45 +546,52 @@
 				continue;
 			} /* switch type */
 
-			/* Skip over extension headers */
-			caplen -= (8 * num_ext_hdr);
-
 		} /* ERF encapsulation */
-		
+
 		if (caplen > p->snapshot)
 			caplen = p->snapshot;
 
 		/* Run the packet filter if there is one. */
 		if ((p->fcode.bf_insns == NULL) || bpf_filter(p->fcode.bf_insns, dp, packet_len, caplen)) {
-			
+
 			/* convert between timestamp formats */
 			register unsigned long long ts;
-				
+
 			if (IS_BIGENDIAN()) {
 				ts = SWAPLL(header->ts);
 			} else {
 				ts = header->ts;
 			}
 
+			switch (p->opt.tstamp_precision) {
+			case PCAP_TSTAMP_PRECISION_NANO:
+				ticks_per_second = 1000000000;
+				break;
+			case PCAP_TSTAMP_PRECISION_MICRO:
+			default:
+				ticks_per_second = 1000000;
+				break;
+
+			}
 			pcap_header.ts.tv_sec = ts >> 32;
-			ts = (ts & 0xffffffffULL) * 1000000;
+			ts = (ts & 0xffffffffULL) * ticks_per_second;
 			ts += 0x80000000; /* rounding */
-			pcap_header.ts.tv_usec = ts >> 32;		
-			if (pcap_header.ts.tv_usec >= 1000000) {
-				pcap_header.ts.tv_usec -= 1000000;
+			pcap_header.ts.tv_usec = ts >> 32;
+			if (pcap_header.ts.tv_usec >= ticks_per_second) {
+				pcap_header.ts.tv_usec -= ticks_per_second;
 				pcap_header.ts.tv_sec++;
 			}
 
 			/* Fill in our own header data */
 			pcap_header.caplen = caplen;
 			pcap_header.len = packet_len;
-	
+
 			/* Count the packet. */
 			pd->stat.ps_recv++;
-	
+
 			/* Call the user supplied callback function */
 			callback(user, &pcap_header, dp);
-	
+
 			/* Only count packets that pass the filter, for consistency with standard Linux behaviour. */
 			processed++;
 			if (processed == cnt && !PACKET_COUNT_IS_UNLIMITED(cnt))
@@ -603,7 +618,7 @@
  *  device will result in a failure.  The promisc flag is ignored because DAG
  *  cards are always promiscuous.  The to_ms parameter is used in setting the
  *  API polling parameters.
- *  
+ *
  *  snaplen is now also ignored, until we get per-stream slen support. Set
  *  slen with approprite DAG tool BEFORE pcap_activate().
  *
@@ -639,7 +654,7 @@
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't allocate string for device name: %s\n", pcap_strerror(errno));
 		goto fail;
 	}
-	
+
 	/* Parse input name to get dag device and stream number if provided */
 	if (dag_parse_name(device, newDev, strlen(device) + 16, &handlep->dag_stream) < 0) {
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_parse_name: %s\n", pcap_strerror(errno));
@@ -685,7 +700,7 @@
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_get_stream_poll: %s\n", pcap_strerror(errno));
 		goto faildetach;
 	}
-	
+
 	if (handle->opt.immediate) {
 		/* Call callback immediately.
 		 * XXX - is this the right way to handle this?
@@ -710,7 +725,7 @@
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_set_stream_poll: %s\n", pcap_strerror(errno));
 		goto faildetach;
 	}
-		
+
 #else
 	if((handlep->dag_mem_base = dag_mmap(handle->fd)) == MAP_FAILED) {
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,"dag_mmap %s: %s\n", device, pcap_strerror(errno));
@@ -733,14 +748,14 @@
 		handle->snapshot = MIN_DAG_SNAPLEN;
 	}
 	/* snap len has to be a multiple of 4 */
-	snprintf(conf, 30, "varlen slen=%d", (snaplen + 3) & ~3); 
+	snprintf(conf, 30, "varlen slen=%d", (snaplen + 3) & ~3);
 
 	if(dag_configure(handle->fd, conf) < 0) {
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,"dag_configure %s: %s\n", device, pcap_strerror(errno));
 		goto faildetach;
 	}
-#endif	
-	
+#endif
+
 #ifdef HAVE_DAG_STREAMS_API
 	if(dag_start_stream(handle->fd, handlep->dag_stream) < 0) {
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_start_stream %s: %s\n", device, pcap_strerror(errno));
@@ -807,7 +822,7 @@
 	handle->linktype = -1;
 	if (dag_get_datalink(handle) < 0)
 		goto failstop;
-	
+
 	handle->bufsize = 0;
 
 	if (new_pcap_dag(handle) < 0) {
@@ -838,12 +853,12 @@
 	handlep->stat.ps_ifdrop = 0;
 	return 0;
 
-#ifdef HAVE_DAG_STREAMS_API 
+#ifdef HAVE_DAG_STREAMS_API
 failstop:
 	if (dag_stop_stream(handle->fd, handlep->dag_stream) < 0) {
 		fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno));
 	}
-	
+
 faildetach:
 	if (dag_detach_stream(handle->fd, handlep->dag_stream) < 0)
 		fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno));
@@ -852,7 +867,7 @@
 	if (dag_stop(handle->fd) < 0)
 		fprintf(stderr,"dag_stop: %s\n", strerror(errno));
 #endif /* HAVE_DAG_STREAMS_API */
-	
+
 failclose:
 	if (dag_close(handle->fd) < 0)
 		fprintf(stderr,"dag_close: %s\n", strerror(errno));
@@ -922,6 +937,26 @@
 		return NULL;
 
 	p->activate_op = dag_activate;
+
+	/*
+	 * We claim that we support microsecond and nanosecond time
+	 * stamps.
+	 *
+	 * XXX Our native precision is 2^-32s, but libpcap doesn't support
+	 * power of two precisions yet. We can convert to either MICRO or NANO.
+	 */
+	p->tstamp_precision_count = 2;
+	p->tstamp_precision_list = malloc(2 * sizeof(u_int));
+	if (p->tstamp_precision_list == NULL) {
+		snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s",
+		    pcap_strerror(errno));
+		if (p->tstamp_type_list != NULL)
+			free(p->tstamp_type_list);
+		free(p);
+		return NULL;
+	}
+	p->tstamp_precision_list[0] = PCAP_TSTAMP_PRECISION_MICRO;
+	p->tstamp_precision_list[1] = PCAP_TSTAMP_PRECISION_NANO;
 	return p;
 }
 
@@ -934,9 +969,9 @@
 	*/
 	/*pd->stat.ps_recv = 0;*/
 	/*pd->stat.ps_drop = 0;*/
-	
+
 	*ps = pd->stat;
- 
+
 	return 0;
 }
 
@@ -958,6 +993,8 @@
 	char dagname[DAGNAME_BUFSIZE];
 	int dagstream;
 	int dagfd;
+	dag_card_inf_t *inf;
+	char *description;
 
 	/* Try all the DAGs 0-DAG_MAX_BOARDS */
 	for (c = 0; c < DAG_MAX_BOARDS; c++) {
@@ -966,8 +1003,11 @@
 		{
 			return -1;
 		}
+		description = NULL;
 		if ( (dagfd = dag_open(dagname)) >= 0 ) {
-			if (pcap_add_if(devlistp, name, 0, NULL, errbuf) == -1) {
+			if ((inf = dag_pciinfo(dagfd)))
+				description = dag_device_name(inf->device_code, 1);
+			if (pcap_add_if(devlistp, name, 0, description, errbuf) == -1) {
 				/*
 				 * Failure.
 				 */
@@ -982,19 +1022,19 @@
 						dag_detach_stream(dagfd, stream);
 
 						snprintf(name,  10, "dag%d:%d", c, stream);
-						if (pcap_add_if(devlistp, name, 0, NULL, errbuf) == -1) {
+						if (pcap_add_if(devlistp, name, 0, description, errbuf) == -1) {
 							/*
 							 * Failure.
 							 */
 							ret = -1;
 						}
-						
+
 						rxstreams--;
 						if(rxstreams <= 0) {
 							break;
 						}
 					}
-				}				
+				}
 			}
 #endif  /* HAVE_DAG_STREAMS_API */
 			dag_close(dagfd);
@@ -1054,13 +1094,13 @@
 		uint32_t mindata;
 		struct timeval maxwait;
 		struct timeval poll;
-		
+
 		if (dag_get_stream_poll(p->fd, pd->dag_stream,
 					&mindata, &maxwait, &poll) < 0) {
 			snprintf(errbuf, PCAP_ERRBUF_SIZE, "dag_get_stream_poll: %s\n", pcap_strerror(errno));
 			return -1;
 		}
-		
+
 		/* Amount of data to collect in Bytes before calling callbacks.
 		 * Important for efficiency, but can introduce latency
 		 * at low packet rates if to_ms not set!
@@ -1069,7 +1109,7 @@
 			mindata = 0;
 		else
 			mindata = 65536;
-		
+
 		if (dag_set_stream_poll(p->fd, pd->dag_stream,
 					mindata, &maxwait, &poll) < 0) {
 			snprintf(errbuf, PCAP_ERRBUF_SIZE, "dag_set_stream_poll: %s\n", pcap_strerror(errno));
@@ -1084,7 +1124,7 @@
 	}
 	return (0);
 }
-		
+
 static int
 dag_get_datalink(pcap_t *p)
 {
@@ -1105,18 +1145,18 @@
 	/* Get list of possible ERF types for this card */
 	if (dag_get_stream_erf_types(p->fd, pd->dag_stream, types, 255) < 0) {
 		snprintf(p->errbuf, sizeof(p->errbuf), "dag_get_stream_erf_types: %s", pcap_strerror(errno));
-		return (-1);		
+		return (-1);
 	}
-	
+
 	while (types[index]) {
 
 #elif defined HAVE_DAG_GET_ERF_TYPES
 	/* Get list of possible ERF types for this card */
 	if (dag_get_erf_types(p->fd, types, 255) < 0) {
 		snprintf(p->errbuf, sizeof(p->errbuf), "dag_get_erf_types: %s", pcap_strerror(errno));
-		return (-1);		
+		return (-1);
 	}
-	
+
 	while (types[index]) {
 #else
 	/* Check the type through a dagapi call. */
@@ -1162,7 +1202,7 @@
 				p->linktype = DLT_EN10MB;
 			break;
 
-		case TYPE_ATM: 
+		case TYPE_ATM:
 		case TYPE_AAL5:
 		case TYPE_MC_ATM:
 		case TYPE_MC_AAL5:
diff --git a/pcap-dag.h b/pcap-dag.h
index 4751186..68520dc 100644
--- a/pcap-dag.h
+++ b/pcap-dag.h
@@ -6,8 +6,6 @@
  * at the same time as another type of device.
  *
  * Author: Richard Littin, Sean Irvine ({richard,sean}@reeltwo.com)
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-dag.h,v 1.7 2008-04-04 19:37:45 guy Exp $ (LBL)
  */
 
 pcap_t *dag_create(const char *, char *, int *);
diff --git a/pcap-dbus.c b/pcap-dbus.c
index c878353..ab3f125 100644
--- a/pcap-dbus.c
+++ b/pcap-dbus.c
@@ -11,8 +11,8 @@
  * 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. The name of the author may not be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
  * permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -122,7 +122,7 @@
 
 	dbus_message_unref(msg);
 	return 0;
-}                           
+}
 
 static int
 dbus_stats(pcap_t *handle, struct pcap_stat *stats)
@@ -250,8 +250,8 @@
 {
 	pcap_t *p;
 
-	if (strcmp(device, "dbus-system") && 
-		strcmp(device, "dbus-session") && 
+	if (strcmp(device, "dbus-system") &&
+		strcmp(device, "dbus-session") &&
 		strncmp(device, "dbus://", 7))
 	{
 		*is_ours = 0;
@@ -267,7 +267,7 @@
 	return (p);
 }
 
-int 
+int
 dbus_findalldevs(pcap_if_t **alldevsp, char *err_str)
 {
 	if (pcap_add_if(alldevsp, "dbus-system", 0, "D-Bus system bus", err_str) < 0)
diff --git a/pcap-dlpi.c b/pcap-dlpi.c
index 8993134..c007135 100644
--- a/pcap-dlpi.c
+++ b/pcap-dlpi.c
@@ -68,11 +68,6 @@
  *      DL_HP_RAWDLS?
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.128 2008-12-02 16:20:23 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -303,7 +298,7 @@
 	ret = -1;
 #endif /* raw mode */
 	return (ret);
-}   
+}
 
 #ifndef DL_IPATM
 #define DL_IPATM	0x12	/* ATM Classical IP interface */
@@ -341,6 +336,8 @@
 #ifdef DL_HP_RAWDLS
 	struct pcap_dlpi *pd = p->priv;
 #endif
+	int status = 0;
+	int retv;
 	register char *cp;
 	int ppa;
 #ifdef HAVE_SOLARIS
@@ -359,7 +356,6 @@
 #ifndef HAVE_DEV_DLPI
 	char dname2[100];
 #endif
-	int status = PCAP_ERROR;
 
 #ifdef HAVE_DEV_DLPI
 	/*
@@ -397,6 +393,8 @@
 	if ((p->fd = open(cp, O_RDWR)) < 0) {
 		if (errno == EPERM || errno == EACCES)
 			status = PCAP_ERROR_PERM_DENIED;
+		else
+			status = PCAP_ERROR;
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
 		    "%s: %s", cp, pcap_strerror(errno));
 		goto bad;
@@ -461,6 +459,8 @@
 		if (errno != ENOENT) {
 			if (errno == EPERM || errno == EACCES)
 				status = PCAP_ERROR_PERM_DENIED;
+			else
+				status = PCAP_ERROR;
 			snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s", dname,
 			    pcap_strerror(errno));
 			goto bad;
@@ -497,6 +497,8 @@
 			} else {
 				if (errno == EPERM || errno == EACCES)
 					status = PCAP_ERROR_PERM_DENIED;
+				else
+					status = PCAP_ERROR;
 				snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
 				    dname2, pcap_strerror(errno));
 			}
@@ -511,21 +513,28 @@
 	** Attach if "style 2" provider
 	*/
 	if (dlinforeq(p->fd, p->errbuf) < 0 ||
-	    dlinfoack(p->fd, (char *)buf, p->errbuf) < 0)
+	    dlinfoack(p->fd, (char *)buf, p->errbuf) < 0) {
+		status = PCAP_ERROR;
 		goto bad;
+	}
 	infop = &(MAKE_DL_PRIMITIVES(buf))->info_ack;
 #ifdef HAVE_SOLARIS
 	if (infop->dl_mac_type == DL_IPATM)
 		isatm = 1;
 #endif
 	if (infop->dl_provider_style == DL_STYLE2) {
-		status = dl_doattach(p->fd, ppa, p->errbuf);
-		if (status < 0)
+		retv = dl_doattach(p->fd, ppa, p->errbuf);
+		if (retv < 0) {
+			status = retv;
 			goto bad;
+		}
 #ifdef DL_HP_RAWDLS
 		if (pd->send_fd >= 0) {
-			if (dl_doattach(pd->send_fd, ppa, p->errbuf) < 0)
+			retv = dl_doattach(pd->send_fd, ppa, p->errbuf);
+			if (retv < 0) {
+				status = retv;
 				goto bad;
+			}
 		}
 #endif
 	}
@@ -572,22 +581,28 @@
 	*/
 	if ((dlbindreq(p->fd, 1537, p->errbuf) < 0 &&
 	     dlbindreq(p->fd, 2, p->errbuf) < 0) ||
-	     dlbindack(p->fd, (char *)buf, p->errbuf, NULL) < 0)
+	     dlbindack(p->fd, (char *)buf, p->errbuf, NULL) < 0) {
+		status = PCAP_ERROR;
 		goto bad;
+	}
 #elif defined(DL_HP_RAWDLS)
 	/*
 	** HP-UX 10.0x and 10.1x.
 	*/
-	if (dl_dohpuxbind(p->fd, p->errbuf) < 0)
+	if (dl_dohpuxbind(p->fd, p->errbuf) < 0) {
+		status = PCAP_ERROR;
 		goto bad;
+	}
 	if (pd->send_fd >= 0) {
 		/*
 		** XXX - if this fails, just close send_fd and
 		** set it to -1, so that you can't send but can
 		** still receive?
 		*/
-		if (dl_dohpuxbind(pd->send_fd, p->errbuf) < 0)
+		if (dl_dohpuxbind(pd->send_fd, p->errbuf) < 0) {
+			status = PCAP_ERROR;
 			goto bad;
+		}
 	}
 #else /* neither AIX nor HP-UX */
 	/*
@@ -595,8 +610,10 @@
 	** OS using DLPI.
 	**/
 	if (dlbindreq(p->fd, 0, p->errbuf) < 0 ||
-	    dlbindack(p->fd, (char *)buf, p->errbuf, NULL) < 0)
+	    dlbindack(p->fd, (char *)buf, p->errbuf, NULL) < 0) {
+	    	status = PCAP_ERROR;
 		goto bad;
+	}
 #endif /* AIX vs. HP-UX vs. other */
 #endif /* !HP-UX 9 and !HP-UX 10.20 or later and !SINIX */
 
@@ -609,6 +626,7 @@
 		** help, and may break things.
 		*/
 		if (strioctl(p->fd, A_PROMISCON_REQ, 0, NULL) < 0) {
+			status = PCAP_ERROR;
 			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
 			    "A_PROMISCON_REQ: %s", pcap_strerror(errno));
 			goto bad;
@@ -619,10 +637,12 @@
 		/*
 		** Enable promiscuous (not necessary on send FD)
 		*/
-		status = dlpromiscon(p, DL_PROMISC_PHYS);
-		if (status < 0) {
-			if (status == PCAP_ERROR_PERM_DENIED)
+		retv = dlpromiscon(p, DL_PROMISC_PHYS);
+		if (retv < 0) {
+			if (retv == PCAP_ERROR_PERM_DENIED)
 				status = PCAP_ERROR_PROMISC_PERM_DENIED;
+			else
+				status = retv;
 			goto bad;
 		}
 
@@ -632,8 +652,8 @@
 		** HP-UX or SINIX) (Not necessary on send FD)
 		*/
 #if !defined(__hpux) && !defined(sinix)
-		status = dlpromiscon(p, DL_PROMISC_MULTI);
-		if (status < 0)
+		retv = dlpromiscon(p, DL_PROMISC_MULTI);
+		if (retv < 0)
 			status = PCAP_WARNING;
 #endif
 	}
@@ -653,16 +673,23 @@
 	/* Everything else (except for SINIX) - always do this */
 	{
 #endif
-		status = dlpromiscon(p, DL_PROMISC_SAP);
-		if (status < 0) {
-			/*
-			 * Not fatal, since the DL_PROMISC_PHYS mode worked.
-			 * Report it as a warning, however.
-			 */
-			if (p->opt.promisc)
+		retv = dlpromiscon(p, DL_PROMISC_SAP);
+		if (retv < 0) {
+			if (p->opt.promisc) {
+				/*
+				 * Not fatal, since the DL_PROMISC_PHYS mode
+				 * worked.
+				 *
+				 * Report it as a warning, however.
+				 */
 				status = PCAP_WARNING;
-			else
+			} else {
+				/*
+				 * Fatal.
+				 */
+				status = retv;
 				goto bad;
+			}
 		}
 	}
 #endif /* sinix */
@@ -672,8 +699,10 @@
 	** promiscuous options.
 	*/
 #if defined(HAVE_HPUX9) || defined(HAVE_HPUX10_20_OR_LATER)
-	if (dl_dohpuxbind(p->fd, p->errbuf) < 0)
+	if (dl_dohpuxbind(p->fd, p->errbuf) < 0) {
+		status = PCAP_ERROR;
 		goto bad;
+	}
 	/*
 	** We don't set promiscuous mode on the send FD, but we'll defer
 	** binding it anyway, just to keep the HP-UX 9/10.20 or later
@@ -685,8 +714,10 @@
 		** set it to -1, so that you can't send but can
 		** still receive?
 		*/
-		if (dl_dohpuxbind(pd->send_fd, p->errbuf) < 0)
+		if (dl_dohpuxbind(pd->send_fd, p->errbuf) < 0) {
+			status = PCAP_ERROR;
 			goto bad;
+		}
 	}
 #endif
 
@@ -696,12 +727,16 @@
 	** when sending packets.
 	*/
 	if (dlinforeq(p->fd, p->errbuf) < 0 ||
-	    dlinfoack(p->fd, (char *)buf, p->errbuf) < 0)
+	    dlinfoack(p->fd, (char *)buf, p->errbuf) < 0) {
+	    	status = PCAP_ERROR;
 		goto bad;
+	}
 
 	infop = &(MAKE_DL_PRIMITIVES(buf))->info_ack;
-	if (pcap_process_mactype(p, infop->dl_mac_type) != 0)
+	if (pcap_process_mactype(p, infop->dl_mac_type) != 0) {
+		status = PCAP_ERROR;
 		goto bad;
+	}
 
 #ifdef	DLIOCRAW
 	/*
@@ -709,6 +744,7 @@
 	** header.
 	*/
 	if (strioctl(p->fd, DLIOCRAW, 0, NULL) < 0) {
+		status = PCAP_ERROR;
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "DLIOCRAW: %s",
 		    pcap_strerror(errno));
 		goto bad;
@@ -739,28 +775,31 @@
 #endif
 
 	/* Push and configure bufmod. */
-	if (pcap_conf_bufmod(p, ss) != 0)
+	if (pcap_conf_bufmod(p, ss) != 0) {
+		status = PCAP_ERROR;
 		goto bad;
+	}
 #endif
 
 	/*
 	** As the last operation flush the read side.
 	*/
 	if (ioctl(p->fd, I_FLUSH, FLUSHR) != 0) {
+		status = PCAP_ERROR;
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "FLUSHR: %s",
 		    pcap_strerror(errno));
 		goto bad;
 	}
 
 	/* Allocate data buffer. */
-	if (pcap_alloc_databuf(p) != 0)
+	if (pcap_alloc_databuf(p) != 0) {
+		status = PCAP_ERROR;
 		goto bad;
-
-	/* Success - but perhaps with a warning */
-	if (status < 0)
-		status = 0;
+	}
 
 	/*
+	 * Success.
+	 *
 	 * "p->fd" is an FD for a STREAMS device, so "select()" and
 	 * "poll()" should work on it.
 	 */
diff --git a/pcap-dos.c b/pcap-dos.c
index cecc73c..8632cee 100644
--- a/pcap-dos.c
+++ b/pcap-dos.c
@@ -4,8 +4,6 @@
  *
  *  pcap-dos.c: Interface to PKTDRVR, NDIS2 and 32-bit pmode
  *              network drivers.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-dos.c,v 1.7 2008-04-22 17:16:30 guy Exp $ (LBL)
  */
 
 #include <stdio.h>
@@ -168,7 +166,7 @@
  * network packets.
  */
 static int pcap_activate_dos (pcap_t *pcap)
-{ 
+{
   struct pcap_dos *pcapd = pcap->priv;
 
   if (pcap->opt.rfmon) {
@@ -199,7 +197,7 @@
         !first_init(pcap->opt.source, pcap->errbuf, pcap->opt.promisc))
     {
       return (PCAP_ERROR);
-    } 
+    }
     atexit (close_driver);
   }
   else if (stricmp(active_dev->name,pcap->opt.source))
@@ -403,7 +401,7 @@
     strlcpy (p->errbuf, "pktdrvr doesn't have detailed statistics",
              PCAP_ERRBUF_SIZE);
     return (-1);
-  }             
+  }
   memcpy (se, (*dev->get_stats)(dev), sizeof(*se));
   return (0);
 }
@@ -522,7 +520,7 @@
   }
   ARGSUSED (device);
   return (0);
-}      
+}
 
 /*
  * Get a list of all interfaces that are present and that we probe okay.
@@ -962,7 +960,7 @@
    *            have default values. Should be taken from another
    *            ini-file/environment in any case (ref. tcpdump.ini)
    */
-  _watt_is_init = 1;  
+  _watt_is_init = 1;
 
   if (!using_pktdrv || !has_ip_addr)  /* for now .... */
   {
@@ -1094,7 +1092,7 @@
 
   if (!PktInitDriver(mode))
      return (0);
- 
+
   PktResetStatistics (pktInfo.handle);
   PktQueueBusy (FALSE);
   return (1);
@@ -1292,7 +1290,7 @@
               0,0,0,0,0,0,
               &cs89_dev,
               rtl8139_probe     /* dev->probe routine */
-            };            
+            };
 
 /*
  * Dequeue routine is called by polling.
diff --git a/pcap-dos.h b/pcap-dos.h
index f474437..bf47fb5 100644
--- a/pcap-dos.h
+++ b/pcap-dos.h
@@ -1,8 +1,6 @@
 /*
  * Internal details for libpcap on DOS.
  * 32-bit targets: djgpp, Pharlap or DOS4GW.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-dos.h,v 1.1 2004-12-18 08:52:10 guy Exp $ (LBL)
  */
 
 #ifndef __PCAP_DOS_H
@@ -216,7 +214,7 @@
   #define PCAP_ASSERT(x) ((void)0)
 
 #else
-  void pcap_assert (const char *what, const char *file, unsigned line);  
+  void pcap_assert (const char *what, const char *file, unsigned line);
 
   #define PCAP_ASSERT(x) do { \
                            if (!(x)) \
diff --git a/pcap-enet.c b/pcap-enet.c
index 5ad921c..777d3e3 100644
--- a/pcap-enet.c
+++ b/pcap-enet.c
@@ -6,10 +6,6 @@
  *
  * Rayan Zachariassen, CA*Net
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-enet.c,v 1.9 2006-10-04 18:09:22 guy Exp $";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/pcap-filter.manmisc.in b/pcap-filter.manmisc.in
index 5c11d5c..d740194 100644
--- a/pcap-filter.manmisc.in
+++ b/pcap-filter.manmisc.in
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap-filter.manmisc.in,v 1.1 2008-10-21 07:33:01 guy Exp $ (LBL)
-.\"
 .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\" All rights reserved.
@@ -20,7 +18,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP-FILTER @MAN_MISC_INFO@ "6 January 2008"
+.TH PCAP-FILTER @MAN_MISC_INFO@ "17 May 2013"
 .SH NAME
 pcap-filter \- packet filter syntax
 .br
@@ -332,8 +330,9 @@
 authentication header, routing header, or hop-by-hop option header,
 between IPv6 header and TCP header.
 The BPF code emitted by this primitive is complex and
-cannot be optimized by the BPF optimizer code, so this can be somewhat
-slow.
+cannot be optimized by the BPF optimizer code, and is not supported by
+filter engines in the kernel, so this can be somewhat slow, and may
+cause more packets to be dropped.
 .IP "\fBip protochain \fIprotocol\fR"
 Equivalent to \fBip6 protochain \fIprotocol\fR, but this is for IPv4.
 .IP "\fBprotochain \fIprotocol\fR"
@@ -453,6 +452,67 @@
 .IP "\fBdecnet host \fIhost\fR"
 True if either the DECNET source or destination address is
 .IR host .
+.IP \fBllc\fP
+True if the packet has an 802.2 LLC header.  This includes:
+.IP
+Ethernet packets with a length field rather than a type field that
+aren't raw NetWare-over-802.3 packets;
+.IP
+IEEE 802.11 data packets;
+.IP
+Token Ring packets (no check is done for LLC frames);
+.IP
+FDDI packets (no check is done for LLC frames);
+.IP
+LLC-encapsulated ATM packets, for SunATM on Solaris.
+.IP
+
+.IP "\fBllc\fP \Fitype\fR"
+True if the packet has an 802.2 LLC header and has the specified
+.IR type .
+.I type
+can be one of:
+.RS
+.TP
+\fBi\fR
+Information (I) PDUs
+.TP
+\fBs\fR
+Supervisory (S) PDUs
+.TP
+\fBu\fR
+Unnumbered (U) PDUs
+.TP
+\fBrr\fR
+Receiver Ready (RR) S PDUs
+.TP
+\fBrnr\fR
+Receiver Not Ready (RNR) S PDUs
+.TP
+\fBrej\fR
+Reject (REJ) S PDUs
+.TP
+\fBui\fR
+Unnumbered Information (UI) U PDUs
+.TP
+\fBua\fR
+Unnumbered Acknowledgment (UA) U PDUs
+.TP
+\fBdisc\fR
+Disconnect (DISC) U PDUs
+.TP
+\fBsabme\fR
+Set Asynchronous Balanced Mode Extended (SABME) U PDUs
+.TP
+\fBtest\fR
+Test (TEST) U PDUs
+.TP
+\fBxid\fR
+Exchange Identification (XID) U PDUs
+.TP
+\fBfrmr\fR
+Frame Reject (FRMR) U PDUs
+.RE
 .IP "\fBifname \fIinterface\fR"
 True if the packet was logged as coming from the specified interface (applies
 only to packets logged by OpenBSD's or FreeBSD's
@@ -487,7 +547,7 @@
 or FreeBSD's
 .BR pf (4)).
 .IP "\fBruleset \fIname\fR"
-Synonomous with the
+Synonymous with the
 .B rset
 modifier.
 .IP "\fBsrnr \fInum\fR"
@@ -496,7 +556,7 @@
 FreeBSD's
 .BR pf (4)).
 .IP "\fBsubrulenum \fInum\fR"
-Synonomous with the
+Synonymous with the
 .B srnr
 modifier.
 .IP "\fBaction \fIact\fR"
@@ -637,7 +697,7 @@
 the assumption that the packet is a MPLS-encapsulated IP packet.  The
 \fBmpls \fI[label_num]\fR expression may be used more than once, to
 filter on MPLS hierarchies.  Each use of that expression increments the
-filter offsets by 4. 
+filter offsets by 4.
 .IP
 For example:
 .in +.5i
@@ -673,6 +733,22 @@
 .fi
 .in -.5i
 filters IPv4 protocols encapsulated in PPPoE session id 0x27.
+.IP "\fBgeneve \fI[vni]\fR"
+True if the packet is a Geneve packet (UDP port 6081). If \fI[vni]\fR
+is specified, only true if the packet has the specified \fIvni\fR.
+Note that when the \fBgeneve\fR keyword is encountered in
+\fIexpression\fR, it changes the decoding offsets for the remainder of
+\fIexpression\fR on the assumption that the packet is a Geneve packet.
+.IP
+For example:
+.in +.5i
+.nf
+\fBgeneve 0xb && ip\fR
+.fi
+.in -.5i
+filters IPv4 protocols encapsulated in Geneve with VNI 0xb. This will
+match both IP directly encapsulated in Geneve as well as IP contained
+inside an Ethernet frame.
 .IP "\fBiso proto \fIprotocol\fR"
 True if the packet is an OSI packet of protocol type \fIprotocol\fP.
 \fIProtocol\fP can be a number or one of the names
@@ -704,9 +780,6 @@
 packet or a LANE LE Control packet.  If \fBlane\fR isn't specified, the
 tests are done under the assumption that the packet is an
 LLC-encapsulated packet.
-.IP \fBllc\fP
-True if the packet is an ATM packet, for SunATM on Solaris, and is
-an LLC-encapsulated packet.
 .IP \fBoamf4s\fP
 True if the packet is an ATM packet, for SunATM on Solaris, and is
 a segment OAM F4 flow cell (VPI=0 & VCI=3).
@@ -743,11 +816,17 @@
 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
+[+, -, *, /, %, &, |, ^, <<, >>], a length operator, and special packet data
 accessors.  Note that all comparisons are unsigned, so that, for example,
 0x80000000 and 0xffffffff are > 0.
-To access
-data inside the packet, use the following syntax:
+.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
+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
+To access data inside the packet, use the following syntax:
 .in +.5i
 .nf
 \fIproto\fB [ \fIexpr\fB : \fIsize\fB ]\fR
diff --git a/pcap-int.h b/pcap-int.h
index 0c27ec7..2f71e11 100644
--- a/pcap-int.h
+++ b/pcap-int.h
@@ -29,8 +29,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.94 2008-09-16 00:20:23 guy Exp $ (LBL)
  */
 
 #ifndef pcap_int_h
@@ -84,6 +82,29 @@
 
 #endif /* _MSC_VER */
 
+/*
+ * Maximum snapshot length.
+ *
+ * Somewhat arbitrary, but chosen to be:
+ *
+ *    1) big enough for maximum-size Linux loopback packets (65549)
+ *       and some USB packets captured with USBPcap:
+ *
+ *           http://desowin.org/usbpcap/
+ *
+ *       (> 131072, < 262144)
+ *
+ * and
+ *
+ *    2) small enough not to cause attempts to allocate huge amounts of
+ *       memory; some applications might use the snapshot length in a
+ *       savefile header to control the size of the buffer they allocate,
+ *       so a size of, say, 2^31-1 might not work well.
+ *
+ * We don't enforce this in pcap_set_snaplen(), but we use it internally.
+ */
+#define MAXIMUM_SNAPLEN		262144
+
 struct pcap_opt {
 	char	*source;
 	int	timeout;	/* timeout for buffering */
@@ -182,6 +203,11 @@
 	pcap_direction_t direction;
 
 	/*
+	 * Flags to affect BPF code generation.
+	 */
+	int bpf_codegen_flags;
+
+	/*
 	 * Placeholder for filter code if bpf not in kernel.
 	 */
 	struct bpf_program fcode;
@@ -228,6 +254,11 @@
 };
 
 /*
+ * BPF code generation flags.
+ */
+#define BPF_SPECIAL_VLAN_HANDLING	0x00000001	/* special VLAN handling for Linux */
+
+/*
  * This is a timeval as stored in a savefile.
  * It has to use the same types everywhere, independent of the actual
  * `struct timeval'; `struct timeval' has 32-bit tv_sec values on some
@@ -387,6 +418,9 @@
 int	add_addr_to_iflist(pcap_if_t **, const char *, u_int, struct sockaddr *,
 	    size_t, struct sockaddr *, size_t, struct sockaddr *, size_t,
 	    struct sockaddr *, size_t, char *);
+int	add_addr_to_dev(pcap_if_t *, struct sockaddr *, size_t,
+	    struct sockaddr *, size_t, struct sockaddr *, size_t,
+	    struct sockaddr *dstaddr, size_t, char *errbuf);
 int	pcap_add_if(pcap_if_t **, const char *, u_int, const char *, char *);
 struct sockaddr *dup_sockaddr(struct sockaddr *, size_t);
 int	add_or_find_if(pcap_if_t **, pcap_if_t **, const char *, u_int,
diff --git a/pcap-libdlpi.c b/pcap-libdlpi.c
index 5bc9374..333e532 100644
--- a/pcap-libdlpi.c
+++ b/pcap-libdlpi.c
@@ -24,11 +24,6 @@
  * Packet capture routines for DLPI using libdlpi under SunOS 5.11.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-	"@(#) $Header: /tcpdump/master/libpcap/pcap-libdlpi.c,v 1.6 2008-04-14 20:40:58 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -101,10 +96,10 @@
 pcap_activate_libdlpi(pcap_t *p)
 {
 	struct pcap_dlpi *pd = p->priv;
+	int status = 0;
 	int retv;
 	dlpi_handle_t dh;
 	dlpi_info_t dlinfo;
-	int err = PCAP_ERROR;
 
 	/*
 	 * Enable Solaris raw and passive DLPI extensions;
@@ -114,13 +109,15 @@
 	retv = dlpi_open(p->opt.source, &dh, DLPI_RAW|DLPI_PASSIVE);
 	if (retv != DLPI_SUCCESS) {
 		if (retv == DLPI_ELINKNAMEINVAL || retv == DLPI_ENOLINK)
-			err = PCAP_ERROR_NO_SUCH_DEVICE;
+			status = PCAP_ERROR_NO_SUCH_DEVICE;
 		else if (retv == DL_SYSERR &&
 		    (errno == EPERM || errno == EACCES))
-			err = PCAP_ERROR_PERM_DENIED;
+			status = PCAP_ERROR_PERM_DENIED;
+		else
+			status = PCAP_ERROR;
 		pcap_libdlpi_err(p->opt.source, "dlpi_open", retv,
 		    p->errbuf);
-		return (err);
+		return (status);
 	}
 	pd->dlpi_hd = dh;
 
@@ -129,20 +126,21 @@
 		 * This device exists, but we don't support monitor mode
 		 * any platforms that support DLPI.
 		 */
-		err = PCAP_ERROR_RFMON_NOTSUP;
+		status = PCAP_ERROR_RFMON_NOTSUP;
 		goto bad;
 	}
 
 	/* Bind with DLPI_ANY_SAP. */
 	if ((retv = dlpi_bind(pd->dlpi_hd, DLPI_ANY_SAP, 0)) != DLPI_SUCCESS) {
+		status = PCAP_ERROR;
 		pcap_libdlpi_err(p->opt.source, "dlpi_bind", retv, p->errbuf);
 		goto bad;
 	}
 
 	/* Enable promiscuous mode. */
 	if (p->opt.promisc) {
-		err = dlpromiscon(p, DL_PROMISC_PHYS);
-		if (err < 0) {
+		retv = dlpromiscon(p, DL_PROMISC_PHYS);
+		if (retv < 0) {
 			/*
 			 * "You don't have permission to capture on
 			 * this device" and "you don't have permission
@@ -156,57 +154,71 @@
 			 * XXX - you might have to capture in
 			 * promiscuous mode to see outgoing packets.
 			 */
-			if (err == PCAP_ERROR_PERM_DENIED)
-				err = PCAP_ERROR_PROMISC_PERM_DENIED;
+			if (retv == PCAP_ERROR_PERM_DENIED)
+				status = PCAP_ERROR_PROMISC_PERM_DENIED;
+			else
+				status = retv;
 			goto bad;
 		}
 	} else {
 		/* Try to enable multicast. */
-		err = dlpromiscon(p, DL_PROMISC_MULTI);
-		if (err < 0)
+		retv = dlpromiscon(p, DL_PROMISC_MULTI);
+		if (retv < 0) {
+			status = retv;
 			goto bad;
+		}
 	}
 
 	/* Try to enable SAP promiscuity. */
-	err = dlpromiscon(p, DL_PROMISC_SAP);
-	if (err < 0) {
+	retv = dlpromiscon(p, DL_PROMISC_SAP);
+	if (retv < 0) {
 		/*
 		 * Not fatal, since the DL_PROMISC_PHYS mode worked.
 		 * Report it as a warning, however.
 		 */
 		if (p->opt.promisc)
-			err = PCAP_WARNING;
-		else
+			status = PCAP_WARNING;
+		else {
+			status = retv;
 			goto bad;
+		}
 	}
 
 	/* Determine link type.  */
 	if ((retv = dlpi_info(pd->dlpi_hd, &dlinfo, 0)) != DLPI_SUCCESS) {
+		status = PCAP_ERROR;
 		pcap_libdlpi_err(p->opt.source, "dlpi_info", retv, p->errbuf);
 		goto bad;
 	}
 
-	if (pcap_process_mactype(p, dlinfo.di_mactype) != 0)
+	if (pcap_process_mactype(p, dlinfo.di_mactype) != 0) {
+		status = PCAP_ERROR;
 		goto bad;
+	}
 
 	p->fd = dlpi_fd(pd->dlpi_hd);
 
 	/* Push and configure bufmod. */
-	if (pcap_conf_bufmod(p, p->snapshot) != 0)
+	if (pcap_conf_bufmod(p, p->snapshot) != 0) {
+		status = PCAP_ERROR;
 		goto bad;
+	}
 
 	/*
 	 * Flush the read side.
 	 */
 	if (ioctl(p->fd, I_FLUSH, FLUSHR) != 0) {
+		status = PCAP_ERROR;
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "FLUSHR: %s",
 		    pcap_strerror(errno));
 		goto bad;
 	}
 
 	/* Allocate data buffer. */
-	if (pcap_alloc_databuf(p) != 0)
+	if (pcap_alloc_databuf(p) != 0) {
+		status = PCAP_ERROR;
 		goto bad;
+	}
 
 	/*
 	 * "p->fd" is a FD for a STREAMS device, so "select()" and
@@ -224,10 +236,10 @@
 	p->stats_op = pcap_stats_dlpi;
 	p->cleanup_op = pcap_cleanup_libdlpi;
 
-	return (0);
+	return (status);
 bad:
 	pcap_cleanup_libdlpi(p);
-	return (err);
+	return (status);
 }
 
 #define STRINGIFY(n)	#n
diff --git a/pcap-linktype.manmisc.in b/pcap-linktype.manmisc.in
index 8904387..e42c5b3 100644
--- a/pcap-linktype.manmisc.in
+++ b/pcap-linktype.manmisc.in
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap-linktype.manmisc.in,v 1.3 2008-10-27 22:52:30 guy Exp $
-.\"
 .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\" All rights reserved.
@@ -20,7 +18,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP-LINKTYPE @MAN_MISC_INFO@ "23 October 2008"
+.TH PCAP-LINKTYPE @MAN_MISC_INFO@ "12 March 2011"
 .SH NAME
 pcap-linktype \- link-layer header types supported by libpcap
 .SH DESCRIPTION
diff --git a/pcap-linux.c b/pcap-linux.c
index dc42735..a226da1 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -25,10 +25,10 @@
  *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  *  Modifications:     Added PACKET_MMAP support
- *                     Paolo Abeni <paolo.abeni@email.it> 
+ *                     Paolo Abeni <paolo.abeni@email.it>
  *                     Added TPACKET_V3 support
  *                     Gabor Tatarka <gabor.tatarka@ericsson.com>
- *                     
+ *
  *                     based on previous works of:
  *                     Simon Patarin <patarin@cs.unibo.it>
  *                     Phil Wood <cpw@lanl.gov>
@@ -47,7 +47,7 @@
  * 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. 
+ *    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.
@@ -56,22 +56,17 @@
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.  
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  * IN NO EVENT SHALL THE AUTHOR 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, 
+ * 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.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.164 2008-12-14 22:00:57 guy Exp $ (LBL)";
-#endif
-
 /*
  * Known problems with 2.0[.x] kernels:
  *
@@ -193,9 +188,10 @@
 # endif /* PACKET_HOST */
 
 
- /* check for memory mapped access avaibility. We assume every needed 
+ /* check for memory mapped access avaibility. We assume every needed
   * struct is defined if the macro TPACKET_HDRLEN is defined, because it
   * uses many ring related structs and macros */
+# ifdef PCAP_SUPPORT_PACKET_RING
 # ifdef TPACKET_HDRLEN
 #  define HAVE_PACKET_RING
 #  ifdef TPACKET3_HDRLEN
@@ -207,6 +203,7 @@
 #   define TPACKET_V1	0    /* Old kernel with only V1, so no TPACKET_Vn defined */
 #  endif /* TPACKET2_HDRLEN */
 # endif /* TPACKET_HDRLEN */
+# endif /* PCAP_SUPPORT_PACKET_RING */
 #endif /* PF_PACKET */
 
 #ifdef SO_ATTACH_FILTER
@@ -218,6 +215,14 @@
 #include <linux/net_tstamp.h>
 #endif
 
+#ifdef HAVE_LINUX_SOCKIOS_H
+#include <linux/sockios.h>
+#endif
+
+#ifdef HAVE_LINUX_IF_BONDING_H
+#include <linux/if_bonding.h>
+#endif
+
 /*
  * Got Wireless Extensions?
  */
@@ -321,7 +326,7 @@
 /*
  * Prototypes for internal functions and methods.
  */
-static void map_arphrd_to_dlt(pcap_t *, int, int);
+static void map_arphrd_to_dlt(pcap_t *, int, int, const char *, int);
 #ifdef HAVE_PF_PACKET_SOCKETS
 static short int map_packet_type_to_sll_type(short int);
 #endif
@@ -339,8 +344,30 @@
 static int pcap_set_datalink_linux(pcap_t *, int);
 static void pcap_cleanup_linux(pcap_t *);
 
+/*
+ * This is what the header structure looks like in a 64-bit kernel;
+ * we use this, rather than struct tpacket_hdr, if we're using
+ * TPACKET_V1 in 32-bit code running on a 64-bit kernel.
+ */
+struct tpacket_hdr_64 {
+	uint64_t	tp_status;
+	unsigned int	tp_len;
+	unsigned int	tp_snaplen;
+	unsigned short	tp_mac;
+	unsigned short	tp_net;
+	unsigned int	tp_sec;
+	unsigned int	tp_usec;
+};
+
+/*
+ * We use this internally as the tpacket version for TPACKET_V1 in
+ * 32-bit code on a 64-bit kernel.
+ */
+#define TPACKET_V1_64 99
+
 union thdr {
 	struct tpacket_hdr		*h1;
+	struct tpacket_hdr_64		*h1_64;
 #ifdef HAVE_TPACKET2
 	struct tpacket2_hdr		*h2;
 #endif
@@ -358,6 +385,7 @@
 static int prepare_tpacket_socket(pcap_t *handle);
 static void pcap_cleanup_linux_mmap(pcap_t *);
 static int pcap_read_linux_mmap_v1(pcap_t *, int, pcap_handler , u_char *);
+static int pcap_read_linux_mmap_v1_64(pcap_t *, int, pcap_handler , u_char *);
 #ifdef HAVE_TPACKET2
 static int pcap_read_linux_mmap_v2(pcap_t *, int, pcap_handler , u_char *);
 #endif
@@ -371,6 +399,12 @@
     const u_char *bytes);
 #endif
 
+#ifdef TP_STATUS_VLAN_TPID_VALID
+# define VLAN_TPID(hdr, hv)	(((hv)->tp_vlan_tpid || ((hdr)->tp_status & TP_STATUS_VLAN_TPID_VALID)) ? (hv)->tp_vlan_tpid : ETH_P_8021Q)
+#else
+# define VLAN_TPID(hdr, hv)	ETH_P_8021Q
+#endif
+
 /*
  * Wrap some ioctl calls
  */
@@ -387,7 +421,12 @@
 static int	enter_rfmon_mode(pcap_t *handle, int sock_fd,
     const char *device);
 #endif /* HAVE_PF_PACKET_SOCKETS */
+#if defined(HAVE_LINUX_NET_TSTAMP_H) && defined(PACKET_TIMESTAMP)
+static int	iface_ethtool_get_ts_info(pcap_t *handle, char *ebuf);
+#endif
+#ifdef HAVE_PACKET_RING
 static int	iface_get_offload(pcap_t *handle);
+#endif
 static int 	iface_bind_old(int fd, const char *device, char *ebuf);
 
 #ifdef SO_ATTACH_FILTER
@@ -414,26 +453,15 @@
 
 	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)
 	/*
-	 * We claim that we support:
-	 *
-	 *	software time stamps, with no details about their precision;
-	 *	hardware time stamps, synced to the host time;
-	 *	hardware time stamps, not synced to the host time.
-	 *
-	 * XXX - we can't ask a device whether it supports
-	 * hardware time stamps, so we just claim all devices do.
+	 * See what time stamp types we support.
 	 */
-	handle->tstamp_type_count = 3;
-	handle->tstamp_type_list = malloc(3 * sizeof(u_int));
-	if (handle->tstamp_type_list == NULL) {
+	if (iface_ethtool_get_ts_info(handle, ebuf) == -1) {
 		free(handle);
 		return NULL;
 	}
-	handle->tstamp_type_list[0] = PCAP_TSTAMP_HOST;
-	handle->tstamp_type_list[1] = PCAP_TSTAMP_ADAPTER;
-	handle->tstamp_type_list[2] = PCAP_TSTAMP_ADAPTER_UNSYNCED;
 #endif
 
 #if defined(SIOCGSTAMPNS) && defined(SO_TIMESTAMPNS)
@@ -448,6 +476,8 @@
 	handle->tstamp_precision_count = 2;
 	handle->tstamp_precision_list = malloc(2 * sizeof(u_int));
 	if (handle->tstamp_precision_list == NULL) {
+		snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s",
+		    pcap_strerror(errno));
 		if (handle->tstamp_type_list != NULL)
 			free(handle->tstamp_type_list);
 		free(handle);
@@ -871,7 +901,7 @@
 	 * Now configure the monitor interface up.
 	 */
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, handlep->mondevice, sizeof(ifr.ifr_name));
+	strlcpy(ifr.ifr_name, handlep->mondevice, sizeof(ifr.ifr_name));
 	if (ioctl(sock_fd, SIOCGIFFLAGS, &ifr) == -1) {
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
 		    "%s: Can't get flags for %s: %s", device,
@@ -912,6 +942,41 @@
 }
 #endif /* HAVE_LIBNL */
 
+#ifdef IW_MODE_MONITOR
+/*
+ * Bonding devices mishandle unknown ioctls; they fail with ENODEV
+ * rather than ENOTSUP, EOPNOTSUPP, or ENOTTY, so Wireless Extensions
+ * will fail with ENODEV if we try to do them on a bonding device,
+ * making us return a "no such device" indication rather than just
+ * saying "no Wireless Extensions".
+ *
+ * So we check for bonding devices, if we can, before trying those
+ * ioctls, by trying a bonding device information query ioctl to see
+ * whether it succeeds.
+ */
+static int
+is_bonding_device(int fd, const char *device)
+{
+#if defined(BOND_INFO_QUERY_OLD) || defined(SIOCBONDINFOQUERY)
+	struct ifreq ifr;
+	ifbond ifb;
+
+	memset(&ifr, 0, sizeof ifr);
+	strlcpy(ifr.ifr_name, device, sizeof ifr.ifr_name);
+	memset(&ifb, 0, sizeof ifb);
+	ifr.ifr_data = (caddr_t)&ifb;
+#ifdef SIOCBONDINFOQUERY
+	if (ioctl(fd, SIOCBONDINFOQUERY, &ifr) == 0)
+#else /* SIOCBONDINFOQUERY */
+	if (ioctl(fd, BOND_INFO_QUERY_OLD, &ifr) == 0)
+#endif /* SIOCBONDINFOQUERY */
+		return 1;	/* success, so it's a bonding device */
+#endif /* defined(BOND_INFO_QUERY_OLD) || defined(SIOCBONDINFOQUERY) */
+
+	return 0;	/* no, it's not a bonding device */
+}
+#endif /* IW_MODE_MONITOR */
+
 static int
 pcap_can_set_rfmon_linux(pcap_t *handle)
 {
@@ -970,12 +1035,17 @@
 		return PCAP_ERROR;
 	}
 
+	if (is_bonding_device(sock_fd, handle->opt.source)) {
+		/* It's a bonding device, so don't even try. */
+		close(sock_fd);
+		return 0;
+	}
+
 	/*
 	 * Attempt to get the current mode.
 	 */
-	strncpy(ireq.ifr_ifrn.ifrn_name, handle->opt.source,
+	strlcpy(ireq.ifr_ifrn.ifrn_name, handle->opt.source,
 	    sizeof ireq.ifr_ifrn.ifrn_name);
-	ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 	if (ioctl(sock_fd, SIOCGIWMODE, &ireq) != -1) {
 		/*
 		 * Well, we got the mode; assume we can set it.
@@ -1011,7 +1081,7 @@
 	FILE * file;
 	int field_to_convert = 3, if_name_sz = strlen(if_name);
 	long int dropped_pkts = 0;
-	
+
 	file = fopen("/proc/net/dev", "r");
 	if (!file)
 		return 0;
@@ -1026,7 +1096,7 @@
 			field_to_convert = 4;
 			continue;
 		}
-	
+
 		/* find iface and make sure it actually matches -- space before the name and : after it */
 		if ((bufptr = strstr(buffer, if_name)) &&
 			(bufptr == buffer || *(bufptr-1) == ' ') &&
@@ -1040,20 +1110,20 @@
 				while (*bufptr != '\0' && *(bufptr++) == ' ');
 				while (*bufptr != '\0' && *(bufptr++) != ' ');
 			}
-			
+
 			/* get rid of any final spaces */
 			while (*bufptr != '\0' && *bufptr == ' ') bufptr++;
-			
+
 			if (*bufptr != '\0')
 				dropped_pkts = strtol(bufptr, NULL, 10);
 
 			break;
 		}
 	}
-	
+
 	fclose(file);
 	return dropped_pkts;
-} 
+}
 
 
 /*
@@ -1097,7 +1167,7 @@
 			 * in 2.0[.x] kernels.
 			 */
 			memset(&ifr, 0, sizeof(ifr));
-			strncpy(ifr.ifr_name, handlep->device,
+			strlcpy(ifr.ifr_name, handlep->device,
 			    sizeof(ifr.ifr_name));
 			if (ioctl(handle->fd, SIOCGIFFLAGS, &ifr) == -1) {
 				fprintf(stderr,
@@ -1161,7 +1231,7 @@
 			 */
 			oldflags = 0;
 			memset(&ifr, 0, sizeof(ifr));
-			strncpy(ifr.ifr_name, handlep->device,
+			strlcpy(ifr.ifr_name, handlep->device,
 			    sizeof(ifr.ifr_name));
 			if (ioctl(handle->fd, SIOCGIFFLAGS, &ifr) != -1) {
 				if (ifr.ifr_flags & IFF_UP) {
@@ -1175,10 +1245,8 @@
 			/*
 			 * Now restore the mode.
 			 */
-			strncpy(ireq.ifr_ifrn.ifrn_name, handlep->device,
+			strlcpy(ireq.ifr_ifrn.ifrn_name, handlep->device,
 			    sizeof ireq.ifr_ifrn.ifrn_name);
-			ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1]
-			    = 0;
 			ireq.u.mode = handlep->oldmode;
 			if (ioctl(handle->fd, SIOCSIWMODE, &ireq) == -1) {
 				/*
@@ -1237,10 +1305,28 @@
 {
 	struct pcap_linux *handlep = handle->priv;
 	const char	*device;
+	struct ifreq	ifr;
 	int		status = 0;
+	int		ret;
 
 	device = handle->opt.source;
 
+	/*
+	 * Make sure the name we were handed will fit into the ioctls we
+	 * might perform on the device; if not, return a "No such device"
+	 * indication, as the Linux kernel shouldn't support creating
+	 * a device whose name won't fit into those ioctls.
+	 *
+	 * "Will fit" means "will fit, complete with a null terminator",
+	 * so if the length, which does *not* include the null terminator,
+	 * is greater than *or equal to* the size of the field into which
+	 * we'll be copying it, that won't fit.
+	 */
+	if (strlen(device) >= sizeof(ifr.ifr_name)) {
+		status = PCAP_ERROR_NO_SUCH_DEVICE;
+		goto fail;
+	}
+
 	handle->inject_op = pcap_inject_linux;
 	handle->setfilter_op = pcap_setfilter_linux;
 	handle->setdirection_op = pcap_setdirection_linux;
@@ -1272,12 +1358,12 @@
 			 pcap_strerror(errno) );
 		return PCAP_ERROR;
 	}
-	
+
 	/* copy timeout value */
 	handlep->timeout = handle->opt.timeout;
 
 	/*
-	 * If we're in promiscuous mode, then we probably want 
+	 * If we're in promiscuous mode, then we probably want
 	 * to see when the interface drops packets too, so get an
 	 * initial count from /proc/net/dev
 	 */
@@ -1293,16 +1379,17 @@
 	 * to be compatible with older kernels for a while so we are
 	 * trying both methods with the newer method preferred.
 	 */
-	status = activate_new(handle);
-	if (status < 0) {
+	ret = activate_new(handle);
+	if (ret < 0) {
 		/*
 		 * Fatal error with the new way; just fail.
-		 * status has the error return; if it's PCAP_ERROR,
+		 * ret has the error return; if it's PCAP_ERROR,
 		 * handle->errbuf has been set appropriately.
 		 */
+		status = ret;
 		goto fail;
 	}
-	if (status == 1) {
+	if (ret == 1) {
 		/*
 		 * Success.
 		 * Try to use memory-mapped access.
@@ -1329,21 +1416,23 @@
 			/*
 			 * We failed to set up to use it, or the kernel
 			 * supports it, but we failed to enable it.
-			 * status has been set to the error status to
+			 * ret has been set to the error status to
 			 * return and, if it's PCAP_ERROR, handle->errbuf
 			 * contains the error message.
 			 */
+			status = ret;
 			goto fail;
 		}
 	}
-	else if (status == 0) {
+	else if (ret == 0) {
 		/* Non-fatal error; try old way */
-		if ((status = activate_old(handle)) != 1) {
+		if ((ret = activate_old(handle)) != 1) {
 			/*
 			 * Both methods to open the packet socket failed.
 			 * Tidy up and report our failure (handle->errbuf
 			 * is expected to be set by the functions above).
 			 */
+			status = ret;
 			goto fail;
 		}
 	}
@@ -1351,7 +1440,6 @@
 	/*
 	 * We set up the socket, but not with memory-mapped access.
 	 */
-	status = 0;
 	if (handle->opt.buffer_size != 0) {
 		/*
 		 * Set the socket buffer size to the specified value.
@@ -1478,6 +1566,7 @@
 	int			packet_len, caplen;
 	struct pcap_pkthdr	pcap_header;
 
+        struct bpf_aux_data     aux_data;
 #ifdef HAVE_PF_PACKET_SOCKETS
 	/*
 	 * If this is a cooked device, leave extra room for a
@@ -1658,9 +1747,14 @@
 			memmove(bp, bp + VLAN_TAG_LEN, handlep->vlan_offset);
 
 			tag = (struct vlan_tag *)(bp + handlep->vlan_offset);
-			tag->vlan_tpid = htons(ETH_P_8021Q);
+			tag->vlan_tpid = htons(VLAN_TPID(aux, aux));
 			tag->vlan_tci = htons(aux->tp_vlan_tci);
 
+                        /* store vlan tci to bpf_aux_data struct for userland bpf filter */
+#if defined(TP_STATUS_VLAN_VALID)
+                        aux_data.vlan_tag = htons(aux->tp_vlan_tci) & 0x0fff;
+                        aux_data.vlan_tag_present = (aux->tp_status & TP_STATUS_VLAN_VALID);
+#endif
 			packet_len += VLAN_TAG_LEN;
 		}
 	}
@@ -1694,8 +1788,8 @@
 	 *
 	 * We currently handle this by making a copy of the filter
 	 * program, fixing all "ret" instructions with non-zero
-	 * operands to have an operand of 65535 so that the filter
-	 * doesn't truncate the packet, and supplying that modified
+	 * operands to have an operand of MAXIMUM_SNAPLEN so that the
+	 * filter doesn't truncate the packet, and supplying that modified
 	 * filter to the kernel.
 	 */
 
@@ -1705,9 +1799,8 @@
 
 	/* Run the packet filter if not using kernel filter */
 	if (handlep->filter_in_userland && handle->fcode.bf_insns) {
-		if (bpf_filter(handle->fcode.bf_insns, bp,
-		                packet_len, caplen) == 0)
-		{
+		if (bpf_filter_with_aux_data(handle->fcode.bf_insns, bp,
+		    packet_len, caplen, &aux_data) == 0) {
 			/* rejected by filter */
 			return 0;
 		}
@@ -1830,7 +1923,7 @@
 		return (-1);
 	}
 	return (ret);
-}                           
+}
 
 /*
  *  Get the statistics for the given packet capture handle.
@@ -1868,8 +1961,8 @@
 #endif /* HAVE_TPACKET_STATS */
 
 	long if_dropped = 0;
-	
-	/* 
+
+	/*
 	 *	To fill in ps_ifdrop, we parse /proc/net/dev for the number
 	 */
 	if (handle->opt.promisc)
@@ -1899,7 +1992,7 @@
 		 *	dropped by the interface driver.  It counts only
 		 *	packets that passed the filter.
 		 *
-		 *	See above for ps_ifdrop. 
+		 *	See above for ps_ifdrop.
 		 *
 		 *	Both statistics include packets not yet read from
 		 *	the kernel by libpcap, and thus not yet seen by
@@ -1928,7 +2021,7 @@
 		 * "tp_packets" as the count of packets and "tp_drops"
 		 * as the count of drops.
 		 *
-		 * Keep a running total because each call to 
+		 * Keep a running total because each call to
 		 *    getsockopt(handle->fd, SOL_PACKET, PACKET_STATISTICS, ....
 		 * resets the counters to zero.
 		 */
@@ -1974,16 +2067,87 @@
 	 * We maintain the count of packets processed by libpcap in
 	 * "handlep->packets_read", for reasons described in the comment
 	 * at the end of pcap_read_packet().  We have no idea how many
-	 * packets were dropped by the kernel buffers -- but we know 
+	 * packets were dropped by the kernel buffers -- but we know
 	 * how many the interface dropped, so we can return that.
 	 */
-	 
+
 	stats->ps_recv = handlep->packets_read;
 	stats->ps_drop = 0;
 	stats->ps_ifdrop = handlep->stat.ps_ifdrop;
 	return 0;
 }
 
+static int
+add_linux_if(pcap_if_t **devlistp, const char *ifname, int fd, char *errbuf)
+{
+	const char *p;
+	char name[512];	/* XXX - pick a size */
+	char *q, *saveq;
+	struct ifreq ifrflags;
+
+	/*
+	 * Get the interface name.
+	 */
+	p = ifname;
+	q = &name[0];
+	while (*p != '\0' && isascii(*p) && !isspace(*p)) {
+		if (*p == ':') {
+			/*
+			 * This could be the separator between a
+			 * name and an alias number, or it could be
+			 * the separator between a name with no
+			 * alias number and the next field.
+			 *
+			 * If there's a colon after digits, it
+			 * separates the name and the alias number,
+			 * otherwise it separates the name and the
+			 * next field.
+			 */
+			saveq = q;
+			while (isascii(*p) && isdigit(*p))
+				*q++ = *p++;
+			if (*p != ':') {
+				/*
+				 * That was the next field,
+				 * not the alias number.
+				 */
+				q = saveq;
+			}
+			break;
+		} else
+			*q++ = *p++;
+	}
+	*q = '\0';
+
+	/*
+	 * Get the flags for this interface.
+	 */
+	strlcpy(ifrflags.ifr_name, name, sizeof(ifrflags.ifr_name));
+	if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifrflags) < 0) {
+		if (errno == ENXIO || errno == ENODEV)
+			return (0);	/* device doesn't actually exist - ignore it */
+		(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
+		    "SIOCGIFFLAGS: %.*s: %s",
+		    (int)sizeof(ifrflags.ifr_name),
+		    ifrflags.ifr_name,
+		    pcap_strerror(errno));
+		return (-1);
+	}
+
+	/*
+	 * Add an entry for this interface, with no addresses.
+	 */
+	if (pcap_add_if(devlistp, name, ifrflags.ifr_flags, NULL,
+	    errbuf) == -1) {
+		/*
+		 * Failure.
+		 */
+		return (-1);
+	}
+
+	return (0);
+}
+
 /*
  * Get from "/sys/class/net" all interfaces listed there; if they're
  * already in the list of interfaces we have, that won't add another
@@ -1997,6 +2161,8 @@
  * We also don't fail if we couldn't open "/sys/class/net"; we just leave
  * the list of interfaces as is, and return 0, so that we can try
  * scanning /proc/net/dev.
+ *
+ * Otherwise, we return 1 if we don't get an error and -1 if we do.
  */
 static int
 scan_sys_class_net(pcap_if_t **devlistp, char *errbuf)
@@ -2006,10 +2172,6 @@
 	struct dirent *ent;
 	char subsystem_path[PATH_MAX+1];
 	struct stat statb;
-	char *p;
-	char name[512];	/* XXX - pick a size */
-	char *q, *saveq;
-	struct ifreq ifrflags;
 	int ret = 1;
 
 	sys_class_net_d = opendir("/sys/class/net");
@@ -2087,66 +2249,10 @@
 		}
 
 		/*
-		 * Get the interface name.
+		 * Attempt to add the interface.
 		 */
-		p = &ent->d_name[0];
-		q = &name[0];
-		while (*p != '\0' && isascii(*p) && !isspace(*p)) {
-			if (*p == ':') {
-				/*
-				 * This could be the separator between a
-				 * name and an alias number, or it could be
-				 * the separator between a name with no
-				 * alias number and the next field.
-				 *
-				 * If there's a colon after digits, it
-				 * separates the name and the alias number,
-				 * otherwise it separates the name and the
-				 * next field.
-				 */
-				saveq = q;
-				while (isascii(*p) && isdigit(*p))
-					*q++ = *p++;
-				if (*p != ':') {
-					/*
-					 * That was the next field,
-					 * not the alias number.
-					 */
-					q = saveq;
-				}
-				break;
-			} else
-				*q++ = *p++;
-		}
-		*q = '\0';
-
-		/*
-		 * Get the flags for this interface, and skip it if
-		 * it's not up.
-		 */
-		strncpy(ifrflags.ifr_name, name, sizeof(ifrflags.ifr_name));
-		if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifrflags) < 0) {
-			if (errno == ENXIO || errno == ENODEV)
-				continue;
-			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
-			    "SIOCGIFFLAGS: %.*s: %s",
-			    (int)sizeof(ifrflags.ifr_name),
-			    ifrflags.ifr_name,
-			    pcap_strerror(errno));
-			ret = -1;
-			break;
-		}
-		if (!(ifrflags.ifr_flags & IFF_UP))
-			continue;
-
-		/*
-		 * Add an entry for this interface, with no addresses.
-		 */
-		if (pcap_add_if(devlistp, name, ifrflags.ifr_flags, NULL,
-		    errbuf) == -1) {
-			/*
-			 * Failure.
-			 */
+		if (add_linux_if(devlistp, &ent->d_name[0], fd, errbuf) == -1) {
+			/* Fail. */
 			ret = -1;
 			break;
 		}
@@ -2184,9 +2290,6 @@
 	char linebuf[512];
 	int linenum;
 	char *p;
-	char name[512];	/* XXX - pick a size */
-	char *q, *saveq;
-	struct ifreq ifrflags;
 	int ret = 0;
 
 	proc_net_f = fopen("/proc/net/dev", "r");
@@ -2235,65 +2338,10 @@
 			continue;	/* blank line */
 
 		/*
-		 * Get the interface name.
+		 * Attempt to add the interface.
 		 */
-		q = &name[0];
-		while (*p != '\0' && isascii(*p) && !isspace(*p)) {
-			if (*p == ':') {
-				/*
-				 * This could be the separator between a
-				 * name and an alias number, or it could be
-				 * the separator between a name with no
-				 * alias number and the next field.
-				 *
-				 * If there's a colon after digits, it
-				 * separates the name and the alias number,
-				 * otherwise it separates the name and the
-				 * next field.
-				 */
-				saveq = q;
-				while (isascii(*p) && isdigit(*p))
-					*q++ = *p++;
-				if (*p != ':') {
-					/*
-					 * That was the next field,
-					 * not the alias number.
-					 */
-					q = saveq;
-				}
-				break;
-			} else
-				*q++ = *p++;
-		}
-		*q = '\0';
-
-		/*
-		 * Get the flags for this interface, and skip it if
-		 * it's not up.
-		 */
-		strncpy(ifrflags.ifr_name, name, sizeof(ifrflags.ifr_name));
-		if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifrflags) < 0) {
-			if (errno == ENXIO)
-				continue;
-			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
-			    "SIOCGIFFLAGS: %.*s: %s",
-			    (int)sizeof(ifrflags.ifr_name),
-			    ifrflags.ifr_name,
-			    pcap_strerror(errno));
-			ret = -1;
-			break;
-		}
-		if (!(ifrflags.ifr_flags & IFF_UP))
-			continue;
-
-		/*
-		 * Add an entry for this interface, with no addresses.
-		 */
-		if (pcap_add_if(devlistp, name, ifrflags.ifr_flags, NULL,
-		    errbuf) == -1) {
-			/*
-			 * Failure.
-			 */
+		if (add_linux_if(devlistp, p, fd, errbuf) == -1) {
+			/* Fail. */
 			ret = -1;
 			break;
 		}
@@ -2348,7 +2396,8 @@
 	/*
 	 * Add the "any" device.
 	 */
-	if (pcap_add_if(alldevsp, "any", 0, any_descr, errbuf) < 0)
+	if (pcap_add_if(alldevsp, "any", IFF_UP|IFF_RUNNING,
+	    any_descr, errbuf) < 0)
 		return (-1);
 
 	return (0);
@@ -2371,7 +2420,7 @@
 	if (!handle)
 		return -1;
 	if (!filter) {
-	        strncpy(handle->errbuf, "setfilter: No filter specified",
+	        strlcpy(handle->errbuf, "setfilter: No filter specified",
 			PCAP_ERRBUF_SIZE);
 		return -1;
 	}
@@ -2414,12 +2463,13 @@
 		 * of different size. Pointed out by Sebastian
 		 *
 		 * Oh, and we also need to fix it up so that all "ret"
-		 * instructions with non-zero operands have 65535 as the
-		 * operand if we're not capturing in memory-mapped modee,
-		 * and so that, if we're in cooked mode, all memory-reference
-		 * instructions use special magic offsets in references to
-		 * the link-layer header and assume that the link-layer
-		 * payload begins at 0; "fix_program()" will do that.
+		 * instructions with non-zero operands have MAXIMUM_SNAPLEN
+		 * as the operand if we're not capturing in memory-mapped
+		 * mode, and so that, if we're in cooked mode, all memory-
+		 * reference instructions use special magic offsets in
+		 * references to the link-layer header and assume that the
+		 * link-layer payload begins at 0; "fix_program()" will do
+		 * that.
 		 */
 		switch (fix_program(handle, &fcode, is_mmapped)) {
 
@@ -2505,8 +2555,14 @@
 	 * calling "pcap_setfilter()".  Otherwise, the kernel filter may
 	 * filter out packets that would pass the new userland filter.
 	 */
-	if (handlep->filter_in_userland)
-		reset_kernel_filter(handle);
+	if (handlep->filter_in_userland) {
+		if (reset_kernel_filter(handle) == -1) {
+			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+			    "can't remove kernel filter: %s",
+			    pcap_strerror(errno));
+			err = -2;	/* fatal error */
+		}
+	}
 
 	/*
 	 * Free up the copy of the filter that was made by "fix_program()".
@@ -2588,6 +2644,51 @@
 }
 #endif
 
+static int
+is_wifi(int sock_fd
+#ifndef IW_MODE_MONITOR
+_U_
+#endif
+, const char *device)
+{
+	char *pathstr;
+	struct stat statb;
+#ifdef IW_MODE_MONITOR
+	char errbuf[PCAP_ERRBUF_SIZE];
+#endif
+
+	/*
+	 * See if there's a sysfs wireless directory for it.
+	 * If so, it's a wireless interface.
+	 */
+	if (asprintf(&pathstr, "/sys/class/net/%s/wireless", device) == -1) {
+		/*
+		 * Just give up here.
+		 */
+		return 0;
+	}
+	if (stat(pathstr, &statb) == 0) {
+		free(pathstr);
+		return 1;
+	}
+	free(pathstr);
+
+#ifdef IW_MODE_MONITOR
+	/*
+	 * OK, maybe it's not wireless, or maybe this kernel doesn't
+	 * support sysfs.  Try the wireless extensions.
+	 */
+	if (has_wext(sock_fd, device, errbuf) == 1) {
+		/*
+		 * It supports the wireless extensions, so it's a Wi-Fi
+		 * device.
+		 */
+		return 1;
+	}
+#endif
+	return 0;
+}
+
 /*
  *  Linux uses the ARP hardware type to identify the type of an
  *  interface. pcap uses the DLT_xxx constants for this. This
@@ -2606,13 +2707,33 @@
  *
  *  Sets the link type to -1 if unable to map the type.
  */
-static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok)
+static void map_arphrd_to_dlt(pcap_t *handle, int sock_fd, int arptype,
+			      const char *device, int cooked_ok)
 {
+	static const char cdma_rmnet[] = "cdma_rmnet";
+
 	switch (arptype) {
 
 	case ARPHRD_ETHER:
 		/*
-		 * This is (presumably) a real Ethernet capture; give it a
+		 * For various annoying reasons having to do with DHCP
+		 * software, some versions of Android give the mobile-
+		 * phone-network interface an ARPHRD_ value of
+		 * ARPHRD_ETHER, even though the packets supplied by
+		 * that interface have no link-layer header, and begin
+		 * with an IP header, so that the ARPHRD_ value should
+		 * be ARPHRD_NONE.
+		 *
+		 * Detect those devices by checking the device name, and
+		 * use DLT_RAW for them.
+		 */
+		if (strncmp(device, cdma_rmnet, sizeof cdma_rmnet - 1) == 0) {
+			handle->linktype = DLT_RAW;
+			return;
+		}
+
+		/*
+		 * Is this a real Ethernet device?  If so, give it a
 		 * link-layer-type list with DLT_EN10MB and DLT_DOCSIS, so
 		 * that an application can let you choose it, in case you're
 		 * capturing DOCSIS traffic that a Cisco Cable Modem
@@ -2621,21 +2742,27 @@
 		 * DOCSIS frames out on the wire inside the low-level
 		 * Ethernet framing).
 		 *
-		 * XXX - are there any sorts of "fake Ethernet" that have
-		 * ARPHRD_ETHER but that *shouldn't offer DLT_DOCSIS as
+		 * 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_new()",
-		 * as we fall back on cooked mode there; are there any
+		 * as we fall back on cooked mode there, and we use
+		 * is_wifi() to check for 802.11 devices; are there any
 		 * others?
 		 */
-		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_EN10MB;
-			handle->dlt_list[1] = DLT_DOCSIS;
-			handle->dlt_count = 2;
+		if (!is_wifi(sock_fd, device)) {
+			/*
+			 * It's not a Wi-Fi device; offer DOCSIS.
+			 */
+			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_EN10MB;
+				handle->dlt_list[1] = DLT_DOCSIS;
+				handle->dlt_count = 2;
+			}
 		}
 		/* FALLTHROUGH */
 
@@ -2944,7 +3071,9 @@
 		/* Don't expect IP packet out of this interfaces... */
 		handle->linktype = DLT_LINUX_IRDA;
 		/* We need to save packet direction for IrDA decoding,
-		 * so let's use "Linux-cooked" mode. Jean II */
+		 * so let's use "Linux-cooked" mode. Jean II
+		 *
+		 * XXX - this is handled in activate_new(). */
 		//handlep->cooked = 1;
 		break;
 
@@ -2976,6 +3105,21 @@
                handle->linktype =  DLT_IEEE802_15_4_NOFCS;
                break;
 
+#ifndef ARPHRD_NETLINK
+#define ARPHRD_NETLINK	824
+#endif
+	case ARPHRD_NETLINK:
+		handle->linktype = DLT_NETLINK;
+		/*
+		 * We need to use cooked mode, so that in sll_protocol we
+		 * pick up the netlink protocol type such as NETLINK_ROUTE,
+		 * NETLINK_GENERIC, NETLINK_FIB_LOOKUP, etc.
+		 *
+		 * XXX - this is handled in activate_new().
+		 */
+		//handlep->cooked = 1;
+		break;
+
 	default:
 		handle->linktype = -1;
 		break;
@@ -3004,6 +3148,10 @@
 #endif
 	int			err = 0;
 	struct packet_mreq	mr;
+#ifdef SO_BPF_EXTENSIONS
+	int			bpf_extensions;
+	socklen_t		len = sizeof(bpf_extensions);
+#endif
 
 	/*
 	 * Open a socket with protocol family packet. If the
@@ -3107,11 +3255,12 @@
 			close(sock_fd);
 			return arptype;
 		}
-		map_arphrd_to_dlt(handle, arptype, 1);
+		map_arphrd_to_dlt(handle, sock_fd, arptype, device, 1);
 		if (handle->linktype == -1 ||
 		    handle->linktype == DLT_LINUX_SLL ||
 		    handle->linktype == DLT_LINUX_IRDA ||
 		    handle->linktype == DLT_LINUX_LAPD ||
+		    handle->linktype == DLT_NETLINK ||
 		    (handle->linktype == DLT_EN10MB &&
 		     (strncmp("isdn", device, 4) == 0 ||
 		      strncmp("isdY", device, 4) == 0))) {
@@ -3181,7 +3330,8 @@
 			 * same applies to LAPD capture.
 			 */
 			if (handle->linktype != DLT_LINUX_IRDA &&
-			    handle->linktype != DLT_LINUX_LAPD)
+			    handle->linktype != DLT_LINUX_LAPD &&
+			    handle->linktype != DLT_NETLINK)
 				handle->linktype = DLT_LINUX_SLL;
 		}
 
@@ -3208,6 +3358,7 @@
 			/*
 			 * It doesn't support monitor mode.
 			 */
+			close(sock_fd);
 			return PCAP_ERROR_RFMON_NOTSUP;
 		}
 
@@ -3314,23 +3465,43 @@
 		break;
 	}
 
-	/* Save the socket FD in the pcap structure */
-	handle->fd = sock_fd;
-
 #if defined(SIOCGSTAMPNS) && defined(SO_TIMESTAMPNS)
 	if (handle->opt.tstamp_precision == PCAP_TSTAMP_PRECISION_NANO) {
 		int nsec_tstamps = 1;
 
-		if (setsockopt(handle->fd, SOL_SOCKET, SO_TIMESTAMPNS, &nsec_tstamps, sizeof(nsec_tstamps)) < 0) {
+		if (setsockopt(sock_fd, SOL_SOCKET, SO_TIMESTAMPNS, &nsec_tstamps, sizeof(nsec_tstamps)) < 0) {
 			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "setsockopt: unable to set SO_TIMESTAMPNS");
+			close(sock_fd);
 			return PCAP_ERROR;
 		}
 	}
 #endif /* defined(SIOCGSTAMPNS) && defined(SO_TIMESTAMPNS) */
 
+	/*
+	 * We've succeeded. Save the socket FD in the pcap structure.
+	 */
+	handle->fd = sock_fd;
+
+#ifdef SO_BPF_EXTENSIONS
+	/*
+	 * Can we generate special code for VLAN checks?
+	 * (XXX - what if we need the special code but it's not supported
+	 * by the OS?  Is that possible?)
+	 */
+	if (getsockopt(sock_fd, SOL_SOCKET, SO_BPF_EXTENSIONS,
+	    &bpf_extensions, &len) == 0) {
+		if (bpf_extensions >= SKF_AD_VLAN_TAG_PRESENT) {
+			/*
+			 * Yes, we can.  Request that we do so.
+			 */
+			handle->bpf_codegen_flags |= BPF_SPECIAL_VLAN_HANDLING;
+		}
+	}
+#endif /* SO_BPF_EXTENSIONS */
+
 	return 1;
 #else /* HAVE_PF_PACKET_SOCKETS */
-	strncpy(ebuf,
+	strlcpy(ebuf,
 		"New packet capturing interface not supported by build "
 		"environment", PCAP_ERRBUF_SIZE);
 	return 0;
@@ -3350,7 +3521,7 @@
  * On error, returns -1, and sets *status to the appropriate error code;
  * if that is PCAP_ERROR, sets handle->errbuf to the appropriate message.
  */
-static int 
+static int
 activate_mmap(pcap_t *handle, int *status)
 {
 	struct pcap_linux *handlep = handle->priv;
@@ -3411,6 +3582,9 @@
 	case TPACKET_V1:
 		handle->read_op = pcap_read_linux_mmap_v1;
 		break;
+	case TPACKET_V1_64:
+		handle->read_op = pcap_read_linux_mmap_v1_64;
+		break;
 #ifdef HAVE_TPACKET2
 	case TPACKET_V2:
 		handle->read_op = pcap_read_linux_mmap_v2;
@@ -3431,7 +3605,7 @@
 	return 1;
 }
 #else /* HAVE_PACKET_RING */
-static int 
+static int
 activate_mmap(pcap_t *handle _U_, int *status _U_)
 {
 	return 0;
@@ -3455,7 +3629,10 @@
 	int val = version;
 	socklen_t len = sizeof(val);
 
-	/* Probe whether kernel supports the specified TPACKET version */
+	/*
+	 * Probe whether kernel supports the specified TPACKET version;
+	 * this also gets the length of the header for that version.
+	 */
 	if (getsockopt(handle->fd, SOL_PACKET, PACKET_HDRLEN, &val, &len) < 0) {
 		if (errno == ENOPROTOOPT || errno == EINVAL)
 			return 1;	/* no */
@@ -3495,6 +3672,36 @@
 #endif /* defined HAVE_TPACKET2 || defined HAVE_TPACKET3 */
 
 /*
+ * If the instruction set for which we're compiling has both 32-bit
+ * and 64-bit versions, and Linux support for the 64-bit version
+ * predates TPACKET_V2, define ISA_64_BIT as the .machine value
+ * you get from uname() for the 64-bit version.  Otherwise, leave
+ * it undefined.  (This includes ARM, which has a 64-bit version,
+ * but Linux support for it appeared well after TPACKET_V2 support
+ * did, so there should never be a case where 32-bit ARM code is
+ * running o a 64-bit kernel that only supports TPACKET_V1.)
+ *
+ * If we've omitted your favorite such architecture, please contribute
+ * a patch.  (No patch is needed for architectures that are 32-bit-only
+ * or for which Linux has no support for 32-bit userland - or for which,
+ * as noted, 64-bit support appeared in Linux after TPACKET_V2 support
+ * did.)
+ */
+#if defined(__i386__)
+#define ISA_64_BIT	"x86_64"
+#elif defined(__ppc__)
+#define ISA_64_BIT	"ppc64"
+#elif defined(__sparc__)
+#define ISA_64_BIT	"sparc64"
+#elif defined(__s390__)
+#define ISA_64_BIT	"s390x"
+#elif defined(__mips__)
+#define ISA_64_BIT	"mips64"
+#elif defined(__hppa__)
+#define ISA_64_BIT	"parisc64"
+#endif
+
+/*
  * Attempt to set the socket to version 3 of the memory-mapped header and,
  * if that fails because version 3 isn't supported, attempt to fall
  * back to version 2.  If version 2 isn't supported, just leave it at
@@ -3511,11 +3718,10 @@
 	int ret;
 #endif
 
-	handlep->tp_version = TPACKET_V1;
-	handlep->tp_hdrlen = sizeof(struct tpacket_hdr);
-
 #ifdef HAVE_TPACKET3
 	/*
+	 * Try setting the version to TPACKET_V3.
+	 *
 	 * The only mode in which buffering is done on PF_PACKET
 	 * sockets, so that packets might not be delivered
 	 * immediately, is TPACKET_V3 mode.
@@ -3524,28 +3730,87 @@
 	 * if the user has requested immediate mode, we don't
 	 * use TPACKET_V3.
 	 */
-	if (handle->opt.immediate)
-		ret = 1; /* pretend TPACKET_V3 couldn't be set */
-	else
+	if (!handle->opt.immediate) {
 		ret = init_tpacket(handle, TPACKET_V3, "TPACKET_V3");
-	if (-1 == ret) {
-		/* Error during setting up TPACKET_V3. */
-		return -1;
-	} else if (1 == ret) {
-		/* TPACKET_V3 not supported - fall back to TPACKET_V2. */
+		if (ret == 0) {
+			/*
+			 * Success.
+			 */
+			return 1;
+		}
+		if (ret == -1) {
+			/*
+			 * We failed for some reason other than "the
+			 * kernel doesn't support TPACKET_V3".
+			 */
+			return -1;
+		}
+	}
 #endif /* HAVE_TPACKET3 */
 
 #ifdef HAVE_TPACKET2
-		ret = init_tpacket(handle, TPACKET_V2, "TPACKET_V2");
-		if (-1 == ret) {
-			/* Error during setting up TPACKET_V2. */
-			return -1;
-		}
+	/*
+	 * Try setting the version to TPACKET_V2.
+	 */
+	ret = init_tpacket(handle, TPACKET_V2, "TPACKET_V2");
+	if (ret == 0) {
+		/*
+		 * Success.
+		 */
+		return 1;
+	}
+	if (ret == -1) {
+		/*
+		 * We failed for some reason other than "the
+		 * kernel doesn't support TPACKET_V2".
+		 */
+		return -1;
+	}
 #endif /* HAVE_TPACKET2 */
 
-#ifdef HAVE_TPACKET3
+	/*
+	 * OK, we're using TPACKET_V1, as that's all the kernel supports.
+	 */
+	handlep->tp_version = TPACKET_V1;
+	handlep->tp_hdrlen = sizeof(struct tpacket_hdr);
+
+#ifdef ISA_64_BIT
+	/*
+	 * 32-bit userspace + 64-bit kernel + TPACKET_V1 are not compatible with
+	 * each other due to platform-dependent data type size differences.
+	 *
+	 * If we have a 32-bit userland and a 64-bit kernel, use an
+	 * internally-defined TPACKET_V1_64, with which we use a 64-bit
+	 * version of the data structures.
+	 */
+	if (sizeof(long) == 4) {
+		/*
+		 * This is 32-bit code.
+		 */
+		struct utsname utsname;
+
+		if (uname(&utsname) == -1) {
+			/*
+			 * Failed.
+			 */
+			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+			    "uname failed: %s", pcap_strerror(errno));
+			return -1;
+		}
+		if (strcmp(utsname.machine, ISA_64_BIT) == 0) {
+			/*
+			 * uname() tells us the machine is 64-bit,
+			 * so we presumably have a 64-bit kernel.
+			 *
+			 * XXX - this presumes that uname() won't lie
+			 * in 32-bit code and claim that the machine
+			 * has the 32-bit version of the ISA.
+			 */
+			handlep->tp_version = TPACKET_V1_64;
+			handlep->tp_hdrlen = sizeof(struct tpacket_hdr_64);
+		}
 	}
-#endif /* HAVE_TPACKET3 */
+#endif
 
 	return 1;
 }
@@ -3589,6 +3854,7 @@
 	switch (handlep->tp_version) {
 
 	case TPACKET_V1:
+	case TPACKET_V1_64:
 #ifdef HAVE_TPACKET2
 	case TPACKET_V2:
 #endif
@@ -3716,18 +3982,24 @@
 		 * We pick a "frame" size of 128K to leave enough
 		 * room for at least one reasonably-sized packet
 		 * in the "frame". */
-		req.tp_frame_size = 131072;
+		req.tp_frame_size = MAXIMUM_SNAPLEN;
 		req.tp_frame_nr = handle->opt.buffer_size/req.tp_frame_size;
 		break;
 #endif
+	default:
+		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+		    "Internal error: unknown TPACKET_ value %u",
+		    handlep->tp_version);
+		*status = PCAP_ERROR;
+		return -1;
 	}
 
-	/* compute the minumum block size that will handle this frame. 
-	 * The block has to be page size aligned. 
-	 * The max block size allowed by the kernel is arch-dependent and 
+	/* compute the minumum block size that will handle this frame.
+	 * The block has to be page size aligned.
+	 * The max block size allowed by the kernel is arch-dependent and
 	 * it's not explicitly checked here. */
 	req.tp_block_size = getpagesize();
-	while (req.tp_block_size < req.tp_frame_size) 
+	while (req.tp_block_size < req.tp_frame_size)
 		req.tp_block_size <<= 1;
 
 	frames_per_block = req.tp_block_size/req.tp_frame_size;
@@ -3768,7 +4040,7 @@
 		hwconfig.rx_filter = HWTSTAMP_FILTER_ALL;
 
 		memset(&ifr, 0, sizeof(ifr));
-		strcpy(ifr.ifr_name, handle->opt.source);
+		strlcpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name));
 		ifr.ifr_data = (void *)&hwconfig;
 
 		if (ioctl(handle->fd, SIOCSHWTSTAMP, &ifr) < 0) {
@@ -3825,8 +4097,8 @@
 			}
 			if (setsockopt(handle->fd, SOL_PACKET, PACKET_TIMESTAMP,
 				(void *)&timesource, sizeof(timesource))) {
-				snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, 
-					"can't set PACKET_TIMESTAMP: %s", 
+				snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+					"can't set PACKET_TIMESTAMP: %s",
 					pcap_strerror(errno));
 				*status = PCAP_ERROR;
 				return -1;
@@ -3841,7 +4113,7 @@
 
 	/* req.tp_frame_nr is requested to match frames_per_block*req.tp_block_nr */
 	req.tp_frame_nr = req.tp_block_nr * frames_per_block;
-	
+
 #ifdef HAVE_TPACKET3
 	/* timeout value to retire block - use the configured buffering timeout, or default if <0. */
 	req.tp_retire_blk_tov = (handlep->timeout>=0)?handlep->timeout:0;
@@ -3933,13 +4205,14 @@
 	/* tell the kernel to destroy the ring*/
 	struct tpacket_req req;
 	memset(&req, 0, sizeof(req));
-	setsockopt(handle->fd, SOL_PACKET, PACKET_RX_RING,
+	/* do not test for setsockopt failure, as we can't recover from any error */
+	(void)setsockopt(handle->fd, SOL_PACKET, PACKET_RX_RING,
 				(void *) &req, sizeof(req));
 
 	/* if ring is mapped, unmap it*/
 	if (handlep->mmapbuf) {
 		/* do not test for mmap failure, as we can't recover from any error */
-		munmap(handlep->mmapbuf, handlep->mmapbuflen);
+		(void)munmap(handlep->mmapbuf, handlep->mmapbuflen);
 		handlep->mmapbuf = NULL;
 	}
 }
@@ -3973,7 +4246,7 @@
 	memcpy(handlep->oneshot_buffer, bytes, h->caplen);
 	*sp->pkt = handlep->oneshot_buffer;
 }
-    
+
 static void
 pcap_cleanup_linux_mmap( pcap_t *handle )
 {
@@ -4003,6 +4276,13 @@
 	struct pcap_linux *handlep = p->priv;
 
 	/*
+	 * Set the file descriptor to non-blocking mode, as we use
+	 * it for sending packets.
+	 */
+	if (pcap_setnonblock_fd(p, nonblock, errbuf) == -1)
+		return -1;
+
+	/*
 	 * Map each value to their corresponding negation to
 	 * preserve the timeout value provided with pcap_set_timeout.
 	 */
@@ -4035,6 +4315,11 @@
 						TP_STATUS_KERNEL))
 			return NULL;
 		break;
+	case TPACKET_V1_64:
+		if (status != (h.h1_64->tp_status ? TP_STATUS_USER :
+						TP_STATUS_KERNEL))
+			return NULL;
+		break;
 #ifdef HAVE_TPACKET2
 	case TPACKET_V2:
 		if (status != (h.h2->tp_status ? TP_STATUS_USER :
@@ -4179,7 +4464,8 @@
 		unsigned int tp_sec,
 		unsigned int tp_usec,
 		int tp_vlan_tci_valid,
-		__u16 tp_vlan_tci)
+		__u16 tp_vlan_tci,
+		__u16 tp_vlan_tpid)
 {
 	struct pcap_linux *handlep = handle->priv;
 	unsigned char *bp;
@@ -4190,7 +4476,7 @@
 	if (tp_mac + tp_snaplen > handle->bufsize) {
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
 			"corrupted frame on kernel ring mac "
-			"offset %d + caplen %d > frame len %d",
+			"offset %u + caplen %u > frame len %d",
 			tp_mac, tp_snaplen, handle->bufsize);
 		return -1;
 	}
@@ -4205,22 +4491,9 @@
 	 * the filter when the ring became empty, but it can possibly
 	 * happen a lot later... */
 	bp = frame + tp_mac;
-	if (handlep->filter_in_userland && handle->fcode.bf_insns &&
-			(bpf_filter(handle->fcode.bf_insns, bp,
-				tp_len, tp_snaplen) == 0))
-		return 0;
-
-	sll = (void *)frame + TPACKET_ALIGN(handlep->tp_hdrlen);
-	if (!linux_check_direction(handle, sll))
-		return 0;
-
-	/* get required packet info from ring header */
-	pcaphdr.ts.tv_sec = tp_sec;
-	pcaphdr.ts.tv_usec = tp_usec;
-	pcaphdr.caplen = tp_snaplen;
-	pcaphdr.len = tp_len;
 
 	/* if required build in place the sll header*/
+	sll = (void *)frame + TPACKET_ALIGN(handlep->tp_hdrlen);
 	if (handlep->cooked) {
 		struct sll_header *hdrp;
 
@@ -4233,7 +4506,7 @@
 		 */
 		bp -= SLL_HDR_LEN;
 
-		/*/*
+		/*
 		 * Let's make sure that's past the end of
 		 * the tpacket header, i.e. >=
 		 * ((u_char *)thdr + TPACKET_HDRLEN), so we
@@ -4258,7 +4531,30 @@
 		hdrp->sll_halen = htons(sll->sll_halen);
 		memcpy(hdrp->sll_addr, sll->sll_addr, SLL_ADDRLEN);
 		hdrp->sll_protocol = sll->sll_protocol;
+	}
 
+	if (handlep->filter_in_userland && handle->fcode.bf_insns) {
+		struct bpf_aux_data aux_data;
+
+		aux_data.vlan_tag = tp_vlan_tci & 0x0fff;
+		aux_data.vlan_tag_present = tp_vlan_tci_valid;
+
+		if (bpf_filter_with_aux_data(handle->fcode.bf_insns, bp,
+		    tp_len, tp_snaplen, &aux_data) == 0)
+			return 0;
+	}
+
+	if (!linux_check_direction(handle, sll))
+		return 0;
+
+	/* get required packet info from ring header */
+	pcaphdr.ts.tv_sec = tp_sec;
+	pcaphdr.ts.tv_usec = tp_usec;
+	pcaphdr.caplen = tp_snaplen;
+	pcaphdr.len = tp_len;
+
+	/* if required build in place the sll header*/
+	if (handlep->cooked) {
 		/* update packet len */
 		pcaphdr.caplen += SLL_HDR_LEN;
 		pcaphdr.len += SLL_HDR_LEN;
@@ -4275,7 +4571,7 @@
 		memmove(bp, bp + VLAN_TAG_LEN, handlep->vlan_offset);
 
 		tag = (struct vlan_tag *)(bp + handlep->vlan_offset);
-		tag->vlan_tpid = htons(ETH_P_8021Q);
+		tag->vlan_tpid = htons(tp_vlan_tpid);
 		tag->vlan_tci = htons(tp_vlan_tci);
 
 		pcaphdr.caplen += VLAN_TAG_LEN;
@@ -4335,6 +4631,7 @@
 				h.h1->tp_sec,
 				h.h1->tp_usec,
 				0,
+				0,
 				0);
 		if (ret == 1) {
 			pkts++;
@@ -4374,6 +4671,80 @@
 	return pkts;
 }
 
+static int
+pcap_read_linux_mmap_v1_64(pcap_t *handle, int max_packets, pcap_handler callback,
+		u_char *user)
+{
+	struct pcap_linux *handlep = handle->priv;
+	int pkts = 0;
+	int ret;
+
+	/* wait for frames availability.*/
+	ret = pcap_wait_for_frames_mmap(handle);
+	if (ret) {
+		return ret;
+	}
+
+	/* 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)) {
+		union thdr h;
+
+		h.raw = pcap_get_ring_frame(handle, TP_STATUS_USER);
+		if (!h.raw)
+			break;
+
+		ret = pcap_handle_packet_mmap(
+				handle,
+				callback,
+				user,
+				h.raw,
+				h.h1_64->tp_len,
+				h.h1_64->tp_mac,
+				h.h1_64->tp_snaplen,
+				h.h1_64->tp_sec,
+				h.h1_64->tp_usec,
+				0,
+				0,
+				0);
+		if (ret == 1) {
+			pkts++;
+			handlep->packets_read++;
+		} else if (ret < 0) {
+			return ret;
+		}
+
+		/*
+		 * Hand this block back to the kernel, and, if we're
+		 * counting blocks that need to be filtered in userland
+		 * after having been filtered by the kernel, count
+		 * the one we've just processed.
+		 */
+		h.h1_64->tp_status = TP_STATUS_KERNEL;
+		if (handlep->blocks_to_filter_in_userland > 0) {
+			handlep->blocks_to_filter_in_userland--;
+			if (handlep->blocks_to_filter_in_userland == 0) {
+				/*
+				 * No more blocks need to be filtered
+				 * in userland.
+				 */
+				handlep->filter_in_userland = 0;
+			}
+		}
+
+		/* next block */
+		if (++handle->offset >= handle->cc)
+			handle->offset = 0;
+
+		/* check for break loop condition*/
+		if (handle->break_loop) {
+			handle->break_loop = 0;
+			return PCAP_ERROR_BREAK;
+		}
+	}
+	return pkts;
+}
+
 #ifdef HAVE_TPACKET2
 static int
 pcap_read_linux_mmap_v2(pcap_t *handle, int max_packets, pcap_handler callback,
@@ -4413,7 +4784,8 @@
 #else
 				h.h2->tp_vlan_tci != 0,
 #endif
-				h.h2->tp_vlan_tci);
+				h.h2->tp_vlan_tci,
+				VLAN_TPID(h.h2, h.h2));
 		if (ret == 1) {
 			pkts++;
 			handlep->packets_read++;
@@ -4463,6 +4835,7 @@
 	int pkts = 0;
 	int ret;
 
+again:
 	if (handlep->current_packet == NULL) {
 		/* wait for frames availability.*/
 		ret = pcap_wait_for_frames_mmap(handle);
@@ -4471,8 +4844,13 @@
 		}
 	}
 	h.raw = pcap_get_ring_frame(handle, TP_STATUS_USER);
-	if (!h.raw)
+	if (!h.raw) {
+		if (pkts == 0 && handlep->timeout == 0) {
+			/* Block until we see a packet. */
+			goto again;
+		}
 		return pkts;
+	}
 
 	/* non-positive values of max_packets are used to require all
 	 * packets currently available in the ring */
@@ -4508,7 +4886,8 @@
 #else
 					tp3_hdr->hv1.tp_vlan_tci != 0,
 #endif
-					tp3_hdr->hv1.tp_vlan_tci);
+					tp3_hdr->hv1.tp_vlan_tci,
+					VLAN_TPID(tp3_hdr, &tp3_hdr->hv1));
 			if (ret == 1) {
 				pkts++;
 				handlep->packets_read++;
@@ -4553,11 +4932,15 @@
 			return PCAP_ERROR_BREAK;
 		}
 	}
+	if (pkts == 0 && handlep->timeout == 0) {
+		/* Block until we see a packet. */
+		goto again;
+	}
 	return pkts;
 }
 #endif /* HAVE_TPACKET3 */
 
-static int 
+static int
 pcap_setfilter_linux_mmap(pcap_t *handle, struct bpf_program *filter)
 {
 	struct pcap_linux *handlep = handle->priv;
@@ -4650,7 +5033,7 @@
 	struct ifreq	ifr;
 
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+	strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
 
 	if (ioctl(fd, SIOCGIFINDEX, &ifr) == -1) {
 		snprintf(ebuf, PCAP_ERRBUF_SIZE,
@@ -4732,13 +5115,15 @@
 {
 	struct iwreq ireq;
 
-	strncpy(ireq.ifr_ifrn.ifrn_name, device,
+	if (is_bonding_device(sock_fd, device))
+		return 0;	/* bonding device, so don't even try */
+
+	strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 	    sizeof ireq.ifr_ifrn.ifrn_name);
-	ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 	if (ioctl(sock_fd, SIOCGIWNAME, &ireq) >= 0)
 		return 1;	/* yes */
 	snprintf(ebuf, PCAP_ERRBUF_SIZE,
-	    "%s: SIOCGIWPRIV: %s", device, pcap_strerror(errno));
+	    "%s: SIOCGIWNAME: %s", device, pcap_strerror(errno));
 	if (errno == ENODEV)
 		return PCAP_ERROR_NO_SUCH_DEVICE;
 	return 0;
@@ -4870,9 +5255,8 @@
 	 * return EOPNOTSUPP.
 	 */
 	memset(&ireq, 0, sizeof ireq);
-	strncpy(ireq.ifr_ifrn.ifrn_name, device,
+	strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 	    sizeof ireq.ifr_ifrn.ifrn_name);
-	ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 	ireq.u.data.pointer = (void *)args;
 	ireq.u.data.length = 0;
 	ireq.u.data.flags = 0;
@@ -5073,9 +5457,8 @@
 	/*
 	 * Get the old mode.
 	 */
-	strncpy(ireq.ifr_ifrn.ifrn_name, device,
+	strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 	    sizeof ireq.ifr_ifrn.ifrn_name);
-	ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 	if (ioctl(sock_fd, SIOCGIWMODE, &ireq) == -1) {
 		/*
 		 * We probably won't be able to set the mode, either.
@@ -5130,9 +5513,8 @@
 		 * If it fails, just fall back on SIOCSIWMODE.
 		 */
 		memset(&ireq, 0, sizeof ireq);
-		strncpy(ireq.ifr_ifrn.ifrn_name, device,
+		strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 		    sizeof ireq.ifr_ifrn.ifrn_name);
-		ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 		ireq.u.data.length = 1;	/* 1 argument */
 		args[0] = 3;	/* request Prism header */
 		memcpy(ireq.u.name, args, sizeof (int));
@@ -5163,7 +5545,7 @@
 	 * might get EBUSY.
 	 */
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+	strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
 	if (ioctl(sock_fd, SIOCGIFFLAGS, &ifr) == -1) {
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
 		    "%s: Can't get flags: %s", device, strerror(errno));
@@ -5183,9 +5565,8 @@
 	/*
 	 * Then turn monitor mode on.
 	 */
-	strncpy(ireq.ifr_ifrn.ifrn_name, device,
+	strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 	    sizeof ireq.ifr_ifrn.ifrn_name);
-	ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 	ireq.u.mode = IW_MODE_MONITOR;
 	if (ioctl(sock_fd, SIOCSIWMODE, &ireq) == -1) {
 		/*
@@ -5223,9 +5604,8 @@
 		 * Try to select the radiotap header.
 		 */
 		memset(&ireq, 0, sizeof ireq);
-		strncpy(ireq.ifr_ifrn.ifrn_name, device,
+		strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 		    sizeof ireq.ifr_ifrn.ifrn_name);
-		ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 		args[0] = 3;	/* request radiotap header */
 		memcpy(ireq.u.name, args, sizeof (int));
 		if (ioctl(sock_fd, cmd, &ireq) != -1)
@@ -5235,9 +5615,8 @@
 		 * That failed.  Try to select the AVS header.
 		 */
 		memset(&ireq, 0, sizeof ireq);
-		strncpy(ireq.ifr_ifrn.ifrn_name, device,
+		strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 		    sizeof ireq.ifr_ifrn.ifrn_name);
-		ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 		args[0] = 2;	/* request AVS header */
 		memcpy(ireq.u.name, args, sizeof (int));
 		if (ioctl(sock_fd, cmd, &ireq) != -1)
@@ -5247,9 +5626,8 @@
 		 * That failed.  Try to select the Prism header.
 		 */
 		memset(&ireq, 0, sizeof ireq);
-		strncpy(ireq.ifr_ifrn.ifrn_name, device,
+		strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 		    sizeof ireq.ifr_ifrn.ifrn_name);
-		ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 		args[0] = 1;	/* request Prism header */
 		memcpy(ireq.u.name, args, sizeof (int));
 		ioctl(sock_fd, cmd, &ireq);
@@ -5266,9 +5644,8 @@
 		 * Select the Prism header.
 		 */
 		memset(&ireq, 0, sizeof ireq);
-		strncpy(ireq.ifr_ifrn.ifrn_name, device,
+		strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 		    sizeof ireq.ifr_ifrn.ifrn_name);
-		ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 		args[0] = 3;	/* request Prism header */
 		memcpy(ireq.u.name, args, sizeof (int));
 		ioctl(sock_fd, cmd, &ireq);
@@ -5279,9 +5656,8 @@
 		 * Get the current channel.
 		 */
 		memset(&ireq, 0, sizeof ireq);
-		strncpy(ireq.ifr_ifrn.ifrn_name, device,
+		strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 		    sizeof ireq.ifr_ifrn.ifrn_name);
-		ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 		if (ioctl(sock_fd, SIOCGIWFREQ, &ireq) == -1) {
 			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
 			    "%s: SIOCGIWFREQ: %s", device,
@@ -5295,9 +5671,8 @@
 		 * current value.
 		 */
 		memset(&ireq, 0, sizeof ireq);
-		strncpy(ireq.ifr_ifrn.ifrn_name, device,
+		strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 		    sizeof ireq.ifr_ifrn.ifrn_name);
-		ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 		args[0] = 1;		/* request Prism header */
 		args[1] = channel;	/* set channel */
 		memcpy(ireq.u.name, args, 2*sizeof (int));
@@ -5310,9 +5685,8 @@
 		 * Prism header.
 		 */
 		memset(&ireq, 0, sizeof ireq);
-		strncpy(ireq.ifr_ifrn.ifrn_name, device,
+		strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 		    sizeof ireq.ifr_ifrn.ifrn_name);
-		ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 		args[0] = 0;	/* disallow transmitting */
 		memcpy(ireq.u.name, args, sizeof (int));
 		ioctl(sock_fd, cmd, &ireq);
@@ -5323,9 +5697,8 @@
 		 * Force the Prism header.
 		 */
 		memset(&ireq, 0, sizeof ireq);
-		strncpy(ireq.ifr_ifrn.ifrn_name, device,
+		strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 		    sizeof ireq.ifr_ifrn.ifrn_name);
-		ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 		args[0] = 1;	/* request Prism header */
 		memcpy(ireq.u.name, args, sizeof (int));
 		ioctl(sock_fd, cmd, &ireq);
@@ -5336,9 +5709,8 @@
 		 * Force the Prism header.
 		 */
 		memset(&ireq, 0, sizeof ireq);
-		strncpy(ireq.ifr_ifrn.ifrn_name, device,
+		strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 		    sizeof ireq.ifr_ifrn.ifrn_name);
-		ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 		ireq.u.data.length = 1;	/* 1 argument */
 		ireq.u.data.pointer = "1";
 		ireq.u.data.flags = 0;
@@ -5350,9 +5722,8 @@
 		 * Force the Prism header.
 		 */
 		memset(&ireq, 0, sizeof ireq);
-		strncpy(ireq.ifr_ifrn.ifrn_name, device,
+		strlcpy(ireq.ifr_ifrn.ifrn_name, device,
 		    sizeof ireq.ifr_ifrn.ifrn_name);
-		ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] = 0;
 		args[0] = 1;	/* request Prism header */
 		memcpy(ireq.u.name, args, sizeof (int));
 		ioctl(sock_fd, cmd, &ireq);
@@ -5434,6 +5805,121 @@
 	return 0;
 }
 
+#if defined(HAVE_LINUX_NET_TSTAMP_H) && defined(PACKET_TIMESTAMP)
+/*
+ * Map SOF_TIMESTAMPING_ values to PCAP_TSTAMP_ values.
+ */
+static const struct {
+	int soft_timestamping_val;
+	int pcap_tstamp_val;
+} sof_ts_type_map[3] = {
+	{ SOF_TIMESTAMPING_SOFTWARE, PCAP_TSTAMP_HOST },
+	{ SOF_TIMESTAMPING_SYS_HARDWARE, PCAP_TSTAMP_ADAPTER },
+	{ SOF_TIMESTAMPING_RAW_HARDWARE, PCAP_TSTAMP_ADAPTER_UNSYNCED }
+};
+#define NUM_SOF_TIMESTAMPING_TYPES	(sizeof sof_ts_type_map / sizeof sof_ts_type_map[0])
+
+static void
+iface_set_default_ts_types(pcap_t *handle)
+{
+	int i;
+
+	handle->tstamp_type_count = NUM_SOF_TIMESTAMPING_TYPES;
+	handle->tstamp_type_list = malloc(NUM_SOF_TIMESTAMPING_TYPES * sizeof(u_int));
+	for (i = 0; i < NUM_SOF_TIMESTAMPING_TYPES; i++)
+		handle->tstamp_type_list[i] = sof_ts_type_map[i].pcap_tstamp_val;
+}
+
+#ifdef ETHTOOL_GET_TS_INFO
+/*
+ * Get a list of time stamping capabilities.
+ */
+static int
+iface_ethtool_get_ts_info(pcap_t *handle, char *ebuf)
+{
+	int fd;
+	struct ifreq ifr;
+	struct ethtool_ts_info info;
+	int num_ts_types;
+	int i, j;
+
+	/*
+	 * This doesn't apply to the "any" device; you have to ask
+	 * specific devices for their capabilities, so just default
+	 * to saying we support all of them.
+	 */
+	if (strcmp(handle->opt.source, "any") == 0) {
+		iface_set_default_ts_types(handle);
+		return 0;
+	}
+
+	/*
+	 * Create a socket from which to fetch time stamping capabilities.
+	 */
+	fd = socket(AF_INET, SOCK_DGRAM, 0);
+	if (fd < 0) {
+		(void)snprintf(ebuf, PCAP_ERRBUF_SIZE,
+		    "socket for SIOCETHTOOL(ETHTOOL_GET_TS_INFO): %s", pcap_strerror(errno));
+		return -1;
+	}
+
+	memset(&ifr, 0, sizeof(ifr));
+	strlcpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name));
+	memset(&info, 0, sizeof(info));
+	info.cmd = ETHTOOL_GET_TS_INFO;
+	ifr.ifr_data = (caddr_t)&info;
+	if (ioctl(fd, SIOCETHTOOL, &ifr) == -1) {
+		close(fd);
+		if (errno == EOPNOTSUPP || errno == EINVAL) {
+			/*
+			 * OK, let's just return all the possible time
+			 * stamping types.
+			 */
+			iface_set_default_ts_types(handle);
+			return 0;
+		}
+		snprintf(ebuf, PCAP_ERRBUF_SIZE,
+		    "%s: SIOCETHTOOL(ETHTOOL_GET_TS_INFO) ioctl failed: %s", handle->opt.source,
+		    strerror(errno));
+		return -1;
+	}
+	close(fd);
+
+	num_ts_types = 0;
+	for (i = 0; i < NUM_SOF_TIMESTAMPING_TYPES; i++) {
+		if (info.so_timestamping & sof_ts_type_map[i].soft_timestamping_val)
+			num_ts_types++;
+	}
+	handle->tstamp_type_count = num_ts_types;
+	if (num_ts_types != 0) {
+		handle->tstamp_type_list = malloc(num_ts_types * sizeof(u_int));
+		for (i = 0, j = 0; i < NUM_SOF_TIMESTAMPING_TYPES; i++) {
+			if (info.so_timestamping & sof_ts_type_map[i].soft_timestamping_val) {
+				handle->tstamp_type_list[j] = sof_ts_type_map[i].pcap_tstamp_val;
+				j++;
+			}
+		}
+	} else
+		handle->tstamp_type_list = NULL;
+
+	return 0;
+}
+#else /* ETHTOOL_GET_TS_INFO */
+static int
+iface_ethtool_get_ts_info(pcap_t *handle, char *ebuf _U_)
+{
+	/*
+	 * We don't have an ioctl to use to ask what's supported,
+	 * so say we support everything.
+	 */
+	iface_set_default_ts_types(handle);
+	return 0;
+}
+#endif /* ETHTOOL_GET_TS_INFO */
+
+#endif /* defined(HAVE_LINUX_NET_TSTAMP_H) && defined(PACKET_TIMESTAMP) */
+
+#ifdef HAVE_PACKET_RING
 /*
  * Find out if we have any form of fragmentation/reassembly offloading.
  *
@@ -5444,13 +5930,13 @@
  */
 #if defined(SIOCETHTOOL) && (defined(ETHTOOL_GTSO) || defined(ETHTOOL_GUFO) || defined(ETHTOOL_GGSO) || defined(ETHTOOL_GFLAGS) || defined(ETHTOOL_GGRO))
 static int
-iface_ethtool_ioctl(pcap_t *handle, int cmd, const char *cmdname)
+iface_ethtool_flag_ioctl(pcap_t *handle, int cmd, const char *cmdname)
 {
 	struct ifreq	ifr;
 	struct ethtool_value eval;
 
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name));
+	strlcpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name));
 	eval.cmd = cmd;
 	eval.data = 0;
 	ifr.ifr_data = (caddr_t)&eval;
@@ -5465,11 +5951,11 @@
 			return 0;
 		}
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
-		    "%s: SIOETHTOOL(%s) ioctl failed: %s", handle->opt.source,
+		    "%s: SIOCETHTOOL(%s) ioctl failed: %s", handle->opt.source,
 		    cmdname, strerror(errno));
 		return -1;
 	}
-	return eval.data;	
+	return eval.data;
 }
 
 static int
@@ -5478,7 +5964,7 @@
 	int ret;
 
 #ifdef ETHTOOL_GTSO
-	ret = iface_ethtool_ioctl(handle, ETHTOOL_GTSO, "ETHTOOL_GTSO");
+	ret = iface_ethtool_flag_ioctl(handle, ETHTOOL_GTSO, "ETHTOOL_GTSO");
 	if (ret == -1)
 		return -1;
 	if (ret)
@@ -5486,7 +5972,7 @@
 #endif
 
 #ifdef ETHTOOL_GUFO
-	ret = iface_ethtool_ioctl(handle, ETHTOOL_GUFO, "ETHTOOL_GUFO");
+	ret = iface_ethtool_flag_ioctl(handle, ETHTOOL_GUFO, "ETHTOOL_GUFO");
 	if (ret == -1)
 		return -1;
 	if (ret)
@@ -5499,7 +5985,7 @@
 	 * handed to PF_PACKET sockets on transmission?  If not,
 	 * this need not be checked.
 	 */
-	ret = iface_ethtool_ioctl(handle, ETHTOOL_GGSO, "ETHTOOL_GGSO");
+	ret = iface_ethtool_flag_ioctl(handle, ETHTOOL_GGSO, "ETHTOOL_GGSO");
 	if (ret == -1)
 		return -1;
 	if (ret)
@@ -5507,7 +5993,7 @@
 #endif
 
 #ifdef ETHTOOL_GFLAGS
-	ret = iface_ethtool_ioctl(handle, ETHTOOL_GFLAGS, "ETHTOOL_GFLAGS");
+	ret = iface_ethtool_flag_ioctl(handle, ETHTOOL_GFLAGS, "ETHTOOL_GFLAGS");
 	if (ret == -1)
 		return -1;
 	if (ret & ETH_FLAG_LRO)
@@ -5520,7 +6006,7 @@
 	 * handed to PF_PACKET sockets on receipt?  If not,
 	 * this need not be checked.
 	 */
-	ret = iface_ethtool_ioctl(handle, ETHTOOL_GGRO, "ETHTOOL_GGRO");
+	ret = iface_ethtool_flag_ioctl(handle, ETHTOOL_GGRO, "ETHTOOL_GGRO");
 	if (ret == -1)
 		return -1;
 	if (ret)
@@ -5541,6 +6027,8 @@
 }
 #endif /* SIOCETHTOOL */
 
+#endif /* HAVE_PACKET_RING */
+
 #endif /* HAVE_PF_PACKET_SOCKETS */
 
 /* ===== Functions to interface to the older kernels ================== */
@@ -5588,7 +6076,7 @@
 	/* Bind to the given device */
 
 	if (strcmp(device, "any") == 0) {
-		strncpy(handle->errbuf, "pcap_activate: The \"any\" device isn't supported on 2.0[.x]-kernel systems",
+		strlcpy(handle->errbuf, "pcap_activate: The \"any\" device isn't supported on 2.0[.x]-kernel systems",
 			PCAP_ERRBUF_SIZE);
 		return PCAP_ERROR;
 	}
@@ -5606,7 +6094,7 @@
 	 * Try to find the DLT_ type corresponding to that
 	 * link-layer type.
 	 */
-	map_arphrd_to_dlt(handle, arptype, 0);
+	map_arphrd_to_dlt(handle, handle->fd, arptype, device, 0);
 	if (handle->linktype == -1) {
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
 			 "unknown arptype %d", arptype);
@@ -5617,7 +6105,7 @@
 
 	if (handle->opt.promisc) {
 		memset(&ifr, 0, sizeof(ifr));
-		strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+		strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
 		if (ioctl(handle->fd, SIOCGIFFLAGS, &ifr) == -1) {
 			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
 				 "SIOCGIFFLAGS: %s", pcap_strerror(errno));
@@ -5755,7 +6243,7 @@
 	socklen_t	errlen = sizeof(err);
 
 	memset(&saddr, 0, sizeof(saddr));
-	strncpy(saddr.sa_data, device, sizeof(saddr.sa_data));
+	strlcpy(saddr.sa_data, device, sizeof(saddr.sa_data));
 	if (bind(fd, &saddr, sizeof(saddr)) == -1) {
 		snprintf(ebuf, PCAP_ERRBUF_SIZE,
 			 "bind: %s", pcap_strerror(errno));
@@ -5794,7 +6282,7 @@
 		return BIGGER_THAN_ALL_MTUS;
 
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+	strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
 
 	if (ioctl(fd, SIOCGIFMTU, &ifr) == -1) {
 		snprintf(ebuf, PCAP_ERRBUF_SIZE,
@@ -5814,7 +6302,7 @@
 	struct ifreq	ifr;
 
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+	strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
 
 	if (ioctl(fd, SIOCGIFHWADDR, &ifr) == -1) {
 		snprintf(ebuf, PCAP_ERRBUF_SIZE,
@@ -5881,18 +6369,19 @@
 					 * Yes - if the value to be returned,
 					 * i.e. the snapshot length, is
 					 * anything other than 0, make it
-					 * 65535, so that the packet is
-					 * truncated by "recvfrom()",
+					 * MAXIMUM_SNAPLEN, so that the packet
+					 * is truncated by "recvfrom()",
 					 * not by the filter.
 					 *
 					 * XXX - there's nothing we can
 					 * easily do if it's getting the
 					 * value from the accumulator; we'd
 					 * have to insert code to force
-					 * non-zero values to be 65535.
+					 * non-zero values to be
+					 * MAXIMUM_SNAPLEN.
 					 */
 					if (p->k != 0)
-						p->k = 65535;
+						p->k = MAXIMUM_SNAPLEN;
 				}
 			}
 			break;
@@ -6025,20 +6514,40 @@
 		 * "nothing more to be read" error).
 		 */
 		save_mode = fcntl(handle->fd, F_GETFL, 0);
-		if (save_mode != -1 &&
-		    fcntl(handle->fd, F_SETFL, save_mode | O_NONBLOCK) >= 0) {
-			while (recv(handle->fd, &drain, sizeof drain,
-			       MSG_TRUNC) >= 0)
-				;
-			save_errno = errno;
-			fcntl(handle->fd, F_SETFL, save_mode);
-			if (save_errno != EAGAIN) {
-				/* Fatal error */
-				reset_kernel_filter(handle);
-				snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
-				 "recv: %s", pcap_strerror(save_errno));
-				return -2;
-			}
+		if (save_mode == -1) {
+			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+			    "can't get FD flags when changing filter: %s",
+			    pcap_strerror(errno));
+			return -2;
+		}
+		if (fcntl(handle->fd, F_SETFL, save_mode | O_NONBLOCK) < 0) {
+			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+			    "can't set nonblocking mode when changing filter: %s",
+			    pcap_strerror(errno));
+			return -2;
+		}
+		while (recv(handle->fd, &drain, sizeof drain, MSG_TRUNC) >= 0)
+			;
+		save_errno = errno;
+		if (save_errno != EAGAIN) {
+			/*
+			 * Fatal error.
+			 *
+			 * If we can't restore the mode or reset the
+			 * kernel filter, there's nothing we can do.
+			 */
+			(void)fcntl(handle->fd, F_SETFL, save_mode);
+			(void)reset_kernel_filter(handle);
+			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+			    "recv failed when changing filter: %s",
+			    pcap_strerror(save_errno));
+			return -2;
+		}
+		if (fcntl(handle->fd, F_SETFL, save_mode) == -1) {
+			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+			    "can't restore FD flags when changing filter: %s",
+			    pcap_strerror(save_errno));
+			return -2;
 		}
 	}
 
@@ -6061,11 +6570,16 @@
 		save_errno = errno;
 
 		/*
-		 * XXX - if this fails, we're really screwed;
-		 * we have the total filter on the socket,
-		 * and it won't come off.  What do we do then?
+		 * If this fails, we're really screwed; we have the
+		 * total filter on the socket, and it won't come off.
+		 * Report it as a fatal error.
 		 */
-		reset_kernel_filter(handle);
+		if (reset_kernel_filter(handle) == -1) {
+			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+			    "can't remove kernel total filter: %s",
+			    pcap_strerror(errno));
+			return -2;	/* fatal error */
+		}
 
 		errno = save_errno;
 	}
diff --git a/pcap-namedb.h b/pcap-namedb.h
index d0b2231..d5908c9 100644
--- a/pcap-namedb.h
+++ b/pcap-namedb.h
@@ -29,8 +29,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-namedb.h,v 1.13 2006-10-04 18:13:32 guy Exp $ (LBL)
  */
 
 /*
diff --git a/pcap-netfilter-linux.c b/pcap-netfilter-linux.c
index aa8edbb..3ee6faa 100644
--- a/pcap-netfilter-linux.c
+++ b/pcap-netfilter-linux.c
@@ -11,8 +11,8 @@
  * 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. The name of the author may not be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
  * permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -57,14 +57,14 @@
 #include <linux/netfilter/nfnetlink_queue.h>
 
 /* NOTE: if your program drops privilages after pcap_activate() it WON'T work with nfqueue.
- *       It took me quite some time to debug ;/ 
+ *       It took me quite some time to debug ;/
  *
  *       Sending any data to nfnetlink socket requires CAP_NET_ADMIN privilages,
  *       and in nfqueue we need to send verdict reply after recving packet.
  *
  *       In tcpdump you can disable dropping privilages with -Z root
  */
- 
+
 #include "pcap-netfilter-linux.h"
 
 #define HDR_LENGTH (NLMSG_LENGTH(NLMSG_ALIGN(sizeof(struct nfgenmsg))))
@@ -116,19 +116,18 @@
 			return -1;
 		}
 
-		if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_ULOG && 
-			NFNL_MSG_TYPE(nlh->nlmsg_type) == NFULNL_MSG_PACKET) 
-				type = NFLOG;
-
-		if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_QUEUE && 
-			NFNL_MSG_TYPE(nlh->nlmsg_type) == NFQNL_MSG_PACKET)
-				type = NFQUEUE;
+		if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_ULOG &&
+		    NFNL_MSG_TYPE(nlh->nlmsg_type) == NFULNL_MSG_PACKET)
+			type = NFLOG;
+		else if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_QUEUE &&
+		         NFNL_MSG_TYPE(nlh->nlmsg_type) == NFQNL_MSG_PACKET)
+			type = NFQUEUE;
 
 		if (type != OTHER) {
 			const unsigned char *payload = NULL;
 			struct pcap_pkthdr pkth;
 
-			const struct nfgenmsg *nfg;
+			const struct nfgenmsg *nfg = NULL;
 			int id = 0;
 
 			if (handle->linktype != DLT_NFLOG) {
@@ -185,7 +184,7 @@
 
 				gettimeofday(&pkth.ts, NULL);
 				if (handle->fcode.bf_insns == NULL ||
-						bpf_filter(handle->fcode.bf_insns, payload, pkth.len, pkth.caplen)) 
+						bpf_filter(handle->fcode.bf_insns, payload, pkth.len, pkth.caplen))
 				{
 					handlep->packets_read++;
 					callback(user, &pkth, payload);
@@ -195,7 +194,10 @@
 
 			if (type == NFQUEUE) {
 				/* XXX, possible responses: NF_DROP, NF_ACCEPT, NF_STOLEN, NF_QUEUE, NF_REPEAT, NF_STOP */
-				nfqueue_send_verdict(handle, ntohs(nfg->res_id), id, NF_ACCEPT);
+				/* if type == NFQUEUE, handle->linktype is always != DLT_NFLOG,
+				   so nfg is always initialized to NLMSG_DATA(nlh). */
+				if (nfg != NULL)
+					nfqueue_send_verdict(handle, ntohs(nfg->res_id), id, NF_ACCEPT);
 			}
 		}
 
@@ -232,7 +234,7 @@
 {
 	snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported on netfilter devices");
 	return (-1);
-}                           
+}
 
 struct my_nfattr {
 	u_int16_t nfa_len;
@@ -250,7 +252,7 @@
 
 	struct sockaddr_nl snl;
 	static unsigned int seq_id;
-	
+
 	if (!seq_id)
 		seq_id = time(NULL);
 	++seq_id;
@@ -342,7 +344,7 @@
 	return nflog_send_config_msg(handle, family, group_id, &nfa);
 }
 
-static int 
+static int
 nflog_send_config_mode(const pcap_t *handle, u_int16_t group_id, u_int8_t copy_mode, u_int32_t copy_range)
 {
 	struct nfulnl_msg_config_mode msg;
@@ -396,7 +398,7 @@
 	return nfqueue_send_config_msg(handle, AF_UNSPEC, group_id, &nfa);
 }
 
-static int 
+static int
 nfqueue_send_config_mode(const pcap_t *handle, u_int16_t group_id, u_int8_t copy_mode, u_int32_t copy_range)
 {
 	struct nfqnl_msg_config_params msg;
@@ -429,7 +431,7 @@
 		dev += strlen(NFQUEUE_IFACE);
 		type = NFQUEUE;
 	}
- 
+
 	if (type != OTHER && *dev == ':') {
 		dev++;
 		while (*dev) {
@@ -438,7 +440,7 @@
 
 			if (group_count == 32) {
 				snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
-						"Maximum 32 netfilter groups! dev: %s", 
+						"Maximum 32 netfilter groups! dev: %s",
 						handle->opt.source);
 				return PCAP_ERROR;
 			}
@@ -463,7 +465,7 @@
 
 	if (type == OTHER || *dev) {
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
-				"Can't get netfilter group(s) index from %s", 
+				"Can't get netfilter group(s) index from %s",
 				handle->opt.source);
 		return PCAP_ERROR;
 	}
@@ -600,7 +602,7 @@
 	/* Does it begin with NFLOG_IFACE or NFQUEUE_IFACE? */
 	if (strncmp(cp, NFLOG_IFACE, sizeof NFLOG_IFACE - 1) == 0)
 		cp += sizeof NFLOG_IFACE - 1;
-	else if (strncmp(cp, NFQUEUE_IFACE, sizeof NFQUEUE_IFACE - 1) == 0) 
+	else if (strncmp(cp, NFQUEUE_IFACE, sizeof NFQUEUE_IFACE - 1) == 0)
 		cp += sizeof NFQUEUE_IFACE - 1;
 	else {
 		/* Nope, doesn't begin with NFLOG_IFACE nor NFQUEUE_IFACE */
@@ -629,11 +631,11 @@
 	return (p);
 }
 
-int 
+int
 netfilter_findalldevs(pcap_if_t **alldevsp, char *err_str)
 {
 	int sock;
-	
+
 	sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER);
 	if (sock < 0) {
 		/* if netlink is not supported this is not fatal */
diff --git a/pcap-netfilter-linux.h b/pcap-netfilter-linux.h
index 882a402..01d9b39 100644
--- a/pcap-netfilter-linux.h
+++ b/pcap-netfilter-linux.h
@@ -11,8 +11,8 @@
  * 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. The name of the author may not be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
  * permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
diff --git a/pcap-nit.c b/pcap-nit.c
index 40e640c..a8355f9 100644
--- a/pcap-nit.c
+++ b/pcap-nit.c
@@ -18,10 +18,6 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-nit.c,v 1.62 2008-04-14 20:40:58 guy Exp $ (LBL)";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -215,7 +211,7 @@
 		return (-1);
 	}
 	return (ret);
-}                           
+}
 
 static int
 nit_setflags(pcap_t *p)
diff --git a/pcap-null.c b/pcap-null.c
index 6737386..934fb2c 100644
--- a/pcap-null.c
+++ b/pcap-null.c
@@ -18,10 +18,6 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-null.c,v 1.22 2008-04-04 19:37:45 guy Exp $ (LBL)";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/pcap-pf.c b/pcap-pf.c
index 8de6e58..e03b2ed 100644
--- a/pcap-pf.c
+++ b/pcap-pf.c
@@ -22,11 +22,6 @@
  *	Extraction/creation by Jeffrey Mogul, DECWRL
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-pf.c,v 1.97 2008-04-14 20:40:58 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -242,7 +237,7 @@
 		return (-1);
 	}
 	return (ret);
-}                           
+}
 
 static int
 pcap_stats_pf(pcap_t *p, struct pcap_stat *ps)
diff --git a/pcap-savefile.manfile.in b/pcap-savefile.manfile.in
index c20e003..622f6c6 100644
--- a/pcap-savefile.manfile.in
+++ b/pcap-savefile.manfile.in
@@ -1,6 +1,3 @@
-'\" t
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap-savefile.manfile.in,v 1.2 2008-10-24 07:33:50 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -20,12 +17,12 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP-SAVEFILE @MAN_FILE_FORMATS@ "21 October 2008"
+.TH PCAP-SAVEFILE @MAN_FILE_FORMATS@ "29 July 2013"
 .SH NAME
 pcap-savefile \- libpcap savefile format
 .SH DESCRIPTION
 NOTE: applications and libraries should, if possible, use libpcap to
-read savefiles, rather than having their own code to read savefiles. 
+read savefiles, rather than having their own code to read savefiles.
 If, in the future, a new file format is supported by libpcap,
 applications and libraries using libpcap to read savefiles will be able
 to read the new format of savefiles, but applications and libraries
diff --git a/pcap-septel.c b/pcap-septel.c
index 4ca7a60..61cd2f5 100644
--- a/pcap-septel.c
+++ b/pcap-septel.c
@@ -14,11 +14,6 @@
  * (+961 3 485243)
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-septel.c,v 1.4 2008-04-14 20:40:58 guy Exp $";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -199,9 +194,9 @@
  *  See also pcap(3).
  */
 static pcap_t *septel_activate(pcap_t* handle) {
-  /* Initialize some components of the pcap structure. */  
+  /* Initialize some components of the pcap structure. */
   handle->linktype = DLT_MTP2;
-  
+
   handle->bufsize = 0;
 
   /*
@@ -249,9 +244,9 @@
   struct pcap_septel *handlep = p->priv;
   /*handlep->stat.ps_recv = 0;*/
   /*handlep->stat.ps_drop = 0;*/
-  
+
   *ps = handlep->stat;
- 
+
   return 0;
 }
 
@@ -259,13 +254,8 @@
 int
 septel_findalldevs(pcap_if_t **devlistp, char *errbuf)
 {
-unsigned char *p;
-  const char description[512]= "Intel/Septel device";
-  char name[512]="septel" ;
-  int ret = 0;
-  pcap_add_if(devlistp,name,0,description,errbuf);
-
-  return (ret); 
+  return (pcap_add_if(devlistp,"septel",0,
+                      "Intel/Septel device",errbuf));
 }
 
 
diff --git a/pcap-septel.h b/pcap-septel.h
index b72f35b..b6e1168 100644
--- a/pcap-septel.h
+++ b/pcap-septel.h
@@ -7,8 +7,6 @@
  *
  * Authors: Gilbert HOYEK (gil_hoyek@hotmail.com), Elias M. KHOURY
  * (+961 3 485343);
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-septel.h,v 1.2 2008-04-04 19:37:45 guy Exp $
  */
 
 pcap_t *septel_create(const char *device, char *ebuf, int *is_ours);
diff --git a/pcap-sita.c b/pcap-sita.c
index 7ab801e..b35b106 100644
--- a/pcap-sita.c
+++ b/pcap-sita.c
@@ -24,8 +24,6 @@
  *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
- /* $Id: pcap-sita.c */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -185,7 +183,7 @@
 	find_unit_by_fd(fd, &chassis, &geoslot, &u);
 	while (count) {
 		if ((len = recv(fd, buf, count, 0)) <= 0)	return -1;	/* read in whatever data was sent to us */
-		count -= len;	
+		count -= len;
 		buf += len;
 	}															/* till we have everything we are looking for */
 	return 0;
@@ -213,7 +211,7 @@
 		u->imsg = (char *)realloc(u->imsg, 1);				/* and re-allocate the old large buffer into a new small one */
 		if (u->imsg == NULL) {	/* oops, realloc call failed */
 			fprintf(stderr, "Warning...call to realloc() failed, value of errno is %d\n", errno);
-		
+
 	}
 }
 
@@ -555,10 +553,10 @@
 		}
 		if (has_swapped == 0)
 			return;
-	}	
+	}
 	return;
 }
-	
+
 static int process_client_data (char *errbuf) {								/* returns: -1 = error, 0 = OK */
 	int					chassis, geoslot;
 	unit_t				*u;
diff --git a/pcap-sita.h b/pcap-sita.h
index b232ee2..9c35c6a 100644
--- a/pcap-sita.h
+++ b/pcap-sita.h
@@ -2,8 +2,6 @@
  * pcap-sita.h: Packet capture interface for SITA WAN devices
  *
  * Authors: Fulko Hew (fulko.hew@sita.aero) (+1 905 6815570);
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-sita.h
  */
 
 extern int acn_parse_hosts_file(char *errbuf);
diff --git a/pcap-snf.c b/pcap-snf.c
index ee6ffa4..03dc08d 100644
--- a/pcap-snf.c
+++ b/pcap-snf.c
@@ -16,6 +16,9 @@
 #include <unistd.h>
 
 #include <snf.h>
+#if SNF_VERSION_API >= 0x0003
+#define SNF_HAVE_INJECT_API
+#endif
 
 #include "pcap-int.h"
 #include "pcap-snf.h"
@@ -26,6 +29,9 @@
 struct pcap_snf {
 	snf_handle_t snf_handle; /* opaque device handle */
 	snf_ring_t   snf_ring;   /* opaque device ring handle */
+#ifdef SNF_HAVE_INJECT_API
+        snf_inject_t snf_inj;    /* inject handle, if inject is used */
+#endif
         int          snf_timeout;
         int          snf_boardnum;
 };
@@ -41,9 +47,10 @@
 snf_pcap_stats(pcap_t *p, struct pcap_stat *ps)
 {
 	struct snf_ring_stats stats;
+	struct pcap_snf *snfps = p->priv;
 	int rc;
 
-	if ((rc = snf_ring_getstats(ps->snf_ring, &stats))) {
+	if ((rc = snf_ring_getstats(snfps->snf_ring, &stats))) {
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "snf_get_stats: %s",
 			 pcap_strerror(rc));
 		return -1;
@@ -62,6 +69,10 @@
 	if (p == NULL)
 		return;
 
+#ifdef SNF_HAVE_INJECT_API
+        if (ps->snf_inj)
+                snf_inject_close(ps->snf_inj);
+#endif
 	snf_ring_close(ps->snf_ring);
 	snf_close(ps->snf_handle);
 	pcap_cleanup_live_common(p);
@@ -95,14 +106,23 @@
 
 static inline
 struct timeval
-snf_timestamp_to_timeval(const int64_t ts_nanosec)
+snf_timestamp_to_timeval(const int64_t ts_nanosec, const int tstamp_precision)
 {
 	struct timeval tv;
-	int32_t rem;
+	long tv_nsec;
+
 	if (ts_nanosec == 0)
 		return (struct timeval) { 0, 0 };
+
 	tv.tv_sec = ts_nanosec / _NSEC_PER_SEC;
-	tv.tv_usec = (ts_nanosec % _NSEC_PER_SEC) / 1000;
+	tv_nsec = (ts_nanosec % _NSEC_PER_SEC);
+
+	/* libpcap expects tv_usec to be nanos if using nanosecond precision. */
+	if (tstamp_precision == PCAP_TSTAMP_PRECISION_NANO)
+		tv.tv_usec = tv_nsec;
+	else
+		tv.tv_usec = tv_nsec / 1000;
+
 	return tv;
 }
 
@@ -113,11 +133,13 @@
 	struct pcap_pkthdr hdr;
 	int i, flags, err, caplen, n;
 	struct snf_recv_req req;
+	int nonblock, timeout;
 
-	if (!p || cnt == 0)
+	if (!p)
 		return -1;
 
 	n = 0;
+	timeout = ps->snf_timeout;
 	while (n < cnt || PACKET_COUNT_IS_UNLIMITED(cnt)) {
 		/*
 		 * Has "pcap_breakloop()" been called?
@@ -131,14 +153,17 @@
 			}
 		}
 
-		err = snf_ring_recv(ps->snf_ring, ps->snf_timeout, &req);
+		err = snf_ring_recv(ps->snf_ring, timeout, &req);
 
 		if (err) {
-			if (err == EBUSY || err == EAGAIN)
-				return (0);
-			if (err == EINTR)
+			if (err == EBUSY || err == EAGAIN) {
+				return (n);
+			}
+			else if (err == EINTR) {
+				timeout = 0;
 				continue;
-			if (err != 0) {
+			}
+			else {
 				snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "snf_read: %s",
 				 	 pcap_strerror(err));
 				return -1;
@@ -151,12 +176,17 @@
 
 		if ((p->fcode.bf_insns == NULL) ||
 		     bpf_filter(p->fcode.bf_insns, req.pkt_addr, req.length, caplen)) {
-			hdr.ts = snf_timestamp_to_timeval(req.timestamp);
+			hdr.ts = snf_timestamp_to_timeval(req.timestamp, p->opt.tstamp_precision);
 			hdr.caplen = caplen;
 			hdr.len = req.length;
 			callback(user, &hdr, req.pkt_addr);
 		}
 		n++;
+
+		/* After one successful packet is received, we won't block
+		* again for that timeout. */
+		if (timeout != 0)
+			timeout = 0;
 	}
 	return (n);
 }
@@ -183,9 +213,32 @@
 static int
 snf_inject(pcap_t *p, const void *buf _U_, size_t size _U_)
 {
-	strlcpy(p->errbuf, "Sending packets isn't supported with snf",
+#ifdef SNF_HAVE_INJECT_API
+	struct pcap_snf *ps = p->priv;
+        int rc;
+        if (ps->snf_inj == NULL) {
+                rc = snf_inject_open(ps->snf_boardnum, 0, &ps->snf_inj);
+                if (rc) {
+                        snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                                "snf_inject_open: %s", pcap_strerror(rc));
+                        return (-1);
+                }
+        }
+
+        rc = snf_inject_send(ps->snf_inj, -1, 0, buf, size);
+        if (!rc) {
+                return (size);
+        }
+        else {
+                snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "snf_inject_send: %s",
+                         pcap_strerror(rc));
+                return (-1);
+        }
+#else
+	strlcpy(p->errbuf, "Sending packets isn't supported with this snf version",
 	    PCAP_ERRBUF_SIZE);
 	return (-1);
+#endif
 }
 
 static int
@@ -195,7 +248,7 @@
 	char *device = p->opt.source;
 	const char *nr = NULL;
 	int err;
-	int flags = 0;
+	int flags = -1, ring_id = -1;
 
 	if (device == NULL) {
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
@@ -205,8 +258,10 @@
 
 	/* In Libpcap, we set pshared by default if NUM_RINGS is set to > 1.
 	 * Since libpcap isn't thread-safe */
-	if ((nr = getenv("SNF_NUM_RINGS")) && *nr && atoi(nr) > 1)
-		flags |= SNF_F_PSHARED;
+	if ((nr = getenv("SNF_FLAGS")) && *nr)
+		flags = strtol(nr, NULL, 0);
+	else if ((nr = getenv("SNF_NUM_RINGS")) && *nr && atoi(nr) > 1)
+		flags = SNF_F_PSHARED;
 	else
 		nr = NULL;
 
@@ -222,10 +277,14 @@
 		return -1;
 	}
 
-	err = snf_ring_open(ps->snf_handle, &ps->snf_ring);
+	if ((nr = getenv("SNF_PCAP_RING_ID")) && *nr) {
+		ring_id = (int) strtol(nr, NULL, 0);
+	}
+	err = snf_ring_open_id(ps->snf_handle, ring_id, &ps->snf_ring);
 	if (err != 0) {
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
-			 "snf_ring_open failed: %s", pcap_strerror(err));
+			 "snf_ring_open_id(ring=%d) failed: %s",
+			 ring_id, pcap_strerror(err));
 		return -1;
 	}
 
@@ -255,12 +314,104 @@
 	p->setnonblock_op = snf_setnonblock;
 	p->stats_op = snf_pcap_stats;
 	p->cleanup_op = snf_platform_cleanup;
+#ifdef SNF_HAVE_INJECT_API
+        ps->snf_inj = NULL;
+#endif
 	return 0;
 }
 
+#define MAX_DESC_LENGTH 128
 int
 snf_findalldevs(pcap_if_t **devlistp, char *errbuf)
 {
+	pcap_if_t *devlist = NULL,*curdev,*prevdev;
+	pcap_addr_t *curaddr;
+	struct snf_ifaddrs *ifaddrs, *ifa;
+	char desc[MAX_DESC_LENGTH];
+	int ret;
+
+	if (snf_init(SNF_VERSION_API))
+		return (-1);
+
+	if (snf_getifaddrs(&ifaddrs) || ifaddrs == NULL)
+	{
+		(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
+			"snf_getifaddrs: %s", pcap_strerror(errno));
+		return (-1);
+	}
+	ifa = ifaddrs;
+	while (ifa)
+	{
+		/*
+		 * Allocate a new entry
+		 */
+		curdev = (pcap_if_t *)malloc(sizeof(pcap_if_t));
+		if (curdev == NULL) {
+		(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
+			"snf_findalldevs malloc: %s", pcap_strerror(errno));
+			return (-1);
+		}
+		if (devlist == NULL) /* save first entry */
+			devlist = curdev;
+		else
+			prevdev->next = curdev;
+		/*
+		 * Fill in the entry.
+		 */
+		curdev->next = NULL;
+		curdev->name = strdup(ifa->snf_ifa_name);
+		if (curdev->name == NULL) {
+			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
+			    "snf_findalldevs strdup: %s", pcap_strerror(errno));
+			free(curdev);
+			return (-1);
+		}
+		(void)snprintf(desc,MAX_DESC_LENGTH,"Myricom snf%d",
+				ifa->snf_ifa_portnum);
+		curdev->description = strdup(desc);
+		if (curdev->description == NULL) {
+			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
+			"snf_findalldevs strdup1: %s", pcap_strerror(errno));
+			free(curdev->name);
+			free(curdev);
+			return (-1);
+		}
+		curdev->addresses = NULL;
+		curdev->flags = 0;
+
+		curaddr = (pcap_addr_t *)malloc(sizeof(pcap_addr_t));
+		if (curaddr == NULL) {
+			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
+			     "snf_findalldevs malloc1: %s", pcap_strerror(errno));
+			free(curdev->description);
+			free(curdev->name);
+			free(curdev);
+			return (-1);
+		}
+		curdev->addresses = curaddr;
+		curaddr->next = NULL;
+		curaddr->addr = (struct sockaddr*)malloc(sizeof(struct sockaddr_storage));
+		if (curaddr->addr == NULL) {
+			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
+			    "malloc2: %s", pcap_strerror(errno));
+			free(curdev->description);
+			free(curdev->name);
+			free(curaddr);
+			free(curdev);
+			return (-1);
+		}
+		curaddr->addr->sa_family = AF_INET;
+		curaddr->netmask = NULL;
+		curaddr->broadaddr = NULL;
+		curaddr->dstaddr = NULL;
+		curaddr->next = NULL;
+
+		prevdev = curdev;
+		ifa = ifa->snf_ifa_next;
+	}
+	snf_freeifaddrs(ifaddrs);
+	*devlistp = devlist;
+
 	/*
 	 * There are no platform-specific devices since each device
 	 * exists as a regular Ethernet device.
@@ -324,6 +475,22 @@
 		return NULL;
 	ps = p->priv;
 
+	/*
+	 * We support microsecond and nanosecond time stamps.
+	 */
+	p->tstamp_precision_count = 2;
+	p->tstamp_precision_list = malloc(2 * sizeof(u_int));
+	if (p->tstamp_precision_list == NULL) {
+		snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s",
+		    pcap_strerror(errno));
+		if (p->tstamp_type_list != NULL)
+			free(p->tstamp_type_list);
+		free(p);
+		return NULL;
+	}
+	p->tstamp_precision_list[0] = PCAP_TSTAMP_PRECISION_MICRO;
+	p->tstamp_precision_list[1] = PCAP_TSTAMP_PRECISION_NANO;
+
 	p->activate_op = snf_activate;
 	ps->snf_boardnum = boardnum;
 	return p;
diff --git a/pcap-snit.c b/pcap-snit.c
index 12656b8..0ce7860 100644
--- a/pcap-snit.c
+++ b/pcap-snit.c
@@ -23,11 +23,6 @@
  * This module now handles the STREAMS based NIT.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-snit.c,v 1.77 2008-04-14 20:40:58 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -216,7 +211,7 @@
 pcap_inject_snit(pcap_t *p, const void *buf, size_t size)
 {
 	struct strbuf ctl, data;
-	
+
 	/*
 	 * XXX - can we just do
 	 *
diff --git a/pcap-snoop.c b/pcap-snoop.c
index a49db87..f622f31 100644
--- a/pcap-snoop.c
+++ b/pcap-snoop.c
@@ -18,10 +18,6 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-snoop.c,v 1.59 2008-12-02 16:25:14 guy Exp $ (LBL)";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -118,7 +114,7 @@
 	caplen = (datalen < p->snapshot) ? datalen : p->snapshot;
 	cp = (u_char *)(sh + 1) + p->offset;		/* XXX */
 
-	/* 
+	/*
 	 * XXX unfortunately snoop loopback isn't exactly like
 	 * BSD's.  The address family is encoded in the first 2
 	 * bytes rather than the first 4 bytes!  Luckily the last
@@ -159,7 +155,7 @@
 		return (-1);
 	}
 	return (ret);
-}                           
+}
 
 static int
 pcap_stats_snoop(pcap_t *p, struct pcap_stat *ps)
diff --git a/pcap-stdinc.h b/pcap-stdinc.h
index f1c736e..f70dcce 100644
--- a/pcap-stdinc.h
+++ b/pcap-stdinc.h
@@ -27,63 +27,57 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-stdinc.h,v 1.10.2.1 2008-10-06 15:38:39 gianluca Exp $ (LBL)
  */
 #ifndef pcap_stdinc_h
 #define pcap_stdinc_h
 
 /*
- * Avoids a compiler warning in case this was already defined      
+ * Avoids a compiler warning in case this was already defined
  * (someone defined _WINSOCKAPI_ when including 'windows.h', in order
  * to prevent it from including 'winsock.h')
  */
 #ifdef _WINSOCKAPI_
 #undef _WINSOCKAPI_
 #endif
+
 #include <winsock2.h>
-
 #include <fcntl.h>
-
-#include "bittypes.h"
 #include <time.h>
 #include <io.h>
 
-#ifndef __MINGW32__
+#include "bittypes.h"
 #include "IP6_misc.h"
-#endif
 
 #define caddr_t char*
 
-#if _MSC_VER < 1500
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-#define strdup _strdup
+#if defined(_MSC_VER)
+  #define snprintf  _snprintf
+  #define vsnprintf _vsnprintf
+  #define strdup    _strdup
 #endif
 
-#define inline __inline 
+#define inline __inline
 
 #ifdef __MINGW32__
-#include <stdint.h>
-#else /*__MINGW32__*/
-/* MSVC compiler */
-#ifndef _UINTPTR_T_DEFINED
-#ifdef  _WIN64
-typedef unsigned __int64    uintptr_t;
+  #include <stdint.h>
 #else
-typedef _W64 unsigned int   uintptr_t;
-#endif
-#define _UINTPTR_T_DEFINED
-#endif
+  #ifndef _UINTPTR_T_DEFINED
+    #ifdef  _WIN64
+      typedef unsigned __int64    uintptr_t;
+    #else
+      typedef _W64 unsigned int   uintptr_t;
+    #endif
+    #define _UINTPTR_T_DEFINED
+  #endif
 
-#ifndef _INTPTR_T_DEFINED
-#ifdef  _WIN64
-typedef __int64    intptr_t;
-#else
-typedef _W64 int   intptr_t;
-#endif
-#define _INTPTR_T_DEFINED
-#endif 
-
+  #ifndef _INTPTR_T_DEFINED
+    #ifdef  _WIN64
+      typedef __int64    intptr_t;
+    #else
+      typedef _W64 int   intptr_t;
+    #endif
+    #define _INTPTR_T_DEFINED
+  #endif
 #endif /*__MINGW32__*/
+
 #endif /* pcap_stdinc_h */
diff --git a/pcap-tstamp.manmisc.in b/pcap-tstamp.manmisc.in
index 2cd32c6..74a9a35 100644
--- a/pcap-tstamp.manmisc.in
+++ b/pcap-tstamp.manmisc.in
@@ -19,7 +19,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP-TSTAMP @MAN_MISC_INFO@ "22 August 2010"
+.TH PCAP-TSTAMP @MAN_MISC_INFO@ "21 December 2013"
 .SH NAME
 pcap-tstamp \- packet time stamps in libpcap
 .SH DESCRIPTION
@@ -95,7 +95,7 @@
 use in code, the second value is the value returned by
 .B pcap_tstamp_type_val_to_name()
 and accepted by
-.BR pcap_tstamp_name_to_val() .
+.BR pcap_tstamp_type_name_to_val() .
 .RS 5
 .TP 5
 .BR PCAP_TSTAMP_HOST " - " host
@@ -104,12 +104,12 @@
 synchronized with the host operating system's clock.
 .TP 5
 .BR PCAP_TSTAMP_HOST_LOWPREC " - " host_lowprec
-Time stamp provided by the host on which the capture is being done. 
+Time stamp provided by the host on which the capture is being done.
 This is a low-precision time stamp, synchronized with the host operating
 system's clock.
 .TP 5
 .BR PCAP_TSTAMP_HOST_HIPREC " - " host_hiprec
-Time stamp provided by the host on which the capture is being done. 
+Time stamp provided by the host on which the capture is being done.
 This is a high-precision time stamp; it might or might not be
 synchronized with the host operating system's clock.  It might be more
 expensive to fetch than
@@ -125,8 +125,51 @@
 done.  This is a high-precision time stamp; it is not synchronized with
 the host operating system's clock.
 .RE
+.LP
+By default, when performing a live capture or reading from a savefile,
+time stamps are supplied as seconds since January 1, 1970, 00:00:00 UTC,
+and microseconds since that seconds value, even if higher-resolution
+time stamps are available from the capture device or in the savefile.
+If, when reading a savefile, the time stamps in the file have a higher
+resolution than one microsecond, the additional digits of resolution are
+discarded.
+.LP
+The
+.BR pcap_set_tstamp_precision (3PCAP)
+routine can be used after a
+.B pcap_create()
+call and after a
+.B pcap_activate()
+call to specify the resolution of the time stamps to get for the device.
+If the hardware or software cannot supply a higher-resolution time
+stamp, the
+.B pcap_set_tstamp_precision()
+call will fail, and the time stamps supplied after the
+.B pcap_activate()
+call will have microsecond resolution.
+.LP
+When opening a savefile, the
+.BR pcap_open_offline_with_tstamp_precision (3PCAP)
+and
+.BR pcap_fopen_offline_with_tstamp_precision (3PCAP)
+routines can be used to specify the resolution of time stamps to be read
+from the file; if the time stamps in the file have a lower resolution,
+the fraction-of-a-second portion of the time stamps will be scaled to
+the specified resolution.
+.LP
+The
+.BR pcap_get_tstamp_precision (3PCAP)
+routine returns the resolution of time stamps that will be supplied;
+when capturing packets, this does not reflect the actual precision of
+the time stamp supplied by the hardware or operating system and, when
+reading a savefile, this does not indicate the actual precision of time
+stamps in the file.
 .SH SEE ALSO
 pcap_set_tstamp_type(3PCAP),
 pcap_list_tstamp_types(3PCAP),
 pcap_tstamp_type_val_to_name(3PCAP),
-pcap_tstamp_name_to_val(3PCAP)
+pcap_tstamp_type_name_to_val(3PCAP),
+pcap_set_tstamp_precision(3PCAP),
+pcap_open_offline_with_tstamp_precision(3PCAP),
+pcap_fopen_offline_with_tstamp_precision(3PCAP),
+pcap_get_tstamp_precision(3PCAP)
diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c
index f0892a7..957273a 100644
--- a/pcap-usb-linux.c
+++ b/pcap-usb-linux.c
@@ -11,8 +11,8 @@
  * 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. The name of the author may not be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
  * permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -32,11 +32,7 @@
  * Modifications: Kris Katterjohn <katterjohn@gmail.com>
  *
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-usb-linux.c,v 1.33 2008-12-23 21:38:50 guy Exp $ (LBL)";
-#endif
- 
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -143,21 +139,21 @@
 static void usb_cleanup_linux_mmap(pcap_t *);
 
 /* facility to add an USB device to the device list*/
-static int 
+static int
 usb_dev_add(pcap_if_t** alldevsp, int n, char *err_str)
 {
 	char dev_name[10];
-	char dev_descr[30]; 
+	char dev_descr[30];
 	snprintf(dev_name, 10, USB_IFACE"%d", n);
 	snprintf(dev_descr, 30, "USB bus number %d", n);
 
-	if (pcap_add_if(alldevsp, dev_name, 0, 
+	if (pcap_add_if(alldevsp, dev_name, 0,
 	    dev_descr, err_str) < 0)
 		return -1;
-	return 0; 
+	return 0;
 }
 
-int 
+int
 usb_findalldevs(pcap_if_t **alldevsp, char *err_str)
 {
 	struct dirent* data;
@@ -176,7 +172,7 @@
 			if (strncmp(name, "usb", 3) != 0)
 				continue;
 
-			if (sscanf(&name[3], "%d", &n) == 0) 
+			if (sscanf(&name[3], "%d", &n) == 0)
 				continue;
 
 			ret = usb_dev_add(alldevsp, n, err_str);
@@ -197,7 +193,7 @@
 			if ((len < 1) || !isdigit(name[--len]))
 				continue;
 			while (isdigit(name[--len]));
-			if (sscanf(&name[len+1], "%d", &n) != 1) 
+			if (sscanf(&name[len+1], "%d", &n) != 1)
 				continue;
 
 			ret = usb_dev_add(alldevsp, n, err_str);
@@ -211,12 +207,12 @@
 	return 0;
 }
 
-static 
+static
 int usb_mmap(pcap_t* handle)
 {
 	struct pcap_usb_linux *handlep = handle->priv;
 	int len = ioctl(handle->fd, MON_IOCQ_RING_SIZE);
-	if (len < 0) 
+	if (len < 0)
 		return 0;
 
 	handlep->mmapbuflen = len;
@@ -225,6 +221,8 @@
 	return handlep->mmapbuf != MAP_FAILED;
 }
 
+#ifdef HAVE_LINUX_USBDEVICE_FS_H
+
 #define CTRL_TIMEOUT    (5*1000)        /* milliseconds */
 
 #define USB_DIR_IN		0x80
@@ -262,7 +260,7 @@
 			continue;
 
 		snprintf(buf, sizeof(buf), "/dev/bus/usb/%03d/%s", bus, data->d_name);
-		
+
 		fd = open(buf, O_RDWR);
 		if (fd == -1)
 			continue;
@@ -293,6 +291,7 @@
 	}
 	closedir(dir);
 }
+#endif /* HAVE_LINUX_USBDEVICE_FS_H */
 
 pcap_t *
 usb_create(const char *device, char *ebuf, int *is_ours)
@@ -364,7 +363,7 @@
 	}
 
 	/*now select the read method: try to open binary interface */
-	snprintf(full_path, USB_LINE_LEN, LINUX_USB_MON_DEV"%d", handlep->bus_index);  
+	snprintf(full_path, USB_LINE_LEN, LINUX_USB_MON_DEV"%d", handlep->bus_index);
 	handle->fd = open(full_path, O_RDONLY, 0);
 	if (handle->fd >= 0)
 	{
@@ -382,7 +381,9 @@
 			handle->stats_op = usb_stats_linux_bin;
 			handle->read_op = usb_read_linux_mmap;
 			handle->cleanup_op = usb_cleanup_linux_mmap;
+#ifdef HAVE_LINUX_USBDEVICE_FS_H
 			probe_devices(handlep->bus_index);
+#endif
 
 			/*
 			 * "handle->fd" is a real file, so "select()" and
@@ -395,11 +396,13 @@
 		/* can't mmap, use plain binary interface access */
 		handle->stats_op = usb_stats_linux_bin;
 		handle->read_op = usb_read_linux_bin;
+#ifdef HAVE_LINUX_USBDEVICE_FS_H
 		probe_devices(handlep->bus_index);
+#endif
 	}
 	else {
 		/*Binary interface not available, try open text interface */
-		snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR"/%dt", handlep->bus_index);  
+		snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR"/%dt", handlep->bus_index);
 		handle->fd = open(full_path, O_RDONLY, 0);
 		if (handle->fd < 0)
 		{
@@ -409,7 +412,7 @@
 				 * Not found at the new location; try
 				 * the old location.
 				 */
-				snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%dt", handlep->bus_index);  
+				snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%dt", handlep->bus_index);
 				handle->fd = open(full_path, O_RDONLY, 0);
 			}
 			if (handle->fd < 0) {
@@ -450,22 +453,22 @@
 	return 0;
 }
 
-static inline int 
+static inline int
 ascii_to_int(char c)
 {
 	return c < 'A' ? c- '0': ((c<'a') ? c - 'A' + 10: c-'a'+10);
 }
 
 /*
- * see <linux-kernel-source>/Documentation/usb/usbmon.txt and 
- * <linux-kernel-source>/drivers/usb/mon/mon_text.c for urb string 
+ * see <linux-kernel-source>/Documentation/usb/usbmon.txt and
+ * <linux-kernel-source>/drivers/usb/mon/mon_text.c for urb string
  * format description
  */
 static int
 usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *user)
 {
 	/* see:
-	* /usr/src/linux/Documentation/usb/usbmon.txt 
+	* /usr/src/linux/Documentation/usb/usbmon.txt
 	* for message format
 	*/
 	struct pcap_usb_linux *handlep = handle->priv;
@@ -498,11 +501,11 @@
 		return -1;
 	}
 
-	/* read urb header; %n argument may increment return value, but it's 
+	/* read urb header; %n argument may increment return value, but it's
 	* not mandatory, so does not count on it*/
 	string[ret] = 0;
-	ret = sscanf(string, "%x %d %c %c%c:%d:%d %s%n", &tag, &timestamp, &etype, 
-		&pipeid1, &pipeid2, &dev_addr, &ep_num, status, 
+	ret = sscanf(string, "%x %d %c %c%c:%d:%d %s%n", &tag, &timestamp, &etype,
+		&pipeid1, &pipeid2, &dev_addr, &ep_num, status,
 		&cnt);
 	if (ret < 8)
 	{
@@ -518,10 +521,10 @@
 	string += cnt;
 
 	/* don't use usbmon provided timestamp, since it have low precision*/
-	if (gettimeofday(&pkth.ts, NULL) < 0) 
+	if (gettimeofday(&pkth.ts, NULL) < 0)
 	{
 		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
-			"Can't get timestamp for message '%s' %d:%s", 
+			"Can't get timestamp for message '%s' %d:%s",
 			string, errno, strerror(errno));
 		return -1;
 	}
@@ -564,11 +567,11 @@
 	if (ret != 1)
 	{
 		/* this a setup packet, setup data can be filled with underscore if
-		* usbmon has not been able to read them, so we must parse this fields as 
+		* usbmon has not been able to read them, so we must parse this fields as
 		* strings */
 		pcap_usb_setup* shdr;
 		char str1[3], str2[3], str3[5], str4[5], str5[5];
-		ret = sscanf(string, "%s %s %s %s %s%n", str1, str2, str3, str4, 
+		ret = sscanf(string, "%s %s %s %s %s%n", str1, str2, str3, str4,
 		str5, &cnt);
 		if (ret < 5)
 		{
@@ -589,7 +592,7 @@
 
 		uhdr->setup_flag = 0;
 	}
-	else 
+	else
 		uhdr->setup_flag = 1;
 
 	/* read urb data */
@@ -602,7 +605,7 @@
 	}
 	string += cnt;
 
-	/* urb tag is not present if urb length is 0, so we can stop here 
+	/* urb tag is not present if urb length is 0, so we can stop here
 	 * text parsing */
 	pkth.len = urb_len+pkth.caplen;
 	uhdr->urb_len = urb_len;
@@ -619,7 +622,7 @@
 		return -1;
 	}
 
-	if (urb_tag != '=') 
+	if (urb_tag != '=')
 		goto got;
 
 	/* skip urb tag and following space */
@@ -628,7 +631,7 @@
 	/* if we reach this point we got some urb data*/
 	uhdr->data_flag = 0;
 
-	/* read all urb data; if urb length is greater then the usbmon internal 
+	/* read all urb data; if urb length is greater then the usbmon internal
 	 * buffer length used by the kernel to spool the URB, we get only
 	 * a partial information.
 	 * At least until linux 2.6.17 there is no way to set usbmon intenal buffer
@@ -667,7 +670,7 @@
 	return (-1);
 }
 
-static int 
+static int
 usb_stats_linux(pcap_t *handle, struct pcap_stat *stats)
 {
 	struct pcap_usb_linux *handlep = handle->priv;
@@ -692,7 +695,7 @@
 		}
 		if (fd < 0) {
 			snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
-				"Can't open USB stats file %s: %s", 
+				"Can't open USB stats file %s: %s",
 				string, strerror(errno));
 			return -1;
 		}
@@ -714,11 +717,11 @@
 
 	/* extract info on dropped urbs */
 	for (consumed=0; consumed < ret; ) {
-		/* from the sscanf man page: 
- 		 * The C standard says: "Execution of a %n directive does 
+		/* from the sscanf man page:
+ 		 * The C standard says: "Execution of a %n directive does
  		 * not increment the assignment count returned at the completion
 		 * of  execution" but the Corrigendum seems to contradict this.
-		 * Do not make any assumptions on the effect of %n conversions 
+		 * Do not make any assumptions on the effect of %n conversions
 		 * on the return value and explicitly check for cnt assignmet*/
 		int ntok;
 
@@ -730,7 +733,7 @@
 		ptr += cnt;
 		if (strcmp(token, "nreaders") == 0)
 			ret = sscanf(ptr, "%d", &stats->ps_drop);
-		else 
+		else
 			ret = sscanf(ptr, "%d", &dummy);
 		if (ntok != 1)
 			break;
@@ -743,7 +746,7 @@
 	return 0;
 }
 
-static int 
+static int
 usb_setdirection_linux(pcap_t *p, pcap_direction_t d)
 {
 	p->direction = d;
@@ -751,7 +754,7 @@
 }
 
 
-static int 
+static int
 usb_stats_linux_bin(pcap_t *handle, struct pcap_stat *stats)
 {
 	struct pcap_usb_linux *handlep = handle->priv;
@@ -772,7 +775,7 @@
 }
 
 /*
- * see <linux-kernel-source>/Documentation/usb/usbmon.txt and 
+ * see <linux-kernel-source>/Documentation/usb/usbmon.txt and
  * <linux-kernel-source>/drivers/usb/mon/mon_bin.c binary ABI
  */
 static int
@@ -830,7 +833,7 @@
 }
 
 /*
- * see <linux-kernel-source>/Documentation/usb/usbmon.txt and 
+ * see <linux-kernel-source>/Documentation/usb/usbmon.txt and
  * <linux-kernel-source>/drivers/usb/mon/mon_bin.c binary ABI
  */
 #define VEC_SIZE 32
@@ -884,7 +887,7 @@
 		for (i=0; i<fetch.nfetch; ++i) {
 			/* discard filler */
 			hdr = (pcap_usb_header*) &handlep->mmapbuf[vec[i]];
-			if (hdr->event_type == '@') 
+			if (hdr->event_type == '@')
 				continue;
 
 			/* we can get less that than really captured from kernel, depending on
@@ -914,7 +917,11 @@
 	}
 
 	/* flush pending events*/
-	ioctl(handle->fd, MON_IOCH_MFLUSH, nflush);
+	if (ioctl(handle->fd, MON_IOCH_MFLUSH, nflush) == -1) {
+		snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+		    "Can't mflush fd %d: %s", handle->fd, strerror(errno));
+		return -1;
+	}
 	return packets;
 }
 
diff --git a/pcap-usb-linux.h b/pcap-usb-linux.h
index d64386d..234a262 100644
--- a/pcap-usb-linux.h
+++ b/pcap-usb-linux.h
@@ -11,8 +11,8 @@
  * 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. The name of the author may not be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
  * permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -29,8 +29,6 @@
  *
  * USB sniffing API implementation for Linux platform
  * By Paolo Abeni <paolo.abeni@email.it>
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-usb-linux.h,v 1.5 2008-04-04 19:37:45 guy Exp $ (LBL)
  */
 
 /*
diff --git a/pcap-win32.c b/pcap-win32.c
index 87b3fc6..f449f79 100644
--- a/pcap-win32.c
+++ b/pcap-win32.c
@@ -12,9 +12,9 @@
  * 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. Neither the name of the Politecnico di Torino, CACE Technologies 
- * nor the names of its contributors may be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. Neither the name of the Politecnico di Torino, CACE Technologies
+ * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -31,11 +31,6 @@
  *
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-win32.c,v 1.42 2008-05-21 22:15:25 gianluca Exp $ (LBL)";
-#endif
-
 #include <pcap-int.h>
 #include <Packet32.h>
 #ifdef __MINGW32__
@@ -77,6 +72,8 @@
 struct pcap_win {
 	int nonblock;
 
+	int filtering_in_kernel; /* using kernel filter */
+
 #ifdef HAVE_DAG_API
 	int	dag_fcs_bits;	/* Number of checksum bits from link layer */
 #endif
@@ -111,21 +108,32 @@
 }
 
 /* Start winsock */
-int 
+int
 wsockinit()
 {
 	WORD wVersionRequested;
 	WSADATA wsaData;
-	int err;
-	wVersionRequested = MAKEWORD( 1, 1); 
+	static int err = -1;
+	static int done = 0;
+
+	if (done)
+		return err;
+
+	wVersionRequested = MAKEWORD( 1, 1);
 	err = WSAStartup( wVersionRequested, &wsaData );
+	atexit ((void(*)(void))WSACleanup);
+	InitializeCriticalSection(&g_PcapCompileCriticalSection);
+	done = 1;
+
 	if ( err != 0 )
-	{
-		return -1;
-	}
-	return 0;
+		err = -1;
+	return err;
 }
 
+int pcap_wsockinit()
+{
+       return wsockinit();
+}
 
 static int
 pcap_stats_win32(pcap_t *p, struct pcap_stat *ps)
@@ -189,6 +197,8 @@
 	int cc;
 	int n = 0;
 	register u_char *bp, *ep;
+	u_char *datap;
+	struct pcap_win *pw = p->priv;
 
 	cc = p->cc;
 	if (p->cc == 0) {
@@ -198,23 +208,23 @@
 		if (p->break_loop) {
 			/*
 			 * Yes - clear the flag that indicates that it
-			 * has, and return -2 to indicate that we were
-			 * told to break out of the loop.
+			 * has, and return PCAP_ERROR_BREAK to indicate
+			 * that we were told to break out of the loop.
 			 */
 			p->break_loop = 0;
-			return (-2);
+			return (PCAP_ERROR_BREAK);
 		}
 
 	    /* capture the packets */
 		if(PacketReceivePacket(p->adapter,p->Packet,TRUE)==FALSE){
 			snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error: PacketReceivePacket failed");
-			return (-1);
+			return (PCAP_ERROR);
 		}
-			
+
 		cc = p->Packet->ulBytesReceived;
 
 		bp = p->Packet->Buffer;
-	} 
+	}
 	else
 		bp = p->bp;
 
@@ -229,16 +239,17 @@
 		/*
 		 * Has "pcap_breakloop()" been called?
 		 * If so, return immediately - if we haven't read any
-		 * packets, clear the flag and return -2 to indicate
-		 * that we were told to break out of the loop, otherwise
-		 * leave the flag set, so that the *next* call will break
-		 * out of the loop without having read any packets, and
-		 * return the number of packets we've processed so far.
+		 * packets, clear the flag and return PCAP_ERROR_BREAK
+		 * to indicate that we were told to break out of the loop,
+		 * otherwise leave the flag set, so that the *next* call
+		 * will break out of the loop without having read any
+		 * packets, and return the number of packets we've
+		 * processed so far.
 		 */
 		if (p->break_loop) {
 			if (n == 0) {
 				p->break_loop = 0;
-				return (-2);
+				return (PCAP_ERROR_BREAK);
 			} else {
 				p->bp = bp;
 				p->cc = ep - bp;
@@ -250,16 +261,35 @@
 
 		caplen = bhp->bh_caplen;
 		hdrlen = bhp->bh_hdrlen;
+		datap = bp + hdrlen;
 
 		/*
-		 * XXX A bpf_hdr matches a pcap_pkthdr.
+		 * Short-circuit evaluation: if using BPF filter
+		 * in kernel, no need to do it now - we already know
+		 * the packet passed the filter.
+		 *
+		 * XXX - bpf_filter() should always return TRUE if
+		 * handed a null pointer for the program, but it might
+		 * just try to "run" the filter, so we check here.
 		 */
-		(*callback)(user, (struct pcap_pkthdr*)bp, bp + hdrlen);
-		bp += Packet_WORDALIGN(caplen + hdrlen);
-		if (++n >= cnt && !PACKET_COUNT_IS_UNLIMITED(cnt)) {
-			p->bp = bp;
-			p->cc = ep - bp;
-			return (n);
+		if (pw->filtering_in_kernel ||
+		    p->fcode.bf_insns == NULL ||
+		    bpf_filter(p->fcode.bf_insns, datap, bhp->bh_datalen, caplen)) {
+			/*
+			 * XXX A bpf_hdr matches a pcap_pkthdr.
+			 */
+			(*callback)(user, (struct pcap_pkthdr*)bp, datap);
+			bp += Packet_WORDALIGN(caplen + hdrlen);
+			if (++n >= cnt && !PACKET_COUNT_IS_UNLIMITED(cnt)) {
+				p->bp = bp;
+				p->cc = ep - bp;
+				return (n);
+			}
+		} else {
+			/*
+			 * Skip this packet.
+			 */
+			bp += Packet_WORDALIGN(caplen + hdrlen);
 		}
 	}
 #undef bhp
@@ -298,14 +328,14 @@
 			/* The timeout has expired but we no packets arrived */
 			return 0;
 		header = (dag_record_t*)p->adapter->DagBuffer;
-	} 
+	}
 	else
 		header = (dag_record_t*)p->bp;
-	
+
 	endofbuf = (char*)header + cc;
-	
-	/* 
-	 * Cycle through the packets 
+
+	/*
+	 * Cycle through the packets
 	 */
 	do
 	{
@@ -315,12 +345,12 @@
 
 		/* Increase the number of captured packets */
 		pw->stat.ps_recv++;
-		
+
 		/* Find the beginning of the packet */
 		dp = ((u_char *)header) + dag_record_size;
 
 		/* Determine actual packet len */
-		switch(header->type) 
+		switch(header->type)
 		{
 		case TYPE_ATM:
 			packet_len = ATM_SNAPLEN;
@@ -338,9 +368,9 @@
 				caplen = packet_len;
 			}
 			dp += 2;
-			
+
 			break;
-		
+
 		case TYPE_HDLC_POS:
 			swt = SWAPS(header->wlen);
 			packet_len = swt - (pw->dag_fcs_bits);
@@ -349,10 +379,10 @@
 			{
 				caplen = packet_len;
 			}
-			
+
 			break;
 		}
-		
+
 		if(caplen > p->snapshot)
 			caplen = p->snapshot;
 
@@ -365,14 +395,14 @@
 		 * out of the loop without having read any packets, and
 		 * return the number of packets we've processed so far.
 		 */
-		if (p->break_loop) 
+		if (p->break_loop)
 		{
-			if (n == 0) 
+			if (n == 0)
 			{
 				p->break_loop = 0;
 				return (-2);
-			} 
-			else 
+			}
+			else
 			{
 				p->bp = (char*)header;
 				p->cc = endofbuf - (char*)header;
@@ -393,30 +423,30 @@
 				pcap_header.ts.tv_sec++;
 			}
 		}
-		
+
 		/* No underlaying filtering system. We need to filter on our own */
-		if (p->fcode.bf_insns) 
+		if (p->fcode.bf_insns)
 		{
-			if (bpf_filter(p->fcode.bf_insns, dp, packet_len, caplen) == 0) 
+			if (bpf_filter(p->fcode.bf_insns, dp, packet_len, caplen) == 0)
 			{
 				/* Move to next packet */
 				header = (dag_record_t*)((char*)header + erf_record_len);
 				continue;
 			}
 		}
-		
+
 		/* Fill the header for the user suppplied callback function */
 		pcap_header.caplen = caplen;
 		pcap_header.len = packet_len;
-		
+
 		/* Call the callback function */
 		(*callback)(user, &pcap_header, dp);
-		
+
 		/* Move to next packet */
 		header = (dag_record_t*)((char*)header + erf_record_len);
 
 		/* Stop if the number of packets requested by user has been reached*/
-		if (++n >= cnt && !PACKET_COUNT_IS_UNLIMITED(cnt)) 
+		if (++n >= cnt && !PACKET_COUNT_IS_UNLIMITED(cnt))
 		{
 			p->bp = (char*)header;
 			p->cc = endofbuf - (char*)header;
@@ -424,24 +454,24 @@
 		}
 	}
 	while((u_char*)header < endofbuf);
-	
+
   return 1;
 }
 #endif /* HAVE_DAG_API */
 
 /* Send a packet to the network */
-static int 
+static int
 pcap_inject_win32(pcap_t *p, const void *buf, size_t size){
 	LPPACKET PacketToSend;
 
 	PacketToSend=PacketAllocatePacket();
-	
+
 	if (PacketToSend == NULL)
 	{
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: PacketAllocatePacket failed");
 		return -1;
 	}
-	
+
 	PacketInitPacket(PacketToSend,(PVOID)buf,size);
 	if(PacketSendPacket(p->adapter,PacketToSend,TRUE) == FALSE){
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: PacketSendPacket failed");
@@ -492,28 +522,28 @@
 	wsockinit();
 
 	p->adapter = PacketOpenAdapter(p->opt.source);
-	
+
 	if (p->adapter == NULL)
 	{
 		/* Adapter detected but we are not able to open it. Return failure. */
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Error opening adapter: %s", pcap_win32strerror());
 		return PCAP_ERROR;
 	}
-	
+
 	/*get network type*/
 	if(PacketGetNetType (p->adapter,&type) == FALSE)
 	{
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Cannot determine the network type: %s", pcap_win32strerror());
 		goto bad;
 	}
-	
+
 	/*Set the linktype*/
-	switch (type.LinkType) 
+	switch (type.LinkType)
 	{
 	case NdisMediumWan:
 		p->linktype = DLT_EN10MB;
 		break;
-		
+
 	case NdisMedium802_3:
 		p->linktype = DLT_EN10MB;
 		/*
@@ -536,27 +566,27 @@
 			p->dlt_count = 2;
 		}
 		break;
-		
+
 	case NdisMediumFddi:
 		p->linktype = DLT_FDDI;
 		break;
-		
-	case NdisMedium802_5:			
-		p->linktype = DLT_IEEE802;	
+
+	case NdisMedium802_5:
+		p->linktype = DLT_IEEE802;
 		break;
-		
+
 	case NdisMediumArcnetRaw:
 		p->linktype = DLT_ARCNET;
 		break;
-		
+
 	case NdisMediumArcnet878_2:
 		p->linktype = DLT_ARCNET;
 		break;
-		
+
 	case NdisMediumAtm:
 		p->linktype = DLT_ATM_RFC1483;
 		break;
-		
+
 	case NdisMediumCHDLC:
 		p->linktype = DLT_CHDLC;
 		break;
@@ -587,7 +617,7 @@
 	}
 
 	/* Set promiscuous mode */
-	if (p->opt.promisc) 
+	if (p->opt.promisc)
 	{
 
 		if (PacketSetHwFilter(p->adapter,NDIS_PACKET_TYPE_PROMISCUOUS) == FALSE)
@@ -596,7 +626,7 @@
 			goto bad;
 		}
 	}
-	else 
+	else
 	{
 		if (PacketSetHwFilter(p->adapter,NDIS_PACKET_TYPE_ALL_LOCAL) == FALSE)
 		{
@@ -617,8 +647,8 @@
 
 	if(!(p->adapter->Flags & INFO_FLAG_DAG_CARD))
 	{
-	/* 
-	 * Traditional Adapter 
+	/*
+	 * Traditional Adapter
 	 */
 		/*
 		 * If the buffer size wasn't explicitly set, default to
@@ -632,17 +662,17 @@
 			snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "driver error: not enough memory to allocate the kernel buffer");
 			goto bad;
 		}
-		
+
 		p->buffer = (u_char *)malloc(p->bufsize);
-		if (p->buffer == NULL) 
+		if (p->buffer == NULL)
 		{
 			snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "malloc: %s", pcap_strerror(errno));
 			goto bad;
 		}
-		
+
 		PacketInitPacket(p->Packet,(BYTE*)p->buffer,p->bufsize);
-		
-		if (p-opt.immediate)
+
+		if (p->opt.immediate)
 		{
 			/* tell the driver to copy the buffer as soon as data arrives */
 			if(PacketSetMinToCopy(p->adapter,0)==FALSE)
@@ -664,8 +694,8 @@
 	else
 #ifdef HAVE_DAG_API
 	{
-	/* 
-	 * Dag Card 
+	/*
+	 * Dag Card
 	 */
 		LONG	status;
 		HKEY	dagkey;
@@ -673,8 +703,8 @@
 		DWORD	lpcbdata;
 		int		postype = 0;
 		char	keyname[512];
-		
-		snprintf(keyname, sizeof(keyname), "%s\\CardParams\\%s", 
+
+		snprintf(keyname, sizeof(keyname), "%s\\CardParams\\%s",
 			"SYSTEM\\CurrentControlSet\\Services\\DAG",
 			strstr(_strlwr(p->opt.source), "dag"));
 		do
@@ -682,36 +712,36 @@
 			status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyname, 0, KEY_READ, &dagkey);
 			if(status != ERROR_SUCCESS)
 				break;
-			
+
 			status = RegQueryValueEx(dagkey,
 				"PosType",
 				NULL,
 				&lptype,
 				(char*)&postype,
 				&lpcbdata);
-			
+
 			if(status != ERROR_SUCCESS)
 			{
 				postype = 0;
 			}
-			
+
 			RegCloseKey(dagkey);
 		}
 		while(FALSE);
-		
-		
+
+
 		p->snapshot = PacketSetSnapLen(p->adapter, snaplen);
-		
-		/* Set the length of the FCS associated to any packet. This value 
+
+		/* Set the length of the FCS associated to any packet. This value
 		 * will be subtracted to the packet length */
 		pw->dag_fcs_bits = p->adapter->DagFcsLen;
 	}
 #else
 	goto bad;
 #endif /* HAVE_DAG_API */
-	
+
 	PacketSetReadTimeout(p->adapter, p->opt.timeout);
-	
+
 #ifdef HAVE_DAG_API
 	if(p->adapter->Flags & INFO_FLAG_DAG_CARD)
 	{
@@ -794,17 +824,52 @@
 static int
 pcap_setfilter_win32_npf(pcap_t *p, struct bpf_program *fp)
 {
+	struct pcap_win *pw = p->priv;
+
 	if(PacketSetBpf(p->adapter,fp)==FALSE){
 		/*
 		 * Kernel filter not installed.
-		 * XXX - fall back on userland filtering, as is done
-		 * on other platforms?
+		 *
+		 * XXX - we don't know whether this failed because:
+		 *
+		 *  the kernel rejected the filter program as invalid,
+		 *  in which case we should fall back on userland
+		 *  filtering;
+		 *
+		 *  the kernel rejected the filter program as too big,
+		 *  in which case we should again fall back on
+		 *  userland filtering;
+		 *
+		 *  there was some other problem, in which case we
+		 *  should probably report an error.
+		 *
+		 * For NPF devices, the Win32 status will be
+		 * STATUS_INVALID_DEVICE_REQUEST for invalid
+		 * filters, but I don't know what it'd be for
+		 * other problems, and for some other devices
+		 * it might not be set at all.
+		 *
+		 * So we just fall back on userland filtering in
+		 * all cases.
 		 */
-		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Driver error: cannot set bpf filter: %s", pcap_win32strerror());
-		return (-1);
+
+		/*
+		 * install_bpf_program() validates the program.
+		 *
+		 * XXX - what if we already have a filter in the kernel?
+		 */
+		if (install_bpf_program(p, fp) < 0)
+			return (-1);
+		pw->filtering_in_kernel = 0;	/* filtering in userland */
+		return (0);
 	}
 
 	/*
+	 * It worked.
+	 */
+	pw->filtering_in_kernel = 1;	/* filtering in the kernel */
+
+	/*
 	 * Discard any previously-received packets, as they might have
 	 * passed whatever filter was formerly in effect, but might
 	 * not pass this filter (BIOCSETF discards packets buffered
@@ -817,23 +882,23 @@
 /*
  * We filter at user level, since the kernel driver does't process the packets
  */
-static int 
+static int
 pcap_setfilter_win32_dag(pcap_t *p, struct bpf_program *fp) {
-	
-	if(!fp) 
+
+	if(!fp)
 	{
 		strncpy(p->errbuf, "setfilter: No filter specified", sizeof(p->errbuf));
 		return -1;
 	}
-	
+
 	/* Install a user level filter */
-	if (install_bpf_program(p, fp) < 0) 
+	if (install_bpf_program(p, fp) < 0)
 	{
 		snprintf(p->errbuf, sizeof(p->errbuf),
 			"setfilter, unable to install the filter: %s", pcap_strerror(errno));
 		return -1;
 	}
-	
+
 	return (0);
 }
 
diff --git a/pcap.3pcap.in b/pcap.3pcap.in
index 1408deb..c02ac43 100644
--- a/pcap.3pcap.in
+++ b/pcap.3pcap.in
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap.3pcap.in,v 1.1 2008-10-21 07:33:01 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP 3PCAP "1 July 2013"
+.TH PCAP 3PCAP "16 April 2014"
 .SH NAME
 pcap \- Packet Capture library
 .SH SYNOPSIS
@@ -174,11 +172,9 @@
 .IP
 Not all platforms support a read timeout; on platforms that
 don't, the read timeout is ignored.  A zero value for the timeout,
-on platforms that support a read timeout, has platform-dependent
-behavior that could cause a read to wait for an unlimited amount
-of time until the capture buffer fills up or could cause a read timeout
-of 1 millisecond to be used.  We recommend that a value of zero not be
-used.
+on platforms that support a read timeout,
+will cause a read to wait forever to allow enough packets to
+arrive, with no timeout.
 .IP
 .BR NOTE :
 the read timeout cannot be used to cause calls that read
@@ -358,12 +354,25 @@
 .B pcap_t
 for a ``savefile'', given a pathname
 .TP
+.BR pcap_open_offline_with_tstamp_precision (3PCAP)
+open a
+.B pcap_t
+for a ``savefile'', given a pathname, and specify the precision to
+provide for packet time stamps
+.TP
 .BR pcap_fopen_offline (3PCAP)
 open a
 .B pcap_t
 for a ``savefile'', given a
 .B "FILE\ *"
 .TP
+.BR pcap_fopen_offline_with_tstamp_precision (3PCAP)
+open a
+.B pcap_t
+for a ``savefile'', given a
+.BR "FILE\ *" ,
+and specify the precision to provide for packet time stamps
+.TP
 .BR pcap_open_dead (3PCAP)
 create a ``fake''
 .B pcap_t
@@ -425,9 +434,19 @@
 .BR pcap_tstamp_type_val_to_description (3PCAP)
 get description for a time stamp type
 .TP
-.BR pcap_tstamp_name_to_val (3PCAP)
+.BR pcap_tstamp_type_name_to_val (3PCAP)
 get time stamp type corresponding to a name
 .TP
+.BR pcap_set_tstamp_precision (3PCAP)
+set time stamp precision for a not-yet-activated
+.B pcap_t
+for live capture
+.TP
+.BR pcap_get_tstamp_precision (3PCAP)
+get the time stamp precision of a
+.B pcap_t
+for live capture
+.TP
 .BR pcap_datalink (3PCAP)
 get link-layer header type for a
 .B pcap_t
@@ -556,7 +575,7 @@
 .BR pcap_next_ex ()
 is passed two pointer arguments, one of which points to a
 .IR struct pcap_pkthdr *
-and one of which points to a 
+and one of which points to a
 .IR "const u_char" *.
 It sets the first pointer to point to a
 .I struct pcap_pkthdr
@@ -584,7 +603,9 @@
 all, platforms, if a read timeout was specified, the wait will terminate
 after the read timeout expires; applications should be prepared for
 this, as it happens on some platforms, but should not rely on it, as it
-does not happen on other platforms.
+does not happen on other platforms.  Note that the wait might, or might
+not, terminate even if no packets are available; applications should be
+prepared for this to happen, but must not rely on it happening.
 .PP
 A handle can be put into ``non-blocking mode'', so that those routines
 will, rather than blocking, return an indication that no packets are
@@ -600,8 +621,8 @@
 .BR select (2)
 or
 .BR poll (2)
-or other routines a platform offers to wait for the availability of data
-on any of a set of descriptors.  To obtain, for a handle, a descriptor
+or other routines a platform offers to wait for any of a set of
+descriptors to be ready to read.  To obtain, for a handle, a descriptor
 that can be used in those routines, call
 .BR pcap_get_selectable_fd ().
 Not all handles have such a descriptor available;
@@ -610,7 +631,14 @@
 reasons, one or more of those routines will not work properly with the
 descriptor; the documentation for
 .BR pcap_get_selectable_fd ()
-gives details.
+gives details.  Note that, just as an attempt to read packets from a
+.B pcap_t
+may not return any packets if the read timeout expires, a
+.BR select (),
+.BR poll (),
+or other such call may, if the read timeout expires, indicate that a
+descriptor is ready to read even if there are no packets available to
+read.
 .TP
 .B Routines
 .RS
@@ -847,12 +875,12 @@
 .RE
 .SS Getting library version information
 To get a string giving version information about libpcap, call
-.BR pcap_library_version ().
+.BR pcap_lib_version ().
 .TP
 .B Routines
 .RS
 .TP
-.BR pcap_library_version (3PCAP)
+.BR pcap_lib_version (3PCAP)
 get library version string
 .RE
 .SH BACKWARDS COMPATIBILITY
diff --git a/pcap.c b/pcap.c
index 6b16cea..4e9c94a 100644
--- a/pcap.c
+++ b/pcap.c
@@ -31,11 +31,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.128 2008-12-23 20:13:29 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -93,6 +88,10 @@
 #include "pcap-bt-linux.h"
 #endif
 
+#ifdef PCAP_SUPPORT_BT_MONITOR
+#include "pcap-bt-monitor-linux.h"
+#endif
+
 #ifdef PCAP_SUPPORT_CAN
 #include "pcap-can-linux.h"
 #endif
@@ -109,7 +108,7 @@
 #include "pcap-dbus.h"
 #endif
 
-int 
+int
 pcap_not_initialized(pcap_t *pcap _U_)
 {
 	/* this means 'not initialized' */
@@ -221,7 +220,7 @@
 	return (pkt);
 }
 
-int 
+int
 pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header,
     const u_char **pkt_data)
 {
@@ -281,7 +280,8 @@
 pcap_t *
 pcap_create(const char *source, char *errbuf)
 {
-	return (dag_create(source, errbuf));
+	int is_ours;
+	return (dag_create(source, errbuf, &is_ours));
 }
 #elif defined(SEPTEL_ONLY)
 int
@@ -293,7 +293,8 @@
 pcap_t *
 pcap_create(const char *source, char *errbuf)
 {
-	return (septel_create(source, errbuf));
+	int is_ours;
+	return (septel_create(source, errbuf, &is_ours));
 }
 #elif defined(SNF_ONLY)
 int
@@ -305,7 +306,8 @@
 pcap_t *
 pcap_create(const char *source, char *errbuf)
 {
-	return (snf_create(source, errbuf));
+	int is_ours;
+	return (snf_create(source, errbuf, &is_ours));
 }
 #else /* regular pcap */
 struct capture_source_type {
@@ -324,6 +326,9 @@
 #ifdef PCAP_SUPPORT_BT
 	{ bt_findalldevs, bt_create },
 #endif
+#ifdef PCAP_SUPPORT_BT_MONITOR
+	{ bt_monitor_findalldevs, bt_monitor_create },
+#endif
 #if PCAP_SUPPORT_CANUSB
 	{ canusb_findalldevs, canusb_create },
 #endif
@@ -355,7 +360,7 @@
 
 	/*
 	 * Get the list of regular interfaces first.
-	 */ 
+	 */
 	if (pcap_findalldevs_interfaces(alldevsp, errbuf) == -1)
 		return (-1);	/* failure */
 
@@ -392,6 +397,7 @@
 			return (-1);
 		}
 	}
+
 	return (0);
 }
 
@@ -506,7 +512,7 @@
 #ifndef WIN32
 	p->fd = -1;	/* not opened yet */
 	p->selectable_fd = -1;
-#endif 
+#endif
 
 	if (size == 0) {
 		/* No private data was requested. */
@@ -550,14 +556,20 @@
 	initialize_ops(p);
 
 	/* put in some defaults*/
- 	pcap_set_snaplen(p, 65535);	/* max packet size */
-	p->opt.timeout = 0;		/* no timeout specified */
-	p->opt.buffer_size = 0;		/* use the platform's default */
+ 	pcap_set_snaplen(p, MAXIMUM_SNAPLEN);	/* max packet size */
+	p->opt.timeout = 0;			/* no timeout specified */
+	p->opt.buffer_size = 0;			/* use the platform's default */
 	p->opt.promisc = 0;
 	p->opt.rfmon = 0;
 	p->opt.immediate = 0;
 	p->opt.tstamp_type = -1;	/* default to not setting time stamp type */
 	p->opt.tstamp_precision = PCAP_TSTAMP_PRECISION_MICRO;
+
+	/*
+	 * Start out with no BPF code generation flags set.
+	 */
+	p->bpf_codegen_flags = 0;
+
 	return (p);
 }
 
@@ -1182,6 +1194,7 @@
 	DLT_CHOICE(DLT_AX25_KISS, "AX.25 with KISS header"),
 	DLT_CHOICE(DLT_IEEE802_15_4_NONASK_PHY, "IEEE 802.15.4 with non-ASK PHY data"),
 	DLT_CHOICE(DLT_MPLS, "MPLS with label as link-layer header"),
+	DLT_CHOICE(DLT_LINUX_EVDEV, "Linux evdev events"),
 	DLT_CHOICE(DLT_USB_LINUX_MMAPPED, "USB with padded Linux header"),
 	DLT_CHOICE(DLT_DECT, "DECT"),
 	DLT_CHOICE(DLT_AOS, "AOS Space Data Link protocol"),
@@ -1193,16 +1206,33 @@
 	DLT_CHOICE(DLT_IPV4, "Raw IPv4"),
 	DLT_CHOICE(DLT_IPV6, "Raw IPv6"),
 	DLT_CHOICE(DLT_IEEE802_15_4_NOFCS, "IEEE 802.15.4 without FCS"),
+	DLT_CHOICE(DLT_DBUS, "D-Bus"),
 	DLT_CHOICE(DLT_JUNIPER_VS, "Juniper Virtual Server"),
 	DLT_CHOICE(DLT_JUNIPER_SRX_E2E, "Juniper SRX E2E"),
 	DLT_CHOICE(DLT_JUNIPER_FIBRECHANNEL, "Juniper Fibre Channel"),
 	DLT_CHOICE(DLT_DVB_CI, "DVB-CI"),
+	DLT_CHOICE(DLT_MUX27010, "MUX27010"),
+	DLT_CHOICE(DLT_STANAG_5066_D_PDU, "STANAG 5066 D_PDUs"),
 	DLT_CHOICE(DLT_JUNIPER_ATM_CEMIC, "Juniper ATM CEMIC"),
 	DLT_CHOICE(DLT_NFLOG, "Linux netfilter log messages"),
 	DLT_CHOICE(DLT_NETANALYZER, "Ethernet with Hilscher netANALYZER pseudo-header"),
 	DLT_CHOICE(DLT_NETANALYZER_TRANSPARENT, "Ethernet with Hilscher netANALYZER pseudo-header and with preamble and SFD"),
 	DLT_CHOICE(DLT_IPOIB, "RFC 4391 IP-over-Infiniband"),
-	DLT_CHOICE(DLT_DBUS, "D-Bus"),
+	DLT_CHOICE(DLT_MPEG_2_TS, "MPEG-2 transport stream"),
+	DLT_CHOICE(DLT_NG40, "ng40 protocol tester Iub/Iur"),
+	DLT_CHOICE(DLT_NFC_LLCP, "NFC LLCP PDUs with pseudo-header"),
+	DLT_CHOICE(DLT_INFINIBAND, "InfiniBand"),
+	DLT_CHOICE(DLT_SCTP, "SCTP"),
+	DLT_CHOICE(DLT_USBPCAP, "USB with USBPcap header"),
+	DLT_CHOICE(DLT_RTAC_SERIAL, "Schweitzer Engineering Laboratories RTAC packets"),
+	DLT_CHOICE(DLT_BLUETOOTH_LE_LL, "Bluetooth Low Energy air interface"),
+	DLT_CHOICE(DLT_NETLINK, "Linux netlink"),
+	DLT_CHOICE(DLT_BLUETOOTH_LINUX_MONITOR, "Bluetooth Linux Monitor"),
+	DLT_CHOICE(DLT_BLUETOOTH_BREDR_BB, "Bluetooth Basic Rate/Enhanced Data Rate baseband packets"),
+	DLT_CHOICE(DLT_BLUETOOTH_LE_LL_WITH_PHDR, "Bluetooth Low Energy air interface with pseudo-header"),
+	DLT_CHOICE(DLT_PROFIBUS_DL, "PROFIBUS data link layer"),
+	DLT_CHOICE(DLT_PKTAP, "Apple DLT_PKTAP"),
+	DLT_CHOICE(DLT_EPON, "Ethernet with 802.3 Clause 65 EPON preamble"),
 	DLT_CHOICE_SENTINEL
 };
 
@@ -1458,7 +1488,7 @@
 
 #ifdef WIN32
 /*
- * Generate a string for the last Win32-specific error (i.e. an error generated when 
+ * Generate a string for the last Win32-specific error (i.e. an error generated when
  * calling a Win32 API).
  * For errors occurred during standard C calls, we still use pcap_strerror()
  */
@@ -1810,6 +1840,12 @@
 	p->setmintocopy_op = pcap_setmintocopy_dead;
 #endif
 	p->cleanup_op = pcap_cleanup_dead;
+
+	/*
+	 * A "dead" pcap_t never requires special BPF code generation.
+	 */
+	p->bpf_codegen_flags = 0;
+
 	p->activated = 1;
 	return (p);
 }
@@ -1866,7 +1902,7 @@
 {
 	const struct bpf_insn *fcode = fp->bf_insns;
 
-	if (fcode != NULL) 
+	if (fcode != NULL)
 		return (bpf_filter(fcode, pkt, h->len, h->caplen));
 	else
 		return (0);
diff --git a/pcap.h b/pcap.h
index 490a4bf..174e32d 100644
--- a/pcap.h
+++ b/pcap.h
@@ -29,8 +29,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.59 2006-10-04 18:09:22 guy Exp $ (LBL)
  */
 
 /*
diff --git a/pcap/bluetooth.h b/pcap/bluetooth.h
index 813bea3..01bd5a2 100644
--- a/pcap/bluetooth.h
+++ b/pcap/bluetooth.h
@@ -11,8 +11,8 @@
  * 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. The name of the author may not be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
  * permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -29,20 +29,27 @@
  *
  * bluetooth data struct
  * By Paolo Abeni <paolo.abeni@email.it>
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap/bluetooth.h,v 1.1 2007-09-22 02:10:17 guy Exp $
  */
- 
+
 #ifndef _PCAP_BLUETOOTH_STRUCTS_H__
 #define _PCAP_BLUETOOTH_STRUCTS_H__
 
 /*
- * Header prepended libpcap to each bluetooth h:4 frame.
+ * Header prepended libpcap to each bluetooth h4 frame,
  * fields are in network byte order
  */
 typedef struct _pcap_bluetooth_h4_header {
 	u_int32_t direction; /* if first bit is set direction is incoming */
 } pcap_bluetooth_h4_header;
 
+/*
+ * Header prepended libpcap to each bluetooth linux monitor frame,
+ * fields are in network byte order
+ */
+typedef struct _pcap_bluetooth_linux_monitor_header {
+	u_int16_t adapter_id;
+	u_int16_t opcode;
+} pcap_bluetooth_linux_monitor_header;
+
 
 #endif
diff --git a/pcap/bpf.h b/pcap/bpf.h
index ad36eb6..215d5ca 100644
--- a/pcap/bpf.h
+++ b/pcap/bpf.h
@@ -4,7 +4,7 @@
  *
  * This code is derived from the Stanford/CMU enet packet filter,
  * (net/enet.c) distributed as part of 4.3BSD, and code contributed
- * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 
+ * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
  * Berkeley Laboratory.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -36,8 +36,6 @@
  * SUCH DAMAGE.
  *
  *      @(#)bpf.h       7.1 (Berkeley) 5/7/91
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.32 2008-12-23 20:13:29 guy Exp $ (LBL)
  */
 
 /*
@@ -61,7 +59,8 @@
  * or Tru64 UNIX-style multiple-include protection (or, at least,
  * Tru64 UNIX 5.x-style; I don't have earlier versions available to check),
  * or AIX-style multiple-include protection (or, at least, AIX 5.x-style;
- * I don't have earlier versions available to check).
+ * I don't have earlier versions available to check), or QNX-style
+ * multiple-include protection (as per GitHub pull request #394).
  *
  * We do not check for BPF_MAJOR_VERSION, as that's defined by
  * <linux/filter.h>, which is directly or indirectly included in some
@@ -70,7 +69,7 @@
  *
  * This also provides our own multiple-include protection.
  */
-#if !defined(_NET_BPF_H_) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h)
+#if !defined(_NET_BPF_H_) && !defined(_NET_BPF_H_INCLUDED) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h)
 #define lib_pcap_bpf_h
 
 #ifdef __cplusplus
@@ -89,7 +88,7 @@
 #endif
 
 /*
- * Alignment macros.  BPF_WORDALIGN rounds up to the next 
+ * Alignment macros.  BPF_WORDALIGN rounds up to the next
  * even multiple of BPF_ALIGNMENT.
  *
  * Tcpdump's print-pflog.c uses this, so we define it here.
@@ -108,7 +107,7 @@
 	u_int bf_len;
 	struct bpf_insn *bf_insns;
 };
- 
+
 /*
  * Link-layer header type codes.
  *
@@ -430,7 +429,7 @@
  */
 #define DLT_SUNATM		123	/* Solaris+SunATM */
 
-/* 
+/*
  * Reserved as per request from Kent Dahlgren <kent@praesum.com>
  * for private use.
  */
@@ -673,7 +672,7 @@
 
 /*
  * Juniper-private data link type, as per request from
- * Hannes Gredler <hannes@juniper.net>. 
+ * Hannes Gredler <hannes@juniper.net>.
  * The DLT_ are used for prepending meta-information
  * like interface index, interface name
  * before standard Ethernet, PPP, Frelay & C-HDLC Frames
@@ -690,7 +689,7 @@
 
 /*
  * Juniper-private data link type, as per request from
- * Hannes Gredler <hannes@juniper.net>. 
+ * Hannes Gredler <hannes@juniper.net>.
  * The DLT_ is used for internal communication with a
  * voice Adapter Card (PIC)
  */
@@ -765,7 +764,7 @@
 
 /*
  * Juniper-private data link type, as per request from
- * Hannes Gredler <hannes@juniper.net>. 
+ * Hannes Gredler <hannes@juniper.net>.
  * The DLT_ is used for internal communication with a
  * integrated service module (ISM).
  */
@@ -808,7 +807,7 @@
 
 /*
  * Juniper-private data link type, as per request from
- * Hannes Gredler <hannes@juniper.net>. 
+ * Hannes Gredler <hannes@juniper.net>.
  * The DLT_ is used for capturing data on a secure tunnel interface.
  */
 #define DLT_JUNIPER_ST          200
@@ -900,11 +899,11 @@
  */
 #define DLT_IEEE802_15_4_NONASK_PHY	215
 
-/* 
+/*
  * David Gibson <david@gibson.dropbear.id.au> requested this for
  * captures from the Linux kernel /dev/input/eventN devices. This
  * is used to communicate keystrokes and mouse movements from the
- * Linux kernel to display systems, such as Xorg. 
+ * Linux kernel to display systems, such as Xorg.
  */
 #define DLT_LINUX_EVDEV		216
 
@@ -1104,7 +1103,7 @@
 #define DLT_JUNIPER_ATM_CEMIC	238
 
 /*
- * NetFilter LOG messages 
+ * NetFilter LOG messages
  * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets)
  *
  * Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl>
@@ -1213,7 +1212,7 @@
 
 /*
  * 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
@@ -1224,7 +1223,108 @@
  */
 #define DLT_WIRESHARK_UPPER_PDU	252
 
-#define DLT_MATCHING_MAX	252	/* highest value in the "matching" range */
+/*
+ * DLT type for the netlink protocol (nlmon devices).
+ */
+#define DLT_NETLINK		253
+
+/*
+ * Bluetooth Linux Monitor headers for the BlueZ stack.
+ */
+#define DLT_BLUETOOTH_LINUX_MONITOR	254
+
+/*
+ * Bluetooth Basic Rate/Enhanced Data Rate baseband packets, as
+ * captured by Ubertooth.
+ */
+#define DLT_BLUETOOTH_BREDR_BB	255
+
+/*
+ * Bluetooth Low Energy link layer packets, as captured by Ubertooth.
+ */
+#define DLT_BLUETOOTH_LE_LL_WITH_PHDR	256
+
+/*
+ * PROFIBUS data link layer.
+ */
+#define DLT_PROFIBUS_DL		257
+
+/*
+ * Apple's DLT_PKTAP headers.
+ *
+ * Sadly, the folks at Apple either had no clue that the DLT_USERn values
+ * are for internal use within an organization and partners only, and
+ * didn't know that the right way to get a link-layer header type is to
+ * ask tcpdump.org for one, or knew and didn't care, so they just
+ * used DLT_USER2, which causes problems for everything except for
+ * their version of tcpdump.
+ *
+ * So I'll just give them one; hopefully this will show up in a
+ * libpcap release in time for them to get this into 10.10 Big Sur
+ * or whatever Mavericks' successor is called.  LINKTYPE_PKTAP
+ * will be 258 *even on OS X*; that is *intentional*, so that
+ * PKTAP files look the same on *all* OSes (different OSes can have
+ * different numerical values for a given DLT_, but *MUST NOT* have
+ * different values for what goes in a file, as files can be moved
+ * between OSes!).
+ *
+ * When capturing, on a system with a Darwin-based OS, on a device
+ * that returns 149 (DLT_USER2 and Apple's DLT_PKTAP) with this
+ * version of libpcap, the DLT_ value for the pcap_t  will be DLT_PKTAP,
+ * and that will continue to be DLT_USER2 on Darwin-based OSes. That way,
+ * binary compatibility with Mavericks is preserved for programs using
+ * this version of libpcap.  This does mean that if you were using
+ * DLT_USER2 for some capture device on OS X, you can't do so with
+ * this version of libpcap, just as you can't with Apple's libpcap -
+ * on OS X, they define DLT_PKTAP to be DLT_USER2, so programs won't
+ * be able to distinguish between PKTAP and whatever you were using
+ * DLT_USER2 for.
+ *
+ * If the program saves the capture to a file using this version of
+ * libpcap's pcap_dump code, the LINKTYPE_ value in the file will be
+ * LINKTYPE_PKTAP, which will be 258, even on Darwin-based OSes.
+ * That way, the file will *not* be a DLT_USER2 file.  That means
+ * that the latest version of tcpdump, when built with this version
+ * of libpcap, and sufficiently recent versions of Wireshark will
+ * be able to read those files and interpret them correctly; however,
+ * Apple's version of tcpdump in OS X 10.9 won't be able to handle
+ * them.  (Hopefully, Apple will pick up this version of libpcap,
+ * and the corresponding version of tcpdump, so that tcpdump will
+ * be able to handle the old LINKTYPE_USER2 captures *and* the new
+ * LINKTYPE_PKTAP captures.)
+ */
+#ifdef __APPLE__
+#define DLT_PKTAP	DLT_USER2
+#else
+#define DLT_PKTAP	258
+#endif
+
+/*
+ * Ethernet packets preceded by a header giving the last 6 octets
+ * of the preamble specified by 802.3-2012 Clause 65, section
+ * 65.1.3.2 "Transmit".
+ */
+#define DLT_EPON	259
+
+/*
+ * IPMI trace packets, as specified by Table 3-20 "Trace Data Block Format"
+ * in the PICMG HPM.2 specification.
+ */
+#define DLT_IPMI_HPM_2	260
+
+/*
+ * per  Joshua Wright <jwright@hasborg.com>, formats for Zwave captures.
+ */
+#define DLT_ZWAVE_R1_R2  261
+#define DLT_ZWAVE_R3     262
+
+/*
+ * per Steve Karg <skarg@users.sourceforge.net>, formats for Wattstopper
+ * Digital Lighting Management room bus serial protocol captures.
+ */
+#define DLT_WATTSTOPPER_DLM     263
+
+#define DLT_MATCHING_MAX	263	/* highest value in the "matching" range */
 
 /*
  * DLT and savefile link type values are split into a class and
@@ -1248,7 +1348,17 @@
 
 /*
  * The instruction encodings.
+ *
+ * Please inform tcpdump-workers@lists.tcpdump.org if you use any
+ * of the reserved values, so that we can note that they're used
+ * (and perhaps implement it in the reference BPF implementation
+ * and encourage its implementation elsewhere).
  */
+
+/*
+ * The upper 8 bits of the opcode aren't used. BSD/OS used 0x8000.
+ */
+
 /* instruction classes */
 #define BPF_CLASS(code) ((code) & 0x07)
 #define		BPF_LD		0x00
@@ -1265,6 +1375,7 @@
 #define		BPF_W		0x00
 #define		BPF_H		0x08
 #define		BPF_B		0x10
+/*				0x18	reserved; used by BSD/OS */
 #define BPF_MODE(code)	((code) & 0xe0)
 #define		BPF_IMM 	0x00
 #define		BPF_ABS		0x20
@@ -1272,6 +1383,8 @@
 #define		BPF_MEM		0x60
 #define		BPF_LEN		0x80
 #define		BPF_MSH		0xa0
+/*				0xc0	reserved; used by BSD/OS */
+/*				0xe0	reserved; used by BSD/OS */
 
 /* alu/jmp fields */
 #define BPF_OP(code)	((code) & 0xf0)
@@ -1284,11 +1397,30 @@
 #define		BPF_LSH		0x60
 #define		BPF_RSH		0x70
 #define		BPF_NEG		0x80
+#define		BPF_MOD		0x90
+#define		BPF_XOR		0xa0
+/*				0xb0	reserved */
+/*				0xc0	reserved */
+/*				0xd0	reserved */
+/*				0xe0	reserved */
+/*				0xf0	reserved */
+
 #define		BPF_JA		0x00
 #define		BPF_JEQ		0x10
 #define		BPF_JGT		0x20
 #define		BPF_JGE		0x30
 #define		BPF_JSET	0x40
+/*				0x50	reserved; used on BSD/OS */
+/*				0x60	reserved */
+/*				0x70	reserved */
+/*				0x80	reserved */
+/*				0x90	reserved */
+/*				0xa0	reserved */
+/*				0xb0	reserved */
+/*				0xc0	reserved */
+/*				0xd0	reserved */
+/*				0xe0	reserved */
+/*				0xf0	reserved */
 #define BPF_SRC(code)	((code) & 0x08)
 #define		BPF_K		0x00
 #define		BPF_X		0x08
@@ -1296,11 +1428,43 @@
 /* ret - BPF_K and BPF_X also apply */
 #define BPF_RVAL(code)	((code) & 0x18)
 #define		BPF_A		0x10
+/*				0x18	reserved */
 
 /* misc */
 #define BPF_MISCOP(code) ((code) & 0xf8)
 #define		BPF_TAX		0x00
+/*				0x08	reserved */
+/*				0x10	reserved */
+/*				0x18	reserved */
+/* #define	BPF_COP		0x20	NetBSD "coprocessor" extensions */
+/*				0x28	reserved */
+/*				0x30	reserved */
+/*				0x38	reserved */
+/* #define	BPF_COPX	0x40	NetBSD "coprocessor" extensions */
+/*					also used on BSD/OS */
+/*				0x48	reserved */
+/*				0x50	reserved */
+/*				0x58	reserved */
+/*				0x60	reserved */
+/*				0x68	reserved */
+/*				0x70	reserved */
+/*				0x78	reserved */
 #define		BPF_TXA		0x80
+/*				0x88	reserved */
+/*				0x90	reserved */
+/*				0x98	reserved */
+/*				0xa0	reserved */
+/*				0xa8	reserved */
+/*				0xb0	reserved */
+/*				0xb8	reserved */
+/*				0xc0	reserved; used on BSD/OS */
+/*				0xc8	reserved */
+/*				0xd0	reserved */
+/*				0xd8	reserved */
+/*				0xe0	reserved */
+/*				0xe8	reserved */
+/*				0xf0	reserved */
+/*				0xf8	reserved */
 
 /*
  * The instruction data structure.
@@ -1313,6 +1477,16 @@
 };
 
 /*
+ * Auxiliary data, for use when interpreting a filter intended for the
+ * Linux kernel when the kernel rejects the filter (requiring us to
+ * run it in userland).  It contains VLAN tag information.
+ */
+struct bpf_aux_data {
+	u_short vlan_tag_present;
+	u_short vlan_tag;
+};
+
+/*
  * Macros for insn array initializers.
  */
 #define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }
@@ -1321,9 +1495,11 @@
 #if __STDC__ || defined(__cplusplus)
 extern int bpf_validate(const struct bpf_insn *, int);
 extern u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
+extern u_int bpf_filter_with_aux_data(const struct bpf_insn *, const u_char *, u_int, u_int, const struct bpf_aux_data *);
 #else
 extern int bpf_validate();
 extern u_int bpf_filter();
+extern u_int bpf_filter();
 #endif
 
 /*
diff --git a/pcap/namedb.h b/pcap/namedb.h
index e314557..d3a3432 100644
--- a/pcap/namedb.h
+++ b/pcap/namedb.h
@@ -29,8 +29,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap/namedb.h,v 1.1 2006-10-04 18:09:22 guy Exp $ (LBL)
  */
 
 #ifndef lib_pcap_namedb_h
diff --git a/pcap/pcap.h b/pcap/pcap.h
index f2dd2d6..c9fab4c 100644
--- a/pcap/pcap.h
+++ b/pcap/pcap.h
@@ -30,8 +30,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap/pcap.h,v 1.15 2008-10-06 15:27:32 gianluca Exp $ (LBL)
  */
 
 #ifndef lib_pcap_pcap_h
@@ -133,7 +131,7 @@
 
 /*
  * Macros for the value returned by pcap_datalink_ext().
- * 
+ *
  * If LT_FCS_LENGTH_PRESENT(x) is true, the LT_FCS_LENGTH(x) macro
  * gives the FCS length of packets in the capture.
  */
@@ -222,6 +220,8 @@
 };
 
 #define PCAP_IF_LOOPBACK	0x00000001	/* interface is loopback */
+#define PCAP_IF_UP		0x00000002	/* interface is up */
+#define PCAP_IF_RUNNING		0x00000004	/* interface is running */
 
 /*
  * Representation of an interface address.
@@ -412,6 +412,7 @@
 
 pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
 pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp);
+pcap_dumper_t *pcap_dump_open_append(pcap_t *, const char *);
 FILE	*pcap_dump_file(pcap_dumper_t *);
 long	pcap_dump_ftell(pcap_dumper_t *);
 int	pcap_dump_flush(pcap_dumper_t *);
@@ -424,13 +425,13 @@
 const char *pcap_lib_version(void);
 
 /*
- * On at least some versions of NetBSD, we don't want to declare
+ * On at least some versions of NetBSD and QNX, we don't want to declare
  * bpf_filter() here, as it's also be declared in <net/bpf.h>, with a
  * different signature, but, on other BSD-flavored UN*Xes, it's not
  * declared in <net/bpf.h>, so we *do* want to declare it here, so it's
  * declared when we build pcap-bpf.c.
  */
-#ifndef __NetBSD__
+#if !defined(__NetBSD__) && !defined(__QNX__)
 u_int	bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
 #endif
 int	bpf_validate(const struct bpf_insn *f, int len);
diff --git a/pcap/sll.h b/pcap/sll.h
index 7ad811d..38da29f 100644
--- a/pcap/sll.h
+++ b/pcap/sll.h
@@ -34,8 +34,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap/sll.h,v 1.3 2008-05-30 01:35:33 guy Exp $ (LBL)
  */
 
 /*
diff --git a/pcap/usb.h b/pcap/usb.h
index aa35122..8395527 100644
--- a/pcap/usb.h
+++ b/pcap/usb.h
@@ -11,8 +11,8 @@
  * 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. The name of the author may not be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
  * permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -29,14 +29,12 @@
  *
  * Basic USB data struct
  * By Paolo Abeni <paolo.abeni@email.it>
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap/usb.h,v 1.9 2008-12-23 20:13:29 guy Exp $
  */
- 
+
 #ifndef _PCAP_USB_STRUCTS_H__
 #define _PCAP_USB_STRUCTS_H__
 
-/* 
+/*
  * possible transfer mode
  */
 #define URB_TRANSFER_IN   0x80
diff --git a/pcap/vlan.h b/pcap/vlan.h
index 41aa8c7..021f612 100644
--- a/pcap/vlan.h
+++ b/pcap/vlan.h
@@ -29,8 +29,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap/vlan.h,v 1.1 2008-08-06 07:45:00 guy Exp $
  */
 
 #ifndef lib_pcap_vlan_h
diff --git a/pcap1.h b/pcap1.h
deleted file mode 100644
index 2cb532f..0000000
--- a/pcap1.h
+++ /dev/null
@@ -1,306 +0,0 @@
-/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
-/*
- * 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 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 Computer Systems
- *	Engineering Group at Lawrence Berkeley Laboratory.
- * 4. Neither the name of the University nor of the Laboratory 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/pcap1.h,v 1.5 2008-05-30 01:43:21 guy Exp $ (LBL)
- */
-
-#ifndef lib_pcap_h
-#define lib_pcap_h
-
-#ifdef WIN32
-#include <pcap-stdinc.h>
-#else /* WIN32 */
-#include <sys/types.h>
-#include <sys/time.h>
-#endif /* WIN32 */
-
-#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H
-#include <pcap/bpf.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define PCAP_VERSION_MAJOR 3
-#define PCAP_VERSION_MINOR 0
-
-#define PCAP_ERRBUF_SIZE 256
-
-/*
- * Compatibility for systems that have a bpf.h that
- * predates the bpf typedefs for 64-bit support.
- */
-#if BPF_RELEASE - 0 < 199406
-typedef	int bpf_int32;
-typedef	u_int bpf_u_int32;
-#endif
-
-typedef struct pcap pcap_t;
-typedef struct pcap_dumper pcap_dumper_t;
-typedef struct pcap_if pcap_if_t;
-typedef struct pcap_addr pcap_addr_t;
-
-/*
- * The first record in the file contains saved values for some
- * of the flags used in the printout phases of tcpdump.
- * Many fields here are 32 bit ints so compilers won't insert unwanted
- * padding; these files need to be interchangeable across architectures.
- *
- * Do not change the layout of this structure, in any way (this includes
- * changes that only affect the length of fields in this structure).
- *
- * Also, do not change the interpretation of any of the members of this
- * structure, in any way (this includes using values other than
- * LINKTYPE_ values, as defined in "savefile.c", in the "linktype"
- * field).
- *
- * Instead:
- *
- *	introduce a new structure for the new format, if the layout
- *	of the structure changed;
- *
- *	send mail to "tcpdump-workers@lists.tcpdump.org", requesting
- *	a new magic number for your new capture file format, and, when
- *	you get the new magic number, put it in "savefile.c";
- *
- *	use that magic number for save files with the changed file
- *	header;
- *
- *	make the code in "savefile.c" capable of reading files with
- *	the old file header as well as files with the new file header
- *	(using the magic number to determine the header format).
- *
- * Then supply the changes by forking the branch at
- *
- *	https://github.com/the-tcpdump-group/libpcap/issues
- *
- * and issuing a pull request, so that future versions of libpcap and
- * programs that use it (such as tcpdump) will be able to read your new
- * capture file format.
- */
-
-enum pcap1_info_types {
-        PCAP_DATACAPTURE,
-	PCAP_TIMESTAMP,
-	PCAP_WALLTIME,
-	PCAP_TIMESKEW,
-	PCAP_PROBEPLACE,              /* aka direction */
-	PCAP_COMMENT,                 /* comment */
-};
-
-struct pcap1_info_container {
-	bpf_u_int32 info_len;         /* in bytes */
-	bpf_u_int32 info_type;        /* enum pcap1_info_types */
-	unsigned char info_data[0];
-};
-
-struct pcap1_info_timestamp {
-	struct pcap1_info_container pic;
-	bpf_u_int32    nanoseconds;   /* 10^-9 of seconds */
-	bpf_u_int32    seconds;       /* seconds since Unix epoch - GMT */
-	bpf_u_int16    macroseconds;  /* 16 bits more of MSB of time */
-	bpf_u_int16    sigfigs;	      /* accuracy of timestamps - LSB bits */
-};	
-	
-struct pcap1_info_packet {
-	struct pcap1_info_container pic;
-	bpf_u_int32 caplen;	/* length of portion present */
-	bpf_u_int32 len;	/* length this packet (off wire) */
-	bpf_u_int32 linktype;	/* data link type (LINKTYPE_*) */
-	bpf_u_int32 ifIndex;	/* abstracted interface index */
-	unsigned char packet_data[0];
-};	
-
-enum pcap1_probe {
-	INBOUND  =1,
-	OUTBOUND =2,
-	FORWARD  =3,
-	PREENCAP =4,
-	POSTDECAP=5,
-};
-
-struct pcap1_info_probe {
-	struct pcap1_info_container pic;
-	bpf_u_int32                 probeloc;   /* enum pcap1_probe */
-        unsigned char               probe_desc[0];
-};
-	
-struct pcap1_info_comment {
-	struct pcap1_info_container pic;
-        unsigned char               comment[0];
-};
-	
-struct pcap1_packet_header {
-	bpf_u_int32 magic;
-	u_short     version_major;
-	u_short     version_minor;
-        bpf_u_int32 block_len;
-	struct pcap1_info_container pics[0];
-};
-
-/*
- * Each packet in the dump file is prepended with this generic header.
- * This gets around the problem of different headers for different
- * packet interfaces.
- */
-
-/*
- * As returned by the pcap_stats()
- */
-struct pcap_stat {
-	u_int ps_recv;		/* number of packets received */
-	u_int ps_drop;		/* number of packets dropped */
-	u_int ps_ifdrop;	/* drops by interface XXX not yet supported */
-#ifdef WIN32
-	u_int bs_capt;		/* number of packets that reach the application */
-#endif /* WIN32 */
-};
-
-/*
- * Item in a list of interfaces.
- */
-struct pcap_if {
-	struct pcap_if *next;
-	char *name;		/* name to hand to "pcap_open_live()" */
-	char *description;	/* textual description of interface, or NULL */
-	struct pcap_addr *addresses;
-	bpf_u_int32 flags;	/* PCAP_IF_ interface flags */
-};
-
-#define PCAP_IF_LOOPBACK	0x00000001	/* interface is loopback */
-
-/*
- * Representation of an interface address.
- */
-struct pcap_addr {
-	struct pcap_addr *next;
-	struct sockaddr *addr;		/* address */
-	struct sockaddr *netmask;	/* netmask for that address */
-	struct sockaddr *broadaddr;	/* broadcast address for that address */
-	struct sockaddr *dstaddr;	/* P2P destination address for that address */
-};
-
-typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *,
-			     const u_char *);
-
-char	*pcap_lookupdev(char *);
-int	pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);
-pcap_t	*pcap_open_live(const char *, int, int, int, char *);
-pcap_t	*pcap_open_dead(int, int);
-pcap_t	*pcap_open_offline(const char *, char *);
-void	pcap_close(pcap_t *);
-int	pcap_loop(pcap_t *, int, pcap_handler, u_char *);
-int	pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
-const u_char*
-	pcap_next(pcap_t *, struct pcap_pkthdr *);
-int 	pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);
-void	pcap_breakloop(pcap_t *);
-int	pcap_stats(pcap_t *, struct pcap_stat *);
-int	pcap_setfilter(pcap_t *, struct bpf_program *);
-int	pcap_getnonblock(pcap_t *, char *);
-int	pcap_setnonblock(pcap_t *, int, char *);
-void	pcap_perror(pcap_t *, char *);
-char	*pcap_strerror(int);
-char	*pcap_geterr(pcap_t *);
-int	pcap_compile(pcap_t *, struct bpf_program *, char *, int,
-	    bpf_u_int32);
-int	pcap_compile_nopcap(int, int, struct bpf_program *,
-	    char *, int, bpf_u_int32);
-void	pcap_freecode(struct bpf_program *);
-int	pcap_datalink(pcap_t *);
-int	pcap_list_datalinks(pcap_t *, int **);
-int	pcap_set_datalink(pcap_t *, int);
-int	pcap_datalink_name_to_val(const char *);
-const char *pcap_datalink_val_to_name(int);
-const char *pcap_datalink_val_to_description(int);
-int	pcap_snapshot(pcap_t *);
-int	pcap_is_swapped(pcap_t *);
-int	pcap_major_version(pcap_t *);
-int	pcap_minor_version(pcap_t *);
-
-/* XXX */
-FILE	*pcap_file(pcap_t *);
-int	pcap_fileno(pcap_t *);
-
-pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
-int	pcap_dump_flush(pcap_dumper_t *);
-void	pcap_dump_close(pcap_dumper_t *);
-void	pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);
-FILE	*pcap_dump_file(pcap_dumper_t *);
-
-int	pcap_findalldevs(pcap_if_t **, char *);
-void	pcap_freealldevs(pcap_if_t *);
-
-const char *pcap_lib_version(void);
-
-/* XXX this guy lives in the bpf tree */
-u_int	bpf_filter(struct bpf_insn *, u_char *, u_int, u_int);
-int	bpf_validate(struct bpf_insn *f, int len);
-char	*bpf_image(struct bpf_insn *, int);
-void	bpf_dump(struct bpf_program *, int);
-
-#ifdef WIN32
-/*
- * Win32 definitions
- */
-
-int pcap_setbuff(pcap_t *p, int dim);
-int pcap_setmode(pcap_t *p, int mode);
-int pcap_sendpacket(pcap_t *p, u_char *buf, int size);
-int pcap_setmintocopy(pcap_t *p, int size);
-
-#ifdef WPCAP
-/* Include file with the wpcap-specific extensions */
-#include <Win32-Extensions.h>
-#endif
-
-#define MODE_CAPT 0
-#define MODE_STAT 1
-
-#else
-/*
- * UN*X definitions
- */
-
-int	pcap_get_selectable_fd(pcap_t *);
-
-#endif /* WIN32 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/pcap_activate.3pcap b/pcap_activate.3pcap
index f963d35..61887a7 100644
--- a/pcap_activate.3pcap
+++ b/pcap_activate.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_activate.3pcap,v 1.5 2008-07-01 08:02:33 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_ACTIVATE 3PCAP "5 April 2008"
+.TH PCAP_ACTIVATE 3PCAP "21 September 2010"
 .SH NAME
 pcap_activate \- activate a capture handle
 .SH SYNOPSIS
diff --git a/pcap_breakloop.3pcap b/pcap_breakloop.3pcap
index e437af8..6744924 100644
--- a/pcap_breakloop.3pcap
+++ b/pcap_breakloop.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_breakloop.3pcap,v 1.3 2008-04-06 02:53:21 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -93,7 +91,7 @@
 .B pcap_dispatch()
 or
 .BR pcap_loop() ,
-the flag is cleared, so a subsequent call will resume reading packets. 
+the flag is cleared, so a subsequent call will resume reading packets.
 If a positive number is returned, the flag is not cleared, so a
 subsequent call will return \-2 and clear the flag.
 .SH SEE ALSO
diff --git a/pcap_can_set_rfmon.3pcap b/pcap_can_set_rfmon.3pcap
index 00b92a4..b579804 100644
--- a/pcap_can_set_rfmon.3pcap
+++ b/pcap_can_set_rfmon.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_can_set_rfmon.3pcap,v 1.1 2008-04-06 02:53:21 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_close.3pcap b/pcap_close.3pcap
index 810664d..91eb677 100644
--- a/pcap_close.3pcap
+++ b/pcap_close.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_close.3pcap,v 1.3 2008-04-06 02:53:21 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_compile.3pcap.in b/pcap_compile.3pcap.in
index 7dbdad5..0e5276a 100644
--- a/pcap_compile.3pcap.in
+++ b/pcap_compile.3pcap.in
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_compile.3pcap.in,v 1.1 2008-10-21 07:33:02 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_COMPILE 3PCAP "5 April 2008"
+.TH PCAP_COMPILE 3PCAP "1 December 2009"
 .SH NAME
 pcap_compile \- compile a filter expression
 .SH SYNOPSIS
diff --git a/pcap_create.3pcap b/pcap_create.3pcap
index 153f9fd..5c537fc 100644
--- a/pcap_create.3pcap
+++ b/pcap_create.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_create.3pcap,v 1.1 2008-04-06 02:53:21 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_datalink.3pcap.in b/pcap_datalink.3pcap.in
index 51d5d66..b07fc28 100644
--- a/pcap_datalink.3pcap.in
+++ b/pcap_datalink.3pcap.in
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_datalink.3pcap.in,v 1.1 2008-10-21 07:33:02 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_DATALINK 3PCAP "22 August 2010"
+.TH PCAP_DATALINK 3PCAP "13 October 2013"
 .SH NAME
 pcap_datalink \- get the link-layer header type
 .SH SYNOPSIS
diff --git a/pcap_datalink_name_to_val.3pcap b/pcap_datalink_name_to_val.3pcap
index 9c8e18a..4bc1728 100644
--- a/pcap_datalink_name_to_val.3pcap
+++ b/pcap_datalink_name_to_val.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_datalink_name_to_val.3pcap,v 1.3 2008-04-06 02:53:21 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -43,6 +41,6 @@
 translation is case-insensitive.
 .SH RETURN VALUE
 .B pcap_datalink_name_to_val()
-returns 0 on success and \-1 on failure.
+returns type value on success and \-1 on failure.
 .SH SEE ALSO
 pcap(3PCAP)
diff --git a/pcap_datalink_val_to_name.3pcap b/pcap_datalink_val_to_name.3pcap
index 5acba77..0b17825 100644
--- a/pcap_datalink_val_to_name.3pcap
+++ b/pcap_datalink_val_to_name.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_datalink_val_to_name.3pcap,v 1.3 2008-12-24 21:45:25 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_dump.3pcap b/pcap_dump.3pcap
index 1ccd82a..95f3040 100644
--- a/pcap_dump.3pcap
+++ b/pcap_dump.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_dump.3pcap,v 1.3 2008-04-06 02:53:21 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -42,9 +40,9 @@
 .B pcap_dispatch()
 or
 .BR pcap_loop() .
-If called directly, the 
+If called directly, the
 .I user
-parameter is of type 
+parameter is of type
 .B pcap_dumper_t
 as returned by
 .BR pcap_dump_open() .
diff --git a/pcap_dump_close.3pcap b/pcap_dump_close.3pcap
index 4ed820b..afd00cb 100644
--- a/pcap_dump_close.3pcap
+++ b/pcap_dump_close.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_dump_close.3pcap,v 1.3 2008-04-06 02:53:21 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_dump_file.3pcap b/pcap_dump_file.3pcap
index 9e51a2a..982b0dc 100644
--- a/pcap_dump_file.3pcap
+++ b/pcap_dump_file.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_dump_file.3pcap,v 1.3 2008-04-06 02:53:21 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_dump_flush.3pcap b/pcap_dump_flush.3pcap
index b553883..ba98dee 100644
--- a/pcap_dump_flush.3pcap
+++ b/pcap_dump_flush.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_dump_flush.3pcap,v 1.3 2008-04-06 02:53:21 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_dump_ftell.3pcap b/pcap_dump_ftell.3pcap
index 1d0f96f..6d5c828 100644
--- a/pcap_dump_ftell.3pcap
+++ b/pcap_dump_ftell.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_dump_ftell.3pcap,v 1.3 2008-04-06 02:53:21 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_dump_open.3pcap.in b/pcap_dump_open.3pcap.in
index 2a5dc9d..0b2e3c6 100644
--- a/pcap_dump_open.3pcap.in
+++ b/pcap_dump_open.3pcap.in
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_dump_open.3pcap.in,v 1.1 2008-10-23 05:56:59 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -31,6 +29,7 @@
 .LP
 .ft B
 pcap_dumper_t *pcap_dump_open(pcap_t *p, const char *fname);
+pcap_dumper_t *pcap_dump_open_append(pcap_t *p, const char *fname);
 pcap_dumper_t *pcap_dump_fopen(pcap_t *p, FILE *fp);
 .ft
 .fi
@@ -43,7 +42,7 @@
 .BR tcpdump (1)
 and
 .BR tcpslice (1).
-The name "-" in a synonym
+The name "-" is a synonym
 for
 .BR stdout .
 .PP
@@ -62,9 +61,19 @@
 .BR pcap_open_live() ,
 or
 .BR pcap_open_dead() .
-The link-layer type and snapshot length from
+The time stamp precision, link-layer type, and snapshot length from
 .I p
 are used as the link-layer type and snapshot length of the output file.
+.PP
+.B pcap_dump_open_append()
+is like
+.B pcap_dump_open
+but does not create the file if it does not exist and, if it does
+already exist, and is a pcap file with the same byte order as the host
+opening the file, and has the same time stamp 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
 A pointer to a
 .B pcap_dumper_t
diff --git a/pcap_file.3pcap b/pcap_file.3pcap
index 1471ab6..7b18c81 100644
--- a/pcap_file.3pcap
+++ b/pcap_file.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_file.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_fileno.3pcap b/pcap_fileno.3pcap
index 723733e..39d068b 100644
--- a/pcap_fileno.3pcap
+++ b/pcap_fileno.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_fileno.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_FILENO 3PCAP "5 April 2008"
+.TH PCAP_FILENO 3PCAP "3 November 2009"
 .SH NAME
 pcap_fileno \- get the file descriptor for a live capture
 .SH SYNOPSIS
diff --git a/pcap_findalldevs.3pcap b/pcap_findalldevs.3pcap
index 2e56d09..00bb911 100644
--- a/pcap_findalldevs.3pcap
+++ b/pcap_findalldevs.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_findalldevs.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_FINDALLDEVS 3PCAP "22 August 2010"
+.TH PCAP_FINDALLDEVS 3PCAP "10 January 2014"
 .SH NAME
 pcap_findalldevs, pcap_freealldevs \- get a list of capture devices, and
 free that list
@@ -94,6 +92,12 @@
 .TP
 .B PCAP_IF_LOOPBACK
 set if the device is a loopback interface
+.TP
+.B PCAP_IF_UP
+set if the device is up
+.TP
+.B PCAP_IF_RUNNING
+set if the device is running
 .RE
 .RE
 .PP
@@ -167,7 +171,7 @@
 .PP
 The list of devices must be freed with
 .BR pcap_freealldevs() ,
-whch frees the list pointed to by
+which frees the list pointed to by
 .IR alldevs .
 .SH RETURN VALUE
 .B pcap_findalldevs()
diff --git a/pcap_freecode.3pcap b/pcap_freecode.3pcap
index 31b4f89..c3c3ea6 100644
--- a/pcap_freecode.3pcap
+++ b/pcap_freecode.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_freecode.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_get_selectable_fd.3pcap b/pcap_get_selectable_fd.3pcap
index ae33dbb..6640577 100644
--- a/pcap_get_selectable_fd.3pcap
+++ b/pcap_get_selectable_fd.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_get_selectable_fd.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_GET_SELECTABLE_FD 3PCAP "5 April 2008"
+.TH PCAP_GET_SELECTABLE_FD 3PCAP "22 July 2011"
 .SH NAME
 pcap_get_selectable_fd \- get a file descriptor on which a select() can
 be done for a live capture
@@ -38,9 +36,9 @@
 returns, on UNIX, a file descriptor number for a file descriptor on
 which one can
 do a
-.B select()
-or
-.B poll()
+.BR select() ,
+.BR poll() ,
+or other such call
 to wait for it to be possible to read packets without blocking, if such
 a descriptor exists, or \-1, if no such descriptor exists.  Some network
 devices opened with
@@ -56,6 +54,12 @@
 (for example, regular network devices on FreeBSD 4.3 and 4.4, and Endace
 DAG devices), so \-1 is returned for those devices.
 .PP
+Note that a descriptor on which a read can be done without blocking may,
+on some platforms, not have any packets to read if the read timeout has
+expired.  A call to
+.B pcap_dispatch()
+will return 0 in this case, but will not block.
+.PP
 Note that in:
 .IP
 FreeBSD prior to FreeBSD 4.6;
diff --git a/pcap_geterr.3pcap b/pcap_geterr.3pcap
index 1a4ea34..fcabec3 100644
--- a/pcap_geterr.3pcap
+++ b/pcap_geterr.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_geterr.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_inject.3pcap b/pcap_inject.3pcap
index 79a3eea..7ccdf2c 100644
--- a/pcap_inject.3pcap
+++ b/pcap_inject.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_inject.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_is_swapped.3pcap b/pcap_is_swapped.3pcap
index 29646d1..a120616 100644
--- a/pcap_is_swapped.3pcap
+++ b/pcap_is_swapped.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_is_swapped.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_IS_SWAPPED 3PCAP "5 April 2008"
+.TH PCAP_IS_SWAPPED 3PCAP "17 September 2013"
 .SH NAME
 pcap_is_swapped \- find out whether a savefile has the native byte order
 .SH SYNOPSIS
diff --git a/pcap_lib_version.3pcap b/pcap_lib_version.3pcap
index 7b39be1..3ec2e32 100644
--- a/pcap_lib_version.3pcap
+++ b/pcap_lib_version.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_lib_version.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_list_datalinks.3pcap.in b/pcap_list_datalinks.3pcap.in
index 9dfb342..f849346 100644
--- a/pcap_list_datalinks.3pcap.in
+++ b/pcap_list_datalinks.3pcap.in
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_list_datalinks.3pcap.in,v 1.1 2008-10-21 07:33:02 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_LIST_DATALINKS 3PCAP "22 August 2010"
+.TH PCAP_LIST_DATALINKS 3PCAP "17 September 2013"
 .SH NAME
 pcap_list_datalinks, pcap_free_datalinks \- get a list of link-layer header
 types supported by a capture device, and free that list
@@ -40,7 +38,7 @@
 interface associated with the pcap descriptor.
 .B pcap_list_datalinks()
 allocates an array to hold the list and sets
-.IR *dlt_buf 
+.IR *dlt_buf
 to point to that array.
 .LP
 The caller is responsible for freeing the array with
diff --git a/pcap_lookupdev.3pcap b/pcap_lookupdev.3pcap
index 8b23cb8..79dda42 100644
--- a/pcap_lookupdev.3pcap
+++ b/pcap_lookupdev.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_lookupdev.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_lookupnet.3pcap b/pcap_lookupnet.3pcap
index 75c82cf..a3d14ae 100644
--- a/pcap_lookupnet.3pcap
+++ b/pcap_lookupnet.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_lookupnet.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_loop.3pcap b/pcap_loop.3pcap
index c2ba33c..011d85c 100644
--- a/pcap_loop.3pcap
+++ b/pcap_loop.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_loop.3pcap,v 1.4 2008-12-25 02:01:32 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_LOOP 3PCAP "24 December 2008"
+.TH PCAP_LOOP 3PCAP "13 October 2013"
 .SH NAME
 pcap_loop, pcap_dispatch \- process packets from a live capture or savefile
 .SH SYNOPSIS
@@ -79,6 +77,13 @@
 reading a live capture, and causes all the packets in the file to be
 processed when reading a ``savefile''.
 .PP
+Note that, when doing a live capture on some platforms, if the read
+timeout expires when there are no packets available,
+.B pcap_dispatch()
+will return 0, even when not in non-blocking mode, as there are no
+packets to process.  Applications should be prepared for this to happen,
+but must not rely on it happening.
+.PP
 .ft B
 (In older versions of libpcap, the behavior when
 \fIcnt\fP
diff --git a/pcap_major_version.3pcap b/pcap_major_version.3pcap
index 31903dc..a085838 100644
--- a/pcap_major_version.3pcap
+++ b/pcap_major_version.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_major_version.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_MAJOR_VERSION 3PCAP "5 April 2008"
+.TH PCAP_MAJOR_VERSION 3PCAP "21 December 2011"
 .SH NAME
 pcap_major_version, pcap_minor_version \- get the version number of a savefile
 .SH SYNOPSIS
diff --git a/pcap_next_ex.3pcap b/pcap_next_ex.3pcap
index c4e467e..c310c2f 100644
--- a/pcap_next_ex.3pcap
+++ b/pcap_next_ex.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_next_ex.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_NEXT_EX 3PCAP "5 April 2008"
+.TH PCAP_NEXT_EX 3PCAP "13 October 2013"
 .SH NAME
 pcap_next_ex, pcap_next \- read the next packet from a pcap_t
 .SH SYNOPSIS
diff --git a/pcap_offline_filter.3pcap b/pcap_offline_filter.3pcap
index 3f11022..b471c6a 100644
--- a/pcap_offline_filter.3pcap
+++ b/pcap_offline_filter.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_offline_filter.3pcap,v 1.1 2008-05-13 15:19:56 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_OFFLINE_FILTER 3PCAP "13 May 2008"
+.TH PCAP_OFFLINE_FILTER 3PCAP "25 November 2012"
 .SH NAME
 pcap_offline_filter \- check whether a filter matches a packet
 .SH SYNOPSIS
diff --git a/pcap_open_dead.3pcap.in b/pcap_open_dead.3pcap.in
index 812946b..2d1b48c 100644
--- a/pcap_open_dead.3pcap.in
+++ b/pcap_open_dead.3pcap.in
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_open_dead.3pcap.in,v 1.1 2008-10-21 07:33:02 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_open_live.3pcap b/pcap_open_live.3pcap
index 0889a2a..715994b 100644
--- a/pcap_open_live.3pcap
+++ b/pcap_open_live.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_open_live.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_open_offline.3pcap.in b/pcap_open_offline.3pcap.in
index d38608d..7239729 100644
--- a/pcap_open_offline.3pcap.in
+++ b/pcap_open_offline.3pcap.in
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_open_offline.3pcap.in,v 1.1 2008-10-23 05:56:59 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -59,7 +57,7 @@
 .BR tcpslice (1),
 or can have the pcap-ng file format, although not all pcap-ng files can
 be read.
-The name "-" in a synonym for
+The name "-" is a synonym for
 .BR stdin .
 .PP
 .B pcap_open_offline_with_tstamp_precision()
diff --git a/pcap_set_buffer_size.3pcap b/pcap_set_buffer_size.3pcap
index 060e923..fea1df7 100644
--- a/pcap_set_buffer_size.3pcap
+++ b/pcap_set_buffer_size.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_set_buffer_size.3pcap,v 1.1 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_set_datalink.3pcap b/pcap_set_datalink.3pcap
index 9af32d0..60a7bfc 100644
--- a/pcap_set_datalink.3pcap
+++ b/pcap_set_datalink.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_set_datalink.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_set_promisc.3pcap b/pcap_set_promisc.3pcap
index 382260c..5d17572 100644
--- a/pcap_set_promisc.3pcap
+++ b/pcap_set_promisc.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_set_promisc.3pcap,v 1.1 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_set_rfmon.3pcap b/pcap_set_rfmon.3pcap
index ee73556..a386e8b 100644
--- a/pcap_set_rfmon.3pcap
+++ b/pcap_set_rfmon.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_set_rfmon.3pcap,v 1.1 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_set_snaplen.3pcap b/pcap_set_snaplen.3pcap
index 74195d9..8080ea1 100644
--- a/pcap_set_snaplen.3pcap
+++ b/pcap_set_snaplen.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_set_snaplen.3pcap,v 1.1 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_set_timeout.3pcap b/pcap_set_timeout.3pcap
index 0b66f21..b728203 100644
--- a/pcap_set_timeout.3pcap
+++ b/pcap_set_timeout.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_set_timeout.3pcap,v 1.1 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_SET_TIMEOUT 3PCAP "5 April 2008"
+.TH PCAP_SET_TIMEOUT 3PCAP "16 April 2014"
 .SH NAME
 pcap_set_timeout \- set the read timeout for a not-yet-activated
 capture handle
@@ -38,9 +36,6 @@
 the handle is activated to
 .IR to_ms ,
 which is in units of milliseconds.
-.LP
-The behavior, if the timeout isn't specified, is undefined.  We
-recommend always setting the timeout to a non-zero value.
 .SH RETURN VALUE
 .B pcap_set_timeout()
 returns 0 on success or
diff --git a/pcap_set_tstamp_precision.3pcap.in b/pcap_set_tstamp_precision.3pcap.in
index 053a4c6..85fa84d 100644
--- a/pcap_set_tstamp_precision.3pcap.in
+++ b/pcap_set_tstamp_precision.3pcap.in
@@ -48,7 +48,7 @@
 .B PCAP_TSTAMP_PRECISION_NANO
 to request desired precision. By default, time stamps are in microseconds.
 .SH RETURN VALUE
-.B pcap_set_tstamp_type()
+.B pcap_set_tstamp_precision()
 returns 0 on success if the specified time stamp precision is expected to be
 supported by the operating system,
 .B PCAP_ERROR_TSTAMP_PRECISION_NOTSUP
diff --git a/pcap_set_tstamp_type.3pcap.in b/pcap_set_tstamp_type.3pcap.in
index 261c315..fd673bd 100644
--- a/pcap_set_tstamp_type.3pcap.in
+++ b/pcap_set_tstamp_type.3pcap.in
@@ -52,7 +52,7 @@
 returns 0 on success if the specified time stamp type is expected to be
 supported by the capture device,
 .B PCAP_WARNING_TSTAMP_TYPE_NOTSUP
-on success if the specified time stamp type is not supported by the
+if the specified time stamp type is not supported by the
 capture device,
 .B PCAP_ERROR_ACTIVATED
 if called on a capture handle that has been activated, and
diff --git a/pcap_setdirection.3pcap b/pcap_setdirection.3pcap
index bd0fb25..871a5b0 100644
--- a/pcap_setdirection.3pcap
+++ b/pcap_setdirection.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_setdirection.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -39,7 +37,7 @@
 is one of the constants
 .BR PCAP_D_IN ,
 .B PCAP_D_OUT
-or 
+or
 .BR PCAP_D_INOUT .
 .B PCAP_D_IN
 will only capture packets received by the device,
diff --git a/pcap_setfilter.3pcap b/pcap_setfilter.3pcap
index 89d5da7..c737797 100644
--- a/pcap_setfilter.3pcap
+++ b/pcap_setfilter.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_setfilter.3pcap,v 1.4 2008-05-13 15:19:56 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_SETFILTER 3PCAP "5 April 2008"
+.TH PCAP_SETFILTER 3PCAP "13 May 2008"
 .SH NAME
 pcap_setfilter \- set the filter
 .SH SYNOPSIS
diff --git a/pcap_setnonblock.3pcap b/pcap_setnonblock.3pcap
index b00fce1..a99ea07 100644
--- a/pcap_setnonblock.3pcap
+++ b/pcap_setnonblock.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_setnonblock.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -59,6 +57,14 @@
 and
 .B pcap_next()
 will not work in ``non-blocking'' mode.
+.PP
+When first activated with
+.B pcap_activate()
+or opened with
+.B pcap_open_live() ,
+a capture handle is not in ``non-blocking mode''; a call to
+.B pcap_setnonblock()
+is required in order to put it into ``non-blocking'' mode.
 .SH RETURN VALUE
 .B pcap_getnonblock()
 returns the current ``non-blocking'' state of the capture descriptor; it
diff --git a/pcap_snapshot.3pcap b/pcap_snapshot.3pcap
index f8e4097..47eb42a 100644
--- a/pcap_snapshot.3pcap
+++ b/pcap_snapshot.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_snapshot.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -19,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_SNAPSHOT 3PCAP "5 April 2008"
+.TH PCAP_SNAPSHOT 3PCAP "17 September 2013"
 .SH NAME
 pcap_snapshot \- get the snapshot length
 .SH SYNOPSIS
diff --git a/pcap_stats.3pcap b/pcap_stats.3pcap
index a953e21..159054e 100644
--- a/pcap_stats.3pcap
+++ b/pcap_stats.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_stats.3pcap,v 1.3 2008-04-06 02:53:22 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_statustostr.3pcap b/pcap_statustostr.3pcap
index da18f69..77b8c5f 100644
--- a/pcap_statustostr.3pcap
+++ b/pcap_statustostr.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_statustostr.3pcap,v 1.1 2008-04-09 21:39:21 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_strerror.3pcap b/pcap_strerror.3pcap
index 8e6319b..7185162 100644
--- a/pcap_strerror.3pcap
+++ b/pcap_strerror.3pcap
@@ -1,5 +1,3 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/pcap_strerror.3pcap,v 1.2 2008-04-05 20:26:56 guy Exp $
-.\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
diff --git a/pcap_tstamp_type_name_to_val.3pcap b/pcap_tstamp_type_name_to_val.3pcap
index 8fcc4d7..22dd15f 100644
--- a/pcap_tstamp_type_name_to_val.3pcap
+++ b/pcap_tstamp_type_name_to_val.3pcap
@@ -38,7 +38,7 @@
 value.  The translation is case-insensitive.
 .SH RETURN VALUE
 .B pcap_tstamp_type_name_to_val()
-returns 0 on success and
+returns time stamp type value on success and
 .B PCAP_ERROR
 on failure.
 .SH SEE ALSO
diff --git a/ppp.h b/ppp.h
index 4e1d08d..d6e70c1 100644
--- a/ppp.h
+++ b/ppp.h
@@ -1,4 +1,3 @@
-/* @(#) $Header: /tcpdump/master/libpcap/ppp.h,v 1.12 2005-02-08 19:52:19 guy Exp $ (LBL) */
 /*
  * Point to Point Protocol (PPP) RFC1331
  *
diff --git a/runlex.sh b/runlex.sh
index 74f2161..06b8bd4 100755
--- a/runlex.sh
+++ b/runlex.sh
@@ -7,8 +7,6 @@
 # means that neither Flex nor Lex was found, so we report an error and
 # quit.
 #
-# @(#) $Header: /tcpdump/master/libpcap/runlex.sh,v 1.4 2007-12-31 03:38:39 guy Exp $
-#
 
 #
 # Get the name of the command to run, and then shift to get the arguments.
@@ -179,7 +177,7 @@
 	#
 	# OK, rename lex.yy.c to the right output file.
 	#
-	mv lex.yy.c "$outfile" 
+	mv lex.yy.c "$outfile"
 
 	#
 	# Did that succeed?
@@ -230,6 +228,6 @@
 $prefixline
 #ifndef YY_DECL
 #define YY_DECL int yylex(void)
-#endif  
+#endif
 YY_DECL;
 EOF
diff --git a/savefile.c b/savefile.c
index 73e3ea9..783ec45 100644
--- a/savefile.c
+++ b/savefile.c
@@ -28,11 +28,6 @@
  * dependent values so we can print the dump file on any architecture.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.183 2008-12-23 20:13:29 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -223,14 +218,14 @@
 	FILE *file;
 
 	fd = _open_osfhandle(osfd, _O_RDONLY);
-	if ( fd < 0 ) 
+	if ( fd < 0 )
 	{
 		snprintf(errbuf, PCAP_ERRBUF_SIZE, pcap_strerror(errno));
 		return NULL;
 	}
 
 	file = _fdopen(fd, "rb");
-	if ( file == NULL ) 
+	if ( file == NULL )
 	{
 		snprintf(errbuf, PCAP_ERRBUF_SIZE, pcap_strerror(errno));
 		return NULL;
@@ -349,6 +344,11 @@
 	 */
 	p->oneshot_callback = pcap_oneshot;
 
+	/*
+	 * Savefiles never require special BPF code generation.
+	 */
+	p->bpf_codegen_flags = 0;
+
 	p->activated = 1;
 
 	return (p);
diff --git a/scanner.c b/scanner.c
index e9fc736..df78682 100644
--- a/scanner.c
+++ b/scanner.c
@@ -1,3 +1,6 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #line 2 "scanner.c"
 
 #line 4 "scanner.c"
@@ -28,7 +31,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 39
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -181,7 +184,12 @@
 typedef struct yy_buffer_state *YY_BUFFER_STATE;
 #endif
 
-extern int pcap_leng;
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t pcap_leng;
 
 extern FILE *pcap_in, *pcap_out;
 
@@ -190,6 +198,7 @@
 #define EOB_ACT_LAST_MATCH 2
 
     #define YY_LESS_LINENO(n)
+    #define YY_LINENO_REWIND_TO(ptr)
     
 /* Return all but the first "n" matched characters back to the input stream. */
 #define yyless(n) \
@@ -207,11 +216,6 @@
 
 #define unput(c) yyunput( c, (yytext_ptr)  )
 
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
 #ifndef YY_STRUCT_YY_BUFFER_STATE
 #define YY_STRUCT_YY_BUFFER_STATE
 struct yy_buffer_state
@@ -229,7 +233,7 @@
 	/* Number of characters read into yy_ch_buf, not including EOB
 	 * characters.
 	 */
-	int yy_n_chars;
+	yy_size_t yy_n_chars;
 
 	/* Whether we "own" the buffer - i.e., we know we created it,
 	 * and can realloc() it to grow it, and should free() it to
@@ -299,8 +303,8 @@
 
 /* yy_hold_char holds the character lost when pcap_text is formed. */
 static char yy_hold_char;
-static int yy_n_chars;		/* number of characters read into yy_ch_buf */
-int pcap_leng;
+static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
+yy_size_t pcap_leng;
 
 /* Points to current character in buffer. */
 static char *yy_c_buf_p = (char *) 0;
@@ -328,7 +332,7 @@
 
 YY_BUFFER_STATE pcap__scan_buffer (char *base,yy_size_t size  );
 YY_BUFFER_STATE pcap__scan_string (yyconst char *yy_str  );
-YY_BUFFER_STATE pcap__scan_bytes (yyconst char *bytes,int len  );
+YY_BUFFER_STATE pcap__scan_bytes (yyconst char *bytes,yy_size_t len  );
 
 void *pcap_alloc (yy_size_t  );
 void *pcap_realloc (void *,yy_size_t  );
@@ -388,8 +392,8 @@
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
 
-#define YY_NUM_RULES 154
-#define YY_END_OF_BUFFER 155
+#define YY_NUM_RULES 155
+#define YY_END_OF_BUFFER 156
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -397,168 +401,169 @@
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[1459] =
+static yyconst flex_int16_t yy_accept[1464] =
     {   0,
-        0,    0,  155,  152,  112,  112,  112,  113,  152,  113,
-      113,  113,  153,  122,  122,  113,  113,  113,  113,  150,
-      150,  152,  150,  150,  150,  150,  150,  150,  150,  150,
-      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,
-      150,  150,  113,  152,  116,  120,   67,    0,  150,  122,
-        0,  150,  150,  150,    0,  124,  118,  115,  117,  114,
-      119,  150,  151,  151,  150,  150,  150,   20,  150,  150,
-      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,
-      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,
-      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,
+        0,    0,  156,  153,  113,  113,  113,  114,  153,  114,
+      114,  114,  154,  123,  123,  114,  114,  114,  114,  151,
+      151,  153,  151,  151,  151,  151,  151,  151,  151,  151,
+      151,  151,  151,  151,  151,  151,  151,  151,  151,  151,
+      151,  151,  114,  153,  117,  121,   67,    0,  151,  123,
+        0,  151,  151,  151,    0,  125,  119,  116,  118,  115,
+      120,  151,  152,  152,  151,  151,  151,   20,  151,  151,
+      151,  151,  151,  151,  151,  151,  151,  151,  151,  151,
+      151,  151,  151,  151,  151,  151,  151,  151,  151,  151,
+      151,  151,  151,  151,  151,  151,  151,  151,  151,  151,
 
-        7,  150,   34,   35,  150,  150,  150,  150,  150,  150,
-      150,  150,  150,  150,  150,  150,  150,  150,   91,  150,
-       68,  150,  150,  150,  150,  150,  150,   60,  150,  150,
-      150,  150,   85,  150,  150,  150,  150,  150,  150,   61,
-      150,    4,  150,  150,  150,  150,  150,  150,  150,   68,
-      120,  150,  123,  123,  150,  122,  150,    0,  124,  122,
-      124,  124,  124,  150,  150,  150,   67,    5,  150,   80,
-      150,  150,  150,  150,  150,  150,  150,   55,  106,    1,
-        0,  150,   21,  150,  150,  150,  150,  150,  150,  150,
-      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,
+      151,    7,  151,   34,   35,  151,  151,  151,  151,  151,
+      151,  151,  151,  151,  151,  151,  151,  151,  151,   92,
+      151,   68,  151,  151,  151,  151,  151,  151,   60,  151,
+      151,  151,  151,   86,  151,  151,  151,  151,  151,  151,
+       61,  151,    4,  151,  151,  151,  151,  151,  151,  151,
+       68,  121,  151,  124,  124,  151,  123,  151,    0,  125,
+      123,  125,  125,  125,  151,  151,  151,   67,    5,  151,
+       81,  151,  151,  151,  151,  151,  151,  151,   55,  107,
+        1,    0,  151,   21,  151,  151,  151,  151,  151,  151,
+      151,  151,  151,  151,  151,  151,  151,  151,  151,  151,
 
-       36,  150,  150,   18,   43,    0,  150,   29,  150,   25,
-       70,  150,  150,   78,   37,  150,   99,  150,  150,  150,
-      150,  100,  150,   46,   69,   81,  105,  150,   14,  150,
-        3,  150,  150,  150,  150,  150,   93,  150,  150,   26,
-      150,  104,  150,  107,   38,    2,  150,   42,  150,    9,
-      150,   10,   88,  150,   87,  150,  150,    0,  150,  150,
-      123,  150,  150,  150,  150,  122,    0,  150,    0,  125,
-      124,  124,    0,  124,    0,  124,    0,  124,    0,   23,
-      150,  150,  150,  150,   64,   16,   41,  150,   39,  150,
-      150,  150,   30,  150,   97,  150,  150,  110,  150,  150,
+      151,  151,   36,  151,  151,   18,   43,    0,  151,   29,
+      151,   25,   70,  151,  151,   79,   37,  151,  100,  151,
+      151,  151,  151,  101,  151,   46,   69,   82,  106,  151,
+       14,  151,    3,  151,  151,  151,  151,  151,   94,  151,
+      151,   26,  151,  105,  151,  108,   38,    2,  151,   42,
+      151,    9,  151,   10,   89,  151,   88,  151,  151,    0,
+      151,  151,  124,  151,  151,  151,  151,  123,    0,  151,
+        0,  126,  125,  125,    0,  125,    0,  125,    0,  125,
+        0,   23,  151,  151,  151,  151,   64,   16,   41,  151,
+       39,  151,  151,  151,   30,  151,   98,  151,  151,  151,
 
-      103,  109,   45,  108,  111,   11,  150,   12,   13,  150,
-      150,  150,   32,   77,  150,   62,    3,   98,   47,  150,
-      150,  150,   74,  150,  150,  150,  150,   48,  150,  150,
-       40,  150,    6,  150,   92,  150,    8,   94,  150,  150,
-        0,  150,   53,   73,   15,  150,  123,  123,  150,  123,
-      123,  123,  150,  122,  150,    0,  124,  150,    0,    0,
-      124,    0,  124,  125,  124,    0,    0,    0,    0,  124,
-      124,  124,  124,  124,    0,  150,   56,   57,   58,   59,
-      150,   22,  150,  150,  150,  150,   31,  150,  150,  101,
-      102,    0,   19,  150,  150,  150,   86,  150,   33,  150,
+      111,  151,  151,  104,  110,   45,  109,  112,   11,  151,
+       12,   13,  151,  151,  151,   32,   78,  151,   62,    3,
+       99,   47,  151,  151,  151,   74,  151,  151,  151,  151,
+       48,  151,  151,   40,  151,    6,  151,   93,  151,    8,
+       95,  151,  151,    0,  151,   53,   73,   15,  151,  124,
+      124,  151,  124,  124,  124,  151,  123,  151,    0,  125,
+      151,    0,    0,  125,    0,  125,  126,  125,    0,    0,
+        0,    0,  125,  125,  125,  125,  125,    0,  151,   56,
+       57,   58,   59,  151,   22,  151,  151,  151,  151,   31,
+      151,  151,  151,  102,  103,    0,   19,  151,  151,  151,
 
-       79,   28,   27,  150,  150,   82,  150,  150,  150,   50,
-       17,  150,  150,  150,  150,  150,  150,  150,  150,  150,
-      150,  150,  150,    0,  150,  150,  123,  150,  150,  150,
-      150,  123,  123,  150,  122,  150,    0,    0,  124,  124,
-      124,    0,    0,  125,  124,  124,  125,  124,    0,    0,
-      124,  124,  124,  124,  124,    0,    0,    0,    0,  124,
-      124,    0,  124,    0,  124,    0,   96,  150,  150,  150,
-       24,  150,  150,  150,  150,  150,  150,  150,  150,  150,
-      150,  150,  150,  150,  150,   70,  150,  150,  150,  150,
-      150,  150,  150,   75,   76,  150,   95,  150,  150,  150,
+       87,  151,   33,  151,   80,   28,   27,  151,  151,   83,
+      151,  151,  151,   50,   17,  151,  151,  151,  151,  151,
+      151,  151,  151,  151,  151,  151,  151,    0,  151,  151,
+      124,  151,  151,  151,  151,  124,  124,  151,  123,  151,
+        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,  151,  151,  151,   24,  151,  151,   77,  151,  151,
+      151,  151,  151,  151,  151,  151,  151,  151,  151,  151,
+       70,  151,  151,  151,  151,  151,  151,  151,   75,   76,
 
-      150,  150,  150,  150,  150,  150,  150,  150,  150,  123,
-      123,  150,  123,  123,  123,  123,  150,  122,  150,    0,
-      124,  124,    0,  124,    0,    0,  124,    0,  124,  125,
-      124,    0,    0,    0,  124,  124,    0,  124,  125,  124,
-        0,    0,    0,    0,    0,    0,    0,  124,  124,  124,
-      124,  124,    0,  150,  150,  150,  150,   52,   63,  150,
-      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,
-      150,   71,  150,  150,   44,   83,   84,  150,  150,  150,
-      150,   54,  148,  144,  150,  146,  145,  149,  150,    0,
-      150,  150,  123,  150,  150,  150,  123,  150,  122,  150,
+      151,   96,  151,  151,  151,  151,  151,  151,  151,  151,
+      151,  151,  151,  151,  124,  124,  151,  124,  124,  124,
+      124,  151,  123,  151,    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,  151,  151,
+      151,  151,   52,   63,  151,  151,  151,  151,  151,  151,
+      151,  151,  151,  151,  151,  151,   71,  151,  151,   44,
+       84,   85,  151,  151,  151,  151,   54,  149,  145,  151,
+      147,  146,  150,  151,    0,  151,  151,  124,  151,  151,
 
-        0,    0,  124,  124,  124,  124,  124,  124,    0,    0,
-      125,  124,  124,  124,    0,    0,  124,  124,  124,  124,
-      124,    0,    0,    0,    0,    0,    0,    0,  124,  124,
-      124,  124,  124,    0,    0,    0,    0,    0,  124,  124,
-        0,  124,    0,  124,    0,  150,  150,  150,  150,  150,
-      150,  150,  150,  150,  150,  150,  150,  150,  127,  126,
-      150,  150,   72,  150,  150,  150,  147,  143,  150,  150,
-      123,  123,  123,  123,  150,  122,  150,    0,  124,  124,
-        0,  124,  124,    0,  124,    0,    0,  124,    0,  124,
-      125,  124,    0,    0,    0,  124,  124,    0,  124,  125,
+      151,  124,  151,  123,  151,    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,
+      151,  151,  151,  151,  151,  151,  151,  151,  151,  151,
+      151,  151,  151,  128,  127,  151,  151,   72,  151,  151,
+      151,  148,  144,  151,  151,  124,  124,  124,  124,  151,
+      123,  151,    0,  125,  125,    0,  125,  125,    0,  125,
+        0,    0,  125,    0,  125,  126,  125,    0,    0,    0,
 
-      124,    0,    0,    0,    0,    0,  124,  124,    0,  124,
-      125,  124,    0,  124,  124,    0,    0,    0,    0,    0,
-        0,    0,  124,  124,  124,  124,  124,    0,   65,  150,
-       55,  132,  139,  150,  150,  150,  150,  150,  150,  150,
-      150,  150,   66,   49,  150,  150,    0,  150,  150,  150,
-      150,  150,  122,  150,    0,    0,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,    0,    0,  125,  124,  124,
-      124,    0,    0,  124,  124,  124,  124,  124,    0,    0,
-        0,    0,    0,    0,    0,  124,  124,  124,  124,  124,
-        0,  124,  124,    0,    0,    0,    0,    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,  151,   55,  133,  140,  151,  151,
+      151,  151,  151,  151,  151,  151,  151,   66,   49,  151,
+      151,    0,  151,  151,  151,  151,  151,  123,  151,    0,
+        0,  125,  125,  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,
 
-      124,  124,  124,  124,  124,    0,    0,    0,    0,    0,
-        0,  124,  124,    0,  124,    0,  124,    0,   89,  150,
-      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,
-       51,  121,  121,  123,  123,  150,  122,  150,    0,  124,
-      124,    0,  124,  124,    0,  124,  124,    0,  124,    0,
-      121,  124,    0,  124,  125,  124,    0,    0,    0,  124,
-      124,    0,  124,  125,  124,    0,    0,    0,    0,    0,
-      124,  124,    0,  124,  125,  124,    0,    0,    0,    0,
-        0,    0,  124,  124,    0,  124,  125,  124,    0,  124,
-      124,  124,    0,    0,    0,    0,    0,    0,    0,  124,
+        0,    0,    0,    0,    0,  125,  125,  125,  125,  125,
+        0,    0,    0,    0,    0,    0,  125,  125,    0,  125,
+        0,  125,    0,   90,  151,  151,  151,  151,  151,  151,
+      151,  151,  151,  151,  151,   51,  122,  122,  124,  124,
+      151,  123,  151,    0,  125,  125,    0,  125,  125,    0,
+      125,  125,    0,  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,
 
-      124,  124,  124,  124,    0,  150,  150,  150,  150,  150,
-      150,  150,  150,  137,  150,   90,  121,  121,  123,  150,
-      121,  121,    0,    0,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,    0,  121,  125,  124,
-      124,  124,    0,    0,  124,  124,  124,  124,  124,    0,
-        0,    0,    0,    0,    0,    0,  124,  124,  124,  124,
-      124,    0,  124,  124,    0,    0,    0,    0,    0,    0,
-        0,  124,  124,  124,  124,  124,    0,  124,  124,  124,
-        0,    0,    0,    0,    0,    0,    0,  124,  124,  124,
-      124,  124,    0,    0,    0,    0,    0,    0,  124,  124,
+        0,    0,    0,    0,  125,  125,  125,  125,  125,    0,
+      151,  151,  151,  151,  151,  151,  151,  151,  138,  151,
+       91,  122,  122,  124,  151,  122,  122,    0,    0,  125,
+      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,
+      125,    0,  122,  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,  124,    0,  124,    0,  150,  150,  150,  141,  150,
-      150,  150,  150,  150,  150,  150,  129,  123,  150,  122,
-        0,  124,  124,    0,  124,  124,    0,  124,  124,    0,
-      124,  124,    0,  124,    0,    0,    0,  124,    0,    0,
-      124,  125,  124,    0,    0,    0,  124,  124,    0,  124,
-      125,  124,    0,    0,    0,    0,    0,  124,  124,    0,
-      124,  125,  124,    0,    0,    0,    0,    0,    0,  124,
-      124,    0,  124,  125,  124,    0,    0,    0,    0,    0,
-        0,  124,  124,    0,  124,  125,  124,    0,  124,  124,
-      124,    0,    0,    0,    0,    0,    0,    0,  124,  124,
+        0,    0,    0,  125,  125,    0,  125,    0,  125,    0,
+      151,  151,  151,  142,  151,  151,  151,  151,  151,  151,
+      151,  130,  124,  151,  123,    0,  125,  125,    0,  125,
+      125,    0,  125,  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,
 
-      124,  124,  124,    0,  150,  150,  150,  150,  131,  150,
-      150,  150,  135,  150,  121,    0,    0,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,    0,    0,    0,  125,    0,    0,  124,    0,
-        0,  124,  124,  124,    0,    0,    0,    0,    0,    0,
-        0,  124,  124,  124,    0,  124,  124,    0,    0,    0,
-        0,    0,    0,    0,  124,  124,  124,    0,  124,  124,
-      124,    0,    0,    0,    0,    0,    0,    0,  124,  124,
-      124,    0,  124,  124,  124,    0,    0,    0,    0,    0,
-        0,    0,  124,  124,  124,    0,    0,    0,    0,    0,
+        0,    0,    0,  125,  125,  125,  125,  125,    0,  151,
+      151,  151,  151,  132,  151,  151,  151,  136,  151,  122,
+        0,    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,  124,  124,    0,  124,    0,  124,    0,  128,  140,
-      142,  136,  150,  150,  150,  150,    0,    0,  124,    0,
-      124,    0,  124,  124,    0,  124,  124,    0,  124,  124,
-        0,  124,  124,    0,  124,    0,    0,    0,    0,  124,
-      124,    0,  124,    0,    0,  124,  124,  124,    0,    0,
-        0,    0,  124,  124,  124,    0,    0,    0,    0,    0,
-      124,  124,  124,    0,    0,    0,    0,    0,  124,  124,
-      124,    0,    0,    0,    0,    0,  124,  124,  124,  124,
-      124,  124,    0,    0,    0,    0,    0,    0,    0,  124,
-      124,  124,    0,  150,  150,  150,  150,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,  125,  125,    0,  125,
+        0,  125,    0,  129,  141,  143,  137,  151,  151,  151,
+      151,    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,  151,  151,
 
-      124,  124,  124,  124,  124,  124,    0,    0,    0,    0,
-      124,  124,    0,    0,    0,    0,  124,  124,  124,    0,
-        0,    0,    0,    0,  124,  124,  124,  124,    0,    0,
-        0,    0,    0,  124,  124,  124,  124,    0,    0,    0,
-        0,    0,  124,  124,  124,  124,    0,    0,    0,    0,
-        0,  124,    0,    0,    0,    0,    0,  124,  124,  124,
-      150,  150,  150,  138,  124,  124,  124,  124,  124,  124,
-      124,  124,    0,    0,    0,    0,  124,  124,    0,    0,
-      124,    0,    0,    0,  124,    0,    0,    0,  124,    0,
-        0,    0,  124,    0,    0,    0,  124,  124,  124,  124,
+      151,  151,    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,  151,  151,  151,  139,  125,
+      125,  125,  125,  125,  125,  125,  125,    0,    0,    0,
+        0,  125,  125,    0,    0,  125,    0,    0,    0,  125,
+        0,    0,    0,  125,    0,    0,    0,  125,    0,    0,
 
-        0,    0,    0,    0,    0,  124,  133,  150,  130,  124,
-        0,    0,  124,  124,    0,  124,  124,  124,    0,  124,
-      124,  124,    0,  124,  124,  124,    0,  124,  124,  124,
-        0,    0,    0,    0,  124,  134,  124,  124,    0,    0,
-        0,    0,    0,    0,  124,  124,  124,    0,    0,  124,
-      124,  124,  124,  124,    0,  124,  124,    0
+        0,  125,  125,  125,  125,    0,    0,    0,    0,    0,
+      125,  134,  151,  131,  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,  125,  125,    0,    0,    0,    0,    0,    0,  125,
+      125,  125,    0,    0,  125,  125,  125,  125,  125,    0,
+      125,  125,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -566,13 +571,13 @@
         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
         1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    2,    5,    1,    1,    6,    1,    7,    1,    8,
-        8,    9,    9,    1,   10,   11,    9,   12,   13,   14,
+        1,    2,    5,    1,    1,    6,    7,    8,    1,    9,
+        9,    7,    7,    1,   10,   11,    7,   12,   13,   14,
        15,   16,   17,   18,   17,   17,   17,   19,    1,   20,
        21,   22,    1,    1,   23,   23,   23,   23,   23,   23,
        24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
        24,   24,   24,   24,   24,   24,   24,   25,   24,   24,
-       26,   27,   26,    1,   28,    1,   29,   30,   31,   32,
+       26,   27,   26,    7,   28,    1,   29,   30,   31,   32,
 
        33,   34,   35,   36,   37,   24,   38,   39,   40,   41,
        42,   43,   44,   45,   46,   47,   48,   49,   50,   51,
@@ -595,7 +600,7 @@
 
 static yyconst flex_int32_t yy_meta[54] =
     {   0,
-        1,    2,    2,    1,    2,    1,    3,    2,    1,    4,
+        1,    2,    2,    1,    2,    1,    1,    3,    2,    4,
         5,    6,    6,    6,    6,    6,    6,    6,    7,    3,
         3,    3,    8,    4,    9,    3,    1,    4,    8,    8,
         8,    8,    8,    8,    4,    4,    4,    4,    4,    4,
@@ -603,230 +608,231 @@
         9,    4,    3
     } ;
 
-static yyconst flex_int16_t yy_base[1919] =
+static yyconst flex_int16_t yy_base[1924] =
     {   0,
-        0,    0, 3907,   53, 7401, 7401,   54, 3884,   60, 3897,
-     7401,   82, 7401,  100,   31,  152,   47, 3882,   49,  169,
-      211,  169,   61,   44,  126,   61,   30,   63,   76,  158,
-      215,  218,  160,   32,  166,  117,  230,  236,  208, 3855,
-      174, 3847, 3832,  281, 7401,    0, 7401,  297,  320,  344,
-     3865,  368,    0,  375,    0,  409, 7401, 7401, 7401, 7401,
-     7401,  279,  297,    0, 3838, 3834, 3848,    0, 3847, 3821,
-     3834, 3831, 3819, 3813, 3813, 3816, 3815, 3799, 3808, 3793,
-     3806, 3789,  225, 3798, 3801, 3786, 3770, 3783, 3772, 3777,
-     3767, 3765,  121,   83, 3770, 3768,  129, 3757, 3752, 3761,
+        0,    0, 3898,   53, 7420, 7420,   57, 3862,   64,   81,
+     3874, 7420, 7420,   99,   30,  151,   46, 3860,   52,  168,
+      210,  168,  160,   44,  125,   60,   31,   58,  132,  170,
+      214,  217,  229,   59,  170,  222,  237,  243,  250, 3848,
+      255, 3840, 3824,  300, 7420,    0, 7420,  316,  339,  363,
+     3857,  387,    0,  394,    0,  428, 7420, 7420, 7420, 7420,
+     7420,  296,  316,    0, 3830, 3812, 3826,    0, 3825, 3813,
+     3826, 3822, 3810, 3804, 3791, 3794, 3793, 3792, 3801, 3785,
+     3798, 3781,  116, 3776, 3779, 3764, 3762, 3767, 3773, 3762,
+     3767, 3743, 3742,   56,   68, 3747, 3745,   80, 3749, 3743,
 
-      148,  228,    0,    0,   37,  169, 3749, 3758,  226, 3741,
-     3739, 3742, 3731, 3721, 3729, 3720, 3719, 3724,    0, 3732,
-        0, 3715, 3706, 3700, 3701, 3701, 3701,  234, 3710, 3693,
-     3690, 3683,   56, 3679,  243, 3677,  160, 3676, 3687,    0,
-     3673,    0, 3672, 3656, 3661, 3668, 3659, 3649, 3663, 7401,
-     7401,  434,  458,  274,  499,  523,  547, 3657,  554, 3664,
-      578,  293, 3655, 3630, 3635, 3625,    0,    0, 3630,    0,
-     3639, 3619, 3608, 3607, 3608, 3604, 3604, 3596,    0,    0,
-     3591, 3581,    0, 3593, 3588, 3575, 3589, 3592, 3574, 3558,
-     3557, 3554, 3569, 3552, 3556, 3536, 3538, 3551, 3536, 3535,
+     3752,   68,  166,    0,    0,   15,  122, 3740, 3734,  189,
+     3718, 3716, 3719, 3722, 3710, 3718, 3695, 3694, 3700,    0,
+     3708,    0, 3691, 3696, 3690, 3691, 3676, 3676,  128, 3687,
+     3670, 3680, 3672,  159, 3653,  201, 3651,   38, 3650, 3662,
+        0, 3648,    0, 3646, 3645, 3650, 3642, 3633, 3624, 3639,
+     7420, 7420,  453,  477,  236,  518,  542,  566, 3647,  573,
+     3653,  597,  248, 3629, 3604, 3609, 3600,    0,    0, 3605,
+        0, 3613, 3608, 3597, 3581, 3582, 3579, 3580, 3586,    0,
+        0, 3581, 3571,    0, 3568, 3563, 3551, 3565, 3564, 3566,
+     3563, 3547, 3546, 3522, 3538, 3520, 3524, 3518, 3520, 3533,
 
-        0, 3539, 3533,    0,    0, 3537, 3527,    0, 3518,    0,
-     3515, 3502, 3509,    0,    0, 3497,    0, 3506, 3514,  272,
-     3496,    0, 3480, 3496,    0, 3491,    0, 3494,    0, 3474,
-     3478, 3472, 3475, 3471, 3444, 3440,    0, 3438, 3450,    0,
-     3438,    0, 3437,    0,    0,    0, 3434,    0,  171,  202,
-     3445,    0,    0, 3421,    0, 3418, 3419,  618, 3449,  641,
-      665, 3446,  672,  481,  115,  696, 3437,  720, 3436, 3435,
-      728,  294, 3420, 3419,  488,  769,  792, 3417,    0,    0,
-     3392,  381, 3395, 3399,    0,    0,    0, 3382,    0, 3381,
-     3382, 3366,    0, 3364,    0, 3358, 3360,    0, 3343, 3342,
+     3518, 3503,    0, 3508, 3502,    0,    0, 3506, 3494,    0,
+     3506,    0, 3503, 3491, 3489,    0,    0, 3458,    0, 3467,
+     3475,  244, 3456,    0, 3453, 3469,    0, 3464,    0, 3467,
+        0, 3434, 3438, 3432, 3435, 3439, 3432, 3428,    0, 3426,
+     3425,    0, 3414,    0, 3412,    0,    0,    0, 3408,    0,
+      153,  156, 3419,    0,    0, 3409,    0, 3391, 3392,  637,
+     3422,  660,  684, 3420,  691,  500,  281,  715, 3409,  739,
+     3408, 3407,  747,  290, 3391, 3390,  507,  788,  811, 3389,
+        0,    0, 3363,  350, 3354, 3357,    0,    0,    0, 3346,
+        0, 3345, 3338, 3322,    0, 3321,    0, 3296, 3296, 3297,
 
-        0,    0,    0,    0,    0,  595, 3349,    0,    0, 3355,
-     3325, 3324,    0,    0, 3313,    0,    0,    0,    0, 3328,
-     3311, 3318,    0, 3310, 3294, 3310, 3283, 3279, 3290, 3279,
-        0, 3278,    0, 3264,    0,  261,    0,    0, 3247, 3241,
-      720, 3247,    0,    0,    0,  817,  841,  296,  882, 3274,
-     3273,  405,  905,  929,  953, 3242,  960,  602, 3241, 3240,
-      983,  757, 1007, 1030, 3239,    0, 3236,  408,  409, 1054,
-     3235, 1078,  297, 3224, 3210, 3179,    0,    0,    0,    0,
-     3173,    0, 3183, 3182, 3150, 3148,    0, 3165, 3160,    0,
-        0, 1097,    0, 3148, 3126, 3140,    0, 3131,    0, 3135,
+        0, 3295, 3294,    0,    0,    0,    0,    0,  614, 3300,
+        0,    0, 3294, 3266, 3266,    0,    0, 3258,    0,    0,
+        0,    0, 3273, 3264, 3250,    0, 3243, 3246, 3262, 3235,
+     3229, 3240, 3220,    0, 3198,    0, 3197,    0,  275,    0,
+        0, 3190, 3181,  739, 3193,    0,    0,    0,  836,  860,
+      293,  901, 3205, 3203,  405,  924,  948,  972, 3194,  979,
+      621, 3193, 3190, 1002,  776, 1026, 1049, 3178,    0, 3173,
+      427,  428, 1073, 3172, 1097,  333, 3171, 3162, 3130,    0,
+        0,    0,    0, 3122,    0, 3125, 3121, 3104, 3103,    0,
+     3098, 3082, 3078,    0,    0, 1116,    0, 3068, 3057, 3075,
 
-     3112,    0,    0, 3121, 3101,  366, 3089, 3104,  371, 3101,
-        0, 3090, 3060, 3063, 3053, 3048, 3059, 3052, 3038, 3039,
-     3032, 3038, 3053, 1134, 3062, 1157, 1181, 3059, 1188,  864,
-      165, 1212,  314, 1252, 1275, 1299, 3047, 3036, 1307,  315,
-     3014, 3013, 3012, 3010, 1348,  317, 3008, 3007,  496,  612,
-     1389, 3006, 1413,  321, 2981, 2988, 2979,  871,    0,  352,
-     2978, 1101, 1454, 1477, 2976,    0,    0, 2948, 2964, 2930,
-        0, 2939, 2923, 2928, 2940, 2925, 2940, 2939,  369, 2911,
-      408, 2911, 2916, 2904, 2914,    0, 2904, 2901, 2892, 2896,
-     2892, 2881, 2848,    0,    0, 2852,    0, 2847, 2838, 2850,
+        0, 3064,    0, 3068, 3061,    0,    0, 3071, 3053,  291,
+     3043, 3060,  294, 3054,    0, 3033, 3004, 3018, 3011, 3005,
+     3015, 3008, 2996, 2973, 2966, 2972, 2987, 1153, 3004, 1176,
+     1200, 3002, 1207,  883,  285, 1231,  334, 1271, 1294, 1318,
+     2993, 2977, 1326,  336, 2976, 2975, 2973, 2971, 1367,  363,
+     2970, 2969,  515,  631, 1408, 2968, 1432,  364, 2953, 2960,
+     2948,  890,    0,  371, 2947, 1120, 1473, 1496, 2946,    0,
+        0, 2918, 2920, 2901,    0, 2909, 2890,    0, 2896, 2877,
+     2862, 2877, 2875,  380, 2860,  427, 2860, 2868, 2841, 2851,
+        0, 2841, 2852, 2843, 2847, 2846, 2835, 2819,    0,    0,
 
-     2849, 2843, 2824, 2818, 2816, 2821, 2826, 2824, 1502, 1526,
-      404, 1567, 2847, 2846,  614, 1591, 1615, 1622, 1646, 2822,
-     1653, 1677, 1700, 2821, 2820, 2819, 1723, 1108, 1747, 1770,
-     2818,    0, 1235,    0,  442, 2816, 1242, 1794, 1817, 2815,
-        0,  739,  766, 2822,  466,  786,  817, 1841, 2799, 1865,
-      433, 2798, 2805,  510, 2769, 2774, 2770,    0,    0, 2775,
-     2777, 2748, 2748, 2760, 2743, 2742, 2748, 2740, 2741, 2738,
-     2737,    0, 2728, 2722,    0,    0,    0, 2735, 2730, 2735,
-     2722,    0,    0,    0, 2711,    0,    0,    0, 2700, 1905,
-     2735, 1928, 1952, 2733, 1959,  358, 1983, 2007, 2014, 2038,
+     2823,    0, 2818, 2810, 2823, 2821, 2815, 2811, 2791, 2789,
+     2794, 2799, 2798, 1521, 1545,  423, 1586, 2820, 2819,  633,
+     1610, 1634, 1641, 1665, 2810, 1672, 1696, 1719, 2794, 2793,
+     2792, 1742, 1127, 1766, 1789, 2791,    0, 1254,    0,  461,
+     2790, 1261, 1813, 1836, 2788,    0,  758,  785, 2795,  485,
+      805,  836, 1860, 2786, 1884,  424, 2771, 2778,  405, 2742,
+     2747, 2744,    0,    0, 2748, 2750, 2736, 2721, 2733, 2716,
+     2715, 2722, 2713, 2714, 2725, 2710,    0, 2701, 2695,    0,
+        0,    0, 2708, 2704, 2708, 2695,    0,    0,    0, 2699,
+        0,    0,    0, 2673, 1924, 2708, 1947, 1971, 2706, 1978,
 
-     2724, 2722, 2046,  457, 2721, 2087,  493, 2720, 2705, 2704,
-     2703, 2128,  494, 2702,  879,  899, 2169, 2701, 2193,  523,
-     2699, 2706, 1128, 1130, 2705, 2689, 1251, 1317, 2234, 2680,
-     2258,  524, 2679, 2686, 1331,    0, 1338,    0,  467, 2677,
-     1371, 2299, 2322, 2674,    0, 2345,  354,  390,  534,  535,
-      622,  276,  591, 2645,  241,  551,  433, 1129, 2630, 2629,
-     1247, 2628, 2627, 1343,  854,  503, 2626, 2624, 2383, 2420,
-     2456, 2492,  553, 2516,  650, 2524, 2548, 2651, 2555, 2579,
-     2602, 2650, 2626, 2649, 2634, 2633, 2632, 2672, 1379, 2696,
-     2719, 2631,    0, 1436,    0,  680, 2629, 1443, 2743, 2766,
+      425, 2002, 2026, 2033, 2057, 2697, 2696, 2065,  452, 2693,
+     2106,  476, 2692, 2677, 2676, 2675, 2147,  512, 2674,  898,
+      918, 2188, 2673, 2212,  513, 2671, 2678, 1147, 1149, 2677,
+     2661, 1270, 1336, 2253, 2652, 2277,  517, 2651, 2658, 1350,
+        0, 1357,    0,  486, 2648, 1390, 2318, 2341, 2646,    0,
+     2364,  452,   57,  497,  150,  641,  205,  610, 2602,  258,
+      291,  570, 1148, 2601, 2600, 1266, 2599, 2598, 1362,  873,
+      498, 2596, 2595, 2402, 2439, 2475, 2511,  518, 2535,  551,
+     2543, 2567, 2622, 2574, 2598, 2621, 2606, 2645, 2668, 2605,
+     2604, 2603, 2691, 1398, 2715, 2738, 2601,    0, 1455,    0,
 
-     2627,    0, 1549,    0, 1556,    0,  681, 2611, 1888, 2790,
-     2813, 2610,    0,  555, 1895, 2617, 1451, 1471, 2616, 2615,
-     1502, 1564, 2837, 2605, 2861,  615, 2604, 2611,  617,  688,
-      634,  768, 1251, 1388, 2056, 1453,  808,  834,  898, 2083,
-      766,  923,  810,  833, 2081, 2085, 2903,  835, 2926,  921,
-     2949, 2114, 2973, 2997, 2587, 2586, 3005,  642, 2585, 3046,
-      643, 2584, 3087,  671, 2582, 2581, 2580, 2564, 3128,  742,
-     2563, 1694, 1904, 3169, 2562, 3193,  902, 2561, 2568, 2056,
-     2057, 2566, 2565, 2063, 2123, 3234, 2556, 3258,  930, 2555,
-     2541,  931, 2151, 2540, 2124, 2125, 2539, 2538, 2145, 2166,
+      582, 2600, 1462, 2762, 2785, 2599,    0, 1568,    0, 1575,
+        0,  699, 2583, 1907, 2809, 2832, 2582,    0,  570, 1914,
+     2589, 1470, 1490, 2588, 2587, 1521, 1583, 2856, 2577, 2880,
+      572, 2576, 2583,  590,  652,  615,  636,  787, 1270, 2075,
+     1407,  706,  709,  827, 2102,  707,  829,  631,  785, 2100,
+     2104, 2922,  852, 2945,  853, 2968, 2133, 2992, 3016, 2574,
+     2552, 3024,  660, 2551, 3065,  661, 2550, 3106,  690, 2549,
+     2548, 2546, 2545, 3147,  761, 2544, 1713, 1923, 3188, 2543,
+     3212,  897, 2520, 2527, 2075, 2076, 2526, 2525, 2082, 2142,
+     3253, 2516, 3277,  900, 2514, 2521,  901, 2170, 2520, 2143,
 
-     3299, 2529, 3323,  954, 2527, 2534,    0, 2216,    0, 2223,
-        0,  737, 2525, 2281, 3364, 3387, 2524,    0,  897,  975,
-      976, 1000, 1904, 1001, 1566, 1022, 1046, 2276, 1047, 2105,
-     1048, 3412, 3435, 3459, 1029, 3499, 3523, 3547, 2501, 3554,
-     3578, 3601, 2500, 3625, 3648, 2499, 3672, 3695, 2498, 2497,
-     2495, 3718, 2368, 3742, 3765, 2494,    0, 2406,    0,  969,
-     2493, 2443, 3789, 3812, 2492,    0, 2463,    0, 2470,    0,
-     1016, 2445, 2477, 3836, 3859, 2443,    0,    0, 2484,    0,
-     2884,    0, 1087, 2429, 2891, 3883, 3906, 2428,    0,    0,
-     1077, 3028, 2434, 2231, 2295, 2431, 2397, 2296, 2316, 3930,
+     2144, 2519, 2472, 2164, 2185, 3318, 2463, 3342,  919, 2462,
+     2456,    0, 2235,    0, 2242,    0,  756, 2447, 2300, 3383,
+     3406, 2446,    0,  917,  940,  994,  995, 1923,  996, 1472,
+     1020, 1041, 2295, 1042, 1585,  918, 3431, 3454, 3478,  947,
+     3518, 3542, 3566, 2445, 3573, 3597, 3620, 2394, 3644, 3667,
+     2366, 3691, 3714, 2365, 2364, 2350, 3737, 2387, 3761, 3784,
+     2349,    0, 2425,    0,  956, 2348, 2462, 3808, 3831, 2344,
+        0, 2482,    0, 2489,    0,  988, 2343, 2496, 3855, 3878,
+     2325,    0,    0, 2503,    0, 2903,    0, 1035, 2324, 2910,
+     3902, 3925, 2305,    0,    0,  949, 3047, 2310, 2250, 2314,
 
-     2375, 3954, 1080, 2347, 2354, 2359, 2360, 2361, 2127, 1128,
-     2233, 2298, 1071, 2362, 1203, 1072, 1126, 1150, 3996, 4020,
-     4029, 1204, 2345, 2331, 4047, 1107, 2330, 4088, 1110, 2329,
-     4129, 1157, 2325, 4170, 1158, 2324, 2306, 2305, 4210, 4234,
-     1159, 2286, 2414, 2415, 4275, 2283, 4299, 1182, 2282, 2289,
-     2596, 2643, 2273, 2269, 2899, 2900, 4340, 2259, 4364, 1187,
-     2241, 2248, 1246, 3035, 2247, 2903, 3043, 2244, 2243, 3056,
-     3062, 4405, 2202, 4429, 1248, 2201, 2208,    0, 1249, 3110,
-     2204, 3063, 3084, 2203, 2183, 3104, 3123, 4470, 2174, 4494,
-     1252, 2171, 2167,    0, 3151,    0, 3216,    0, 1166, 2154,
+     2309, 2308, 2315, 2335, 3949, 2284, 3973, 1025, 2280, 2286,
+     2378, 2379, 2380, 2146, 1067, 2252, 2317, 1090, 2381, 1065,
+     1089, 1145, 1147, 4015, 4039, 4048, 1168, 2260, 2259, 4066,
+     1046, 2258, 4107, 1096, 2255, 4148, 1099, 2254, 4189, 1100,
+     2221, 2220, 2219, 4229, 4253, 1129, 2215, 2433, 2434, 4294,
+     2214, 4318, 1152, 2213, 2203, 2615, 2662, 2202, 2201, 2918,
+     2919, 4359, 2190, 4383, 1176, 2178, 2181, 1177, 3054, 2162,
+     2922, 3062, 2132, 2102, 3075, 3081, 4424, 2092, 4448, 1201,
+     2090, 2097,    0, 1204, 3129, 2095, 3082, 3103, 2094, 2093,
+     3123, 3142, 4489, 2083, 4513, 1206, 2073, 2080,    0, 3170,
 
-     3223, 4535, 4558, 2135,    0, 3268, 3269, 3333, 1206, 2399,
-     2363, 1407, 3252, 2275, 1469, 1493, 1347, 4583, 4607, 4616,
-     2105, 4633, 4657, 4680, 2075, 4704, 4727, 2073, 4751, 4774,
-     2070, 4798, 4821, 2068, 2067, 4845, 1276, 2066, 2064, 3286,
-     4886, 2054, 2051,    0, 3350,    0, 1535, 2023, 3482, 4910,
-     2021, 2020,    0, 3489,    0, 3977,    0, 1576, 2019, 3984,
-     4934, 2017, 2016,    0,    0, 4036,    0, 4070,    0, 1599,
-     2015, 4077, 4958, 1991, 1989,    0,    0, 4111,    0, 4118,
-        0, 1630, 1986, 4152, 4982, 1985, 1911,    0,    0, 1386,
-     4159, 1876, 3125, 3145, 1857, 1832, 3164, 3166, 5006, 1819,
+        0, 3235,    0, 1239, 2070, 3242, 4554, 4577, 2042,    0,
+     3287, 3288, 3352, 1169, 2418, 2124, 1286, 2419, 2294, 1426,
+     1512, 1223, 4602, 4626, 4635, 2041, 4652, 4676, 4699, 2040,
+     4723, 4746, 2039, 4770, 4793, 2038, 4817, 4840, 2036, 2035,
+     4864, 1265, 2034, 2033, 3305, 4905, 2010, 2009,    0, 3369,
+        0, 1335, 2008, 3501, 4929, 2007, 2005,    0, 3508,    0,
+     3996,    0, 1505, 2004, 4003, 4953, 2003, 1987,    0,    0,
+     4055,    0, 4089,    0, 1554, 1985, 4096, 4977, 1983, 1981,
+        0,    0, 4130,    0, 4137,    0, 1595, 1980, 4171, 5001,
+     1979, 1954,    0,    0, 1268, 4178, 1938, 3144, 3164, 1895,
 
-     5030, 1389, 1803, 1807, 1495, 1669, 1670, 1520, 1671, 1741,
-     4168, 1692, 1716, 2401, 5072, 1776, 5089, 5113, 1390, 1775,
-     5154, 1453, 1753, 5195, 1561, 1752, 5236, 1566, 1730, 5277,
-     1568, 1729, 1728, 4196, 5318, 1724, 1709,    0, 1708, 3231,
-     3294, 5342, 1705, 1631, 1633, 3333, 3360, 1632, 1602, 3381,
-     3412, 5366, 1573, 1569, 1541, 1591, 4257, 1534, 3498, 3595,
-     1518, 1517, 3642, 3689, 5390, 1505, 1480, 1469,    0, 1621,
-     4264, 1464, 4180, 4181, 1463, 1423, 4205, 4209, 5414, 1394,
-     1391, 1398,    0, 1622, 4322, 1363, 4272, 4316, 1361, 1359,
-     4335, 4337, 5438, 1350, 1316, 1323,    0, 4387,    0, 4394,
+     1852, 3183, 3185, 5025, 1843, 5049, 1297, 1842, 1827, 1688,
+     1689, 1711, 1539, 1225, 1760, 4187, 1538, 1366, 2420, 5091,
+     1794, 5108, 5132, 1405, 1775, 5173, 1408, 1772, 5214, 1409,
+     1771, 5255, 1469, 1748, 5296, 1472, 1747, 1728, 4215, 5337,
+     1727, 1726,    0, 1724, 3250, 3288, 5361, 1650, 1644, 1651,
+     3313, 3352, 1618, 1601, 3379, 3400, 5385, 1588, 1545, 1536,
+     1580, 4276, 1532, 3431, 3517, 1531, 1507, 3614, 3661, 5409,
+     1480, 1479, 1482,    0, 1585, 4283, 1442, 3708, 4199, 1421,
+     1418, 4200, 4224, 5433, 1409, 1374, 1380,    0, 1586, 4341,
+     1378, 4228, 4291, 1377, 1342, 4335, 4354, 5457, 1333, 1331,
 
-        0, 1756, 1314, 4452, 5462,    0, 1312,    0, 1740, 1763,
-     1764, 1786, 1787, 1974, 4488, 4504, 5486, 1623,    0, 1310,
-     5527,    0, 1276, 5551,    0, 1259, 5575,    0, 1253, 5599,
-        0, 1221, 5623,    0, 1217, 4402, 4446, 5647, 1196, 1114,
-     1108,   88,  138, 4460,    0, 1826,  214,  229, 4521,    0,
-     4623,    0, 1850,  322,  345,    0, 4868,    0, 4875,    0,
-     1874,  416,  460,    0, 5053,    0, 5060,    0, 1914,  501,
-      508,    0, 5079,    0, 5136,    0, 1937,  524,  580,    0,
-     1650, 5143,  589, 4531, 4552,  610,  611, 4632, 4674, 5671,
-      605,    0,  632, 2418, 1788, 1811, 1834, 5695,  627,  696,
+     1309,    0, 4406,    0, 4413,    0, 1619, 1278, 4471, 5481,
+        0, 1273,    0, 1690, 1734, 1758, 1759, 1782, 1993, 4507,
+     4523, 5505, 1610,    0, 1272, 5546,    0, 1240, 5570,    0,
+     1215, 5594,    0, 1213, 5618,    0, 1185, 5642,    0,   75,
+     4356, 4421, 5666,  102,  137,  143,  203,  198, 4478,    0,
+     1649,  217,  250, 4540,    0, 4642,    0, 1822,  306,  317,
+        0, 4887,    0, 4894,    0, 1845,  341,  348,    0, 5072,
+        0, 5079,    0, 1869,  372,  412,    0, 5098,    0, 5155,
+        0, 1893,  414,  431,    0, 1640, 5162,  443, 4486, 4550,
+      470,  556, 4571, 4651, 5690,  551,    0,  583, 2382, 1783,
 
-        0,    0,    0,    0,    0,    0, 5177,    0, 1967,  698,
-      699,    0, 4721, 4768,  709,  710,    0, 1652, 5184,  713,
-     4815, 4883,  741,  744,    0,    0, 1653, 5218,  778, 5088,
-     5192,  801,  803,    0,    0, 1816, 5259,  805, 5212, 5231,
-      808,  828,    0,    0, 1838, 5300,  849, 5233, 5253,  856,
-      858,    0,    0, 5307,    0, 5509,    0, 1968,  883,    0,
-     3083, 2964, 2161, 1921,    0, 7401,    0,    0,    0,    0,
-        0,    0, 5315, 5503,  892,  895,    0, 7401, 5517,    0,
-     7401,    0, 5718,    0, 7401,    0, 5725,    0, 7401,    0,
-     5732,    0, 7401,    0, 5739,    0, 7401,    0, 1840, 5746,
+     1806, 1829, 5714,  600,  621,    0,    0,    0,    0,    0,
+        0, 5196,    0, 1933,  644,  646,    0, 4693, 4740,  702,
+      731,    0, 1641, 5203,  732, 4787, 4834,  760,  763,    0,
+        0, 1642, 5237,  797, 4902, 5107,  803,  820,    0,    0,
+     1669, 5244,  822, 5252, 5265,  824,  827,    0,    0, 1671,
+     5279,  868, 5293, 5306,  871,  873,    0,    0, 5320,    0,
+     5528,    0, 1956,  867,    0, 3102, 2983, 2180, 1807,    0,
+     7420,    0,    0,    0,    0,    0,    0, 5334, 5522,  877,
+      910,    0, 7420, 5536,    0, 7420,    0, 5737,    0, 7420,
+        0, 5744,    0, 7420,    0, 5751,    0, 7420,    0, 5758,
 
-      898, 5754, 5755,  937, 2022,    0, 1975, 3341, 2062,    0,
-     5755,    0, 1841, 5769,  946,    0, 1899, 5776,  973,    0,
-     1901, 5783,  976,    0, 1902, 5795,  996,    0, 1929, 5802,
-     1020,    0, 5809,    0, 7401, 2185, 1956, 5816, 1040,    0,
-        0,    0,    0,    0,    0, 1958, 5823, 1041,    0,    0,
-        0,    0,    0,    0,    0,    0,    0, 7401, 5841, 5849,
-     5853, 5856, 5859, 5862, 5865, 5868, 5871, 5874, 5877, 5880,
-     5883, 5886, 5889, 5892, 5895, 5898, 5901, 5905, 5909, 5912,
-     5915, 5918, 5921, 5924, 5927, 5930, 5933, 5937, 5941, 5944,
-     5947, 5951, 5953, 5956, 5959, 5962, 5965, 5968, 5971, 5974,
+        0, 7420,    0, 1672, 5765,  965, 5773, 5774,  990, 1986,
+        0, 1830, 3360, 1877,    0, 5774,    0, 1835, 5788,  992,
+        0, 1857, 5795, 1015,    0, 1859, 5802, 1036,    0, 1860,
+     5814, 1083,    0, 1918, 5821, 1108,    0, 5828,    0, 7420,
+     1940, 1920, 5835, 1135,    0,    0,    0,    0,    0,    0,
+     1921, 5842, 1141,    0,    0,    0,    0,    0,    0,    0,
+        0,    0, 7420, 5860, 5868, 5872, 5875, 5878, 5881, 5884,
+     5887, 5890, 5893, 5896, 5899, 5902, 5905, 5908, 5911, 5914,
+     5917, 5920, 5924, 5928, 5931, 5934, 5937, 5940, 5943, 5946,
+     5949, 5952, 5956, 5960, 5963, 5966, 5970, 5972, 5975, 5978,
 
-     5977, 5981, 5983, 5986, 5990, 5995, 5999, 6002, 6006, 6009,
-     6012, 6015, 6018, 6021, 6024, 6027, 6031, 6035, 6038, 6042,
-     6046, 6051, 6055, 6057, 6061, 6064, 6068, 6071, 6074, 6078,
-     6080, 6083, 6086, 6089, 6092, 6095, 6098, 6101, 6104, 6107,
-     6111, 6113, 6116, 6119, 6122, 6126, 6128, 6131, 6134, 6139,
-     6143, 6148, 6152, 6154, 6158, 6161, 6165, 6170, 6174, 6177,
-     6180, 6183, 6186, 6189, 6192, 6195, 6199, 6203, 6206, 6210,
-     6214, 6219, 6223, 6225, 6229, 6232, 6236, 6239, 6244, 6248,
-     6253, 6257, 6259, 6263, 6266, 6270, 6273, 6276, 6279, 6283,
-     6285, 6288, 6293, 6297, 6300, 6303, 6306, 6309, 6312, 6315,
+     5981, 5984, 5987, 5990, 5993, 5996, 6000, 6002, 6005, 6009,
+     6014, 6018, 6021, 6025, 6028, 6031, 6034, 6037, 6040, 6043,
+     6046, 6050, 6054, 6057, 6061, 6065, 6070, 6074, 6076, 6080,
+     6083, 6087, 6090, 6093, 6097, 6099, 6102, 6105, 6108, 6111,
+     6114, 6117, 6120, 6123, 6126, 6130, 6132, 6135, 6138, 6141,
+     6145, 6147, 6150, 6153, 6158, 6162, 6167, 6171, 6173, 6177,
+     6180, 6184, 6189, 6193, 6196, 6199, 6202, 6205, 6208, 6211,
+     6214, 6218, 6222, 6225, 6229, 6233, 6238, 6242, 6244, 6248,
+     6251, 6255, 6258, 6263, 6267, 6272, 6276, 6278, 6282, 6285,
+     6289, 6292, 6295, 6298, 6302, 6304, 6307, 6312, 6316, 6319,
 
-     6318, 6321, 6325, 6327, 6330, 6333, 6336, 6340, 6342, 6345,
-     6348, 6351, 6354, 6358, 6360, 6363, 6366, 6369, 6374, 6378,
-     6383, 6387, 6389, 6393, 6396, 6400, 6405, 6409, 6412, 6415,
-     6418, 6421, 6424, 6427, 6430, 6434, 6438, 6441, 6445, 6449,
-     6454, 6458, 6460, 6464, 6467, 6471, 6474, 6479, 6483, 6488,
-     6492, 6494, 6498, 6501, 6505, 6508, 6511, 6516, 6520, 6525,
-     6529, 6531, 6535, 6538, 6542, 6545, 6548, 6551, 6555, 6557,
-     6560, 6565, 6569, 6572, 6575, 6578, 6581, 6584, 6587, 6590,
-     6593, 6596, 6599, 6602, 6606, 6608, 6611, 6614, 6617, 6620,
-     6624, 6626, 6629, 6632, 6635, 6638, 6641, 6645, 6647, 6650,
+     6322, 6325, 6328, 6331, 6334, 6337, 6340, 6344, 6346, 6349,
+     6352, 6355, 6359, 6361, 6364, 6367, 6370, 6373, 6377, 6379,
+     6382, 6385, 6388, 6393, 6397, 6402, 6406, 6408, 6412, 6415,
+     6419, 6424, 6428, 6431, 6434, 6437, 6440, 6443, 6446, 6449,
+     6453, 6457, 6460, 6464, 6468, 6473, 6477, 6479, 6483, 6486,
+     6490, 6493, 6498, 6502, 6507, 6511, 6513, 6517, 6520, 6524,
+     6527, 6530, 6535, 6539, 6544, 6548, 6550, 6554, 6557, 6561,
+     6564, 6567, 6570, 6574, 6576, 6579, 6584, 6588, 6591, 6594,
+     6597, 6600, 6603, 6606, 6609, 6612, 6615, 6618, 6621, 6625,
+     6627, 6630, 6633, 6636, 6639, 6643, 6645, 6648, 6651, 6654,
 
-     6653, 6656, 6659, 6662, 6666, 6668, 6671, 6674, 6677, 6680,
-     6685, 6689, 6694, 6698, 6700, 6704, 6707, 6711, 6716, 6720,
-     6723, 6726, 6729, 6732, 6735, 6738, 6741, 6744, 6747, 6751,
-     6755, 6758, 6762, 6766, 6771, 6775, 6777, 6781, 6784, 6788,
-     6791, 6796, 6800, 6805, 6809, 6811, 6815, 6818, 6822, 6825,
-     6828, 6833, 6837, 6842, 6846, 6848, 6852, 6855, 6859, 6862,
-     6865, 6870, 6874, 6879, 6883, 6885, 6889, 6892, 6896, 6899,
-     6902, 6905, 6909, 6911, 6914, 6917, 6922, 6926, 6929, 6932,
-     6935, 6938, 6941, 6944, 6947, 6950, 6953, 6956, 6959, 6963,
-     6967, 6970, 6973, 6977, 6980, 6983, 6987, 6989, 6992, 6995,
+     6657, 6660, 6664, 6666, 6669, 6672, 6675, 6678, 6681, 6685,
+     6687, 6690, 6693, 6696, 6699, 6704, 6708, 6713, 6717, 6719,
+     6723, 6726, 6730, 6735, 6739, 6742, 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, 6889, 6893, 6898, 6902,
+     6904, 6908, 6911, 6915, 6918, 6921, 6924, 6928, 6930, 6933,
+     6936, 6941, 6945, 6948, 6951, 6954, 6957, 6960, 6963, 6966,
+     6969, 6972, 6975, 6978, 6982, 6986, 6989, 6992, 6996, 6999,
 
-     6999, 7001, 7004, 7007, 7010, 7014, 7016, 7019, 7022, 7025,
-     7029, 7031, 7034, 7037, 7040, 7044, 7046, 7049, 7052, 7057,
-     7061, 7066, 7070, 7072, 7076, 7079, 7083, 7088, 7092, 7095,
-     7098, 7101, 7104, 7107, 7110, 7113, 7116, 7120, 7122, 7125,
-     7129, 7134, 7138, 7139, 7142, 7147, 7151, 7156, 7160, 7161,
-     7164, 7167, 7172, 7176, 7181, 7185, 7186, 7189, 7192, 7197,
-     7201, 7206, 7210, 7211, 7214, 7217, 7222, 7226, 7231, 7235,
-     7236, 7239, 7242, 7245, 7249, 7251, 7256, 7260, 7263, 7266,
-     7269, 7272, 7275, 7278, 7282, 7287, 7291, 7292, 7295, 7298,
-     7301, 7304, 7307, 7310, 7313, 7316, 7319, 7322, 7327, 7331,
+     7002, 7006, 7008, 7011, 7014, 7018, 7020, 7023, 7026, 7029,
+     7033, 7035, 7038, 7041, 7044, 7048, 7050, 7053, 7056, 7059,
+     7063, 7065, 7068, 7071, 7076, 7080, 7085, 7089, 7091, 7095,
+     7098, 7102, 7107, 7111, 7114, 7117, 7120, 7123, 7126, 7129,
+     7132, 7135, 7139, 7141, 7144, 7148, 7153, 7157, 7158, 7161,
+     7166, 7170, 7175, 7179, 7180, 7183, 7186, 7191, 7195, 7200,
+     7204, 7205, 7208, 7211, 7216, 7220, 7225, 7229, 7230, 7233,
+     7236, 7241, 7245, 7250, 7254, 7255, 7258, 7261, 7264, 7268,
+     7270, 7275, 7279, 7282, 7285, 7288, 7291, 7294, 7297, 7301,
+     7306, 7310, 7311, 7314, 7317, 7320, 7323, 7326, 7329, 7332,
 
-     7334, 7337, 7340, 7344, 7348, 7352, 7356, 7360, 7363, 7366,
-     7370, 7373, 7376, 7379, 7382, 7385, 7389, 7392
+     7335, 7338, 7341, 7346, 7350, 7353, 7356, 7359, 7363, 7367,
+     7371, 7375, 7379, 7382, 7385, 7389, 7392, 7395, 7398, 7401,
+     7404, 7408, 7411
     } ;
 
-static yyconst flex_int16_t yy_def[1919] =
+static yyconst flex_int16_t yy_def[1924] =
     {   0,
-     1458,    1, 1458, 1458, 1458, 1458, 1458, 1458, 1459, 1458,
-     1458, 1458, 1458, 1458,   14, 1458, 1458, 1458, 1458,   14,
-       20, 1460,   20,   20,   20,   20,   20,   20,   21,   21,
+     1463,    1, 1463, 1463, 1463, 1463, 1463, 1463, 1464, 1463,
+     1463, 1463, 1463, 1463,   14, 1463, 1463, 1463, 1463,   14,
+       20, 1465,   20,   20,   20,   20,   20,   20,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-       21,   21, 1458, 1458, 1458, 1461, 1458,   21,   21,   20,
-     1462,   50,   21,   21,   21, 1458, 1458, 1458, 1458, 1458,
-     1458,   49, 1460, 1460,   52,   52,   52,   21,   21,   21,
+       21,   21, 1463, 1463, 1463, 1466, 1463,   21,   21,   20,
+     1467,   50,   21,   21,   21, 1463, 1463, 1463, 1463, 1463,
+     1463,   49, 1465, 1465,   52,   52,   52,   21,   21,   21,
        21,   52,   21,   21,   52,   21,   21,   21,   52,   21,
        21,   21,   21,   21,   52,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
@@ -835,11 +841,11 @@
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-       21,   21,   21,   21,   21,   21,   21,   21,   21, 1458,
-     1458,   21,   21,  153,   21,   21,  156, 1463, 1458,   54,
-     1458,  161, 1464,   21,   21,  157,   21,   21,   21,  157,
-       21,   21,   21,   21,   21,   21,  157,   21,   21,   21,
-       21,   21,   21,   21,  157,   21,   21,   21,   21,   21,
+       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
+     1463, 1463,   21,   21,  154,   21,   21,  157, 1468, 1463,
+       54, 1463,  162, 1469,   21,   21,  158,   21,   21,   21,
+      158,   21,   21,   21,   21,   21,   21,  158,   21,   21,
+       21,   21,   21,   21,   21,  158,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
 
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
@@ -848,1837 +854,1842 @@
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-       21,   21,   21,  260,  261,  157, 1465,  266, 1466, 1467,
-     1458,  271, 1468, 1469, 1458, 1458, 1458, 1470, 1471,   21,
-       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
+       21,   21,   21,   21,   21,  262,  263,  158, 1470,  268,
+     1471, 1472, 1463,  273, 1473, 1474, 1463, 1463, 1463, 1475,
+     1476,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
 
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-       21,   21,   21,   21,   21,   21,   21,  347,   21,  261,
-      263,  261,  263,  263,  354, 1472, 1458,  353, 1473, 1474,
-     1458, 1458, 1458, 1458, 1475, 1476, 1477, 1478, 1478, 1458,
-     1479, 1458,  372, 1480, 1471,   21,   21,   21,   21,   21,
+       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
+      350,   21,  263,  265,  263,  265,  265,  357, 1477, 1463,
+      356, 1478, 1479, 1463, 1463, 1463, 1463, 1480, 1481, 1482,
+     1483, 1483, 1463, 1484, 1463,  375, 1485, 1476,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
 
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-       21,   21,   21,   21,   21,   21,   21,   21,   21,  426,
-      427,  427,  432,  426,  354,  435, 1481, 1482, 1458,  439,
-     1483, 1458, 1484, 1485, 1458,  445, 1486, 1487, 1488, 1488,
-     1458, 1489, 1458,  453, 1490, 1476, 1458, 1458, 1491, 1492,
-     1458, 1458, 1458, 1458, 1493, 1494,   21,   21,   21,   21,
+       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
+       21,   21,   21,  430,  431,  431,  436,  430,  357,  439,
+     1486, 1487, 1463,  443, 1488, 1463, 1489, 1490, 1463,  449,
+     1491, 1492, 1493, 1493, 1463, 1494, 1463,  457, 1495, 1481,
+     1463, 1463, 1496, 1497, 1463, 1463, 1463, 1463, 1498, 1499,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
 
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-      510,   21,  427,  429,  427,  427,  516,  435,  518, 1495,
-     1458, 1458, 1458, 1496, 1497, 1498, 1458, 1458, 1458, 1458,
-     1499, 1500, 1458, 1501, 1502, 1458, 1458, 1458, 1458, 1503,
-     1504, 1505, 1505, 1491, 1492, 1506, 1506, 1458, 1507, 1458,
-      550, 1508, 1509,   21,   21,   21,   21,   21,   21,   21,
+       21,   21,   21,   21,   21,  515,   21,  431,  433,  431,
+      431,  521,  439,  523, 1500, 1463, 1463, 1463, 1501, 1502,
+     1503, 1463, 1463, 1463, 1463, 1504, 1505, 1463, 1506, 1507,
+     1463, 1463, 1463, 1463, 1508, 1509, 1510, 1510, 1496, 1497,
+     1511, 1511, 1463, 1512, 1463,  555, 1513, 1514,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
        21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-       21,   21,   21,   21,   21,  593,  593,  597,  518,  599,
+       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
 
-     1510, 1511, 1458,  603, 1512, 1458,  606, 1513, 1458, 1514,
-     1515, 1458,  612, 1516, 1517, 1517, 1458, 1518, 1458,  619,
-     1519, 1520, 1521, 1521, 1522, 1523, 1524, 1524, 1458, 1525,
-     1458,  631, 1526, 1527, 1458, 1528, 1458, 1529, 1530, 1458,
-     1458, 1458, 1458, 1531, 1532,  600,  646,  646,  646,  646,
-      646,  646,  646,  646,  646,  646,  646,  646,  646,  646,
-      646,  646,  646,  646,  646,  646,  646,  646,  646,  646,
-      646,  671,  671,  671,  646,  671,  676, 1533, 1458, 1458,
-     1458, 1534, 1458, 1458, 1535, 1536, 1537, 1458, 1458, 1458,
-     1458, 1538, 1539, 1458, 1540, 1541, 1458, 1458, 1458, 1458,
+      598,  598,  602,  523,  604, 1515, 1516, 1463,  608, 1517,
+     1463,  611, 1518, 1463, 1519, 1520, 1463,  617, 1521, 1522,
+     1522, 1463, 1523, 1463,  624, 1524, 1525, 1526, 1526, 1527,
+     1528, 1529, 1529, 1463, 1530, 1463,  636, 1531, 1532, 1463,
+     1533, 1463, 1534, 1535, 1463, 1463, 1463, 1463, 1536, 1537,
+      605,  651,  651,  651,  651,  651,  651,  651,  651,  651,
+      651,  651,  651,  651,  651,  651,  651,  651,  651,  651,
+      651,  651,  651,  651,  651,  651,  676,  676,  676,  651,
+      676,  681, 1538, 1463, 1463, 1463, 1539, 1463, 1463, 1540,
+     1541, 1542, 1463, 1463, 1463, 1463, 1543, 1544, 1463, 1545,
 
-     1542, 1543, 1458, 1544, 1458, 1545, 1546, 1458, 1458, 1458,
-     1458, 1547, 1548, 1549, 1458, 1550, 1551, 1551, 1552, 1553,
-     1554, 1554, 1458, 1555, 1458,  725, 1556, 1557, 1558, 1558,
-     1558, 1558, 1558, 1558, 1558, 1558, 1558, 1558, 1558, 1558,
-     1558, 1558, 1558, 1558, 1558, 1558, 1558, 1558,  747, 1558,
-      747,  751,  751,  753, 1559, 1560, 1458,  757, 1561, 1458,
-      760, 1562, 1458,  763, 1563, 1458, 1564, 1565, 1458,  769,
-     1566, 1567, 1567, 1458, 1568, 1458,  776, 1569, 1570, 1571,
-     1571, 1572, 1573, 1574, 1574, 1458, 1575, 1458,  788, 1576,
-     1577, 1578, 1458, 1579, 1580, 1580, 1581, 1582, 1583, 1583,
+     1546, 1463, 1463, 1463, 1463, 1547, 1548, 1463, 1549, 1463,
+     1550, 1551, 1463, 1463, 1463, 1463, 1552, 1553, 1554, 1463,
+     1555, 1556, 1556, 1557, 1558, 1559, 1559, 1463, 1560, 1463,
+      730, 1561, 1562, 1563, 1563, 1563, 1563, 1563, 1563, 1563,
+     1563, 1563, 1563, 1563, 1563, 1563, 1563, 1563, 1563, 1563,
+     1563, 1563, 1563,  752, 1563,  752,  756,  756,  758, 1564,
+     1565, 1463,  762, 1566, 1463,  765, 1567, 1463,  768, 1568,
+     1463, 1569, 1570, 1463,  774, 1571, 1572, 1572, 1463, 1573,
+     1463,  781, 1574, 1575, 1576, 1576, 1577, 1578, 1579, 1579,
+     1463, 1580, 1463,  793, 1581, 1582, 1583, 1463, 1584, 1585,
 
-     1458, 1584, 1458,  803, 1585, 1586, 1587, 1458, 1588, 1458,
-     1589, 1590, 1458, 1458, 1458, 1458, 1591, 1592, 1593, 1593,
-     1593, 1593, 1593, 1593, 1593, 1593, 1593, 1593, 1593, 1593,
-     1593, 1593,  832,  832,  834,  832,  832,  837, 1594, 1458,
-     1458, 1458, 1595, 1458, 1458, 1596, 1458, 1458, 1597, 1598,
-     1599, 1458, 1458, 1458, 1458, 1600, 1601, 1458, 1602, 1603,
-     1458, 1458, 1458, 1458, 1604, 1605, 1458, 1606, 1458, 1607,
-     1608, 1458, 1458, 1458, 1458, 1609, 1610, 1611, 1458, 1612,
-     1458, 1613, 1614, 1458, 1458, 1458, 1458, 1615, 1616, 1617,
-     1618, 1458, 1619, 1620, 1620, 1621, 1622, 1623, 1623, 1458,
+     1585, 1586, 1587, 1588, 1588, 1463, 1589, 1463,  808, 1590,
+     1591, 1592, 1463, 1593, 1463, 1594, 1595, 1463, 1463, 1463,
+     1463, 1596, 1597, 1598, 1598, 1598, 1598, 1598, 1598, 1598,
+     1598, 1598, 1598, 1598, 1598, 1598, 1598,  837,  837,  839,
+      837,  837,  842, 1599, 1463, 1463, 1463, 1600, 1463, 1463,
+     1601, 1463, 1463, 1602, 1603, 1604, 1463, 1463, 1463, 1463,
+     1605, 1606, 1463, 1607, 1608, 1463, 1463, 1463, 1463, 1609,
+     1610, 1463, 1611, 1463, 1612, 1613, 1463, 1463, 1463, 1463,
+     1614, 1615, 1616, 1463, 1617, 1463, 1618, 1619, 1463, 1463,
+     1463, 1463, 1620, 1621, 1622, 1623, 1463, 1624, 1625, 1625,
 
-     1624, 1458,  902, 1625, 1626, 1627, 1627, 1627, 1627, 1627,
-     1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,  919,
-     1627, 1627, 1628, 1629, 1458,  925, 1630, 1458,  928, 1631,
-     1458,  931, 1632, 1458,  934, 1633, 1458, 1634, 1458, 1458,
-      940, 1635, 1636, 1636, 1458, 1637, 1458,  947, 1638, 1639,
-     1640, 1640, 1641, 1642, 1643, 1643, 1458, 1644, 1458,  959,
-     1645, 1646, 1647, 1458, 1648, 1649, 1649, 1650, 1651, 1652,
-     1652, 1458, 1653, 1458,  974, 1654, 1655, 1656, 1657, 1458,
-     1658, 1659, 1659, 1660, 1661, 1662, 1662, 1458, 1663, 1458,
-      990, 1664, 1665, 1666, 1458, 1667, 1458, 1668, 1669, 1458,
+     1626, 1627, 1628, 1628, 1463, 1629, 1463,  907, 1630, 1631,
+     1632, 1632, 1632, 1632, 1632, 1632, 1632, 1632, 1632, 1632,
+     1632, 1632, 1632, 1632,  924, 1632, 1632, 1633, 1634, 1463,
+      930, 1635, 1463,  933, 1636, 1463,  936, 1637, 1463,  939,
+     1638, 1463, 1639, 1463, 1463,  945, 1640, 1641, 1641, 1463,
+     1642, 1463,  952, 1643, 1644, 1645, 1645, 1646, 1647, 1648,
+     1648, 1463, 1649, 1463,  964, 1650, 1651, 1652, 1463, 1653,
+     1654, 1654, 1655, 1656, 1657, 1657, 1463, 1658, 1463,  979,
+     1659, 1660, 1661, 1662, 1463, 1663, 1664, 1664, 1665, 1666,
+     1667, 1667, 1463, 1668, 1463,  995, 1669, 1670, 1671, 1463,
 
-     1458, 1458, 1458, 1670, 1671, 1672, 1672, 1672, 1672, 1672,
-     1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1018, 1672,
-     1673, 1458, 1458, 1458, 1674, 1458, 1458, 1675, 1458, 1458,
-     1676, 1458, 1458, 1677, 1678, 1458, 1036, 1679, 1680, 1458,
-     1458, 1681, 1682, 1683, 1458, 1684, 1685, 1458, 1458, 1458,
-     1686, 1687, 1688, 1458, 1689, 1458, 1690, 1691, 1458, 1458,
-     1458, 1692, 1693, 1694, 1695, 1458, 1696, 1458, 1697, 1698,
-     1458, 1458, 1458, 1699, 1700, 1701, 1702, 1458, 1703, 1458,
-     1704, 1705, 1458, 1458, 1458, 1706, 1707, 1708, 1709, 1710,
-     1458, 1711, 1712, 1712, 1713, 1714, 1715, 1715, 1458, 1716,
+     1672, 1463, 1673, 1674, 1463, 1463, 1463, 1463, 1675, 1676,
+     1677, 1677, 1677, 1677, 1677, 1677, 1677, 1677, 1677, 1677,
+     1677, 1677, 1677, 1023, 1677, 1678, 1463, 1463, 1463, 1679,
+     1463, 1463, 1680, 1463, 1463, 1681, 1463, 1463, 1682, 1683,
+     1463, 1041, 1684, 1685, 1463, 1463, 1686, 1687, 1688, 1463,
+     1689, 1690, 1463, 1463, 1463, 1691, 1692, 1693, 1463, 1694,
+     1463, 1695, 1696, 1463, 1463, 1463, 1697, 1698, 1699, 1700,
+     1463, 1701, 1463, 1702, 1703, 1463, 1463, 1463, 1704, 1705,
+     1706, 1707, 1463, 1708, 1463, 1709, 1710, 1463, 1463, 1463,
+     1711, 1712, 1713, 1714, 1715, 1463, 1716, 1717, 1717, 1718,
 
-     1458, 1101, 1717, 1718, 1719, 1719, 1719, 1719, 1719, 1719,
-     1719, 1719, 1719, 1719, 1719, 1720, 1458, 1458, 1118, 1721,
-     1458, 1121, 1722, 1458, 1124, 1723, 1458, 1127, 1724, 1458,
-     1130, 1725, 1458, 1458, 1458, 1726, 1727, 1728, 1729, 1730,
-     1730, 1458, 1731, 1732, 1733, 1734, 1734, 1735, 1736, 1737,
-     1737, 1458, 1738, 1739, 1740, 1741, 1458, 1742, 1743, 1743,
-     1744, 1745, 1746, 1746, 1458, 1747, 1748, 1749, 1750, 1751,
-     1458, 1752, 1753, 1753, 1754, 1755, 1756, 1756, 1458, 1757,
-     1758, 1759, 1760, 1761, 1458, 1762, 1763, 1763, 1764, 1765,
-     1766, 1766, 1458, 1767, 1768, 1769, 1770, 1458, 1771, 1458,
+     1719, 1720, 1720, 1463, 1721, 1463, 1106, 1722, 1723, 1724,
+     1724, 1724, 1724, 1724, 1724, 1724, 1724, 1724, 1724, 1724,
+     1725, 1463, 1463, 1123, 1726, 1463, 1126, 1727, 1463, 1129,
+     1728, 1463, 1132, 1729, 1463, 1135, 1730, 1463, 1463, 1463,
+     1731, 1732, 1733, 1734, 1735, 1735, 1463, 1736, 1737, 1738,
+     1739, 1739, 1740, 1741, 1742, 1742, 1463, 1743, 1744, 1745,
+     1746, 1463, 1747, 1748, 1748, 1749, 1750, 1751, 1751, 1463,
+     1752, 1753, 1754, 1755, 1756, 1463, 1757, 1758, 1758, 1759,
+     1760, 1761, 1761, 1463, 1762, 1763, 1764, 1765, 1766, 1463,
+     1767, 1768, 1768, 1769, 1770, 1771, 1771, 1463, 1772, 1773,
 
-     1772, 1773, 1458, 1458, 1458, 1774, 1775, 1776, 1777, 1777,
-     1777, 1777, 1777, 1777, 1777, 1777, 1458, 1217, 1778, 1779,
-     1458, 1780, 1781, 1458, 1782, 1783, 1458, 1784, 1785, 1458,
-     1786, 1787, 1458, 1788, 1789, 1790, 1790, 1458, 1791, 1792,
-     1793, 1794, 1795, 1458, 1796, 1797, 1458, 1798, 1458, 1799,
-     1458, 1800, 1801, 1458, 1802, 1803, 1458, 1804, 1458, 1805,
-     1806, 1458, 1807, 1808, 1458, 1809, 1458, 1810, 1811, 1458,
-     1812, 1813, 1458, 1814, 1458, 1815, 1816, 1458, 1817, 1818,
-     1819, 1458, 1820, 1821, 1821, 1822, 1823, 1824, 1824, 1458,
-     1825, 1826, 1827, 1828, 1828, 1828, 1828, 1458, 1829, 1830,
+     1774, 1775, 1463, 1776, 1463, 1777, 1778, 1463, 1463, 1463,
+     1779, 1780, 1781, 1782, 1782, 1782, 1782, 1782, 1782, 1782,
+     1782, 1463, 1222, 1783, 1784, 1463, 1785, 1786, 1463, 1787,
+     1788, 1463, 1789, 1790, 1463, 1791, 1792, 1463, 1793, 1794,
+     1795, 1795, 1463, 1796, 1797, 1798, 1799, 1800, 1463, 1801,
+     1802, 1463, 1803, 1463, 1804, 1463, 1805, 1806, 1463, 1807,
+     1808, 1463, 1809, 1463, 1810, 1811, 1463, 1812, 1813, 1463,
+     1814, 1463, 1815, 1816, 1463, 1817, 1818, 1463, 1819, 1463,
+     1820, 1821, 1463, 1822, 1823, 1824, 1463, 1825, 1826, 1826,
+     1827, 1828, 1829, 1829, 1463, 1830, 1831, 1832, 1833, 1833,
 
-     1831, 1832, 1833, 1834, 1835, 1836, 1458, 1837, 1838, 1458,
-     1839, 1840, 1841, 1841, 1842, 1843, 1844, 1845, 1458, 1846,
-     1847, 1847, 1848, 1849, 1850, 1851, 1852, 1458, 1853, 1854,
-     1854, 1855, 1856, 1857, 1858, 1859, 1458, 1860, 1861, 1861,
-     1862, 1863, 1864, 1865, 1866, 1458, 1867, 1868, 1868, 1869,
-     1870, 1871, 1872, 1458, 1873, 1458, 1874, 1875, 1458, 1876,
-     1877, 1877, 1877, 1877, 1878, 1458, 1879, 1880, 1881, 1882,
-     1883, 1884, 1885, 1885, 1886, 1887, 1888, 1458, 1458, 1889,
-     1458, 1890, 1458, 1891, 1458, 1892, 1458, 1893, 1458, 1894,
-     1458, 1895, 1458, 1896, 1458, 1897, 1458, 1872, 1898, 1458,
+     1833, 1833, 1463, 1834, 1835, 1836, 1837, 1838, 1839, 1840,
+     1841, 1463, 1842, 1843, 1463, 1844, 1845, 1846, 1846, 1847,
+     1848, 1849, 1850, 1463, 1851, 1852, 1852, 1853, 1854, 1855,
+     1856, 1857, 1463, 1858, 1859, 1859, 1860, 1861, 1862, 1863,
+     1864, 1463, 1865, 1866, 1866, 1867, 1868, 1869, 1870, 1871,
+     1463, 1872, 1873, 1873, 1874, 1875, 1876, 1877, 1463, 1878,
+     1463, 1879, 1880, 1463, 1881, 1882, 1882, 1882, 1882, 1883,
+     1463, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1890, 1891,
+     1892, 1893, 1463, 1463, 1894, 1463, 1895, 1463, 1896, 1463,
+     1897, 1463, 1898, 1463, 1899, 1463, 1900, 1463, 1901, 1463,
 
-     1873, 1899, 1899, 1874, 1875, 1900, 1877, 1877, 1877, 1901,
-     1458, 1902, 1903, 1458, 1889, 1890, 1904, 1458, 1891, 1892,
-     1905, 1458, 1893, 1894, 1906, 1458, 1895, 1896, 1907, 1458,
-     1897, 1908, 1458, 1909, 1458, 1877, 1910, 1458, 1902, 1911,
-     1912, 1913, 1914, 1915, 1908, 1916, 1458, 1909, 1917, 1911,
-     1912, 1913, 1914, 1915, 1918, 1917, 1918,    0, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
+     1902, 1463, 1877, 1903, 1463, 1878, 1904, 1904, 1879, 1880,
+     1905, 1882, 1882, 1882, 1906, 1463, 1907, 1908, 1463, 1894,
+     1895, 1909, 1463, 1896, 1897, 1910, 1463, 1898, 1899, 1911,
+     1463, 1900, 1901, 1912, 1463, 1902, 1913, 1463, 1914, 1463,
+     1882, 1915, 1463, 1907, 1916, 1917, 1918, 1919, 1920, 1913,
+     1921, 1463, 1914, 1922, 1916, 1917, 1918, 1919, 1920, 1923,
+     1922, 1923,    0, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
 
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
 
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
 
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
 
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
 
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463
     } ;
 
-static yyconst flex_int16_t yy_nxt[7455] =
+static yyconst flex_int16_t yy_nxt[7474] =
     {   0,
-        4,    5,    6,    7,    8,    9,   10,   11,   12,   11,
+        4,    5,    6,    7,    8,    9,   10,   11,   12,   12,
        13,   14,   15,   15,   15,   15,   15,   15,   16,   17,
-       18,   19,   20,   21,   21,   11,   22,   13,   23,   24,
+       18,   19,   20,   21,   21,   12,   22,   13,   23,   24,
        25,   26,   27,   28,   29,   30,   31,   21,   32,   33,
        34,   35,   36,   21,   37,   38,   39,   40,   41,   42,
-       21,   21,   43,   44,   44,   53,   44,   44,   44,   44,
-       44,   44,   44,   44,  116,   44,   57,   58,   44,   60,
-       61,   44,   44,  117,   72,   83,   84,  209,   44,   44,
-       44,   53,   44,  210,  240,   44,   44,   44,   73,   65,
-       44,   66,   67,   79,   85,   74,   68,   80, 1134,   86,
+       21,   21,   43,   44,   53,  211,   44,   44,   44,   44,
+       44,  212,   44,   44,   44,   57,   58,   44,  248,   44,
+       44,   44,   60,   61,   72,   44,   83,   84,  249,   44,
+       53,   44,   44,   44,   44,  206,   44,   44,   73,   85,
+       44,  117,   79, 1239,   86,   74,   80,  736,  195,   44,
 
-       44,   69,  241,   81,   87,   70,   82,   71,   44,   48,
-       49,   50,   50,   50,   50,   50,   50,   50,   51,  195,
-       88,  196,   52,   53,   54,   53,  352,   55,   52,   52,
-       52,   52,   52,   52,   53,   53,   53,   53,   53,   53,
-       53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
-       54,   53,   44,  123,   75,   44,  447,   44,  124,  125,
-       44,  126,  127,  193,   76,  204,  194,   77,  199,   63,
-       56,   78,   63,  200,   63,   53,  515,   63,   44,   62,
-       52,   52,   52,   52,   52,   52,   52,   63,  110,   89,
-      246,   90,  111,   53,  118,   63,   91,   92,  205,   93,
+      118,  196,   81,   53,  197,   82,  198,   44,   48,   49,
+       50,   50,   50,   50,   50,   50,   50,   51,  207,  201,
+     1304,   52,   53,   54,  202,  182,   55,   52,   52,   52,
+       52,   52,   52,   53,   53,   53,   53,   53,   53,   53,
+       53,   53,   53,   53,   53,   53,   53,   53,   53,   54,
+       53,   44,  183,   75,   44,  451,   44,   44,  184,  236,
+       87,  451,  213,   76,   88,  344,   77,  214,   63,   56,
+       78,   63,  237,   63,   63,  208,   89,   44,   62,   52,
+       52,   52,   52,   52,   52,   52,   63,  242,   65,  345,
+       66,   67,   53,  738,   63,   68,   53,  342,  119,  343,
 
-      247,  112,  113,   94,  145,  114,  119,  115,  120,  211,
-      121,  341,  146,  122,  212,  339,  147,  340,  148,   53,
-       55,   53,   53,   53,   53,   53,   53,   53,   53, 1458,
-      103,  104, 1222,   53,  181,  342,  140,  206,  141,   53,
-       53,   53,   53,   53,   53,   95,  105,  447,   96,   97,
-      106,   98,  142,   99,  107,  100,  108,  101,  128,  143,
-      102,  182,  129,  109,  207,  234,  133,  183,  215,  208,
-      130,  216,  134,  217,  135,  131,  136,  132,  235,  243,
-      137,   44,  138,  139,   44,  738,   44,   53,  244,   44,
-      155,  155,  155,  155,  155,  155,  155,   63,   53,   44,
+       69,   90,  209,   91,   70,  243,   71,  210,   92,   93,
+      120,   94,  121, 1139,  122,   95,  451,  123,   53,   55,
+       53,   53,   53,   53,   53,   53,   53,   53, 1463,  104,
+      105,  217,   53,  740,  218, 1227,  219,  245,   53,   53,
+       53,   53,   53,   53,   96,  106,  246,   97,   98,  107,
+       99,   53,  100,  108,  101,  109,  102,  111,  124,  103,
+       53,  112,  110,  125,  126,  129,  127,  128,  451,  130,
+      113,  114, 1463,  134,  115,  324,  116,  131,  141,  135,
+      142,  136,  132,  137,  133,  146,   53,  138,  325,  139,
+      140,   53,  355,  147,  143,   53,  520,  148, 1463,  149,
 
-       63,  413,   63,  321,  735,   63,  414,   44,  152,  152,
-      152,  152,  152,  152,  152,   63,  322, 1458, 1458,  152,
-       53, 1458,   53,   63,   53,  152,  152,  152,  152,  152,
-      152,  153,  154,  154,  154,  154,  154,  154,   53, 1458,
-     1225, 1458,  155, 1458, 1458, 1458,   53, 1458,  155,  155,
-      155,  155,  155,  155,   49,  156,  156,  156,  156,  156,
-      156,  156,  275,  447,   53, 1458,  157, 1458,   53,  673,
-      277, 1458,  157,  157,  157,  157,  157,  157,   62,  157,
-      157,  157,  157,  157,  157,  157,  160,  160,  160,  160,
-      160,  160,  160,  377,  378,  379,  380,  160,  490,  730,
+       44,  144,  743,   44,   53,   44,   44,  156,  156,  156,
+      156,  156,  156,  156, 1463,  417,   63,   53,   44,   63,
+      418,   63,   63,  495, 1230,  499,   44,  153,  153,  153,
+      153,  153,  153,  153,   63,  451,  496,   53,  153,  500,
+     1463,  744,   63,   53,  153,  153,  153,  153,  153,  153,
+      154,  155,  155,  155,  155,  155,  155, 1463,   53, 1233,
+     1463,  156,  380,  381,  382,  383,  451,  156,  156,  156,
+      156,  156,  156,   49,  157,  157,  157,  157,  157,  157,
+      157,  277,  384, 1463,   53,  158, 1463, 1463, 1463,  279,
+     1236,  158,  158,  158,  158,  158,  158,   62,  158,  158,
 
-       53,  564,  494,  160,  160,  160,  160,  160,  160,   44,
-      565,  491,   44,  381,   44,  431,  495,   44,  458,  458,
-      161,  162,  162,  162,  162,  162,  162,   44,   53,  263,
-      731,  163,  459, 1458, 1228,   44,   53,  163,  163,  163,
-      163,  163,  163,  258,  567,  259,  259,  259,  259,  259,
-      259,  259,  362,  568,   53,  263,  259, 1458,  459, 1458,
-      523,  740,  259,  259,  259,  259,  259,  259,  260,  261,
-      261,  261,  261,  261,  261,  261,  275,  462,  447,   53,
-      262, 1458,  263, 1458, 1458,  464,  262,  262,  262,  262,
-      262,  262,  349,  349,  349,  349,  349,  349,  349,  368,
+      158,  158,  158,  158,  158,  161,  161,  161,  161,  161,
+      161,  161,  569, 1463, 1463,  435,  161,  380,  381,  382,
+      383,  570,  161,  161,  161,  161,  161,  161,   44,  265,
+      451,   44, 1239,   44,   44,   53,  678,  462,  462,  162,
+      163,  163,  163,  163,  163,  163,   44,   53, 1463,  451,
+      164,  463, 1463, 1203,   44,  265,  164,  164,  164,  164,
+      164,  164,  260,  572,  261,  261,  261,  261,  261,  261,
+      261,  365,  573,   53, 1463,  261, 1463,  463, 1463,  528,
+     1205,  261,  261,  261,  261,  261,  261,  262,  263,  263,
+      263,  263,  263,  263,  263,  277,  466,  735,   53,  264,
 
-      369,  369,  369,  369,  369,  369,  533, 1458,  263,  264,
-      262,  262,  262,  262,  262,  262,  262, 1458, 1458, 1231,
-      534,  262,  377,  378,  379,  380,  447,  262,  262,  262,
-      262,  262,  262,  265,  266,  266,  266,  266,  266,  266,
-      266,  267, 1234, 1458, 1458,  268,  534, 1458, 1458,   53,
-      746,  268,  268,  268,  268,  268,  268,   53,  268,  268,
-      268,  268,  268,  268,  268,  271,  272,  272,  272,  272,
-      272,  272,  273, 1458, 1458,  732,  274,  595,  733,  807,
-       53,   53,  274,  274,  274,  274,  274,  274,  275,  276,
-      276,  276,  276,  276,  276,  276,  277,   53,  447, 1198,
+     1463,  265, 1463, 1463,  468,  264,  264,  264,  264,  264,
+      264,  352,  352,  352,  352,  352,  352,  352,  371,  372,
+      372,  372,  372,  372,  372,  538, 1463,  265,  266,  264,
+      264,  264,  264,  264,  264,  264, 1463, 1463,  737,  539,
+      264, 1463,  600,   53,   53,  751,  264,  264,  264,  264,
+      264,  264,  267,  268,  268,  268,  268,  268,  268,  268,
+      269,  757, 1463, 1463,  270,  539, 1006, 1463,  600, 1211,
+      270,  270,  270,  270,  270,  270,   53,  270,  270,  270,
+      270,  270,  270,  270,  273,  274,  274,  274,  274,  274,
+      274,  275,  533, 1209,  812,  276, 1463,   53,  745,   55,
 
-      278,  739,  279,  595,  392,  807,  278,  278,  278,  278,
-      278,  278,  393,  434,  434,  434,  434,  434,  434,  434,
-     1200, 1001,  533, 1206,  596,  394,   55,  736,  279,  346,
-      346,  346,  346,  346,  346,  346, 1458,   53,  429, 1458,
-      346,  395, 1204,   55,   55, 1366,  346,  346,  346,  346,
-      346,  346,  347,  348,  348,  348,  348,  348,  348,  734,
-      752,   55, 1458,  349,  429, 1458, 1458, 1458,   53,  349,
-      349,  349,  349,  349,  349,  260,  350,  350,  350,  350,
-      350,  350,  350,  351,  351,  351,  351,  351,  351,  351,
-      528,  537, 1458, 1458,  351, 1458,   53,   55,  681,  684,
+      686,  276,  276,  276,  276,  276,  276,  277,  278,  278,
+      278,  278,  278,  278,  278,  279,   53,   55, 1371,  280,
+      812,  281, 1463,  396,   55,  280,  280,  280,  280,  280,
+      280,  397,  438,  438,  438,  438,  438,  438,  438, 1304,
+       55,  538,   55,  601,  398,   55,  741,  281,  349,  349,
+      349,  349,  349,  349,  349, 1463,   53,  433,   55,  349,
+      399,   55, 1304,   55,  451,  349,  349,  349,  349,  349,
+      349,  350,  351,  351,  351,  351,  351,  351,  739,   55,
+      825, 1463,  352,  433, 1463, 1463,  824,   53,  352,  352,
+      352,  352,  352,  352,  262,  353,  353,  353,  353,  353,
 
-      351,  351,  351,  351,  351,  351,  353,  354,  354,  354,
-      354,  354,  354,  354, 1299,   55, 1299,  447,  355, 1244,
-     1040, 1458,  819, 1249,  355,  355,  355,  355,  355,  355,
-      358,  355,  355,  355,  355,  355,  355,  355,  362,  363,
-      363,  363,  363,  363,  363,  363,  364,  641,  417,  635,
-      365, 1251,  366,  418, 1049,  643,  365,  365,  365,  365,
-      365,  365,  419,  636,  420,  421, 1458,  422,  449,  450,
-      450,  450,  450,  450,  450,   55,  635,   55,  366,  275,
-      370,  370,  370,  370,  370,  370,  370,  277, 1257,  636,
-     1458,  371, 1458,   55,  829,   55,  637,  371,  371,  371,
+      353,  353,  354,  354,  354,  354,  354,  354,  354,  542,
+     1463, 1463, 1249,  354, 1463,   55,   55,  689,   55,  354,
+      354,  354,  354,  354,  354,  356,  357,  357,  357,  357,
+      357,  357,  357,   55,   55,  834,   55,  358,  830,  831,
+     1463, 1045, 1254,  358,  358,  358,  358,  358,  358,  361,
+      358,  358,  358,  358,  358,  358,  358,  365,  366,  366,
+      366,  366,  366,  366,  366,  367,  646,  421,  640,  368,
+     1256,  369,  422, 1054,  648,  368,  368,  368,  368,  368,
+      368,  423,  641,  424,  425, 1463,  426,  453,  454,  454,
+      454,  454,  454,  454,   55,  640,   55,  369,  277,  373,
 
-      371,  371,  371,  372,  373,  373,  373,  373,  373,  373,
-      638, 1259,  820, 1060,  374, 1265, 1458,   55, 1267,   55,
-      374,  374,  374,  374,  374,  374,  424,  637,  425,  425,
-      425,  425,  425,  425,  425,   55,  638,   55, 1072,  425,
-      825, 1458,   55,   55,  747,  425,  425,  425,  425,  425,
-      425,  426,  427,  427,  427,  427,  427,  427,  427, 1273,
-       55,   55,   55,  428,  826,  429, 1275, 1458, 1084,  428,
-      428,  428,  428,  428,  428,  512,  512,  512,  512,  512,
-      512,  512,  542,  543,  543,  543,  543,  543,  543,  694,
-      745,  429,  430,  428,  428,  428,  428,  428,  428,  428,
+      373,  373,  373,  373,  373,  373,  279, 1262,  641, 1463,
+      374, 1463,   55, 1264,   55,  642,  374,  374,  374,  374,
+      374,  374,  375,  376,  376,  376,  376,  376,  376,  643,
+     1065,  826, 1270,  377, 1272, 1463,   55, 1077,   55,  377,
+      377,  377,  377,  377,  377,  428,  642,  429,  429,  429,
+      429,  429,  429,  429,   55,  643,   55,  832,  429,  835,
+     1463,  752,   55,  754,  429,  429,  429,  429,  429,  429,
+      430,  431,  431,  431,  431,  431,  431,  431, 1278,   55,
+       55, 1280,  432, 1089,  433, 1211, 1463, 1312,  432,  432,
+      432,  432,  432,  432,  517,  517,  517,  517,  517,  517,
 
-       53, 1206, 1307,  695,  428, 1134,   55,   55, 1354,  694,
-      428,  428,  428,  428,  428,  428,  432,  433,  433,  433,
-      433,  433,  433, 1458,   55,   55, 1458,  434,  827,  695,
-       55,  749,   55,  434,  434,  434,  434,  434,  434,  265,
-      435,  435,  435,  435,  435,  435,  435, 1356,   55, 1458,
-       55,  436, 1458,  830, 1458,  878, 1379,  436,  436,  436,
-      436,  436,  436,   53,  436,  436,  436,  436,  436,  436,
-      436,  439,  440,  440,  440,  440,  440,  440, 1458,  689,
-     1458,  878,  441, 1383,   55,   55, 1387,  842,  441,  441,
-      441,  441,  441,  441,  445,  446,  446,  446,  446,  446,
+      517,  547,  548,  548,  548,  548,  548,  548,  699,  750,
+      433,  434,  432,  432,  432,  432,  432,  432,  432,   53,
+     1139, 1463,  700,  432, 1463,  883,   55,   55,  699,  432,
+      432,  432,  432,  432,  432,  436,  437,  437,  437,  437,
+      437,  437, 1463, 1463,   55,   55,  438, 1463,  700,   55,
+     1463,  883,  438,  438,  438,  438,  438,  438,  267,  439,
+      439,  439,  439,  439,  439,  439,  694,   55, 1463, 1463,
+      440,   53,  911,  999,  847, 1359,  440,  440,  440,  440,
+      440,  440,   53,  440,  440,  440,  440,  440,  440,  440,
+      443,  444,  444,  444,  444,  444,  444,   53,  703,  999,
 
-      446,  447,   55,   55, 1458,  448, 1391,  906,  907,   55,
-       55,  448,  448,  448,  448,  448,  448,  362,  451,  451,
-      451,  451,  451,  451,  451,  364,  698,   55,   55,  452,
-     1395,   55,  908,  910,  845,  452,  452,  452,  452,  452,
-      452,  453,  454,  454,  454,  454,  454,  454,  447,   55,
-     1411, 1433,  455,   53,  912,   55,   55,   55,  455,  455,
-      455,  455,  455,  455,  275,  460,  460,  460,  460,  460,
-      460,  460,  277,   55,   55,   55,  461,  915,  913,   53,
-       55,   55,  461,  461,  461,  461,  461,  461,  462,  463,
-      463,  463,  463,  463,  463,  463,  464,  709,   55,   55,
+     1361,  445, 1384,   55,   55,   55,  850,  445,  445,  445,
+      445,  445,  445,  449,  450,  450,  450,  450,  450,  450,
+      451,   55,   55,   55,  452, 1388,  912,  913,  915,   55,
+      452,  452,  452,  452,  452,  452,  365,  455,  455,  455,
+      455,  455,  455,  455,  367,  714, 1392,   55,  456, 1463,
+       55,   55,  917,  853,  456,  456,  456,  456,  456,  456,
+      457,  458,  458,  458,  458,  458,  458,  451,   55,   55,
+     1463,  459,  920,  918,   55, 1463,   55,  459,  459,  459,
+      459,  459,  459,  277,  464,  464,  464,  464,  464,  464,
+      464,  279,   55, 1396,   55,  465, 1463, 1016,   55,   55,
 
-      465,  994,  466, 1015, 1458,  848,  465,  465,  465,  465,
-      465,  465,  546,  547,  547,  547,  547,  547,  547,  615,
-      616,  616,  616,  616,  616,  616,  447,  994,  466,  475,
-     1458, 1458,  447,  476, 1458,   55,  477,   55,  703,  478,
-      703,  479,  480,  481,  482,  509,  509,  509,  509,  509,
-      509,  509,  704,   55, 1458,   55,  509, 1458, 1011,   55,
-     1458,  741,  509,  509,  509,  509,  509,  509,  510,  511,
-      511,  511,  511,  511,  511,   53,  814,   55,  704,  512,
-     1458, 1458, 1458, 1458,  816,  512,  512,  512,  512,  512,
-      512,  426,  513,  513,  513,  513,  513,  513,  513,  514,
+     1022,  465,  465,  465,  465,  465,  465,  466,  467,  467,
+      467,  467,  467,  467,  467,  468,   55,   55, 1400,  469,
+     1463,  470, 1020, 1463, 1463,  469,  469,  469,  469,  469,
+      469,  551,  552,  552,  552,  552,  552,  552,  620,  621,
+      621,  621,  621,  621,  621, 1416, 1463,  470,  480, 1463,
+     1463, 1438,  481, 1463,   55,  482,   55,  708,  483,  708,
+      484,  485,  486,  487,  514,  514,  514,  514,  514,  514,
+      514,  709,   55, 1463,   55,  514, 1463,   55,   55, 1463,
+      746,  514,  514,  514,  514,  514,  514,  515,  516,  516,
+      516,  516,  516,  516,   53,   55,   55,  709,  517, 1463,
 
-      514,  514,  514,  514,  514,  514, 1458, 1458, 1458, 1458,
-      514, 1458,   55,   55, 1299,   55,  514,  514,  514,  514,
-      514,  514,  431,  516,  516,  516,  516,  516,  516,  516,
-       55,   55, 1458,   55,  517, 1234,  263, 1458, 1017, 1231,
-      517,  517,  517,  517,  517,  517,  623,  624,  624,  624,
-      624,  624,  624,  627,  628,  628,  628,  628,  628,  628,
-       55,  705,  263,  517,  517,  517,  517,  517,  517,  517,
-     1065, 1228, 1458, 1077,  517,  706, 1458, 1225,   55,  742,
-      517,  517,  517,  517,  517,  517,  518,  518,  518,  518,
-      518,  518,  518,   53, 1222,  821, 1065,  519, 1458, 1077,
+     1463, 1070, 1463, 1236,  517,  517,  517,  517,  517,  517,
+      430,  518,  518,  518,  518,  518,  518,  518,  519,  519,
+      519,  519,  519,  519,  519, 1463, 1463, 1070, 1082,  519,
+     1463, 1233,   55, 1230,   55,  519,  519,  519,  519,  519,
+      519,  435,  521,  521,  521,  521,  521,  521,  521,  819,
+       55, 1463,   55,  522, 1082,  265, 1463,  821, 1227,  522,
+      522,  522,  522,  522,  522,  628,  629,  629,  629,  629,
+      629,  629,  632,  633,  633,  633,  633,  633,  633,   55,
+      710,  265,  522,  522,  522,  522,  522,  522,  522, 1463,
+     1304, 1211, 1202,  522,  711,   55, 1008,   55,  747,  522,
 
-     1458,  706, 1458,  519,  519,  519,  519,  519,  519,   53,
-      519,  519,  519,  519,  519,  519,  519,  362,  522,  522,
-      522,  522,  522,  522,  522,  523, 1458,  705, 1299,  524,
-     1206,  366, 1003, 1084,  447,  524,  524,  524,  524,  524,
-      524, 1458,  714,  715,  715,  715,  715,  715,  715,  717,
-      718,  718,  718,  718,  718,  718,   55,  366,  528,  529,
-      529,  529,  529,  529,  529,  529,  530, 1458, 1234,  885,
-      531, 1080,  532, 1078,   55,  744,  531,  531,  531,  531,
-      531,  531,  721,  722,  722,  722,  722,  722,  722,   53,
-      772,  773,  773,  773,  773,  773,  773,   55,  532,  362,
+      522,  522,  522,  522,  522,  523,  523,  523,  523,  523,
+      523,  523,   53,   55,  827, 1463,  524, 1115, 1202, 1089,
+      711, 1463,  524,  524,  524,  524,  524,  524,   53,  524,
+      524,  524,  524,  524,  524,  524,  365,  527,  527,  527,
+      527,  527,  527,  527,  528,  858,  710, 1463,  529,  451,
+      369, 1239,  890, 1029,  529,  529,  529,  529,  529,  529,
+     1463,  719,  720,  720,  720,  720,  720,  720,  722,  723,
+      723,  723,  723,  723,  723,   55,  369,  533,  534,  534,
+      534,  534,  534,  534,  534,  535, 1463, 1085, 1083,  536,
+     1077,  537,  451,   55,  749,  536,  536,  536,  536,  536,
 
-      535,  535,  535,  535,  535,  535,  535,  523, 1072,  447,
-     1197,  536, 1231, 1458, 1458,   55,   55,  536,  536,  536,
-      536,  536,  536,  537,  538,  538,  538,  538,  538,  538,
-      538,  539,  822,  873,   55,  540, 1197,  541, 1110, 1458,
-     1458,  540,  540,  540,  540,  540,  540,  780,  781,  781,
-      781,  781,  781,  781,  784,  785,  785,  785,  785,  785,
-      785,  808,   55,  541,  462,  548,  548,  548,  548,  548,
-      548,  548,  464, 1068, 1066,  809,  549, 1458,   55, 1060,
-       55,  808,  549,  549,  549,  549,  549,  549,  550,  551,
-      551,  551,  551,  551,  551, 1458,   55,  824,  447,  552,
+      536,  726,  727,  727,  727,  727,  727,  727,   53,  777,
+      778,  778,  778,  778,  778,  778,   55,  537,  365,  540,
+      540,  540,  540,  540,  540,  540,  528, 1236,  878, 1463,
+      541, 1073, 1463, 1463,   55,   55,  541,  541,  541,  541,
+      541,  541,  542,  543,  543,  543,  543,  543,  543,  543,
+      544,  829, 1071,   55,  545, 1463,  546, 1118, 1463, 1463,
+      545,  545,  545,  545,  545,  545,  785,  786,  786,  786,
+      786,  786,  786,  789,  790,  790,  790,  790,  790,  790,
+      813,   55,  546,  466,  553,  553,  553,  553,  553,  553,
+      553,  468, 1065, 1463,  814,  554, 1463,  451, 1233,   55,
 
-     1113,  809,   55, 1458,   55,  552,  552,  552,  552,  552,
-      552,  590,  810,  591,  591,  591,  591,  591,  591,  591,
-       55, 1458,   55, 1228,  591, 1114,  811,  862, 1056,   55,
-      591,  591,  591,  591,  591,  591,  592,  593,  593,  593,
-      593,  593,  593,  593, 1054,  853, 1209,   55,  594, 1212,
-      595, 1049,  811, 1024,  594,  594,  594,  594,  594,  594,
-      792,  793,  793,  793,  793,  793,  793,  795,  796,  796,
-      796,  796,  796,  796,  810,   55,  595,  592,  594,  594,
-      594,  594,  594,  594,  594, 1458,  862,  447, 1458,  594,
-     1458, 1225, 1458,   55, 1027,  594,  594,  594,  594,  594,
+      813,  554,  554,  554,  554,  554,  554,  555,  556,  556,
+      556,  556,  556,  556, 1463,  867,  916,  867,  557, 1463,
+      814,   55, 1463, 1032,  557,  557,  557,  557,  557,  557,
+      595,  815,  596,  596,  596,  596,  596,  596,  596,   55,
+     1463, 1061, 1059,  596, 1119,  816, 1054,   55,   55,  596,
+      596,  596,  596,  596,  596,  597,  598,  598,  598,  598,
+      598,  598,  598,  451,  878,   55,   55,  599, 1217,  600,
+     1220,  816, 1035,  599,  599,  599,  599,  599,  599,  797,
+      798,  798,  798,  798,  798,  798,  800,  801,  801,  801,
+      801,  801,  801,  815,   55,  600,  597,  599,  599,  599,
 
-      594,  431,  597,  597,  597,  597,  597,  597,  597,  873,
-      911, 1458,  853,  598, 1458, 1256, 1458, 1030, 1458,  598,
-      598,  598,  598,  598,  598,   53,  598,  598,  598,  598,
-      598,  598,  598,  599,  599,  599,  599,  599,  599,  599,
-      885, 1256, 1045, 1040,  600, 1264, 1272, 1458, 1033,  447,
-      600,  600,  600,  600,  600,  600,   53,  600,  600,  600,
-      600,  600,  600,  600,  603,  604,  604,  604,  604,  604,
-      604, 1264, 1272, 1458, 1353,  605, 1382, 1386,   55,   55,
-       55,  605,  605,  605,  605,  605,  605,  362,  451,  451,
-      451,  451,  451,  451,  451,  523,   55,   55,   55,  452,
+      599,  599,  599,  599, 1261,  890, 1230, 1463,  599, 1269,
+     1277,  858,   55, 1038,  599,  599,  599,  599,  599,  599,
+      435,  602,  602,  602,  602,  602,  602,  602, 1050, 1006,
+     1261,  921,  603, 1463, 1463, 1269, 1277, 1008,  603,  603,
+      603,  603,  603,  603,   53,  603,  603,  603,  603,  603,
+      603,  603,  604,  604,  604,  604,  604,  604,  604, 1045,
+     1463, 1045,  451,  605, 1358, 1387, 1391, 1227, 1227,  605,
+      605,  605,  605,  605,  605,   53,  605,  605,  605,  605,
+      605,  605,  605,  608,  609,  609,  609,  609,  609,  609,
+     1358, 1387, 1391, 1395,  610, 1399, 1437,   55,   55,   55,
 
-     1353,   55, 1382, 1386,  858,  452,  452,  452,  452,  452,
-      452,  606,  607,  607,  607,  607,  607,  607,  859,   55,
-     1210, 1211,  608, 1222, 1215,   55,  447, 1136,  608,  608,
-      608,  608,  608,  608,  612,  613,  613,  613,  613,  613,
-      613,  447, 1241,   55,  859,  614, 1117, 1234, 1231,   55,
-       55,  614,  614,  614,  614,  614,  614,  528,  617,  617,
-      617,  617,  617,  617,  617,  530, 1001,   55,   55,  618,
-     1228, 1225,   55,   55, 1003,  618,  618,  618,  618,  618,
-      618,  619,  620,  620,  620,  620,  620,  620,  447, 1213,
-       55,   55,  621, 1222, 1117,   55,   55,   55,  621,  621,
+      610,  610,  610,  610,  610,  610,  365,  455,  455,  455,
+      455,  455,  455,  455,  528,   55,   55,   55,  456, 1395,
+       55, 1399, 1437,  863,  456,  456,  456,  456,  456,  456,
+      611,  612,  612,  612,  612,  612,  612,  864,   55, 1214,
+     1215,  613,  451,   55, 1141, 1246, 1122,  613,  613,  613,
+      613,  613,  613,  617,  618,  618,  618,  618,  618,  618,
+      451,   55, 1216,  864,  619, 1239, 1236,   55,   55,   55,
+      619,  619,  619,  619,  619,  619,  533,  622,  622,  622,
+      622,  622,  622,  622,  535,   55,   55,   55,  623, 1233,
+     1230,   55,   55, 1227,  623,  623,  623,  623,  623,  623,
 
-      621,  621,  621,  621,  537,  629,  629,  629,  629,  629,
-      629,  629,  539,   55,   55,   55,  630, 1001, 1362, 1294,
-       55, 1206,  630,  630,  630,  630,  630,  630,  631,  632,
-      632,  632,  632,  632,  632,  447, 1040, 1003,   55,  633,
-     1390, 1363,  814,   55, 1222,  633,  633,  633,  633,  633,
-      633,  462,  639,  639,  639,  639,  639,  639,  639,  464,
-     1049,   55, 1394,  640, 1432, 1440, 1390,  997, 1225,  640,
-      640,  640,  640,  640,  640,  641,  642,  642,  642,  642,
-      642,  642,  642,  643, 1060, 1364,  995,  644, 1394,  645,
-     1432, 1440, 1228,  644,  644,  644,  644,  644,  644,  799,
+      624,  625,  625,  625,  625,  625,  625,  451, 1218,   55,
+       55,  626, 1122, 1367, 1299,   55,   55,  626,  626,  626,
+      626,  626,  626,  542,  634,  634,  634,  634,  634,  634,
+      634,  544, 1054,   55,   55,  635, 1368, 1006,   55,   55,
+     1230,  635,  635,  635,  635,  635,  635,  636,  637,  637,
+      637,  637,  637,  637,  451, 1065,   55,   55,  638, 1445,
+     1211, 1008,  819, 1233,  638,  638,  638,  638,  638,  638,
+      466,  644,  644,  644,  644,  644,  644,  644,  468, 1077,
+     1369, 1446,  645, 1447, 1448, 1445,   55, 1236,  645,  645,
+      645,  645,  645,  645,  646,  647,  647,  647,  647,  647,
 
-      800,  800,  800,  800,  800,  800,  715,  715,  715,  715,
-      715,  715,  715,   55,  858,  645,  669,  669,  669,  669,
-      669,  669,  669, 1441, 1072, 1442, 1443,  669, 1458, 1086,
-       55,   55, 1231,  669,  669,  669,  669,  669,  669,  670,
-      670,  670,  670,  670,  670,  670,  909, 1084,   55, 1441,
-      670, 1442, 1443, 1444, 1458, 1234,  670,  670,  670,  670,
-      670,  670,  592,  671,  671,  671,  671,  671,  671,  671,
-      672,  672,  672,  672,  672,  672,  672, 1134, 1204, 1444,
-     1449,  672, 1455,   55,   55, 1299, 1206,  672,  672,  672,
-      672,  672,  672,  431,  674,  674,  674,  674,  674,  674,
+      647,  647,  648, 1089,   55, 1002,  649, 1446,  650, 1447,
+     1448, 1239,  649,  649,  649,  649,  649,  649,  804,  805,
+      805,  805,  805,  805,  805,  720,  720,  720,  720,  720,
+      720,  720,   55,  863,  650,  674,  674,  674,  674,  674,
+      674,  674, 1449, 1139, 1454, 1460,  674, 1463, 1000,   55,
+       55, 1304,  674,  674,  674,  674,  674,  674,  675,  675,
+      675,  675,  675,  675,  675,  914, 1209,   55, 1449,  675,
+     1454, 1460, 1091, 1463, 1211,  675,  675,  675,  675,  675,
+      675,  597,  676,  676,  676,  676,  676,  676,  676,  677,
+      677,  677,  677,  677,  677,  677, 1209,  451, 1038, 1079,
 
-      674,   55,   55,  447, 1033,  675, 1449, 1074, 1455,  447,
-     1295,  675,  675,  675,  675,  675,  675,   53,  675,  675,
-      675,  675,  675,  675,  675,  676,  676,  676,  676,  676,
-      676,  676, 1204, 1030, 1062,  447,  677, 1027, 1051,  447,
-     1458, 1024,  677,  677,  677,  677,  677,  677,   53,  677,
-      677,  677,  677,  677,  677,  677,  528,  680,  680,  680,
-      680,  680,  680,  680,  681,   55,  867,  867,  682, 1042,
-      532,   55,  447,  869,  682,  682,  682,  682,  682,  682,
-      868, 1458, 1136,   55,  447, 1117, 1033,  870, 1030,   55,
-       55, 1027,   55, 1024,   55,  823,  532,  537,  683,  683,
+      677,  451,   55, 1035, 1463, 1067,  677,  677,  677,  677,
+      677,  677,  435,  679,  679,  679,  679,  679,  679,  679,
+       55,  451, 1032, 1056,  680,  451, 1029, 1047,  451, 1300,
+      680,  680,  680,  680,  680,  680,   53,  680,  680,  680,
+      680,  680,  680,  680,  681,  681,  681,  681,  681,  681,
+      681, 1141,  451, 1122, 1038,  682, 1035, 1032, 1029, 1122,
+     1008,  682,  682,  682,  682,  682,  682,   53,  682,  682,
+      682,  682,  682,  682,  682,  533,  685,  685,  685,  685,
+      685,  685,  685,  686,   55,  872,  872,  687,  821,  537,
+      890, 1091,  874,  687,  687,  687,  687,  687,  687,  873,
 
-      683,  683,  683,  683,  683,  684,  868, 1458,   55,  685,
-       55,  541,   55,  870,   55,  685,  685,  685,  685,  685,
-      685,  831,  828, 1117,  338,  836,  836,  836,  836,  836,
-      836,  836,   55,  869,  879,  879,   55,  541,  689,  690,
-      690,  690,  690,  690,  690,  690,  691, 1458,  880, 1458,
-      692,  916,  693, 1003,   55,  881,  692,  692,  692,  692,
-      692,  692,  793,  793,  793,  793,  793,  793,  793,  882,
-       55, 1010,  816, 1458,  880, 1458,  881,  885,  693,  528,
-      696,  696,  696,  696,  696,  696,  696,  681,   55, 1086,
-     1458,  697, 1033,  709,   55,  882, 1409,  697,  697,  697,
+     1463, 1038,   55,  714,  886,  884,  875,  878, 1079,   55,
+     1035,   55,  703,   55,  828,  537,  542,  688,  688,  688,
+      688,  688,  688,  688,  689,  873, 1463,   55,  690,   55,
+      546,   55,  875,   55,  690,  690,  690,  690,  690,  690,
+      836,  833,  874,  341,  841,  841,  841,  841,  841,  841,
+      841,   55,  874,  884,  884,   55,  546,  694,  695,  695,
+      695,  695,  695,  695,  695,  696, 1463,  885, 1463,  697,
+     1114,  698,  872,   55,  886,  697,  697,  697,  697,  697,
+      697,  798,  798,  798,  798,  798,  798,  798,  887,   55,
+     1015,  867, 1463,  885, 1463,  886, 1067,  698,  533,  701,
 
-      697,  697,  697,  698,  699,  699,  699,  699,  699,  699,
-      699,  700,   55,  881,  879,  701, 1458,  702,  873, 1074,
-     1030,  701,  701,  701,  701,  701,  701,  891,  892,  892,
-      892,  892,  892,  892,  894,  895,  895,  895,  895,  895,
-      895,  995,   55,  702,  537,  707,  707,  707,  707,  707,
-      707,  707,  684,  698,  869,  996,  708,  867,  862, 1062,
-       55, 1012,  708,  708,  708,  708,  708,  708,  709,  710,
-      710,  710,  710,  710,  710,  710,  711, 1027, 1013,  689,
-      712,  996,  713,  858,   55,   55,  712,  712,  712,  712,
-      712,  712,  898,  899,  899,  899,  899,  899,  899,  853,
+      701,  701,  701,  701,  701,  701,  686,   55, 1032, 1463,
+      702,  694,  863,  858,  887, 1414,  702,  702,  702,  702,
+      702,  702,  703,  704,  704,  704,  704,  704,  704,  704,
+      705, 1056, 1029, 1047,  706, 1463,  707,  944,  929, 1038,
+      706,  706,  706,  706,  706,  706,  896,  897,  897,  897,
+      897,  897,  897,  899,  900,  900,  900,  900,  900,  900,
+     1000,   55,  707,  542,  712,  712,  712,  712,  712,  712,
+      712,  689, 1035, 1032, 1001,  713, 1029, 1027,  929,   55,
+     1017,  713,  713,  713,  713,  713,  713,  714,  715,  715,
+      715,  715,  715,  715,  715,  716,  819, 1018, 1008,  717,
 
-     1051, 1024,   55,   55, 1042,  995,  997,   55,  713,  641,
-      723,  723,  723,  723,  723,  723,  723,  643,  914, 1458,
-      998,  724, 1112,  939,  924,   55,  997,  724,  724,  724,
-      724,  724,  724,  725,  726,  726,  726,  726,  726,  726,
-     1458, 1014, 1033, 1030,  727, 1458,  998, 1027, 1024, 1022,
-      727,  727,  727,  727,  727,  727,   53,   53,   53,   53,
-       53,   53,   53,  924,  814, 1003, 1458,   53,   55,   55,
-       55,   55,   55,   53,   53,   53,   53,   53,   53,  943,
-      944,  944,  944,  944,  944,  944,   55,   55,   55,   55,
-       55,  729,  747,  816,  748,  748,  748,  748,  748,  748,
+     1001,  718,  821,   55,   55,  717,  717,  717,  717,  717,
+      717,  903,  904,  904,  904,  904,  904,  904,  646,  815,
+      813,   55,   55,  892, 1000, 1002,   55,  718,  646,  728,
+      728,  728,  728,  728,  728,  728,  648,  919, 1463, 1003,
+      729, 1117,  853,  880,   55, 1002,  729,  729,  729,  729,
+      729,  729,  730,  731,  731,  731,  731,  731,  731, 1463,
+     1019,  850,  869,  732, 1463, 1003,  847,  860,  944,  732,
+      732,  732,  732,  732,  732,   53,   53,   53,   53,   53,
+       53,   53,  929,  853,  850, 1463,   53,   55,   55,   55,
+       55,   55,   53,   53,   53,   53,   53,   53,  948,  949,
 
-      748, 1006, 1007, 1008, 1009,  748, 1016,  641,   55, 1109,
-       55,  748,  748,  748,  748,  748,  748,  951,  952,  952,
-      952,  952,  952,  952, 1045, 1045,   55,   55,   55,   53,
-      749,  750,  750,  750,  750,  750,  750,  750, 1046, 1458,
-     1108,  810,  750, 1216,  808,   55,  887,  848,  750,  750,
-      750,  750,  750,  750,  955,  956,  956,  956,  956,  956,
-      956,  875, 1361,  845, 1046, 1458,   53,  671,  671,  671,
-      671,  671,  671,  671,  963,  964,  964,  964,  964,  964,
-      964,  966,  967,  967,  967,  967,  967,  967,  970,  971,
-      971,  971,  971,  971,  971,  979,  980,  980,  980,  980,
+      949,  949,  949,  949,  949,   55,   55,   55,   55,   55,
+      734,  752,  847,  753,  753,  753,  753,  753,  753,  753,
+     1011, 1012, 1013, 1014,  753, 1021, 1366,   55,   55,   55,
+      753,  753,  753,  753,  753,  753,  956,  957,  957,  957,
+      957,  957,  957, 1050, 1050,   55,   55,   55,   53,  754,
+      755,  755,  755,  755,  755,  755,  755, 1051, 1463, 1113,
+     1116,  755, 1221,  929,  821,  648,  714,  755,  755,  755,
+      755,  755,  755,  960,  961,  961,  961,  961,  961,  961,
+      892,  853,  542, 1051, 1463,   53,  676,  676,  676,  676,
+      676,  676,  676,  968,  969,  969,  969,  969,  969,  969,
 
-      980,  980,   53,  672,  672,  672,  672,  672,  672,  672,
-      864,  842,  855,  939,  672,  924,  848,  845,  842,  924,
-      672,  672,  672,  672,  672,  672,  751,  350,  350,  350,
-      350,  350,  350,  350,  265,  753,  753,  753,  753,  753,
-      753,  753,  816,  643,  709,  887,  754,  848,  537,  705,
-      703,  698,  754,  754,  754,  754,  754,  754,   53,  754,
-      754,  754,  754,  754,  754,  754,  757,  758,  758,  758,
-      758,  758,  758,  875,  845,  528,  694,  759,  689,  864,
-      842,  855,  852,  759,  759,  759,  759,  759,  759,  528,
-      617,  617,  617,  617,  617,  617,  617,  681,  768,  756,
+      971,  972,  972,  972,  972,  972,  972,  975,  976,  976,
+      976,  976,  976,  976,  984,  985,  985,  985,  985,  985,
+      985,   53,  677,  677,  677,  677,  677,  677,  677,  710,
+      708,  703,  880,  677,  850,  533,  699,  694,  869,  677,
+      677,  677,  677,  677,  677,  756,  353,  353,  353,  353,
+      353,  353,  353,  267,  758,  758,  758,  758,  758,  758,
+      758,  847,  860,  857,  773,  759,  761,  853,  850,  847,
+      845,  759,  759,  759,  759,  759,  759,   53,  759,  759,
+      759,  759,  759,  759,  759,  762,  763,  763,  763,  763,
+      763,  763,  761,  646,  821,  648,  764,  466,  642,  640,
 
-      848,  618,  845,  842,  840,  756, 1054,  618,  618,  618,
-      618,  618,  618,  760,  761,  761,  761,  761,  761,  761,
-     1055,  641,  816,  643,  762,  462,  637,  635,  711,  684,
-      762,  762,  762,  762,  762,  762,  537,  629,  629,  629,
-      629,  629,  629,  629,  684,  700, 1055,  681,  630,  691,
-      768,  756,  684, 1054,  630,  630,  630,  630,  630,  630,
-      763,  764,  764,  764,  764,  764,  764, 1458,  681,  756,
-       53,  765,   53,   53,  743,   53,   53,  765,  765,  765,
-      765,  765,  765,  769,  770,  770,  770,  770,  770,  770,
-      447,  737,  643, 1458,  771,  464,  537,  711,  684,  362,
+      716,  689,  764,  764,  764,  764,  764,  764,  533,  622,
+      622,  622,  622,  622,  622,  622,  686,  705,  686,  696,
+      623,  773,  761,  689,  686, 1059,  623,  623,  623,  623,
+      623,  623,  765,  766,  766,  766,  766,  766,  766, 1060,
+      761,   53,   53,  767,   53,  748,   53,   53,  742,  767,
+      767,  767,  767,  767,  767,  542,  634,  634,  634,  634,
+      634,  634,  634,  689,  648, 1060,  468,  635,  542,  716,
+      689,  365, 1059,  635,  635,  635,  635,  635,  635,  768,
+      769,  769,  769,  769,  769,  769, 1463,  538,  533,  705,
+      770,  686,  696,  693,  616,  607,  770,  770,  770,  770,
 
-      771,  771,  771,  771,  771,  771,  689,  774,  774,  774,
-      774,  774,  774,  774,  691,  533,  528,  700,  775,  681,
-      691,  688,  611,  602,  775,  775,  775,  775,  775,  775,
-      776,  777,  777,  777,  777,  777,  777,  447,  684,  681,
-      679,  778,  602,  592,  590,  668,  667,  778,  778,  778,
-      778,  778,  778,  698,  786,  786,  786,  786,  786,  786,
-      786,  700,  666,  665,  664,  787,  663,  662,  661,  660,
-      659,  787,  787,  787,  787,  787,  787,  788,  789,  789,
-      789,  789,  789,  789,  447,  658,  657,  656,  790,  655,
-      654,  653,  652,  651,  790,  790,  790,  790,  790,  790,
+      770,  770,  774,  775,  775,  775,  775,  775,  775,  451,
+      689,  686, 1463,  776,  684,  607,  597,  595,  673,  776,
+      776,  776,  776,  776,  776,  694,  779,  779,  779,  779,
+      779,  779,  779,  696,  672,  671,  670,  780,  669,  668,
+      667,  666,  665,  780,  780,  780,  780,  780,  780,  781,
+      782,  782,  782,  782,  782,  782,  451,  664,  663,  662,
+      783,  661,  660,  659,  658,  657,  783,  783,  783,  783,
+      783,  783,  703,  791,  791,  791,  791,  791,  791,  791,
+      705,  656,  655,  654,  792,  653,  652,  651,  466,  648,
+      792,  792,  792,  792,  792,  792,  793,  794,  794,  794,
 
-      709,  801,  801,  801,  801,  801,  801,  801,  711,  650,
-      649,  648,  802,  647,  646,  462,  643,  464,  802,  802,
-      802,  802,  802,  802,  803,  804,  804,  804,  804,  804,
-      804,  447,  458,  539,  523,  805,  530,  611,  602,  523,
-      602,  805,  805,  805,  805,  805,  805,  641,  812,  812,
-      812,  812,  812,  812,  812,  643,  596,  596,  589,  813,
-      588,  587,  586,  585,  584,  813,  813,  813,  813,  813,
-      813,  814,  815,  815,  815,  815,  815,  815,  815,  816,
-      583,  582,  581,  817,  335,  818,  237,  580,  579,  817,
-      817,  817,  817,  817,  817,  982,  983,  983,  983,  983,
+      794,  794,  794,  451,  468,  462,  544,  795,  528,  535,
+      616,  607,  528,  795,  795,  795,  795,  795,  795,  714,
+      806,  806,  806,  806,  806,  806,  806,  716,  607,  601,
+      601,  807,  594,  593,  592,  591,  590,  807,  807,  807,
+      807,  807,  807,  808,  809,  809,  809,  809,  809,  809,
+      451,  589,  588,  587,  810,  586,  338,  239,  585,  584,
+      810,  810,  810,  810,  810,  810,  646,  817,  817,  817,
+      817,  817,  817,  817,  648,  583,  582,  581,  818,  580,
+      579,  578,  577,  576,  818,  818,  818,  818,  818,  818,
+      819,  820,  820,  820,  820,  820,  820,  820,  821,  575,
 
-      983,  983,  986,  987,  987,  987,  987,  987,  987, 1056,
-     1056,  818,   55, 1066,  832,  832,  832,  832,  832,  832,
-      832,  578,  577, 1057, 1458,  832,  576, 1067,  575,  574,
-       55,  832,  832,  832,  832,  832,  832,  833,  833,  833,
-      833,  833,  833,  833,  573,  572,  571,  570,  833, 1057,
-     1458,  569,  566, 1067,  833,  833,  833,  833,  833,  833,
-      834,  835,  835,  835,  835,  835,  835,  563,  562,  561,
-      560,  836,  559,   55,  558,  557,  556,  836,  836,  836,
-      836,  836,  836,  265,  837,  837,  837,  837,  837,  837,
-      837,   55,  555,  554,  464,  838,  277,  447,  362,  539,
+      574,  571,  822,  568,  823,  567,  566,  565,  822,  822,
+      822,  822,  822,  822,  987,  988,  988,  988,  988,  988,
+      988,  991,  992,  992,  992,  992,  992,  992, 1061, 1061,
+      823,   55, 1071,  837,  837,  837,  837,  837,  837,  837,
+      564,  563, 1062, 1463,  837,  562, 1072,  561,  560,   55,
+      837,  837,  837,  837,  837,  837,  838,  838,  838,  838,
+      838,  838,  838,  559,  468,  279,  451,  838, 1062, 1463,
+      365,  544, 1072,  838,  838,  838,  838,  838,  838,  839,
+      840,  840,  840,  840,  840,  840,  528,  535,  451,  532,
+      841,  448,   55,  442,  528,  526,  841,  841,  841,  841,
 
-     1408,  838,  838,  838,  838,  838,  838,   53,  838,  838,
-      838,  838,  838,  838,  838,  689,  841,  841,  841,  841,
-      841,  841,  841,  842,  523,  530,  447,  843,  527,  693,
-      444,  438,  523,  843,  843,  843,  843,  843,  843,  892,
-      892,  892,  892,  892,  892,  892,  964,  964,  964,  964,
-      964,  964,  964, 1066,  521,  693,  698,  844,  844,  844,
-      844,  844,  844,  844,  845,  438, 1068, 1458,  846,  430,
-      702,  424, 1068, 1078,  846,  846,  846,  846,  846,  846,
-     1069,  508,  507,  506,  505,  504, 1458, 1079,  503,  502,
-      501,  500,   55, 1458, 1078,  499,  702,  709,  847,  847,
+      841,  841,  267,  842,  842,  842,  842,  842,  842,  842,
+       55,  442,  434,  428,  843,  513,  512,  511,  510, 1413,
+      843,  843,  843,  843,  843,  843,   53,  843,  843,  843,
+      843,  843,  843,  843,  694,  846,  846,  846,  846,  846,
+      846,  846,  847,  509,  508,  507,  848,  506,  698,  505,
+      504,  503,  848,  848,  848,  848,  848,  848,  897,  897,
+      897,  897,  897,  897,  897,  969,  969,  969,  969,  969,
+      969,  969, 1071,  502,  698,  703,  849,  849,  849,  849,
+      849,  849,  849,  850,  501, 1073, 1463,  851,  498,  707,
+      497, 1073, 1083,  851,  851,  851,  851,  851,  851, 1074,
 
-      847,  847,  847,  847,  847,  848, 1069,  498, 1458,  849,
-       55,  713, 1458, 1079, 1080,  849,  849,  849,  849,  849,
-      849,  980,  980,  980,  980,  980,  980,  980, 1081, 1407,
-      497,  496,  493, 1080, 1458, 1198,  492,  713,  853,  854,
-      854,  854,  854,  854,  854,  854,  855, 1458,  489, 1199,
-      856,  488,  857,  487, 1081, 1198,  856,  856,  856,  856,
-      856,  856, 1090, 1091, 1091, 1091, 1091, 1091, 1091, 1458,
-      486,  485,  119, 1458, 1200, 1199, 1200,  484,  857,  689,
-      860,  860,  860,  860,  860,  860,  860,  842, 1201,  483,
-     1458,  861,  474,  473,  472, 1458,  471,  861,  861,  861,
+      494,  493,  492,  491,  490, 1463, 1084,  120,  489,  488,
+      479,   55, 1463, 1083,  478,  707,  714,  852,  852,  852,
+      852,  852,  852,  852,  853, 1074,  477, 1463,  854,   55,
+      718, 1463, 1084, 1085,  854,  854,  854,  854,  854,  854,
+      985,  985,  985,  985,  985,  985,  985, 1086, 1412,  476,
+      475,  474, 1085, 1463, 1203,  473,  718,  858,  859,  859,
+      859,  859,  859,  859,  859,  860, 1463,  472, 1204,  861,
+      471,  862,  277, 1086, 1203,  861,  861,  861,  861,  861,
+      861, 1095, 1096, 1096, 1096, 1096, 1096, 1096, 1463,  468,
+      279,  451, 1463, 1205, 1204, 1205,  367,  862,  694,  865,
 
-      861,  861,  861,  862,  863,  863,  863,  863,  863,  863,
-      863,  864,  470,  469, 1201,  865, 1458,  866,  468,  467,
-      275,  865,  865,  865,  865,  865,  865, 1093, 1094, 1094,
-     1094, 1094, 1094, 1094, 1097, 1098, 1098, 1098, 1098, 1098,
-     1098, 1244,  464,  866,  698,  871,  871,  871,  871,  871,
-      871,  871,  845,  277,  447, 1245,  872,  364,  444,  438,
-      438,   55,  872,  872,  872,  872,  872,  872,  873,  874,
-      874,  874,  874,  874,  874,  874,  875,   55,   55,   55,
-      876, 1245,  877,  431,  431,  423,  876,  876,  876,  876,
-      876,  876,  416, 1111,  415,   55,   55, 1140, 1141, 1141,
+      865,  865,  865,  865,  865,  865,  847, 1206,  448, 1463,
+      866,  442,  442,  435, 1463,  435,  866,  866,  866,  866,
+      866,  866,  867,  868,  868,  868,  868,  868,  868,  868,
+      869,  427,  420, 1206,  870, 1463,  871,  419,  416,  415,
+      870,  870,  870,  870,  870,  870, 1098, 1099, 1099, 1099,
+     1099, 1099, 1099, 1102, 1103, 1103, 1103, 1103, 1103, 1103,
+     1249,  414,  871,  703,  876,  876,  876,  876,  876,  876,
+      876,  850,  413,  412, 1250,  877,  411,  410,  409,  408,
+      407,  877,  877,  877,  877,  877,  877,  878,  879,  879,
+      879,  879,  879,  879,  879,  880,   55,   55, 1249,  881,
 
-     1141, 1141, 1141, 1141, 1244,  412, 1105, 1106,  877,  709,
-      883,  883,  883,  883,  883,  883,  883,  848, 1458,  411,
-      410,  884,  409,  408,  407,  406,  405,  884,  884,  884,
-      884,  884,  884,  885,  886,  886,  886,  886,  886,  886,
-      886,  887,   55, 1249, 1458,  888,  404,  889,  403,  402,
-       55,  888,  888,  888,  888,  888,  888, 1250,  401,  400,
-       55, 1146, 1147, 1147, 1147, 1147, 1147, 1147,   55,  399,
-     1249, 1107,  398,  889,  814,  900,  900,  900,  900,  900,
-      900,  900,  816, 1250, 1458,  397,  901, 1436,  396,  391,
-      390, 1251,  901,  901,  901,  901,  901,  901,  902,  903,
+     1250,  882,  406,  405,  404,  881,  881,  881,  881,  881,
+      881,  403, 1463,  402,   55,   55, 1145, 1146, 1146, 1146,
+     1146, 1146, 1146, 1254,  401, 1110, 1111,  882,  714,  888,
+      888,  888,  888,  888,  888,  888,  853, 1255, 1463,  400,
+      889,  395,  394,  393,  392,  391,  889,  889,  889,  889,
+      889,  889,  890,  891,  891,  891,  891,  891,  891,  891,
+      892,   55, 1254, 1255,  893,  320,  894,  390,  389,   55,
+      893,  893,  893,  893,  893,  893, 1463,  388,  387,   55,
+     1151, 1152, 1152, 1152, 1152, 1152, 1152,   55,  386, 1256,
+     1112,  385,  894,  819,  905,  905,  905,  905,  905,  905,
 
-      903,  903,  903,  903,  903, 1252,  389,  388,  317,  904,
-     1458,  387,  386,  385,  384,  904,  904,  904,  904,  904,
-      904,   55, 1251,  917,  917,  917,  917,  917,  917,  917,
-      383, 1252,  382,  376,  917,  277, 1458,  364,  273,   55,
-      917,  917,  917,  917,  917,  917,  918,  918,  918,  918,
-      918,  918,  918,  361,  270,  357,  264,  918,  258,  142,
-      345,  344, 1458,  918,  918,  918,  918,  918,  918,  596,
-      919,  919,  919,  919,  919,  919,  919,  343,  338,  317,
-      337,  920,  336,  429,  335,  334,  333,  920,  920,  920,
-      920,  920,  920, 1150, 1151, 1151, 1151, 1151, 1151, 1151,
+      905,  821, 1463, 1257,  379,  906, 1441,  279,  367,  275,
+     1256,  906,  906,  906,  906,  906,  906,  907,  908,  908,
+      908,  908,  908,  908, 1463,  364,  272,  360,  909, 1257,
+      266,  260,  143,  348,  909,  909,  909,  909,  909,  909,
+       55, 1262,  922,  922,  922,  922,  922,  922,  922,  347,
+     1463,  346,  341,  922,  320, 1263,  340,  339,   55,  922,
+      922,  922,  922,  922,  922,  923,  923,  923,  923,  923,
+      923,  923,  338,  337,  336,  335,  923,  334,  333,  332,
+      331, 1263,  923,  923,  923,  923,  923,  923,  601,  924,
+      924,  924,  924,  924,  924,  924,  330,  329,  328,  327,
 
-     1156, 1157, 1157, 1157, 1157, 1157, 1157,  332, 1257,  429,
-      920,  920,  920,  920,  920,  920,  920,  331,  330,  329,
-      328,  920, 1258,  327,  326,  325,  324,  920,  920,  920,
-      920,  920,  920,  265,  921,  921,  921,  921,  921,  921,
-      921,  323,  320,  319,  318,  922,  317,  316, 1258,  315,
-      314,  922,  922,  922,  922,  922,  922,   53,  922,  922,
-      922,  922,  922,  922,  922,  925,  926,  926,  926,  926,
-      926,  926,  313,  312,  311,  310,  927,  309,  308,  307,
-      306,  305,  927,  927,  927,  927,  927,  927,  689,  774,
-      774,  774,  774,  774,  774,  774,  842,  304,  303,  302,
+      925,  326,  433,  323,  322,  321,  925,  925,  925,  925,
+      925,  925, 1155, 1156, 1156, 1156, 1156, 1156, 1156, 1161,
+     1162, 1162, 1162, 1162, 1162, 1162,  320, 1262,  433,  925,
+      925,  925,  925,  925,  925,  925,  319,  318,  317,  316,
+      925, 1463,  315,  314,  313,  312,  925,  925,  925,  925,
+      925,  925,  267,  926,  926,  926,  926,  926,  926,  926,
+      311,  310,  309,  308,  927,  307,  306, 1463,  305,  304,
+      927,  927,  927,  927,  927,  927,   53,  927,  927,  927,
+      927,  927,  927,  927,  930,  931,  931,  931,  931,  931,
+      931,  303,  302,  301,  300,  932,  299,  298,  297,  143,
 
-      775,  301,  300,  299,  298, 1257,  775,  775,  775,  775,
-      775,  775,  928,  929,  929,  929,  929,  929,  929, 1458,
-      297,  296,  295,  930,  142,  294,  293,  292,  291,  930,
-      930,  930,  930,  930,  930,  698,  786,  786,  786,  786,
-      786,  786,  786,  845,  290, 1458,  289,  787,  288,  287,
-      286,  285, 1259,  787,  787,  787,  787,  787,  787,  931,
-      932,  932,  932,  932,  932,  932, 1260,  284,  283,  282,
-      933,  281,  280,  277,  265,  270,  933,  933,  933,  933,
-      933,  933,  709,  801,  801,  801,  801,  801,  801,  801,
-      848,  257, 1260,  256,  802,  255,  254,  253,  252, 1259,
+      296,  932,  932,  932,  932,  932,  932,  694,  779,  779,
+      779,  779,  779,  779,  779,  847,  295,  294,  293,  780,
+      292,  291,  290,  289, 1264,  780,  780,  780,  780,  780,
+      780,  933,  934,  934,  934,  934,  934,  934, 1265,  288,
+      287,  286,  935,  285,  284,  283,  282,  279,  935,  935,
+      935,  935,  935,  935,  703,  791,  791,  791,  791,  791,
+      791,  791,  850,  267, 1265,  272,  792,  259,  258,  257,
+      256, 1264,  792,  792,  792,  792,  792,  792,  936,  937,
+      937,  937,  937,  937,  937, 1463,  255,  254,  253,  938,
+      252,  251,  250,  247,  244,  938,  938,  938,  938,  938,
 
-      802,  802,  802,  802,  802,  802,  934,  935,  935,  935,
-      935,  935,  935, 1458,  251,  250,  249,  936,  248,  245,
-      242,  239,  238,  936,  936,  936,  936,  936,  936,  940,
-      941,  941,  941,  941,  941,  941,  447,  237,  236, 1458,
-      942,  233,  232,  231,  230,  229,  942,  942,  942,  942,
-      942,  942,  853,  945,  945,  945,  945,  945,  945,  945,
-      855,  228,  227,  226,  946,  225,  224,  223,  222,  221,
-      946,  946,  946,  946,  946,  946,  947,  948,  948,  948,
-      948,  948,  948,  447,  220,  219,  218,  949,  214,  213,
-      203,  202,  201,  949,  949,  949,  949,  949,  949,  862,
+      938,  714,  806,  806,  806,  806,  806,  806,  806,  853,
+      241, 1463,  240,  807,  239,  238,  235,  234, 1270,  807,
+      807,  807,  807,  807,  807,  939,  940,  940,  940,  940,
+      940,  940, 1271,  233,  232,  231,  941,  230,  229,  228,
+      227,  226,  941,  941,  941,  941,  941,  941,  945,  946,
+      946,  946,  946,  946,  946,  451,  225,  224, 1271,  947,
+      223,  222,  221,  220,  216,  947,  947,  947,  947,  947,
+      947,  858,  950,  950,  950,  950,  950,  950,  950,  860,
+      215,  205,  204,  951,  203,  200,  199,  194,  193,  951,
+      951,  951,  951,  951,  951,  952,  953,  953,  953,  953,
 
-      957,  957,  957,  957,  957,  957,  957,  864,  198,  197,
-      192,  958,  191,  190,  189,  188,  187,  958,  958,  958,
-      958,  958,  958,  959,  960,  960,  960,  960,  960,  960,
-      447,  186,  185,  184,  961,  180,  179,  178,  177,  176,
-      961,  961,  961,  961,  961,  961,  873,  972,  972,  972,
-      972,  972,  972,  972,  875,  175,  174,  173,  973,  172,
-      171,  170,  169,  168,  973,  973,  973,  973,  973,  973,
-      974,  975,  975,  975,  975,  975,  975,  447,  167,  166,
-      165,  976,  164,  159,  150,  149,  144,  976,  976,  976,
-      976,  976,  976,  885,  988,  988,  988,  988,  988,  988,
+      953,  953,  451,  192,  191,  190,  954,  189,  188,  187,
+      186,  185,  954,  954,  954,  954,  954,  954,  867,  962,
+      962,  962,  962,  962,  962,  962,  869,  181,  180,  179,
+      963,  178,  177,  176,  175,  174,  963,  963,  963,  963,
+      963,  963,  964,  965,  965,  965,  965,  965,  965,  451,
+      173,  172,  171,  966,  170,  169,  168,  167,  166,  966,
+      966,  966,  966,  966,  966,  878,  977,  977,  977,  977,
+      977,  977,  977,  880,  165,  160,  151,  978,  150,  145,
+       59,   47,   45,  978,  978,  978,  978,  978,  978,  979,
+      980,  980,  980,  980,  980,  980,  451, 1463, 1463, 1463,
 
-      988,  887,   59,   47,   45,  989, 1458, 1458, 1458, 1458,
-     1458,  989,  989,  989,  989,  989,  989,  990,  991,  991,
-      991,  991,  991,  991,  447, 1458, 1458, 1458,  992, 1458,
-     1458, 1458, 1458, 1458,  992,  992,  992,  992,  992,  992,
-      814,  999,  999,  999,  999,  999,  999,  999,  816, 1458,
-     1458, 1458, 1000, 1458, 1458, 1458, 1458, 1458, 1000, 1000,
-     1000, 1000, 1000, 1000, 1001, 1002, 1002, 1002, 1002, 1002,
-     1002, 1002, 1003, 1458, 1458, 1458, 1004, 1458, 1005, 1458,
-     1458, 1458, 1004, 1004, 1004, 1004, 1004, 1004, 1159, 1160,
-     1160, 1160, 1160, 1160, 1160, 1163, 1164, 1164, 1164, 1164,
+      981, 1463, 1463, 1463, 1463, 1463,  981,  981,  981,  981,
+      981,  981,  890,  993,  993,  993,  993,  993,  993,  993,
+      892, 1463, 1463, 1463,  994, 1463, 1463, 1463, 1463, 1463,
+      994,  994,  994,  994,  994,  994,  995,  996,  996,  996,
+      996,  996,  996,  451, 1463, 1463, 1463,  997, 1463, 1463,
+     1463, 1463, 1463,  997,  997,  997,  997,  997,  997,  819,
+     1004, 1004, 1004, 1004, 1004, 1004, 1004,  821, 1463, 1463,
+     1463, 1005, 1463, 1463, 1463, 1463, 1463, 1005, 1005, 1005,
+     1005, 1005, 1005, 1006, 1007, 1007, 1007, 1007, 1007, 1007,
+     1007, 1008, 1463, 1463, 1463, 1009, 1463, 1010, 1463, 1463,
 
-     1164, 1164, 1458, 1458, 1005,   55,  596, 1018, 1018, 1018,
-     1018, 1018, 1018, 1018, 1458, 1458, 1458, 1458, 1019, 1458,
-     1458, 1458, 1458,   55, 1019, 1019, 1019, 1019, 1019, 1019,
-       53, 1019, 1019, 1019, 1019, 1019, 1019, 1019,   55,  265,
-     1020, 1020, 1020, 1020, 1020, 1020, 1020, 1170, 1171, 1171,
-     1171, 1171, 1171, 1171, 1458, 1458,   55,  853, 1023, 1023,
-     1023, 1023, 1023, 1023, 1023, 1024, 1458, 1458, 1458, 1025,
-     1458,  857, 1458, 1458, 1458, 1025, 1025, 1025, 1025, 1025,
-     1025, 1173, 1174, 1174, 1174, 1174, 1174, 1174, 1177, 1178,
-     1178, 1178, 1178, 1178, 1178, 1458, 1458,  857,  862, 1026,
+     1463, 1009, 1009, 1009, 1009, 1009, 1009, 1164, 1165, 1165,
+     1165, 1165, 1165, 1165, 1168, 1169, 1169, 1169, 1169, 1169,
+     1169, 1463, 1463, 1010,   55,  601, 1023, 1023, 1023, 1023,
+     1023, 1023, 1023, 1463, 1463, 1463, 1463, 1024, 1463, 1463,
+     1463, 1463,   55, 1024, 1024, 1024, 1024, 1024, 1024,   53,
+     1024, 1024, 1024, 1024, 1024, 1024, 1024,   55,  267, 1025,
+     1025, 1025, 1025, 1025, 1025, 1025, 1175, 1176, 1176, 1176,
+     1176, 1176, 1176, 1463, 1463,   55,  858, 1028, 1028, 1028,
+     1028, 1028, 1028, 1028, 1029, 1463, 1463, 1463, 1030, 1463,
+      862, 1463, 1463, 1463, 1030, 1030, 1030, 1030, 1030, 1030,
 
-     1026, 1026, 1026, 1026, 1026, 1026, 1027, 1458, 1458, 1458,
-     1028, 1458,  866, 1458, 1458, 1458, 1028, 1028, 1028, 1028,
-     1028, 1028, 1184, 1185, 1185, 1185, 1185, 1185, 1185, 1187,
-     1188, 1188, 1188, 1188, 1188, 1188, 1458, 1458,  866,  873,
-     1029, 1029, 1029, 1029, 1029, 1029, 1029, 1030, 1458, 1458,
-     1458, 1031, 1458,  877, 1458, 1458, 1458, 1031, 1031, 1031,
-     1031, 1031, 1031, 1191, 1192, 1192, 1192, 1192, 1192, 1192,
-     1091, 1091, 1091, 1091, 1091, 1091, 1091,   55, 1458,  877,
-      885, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1033, 1458,
-     1265, 1265, 1034, 1458,  889,   55, 1458, 1458, 1034, 1034,
+     1178, 1179, 1179, 1179, 1179, 1179, 1179, 1182, 1183, 1183,
+     1183, 1183, 1183, 1183, 1463, 1463,  862,  867, 1031, 1031,
+     1031, 1031, 1031, 1031, 1031, 1032, 1463, 1463, 1463, 1033,
+     1463,  871, 1463, 1463, 1463, 1033, 1033, 1033, 1033, 1033,
+     1033, 1189, 1190, 1190, 1190, 1190, 1190, 1190, 1192, 1193,
+     1193, 1193, 1193, 1193, 1193, 1463, 1463,  871,  878, 1034,
+     1034, 1034, 1034, 1034, 1034, 1034, 1035, 1463, 1463, 1463,
+     1036, 1463,  882, 1463, 1463, 1463, 1036, 1036, 1036, 1036,
+     1036, 1036, 1196, 1197, 1197, 1197, 1197, 1197, 1197, 1096,
+     1096, 1096, 1096, 1096, 1096, 1096,   55, 1463,  882,  890,
 
-     1034, 1034, 1034, 1034, 1266, 1458, 1214, 1236, 1237, 1237,
-     1237, 1237, 1237, 1237, 1458, 1267, 1458, 1458, 1458, 1267,
-      889, 1036, 1037, 1037, 1037, 1037, 1037, 1037, 1038, 1268,
-     1266, 1458, 1039, 1458, 1458, 1458, 1458, 1458, 1039, 1039,
-     1039, 1039, 1039, 1039, 1040, 1041, 1041, 1041, 1041, 1041,
-     1041, 1041, 1042, 1458, 1458, 1268, 1043, 1458, 1044, 1458,
-     1458, 1458, 1043, 1043, 1043, 1043, 1043, 1043, 1157, 1157,
-     1157, 1157, 1157, 1157, 1157, 1171, 1171, 1171, 1171, 1171,
-     1171, 1171, 1273, 1458, 1044,  853, 1047, 1047, 1047, 1047,
-     1047, 1047, 1047, 1024, 1458, 1458, 1274, 1048, 1458, 1458,
+     1037, 1037, 1037, 1037, 1037, 1037, 1037, 1038, 1463, 1270,
+     1272, 1039, 1463,  894,   55, 1463, 1463, 1039, 1039, 1039,
+     1039, 1039, 1039, 1463, 1273, 1219, 1241, 1242, 1242, 1242,
+     1242, 1242, 1242, 1463, 1272, 1463, 1463, 1463, 1278,  894,
+     1041, 1042, 1042, 1042, 1042, 1042, 1042, 1043, 1463, 1463,
+     1273, 1044, 1279, 1463, 1463, 1463, 1463, 1044, 1044, 1044,
+     1044, 1044, 1044, 1045, 1046, 1046, 1046, 1046, 1046, 1046,
+     1046, 1047, 1463, 1463, 1463, 1048, 1463, 1049, 1279, 1463,
+     1463, 1048, 1048, 1048, 1048, 1048, 1048, 1162, 1162, 1162,
+     1162, 1162, 1162, 1162, 1176, 1176, 1176, 1176, 1176, 1176,
 
-     1458, 1458, 1458, 1048, 1048, 1048, 1048, 1048, 1048, 1049,
-     1050, 1050, 1050, 1050, 1050, 1050, 1050, 1051, 1458, 1458,
-     1458, 1052, 1274, 1053, 1458, 1458, 1273, 1052, 1052, 1052,
-     1052, 1052, 1052, 1185, 1185, 1185, 1185, 1185, 1185, 1185,
-     1458, 1458, 1458, 1458, 1458, 1275, 1458, 1275, 1458, 1053,
-      862, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1027, 1276,
-     1458, 1458, 1059, 1458, 1458, 1458, 1458, 1458, 1059, 1059,
-     1059, 1059, 1059, 1059, 1060, 1061, 1061, 1061, 1061, 1061,
-     1061, 1061, 1062, 1458, 1458, 1276, 1063, 1458, 1064, 1458,
-     1458, 1458, 1063, 1063, 1063, 1063, 1063, 1063, 1281, 1282,
+     1176, 1278, 1463, 1049,  858, 1052, 1052, 1052, 1052, 1052,
+     1052, 1052, 1029, 1463, 1463, 1463, 1053, 1463, 1463, 1463,
+     1463, 1463, 1053, 1053, 1053, 1053, 1053, 1053, 1054, 1055,
+     1055, 1055, 1055, 1055, 1055, 1055, 1056, 1463, 1463, 1463,
+     1057, 1463, 1058, 1463, 1463, 1280, 1057, 1057, 1057, 1057,
+     1057, 1057, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1281,
+     1463, 1463, 1463, 1463, 1280, 1463, 1312, 1463, 1058,  867,
+     1063, 1063, 1063, 1063, 1063, 1063, 1063, 1032, 1463, 1463,
+     1313, 1064, 1463, 1463, 1463, 1281, 1463, 1064, 1064, 1064,
+     1064, 1064, 1064, 1065, 1066, 1066, 1066, 1066, 1066, 1066,
 
-     1282, 1282, 1282, 1282, 1282, 1284, 1285, 1285, 1285, 1285,
-     1285, 1285, 1307, 1458, 1064,  873, 1070, 1070, 1070, 1070,
-     1070, 1070, 1070, 1030, 1458, 1458, 1308, 1071, 1458, 1458,
-     1458, 1458, 1458, 1071, 1071, 1071, 1071, 1071, 1071, 1072,
-     1073, 1073, 1073, 1073, 1073, 1073, 1073, 1074, 1458, 1458,
-     1458, 1075, 1308, 1076, 1458, 1458, 1307, 1075, 1075, 1075,
-     1075, 1075, 1075, 1288, 1289, 1289, 1289, 1289, 1289, 1289,
-     1458, 1313, 1314, 1314, 1314, 1314, 1314, 1314, 1458, 1076,
-      885, 1082, 1082, 1082, 1082, 1082, 1082, 1082, 1033, 1458,
-     1458, 1458, 1083, 1458, 1458, 1458, 1458,   55, 1083, 1083,
+     1066, 1067, 1463, 1463, 1463, 1068, 1313, 1069, 1463, 1463,
+     1463, 1068, 1068, 1068, 1068, 1068, 1068, 1286, 1287, 1287,
+     1287, 1287, 1287, 1287, 1289, 1290, 1290, 1290, 1290, 1290,
+     1290, 1312, 1463, 1069,  878, 1075, 1075, 1075, 1075, 1075,
+     1075, 1075, 1035, 1463, 1463, 1463, 1076, 1463, 1463, 1463,
+     1463, 1463, 1076, 1076, 1076, 1076, 1076, 1076, 1077, 1078,
+     1078, 1078, 1078, 1078, 1078, 1078, 1079, 1463, 1463, 1463,
+     1080, 1463, 1081, 1463, 1463, 1463, 1080, 1080, 1080, 1080,
+     1080, 1080, 1293, 1294, 1294, 1294, 1294, 1294, 1294, 1318,
+     1319, 1319, 1319, 1319, 1319, 1319, 1359, 1463, 1081,  890,
 
-     1083, 1083, 1083, 1083, 1084, 1085, 1085, 1085, 1085, 1085,
-     1085, 1085, 1086,   55, 1458,   55, 1087, 1458, 1088, 1458,
-     1458, 1458, 1087, 1087, 1087, 1087, 1087, 1087, 1296, 1458,
-     1458,   55, 1318, 1319, 1319, 1319, 1319, 1319, 1319, 1458,
-     1458, 1354, 1297, 1458, 1088, 1001, 1099, 1099, 1099, 1099,
-     1099, 1099, 1099, 1003, 1458, 1355, 1458, 1100, 1458, 1458,
-     1458, 1458, 1354, 1100, 1100, 1100, 1100, 1100, 1100, 1101,
-     1102, 1102, 1102, 1102, 1102, 1102, 1458, 1458, 1458, 1458,
-     1103, 1355, 1458, 1458, 1458, 1458, 1103, 1103, 1103, 1103,
-     1103, 1103,   55,  596, 1115, 1115, 1115, 1115, 1115, 1115,
+     1087, 1087, 1087, 1087, 1087, 1087, 1087, 1038, 1463, 1463,
+     1360, 1088, 1463, 1463, 1463, 1463,   55, 1088, 1088, 1088,
+     1088, 1088, 1088, 1089, 1090, 1090, 1090, 1090, 1090, 1090,
+     1090, 1091,   55, 1463,   55, 1092, 1360, 1093, 1463, 1463,
+     1463, 1092, 1092, 1092, 1092, 1092, 1092, 1301, 1463, 1463,
+       55, 1323, 1324, 1324, 1324, 1324, 1324, 1324, 1463, 1463,
+     1359, 1302, 1463, 1093, 1006, 1104, 1104, 1104, 1104, 1104,
+     1104, 1104, 1008, 1463, 1463, 1463, 1105, 1463, 1463, 1463,
+     1463, 1361, 1105, 1105, 1105, 1105, 1105, 1105, 1106, 1107,
+     1107, 1107, 1107, 1107, 1107, 1362, 1463, 1463, 1463, 1108,
 
-     1115, 1458, 1458, 1458, 1458,  922, 1458, 1458, 1458, 1458,
-       55,  922,  922,  922,  922,  922,  922,   53,  922,  922,
-      922,  922,  922,  922,  922,   55,  265, 1020, 1020, 1020,
-     1020, 1020, 1020, 1020, 1321, 1322, 1322, 1322, 1322, 1322,
-     1322, 1458, 1356,   55, 1118, 1119, 1119, 1119, 1119, 1119,
-     1119, 1458, 1458, 1458, 1458, 1120, 1357, 1458, 1458, 1458,
-     1458, 1120, 1120, 1120, 1120, 1120, 1120,  853,  945,  945,
-      945,  945,  945,  945,  945, 1024, 1458, 1458, 1458,  946,
-     1458, 1458, 1357, 1458, 1356,  946,  946,  946,  946,  946,
-      946, 1121, 1122, 1122, 1122, 1122, 1122, 1122, 1458, 1458,
+     1463, 1463, 1463, 1463, 1463, 1108, 1108, 1108, 1108, 1108,
+     1108,   55,  601, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
+     1463, 1362, 1463, 1463,  927, 1463, 1463, 1463, 1463,   55,
+      927,  927,  927,  927,  927,  927,   53,  927,  927,  927,
+      927,  927,  927,  927,   55,  267, 1025, 1025, 1025, 1025,
+     1025, 1025, 1025, 1326, 1327, 1327, 1327, 1327, 1327, 1327,
+     1463, 1361,   55, 1123, 1124, 1124, 1124, 1124, 1124, 1124,
+     1463, 1463, 1463, 1463, 1125, 1463, 1463, 1463, 1463, 1463,
+     1125, 1125, 1125, 1125, 1125, 1125,  858,  950,  950,  950,
+      950,  950,  950,  950, 1029, 1463, 1463, 1463,  951, 1463,
 
-     1458, 1458, 1123, 1458, 1458, 1458, 1458, 1458, 1123, 1123,
-     1123, 1123, 1123, 1123,  862,  957,  957,  957,  957,  957,
-      957,  957, 1027, 1458, 1458, 1458,  958, 1458, 1458, 1458,
-     1458, 1379,  958,  958,  958,  958,  958,  958, 1124, 1125,
-     1125, 1125, 1125, 1125, 1125, 1380, 1458, 1458, 1458, 1126,
-     1458, 1458, 1458, 1458, 1458, 1126, 1126, 1126, 1126, 1126,
-     1126,  873,  972,  972,  972,  972,  972,  972,  972, 1030,
-     1458, 1380, 1458,  973, 1458, 1458, 1458, 1458, 1379,  973,
-      973,  973,  973,  973,  973, 1127, 1128, 1128, 1128, 1128,
-     1128, 1128, 1458, 1458, 1458, 1458, 1129, 1458, 1458, 1458,
+     1463, 1463, 1463, 1384,  951,  951,  951,  951,  951,  951,
+     1126, 1127, 1127, 1127, 1127, 1127, 1127, 1385, 1463, 1463,
+     1463, 1128, 1463, 1463, 1463, 1463, 1463, 1128, 1128, 1128,
+     1128, 1128, 1128,  867,  962,  962,  962,  962,  962,  962,
+      962, 1032, 1463, 1385, 1463,  963, 1463, 1463, 1463, 1463,
+     1384,  963,  963,  963,  963,  963,  963, 1129, 1130, 1130,
+     1130, 1130, 1130, 1130, 1463, 1463, 1463, 1463, 1131, 1463,
+     1463, 1463, 1463, 1463, 1131, 1131, 1131, 1131, 1131, 1131,
+      878,  977,  977,  977,  977,  977,  977,  977, 1035, 1463,
+     1463, 1463,  978, 1463, 1463, 1463, 1463, 1388,  978,  978,
 
-     1458, 1458, 1129, 1129, 1129, 1129, 1129, 1129,  885,  988,
-      988,  988,  988,  988,  988,  988, 1033, 1458, 1458, 1458,
-      989, 1458, 1458, 1458, 1458, 1383,  989,  989,  989,  989,
-      989,  989, 1130, 1131, 1131, 1131, 1131, 1131, 1131, 1384,
-     1458, 1458, 1458, 1132, 1458, 1458, 1458, 1458, 1458, 1132,
-     1132, 1132, 1132, 1132, 1132, 1134, 1135, 1135, 1135, 1135,
-     1135, 1135, 1135, 1136, 1458, 1384, 1458, 1137, 1458, 1138,
-     1458, 1458, 1458, 1137, 1137, 1137, 1137, 1137, 1137, 1327,
-     1328, 1328, 1328, 1328, 1328, 1328, 1330, 1331, 1331, 1331,
-     1331, 1331, 1331, 1383, 1458, 1138, 1040, 1142, 1142, 1142,
+      978,  978,  978,  978, 1132, 1133, 1133, 1133, 1133, 1133,
+     1133, 1389, 1463, 1463, 1463, 1134, 1463, 1463, 1463, 1463,
+     1463, 1134, 1134, 1134, 1134, 1134, 1134,  890,  993,  993,
+      993,  993,  993,  993,  993, 1038, 1463, 1389, 1463,  994,
+     1463, 1463, 1463, 1463, 1388,  994,  994,  994,  994,  994,
+      994, 1135, 1136, 1136, 1136, 1136, 1136, 1136, 1463, 1463,
+     1463, 1463, 1137, 1463, 1463, 1463, 1463, 1463, 1137, 1137,
+     1137, 1137, 1137, 1137, 1139, 1140, 1140, 1140, 1140, 1140,
+     1140, 1140, 1141, 1463, 1463, 1463, 1142, 1463, 1143, 1463,
+     1463, 1463, 1142, 1142, 1142, 1142, 1142, 1142, 1332, 1333,
 
-     1142, 1142, 1142, 1142, 1042, 1458, 1458, 1458, 1143, 1458,
-     1458, 1458, 1458, 1458, 1143, 1143, 1143, 1143, 1143, 1143,
-     1049, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1051, 1458,
-     1458, 1458, 1153, 1458, 1458, 1458, 1458, 1458, 1153, 1153,
-     1153, 1153, 1153, 1153, 1060, 1165, 1165, 1165, 1165, 1165,
-     1165, 1165, 1062, 1458, 1458, 1458, 1166, 1458, 1458, 1458,
-     1458, 1458, 1166, 1166, 1166, 1166, 1166, 1166, 1072, 1179,
-     1179, 1179, 1179, 1179, 1179, 1179, 1074, 1458, 1458, 1458,
-     1180, 1458, 1458, 1458, 1458, 1458, 1180, 1180, 1180, 1180,
-     1180, 1180, 1084, 1193, 1193, 1193, 1193, 1193, 1193, 1193,
+     1333, 1333, 1333, 1333, 1333, 1335, 1336, 1336, 1336, 1336,
+     1336, 1336, 1392, 1463, 1143, 1045, 1147, 1147, 1147, 1147,
+     1147, 1147, 1147, 1047, 1463, 1463, 1393, 1148, 1463, 1463,
+     1463, 1463, 1463, 1148, 1148, 1148, 1148, 1148, 1148, 1054,
+     1157, 1157, 1157, 1157, 1157, 1157, 1157, 1056, 1463, 1463,
+     1463, 1158, 1393, 1463, 1463, 1463, 1463, 1158, 1158, 1158,
+     1158, 1158, 1158, 1065, 1170, 1170, 1170, 1170, 1170, 1170,
+     1170, 1067, 1463, 1463, 1463, 1171, 1463, 1463, 1463, 1463,
+     1463, 1171, 1171, 1171, 1171, 1171, 1171, 1077, 1184, 1184,
+     1184, 1184, 1184, 1184, 1184, 1079, 1463, 1463, 1463, 1185,
 
-     1086, 1458, 1458, 1458, 1194, 1458, 1458, 1458, 1458, 1458,
-     1194, 1194, 1194, 1194, 1194, 1194, 1001, 1202, 1202, 1202,
-     1202, 1202, 1202, 1202, 1003, 1458, 1458, 1458, 1203, 1458,
-     1458, 1458, 1458, 1458, 1203, 1203, 1203, 1203, 1203, 1203,
-     1204, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1206, 1458,
-     1458, 1458, 1207, 1458, 1208, 1458, 1458, 1458, 1207, 1207,
-     1207, 1207, 1207, 1207, 1336, 1337, 1337, 1337, 1337, 1337,
-     1337, 1339, 1340, 1340, 1340, 1340, 1340, 1340, 1458, 1458,
-     1208,   55,  596,  513,  513,  513,  513,  513,  513,  513,
-     1345, 1346, 1346, 1346, 1346, 1346, 1346, 1458, 1387,   55,
+     1463, 1463, 1463, 1463, 1463, 1185, 1185, 1185, 1185, 1185,
+     1185, 1089, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1091,
+     1463, 1463, 1463, 1199, 1463, 1463, 1463, 1463, 1463, 1199,
+     1199, 1199, 1199, 1199, 1199, 1006, 1207, 1207, 1207, 1207,
+     1207, 1207, 1207, 1008, 1463, 1463, 1463, 1208, 1463, 1463,
+     1463, 1463, 1463, 1208, 1208, 1208, 1208, 1208, 1208, 1209,
+     1210, 1210, 1210, 1210, 1210, 1210, 1210, 1211, 1463, 1463,
+     1463, 1212, 1463, 1213, 1463, 1463, 1463, 1212, 1212, 1212,
+     1212, 1212, 1212, 1341, 1342, 1342, 1342, 1342, 1342, 1342,
+     1344, 1345, 1345, 1345, 1345, 1345, 1345, 1463, 1463, 1213,
 
-     1217, 1218, 1218, 1218, 1218, 1218, 1218, 1219, 1458, 1458,
-     1458, 1220, 1388, 1458, 1458, 1458, 1458, 1220, 1220, 1220,
-     1220, 1220, 1220, 1040, 1221, 1221, 1221, 1221, 1221, 1221,
-     1221, 1222, 1458, 1458, 1458, 1223, 1458, 1044, 1388, 1458,
-     1458, 1223, 1223, 1223, 1223, 1223, 1223, 1348, 1349, 1349,
-     1349, 1349, 1349, 1349, 1282, 1282, 1282, 1282, 1282, 1282,
-     1282, 1458, 1458, 1044, 1049, 1224, 1224, 1224, 1224, 1224,
-     1224, 1224, 1225, 1458, 1458, 1458, 1226, 1458, 1053, 1458,
-     1458, 1458, 1226, 1226, 1226, 1226, 1226, 1226, 1373, 1374,
-     1374, 1374, 1374, 1374, 1374, 1319, 1319, 1319, 1319, 1319,
+       55,  601,  518,  518,  518,  518,  518,  518,  518, 1350,
+     1351, 1351, 1351, 1351, 1351, 1351, 1463, 1392,   55, 1222,
+     1223, 1223, 1223, 1223, 1223, 1223, 1224, 1463, 1463, 1463,
+     1225, 1463, 1463, 1463, 1463, 1463, 1225, 1225, 1225, 1225,
+     1225, 1225, 1045, 1226, 1226, 1226, 1226, 1226, 1226, 1226,
+     1227, 1463, 1463, 1463, 1228, 1463, 1049, 1463, 1463, 1463,
+     1228, 1228, 1228, 1228, 1228, 1228, 1353, 1354, 1354, 1354,
+     1354, 1354, 1354, 1287, 1287, 1287, 1287, 1287, 1287, 1287,
+     1463, 1463, 1049, 1054, 1229, 1229, 1229, 1229, 1229, 1229,
+     1229, 1230, 1463, 1463, 1463, 1231, 1463, 1058, 1463, 1463,
 
-     1319, 1319, 1387, 1458, 1053, 1060, 1227, 1227, 1227, 1227,
-     1227, 1227, 1227, 1228, 1458, 1458, 1458, 1229, 1458, 1064,
-     1458, 1458, 1391, 1229, 1229, 1229, 1229, 1229, 1229, 1328,
-     1328, 1328, 1328, 1328, 1328, 1328, 1392, 1458, 1458, 1458,
-     1458, 1391, 1458, 1395, 1458, 1064, 1072, 1230, 1230, 1230,
-     1230, 1230, 1230, 1230, 1231, 1458, 1458, 1396, 1232, 1458,
-     1076, 1458, 1392, 1395, 1232, 1232, 1232, 1232, 1232, 1232,
-     1337, 1337, 1337, 1337, 1337, 1337, 1337, 1458, 1458, 1458,
-     1458, 1458, 1458, 1396, 1458, 1458, 1076, 1084, 1233, 1233,
-     1233, 1233, 1233, 1233, 1233, 1234, 1458, 1458, 1458, 1235,
+     1463, 1231, 1231, 1231, 1231, 1231, 1231, 1378, 1379, 1379,
+     1379, 1379, 1379, 1379, 1324, 1324, 1324, 1324, 1324, 1324,
+     1324, 1463, 1463, 1058, 1065, 1232, 1232, 1232, 1232, 1232,
+     1232, 1232, 1233, 1463, 1463, 1463, 1234, 1463, 1069, 1463,
+     1463, 1463, 1234, 1234, 1234, 1234, 1234, 1234, 1333, 1333,
+     1333, 1333, 1333, 1333, 1333, 1342, 1342, 1342, 1342, 1342,
+     1342, 1342, 1396, 1463, 1069, 1077, 1235, 1235, 1235, 1235,
+     1235, 1235, 1235, 1236, 1463, 1396, 1397, 1237, 1463, 1081,
+     1463, 1463, 1463, 1237, 1237, 1237, 1237, 1237, 1237, 1463,
+     1351, 1351, 1351, 1351, 1351, 1351, 1351, 1463, 1463, 1463,
 
-     1458, 1088, 1458, 1458, 1458, 1235, 1235, 1235, 1235, 1235,
-     1235, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1399, 1400,
-     1400, 1400, 1400, 1400, 1400, 1411, 1458, 1088, 1134, 1238,
-     1238, 1238, 1238, 1238, 1238, 1238, 1136, 1458, 1458, 1412,
-     1239, 1458, 1458, 1458, 1458, 1458, 1239, 1239, 1239, 1239,
-     1239, 1239, 1040, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-     1222, 1458, 1458, 1458, 1247, 1412, 1458, 1458, 1458, 1458,
-     1247, 1247, 1247, 1247, 1247, 1247, 1049, 1253, 1253, 1253,
-     1253, 1253, 1253, 1253, 1225, 1458, 1458, 1458, 1254, 1458,
-     1458, 1458, 1458, 1458, 1254, 1254, 1254, 1254, 1254, 1254,
+     1463, 1463, 1397, 1400, 1463, 1081, 1089, 1238, 1238, 1238,
+     1238, 1238, 1238, 1238, 1239, 1463, 1400, 1401, 1240, 1463,
+     1093, 1463, 1463, 1463, 1240, 1240, 1240, 1240, 1240, 1240,
+     1463, 1404, 1405, 1405, 1405, 1405, 1405, 1405, 1463, 1463,
+     1463, 1463, 1463, 1401, 1416, 1463, 1093, 1139, 1243, 1243,
+     1243, 1243, 1243, 1243, 1243, 1141, 1463, 1463, 1417, 1244,
+     1463, 1463, 1463, 1463, 1463, 1244, 1244, 1244, 1244, 1244,
+     1244, 1045, 1251, 1251, 1251, 1251, 1251, 1251, 1251, 1227,
+     1463, 1463, 1463, 1252, 1417, 1463, 1463, 1463, 1463, 1252,
+     1252, 1252, 1252, 1252, 1252, 1054, 1258, 1258, 1258, 1258,
 
-     1060, 1261, 1261, 1261, 1261, 1261, 1261, 1261, 1228, 1458,
-     1458, 1458, 1262, 1458, 1458, 1458, 1458, 1458, 1262, 1262,
-     1262, 1262, 1262, 1262, 1072, 1269, 1269, 1269, 1269, 1269,
-     1269, 1269, 1231, 1458, 1458, 1458, 1270, 1458, 1458, 1458,
-     1458, 1458, 1270, 1270, 1270, 1270, 1270, 1270, 1084, 1277,
-     1277, 1277, 1277, 1277, 1277, 1277, 1234, 1458, 1458, 1458,
-     1278, 1458, 1458, 1458, 1458, 1458, 1278, 1278, 1278, 1278,
-     1278, 1278, 1204, 1290, 1290, 1290, 1290, 1290, 1290, 1290,
-     1206, 1458, 1458, 1458, 1291, 1458, 1458, 1458, 1458, 1458,
-     1291, 1291, 1291, 1291, 1291, 1291, 1134, 1298, 1298, 1298,
+     1258, 1258, 1258, 1230, 1463, 1463, 1463, 1259, 1463, 1463,
+     1463, 1463, 1463, 1259, 1259, 1259, 1259, 1259, 1259, 1065,
+     1266, 1266, 1266, 1266, 1266, 1266, 1266, 1233, 1463, 1463,
+     1463, 1267, 1463, 1463, 1463, 1463, 1463, 1267, 1267, 1267,
+     1267, 1267, 1267, 1077, 1274, 1274, 1274, 1274, 1274, 1274,
+     1274, 1236, 1463, 1463, 1463, 1275, 1463, 1463, 1463, 1463,
+     1463, 1275, 1275, 1275, 1275, 1275, 1275, 1089, 1282, 1282,
+     1282, 1282, 1282, 1282, 1282, 1239, 1463, 1463, 1463, 1283,
+     1463, 1463, 1463, 1463, 1463, 1283, 1283, 1283, 1283, 1283,
+     1283, 1209, 1295, 1295, 1295, 1295, 1295, 1295, 1295, 1211,
 
-     1298, 1298, 1298, 1298, 1299, 1458, 1458, 1458, 1300, 1458,
-     1138, 1458, 1458, 1411, 1300, 1300, 1300, 1300, 1300, 1300,
-     1402, 1403, 1403, 1403, 1403, 1403, 1403, 1458, 1413, 1414,
-     1414, 1414, 1414, 1414, 1414, 1458, 1138, 1040, 1142, 1142,
-     1142, 1142, 1142, 1142, 1142, 1222, 1458, 1458, 1458, 1143,
-     1458, 1458, 1458, 1458, 1458, 1143, 1143, 1143, 1143, 1143,
-     1143, 1049, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1225,
-     1458, 1458, 1458, 1153, 1458, 1458, 1458, 1458, 1458, 1153,
-     1153, 1153, 1153, 1153, 1153, 1060, 1165, 1165, 1165, 1165,
-     1165, 1165, 1165, 1228, 1458, 1458, 1458, 1166, 1458, 1458,
+     1463, 1463, 1463, 1296, 1463, 1463, 1463, 1463, 1463, 1296,
+     1296, 1296, 1296, 1296, 1296, 1139, 1303, 1303, 1303, 1303,
+     1303, 1303, 1303, 1304, 1463, 1463, 1463, 1305, 1463, 1143,
+     1463, 1463, 1416, 1305, 1305, 1305, 1305, 1305, 1305, 1407,
+     1408, 1408, 1408, 1408, 1408, 1408, 1463, 1418, 1419, 1419,
+     1419, 1419, 1419, 1419, 1463, 1143, 1045, 1147, 1147, 1147,
+     1147, 1147, 1147, 1147, 1227, 1463, 1463, 1463, 1148, 1463,
+     1463, 1463, 1463, 1463, 1148, 1148, 1148, 1148, 1148, 1148,
+     1054, 1157, 1157, 1157, 1157, 1157, 1157, 1157, 1230, 1463,
+     1463, 1463, 1158, 1463, 1463, 1463, 1463, 1463, 1158, 1158,
 
-     1458, 1458, 1458, 1166, 1166, 1166, 1166, 1166, 1166, 1072,
-     1179, 1179, 1179, 1179, 1179, 1179, 1179, 1231, 1458, 1458,
-     1458, 1180, 1458, 1458, 1458, 1458, 1458, 1180, 1180, 1180,
-     1180, 1180, 1180, 1084, 1193, 1193, 1193, 1193, 1193, 1193,
-     1193, 1234, 1458, 1458, 1458, 1194, 1458, 1458, 1458, 1458,
-     1458, 1194, 1194, 1194, 1194, 1194, 1194, 1134, 1309, 1309,
-     1309, 1309, 1309, 1309, 1309, 1299, 1458, 1458, 1458, 1310,
-     1458, 1458, 1458, 1458, 1458, 1310, 1310, 1310, 1310, 1310,
-     1310, 1204, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1206,
-     1458, 1458, 1458, 1359, 1458, 1458, 1458, 1458, 1458, 1359,
+     1158, 1158, 1158, 1158, 1065, 1170, 1170, 1170, 1170, 1170,
+     1170, 1170, 1233, 1463, 1463, 1463, 1171, 1463, 1463, 1463,
+     1463, 1463, 1171, 1171, 1171, 1171, 1171, 1171, 1077, 1184,
+     1184, 1184, 1184, 1184, 1184, 1184, 1236, 1463, 1463, 1463,
+     1185, 1463, 1463, 1463, 1463, 1463, 1185, 1185, 1185, 1185,
+     1185, 1185, 1089, 1198, 1198, 1198, 1198, 1198, 1198, 1198,
+     1239, 1463, 1463, 1463, 1199, 1463, 1463, 1463, 1463, 1463,
+     1199, 1199, 1199, 1199, 1199, 1199, 1139, 1314, 1314, 1314,
+     1314, 1314, 1314, 1314, 1304, 1463, 1463, 1463, 1315, 1463,
+     1463, 1463, 1463, 1463, 1315, 1315, 1315, 1315, 1315, 1315,
 
-     1359, 1359, 1359, 1359, 1359, 1134, 1238, 1238, 1238, 1238,
-     1238, 1238, 1238, 1299, 1458, 1458, 1458, 1239, 1458, 1458,
-     1458, 1458, 1458, 1239, 1239, 1239, 1239, 1239, 1239, 1417,
-     1418, 1418, 1418, 1418, 1418, 1418, 1421, 1422, 1422, 1422,
-     1422, 1422, 1422, 1425, 1426, 1426, 1426, 1426, 1426, 1426,
-     1429, 1430, 1430, 1430, 1430, 1430, 1430, 1400, 1400, 1400,
-     1400, 1400, 1400, 1400, 1433, 1433, 1437, 1438, 1438, 1438,
-     1438, 1438, 1438, 1458, 1458, 1458, 1458, 1458, 1434, 1458,
-     1414, 1414, 1414, 1414, 1414, 1414, 1414, 1418, 1418, 1418,
-     1418, 1418, 1418, 1418, 1422, 1422, 1422, 1422, 1422, 1422,
+     1209, 1363, 1363, 1363, 1363, 1363, 1363, 1363, 1211, 1463,
+     1463, 1463, 1364, 1463, 1463, 1463, 1463, 1463, 1364, 1364,
+     1364, 1364, 1364, 1364, 1139, 1243, 1243, 1243, 1243, 1243,
+     1243, 1243, 1304, 1463, 1463, 1463, 1244, 1463, 1463, 1463,
+     1463, 1463, 1244, 1244, 1244, 1244, 1244, 1244, 1422, 1423,
+     1423, 1423, 1423, 1423, 1423, 1426, 1427, 1427, 1427, 1427,
+     1427, 1427, 1430, 1431, 1431, 1431, 1431, 1431, 1431, 1434,
+     1435, 1435, 1435, 1435, 1435, 1435, 1405, 1405, 1405, 1405,
+     1405, 1405, 1405, 1438, 1438, 1442, 1443, 1443, 1443, 1443,
+     1443, 1443, 1463, 1463, 1463, 1463, 1463, 1439, 1463, 1419,
 
-     1422, 1458, 1458, 1458, 1434, 1458, 1426, 1426, 1426, 1426,
-     1426, 1426, 1426, 1430, 1430, 1430, 1430, 1430, 1430, 1430,
-     1446, 1447, 1447, 1447, 1447, 1447, 1447, 1438, 1438, 1438,
-     1438, 1438, 1438, 1438, 1447, 1447, 1447, 1447, 1447, 1447,
-     1447,   46, 1458, 1458, 1458, 1458,   46,   46,   46,   64,
-     1458,   64,   64,   64,   64,   64,   64,   64,  151, 1458,
-      151,  158,  158,  158,  269,  269,  269,  278,  278,  278,
-      356,  356,  356,  359,  359,  359,  360,  360,  360,  367,
-      367,  367,  365,  365,  365,  371,  371,  371,  375, 1458,
-      375,  437,  437,  437,  442,  442,  442,  443,  443,  443,
+     1419, 1419, 1419, 1419, 1419, 1419, 1423, 1423, 1423, 1423,
+     1423, 1423, 1423, 1427, 1427, 1427, 1427, 1427, 1427, 1427,
+     1463, 1463, 1463, 1439, 1463, 1431, 1431, 1431, 1431, 1431,
+     1431, 1431, 1435, 1435, 1435, 1435, 1435, 1435, 1435, 1451,
+     1452, 1452, 1452, 1452, 1452, 1452, 1443, 1443, 1443, 1443,
+     1443, 1443, 1443, 1452, 1452, 1452, 1452, 1452, 1452, 1452,
+       46, 1463, 1463, 1463, 1463,   46,   46,   46,   64, 1463,
+       64,   64,   64,   64,   64,   64,   64,  152, 1463,  152,
+      159,  159,  159,  271,  271,  271,  280,  280,  280,  359,
+      359,  359,  362,  362,  362,  363,  363,  363,  370,  370,
 
-      452,  452,  452,  456, 1458,  456,  457,  457,  457,  369,
-      369, 1458, 1458,  369,  461,  461,  461,  465,  465,  465,
-      359,  359,  359,  520,  520,  520,  524,  524,  524,  525,
-      525,  525,  526,  526,  526,  367,  367,  367,  531,  531,
-      531,  450,  450, 1458, 1458,  450,  536,  536,  536,  540,
-      540,  540,  544, 1458,  544,  545,  545,  545,  549,  549,
-      549,  553, 1458,  553,  601,  601,  601,  452,  452,  452,
-      609,  609,  609,  610,  610,  610,  618,  618,  618,  622,
-     1458,  622,  625, 1458,  625,  626,  626,  626,  630,  630,
-      630,  634, 1458,  634,  543,  543, 1458, 1458,  543,  547,
+      370,  368,  368,  368,  374,  374,  374,  378, 1463,  378,
+      441,  441,  441,  446,  446,  446,  447,  447,  447,  456,
+      456,  456,  460, 1463,  460,  461,  461,  461,  372,  372,
+     1463, 1463,  372,  465,  465,  465,  469,  469,  469,  362,
+      362,  362,  525,  525,  525,  529,  529,  529,  530,  530,
+      530,  531,  531,  531,  370,  370,  370,  536,  536,  536,
+      454,  454, 1463, 1463,  454,  541,  541,  541,  545,  545,
+      545,  549, 1463,  549,  550,  550,  550,  554,  554,  554,
+      558, 1463,  558,  606,  606,  606,  456,  456,  456,  614,
+      614,  614,  615,  615,  615,  623,  623,  623,  627, 1463,
 
-      547, 1458, 1458,  547,  640,  640,  640,  644,  644,  644,
-      553,  553, 1458,  553,  525,  525,  525,  678,  678,  678,
-      682,  682,  682,  685,  685,  685,  686,  686,  686,  687,
-      687,  687,  692,  692,  692,  616,  616, 1458, 1458,  616,
-      697,  697,  697,  701,  701,  701,  622,  622, 1458,  622,
-      624,  624, 1458, 1458,  624,  625,  625, 1458,  625,  626,
-      626,  628,  628, 1458, 1458,  628,  708,  708,  708,  712,
-      712,  712,  634,  634, 1458,  634,  716, 1458,  716,  719,
-     1458,  719,  720,  720,  720,  724,  724,  724,  728, 1458,
-      728,  755,  755,  755,  618,  618,  618,  630,  630,  630,
+      627,  630, 1463,  630,  631,  631,  631,  635,  635,  635,
+      639, 1463,  639,  548,  548, 1463, 1463,  548,  552,  552,
+     1463, 1463,  552,  645,  645,  645,  649,  649,  649,  558,
+      558, 1463,  558,  530,  530,  530,  683,  683,  683,  687,
+      687,  687,  690,  690,  690,  691,  691,  691,  692,  692,
+      692,  697,  697,  697,  621,  621, 1463, 1463,  621,  702,
+      702,  702,  706,  706,  706,  627,  627, 1463,  627,  629,
+      629, 1463, 1463,  629,  630,  630, 1463,  630,  631,  631,
+      633,  633, 1463, 1463,  633,  713,  713,  713,  717,  717,
+      717,  639,  639, 1463,  639,  721, 1463,  721,  724, 1463,
 
-      766,  766,  766,  767,  767,  767,  775,  775,  775,  779,
-     1458,  779,  782, 1458,  782,  783,  783,  783,  787,  787,
-      787,  791, 1458,  791,  794, 1458,  794,  797, 1458,  797,
-      798,  798,  798,  802,  802,  802,  806, 1458,  806,  715,
-     1458, 1458,  715,  716,  716, 1458,  716,  718,  718, 1458,
-     1458,  718,  719,  719, 1458,  719,  720,  720,  722,  722,
-     1458, 1458,  722,  813,  813,  813,  817,  817,  817,  728,
-      728, 1458,  728,   53,   53,   53, 1458,   53,   53,  686,
-      686,  686,  839,  839,  839,  843,  843,  843,  846,  846,
-      846,  849,  849,  849,  850,  850,  850,  851,  851,  851,
+      724,  725,  725,  725,  729,  729,  729,  733, 1463,  733,
+      760,  760,  760,  623,  623,  623,  635,  635,  635,  771,
+      771,  771,  772,  772,  772,  780,  780,  780,  784, 1463,
+      784,  787, 1463,  787,  788,  788,  788,  792,  792,  792,
+      796, 1463,  796,  799, 1463,  799,  802, 1463,  802,  803,
+      803,  803,  807,  807,  807,  811, 1463,  811,  720, 1463,
+     1463,  720,  721,  721, 1463,  721,  723,  723, 1463, 1463,
+      723,  724,  724, 1463,  724,  725,  725,  727,  727, 1463,
+     1463,  727,  818,  818,  818,  822,  822,  822,  733,  733,
+     1463,  733,   53,   53,   53, 1463,   53,   53,  691,  691,
 
-      856,  856,  856,  773,  773, 1458, 1458,  773,  861,  861,
-      861,  865,  865,  865,  779,  779, 1458,  779,  781,  781,
-     1458, 1458,  781,  782,  782, 1458,  782,  783,  783,  785,
-      785, 1458, 1458,  785,  872,  872,  872,  876,  876,  876,
-      791,  791, 1458,  791,  793, 1458, 1458,  793,  794,  794,
-     1458,  794,  796,  796, 1458, 1458,  796,  797,  797, 1458,
-      797,  798,  798,  800,  800, 1458, 1458,  800,  884,  884,
-      884,  888,  888,  888,  806,  806, 1458,  806,  890, 1458,
-      890,  893, 1458,  893,  896, 1458,  896,  897,  897,  897,
-      901,  901,  901,  905, 1458,  905,   53,   53,   53, 1458,
+      691,  844,  844,  844,  848,  848,  848,  851,  851,  851,
+      854,  854,  854,  855,  855,  855,  856,  856,  856,  861,
+      861,  861,  778,  778, 1463, 1463,  778,  866,  866,  866,
+      870,  870,  870,  784,  784, 1463,  784,  786,  786, 1463,
+     1463,  786,  787,  787, 1463,  787,  788,  788,  790,  790,
+     1463, 1463,  790,  877,  877,  877,  881,  881,  881,  796,
+      796, 1463,  796,  798, 1463, 1463,  798,  799,  799, 1463,
+      799,  801,  801, 1463, 1463,  801,  802,  802, 1463,  802,
+      803,  803,  805,  805, 1463, 1463,  805,  889,  889,  889,
+      893,  893,  893,  811,  811, 1463,  811,  895, 1463,  895,
 
-       53,   53,  923,  923,  923,  775,  775,  775,  787,  787,
-      787,  802,  802,  802,  937,  937,  937,  938,  938,  938,
-      946,  946,  946,  950, 1458,  950,  953, 1458,  953,  954,
-      954,  954,  958,  958,  958,  962, 1458,  962,  965, 1458,
-      965,  968, 1458,  968,  969,  969,  969,  973,  973,  973,
-      977, 1458,  977,  978, 1458,  978,  981, 1458,  981,  984,
-     1458,  984,  985,  985,  985,  989,  989,  989,  993, 1458,
-      993,  890, 1458,  890,  892, 1458, 1458,  892,  893,  893,
-     1458,  893,  895,  895, 1458, 1458,  895,  896,  896, 1458,
-      896,  897,  897,  899,  899, 1458, 1458,  899, 1000, 1000,
+      898, 1463,  898,  901, 1463,  901,  902,  902,  902,  906,
+      906,  906,  910, 1463,  910,   53,   53,   53, 1463,   53,
+       53,  928,  928,  928,  780,  780,  780,  792,  792,  792,
+      807,  807,  807,  942,  942,  942,  943,  943,  943,  951,
+      951,  951,  955, 1463,  955,  958, 1463,  958,  959,  959,
+      959,  963,  963,  963,  967, 1463,  967,  970, 1463,  970,
+      973, 1463,  973,  974,  974,  974,  978,  978,  978,  982,
+     1463,  982,  983, 1463,  983,  986, 1463,  986,  989, 1463,
+      989,  990,  990,  990,  994,  994,  994,  998, 1463,  998,
+      895, 1463,  895,  897, 1463, 1463,  897,  898,  898, 1463,
 
-     1000, 1004, 1004, 1004,  905,  905, 1458,  905,   53,   53,
-       53, 1458,   53,   53,  850,  850,  850, 1021, 1021, 1021,
-     1025, 1025, 1025, 1028, 1028, 1028, 1031, 1031, 1031, 1034,
-     1034, 1034, 1035, 1035, 1035, 1043, 1043, 1043,  944,  944,
-     1458, 1458,  944, 1048, 1048, 1048, 1052, 1052, 1052,  950,
-      950, 1458,  950,  952,  952, 1458, 1458,  952,  953,  953,
-     1458,  953,  954,  954,  956,  956, 1458, 1458,  956, 1059,
-     1059, 1059, 1063, 1063, 1063,  962,  962, 1458,  962,  964,
-     1458, 1458,  964,  965,  965, 1458,  965,  967,  967, 1458,
-     1458,  967,  968,  968, 1458,  968,  969,  969,  971,  971,
+      898,  900,  900, 1463, 1463,  900,  901,  901, 1463,  901,
+      902,  902,  904,  904, 1463, 1463,  904, 1005, 1005, 1005,
+     1009, 1009, 1009,  910,  910, 1463,  910,   53,   53,   53,
+     1463,   53,   53,  855,  855,  855, 1026, 1026, 1026, 1030,
+     1030, 1030, 1033, 1033, 1033, 1036, 1036, 1036, 1039, 1039,
+     1039, 1040, 1040, 1040, 1048, 1048, 1048,  949,  949, 1463,
+     1463,  949, 1053, 1053, 1053, 1057, 1057, 1057,  955,  955,
+     1463,  955,  957,  957, 1463, 1463,  957,  958,  958, 1463,
+      958,  959,  959,  961,  961, 1463, 1463,  961, 1064, 1064,
+     1064, 1068, 1068, 1068,  967,  967, 1463,  967,  969, 1463,
 
-     1458, 1458,  971, 1071, 1071, 1071, 1075, 1075, 1075,  977,
-      977, 1458,  977,  978, 1458,  978,  980, 1458, 1458,  980,
-      981,  981, 1458,  981,  983,  983, 1458, 1458,  983,  984,
-      984, 1458,  984,  985,  985,  987,  987, 1458, 1458,  987,
-     1083, 1083, 1083, 1087, 1087, 1087,  993,  993, 1458,  993,
-     1089, 1458, 1089, 1092, 1458, 1092, 1095, 1458, 1095, 1096,
-     1096, 1096, 1100, 1100, 1100, 1104, 1458, 1104,   53,   53,
-       53, 1458,   53,   53, 1116, 1116, 1116,  946,  946,  946,
-      958,  958,  958,  973,  973,  973,  989,  989,  989, 1133,
-     1133, 1133, 1139, 1139, 1139, 1137, 1137, 1137, 1144, 1144,
+     1463,  969,  970,  970, 1463,  970,  972,  972, 1463, 1463,
+      972,  973,  973, 1463,  973,  974,  974,  976,  976, 1463,
+     1463,  976, 1076, 1076, 1076, 1080, 1080, 1080,  982,  982,
+     1463,  982,  983, 1463,  983,  985, 1463, 1463,  985,  986,
+      986, 1463,  986,  988,  988, 1463, 1463,  988,  989,  989,
+     1463,  989,  990,  990,  992,  992, 1463, 1463,  992, 1088,
+     1088, 1088, 1092, 1092, 1092,  998,  998, 1463,  998, 1094,
+     1463, 1094, 1097, 1463, 1097, 1100, 1463, 1100, 1101, 1101,
+     1101, 1105, 1105, 1105, 1109, 1463, 1109,   53,   53,   53,
+     1463,   53,   53, 1121, 1121, 1121,  951,  951,  951,  963,
 
-     1144, 1143, 1143, 1143, 1145, 1458, 1145, 1148, 1458, 1148,
-     1149, 1149, 1149, 1154, 1154, 1154, 1153, 1153, 1153, 1155,
-     1458, 1155, 1158, 1458, 1158, 1161, 1458, 1161, 1162, 1162,
-     1162, 1167, 1167, 1167, 1166, 1166, 1166, 1168, 1458, 1168,
-     1169, 1458, 1169, 1172, 1458, 1172, 1175, 1458, 1175, 1176,
-     1176, 1176, 1181, 1181, 1181, 1180, 1180, 1180, 1182, 1458,
-     1182, 1183, 1458, 1183, 1186, 1458, 1186, 1189, 1458, 1189,
-     1190, 1190, 1190, 1195, 1195, 1195, 1194, 1194, 1194, 1196,
-     1458, 1196, 1089, 1458, 1089, 1091, 1458, 1458, 1091, 1092,
-     1092, 1458, 1092, 1094, 1094, 1458, 1458, 1094, 1095, 1095,
+      963,  963,  978,  978,  978,  994,  994,  994, 1138, 1138,
+     1138, 1144, 1144, 1144, 1142, 1142, 1142, 1149, 1149, 1149,
+     1148, 1148, 1148, 1150, 1463, 1150, 1153, 1463, 1153, 1154,
+     1154, 1154, 1159, 1159, 1159, 1158, 1158, 1158, 1160, 1463,
+     1160, 1163, 1463, 1163, 1166, 1463, 1166, 1167, 1167, 1167,
+     1172, 1172, 1172, 1171, 1171, 1171, 1173, 1463, 1173, 1174,
+     1463, 1174, 1177, 1463, 1177, 1180, 1463, 1180, 1181, 1181,
+     1181, 1186, 1186, 1186, 1185, 1185, 1185, 1187, 1463, 1187,
+     1188, 1463, 1188, 1191, 1463, 1191, 1194, 1463, 1194, 1195,
+     1195, 1195, 1200, 1200, 1200, 1199, 1199, 1199, 1201, 1463,
 
-     1458, 1095, 1096, 1096, 1098, 1098, 1458, 1458, 1098, 1203,
-     1203, 1203, 1207, 1207, 1207, 1104, 1104, 1458, 1104,   53,
-       53,   53, 1458,   53,   53, 1035, 1035, 1035, 1223, 1223,
-     1223, 1226, 1226, 1226, 1229, 1229, 1229, 1232, 1232, 1232,
-     1235, 1235, 1235, 1240, 1240, 1240, 1239, 1239, 1239, 1242,
-     1458, 1242, 1243, 1243, 1243, 1141, 1141, 1458, 1458, 1141,
-     1247, 1247, 1247, 1248, 1248, 1248, 1145, 1145, 1458, 1145,
-     1147, 1147, 1458, 1458, 1147, 1148, 1148, 1458, 1148, 1149,
-     1149, 1151, 1151, 1458, 1458, 1151, 1254, 1254, 1254, 1255,
-     1255, 1255, 1155, 1155, 1458, 1155, 1157, 1458, 1458, 1157,
+     1201, 1094, 1463, 1094, 1096, 1463, 1463, 1096, 1097, 1097,
+     1463, 1097, 1099, 1099, 1463, 1463, 1099, 1100, 1100, 1463,
+     1100, 1101, 1101, 1103, 1103, 1463, 1463, 1103, 1208, 1208,
+     1208, 1212, 1212, 1212, 1109, 1109, 1463, 1109,   53,   53,
+       53, 1463,   53,   53, 1040, 1040, 1040, 1228, 1228, 1228,
+     1231, 1231, 1231, 1234, 1234, 1234, 1237, 1237, 1237, 1240,
+     1240, 1240, 1245, 1245, 1245, 1244, 1244, 1244, 1247, 1463,
+     1247, 1248, 1248, 1248, 1146, 1146, 1463, 1463, 1146, 1252,
+     1252, 1252, 1253, 1253, 1253, 1150, 1150, 1463, 1150, 1152,
+     1152, 1463, 1463, 1152, 1153, 1153, 1463, 1153, 1154, 1154,
 
-     1158, 1158, 1458, 1158, 1160, 1160, 1458, 1458, 1160, 1161,
-     1161, 1458, 1161, 1162, 1162, 1164, 1164, 1458, 1458, 1164,
-     1262, 1262, 1262, 1263, 1263, 1263, 1168, 1168, 1458, 1168,
-     1169, 1458, 1169, 1171, 1458, 1458, 1171, 1172, 1172, 1458,
-     1172, 1174, 1174, 1458, 1458, 1174, 1175, 1175, 1458, 1175,
-     1176, 1176, 1178, 1178, 1458, 1458, 1178, 1270, 1270, 1270,
-     1271, 1271, 1271, 1182, 1182, 1458, 1182, 1183, 1458, 1183,
-     1185, 1458, 1458, 1185, 1186, 1186, 1458, 1186, 1188, 1188,
-     1458, 1458, 1188, 1189, 1189, 1458, 1189, 1190, 1190, 1192,
-     1192, 1458, 1458, 1192, 1278, 1278, 1278, 1279, 1279, 1279,
+     1156, 1156, 1463, 1463, 1156, 1259, 1259, 1259, 1260, 1260,
+     1260, 1160, 1160, 1463, 1160, 1162, 1463, 1463, 1162, 1163,
+     1163, 1463, 1163, 1165, 1165, 1463, 1463, 1165, 1166, 1166,
+     1463, 1166, 1167, 1167, 1169, 1169, 1463, 1463, 1169, 1267,
+     1267, 1267, 1268, 1268, 1268, 1173, 1173, 1463, 1173, 1174,
+     1463, 1174, 1176, 1463, 1463, 1176, 1177, 1177, 1463, 1177,
+     1179, 1179, 1463, 1463, 1179, 1180, 1180, 1463, 1180, 1181,
+     1181, 1183, 1183, 1463, 1463, 1183, 1275, 1275, 1275, 1276,
+     1276, 1276, 1187, 1187, 1463, 1187, 1188, 1463, 1188, 1190,
+     1463, 1463, 1190, 1191, 1191, 1463, 1191, 1193, 1193, 1463,
 
-     1196, 1196, 1458, 1196, 1280, 1458, 1280, 1283, 1458, 1283,
-     1286, 1458, 1286, 1287, 1287, 1287, 1292, 1458, 1292, 1291,
-     1291, 1291, 1293, 1458, 1293,   53,   53,   53, 1458,   53,
-       53, 1301, 1458, 1301, 1300, 1300, 1300, 1302, 1458, 1302,
-     1143, 1143, 1143, 1303, 1458, 1303, 1153, 1153, 1153, 1304,
-     1458, 1304, 1166, 1166, 1166, 1305, 1458, 1305, 1180, 1180,
-     1180, 1306, 1458, 1306, 1194, 1194, 1194, 1237, 1237, 1458,
-     1458, 1237, 1310, 1310, 1310, 1311, 1311, 1311,  367,  367,
-      367, 1242, 1242, 1458, 1242, 1312, 1312, 1312, 1315, 1458,
-     1315, 1316, 1316, 1316, 1317, 1317, 1317, 1320, 1458, 1320,
+     1463, 1193, 1194, 1194, 1463, 1194, 1195, 1195, 1197, 1197,
+     1463, 1463, 1197, 1283, 1283, 1283, 1284, 1284, 1284, 1201,
+     1201, 1463, 1201, 1285, 1463, 1285, 1288, 1463, 1288, 1291,
+     1463, 1291, 1292, 1292, 1292, 1297, 1463, 1297, 1296, 1296,
+     1296, 1298, 1463, 1298,   53,   53,   53, 1463,   53,   53,
+     1306, 1463, 1306, 1305, 1305, 1305, 1307, 1463, 1307, 1148,
+     1148, 1148, 1308, 1463, 1308, 1158, 1158, 1158, 1309, 1463,
+     1309, 1171, 1171, 1171, 1310, 1463, 1310, 1185, 1185, 1185,
+     1311, 1463, 1311, 1199, 1199, 1199, 1242, 1242, 1463, 1463,
+     1242, 1315, 1315, 1315, 1316, 1316, 1316,  370,  370,  370,
 
-     1323, 1458, 1323, 1324, 1324, 1324, 1325, 1325, 1325, 1326,
-     1458, 1326, 1329, 1458, 1329, 1332, 1458, 1332, 1333, 1333,
-     1333, 1334, 1334, 1334, 1335, 1458, 1335, 1338, 1458, 1338,
-     1341, 1458, 1341, 1342, 1342, 1342, 1343, 1343, 1343, 1344,
-     1458, 1344, 1347, 1458, 1347, 1350, 1458, 1350, 1351, 1351,
-     1351, 1352, 1352, 1352, 1280, 1458, 1280, 1282, 1458, 1458,
-     1282, 1283, 1283, 1458, 1283, 1285, 1285, 1458, 1458, 1285,
-     1286, 1286, 1458, 1286, 1287, 1287, 1289, 1289, 1458, 1458,
-     1289, 1359, 1359, 1359, 1360, 1458, 1360, 1293, 1293, 1458,
-     1293,   53,   53,   53, 1458,   53,   53, 1365, 1365, 1365,
+     1247, 1247, 1463, 1247, 1317, 1317, 1317, 1320, 1463, 1320,
+     1321, 1321, 1321, 1322, 1322, 1322, 1325, 1463, 1325, 1328,
+     1463, 1328, 1329, 1329, 1329, 1330, 1330, 1330, 1331, 1463,
+     1331, 1334, 1463, 1334, 1337, 1463, 1337, 1338, 1338, 1338,
+     1339, 1339, 1339, 1340, 1463, 1340, 1343, 1463, 1343, 1346,
+     1463, 1346, 1347, 1347, 1347, 1348, 1348, 1348, 1349, 1463,
+     1349, 1352, 1463, 1352, 1355, 1463, 1355, 1356, 1356, 1356,
+     1357, 1357, 1357, 1285, 1463, 1285, 1287, 1463, 1463, 1287,
+     1288, 1288, 1463, 1288, 1290, 1290, 1463, 1463, 1290, 1291,
+     1291, 1463, 1291, 1292, 1292, 1294, 1294, 1463, 1463, 1294,
 
-     1239, 1239, 1239, 1367, 1458, 1367, 1368, 1458, 1368, 1369,
-     1458, 1369, 1370, 1458, 1370, 1371, 1458, 1371, 1372, 1458,
-     1372, 1375, 1458, 1375, 1376, 1376, 1376, 1377, 1377, 1377,
-     1378, 1458, 1378, 1314, 1314, 1458, 1458, 1314, 1315, 1315,
-     1458, 1315, 1316, 1316, 1381, 1458, 1381, 1319, 1458, 1458,
-     1319, 1320, 1320, 1458, 1320, 1322, 1322, 1458, 1458, 1322,
-     1323, 1323, 1458, 1323, 1324, 1324, 1385, 1458, 1385, 1326,
-     1458, 1326, 1328, 1458, 1458, 1328, 1329, 1329, 1458, 1329,
-     1331, 1331, 1458, 1458, 1331, 1332, 1332, 1458, 1332, 1333,
-     1333, 1389, 1458, 1389, 1335, 1458, 1335, 1337, 1458, 1458,
+     1364, 1364, 1364, 1365, 1463, 1365, 1298, 1298, 1463, 1298,
+       53,   53,   53, 1463,   53,   53, 1370, 1370, 1370, 1244,
+     1244, 1244, 1372, 1463, 1372, 1373, 1463, 1373, 1374, 1463,
+     1374, 1375, 1463, 1375, 1376, 1463, 1376, 1377, 1463, 1377,
+     1380, 1463, 1380, 1381, 1381, 1381, 1382, 1382, 1382, 1383,
+     1463, 1383, 1319, 1319, 1463, 1463, 1319, 1320, 1320, 1463,
+     1320, 1321, 1321, 1386, 1463, 1386, 1324, 1463, 1463, 1324,
+     1325, 1325, 1463, 1325, 1327, 1327, 1463, 1463, 1327, 1328,
+     1328, 1463, 1328, 1329, 1329, 1390, 1463, 1390, 1331, 1463,
+     1331, 1333, 1463, 1463, 1333, 1334, 1334, 1463, 1334, 1336,
 
-     1337, 1338, 1338, 1458, 1338, 1340, 1340, 1458, 1458, 1340,
-     1341, 1341, 1458, 1341, 1342, 1342, 1393, 1458, 1393, 1344,
-     1458, 1344, 1346, 1458, 1458, 1346, 1347, 1347, 1458, 1347,
-     1349, 1349, 1458, 1458, 1349, 1350, 1350, 1458, 1350, 1351,
-     1351, 1397, 1458, 1397, 1398, 1458, 1398, 1401, 1458, 1401,
-     1404, 1458, 1404, 1405, 1405, 1405, 1406, 1458, 1406,   53,
-       53,   53, 1458,   53,   53, 1410, 1458, 1410, 1312, 1458,
-     1312, 1317, 1458, 1317, 1325, 1458, 1325, 1334, 1458, 1334,
-     1343, 1458, 1343, 1352, 1458, 1352, 1374, 1374, 1458, 1458,
-     1374, 1375, 1375, 1458, 1375, 1376, 1376, 1366, 1458, 1366,
+     1336, 1463, 1463, 1336, 1337, 1337, 1463, 1337, 1338, 1338,
+     1394, 1463, 1394, 1340, 1463, 1340, 1342, 1463, 1463, 1342,
+     1343, 1343, 1463, 1343, 1345, 1345, 1463, 1463, 1345, 1346,
+     1346, 1463, 1346, 1347, 1347, 1398, 1463, 1398, 1349, 1463,
+     1349, 1351, 1463, 1463, 1351, 1352, 1352, 1463, 1352, 1354,
+     1354, 1463, 1463, 1354, 1355, 1355, 1463, 1355, 1356, 1356,
+     1402, 1463, 1402, 1403, 1463, 1403, 1406, 1463, 1406, 1409,
+     1463, 1409, 1410, 1410, 1410, 1411, 1463, 1411,   53,   53,
+       53, 1463,   53,   53, 1415, 1463, 1415, 1317, 1463, 1317,
+     1322, 1463, 1322, 1330, 1463, 1330, 1339, 1463, 1339, 1348,
 
-     1415, 1458, 1415, 1416, 1458, 1416, 1419, 1458, 1419, 1420,
-     1458, 1420, 1423, 1458, 1423, 1424, 1458, 1424, 1427, 1458,
-     1427, 1428, 1458, 1428, 1431, 1458, 1431, 1400, 1458, 1458,
-     1400, 1403, 1403, 1458, 1458, 1403, 1435, 1458, 1435, 1377,
-     1458, 1377, 1439, 1458, 1439, 1414, 1458, 1458, 1414, 1418,
-     1458, 1458, 1418, 1422, 1458, 1458, 1422, 1426, 1458, 1458,
-     1426, 1430, 1458, 1458, 1430, 1445, 1458, 1445, 1448, 1458,
-     1448, 1438, 1458, 1458, 1438, 1450, 1458, 1450, 1451, 1458,
-     1451, 1452, 1458, 1452, 1453, 1458, 1453, 1454, 1458, 1454,
-     1447, 1458, 1458, 1447, 1456, 1458, 1456, 1457, 1458, 1457,
+     1463, 1348, 1357, 1463, 1357, 1379, 1379, 1463, 1463, 1379,
+     1380, 1380, 1463, 1380, 1381, 1381, 1371, 1463, 1371, 1420,
+     1463, 1420, 1421, 1463, 1421, 1424, 1463, 1424, 1425, 1463,
+     1425, 1428, 1463, 1428, 1429, 1463, 1429, 1432, 1463, 1432,
+     1433, 1463, 1433, 1436, 1463, 1436, 1405, 1463, 1463, 1405,
+     1408, 1408, 1463, 1463, 1408, 1440, 1463, 1440, 1382, 1463,
+     1382, 1444, 1463, 1444, 1419, 1463, 1463, 1419, 1423, 1463,
+     1463, 1423, 1427, 1463, 1463, 1427, 1431, 1463, 1463, 1431,
+     1435, 1463, 1463, 1435, 1450, 1463, 1450, 1453, 1463, 1453,
+     1443, 1463, 1463, 1443, 1455, 1463, 1455, 1456, 1463, 1456,
 
-        3, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458
+     1457, 1463, 1457, 1458, 1463, 1458, 1459, 1463, 1459, 1452,
+     1463, 1463, 1452, 1461, 1463, 1461, 1462, 1463, 1462,    3,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463
     } ;
 
-static yyconst flex_int16_t yy_chk[7455] =
+static yyconst flex_int16_t yy_chk[7474] =
     {   0,
         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,    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,    4,    7,   15,    4,    7,    4,    7,
-        9,    4,    7,    9,   34,    9,   17,   17,    9,   19,
-       19,    4,    7,   34,   24,   27,   27,  105,    9,    4,
-        7,   15,   12,  105,  133,   12,    9,   12,   24,   23,
-       12,   23,   23,   26,   28,   24,   23,   26, 1242,   28,
+        1,    1,    1,    4,   15,  106,    4,    7,    4,    4,
+        7,  106,    7,    7,    9,   17,   17,    9,  138,    9,
+        9,    4,   19,   19,   24,    7,   27,   27,  138,    4,
+       15,   10,    9,    7,   10,  102,   10,   10,   24,   28,
+        9,   34,   26, 1240,   28,   24,   26,  653,   94,   10,
 
-       12,   23,  133,   26,   29,   23,   26,   23,   12,   14,
-       14,   14,   14,   14,   14,   14,   14,   14,   14,   94,
-       29,   94,   14,   14,   14,  265,  265,   14,   14,   14,
+       34,   94,   26,  653,   95,   26,   95,   10,   14,   14,
+       14,   14,   14,   14,   14,   14,   14,   14,  102,   98,
+     1244,   14,   14,   14,   98,   83,   14,   14,   14,   14,
        14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
        14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
-       14,   14,   16,   36,   25,   16, 1243,   16,   36,   36,
-       16,   36,   36,   93,   25,  101,   93,   25,   97,   22,
-       16,   25,   22,   97,   22,  431,  431,   22,   16,   20,
-       20,   20,   20,   20,   20,   20,   20,   22,   33,   30,
-      137,   30,   33,   20,   35,   22,   30,   30,  101,   30,
+       14,   16,   83,   25,   16, 1245,   16,   16,   83,  129,
+       29, 1246,  107,   25,   29,  252,   25,  107,   22,   16,
+       25,   22,  129,   22,   22,  103,   29,   16,   20,   20,
+       20,   20,   20,   20,   20,   20,   22,  134,   23,  252,
+       23,   23,   20,  655,   22,   23,  655,  251,   35,  251,
 
-      137,   33,   33,   30,   41,   33,   35,   33,   35,  106,
-       35,  250,   41,   35,  106,  249,   41,  249,   41,   20,
-       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-       32,   32, 1247,   21,   83,  250,   39,  102,   39,   21,
-       21,   21,   21,   21,   21,   31,   32, 1248,   31,   31,
-       32,   31,   39,   31,   32,   31,   32,   31,   37,   39,
-       31,   83,   37,   32,  102,  128,   38,   83,  109,  102,
-       37,  109,   38,  109,   38,   37,   38,   37,  128,  135,
-       38,   44,   38,   38,   44,  655,   44,  655,  135,   44,
-       62,   62,   62,   62,   62,   62,   62,   63,  154,   44,
+       23,   30,  103,   30,   23,  134,   23,  103,   30,   30,
+       35,   30,   35, 1247,   35,   30, 1248,   35,   20,   21,
+       21,   21,   21,   21,   21,   21,   21,   21,   21,   32,
+       32,  110,   21,  657,  110, 1252,  110,  136,   21,   21,
+       21,   21,   21,   21,   31,   32,  136,   31,   31,   32,
+       31,  657,   31,   32,   31,   32,   31,   33,   36,   31,
+      155,   33,   32,   36,   36,   37,   36,   36, 1253,   37,
+       33,   33,  163,   38,   33,  222,   33,   37,   39,   38,
+       39,   38,   37,   38,   37,   41,  155,   38,  222,   38,
+       38,  267,  267,   41,   39,  435,  435,   41,  163,   41,
 
-       63,  336,   63,  220,  652,   63,  336,   44,   48,   48,
-       48,   48,   48,   48,   48,   63,  220,  162,  272,   48,
-      348,  373,  652,   63,  154,   48,   48,   48,   48,   48,
-       48,   49,   49,   49,   49,   49,   49,   49,  433,  440,
-     1254,  446,   49,  162,  272,  454,  348,  373,   49,   49,
-       49,   49,   49,   49,   50,   50,   50,   50,   50,   50,
-       50,   50,  460, 1255,  433,  440,   50,  446,  596,  596,
-      460,  454,   50,   50,   50,   50,   50,   50,   52,   52,
-       52,   52,   52,   52,   52,   52,   54,   54,   54,   54,
-       54,   54,   54,  282,  282,  282,  282,   54,  406,  647,
+       44,   39,  660,   44,  660,   44,   44,   62,   62,   62,
+       62,   62,   62,   62,  274,  339,   63,  351,   44,   63,
+      339,   63,   63,  410, 1259,  413,   44,   48,   48,   48,
+       48,   48,   48,   48,   63, 1260,  410,  661,   48,  413,
+      274,  661,   63,  351,   48,   48,   48,   48,   48,   48,
+       49,   49,   49,   49,   49,   49,   49,  376,  437, 1267,
+      444,   49,  284,  284,  284,  284, 1268,   49,   49,   49,
+       49,   49,   49,   50,   50,   50,   50,   50,   50,   50,
+       50,  464,  284,  376,  437,   50,  444,  450,  458,  464,
+     1275,   50,   50,   50,   50,   50,   50,   52,   52,   52,
 
-      647,  479,  409,   54,   54,   54,   54,   54,   54,   56,
-      479,  406,   56,  282,   56,  352,  409,   56,  368,  369,
-       56,   56,   56,   56,   56,   56,   56,   56,  511,  352,
-      648,   56,  368,  369, 1262,   56,  648,   56,   56,   56,
-       56,   56,   56,  152,  481,  152,  152,  152,  152,  152,
-      152,  152,  535,  481,  511,  352,  152,  551,  368,  369,
-      535,  657,  152,  152,  152,  152,  152,  152,  153,  153,
-      153,  153,  153,  153,  153,  153,  545,  639, 1263,  657,
-      153,  604,  153,  551,  545,  639,  153,  153,  153,  153,
-      153,  153,  264,  264,  264,  264,  264,  264,  264,  275,
+       52,   52,   52,   52,   52,   54,   54,   54,   54,   54,
+       54,   54,  484,  450,  458,  355,   54,  559,  559,  559,
+      559,  484,   54,   54,   54,   54,   54,   54,   56,  355,
+     1276,   56, 1283,   56,   56,  601,  601,  371,  372,   56,
+       56,   56,   56,   56,   56,   56,   56,  516,  556, 1284,
+       56,  371,  372, 1288,   56,  355,   56,   56,   56,   56,
+       56,   56,  153,  486,  153,  153,  153,  153,  153,  153,
+      153,  540,  486,  516,  556,  153,  609,  371,  372,  540,
+     1291,  153,  153,  153,  153,  153,  153,  154,  154,  154,
+      154,  154,  154,  154,  154,  550,  644,  652,  652,  154,
 
-      275,  275,  275,  275,  275,  275,  449,  604,  153,  155,
-      155,  155,  155,  155,  155,  155,  155,  607,  613, 1270,
-      449,  155,  554,  554,  554,  554, 1271,  155,  155,  155,
-      155,  155,  155,  156,  156,  156,  156,  156,  156,  156,
-      156,  156, 1278,  607,  613,  156,  449,  620,  632,  666,
-      666,  156,  156,  156,  156,  156,  156,  157,  157,  157,
-      157,  157,  157,  157,  157,  159,  159,  159,  159,  159,
-      159,  159,  159,  620,  632,  649,  159,  673,  650,  714,
-      649,  650,  159,  159,  159,  159,  159,  159,  161,  161,
-      161,  161,  161,  161,  161,  161,  161,  656, 1279, 1283,
+      612,  154,  609,  550,  644,  154,  154,  154,  154,  154,
+      154,  266,  266,  266,  266,  266,  266,  266,  277,  277,
+      277,  277,  277,  277,  277,  453,  612,  154,  156,  156,
+      156,  156,  156,  156,  156,  156,  618,  625,  654,  453,
+      156,  637,  678,  654,  671,  671,  156,  156,  156,  156,
+      156,  156,  157,  157,  157,  157,  157,  157,  157,  157,
+      157,  680,  618,  625,  157,  453, 1292,  637,  678, 1296,
+      157,  157,  157,  157,  157,  157,  158,  158,  158,  158,
+      158,  158,  158,  158,  160,  160,  160,  160,  160,  160,
+      160,  160,  701, 1298,  719,  160,  731,  680,  662,  734,
 
-      161,  656,  161,  673,  306,  714,  161,  161,  161,  161,
-      161,  161,  306,  358,  358,  358,  358,  358,  358,  358,
-     1286, 1287,  450, 1291,  515,  306,  729,  653,  161,  258,
-      258,  258,  258,  258,  258,  258,  450,  653,  515,  726,
-      258,  306, 1293,  731,  729, 1299,  258,  258,  258,  258,
-      258,  258,  260,  260,  260,  260,  260,  260,  260,  651,
-      675,  731,  450,  260,  515,  726,  758,  761,  651,  260,
-      260,  260,  260,  260,  260,  261,  261,  261,  261,  261,
-      261,  261,  261,  263,  263,  263,  263,  263,  263,  263,
-      696,  707,  758,  761,  263,  764,  675,  730,  696,  707,
+      701,  160,  160,  160,  160,  160,  160,  162,  162,  162,
+      162,  162,  162,  162,  162,  162,  662,  734, 1304,  162,
+      719,  162,  731,  309,  736,  162,  162,  162,  162,  162,
+      162,  309,  361,  361,  361,  361,  361,  361,  361, 1305,
+      748,  454,  736,  520,  309,  737,  658,  162,  260,  260,
+      260,  260,  260,  260,  260,  454,  658,  520,  748,  260,
+      309,  735, 1315,  737, 1316,  260,  260,  260,  260,  260,
+      260,  262,  262,  262,  262,  262,  262,  262,  656,  735,
+      737,  454,  262,  520,  763,  766,  735,  656,  262,  262,
+      262,  262,  262,  262,  263,  263,  263,  263,  263,  263,
 
-      263,  263,  263,  263,  263,  263,  266,  266,  266,  266,
-      266,  266,  266,  266, 1300,  730, 1310, 1311,  266, 1315,
-     1316,  764,  730, 1320,  266,  266,  266,  266,  266,  266,
-      268,  268,  268,  268,  268,  268,  268,  268,  271,  271,
-      271,  271,  271,  271,  271,  271,  271,  812,  341,  542,
-      271, 1323,  271,  341, 1324,  812,  271,  271,  271,  271,
-      271,  271,  341,  542,  341,  341,  770,  341,  362,  362,
-      362,  362,  362,  362,  362,  741,  543,  732,  271,  276,
-      276,  276,  276,  276,  276,  276,  276,  276, 1329,  542,
-      543,  276,  770,  741,  741,  732,  546,  276,  276,  276,
+      263,  263,  265,  265,  265,  265,  265,  265,  265,  712,
+      763,  766, 1320,  265,  769,  742,  746,  712,  743,  265,
+      265,  265,  265,  265,  265,  268,  268,  268,  268,  268,
+      268,  268,  268,  742,  746,  746,  743,  268,  742,  743,
+      769, 1321, 1325,  268,  268,  268,  268,  268,  268,  270,
+      270,  270,  270,  270,  270,  270,  270,  273,  273,  273,
+      273,  273,  273,  273,  273,  273,  817,  344,  547,  273,
+     1328,  273,  344, 1329,  817,  273,  273,  273,  273,  273,
+      273,  344,  547,  344,  344,  775,  344,  365,  365,  365,
+      365,  365,  365,  365,  749,  548,  738,  273,  278,  278,
 
-      276,  276,  276,  277,  277,  277,  277,  277,  277,  277,
-      546, 1332,  732, 1333,  277, 1338,  543,  737, 1341,  743,
-      277,  277,  277,  277,  277,  277,  346,  547,  346,  346,
-      346,  346,  346,  346,  346,  737,  546,  743, 1342,  346,
-      737,  547,  744,  738,  748,  346,  346,  346,  346,  346,
-      346,  347,  347,  347,  347,  347,  347,  347,  347, 1347,
-      744,  738,  748,  347,  738,  347, 1350,  547, 1351,  347,
-      347,  347,  347,  347,  347,  430,  430,  430,  430,  430,
-      430,  430,  458,  458,  458,  458,  458,  458,  458,  615,
-      665,  347,  349,  349,  349,  349,  349,  349,  349,  349,
+      278,  278,  278,  278,  278,  278,  278, 1334,  547,  548,
+      278,  775,  749, 1337,  738,  551,  278,  278,  278,  278,
+      278,  278,  279,  279,  279,  279,  279,  279,  279,  551,
+     1338,  738, 1343,  279, 1346,  548,  744, 1347,  747,  279,
+      279,  279,  279,  279,  279,  349,  552,  349,  349,  349,
+      349,  349,  349,  349,  744,  551,  747,  744,  349,  747,
+      552,  753,  755,  755,  349,  349,  349,  349,  349,  349,
+      350,  350,  350,  350,  350,  350,  350,  350, 1352,  753,
+      755, 1355,  350, 1356,  350, 1364,  552, 1380,  350,  350,
+      350,  350,  350,  350,  434,  434,  434,  434,  434,  434,
 
-      665, 1359, 1375,  615,  349, 1376,  819,  739, 1401,  616,
-      349,  349,  349,  349,  349,  349,  353,  353,  353,  353,
-      353,  353,  353,  616,  819,  739,  777,  353,  739,  615,
-      750,  750,  742,  353,  353,  353,  353,  353,  353,  354,
-      354,  354,  354,  354,  354,  354,  354, 1404,  750,  616,
-      742,  354,  777,  742,  789,  792, 1415,  354,  354,  354,
-      354,  354,  354,  355,  355,  355,  355,  355,  355,  355,
-      355,  357,  357,  357,  357,  357,  357,  357,  804,  860,
-      789,  792,  357, 1419,  820,  821, 1423,  860,  357,  357,
-      357,  357,  357,  357,  361,  361,  361,  361,  361,  361,
+      434,  462,  462,  462,  462,  462,  462,  462,  620,  670,
+      350,  352,  352,  352,  352,  352,  352,  352,  352,  670,
+     1381,  782,  620,  352,  794,  797,  824,  836,  621,  352,
+      352,  352,  352,  352,  352,  356,  356,  356,  356,  356,
+      356,  356,  621,  809,  824,  836,  356,  782,  620,  825,
+      794,  797,  356,  356,  356,  356,  356,  356,  357,  357,
+      357,  357,  357,  357,  357,  357,  865,  825,  621,  809,
+      357,  840,  825,  896,  865, 1406,  357,  357,  357,  357,
+      357,  357,  358,  358,  358,  358,  358,  358,  358,  358,
+      360,  360,  360,  360,  360,  360,  360,  840,  876,  896,
 
-      361,  361,  820,  821,  804,  361, 1427,  820,  821,  822,
-      824,  361,  361,  361,  361,  361,  361,  363,  363,  363,
-      363,  363,  363,  363,  363,  363,  871,  822,  824,  363,
-     1431,  826,  822,  824,  871,  363,  363,  363,  363,  363,
-      363,  364,  364,  364,  364,  364,  364,  364,  364,  826,
-     1439, 1448,  364,  835,  826,  827,  829,  831,  364,  364,
-      364,  364,  364,  364,  370,  370,  370,  370,  370,  370,
-      370,  370,  370,  827,  829,  831,  370,  829,  827,  835,
-      913,  916,  370,  370,  370,  370,  370,  370,  372,  372,
-      372,  372,  372,  372,  372,  372,  372,  883,  913,  916,
+     1409,  360, 1420,  826,  827,  829,  876,  360,  360,  360,
+      360,  360,  360,  364,  364,  364,  364,  364,  364,  364,
+      364,  826,  827,  829,  364, 1424,  826,  827,  829,  831,
+      364,  364,  364,  364,  364,  364,  366,  366,  366,  366,
+      366,  366,  366,  366,  366,  888, 1428,  831,  366,  908,
+      832,  834,  831,  888,  366,  366,  366,  366,  366,  366,
+      367,  367,  367,  367,  367,  367,  367,  367,  832,  834,
+      931,  367,  834,  832,  920,  908,  915,  367,  367,  367,
+      367,  367,  367,  373,  373,  373,  373,  373,  373,  373,
+      373,  373,  920, 1432,  915,  373,  931,  915,  921,  918,
 
-      372,  891,  372,  913,  903,  883,  372,  372,  372,  372,
-      372,  372,  462,  462,  462,  462,  462,  462,  462,  528,
-      528,  528,  528,  528,  528,  528, 1241,  891,  372,  392,
-      903,  926, 1240,  392,  929,  917,  392,  910,  623,  392,
-      624,  392,  392,  392,  392,  424,  424,  424,  424,  424,
-      424,  424,  623,  917,  624,  910,  424,  926,  910,  918,
-      929,  658,  424,  424,  424,  424,  424,  424,  426,  426,
-      426,  426,  426,  426,  426,  658,  999,  918,  623,  426,
-      624,  932,  935,  941,  999,  426,  426,  426,  426,  426,
-      426,  427,  427,  427,  427,  427,  427,  427,  427,  429,
+      920,  373,  373,  373,  373,  373,  373,  375,  375,  375,
+      375,  375,  375,  375,  375,  375,  921,  918, 1436,  375,
+      934,  375,  918,  937,  940,  375,  375,  375,  375,  375,
+      375,  466,  466,  466,  466,  466,  466,  466,  533,  533,
+      533,  533,  533,  533,  533, 1444,  934,  375,  396,  937,
+      940, 1453,  396,  946,  922,  396,  923,  628,  396,  629,
+      396,  396,  396,  396,  428,  428,  428,  428,  428,  428,
+      428,  628,  922,  629,  923,  428,  953,  927, 1014,  946,
+      663,  428,  428,  428,  428,  428,  428,  430,  430,  430,
+      430,  430,  430,  430,  663,  927, 1014,  628,  430,  629,
 
-      429,  429,  429,  429,  429,  429,  948,  932,  935,  941,
-      429,  960,  915,  922, 1239, 1009,  429,  429,  429,  429,
-      429,  429,  432,  432,  432,  432,  432,  432,  432,  432,
-      915,  922,  948, 1009,  432, 1235,  432,  960,  915, 1232,
-      432,  432,  432,  432,  432,  432,  533,  533,  533,  533,
-      533,  533,  533,  537,  537,  537,  537,  537,  537,  537,
-      733,  627,  432,  434,  434,  434,  434,  434,  434,  434,
-      963, 1229,  975,  979,  434,  627,  991, 1226,  733,  661,
-      434,  434,  434,  434,  434,  434,  435,  435,  435,  435,
-      435,  435,  435,  661, 1223,  733,  963,  435,  975,  979,
+      965,  968,  953, 1237,  430,  430,  430,  430,  430,  430,
+      431,  431,  431,  431,  431,  431,  431,  431,  433,  433,
+      433,  433,  433,  433,  433,  980,  965,  968,  984,  433,
+      996, 1234, 1022, 1231, 1114,  433,  433,  433,  433,  433,
+      433,  436,  436,  436,  436,  436,  436,  436,  436, 1004,
+     1022,  980, 1114,  436,  984,  436,  996, 1004, 1228,  436,
+      436,  436,  436,  436,  436,  538,  538,  538,  538,  538,
+      538,  538,  542,  542,  542,  542,  542,  542,  542,  739,
+      632,  436,  438,  438,  438,  438,  438,  438,  438, 1042,
+     1225, 1212, 1095,  438,  632, 1017, 1208,  739,  666,  438,
 
-     1037,  627,  991,  435,  435,  435,  435,  435,  435,  436,
-      436,  436,  436,  436,  436,  436,  436,  439,  439,  439,
-      439,  439,  439,  439,  439,  439, 1037,  628, 1220,  439,
-     1207,  439, 1203, 1196, 1195,  439,  439,  439,  439,  439,
-      439,  628,  635,  635,  635,  635,  635,  635,  635,  637,
-      637,  637,  637,  637,  637,  637, 1017,  439,  445,  445,
-      445,  445,  445,  445,  445,  445,  445,  628, 1194, 1190,
-      445, 1189,  445, 1186, 1017,  664,  445,  445,  445,  445,
-      445,  445,  641,  641,  641,  641,  641,  641,  641,  664,
-      689,  689,  689,  689,  689,  689,  689,  734,  445,  451,
+      438,  438,  438,  438,  438,  439,  439,  439,  439,  439,
+      439,  439,  666, 1017,  739, 1042,  439, 1017, 1095, 1201,
+      632, 1107,  439,  439,  439,  439,  439,  439,  440,  440,
+      440,  440,  440,  440,  440,  440,  443,  443,  443,  443,
+      443,  443,  443,  443,  443, 1052,  633, 1107,  443, 1200,
+      443, 1199, 1195, 1052,  443,  443,  443,  443,  443,  443,
+      633,  640,  640,  640,  640,  640,  640,  640,  642,  642,
+      642,  642,  642,  642,  642, 1118,  443,  449,  449,  449,
+      449,  449,  449,  449,  449,  449,  633, 1194, 1191,  449,
+     1187,  449, 1186, 1118,  669,  449,  449,  449,  449,  449,
 
-      451,  451,  451,  451,  451,  451,  451,  451, 1182, 1181,
-     1090,  451, 1180, 1102, 1119,  734, 1012,  451,  451,  451,
-      451,  451,  451,  453,  453,  453,  453,  453,  453,  453,
-      453,  453,  734, 1176, 1012,  453, 1090,  453, 1012, 1102,
-     1119,  453,  453,  453,  453,  453,  453,  694,  694,  694,
-      694,  694,  694,  694,  698,  698,  698,  698,  698,  698,
-      698,  717,  736,  453,  463,  463,  463,  463,  463,  463,
-      463,  463,  463, 1175, 1172,  717,  463, 1122, 1015, 1168,
-      736,  718,  463,  463,  463,  463,  463,  463,  464,  464,
-      464,  464,  464,  464,  464,  718, 1015,  736, 1167,  464,
+      449,  646,  646,  646,  646,  646,  646,  646,  669,  694,
+      694,  694,  694,  694,  694,  694,  741,  449,  455,  455,
+      455,  455,  455,  455,  455,  455,  455, 1185, 1181, 1124,
+      455, 1180, 1127, 1130,  741, 1020,  455,  455,  455,  455,
+      455,  455,  457,  457,  457,  457,  457,  457,  457,  457,
+      457,  741, 1177, 1020,  457, 1124,  457, 1020, 1127, 1130,
+      457,  457,  457,  457,  457,  457,  699,  699,  699,  699,
+      699,  699,  699,  703,  703,  703,  703,  703,  703,  703,
+      722,  830,  457,  467,  467,  467,  467,  467,  467,  467,
+      467,  467, 1173, 1133,  722,  467, 1136, 1172, 1171,  830,
 
-     1015,  717, 1016, 1122, 1105,  464,  464,  464,  464,  464,
-      464,  509,  721,  509,  509,  509,  509,  509,  509,  509,
-     1016,  718, 1105, 1166,  509, 1016,  721, 1162, 1161, 1108,
-      509,  509,  509,  509,  509,  509,  510,  510,  510,  510,
-      510,  510,  510,  510, 1158, 1047, 1105, 1108,  510, 1108,
-      510, 1155,  721, 1047,  510,  510,  510,  510,  510,  510,
-      703,  703,  703,  703,  703,  703,  703,  705,  705,  705,
-      705,  705,  705,  705,  722,  825,  510,  512,  512,  512,
-      512,  512,  512,  512,  512, 1125, 1058, 1154,  722,  512,
-     1128, 1153, 1131,  825, 1058,  512,  512,  512,  512,  512,
+      723,  467,  467,  467,  467,  467,  467,  468,  468,  468,
+      468,  468,  468,  468,  723, 1063,  830, 1167,  468, 1133,
+      722, 1021, 1136, 1063,  468,  468,  468,  468,  468,  468,
+      514,  726,  514,  514,  514,  514,  514,  514,  514, 1021,
+      723, 1166, 1163,  514, 1021,  726, 1160, 1117, 1113,  514,
+      514,  514,  514,  514,  514,  515,  515,  515,  515,  515,
+      515,  515,  515, 1159, 1075, 1117, 1113,  515, 1113,  515,
+     1117,  726, 1075,  515,  515,  515,  515,  515,  515,  708,
+      708,  708,  708,  708,  708,  708,  710,  710,  710,  710,
+      710,  710,  710,  727,  835,  515,  517,  517,  517,  517,
 
-      512,  516,  516,  516,  516,  516,  516,  516,  516, 1070,
-      825, 1125, 1149,  516,  722, 1156, 1128, 1070, 1131,  516,
-      516,  516,  516,  516,  516,  517,  517,  517,  517,  517,
-      517,  517,  517,  518,  518,  518,  518,  518,  518,  518,
-     1082, 1156, 1148, 1145,  518, 1170, 1184, 1218, 1082, 1144,
-      518,  518,  518,  518,  518,  518,  519,  519,  519,  519,
-      519,  519,  519,  519,  521,  521,  521,  521,  521,  521,
-      521, 1170, 1184, 1218, 1281,  521, 1318, 1327, 1106, 1107,
-     1109,  521,  521,  521,  521,  521,  521,  522,  522,  522,
-      522,  522,  522,  522,  522,  522, 1106, 1107, 1109,  522,
+      517,  517,  517,  517, 1161, 1087, 1158,  727,  517, 1175,
+     1189, 1154,  835, 1087,  517,  517,  517,  517,  517,  517,
+      521,  521,  521,  521,  521,  521,  521,  521, 1153, 1207,
+     1161,  835,  521,  727, 1223, 1175, 1189, 1207,  521,  521,
+      521,  521,  521,  521,  522,  522,  522,  522,  522,  522,
+      522,  522,  523,  523,  523,  523,  523,  523,  523, 1251,
+     1223, 1150, 1149,  523, 1286, 1323, 1332, 1251, 1148,  523,
+      523,  523,  523,  523,  523,  524,  524,  524,  524,  524,
+      524,  524,  524,  526,  526,  526,  526,  526,  526,  526,
+     1286, 1323, 1332, 1341,  526, 1350, 1404, 1110, 1111, 1214,
 
-     1281, 1112, 1318, 1327,  772,  522,  522,  522,  522,  522,
-      522,  523,  523,  523,  523,  523,  523,  523,  772, 1112,
-     1106, 1107,  523, 1143, 1112, 1113, 1139, 1137,  523,  523,
-      523,  523,  523,  523,  527,  527,  527,  527,  527,  527,
-      527,  527, 1136, 1113,  772,  527, 1133, 1132, 1129, 1209,
-     1110,  527,  527,  527,  527,  527,  527,  529,  529,  529,
-      529,  529,  529,  529,  529,  529, 1202, 1209, 1110,  529,
-     1126, 1123, 1210, 1211, 1202,  529,  529,  529,  529,  529,
-      529,  530,  530,  530,  530,  530,  530,  530,  530, 1110,
-     1210, 1211,  530, 1120, 1116, 1212, 1213, 1295,  530,  530,
+      526,  526,  526,  526,  526,  526,  527,  527,  527,  527,
+      527,  527,  527,  527,  527, 1110, 1111, 1214,  527, 1341,
+     1112, 1350, 1404,  777,  527,  527,  527,  527,  527,  527,
+      528,  528,  528,  528,  528,  528,  528,  777, 1112, 1110,
+     1111,  528, 1144, 1215, 1142, 1141, 1138,  528,  528,  528,
+      528,  528,  528,  532,  532,  532,  532,  532,  532,  532,
+      532, 1215, 1112,  777,  532, 1137, 1134, 1216, 1217, 1115,
+      532,  532,  532,  532,  532,  532,  534,  534,  534,  534,
+      534,  534,  534,  534,  534, 1216, 1217, 1115,  534, 1131,
+     1128, 1218, 1300, 1125,  534,  534,  534,  534,  534,  534,
 
-      530,  530,  530,  530,  538,  538,  538,  538,  538,  538,
-      538,  538,  538, 1212, 1213, 1295,  538, 1104, 1295, 1213,
-     1296, 1103,  538,  538,  538,  538,  538,  538,  539,  539,
-      539,  539,  539,  539,  539,  539, 1246, 1100, 1296,  539,
-     1336, 1296, 1096, 1297, 1246,  539,  539,  539,  539,  539,
-      539,  548,  548,  548,  548,  548,  548,  548,  548,  548,
-     1253, 1297, 1345,  548, 1399, 1413, 1336, 1095, 1253,  548,
-      548,  548,  548,  548,  548,  550,  550,  550,  550,  550,
-      550,  550,  550,  550, 1261, 1297, 1092,  550, 1345,  550,
-     1399, 1413, 1261,  550,  550,  550,  550,  550,  550,  709,
+      535,  535,  535,  535,  535,  535,  535,  535, 1115, 1218,
+     1300,  535, 1121, 1300, 1218, 1301, 1369,  535,  535,  535,
+      535,  535,  535,  543,  543,  543,  543,  543,  543,  543,
+      543,  543, 1258, 1301, 1369,  543, 1301, 1109, 1302, 1412,
+     1258,  543,  543,  543,  543,  543,  543,  544,  544,  544,
+      544,  544,  544,  544,  544, 1266, 1302, 1412,  544, 1418,
+     1108, 1105, 1101, 1266,  544,  544,  544,  544,  544,  544,
+      553,  553,  553,  553,  553,  553,  553,  553,  553, 1274,
+     1302, 1422,  553, 1426, 1430, 1418, 1414, 1274,  553,  553,
+      553,  553,  553,  553,  555,  555,  555,  555,  555,  555,
 
-      709,  709,  709,  709,  709,  709,  715,  715,  715,  715,
-      715,  715,  715,  823,  773,  550,  590,  590,  590,  590,
-      590,  590,  590, 1417, 1269, 1421, 1425,  590,  773, 1087,
-     1364,  823, 1269,  590,  590,  590,  590,  590,  590,  592,
-      592,  592,  592,  592,  592,  592,  823, 1277, 1364, 1417,
-      592, 1421, 1425, 1429,  773, 1277,  592,  592,  592,  592,
-      592,  592,  593,  593,  593,  593,  593,  593,  593,  593,
-      595,  595,  595,  595,  595,  595,  595, 1309, 1358, 1429,
-     1437,  595, 1446, 1214, 1407, 1309, 1358,  595,  595,  595,
-      595,  595,  595,  597,  597,  597,  597,  597,  597,  597,
+      555,  555,  555, 1282, 1414, 1100,  555, 1422,  555, 1426,
+     1430, 1282,  555,  555,  555,  555,  555,  555,  714,  714,
+      714,  714,  714,  714,  714,  720,  720,  720,  720,  720,
+      720,  720,  828,  778,  555,  595,  595,  595,  595,  595,
+      595,  595, 1434, 1314, 1442, 1451,  595,  778, 1097, 1441,
+      828, 1314,  595,  595,  595,  595,  595,  595,  597,  597,
+      597,  597,  597,  597,  597,  828, 1363, 1441, 1434,  597,
+     1442, 1451, 1092,  778, 1363,  597,  597,  597,  597,  597,
+      597,  598,  598,  598,  598,  598,  598,  598,  598,  600,
+      600,  600,  600,  600,  600,  600, 1410, 1091, 1088, 1080,
 
-      597, 1214, 1407, 1086, 1083,  597, 1437, 1075, 1446, 1074,
-     1214,  597,  597,  597,  597,  597,  597,  598,  598,  598,
-      598,  598,  598,  598,  598,  599,  599,  599,  599,  599,
-      599,  599, 1405, 1071, 1063, 1062,  599, 1059, 1052, 1051,
-     1405, 1048,  599,  599,  599,  599,  599,  599,  600,  600,
-      600,  600,  600,  600,  600,  600,  603,  603,  603,  603,
-      603,  603,  603,  603,  603,  735,  780,  781,  603, 1043,
-      603, 1409, 1042,  784,  603,  603,  603,  603,  603,  603,
-      780,  781, 1039,  735, 1038, 1035, 1034,  784, 1031, 1409,
-      745, 1028,  740, 1025,  746,  735,  603,  606,  606,  606,
+      600, 1079, 1219, 1076, 1410, 1068,  600,  600,  600,  600,
+      600,  600,  602,  602,  602,  602,  602,  602,  602,  602,
+     1219, 1067, 1064, 1057,  602, 1056, 1053, 1048, 1047, 1219,
+      602,  602,  602,  602,  602,  602,  603,  603,  603,  603,
+      603,  603,  603,  603,  604,  604,  604,  604,  604,  604,
+      604, 1044, 1043, 1040, 1039,  604, 1036, 1033, 1030, 1026,
+     1009,  604,  604,  604,  604,  604,  604,  605,  605,  605,
+      605,  605,  605,  605,  605,  608,  608,  608,  608,  608,
+      608,  608,  608,  608,  740,  785,  786,  608, 1005,  608,
+      998,  997,  789,  608,  608,  608,  608,  608,  608,  785,
 
-      606,  606,  606,  606,  606,  606,  780,  781,  745,  606,
-      740,  606,  746,  784,  830,  606,  606,  606,  606,  606,
-      606,  745,  740, 1021,  746,  752,  752,  752,  752,  752,
-      752,  752,  830,  785,  795,  796,  909,  606,  612,  612,
-      612,  612,  612,  612,  612,  612,  612,  785,  795,  796,
-      612,  830,  612, 1004,  909,  799,  612,  612,  612,  612,
-      612,  612,  793,  793,  793,  793,  793,  793,  793,  799,
-     1363,  909, 1000,  785,  795,  796,  800,  993,  612,  617,
-      617,  617,  617,  617,  617,  617,  617,  617, 1363,  992,
-      800,  617,  989,  985, 1436,  799, 1363,  617,  617,  617,
+      786,  994,  740,  990,  989,  986,  789,  982,  981,  750,
+      978,  745,  974,  751,  740,  608,  611,  611,  611,  611,
+      611,  611,  611,  611,  611,  785,  786,  750,  611,  745,
+      611,  751,  789, 1016,  611,  611,  611,  611,  611,  611,
+      750,  745,  973,  751,  757,  757,  757,  757,  757,  757,
+      757, 1016,  790,  800,  801,  914,  611,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  790,  800,  801,  617,
+     1016,  617,  970,  914,  804,  617,  617,  617,  617,  617,
+      617,  798,  798,  798,  798,  798,  798,  798,  804, 1368,
+      914,  967,  790,  800,  801,  805,  966,  617,  622,  622,
 
-      617,  617,  617,  619,  619,  619,  619,  619,  619,  619,
-      619,  619, 1436,  984,  981,  619,  800,  619,  977,  976,
-      973,  619,  619,  619,  619,  619,  619,  808,  808,  808,
-      808,  808,  808,  808,  810,  810,  810,  810,  810,  810,
-      810,  894,  911,  619,  629,  629,  629,  629,  629,  629,
-      629,  629,  629,  969,  968,  894,  629,  965,  962,  961,
-      911,  911,  629,  629,  629,  629,  629,  629,  631,  631,
-      631,  631,  631,  631,  631,  631,  631,  958,  911,  954,
-      631,  894,  631,  953, 1014,  828,  631,  631,  631,  631,
-      631,  631,  814,  814,  814,  814,  814,  814,  814,  950,
+      622,  622,  622,  622,  622,  622,  622, 1368,  963,  805,
+      622,  959,  958,  955,  804, 1368,  622,  622,  622,  622,
+      622,  622,  624,  624,  624,  624,  624,  624,  624,  624,
+      624,  954,  951,  947,  624,  805,  624,  943,  942,  941,
+      624,  624,  624,  624,  624,  624,  813,  813,  813,  813,
+      813,  813,  813,  815,  815,  815,  815,  815,  815,  815,
+      899,  916,  624,  634,  634,  634,  634,  634,  634,  634,
+      634,  634,  938,  935,  899,  634,  932,  929,  928,  916,
+      916,  634,  634,  634,  634,  634,  634,  636,  636,  636,
+      636,  636,  636,  636,  636,  636,  910,  916,  909,  636,
 
-      949,  946, 1014,  828,  942,  895,  898,  912,  631,  642,
-      642,  642,  642,  642,  642,  642,  642,  642,  828,  895,
-      898,  642, 1014,  938,  937,  912,  899,  642,  642,  642,
-      642,  642,  642,  643,  643,  643,  643,  643,  643,  643,
-      899,  912,  936,  933,  643,  895,  898,  930,  927,  924,
-      643,  643,  643,  643,  643,  643,  646,  646,  646,  646,
-      646,  646,  646,  923,  905,  904,  899,  646,  906,  907,
-      908,  914, 1011,  646,  646,  646,  646,  646,  646,  853,
-      853,  853,  853,  853,  853,  853,  906,  907,  908,  914,
-     1011,  646,  669,  901,  669,  669,  669,  669,  669,  669,
+      899,  636,  906, 1019,  833,  636,  636,  636,  636,  636,
+      636,  819,  819,  819,  819,  819,  819,  819,  902,  901,
+      898, 1019,  833,  893,  900,  903,  917,  636,  647,  647,
+      647,  647,  647,  647,  647,  647,  647,  833,  900,  903,
+      647, 1019,  889,  881,  917,  904,  647,  647,  647,  647,
+      647,  647,  648,  648,  648,  648,  648,  648,  648,  904,
+      917,  877,  870,  648,  900,  903,  866,  861,  856,  648,
+      648,  648,  648,  648,  648,  651,  651,  651,  651,  651,
+      651,  651,  855,  854,  851,  904,  651,  911,  912,  913,
+      919, 1299,  651,  651,  651,  651,  651,  651,  858,  858,
 
-      669,  906,  907,  908,  908,  669,  914,  897, 1010, 1011,
-     1114,  669,  669,  669,  669,  669,  669,  858,  858,  858,
-      858,  858,  858,  858,  943,  944, 1010, 1294, 1114,  669,
-      670,  670,  670,  670,  670,  670,  670,  670,  943,  944,
-     1010,  896,  670, 1114,  893, 1294,  888,  884,  670,  670,
-      670,  670,  670,  670,  862,  862,  862,  862,  862,  862,
-      862,  876, 1294,  872,  943,  944,  670,  671,  671,  671,
-      671,  671,  671,  671,  867,  867,  867,  867,  867,  867,
-      867,  869,  869,  869,  869,  869,  869,  869,  873,  873,
-      873,  873,  873,  873,  873,  879,  879,  879,  879,  879,
+      858,  858,  858,  858,  858,  911,  912,  913,  919, 1299,
+      651,  674,  848,  674,  674,  674,  674,  674,  674,  674,
+      911,  912,  913,  913,  674,  919, 1299, 1015, 1018, 1119,
+      674,  674,  674,  674,  674,  674,  863,  863,  863,  863,
+      863,  863,  863,  948,  949, 1015, 1018, 1119,  674,  675,
+      675,  675,  675,  675,  675,  675,  675,  948,  949, 1015,
+     1018,  675, 1119,  844,  822,  818,  811,  675,  675,  675,
+      675,  675,  675,  867,  867,  867,  867,  867,  867,  867,
+      810,  807,  803,  948,  949,  675,  676,  676,  676,  676,
+      676,  676,  676,  872,  872,  872,  872,  872,  872,  872,
 
-      879,  879,  671,  672,  672,  672,  672,  672,  672,  672,
-      865,  861,  856,  851,  672,  850,  849,  846,  843,  839,
-      672,  672,  672,  672,  672,  672,  674,  674,  674,  674,
-      674,  674,  674,  674,  676,  676,  676,  676,  676,  676,
-      676,  676,  817,  813,  806,  805,  676,  802,  798,  797,
-      794,  791,  676,  676,  676,  676,  676,  676,  677,  677,
-      677,  677,  677,  677,  677,  677,  679,  679,  679,  679,
-      679,  679,  679,  790,  787,  783,  782,  679,  779,  778,
-      775,  771,  768,  679,  679,  679,  679,  679,  679,  680,
-      680,  680,  680,  680,  680,  680,  680,  680,  767,  766,
+      874,  874,  874,  874,  874,  874,  874,  878,  878,  878,
+      878,  878,  878,  878,  884,  884,  884,  884,  884,  884,
+      884,  676,  677,  677,  677,  677,  677,  677,  677,  802,
+      799,  796,  795,  677,  792,  788,  787,  784,  783,  677,
+      677,  677,  677,  677,  677,  679,  679,  679,  679,  679,
+      679,  679,  679,  681,  681,  681,  681,  681,  681,  681,
+      681,  780,  776,  773,  772,  681,  771,  770,  767,  764,
+      761,  681,  681,  681,  681,  681,  681,  682,  682,  682,
+      682,  682,  682,  682,  682,  684,  684,  684,  684,  684,
+      684,  684,  760,  733,  732,  729,  684,  725,  724,  721,
 
-      765,  680,  762,  759,  756,  755,  951,  680,  680,  680,
-      680,  680,  680,  681,  681,  681,  681,  681,  681,  681,
-      951,  728,  727,  724,  681,  720,  719,  716,  712,  708,
-      681,  681,  681,  681,  681,  681,  683,  683,  683,  683,
-      683,  683,  683,  683,  683,  701,  951,  697,  683,  692,
-      687,  686,  685,  952,  683,  683,  683,  683,  683,  683,
-      684,  684,  684,  684,  684,  684,  684,  952,  682,  678,
-      668,  684,  667,  663,  662,  660,  659,  684,  684,  684,
-      684,  684,  684,  688,  688,  688,  688,  688,  688,  688,
-      688,  654,  644,  952,  688,  640,  634,  633,  630,  626,
+      717,  713,  684,  684,  684,  684,  684,  684,  685,  685,
+      685,  685,  685,  685,  685,  685,  685,  706,  702,  697,
+      685,  692,  691,  690,  687,  956,  685,  685,  685,  685,
+      685,  685,  686,  686,  686,  686,  686,  686,  686,  956,
+      683,  673,  672,  686,  668,  667,  665,  664,  659,  686,
+      686,  686,  686,  686,  686,  688,  688,  688,  688,  688,
+      688,  688,  688,  688,  649,  956,  645,  688,  639,  638,
+      635,  631,  957,  688,  688,  688,  688,  688,  688,  689,
+      689,  689,  689,  689,  689,  689,  957,  630,  627,  626,
+      689,  623,  619,  616,  615,  614,  689,  689,  689,  689,
 
-      688,  688,  688,  688,  688,  688,  690,  690,  690,  690,
-      690,  690,  690,  690,  690,  625,  622,  621,  690,  618,
-      614,  611,  610,  609,  690,  690,  690,  690,  690,  690,
-      691,  691,  691,  691,  691,  691,  691,  691,  608,  605,
-      602,  691,  601,  594,  591,  589,  585,  691,  691,  691,
-      691,  691,  691,  699,  699,  699,  699,  699,  699,  699,
-      699,  699,  581,  580,  579,  699,  578,  574,  573,  571,
-      570,  699,  699,  699,  699,  699,  699,  700,  700,  700,
-      700,  700,  700,  700,  700,  569,  568,  567,  700,  566,
-      565,  564,  563,  562,  700,  700,  700,  700,  700,  700,
+      689,  689,  693,  693,  693,  693,  693,  693,  693,  693,
+      613,  610,  957,  693,  607,  606,  599,  596,  594,  693,
+      693,  693,  693,  693,  693,  695,  695,  695,  695,  695,
+      695,  695,  695,  695,  590,  586,  585,  695,  584,  583,
+      579,  578,  576,  695,  695,  695,  695,  695,  695,  696,
+      696,  696,  696,  696,  696,  696,  696,  575,  574,  573,
+      696,  572,  571,  570,  569,  568,  696,  696,  696,  696,
+      696,  696,  704,  704,  704,  704,  704,  704,  704,  704,
+      704,  567,  566,  565,  704,  562,  561,  560,  558,  557,
+      704,  704,  704,  704,  704,  704,  705,  705,  705,  705,
 
-      710,  710,  710,  710,  710,  710,  710,  710,  710,  561,
-      560,  557,  710,  556,  555,  553,  552,  549,  710,  710,
-      710,  710,  710,  710,  711,  711,  711,  711,  711,  711,
-      711,  711,  544,  540,  536,  711,  531,  526,  525,  524,
-      520,  711,  711,  711,  711,  711,  711,  723,  723,  723,
-      723,  723,  723,  723,  723,  723,  514,  513,  508,  723,
-      507,  506,  505,  504,  503,  723,  723,  723,  723,  723,
-      723,  725,  725,  725,  725,  725,  725,  725,  725,  725,
-      502,  501,  500,  725,  499,  725,  498,  496,  493,  725,
-      725,  725,  725,  725,  725,  881,  881,  881,  881,  881,
+      705,  705,  705,  705,  554,  549,  545,  705,  541,  536,
+      531,  530,  529,  705,  705,  705,  705,  705,  705,  715,
+      715,  715,  715,  715,  715,  715,  715,  715,  525,  519,
+      518,  715,  513,  512,  511,  510,  509,  715,  715,  715,
+      715,  715,  715,  716,  716,  716,  716,  716,  716,  716,
+      716,  508,  507,  506,  716,  505,  504,  503,  501,  498,
+      716,  716,  716,  716,  716,  716,  728,  728,  728,  728,
+      728,  728,  728,  728,  728,  497,  496,  495,  728,  494,
+      493,  492,  490,  489,  728,  728,  728,  728,  728,  728,
+      730,  730,  730,  730,  730,  730,  730,  730,  730,  488,
 
-      881,  881,  885,  885,  885,  885,  885,  885,  885,  955,
-      956,  725,  747,  966,  747,  747,  747,  747,  747,  747,
-      747,  492,  491,  955,  956,  747,  490,  966,  489,  488,
-      747,  747,  747,  747,  747,  747,  747,  749,  749,  749,
-      749,  749,  749,  749,  487,  485,  484,  483,  749,  955,
-      956,  482,  480,  966,  749,  749,  749,  749,  749,  749,
-      751,  751,  751,  751,  751,  751,  751,  478,  477,  476,
-      475,  751,  474, 1362,  473,  472,  470,  751,  751,  751,
-      751,  751,  751,  753,  753,  753,  753,  753,  753,  753,
-      753, 1362,  469,  468,  465,  753,  461,  457,  456,  455,
+      487,  485,  730,  483,  730,  482,  481,  480,  730,  730,
+      730,  730,  730,  730,  886,  886,  886,  886,  886,  886,
+      886,  890,  890,  890,  890,  890,  890,  890,  960,  961,
+      730,  752,  971,  752,  752,  752,  752,  752,  752,  752,
+      479,  477,  960,  961,  752,  476,  971,  474,  473,  752,
+      752,  752,  752,  752,  752,  752,  754,  754,  754,  754,
+      754,  754,  754,  472,  469,  465,  461,  754,  960,  961,
+      460,  459,  971,  754,  754,  754,  754,  754,  754,  756,
+      756,  756,  756,  756,  756,  756,  456,  452,  451,  448,
+      756,  447, 1367,  446,  445,  442,  756,  756,  756,  756,
 
-     1362,  753,  753,  753,  753,  753,  753,  754,  754,  754,
-      754,  754,  754,  754,  754,  757,  757,  757,  757,  757,
-      757,  757,  757,  757,  452,  448,  447,  757,  444,  757,
-      443,  442,  441,  757,  757,  757,  757,  757,  757,  892,
-      892,  892,  892,  892,  892,  892,  964,  964,  964,  964,
-      964,  964,  964,  967,  438,  757,  760,  760,  760,  760,
-      760,  760,  760,  760,  760,  437,  970,  967,  760,  428,
-      760,  425,  971,  982,  760,  760,  760,  760,  760,  760,
-      970,  423,  422,  421,  420,  419,  971,  982,  418,  417,
-      416,  415, 1361,  967,  983,  414,  760,  763,  763,  763,
+      756,  756,  758,  758,  758,  758,  758,  758,  758,  758,
+     1367,  441,  432,  429,  758,  427,  426,  425,  424, 1367,
+      758,  758,  758,  758,  758,  758,  759,  759,  759,  759,
+      759,  759,  759,  759,  762,  762,  762,  762,  762,  762,
+      762,  762,  762,  423,  422,  421,  762,  420,  762,  419,
+      418,  417,  762,  762,  762,  762,  762,  762,  897,  897,
+      897,  897,  897,  897,  897,  969,  969,  969,  969,  969,
+      969,  969,  972,  416,  762,  765,  765,  765,  765,  765,
+      765,  765,  765,  765,  414,  975,  972,  765,  412,  765,
+      411,  976,  987,  765,  765,  765,  765,  765,  765,  975,
 
-      763,  763,  763,  763,  763,  763,  970,  413,  983,  763,
-     1361,  763,  971,  982,  986,  763,  763,  763,  763,  763,
-      763,  980,  980,  980,  980,  980,  980,  980,  986, 1361,
-      412,  410,  408,  987,  983, 1093,  407,  763,  769,  769,
-      769,  769,  769,  769,  769,  769,  769,  987,  405, 1093,
-      769,  404,  769,  401,  986, 1094,  769,  769,  769,  769,
-      769,  769,  995,  995,  995,  995,  995,  995,  995, 1094,
-      400,  398,  396,  987, 1097, 1093, 1098,  395,  769,  774,
-      774,  774,  774,  774,  774,  774,  774,  774, 1097,  394,
-     1098,  774,  389,  388,  386, 1094,  385,  774,  774,  774,
+      409,  408,  405,  404,  402,  976,  987,  400,  399,  398,
+      393, 1366,  972,  988,  392,  765,  768,  768,  768,  768,
+      768,  768,  768,  768,  768,  975,  391,  988,  768, 1366,
+      768,  976,  987,  991,  768,  768,  768,  768,  768,  768,
+      985,  985,  985,  985,  985,  985,  985,  991, 1366,  389,
+      388,  387,  992,  988, 1098,  386,  768,  774,  774,  774,
+      774,  774,  774,  774,  774,  774,  992,  384, 1098,  774,
+      379,  774,  378,  991, 1099,  774,  774,  774,  774,  774,
+      774, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1099,  377,
+      374,  370,  992, 1102, 1098, 1103,  368,  774,  779,  779,
 
-      774,  774,  774,  776,  776,  776,  776,  776,  776,  776,
-      776,  776,  384,  383, 1097,  776, 1098,  776,  381,  376,
-      375,  776,  776,  776,  776,  776,  776,  997,  997,  997,
-      997,  997,  997,  997, 1001, 1001, 1001, 1001, 1001, 1001,
-     1001, 1140,  374,  776,  786,  786,  786,  786,  786,  786,
-      786,  786,  786,  371,  367, 1140,  786,  365,  360,  359,
-      356, 1013,  786,  786,  786,  786,  786,  786,  788,  788,
-      788,  788,  788,  788,  788,  788,  788, 1006, 1007, 1013,
-      788, 1140,  788,  351,  350,  342,  788,  788,  788,  788,
-      788,  788,  340, 1013,  339, 1006, 1007, 1040, 1040, 1040,
+      779,  779,  779,  779,  779,  779,  779, 1102,  363, 1103,
+      779,  362,  359,  354, 1099,  353,  779,  779,  779,  779,
+      779,  779,  781,  781,  781,  781,  781,  781,  781,  781,
+      781,  345,  343, 1102,  781, 1103,  781,  342,  337,  335,
+      781,  781,  781,  781,  781,  781, 1002, 1002, 1002, 1002,
+     1002, 1002, 1002, 1006, 1006, 1006, 1006, 1006, 1006, 1006,
+     1145,  333,  781,  791,  791,  791,  791,  791,  791,  791,
+      791,  791,  332,  331, 1145,  791,  330,  329,  328,  327,
+      325,  791,  791,  791,  791,  791,  791,  793,  793,  793,
+      793,  793,  793,  793,  793,  793, 1011, 1012, 1146,  793,
 
-     1040, 1040, 1040, 1040, 1141,  334, 1006, 1007,  788,  801,
-      801,  801,  801,  801,  801,  801,  801,  801, 1141,  332,
-      330,  801,  329,  328,  327,  326,  325,  801,  801,  801,
-      801,  801,  801,  803,  803,  803,  803,  803,  803,  803,
-      803,  803, 1008, 1146, 1141,  803,  324,  803,  322,  321,
-     1408,  803,  803,  803,  803,  803,  803, 1146,  320,  315,
-     1008, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1408,  312,
-     1147, 1008,  311,  803,  815,  815,  815,  815,  815,  815,
-      815,  815,  815, 1146, 1147,  310,  815, 1408,  307,  300,
-      299, 1150,  815,  815,  815,  815,  815,  815,  816,  816,
+     1145,  793,  324,  323,  318,  793,  793,  793,  793,  793,
+      793,  315, 1146,  314, 1011, 1012, 1045, 1045, 1045, 1045,
+     1045, 1045, 1045, 1151,  313, 1011, 1012,  793,  806,  806,
+      806,  806,  806,  806,  806,  806,  806, 1151, 1146,  310,
+      806,  303,  302,  300,  299,  298,  806,  806,  806,  806,
+      806,  806,  808,  808,  808,  808,  808,  808,  808,  808,
+      808, 1013, 1152, 1151,  808,  296,  808,  294,  293, 1413,
+      808,  808,  808,  808,  808,  808, 1152,  292,  290, 1013,
+     1050, 1050, 1050, 1050, 1050, 1050, 1050, 1413,  286, 1155,
+     1013,  285,  808,  820,  820,  820,  820,  820,  820,  820,
 
-      816,  816,  816,  816,  816, 1150,  297,  296,  294,  816,
-     1147,  292,  291,  290,  288,  816,  816,  816,  816,  816,
-      816,  832, 1151,  832,  832,  832,  832,  832,  832,  832,
-      284, 1150,  283,  281,  832,  278, 1151,  274,  273,  832,
-      832,  832,  832,  832,  832,  832,  833,  833,  833,  833,
-      833,  833,  833,  270,  269,  267,  262,  833,  259,  257,
-      256,  254, 1151,  833,  833,  833,  833,  833,  833,  834,
-      834,  834,  834,  834,  834,  834,  834,  251,  247,  243,
-      241,  834,  239,  834,  238,  236,  235,  834,  834,  834,
-      834,  834,  834, 1049, 1049, 1049, 1049, 1049, 1049, 1049,
+      820,  820, 1152, 1155,  283,  820, 1413,  280,  276,  275,
+     1156,  820,  820,  820,  820,  820,  820,  821,  821,  821,
+      821,  821,  821,  821, 1156,  272,  271,  269,  821, 1155,
+      264,  261,  259,  258,  821,  821,  821,  821,  821,  821,
+      837, 1164,  837,  837,  837,  837,  837,  837,  837,  256,
+     1156,  253,  249,  837,  245, 1164,  243,  241,  837,  837,
+      837,  837,  837,  837,  837,  838,  838,  838,  838,  838,
+      838,  838,  240,  238,  237,  236,  838,  235,  234,  233,
+      232, 1164,  838,  838,  838,  838,  838,  838,  839,  839,
+      839,  839,  839,  839,  839,  839,  230,  228,  226,  225,
 
-     1054, 1054, 1054, 1054, 1054, 1054, 1054,  234, 1159,  834,
-      836,  836,  836,  836,  836,  836,  836,  233,  232,  231,
-      230,  836, 1159,  228,  226,  224,  223,  836,  836,  836,
-      836,  836,  836,  837,  837,  837,  837,  837,  837,  837,
-      837,  221,  219,  218,  216,  837,  213,  212, 1159,  211,
-      209,  837,  837,  837,  837,  837,  837,  838,  838,  838,
-      838,  838,  838,  838,  838,  840,  840,  840,  840,  840,
-      840,  840,  207,  206,  203,  202,  840,  200,  199,  198,
-      197,  196,  840,  840,  840,  840,  840,  840,  841,  841,
-      841,  841,  841,  841,  841,  841,  841,  195,  194,  193,
+      839,  223,  839,  221,  220,  218,  839,  839,  839,  839,
+      839,  839, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1059,
+     1059, 1059, 1059, 1059, 1059, 1059,  215, 1165,  839,  841,
+      841,  841,  841,  841,  841,  841,  214,  213,  211,  209,
+      841, 1165,  208,  205,  204,  202,  841,  841,  841,  841,
+      841,  841,  842,  842,  842,  842,  842,  842,  842,  842,
+      201,  200,  199,  198,  842,  197,  196, 1165,  195,  194,
+      842,  842,  842,  842,  842,  842,  843,  843,  843,  843,
+      843,  843,  843,  843,  845,  845,  845,  845,  845,  845,
+      845,  193,  192,  191,  190,  845,  189,  188,  187,  186,
 
-      841,  192,  191,  190,  189, 1160,  841,  841,  841,  841,
-      841,  841,  842,  842,  842,  842,  842,  842,  842, 1160,
-      188,  187,  186,  842,  185,  184,  182,  181,  178,  842,
-      842,  842,  842,  842,  842,  844,  844,  844,  844,  844,
-      844,  844,  844,  844,  177, 1160,  176,  844,  175,  174,
-      173,  172, 1163,  844,  844,  844,  844,  844,  844,  845,
-      845,  845,  845,  845,  845,  845, 1163,  171,  169,  166,
-      845,  165,  164,  163,  160,  158,  845,  845,  845,  845,
-      845,  845,  847,  847,  847,  847,  847,  847,  847,  847,
-      847,  149, 1163,  148,  847,  147,  146,  145,  144, 1164,
+      185,  845,  845,  845,  845,  845,  845,  846,  846,  846,
+      846,  846,  846,  846,  846,  846,  183,  182,  179,  846,
+      178,  177,  176,  175, 1168,  846,  846,  846,  846,  846,
+      846,  847,  847,  847,  847,  847,  847,  847, 1168,  174,
+      173,  172,  847,  170,  167,  166,  165,  164,  847,  847,
+      847,  847,  847,  847,  849,  849,  849,  849,  849,  849,
+      849,  849,  849,  161, 1168,  159,  849,  150,  149,  148,
+      147, 1169,  849,  849,  849,  849,  849,  849,  850,  850,
+      850,  850,  850,  850,  850, 1169,  146,  145,  144,  850,
+      142,  140,  139,  137,  135,  850,  850,  850,  850,  850,
 
-      847,  847,  847,  847,  847,  847,  848,  848,  848,  848,
-      848,  848,  848, 1164,  143,  141,  139,  848,  138,  136,
-      134,  132,  131,  848,  848,  848,  848,  848,  848,  852,
-      852,  852,  852,  852,  852,  852,  852,  130,  129, 1164,
-      852,  127,  126,  125,  124,  123,  852,  852,  852,  852,
-      852,  852,  854,  854,  854,  854,  854,  854,  854,  854,
-      854,  122,  120,  118,  854,  117,  116,  115,  114,  113,
-      854,  854,  854,  854,  854,  854,  855,  855,  855,  855,
-      855,  855,  855,  855,  112,  111,  110,  855,  108,  107,
-      100,   99,   98,  855,  855,  855,  855,  855,  855,  863,
+      850,  852,  852,  852,  852,  852,  852,  852,  852,  852,
+      133, 1169,  132,  852,  131,  130,  128,  127, 1178,  852,
+      852,  852,  852,  852,  852,  853,  853,  853,  853,  853,
+      853,  853, 1178,  126,  125,  124,  853,  123,  121,  119,
+      118,  117,  853,  853,  853,  853,  853,  853,  857,  857,
+      857,  857,  857,  857,  857,  857,  116,  115, 1178,  857,
+      114,  113,  112,  111,  109,  857,  857,  857,  857,  857,
+      857,  859,  859,  859,  859,  859,  859,  859,  859,  859,
+      108,  101,  100,  859,   99,   97,   96,   93,   92,  859,
+      859,  859,  859,  859,  859,  860,  860,  860,  860,  860,
 
-      863,  863,  863,  863,  863,  863,  863,  863,   96,   95,
-       92,  863,   91,   90,   89,   88,   87,  863,  863,  863,
-      863,  863,  863,  864,  864,  864,  864,  864,  864,  864,
-      864,   86,   85,   84,  864,   82,   81,   80,   79,   78,
-      864,  864,  864,  864,  864,  864,  874,  874,  874,  874,
-      874,  874,  874,  874,  874,   77,   76,   75,  874,   74,
-       73,   72,   71,   70,  874,  874,  874,  874,  874,  874,
-      875,  875,  875,  875,  875,  875,  875,  875,   69,   67,
-       66,  875,   65,   51,   43,   42,   40,  875,  875,  875,
-      875,  875,  875,  886,  886,  886,  886,  886,  886,  886,
+      860,  860,  860,   91,   90,   89,  860,   88,   87,   86,
+       85,   84,  860,  860,  860,  860,  860,  860,  868,  868,
+      868,  868,  868,  868,  868,  868,  868,   82,   81,   80,
+      868,   79,   78,   77,   76,   75,  868,  868,  868,  868,
+      868,  868,  869,  869,  869,  869,  869,  869,  869,  869,
+       74,   73,   72,  869,   71,   70,   69,   67,   66,  869,
+      869,  869,  869,  869,  869,  879,  879,  879,  879,  879,
+      879,  879,  879,  879,   65,   51,   43,  879,   42,   40,
+       18,   11,    8,  879,  879,  879,  879,  879,  879,  880,
+      880,  880,  880,  880,  880,  880,  880,    3,    0,    0,
 
-      886,  886,   18,   10,    8,  886,    3,    0,    0,    0,
-        0,  886,  886,  886,  886,  886,  886,  887,  887,  887,
-      887,  887,  887,  887,  887,    0,    0,    0,  887,    0,
-        0,    0,    0,    0,  887,  887,  887,  887,  887,  887,
-      900,  900,  900,  900,  900,  900,  900,  900,  900,    0,
-        0,    0,  900,    0,    0,    0,    0,    0,  900,  900,
-      900,  900,  900,  900,  902,  902,  902,  902,  902,  902,
-      902,  902,  902,    0,    0,    0,  902,    0,  902,    0,
-        0,    0,  902,  902,  902,  902,  902,  902, 1056, 1056,
-     1056, 1056, 1056, 1056, 1056, 1060, 1060, 1060, 1060, 1060,
+      880,    0,    0,    0,    0,    0,  880,  880,  880,  880,
+      880,  880,  891,  891,  891,  891,  891,  891,  891,  891,
+      891,    0,    0,    0,  891,    0,    0,    0,    0,    0,
+      891,  891,  891,  891,  891,  891,  892,  892,  892,  892,
+      892,  892,  892,  892,    0,    0,    0,  892,    0,    0,
+        0,    0,    0,  892,  892,  892,  892,  892,  892,  905,
+      905,  905,  905,  905,  905,  905,  905,  905,    0,    0,
+        0,  905,    0,    0,    0,    0,    0,  905,  905,  905,
+      905,  905,  905,  907,  907,  907,  907,  907,  907,  907,
+      907,  907,    0,    0,    0,  907,    0,  907,    0,    0,
 
-     1060, 1060,    0,    0,  902,  919,  919,  919,  919,  919,
-      919,  919,  919,  919,    0,    0,    0,    0,  919,    0,
-        0,    0,    0,  919,  919,  919,  919,  919,  919,  919,
-      920,  920,  920,  920,  920,  920,  920,  920,  921,  921,
-      921,  921,  921,  921,  921,  921,  921, 1066, 1066, 1066,
-     1066, 1066, 1066, 1066,    0,    0,  921,  925,  925,  925,
-      925,  925,  925,  925,  925,  925,    0,    0,    0,  925,
-        0,  925,    0,    0,    0,  925,  925,  925,  925,  925,
-      925, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1072, 1072,
-     1072, 1072, 1072, 1072, 1072,    0,    0,  925,  928,  928,
+        0,  907,  907,  907,  907,  907,  907, 1061, 1061, 1061,
+     1061, 1061, 1061, 1061, 1065, 1065, 1065, 1065, 1065, 1065,
+     1065,    0,    0,  907,  924,  924,  924,  924,  924,  924,
+      924,  924,  924,    0,    0,    0,    0,  924,    0,    0,
+        0,    0,  924,  924,  924,  924,  924,  924,  924,  925,
+      925,  925,  925,  925,  925,  925,  925,  926,  926,  926,
+      926,  926,  926,  926,  926,  926, 1071, 1071, 1071, 1071,
+     1071, 1071, 1071,    0,    0,  926,  930,  930,  930,  930,
+      930,  930,  930,  930,  930,    0,    0,    0,  930,    0,
+      930,    0,    0,    0,  930,  930,  930,  930,  930,  930,
 
-      928,  928,  928,  928,  928,  928,  928,    0,    0,    0,
-      928,    0,  928,    0,    0,    0,  928,  928,  928,  928,
-      928,  928, 1078, 1078, 1078, 1078, 1078, 1078, 1078, 1080,
-     1080, 1080, 1080, 1080, 1080, 1080,    0,    0,  928,  931,
-      931,  931,  931,  931,  931,  931,  931,  931,    0,    0,
-        0,  931,    0,  931,    0,    0,    0,  931,  931,  931,
-      931,  931,  931, 1084, 1084, 1084, 1084, 1084, 1084, 1084,
-     1091, 1091, 1091, 1091, 1091, 1091, 1091, 1111,    0,  931,
-      934,  934,  934,  934,  934,  934,  934,  934,  934,    0,
-     1173, 1174,  934,    0,  934, 1111,    0,    0,  934,  934,
+     1073, 1073, 1073, 1073, 1073, 1073, 1073, 1077, 1077, 1077,
+     1077, 1077, 1077, 1077,    0,    0,  930,  933,  933,  933,
+      933,  933,  933,  933,  933,  933,    0,    0,    0,  933,
+        0,  933,    0,    0,    0,  933,  933,  933,  933,  933,
+      933, 1083, 1083, 1083, 1083, 1083, 1083, 1083, 1085, 1085,
+     1085, 1085, 1085, 1085, 1085,    0,    0,  933,  936,  936,
+      936,  936,  936,  936,  936,  936,  936,    0,    0,    0,
+      936,    0,  936,    0,    0,    0,  936,  936,  936,  936,
+      936,  936, 1089, 1089, 1089, 1089, 1089, 1089, 1089, 1096,
+     1096, 1096, 1096, 1096, 1096, 1096, 1116,    0,  936,  939,
 
-      934,  934,  934,  934, 1173, 1174, 1111, 1134, 1134, 1134,
-     1134, 1134, 1134, 1134,    0, 1177,    0,    0,    0, 1178,
-      934,  939,  939,  939,  939,  939,  939,  939,  939, 1177,
-     1173, 1174,  939, 1178,    0,    0,    0,    0,  939,  939,
-      939,  939,  939,  939,  940,  940,  940,  940,  940,  940,
-      940,  940,  940,    0,    0, 1177,  940,    0,  940, 1178,
-        0,    0,  940,  940,  940,  940,  940,  940, 1157, 1157,
-     1157, 1157, 1157, 1157, 1157, 1171, 1171, 1171, 1171, 1171,
-     1171, 1171, 1187,    0,  940,  945,  945,  945,  945,  945,
-      945,  945,  945,  945,    0,    0, 1187,  945,    0,    0,
+      939,  939,  939,  939,  939,  939,  939,  939,    0, 1179,
+     1182,  939,    0,  939, 1116,    0,    0,  939,  939,  939,
+      939,  939,  939, 1179, 1182, 1116, 1139, 1139, 1139, 1139,
+     1139, 1139, 1139,    0, 1183,    0,    0,    0, 1192,  939,
+      944,  944,  944,  944,  944,  944,  944,  944, 1183, 1179,
+     1182,  944, 1192,    0,    0,    0,    0,  944,  944,  944,
+      944,  944,  944,  945,  945,  945,  945,  945,  945,  945,
+      945,  945,    0,    0, 1183,  945,    0,  945, 1192,    0,
+        0,  945,  945,  945,  945,  945,  945, 1162, 1162, 1162,
+     1162, 1162, 1162, 1162, 1176, 1176, 1176, 1176, 1176, 1176,
 
-        0,    0,    0,  945,  945,  945,  945,  945,  945,  947,
-      947,  947,  947,  947,  947,  947,  947,  947,    0,    0,
-        0,  947, 1187,  947,    0,    0, 1188,  947,  947,  947,
-      947,  947,  947, 1185, 1185, 1185, 1185, 1185, 1185, 1185,
-     1188,    0,    0,    0,    0, 1191,    0, 1192,    0,  947,
-      957,  957,  957,  957,  957,  957,  957,  957,  957, 1191,
-        0, 1192,  957,    0,    0,    0, 1188,    0,  957,  957,
-      957,  957,  957,  957,  959,  959,  959,  959,  959,  959,
-      959,  959,  959,    0,    0, 1191,  959, 1192,  959,    0,
-        0,    0,  959,  959,  959,  959,  959,  959, 1198, 1198,
+     1176, 1193,    0,  945,  950,  950,  950,  950,  950,  950,
+      950,  950,  950,    0,    0, 1193,  950,    0,    0,    0,
+        0,    0,  950,  950,  950,  950,  950,  950,  952,  952,
+      952,  952,  952,  952,  952,  952,  952,    0,    0,    0,
+      952, 1193,  952,    0,    0, 1196,  952,  952,  952,  952,
+      952,  952, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1196,
+        0,    0,    0,    0, 1197,    0, 1241,    0,  952,  962,
+      962,  962,  962,  962,  962,  962,  962,  962, 1197,    0,
+     1241,  962,    0,    0,    0, 1196,    0,  962,  962,  962,
+      962,  962,  962,  964,  964,  964,  964,  964,  964,  964,
 
-     1198, 1198, 1198, 1198, 1198, 1200, 1200, 1200, 1200, 1200,
-     1200, 1200, 1236,    0,  959,  972,  972,  972,  972,  972,
-      972,  972,  972,  972,    0,    0, 1236,  972,    0,    0,
-        0,    0,    0,  972,  972,  972,  972,  972,  972,  974,
-      974,  974,  974,  974,  974,  974,  974,  974,    0,    0,
-        0,  974, 1236,  974,    0,    0, 1237,  974,  974,  974,
-      974,  974,  974, 1204, 1204, 1204, 1204, 1204, 1204, 1204,
-     1237, 1244, 1244, 1244, 1244, 1244, 1244, 1244,    0,  974,
-      988,  988,  988,  988,  988,  988,  988,  988,  988,    0,
-        0,    0,  988,    0,    0,    0, 1237, 1215,  988,  988,
+      964,  964,    0,    0, 1197,  964, 1241,  964,    0,    0,
+        0,  964,  964,  964,  964,  964,  964, 1203, 1203, 1203,
+     1203, 1203, 1203, 1203, 1205, 1205, 1205, 1205, 1205, 1205,
+     1205, 1242,    0,  964,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,    0,    0, 1242,  977,    0,    0,    0,
+        0,    0,  977,  977,  977,  977,  977,  977,  979,  979,
+      979,  979,  979,  979,  979,  979,  979,    0,    0,    0,
+      979, 1242,  979,    0,    0,    0,  979,  979,  979,  979,
+      979,  979, 1209, 1209, 1209, 1209, 1209, 1209, 1209, 1249,
+     1249, 1249, 1249, 1249, 1249, 1249, 1289,    0,  979,  993,
 
-      988,  988,  988,  988,  990,  990,  990,  990,  990,  990,
-      990,  990,  990, 1216,    0, 1215,  990,    0,  990,    0,
-        0,    0,  990,  990,  990,  990,  990,  990, 1215,    0,
-        0, 1216, 1249, 1249, 1249, 1249, 1249, 1249, 1249,    0,
-        0, 1284, 1216,    0,  990, 1002, 1002, 1002, 1002, 1002,
-     1002, 1002, 1002, 1002,    0, 1284,    0, 1002,    0,    0,
-        0,    0, 1285, 1002, 1002, 1002, 1002, 1002, 1002, 1003,
-     1003, 1003, 1003, 1003, 1003, 1003, 1285,    0,    0,    0,
-     1003, 1284,    0,    0,    0,    0, 1003, 1003, 1003, 1003,
-     1003, 1003, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018,
+      993,  993,  993,  993,  993,  993,  993,  993,    0,    0,
+     1289,  993,    0,    0,    0,    0, 1220,  993,  993,  993,
+      993,  993,  993,  995,  995,  995,  995,  995,  995,  995,
+      995,  995, 1221,    0, 1220,  995, 1289,  995,    0,    0,
+        0,  995,  995,  995,  995,  995,  995, 1220,    0,    0,
+     1221, 1254, 1254, 1254, 1254, 1254, 1254, 1254,    0,    0,
+     1290, 1221,    0,  995, 1007, 1007, 1007, 1007, 1007, 1007,
+     1007, 1007, 1007,    0, 1290,    0, 1007,    0,    0,    0,
+        0, 1293, 1007, 1007, 1007, 1007, 1007, 1007, 1008, 1008,
+     1008, 1008, 1008, 1008, 1008, 1293,    0,    0,    0, 1008,
 
-     1018,    0, 1285,    0,    0, 1018,    0,    0,    0,    0,
-     1018, 1018, 1018, 1018, 1018, 1018, 1018, 1019, 1019, 1019,
-     1019, 1019, 1019, 1019, 1019, 1020, 1020, 1020, 1020, 1020,
-     1020, 1020, 1020, 1020, 1251, 1251, 1251, 1251, 1251, 1251,
-     1251,    0, 1288, 1020, 1022, 1022, 1022, 1022, 1022, 1022,
-     1022,    0,    0,    0,    0, 1022, 1288,    0,    0,    0,
-        0, 1022, 1022, 1022, 1022, 1022, 1022, 1023, 1023, 1023,
-     1023, 1023, 1023, 1023, 1023, 1023,    0,    0,    0, 1023,
-        0,    0, 1288,    0, 1289, 1023, 1023, 1023, 1023, 1023,
-     1023, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1289,    0,
+     1290,    0,    0,    0,    0, 1008, 1008, 1008, 1008, 1008,
+     1008, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
+        0, 1293,    0,    0, 1023,    0,    0,    0,    0, 1023,
+     1023, 1023, 1023, 1023, 1023, 1023, 1024, 1024, 1024, 1024,
+     1024, 1024, 1024, 1024, 1025, 1025, 1025, 1025, 1025, 1025,
+     1025, 1025, 1025, 1256, 1256, 1256, 1256, 1256, 1256, 1256,
+        0, 1294, 1025, 1027, 1027, 1027, 1027, 1027, 1027, 1027,
+        0,    0,    0,    0, 1027, 1294,    0,    0,    0,    0,
+     1027, 1027, 1027, 1027, 1027, 1027, 1028, 1028, 1028, 1028,
+     1028, 1028, 1028, 1028, 1028,    0,    0,    0, 1028,    0,
 
-        0,    0, 1024,    0,    0,    0,    0,    0, 1024, 1024,
-     1024, 1024, 1024, 1024, 1026, 1026, 1026, 1026, 1026, 1026,
-     1026, 1026, 1026,    0, 1289,    0, 1026,    0,    0,    0,
-        0, 1313, 1026, 1026, 1026, 1026, 1026, 1026, 1027, 1027,
-     1027, 1027, 1027, 1027, 1027, 1313,    0,    0,    0, 1027,
-        0,    0,    0,    0,    0, 1027, 1027, 1027, 1027, 1027,
-     1027, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
-        0, 1313,    0, 1029,    0,    0,    0,    0, 1314, 1029,
-     1029, 1029, 1029, 1029, 1029, 1030, 1030, 1030, 1030, 1030,
-     1030, 1030, 1314,    0,    0,    0, 1030,    0,    0,    0,
+        0, 1294,    0, 1318, 1028, 1028, 1028, 1028, 1028, 1028,
+     1029, 1029, 1029, 1029, 1029, 1029, 1029, 1318,    0,    0,
+        0, 1029,    0,    0,    0,    0,    0, 1029, 1029, 1029,
+     1029, 1029, 1029, 1031, 1031, 1031, 1031, 1031, 1031, 1031,
+     1031, 1031,    0, 1318,    0, 1031,    0,    0,    0,    0,
+     1319, 1031, 1031, 1031, 1031, 1031, 1031, 1032, 1032, 1032,
+     1032, 1032, 1032, 1032, 1319,    0,    0,    0, 1032,    0,
+        0,    0,    0,    0, 1032, 1032, 1032, 1032, 1032, 1032,
+     1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034,    0,
+     1319,    0, 1034,    0,    0,    0,    0, 1326, 1034, 1034,
 
-        0,    0, 1030, 1030, 1030, 1030, 1030, 1030, 1032, 1032,
-     1032, 1032, 1032, 1032, 1032, 1032, 1032,    0, 1314,    0,
-     1032,    0,    0,    0,    0, 1321, 1032, 1032, 1032, 1032,
-     1032, 1032, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1321,
-        0,    0,    0, 1033,    0,    0,    0,    0,    0, 1033,
-     1033, 1033, 1033, 1033, 1033, 1036, 1036, 1036, 1036, 1036,
-     1036, 1036, 1036, 1036,    0, 1321,    0, 1036,    0, 1036,
-        0,    0,    0, 1036, 1036, 1036, 1036, 1036, 1036, 1257,
-     1257, 1257, 1257, 1257, 1257, 1257, 1259, 1259, 1259, 1259,
-     1259, 1259, 1259, 1322,    0, 1036, 1041, 1041, 1041, 1041,
+     1034, 1034, 1034, 1034, 1035, 1035, 1035, 1035, 1035, 1035,
+     1035, 1326,    0,    0,    0, 1035,    0,    0,    0,    0,
+        0, 1035, 1035, 1035, 1035, 1035, 1035, 1037, 1037, 1037,
+     1037, 1037, 1037, 1037, 1037, 1037,    0, 1326,    0, 1037,
+        0,    0,    0,    0, 1327, 1037, 1037, 1037, 1037, 1037,
+     1037, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1327,    0,
+        0,    0, 1038,    0,    0,    0,    0,    0, 1038, 1038,
+     1038, 1038, 1038, 1038, 1041, 1041, 1041, 1041, 1041, 1041,
+     1041, 1041, 1041,    0, 1327,    0, 1041,    0, 1041,    0,
+        0,    0, 1041, 1041, 1041, 1041, 1041, 1041, 1262, 1262,
 
-     1041, 1041, 1041, 1041, 1041,    0,    0, 1322, 1041,    0,
-        0,    0,    0,    0, 1041, 1041, 1041, 1041, 1041, 1041,
-     1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,    0,
-        0,    0, 1050, 1322,    0,    0,    0,    0, 1050, 1050,
-     1050, 1050, 1050, 1050, 1061, 1061, 1061, 1061, 1061, 1061,
-     1061, 1061, 1061,    0,    0,    0, 1061,    0,    0,    0,
-        0,    0, 1061, 1061, 1061, 1061, 1061, 1061, 1073, 1073,
-     1073, 1073, 1073, 1073, 1073, 1073, 1073,    0,    0,    0,
-     1073,    0,    0,    0,    0,    0, 1073, 1073, 1073, 1073,
-     1073, 1073, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085,
+     1262, 1262, 1262, 1262, 1262, 1264, 1264, 1264, 1264, 1264,
+     1264, 1264, 1335,    0, 1041, 1046, 1046, 1046, 1046, 1046,
+     1046, 1046, 1046, 1046,    0,    0, 1335, 1046,    0,    0,
+        0,    0,    0, 1046, 1046, 1046, 1046, 1046, 1046, 1055,
+     1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055,    0,    0,
+        0, 1055, 1335,    0,    0,    0,    0, 1055, 1055, 1055,
+     1055, 1055, 1055, 1066, 1066, 1066, 1066, 1066, 1066, 1066,
+     1066, 1066,    0,    0,    0, 1066,    0,    0,    0,    0,
+        0, 1066, 1066, 1066, 1066, 1066, 1066, 1078, 1078, 1078,
+     1078, 1078, 1078, 1078, 1078, 1078,    0,    0,    0, 1078,
 
-     1085,    0,    0,    0, 1085,    0,    0,    0,    0,    0,
-     1085, 1085, 1085, 1085, 1085, 1085, 1099, 1099, 1099, 1099,
-     1099, 1099, 1099, 1099, 1099,    0,    0,    0, 1099,    0,
-        0,    0,    0,    0, 1099, 1099, 1099, 1099, 1099, 1099,
-     1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101,    0,
-        0,    0, 1101,    0, 1101,    0,    0,    0, 1101, 1101,
-     1101, 1101, 1101, 1101, 1265, 1265, 1265, 1265, 1265, 1265,
-     1265, 1267, 1267, 1267, 1267, 1267, 1267, 1267,    0,    0,
-     1101, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
-     1273, 1273, 1273, 1273, 1273, 1273, 1273,    0, 1330, 1115,
+        0,    0,    0,    0,    0, 1078, 1078, 1078, 1078, 1078,
+     1078, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090,
+        0,    0,    0, 1090,    0,    0,    0,    0,    0, 1090,
+     1090, 1090, 1090, 1090, 1090, 1104, 1104, 1104, 1104, 1104,
+     1104, 1104, 1104, 1104,    0,    0,    0, 1104,    0,    0,
+        0,    0,    0, 1104, 1104, 1104, 1104, 1104, 1104, 1106,
+     1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,    0,    0,
+        0, 1106,    0, 1106,    0,    0,    0, 1106, 1106, 1106,
+     1106, 1106, 1106, 1270, 1270, 1270, 1270, 1270, 1270, 1270,
+     1272, 1272, 1272, 1272, 1272, 1272, 1272,    0,    0, 1106,
 
-     1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,    0,    0,
-        0, 1117, 1330,    0,    0,    0,    0, 1117, 1117, 1117,
-     1117, 1117, 1117, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
-     1118, 1118,    0,    0,    0, 1118,    0, 1118, 1330,    0,
-        0, 1118, 1118, 1118, 1118, 1118, 1118, 1275, 1275, 1275,
-     1275, 1275, 1275, 1275, 1282, 1282, 1282, 1282, 1282, 1282,
-     1282,    0,    0, 1118, 1121, 1121, 1121, 1121, 1121, 1121,
-     1121, 1121, 1121,    0,    0,    0, 1121,    0, 1121,    0,
-        0,    0, 1121, 1121, 1121, 1121, 1121, 1121, 1307, 1307,
-     1307, 1307, 1307, 1307, 1307, 1319, 1319, 1319, 1319, 1319,
+     1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1278,
+     1278, 1278, 1278, 1278, 1278, 1278,    0, 1336, 1120, 1122,
+     1122, 1122, 1122, 1122, 1122, 1122, 1122,    0,    0,    0,
+     1122, 1336,    0,    0,    0,    0, 1122, 1122, 1122, 1122,
+     1122, 1122, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
+     1123,    0,    0,    0, 1123,    0, 1123, 1336,    0,    0,
+     1123, 1123, 1123, 1123, 1123, 1123, 1280, 1280, 1280, 1280,
+     1280, 1280, 1280, 1287, 1287, 1287, 1287, 1287, 1287, 1287,
+        0,    0, 1123, 1126, 1126, 1126, 1126, 1126, 1126, 1126,
+     1126, 1126,    0,    0,    0, 1126,    0, 1126,    0,    0,
 
-     1319, 1319, 1331,    0, 1121, 1124, 1124, 1124, 1124, 1124,
-     1124, 1124, 1124, 1124,    0,    0, 1331, 1124,    0, 1124,
-        0,    0, 1339, 1124, 1124, 1124, 1124, 1124, 1124, 1328,
-     1328, 1328, 1328, 1328, 1328, 1328, 1339,    0,    0,    0,
-        0, 1340, 1331, 1348,    0, 1124, 1127, 1127, 1127, 1127,
-     1127, 1127, 1127, 1127, 1127, 1340,    0, 1348, 1127,    0,
-     1127,    0, 1339, 1349, 1127, 1127, 1127, 1127, 1127, 1127,
-     1337, 1337, 1337, 1337, 1337, 1337, 1337, 1349,    0,    0,
-        0, 1340,    0, 1348,    0,    0, 1127, 1130, 1130, 1130,
-     1130, 1130, 1130, 1130, 1130, 1130,    0,    0,    0, 1130,
+        0, 1126, 1126, 1126, 1126, 1126, 1126, 1312, 1312, 1312,
+     1312, 1312, 1312, 1312, 1324, 1324, 1324, 1324, 1324, 1324,
+     1324,    0,    0, 1126, 1129, 1129, 1129, 1129, 1129, 1129,
+     1129, 1129, 1129,    0,    0,    0, 1129,    0, 1129,    0,
+        0,    0, 1129, 1129, 1129, 1129, 1129, 1129, 1333, 1333,
+     1333, 1333, 1333, 1333, 1333, 1342, 1342, 1342, 1342, 1342,
+     1342, 1342, 1344,    0, 1129, 1132, 1132, 1132, 1132, 1132,
+     1132, 1132, 1132, 1132,    0, 1345, 1344, 1132,    0, 1132,
+        0,    0,    0, 1132, 1132, 1132, 1132, 1132, 1132, 1345,
+     1351, 1351, 1351, 1351, 1351, 1351, 1351,    0,    0,    0,
 
-        0, 1130,    0, 1349,    0, 1130, 1130, 1130, 1130, 1130,
-     1130, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1354, 1354,
-     1354, 1354, 1354, 1354, 1354, 1373,    0, 1130, 1135, 1135,
-     1135, 1135, 1135, 1135, 1135, 1135, 1135,    0,    0, 1373,
-     1135,    0,    0,    0,    0,    0, 1135, 1135, 1135, 1135,
-     1135, 1135, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142,
-     1142,    0,    0,    0, 1142, 1373,    0,    0,    0,    0,
-     1142, 1142, 1142, 1142, 1142, 1142, 1152, 1152, 1152, 1152,
-     1152, 1152, 1152, 1152, 1152,    0,    0,    0, 1152,    0,
-        0,    0,    0,    0, 1152, 1152, 1152, 1152, 1152, 1152,
+        0,    0, 1344, 1353,    0, 1132, 1135, 1135, 1135, 1135,
+     1135, 1135, 1135, 1135, 1135, 1345, 1354, 1353, 1135,    0,
+     1135,    0,    0,    0, 1135, 1135, 1135, 1135, 1135, 1135,
+     1354, 1359, 1359, 1359, 1359, 1359, 1359, 1359,    0,    0,
+        0,    0,    0, 1353, 1378,    0, 1135, 1140, 1140, 1140,
+     1140, 1140, 1140, 1140, 1140, 1140, 1354,    0, 1378, 1140,
+        0,    0,    0,    0,    0, 1140, 1140, 1140, 1140, 1140,
+     1140, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147,
+        0,    0,    0, 1147, 1378,    0,    0,    0,    0, 1147,
+     1147, 1147, 1147, 1147, 1147, 1157, 1157, 1157, 1157, 1157,
 
-     1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165,    0,
-        0,    0, 1165,    0,    0,    0,    0,    0, 1165, 1165,
-     1165, 1165, 1165, 1165, 1179, 1179, 1179, 1179, 1179, 1179,
-     1179, 1179, 1179,    0,    0,    0, 1179,    0,    0,    0,
-        0,    0, 1179, 1179, 1179, 1179, 1179, 1179, 1193, 1193,
-     1193, 1193, 1193, 1193, 1193, 1193, 1193,    0,    0,    0,
-     1193,    0,    0,    0,    0,    0, 1193, 1193, 1193, 1193,
-     1193, 1193, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205,
-     1205,    0,    0,    0, 1205,    0,    0,    0,    0,    0,
-     1205, 1205, 1205, 1205, 1205, 1205, 1217, 1217, 1217, 1217,
+     1157, 1157, 1157, 1157,    0,    0,    0, 1157,    0,    0,
+        0,    0,    0, 1157, 1157, 1157, 1157, 1157, 1157, 1170,
+     1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170,    0,    0,
+        0, 1170,    0,    0,    0,    0,    0, 1170, 1170, 1170,
+     1170, 1170, 1170, 1184, 1184, 1184, 1184, 1184, 1184, 1184,
+     1184, 1184,    0,    0,    0, 1184,    0,    0,    0,    0,
+        0, 1184, 1184, 1184, 1184, 1184, 1184, 1198, 1198, 1198,
+     1198, 1198, 1198, 1198, 1198, 1198,    0,    0,    0, 1198,
+        0,    0,    0,    0,    0, 1198, 1198, 1198, 1198, 1198,
+     1198, 1210, 1210, 1210, 1210, 1210, 1210, 1210, 1210, 1210,
 
-     1217, 1217, 1217, 1217, 1217,    0,    0,    0, 1217,    0,
-     1217,    0,    0, 1374, 1217, 1217, 1217, 1217, 1217, 1217,
-     1356, 1356, 1356, 1356, 1356, 1356, 1356, 1374, 1379, 1379,
-     1379, 1379, 1379, 1379, 1379,    0, 1217, 1221, 1221, 1221,
-     1221, 1221, 1221, 1221, 1221, 1221,    0,    0,    0, 1221,
-        0,    0,    0, 1374,    0, 1221, 1221, 1221, 1221, 1221,
-     1221, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 1224,
-        0,    0,    0, 1224,    0,    0,    0,    0,    0, 1224,
-     1224, 1224, 1224, 1224, 1224, 1227, 1227, 1227, 1227, 1227,
-     1227, 1227, 1227, 1227,    0,    0,    0, 1227,    0,    0,
+        0,    0,    0, 1210,    0,    0,    0,    0,    0, 1210,
+     1210, 1210, 1210, 1210, 1210, 1222, 1222, 1222, 1222, 1222,
+     1222, 1222, 1222, 1222,    0,    0,    0, 1222,    0, 1222,
+        0,    0, 1379, 1222, 1222, 1222, 1222, 1222, 1222, 1361,
+     1361, 1361, 1361, 1361, 1361, 1361, 1379, 1384, 1384, 1384,
+     1384, 1384, 1384, 1384,    0, 1222, 1226, 1226, 1226, 1226,
+     1226, 1226, 1226, 1226, 1226,    0,    0,    0, 1226,    0,
+        0,    0, 1379,    0, 1226, 1226, 1226, 1226, 1226, 1226,
+     1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229,    0,
+        0,    0, 1229,    0,    0,    0,    0,    0, 1229, 1229,
 
-        0,    0,    0, 1227, 1227, 1227, 1227, 1227, 1227, 1230,
-     1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,    0,    0,
-        0, 1230,    0,    0,    0,    0,    0, 1230, 1230, 1230,
-     1230, 1230, 1230, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
-     1233, 1233,    0,    0,    0, 1233,    0,    0,    0,    0,
-        0, 1233, 1233, 1233, 1233, 1233, 1233, 1238, 1238, 1238,
-     1238, 1238, 1238, 1238, 1238, 1238,    0,    0,    0, 1238,
-        0,    0,    0,    0,    0, 1238, 1238, 1238, 1238, 1238,
-     1238, 1290, 1290, 1290, 1290, 1290, 1290, 1290, 1290, 1290,
-        0,    0,    0, 1290,    0,    0,    0,    0,    0, 1290,
+     1229, 1229, 1229, 1229, 1232, 1232, 1232, 1232, 1232, 1232,
+     1232, 1232, 1232,    0,    0,    0, 1232,    0,    0,    0,
+        0,    0, 1232, 1232, 1232, 1232, 1232, 1232, 1235, 1235,
+     1235, 1235, 1235, 1235, 1235, 1235, 1235,    0,    0,    0,
+     1235,    0,    0,    0,    0,    0, 1235, 1235, 1235, 1235,
+     1235, 1235, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238,
+     1238,    0,    0,    0, 1238,    0,    0,    0,    0,    0,
+     1238, 1238, 1238, 1238, 1238, 1238, 1243, 1243, 1243, 1243,
+     1243, 1243, 1243, 1243, 1243,    0,    0,    0, 1243,    0,
+        0,    0,    0,    0, 1243, 1243, 1243, 1243, 1243, 1243,
 
-     1290, 1290, 1290, 1290, 1290, 1298, 1298, 1298, 1298, 1298,
-     1298, 1298, 1298, 1298,    0,    0,    0, 1298,    0,    0,
-        0,    0,    0, 1298, 1298, 1298, 1298, 1298, 1298, 1383,
-     1383, 1383, 1383, 1383, 1383, 1383, 1387, 1387, 1387, 1387,
-     1387, 1387, 1387, 1391, 1391, 1391, 1391, 1391, 1391, 1391,
-     1395, 1395, 1395, 1395, 1395, 1395, 1395, 1400, 1400, 1400,
-     1400, 1400, 1400, 1400, 1402, 1403, 1411, 1411, 1411, 1411,
-     1411, 1411, 1411,    0,    0,    0,    0,    0, 1402, 1403,
-     1414, 1414, 1414, 1414, 1414, 1414, 1414, 1418, 1418, 1418,
-     1418, 1418, 1418, 1418, 1422, 1422, 1422, 1422, 1422, 1422,
+     1295, 1295, 1295, 1295, 1295, 1295, 1295, 1295, 1295,    0,
+        0,    0, 1295,    0,    0,    0,    0,    0, 1295, 1295,
+     1295, 1295, 1295, 1295, 1303, 1303, 1303, 1303, 1303, 1303,
+     1303, 1303, 1303,    0,    0,    0, 1303,    0,    0,    0,
+        0,    0, 1303, 1303, 1303, 1303, 1303, 1303, 1388, 1388,
+     1388, 1388, 1388, 1388, 1388, 1392, 1392, 1392, 1392, 1392,
+     1392, 1392, 1396, 1396, 1396, 1396, 1396, 1396, 1396, 1400,
+     1400, 1400, 1400, 1400, 1400, 1400, 1405, 1405, 1405, 1405,
+     1405, 1405, 1405, 1407, 1408, 1416, 1416, 1416, 1416, 1416,
+     1416, 1416,    0,    0,    0,    0,    0, 1407, 1408, 1419,
 
-     1422,    0,    0,    0, 1402, 1403, 1426, 1426, 1426, 1426,
-     1426, 1426, 1426, 1430, 1430, 1430, 1430, 1430, 1430, 1430,
-     1433, 1433, 1433, 1433, 1433, 1433, 1433, 1438, 1438, 1438,
-     1438, 1438, 1438, 1438, 1447, 1447, 1447, 1447, 1447, 1447,
-     1447, 1459,    0,    0,    0,    0, 1459, 1459, 1459, 1460,
-        0, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1461,    0,
-     1461, 1462, 1462, 1462, 1463, 1463, 1463, 1464, 1464, 1464,
-     1465, 1465, 1465, 1466, 1466, 1466, 1467, 1467, 1467, 1468,
-     1468, 1468, 1469, 1469, 1469, 1470, 1470, 1470, 1471,    0,
-     1471, 1472, 1472, 1472, 1473, 1473, 1473, 1474, 1474, 1474,
+     1419, 1419, 1419, 1419, 1419, 1419, 1423, 1423, 1423, 1423,
+     1423, 1423, 1423, 1427, 1427, 1427, 1427, 1427, 1427, 1427,
+        0,    0,    0, 1407, 1408, 1431, 1431, 1431, 1431, 1431,
+     1431, 1431, 1435, 1435, 1435, 1435, 1435, 1435, 1435, 1438,
+     1438, 1438, 1438, 1438, 1438, 1438, 1443, 1443, 1443, 1443,
+     1443, 1443, 1443, 1452, 1452, 1452, 1452, 1452, 1452, 1452,
+     1464,    0,    0,    0,    0, 1464, 1464, 1464, 1465,    0,
+     1465, 1465, 1465, 1465, 1465, 1465, 1465, 1466,    0, 1466,
+     1467, 1467, 1467, 1468, 1468, 1468, 1469, 1469, 1469, 1470,
+     1470, 1470, 1471, 1471, 1471, 1472, 1472, 1472, 1473, 1473,
 
-     1475, 1475, 1475, 1476,    0, 1476, 1477, 1477, 1477, 1478,
-     1478,    0,    0, 1478, 1479, 1479, 1479, 1480, 1480, 1480,
-     1481, 1481, 1481, 1482, 1482, 1482, 1483, 1483, 1483, 1484,
-     1484, 1484, 1485, 1485, 1485, 1486, 1486, 1486, 1487, 1487,
-     1487, 1488, 1488,    0,    0, 1488, 1489, 1489, 1489, 1490,
-     1490, 1490, 1491,    0, 1491, 1492, 1492, 1492, 1493, 1493,
-     1493, 1494,    0, 1494, 1495, 1495, 1495, 1496, 1496, 1496,
-     1497, 1497, 1497, 1498, 1498, 1498, 1499, 1499, 1499, 1500,
-        0, 1500, 1501,    0, 1501, 1502, 1502, 1502, 1503, 1503,
-     1503, 1504,    0, 1504, 1505, 1505,    0,    0, 1505, 1506,
+     1473, 1474, 1474, 1474, 1475, 1475, 1475, 1476,    0, 1476,
+     1477, 1477, 1477, 1478, 1478, 1478, 1479, 1479, 1479, 1480,
+     1480, 1480, 1481,    0, 1481, 1482, 1482, 1482, 1483, 1483,
+        0,    0, 1483, 1484, 1484, 1484, 1485, 1485, 1485, 1486,
+     1486, 1486, 1487, 1487, 1487, 1488, 1488, 1488, 1489, 1489,
+     1489, 1490, 1490, 1490, 1491, 1491, 1491, 1492, 1492, 1492,
+     1493, 1493,    0,    0, 1493, 1494, 1494, 1494, 1495, 1495,
+     1495, 1496,    0, 1496, 1497, 1497, 1497, 1498, 1498, 1498,
+     1499,    0, 1499, 1500, 1500, 1500, 1501, 1501, 1501, 1502,
+     1502, 1502, 1503, 1503, 1503, 1504, 1504, 1504, 1505,    0,
 
-     1506,    0,    0, 1506, 1507, 1507, 1507, 1508, 1508, 1508,
-     1509, 1509,    0, 1509, 1510, 1510, 1510, 1511, 1511, 1511,
-     1512, 1512, 1512, 1513, 1513, 1513, 1514, 1514, 1514, 1515,
-     1515, 1515, 1516, 1516, 1516, 1517, 1517,    0,    0, 1517,
-     1518, 1518, 1518, 1519, 1519, 1519, 1520, 1520,    0, 1520,
-     1521, 1521,    0,    0, 1521, 1522, 1522,    0, 1522, 1523,
-     1523, 1524, 1524,    0,    0, 1524, 1525, 1525, 1525, 1526,
-     1526, 1526, 1527, 1527,    0, 1527, 1528,    0, 1528, 1529,
-        0, 1529, 1530, 1530, 1530, 1531, 1531, 1531, 1532,    0,
-     1532, 1533, 1533, 1533, 1534, 1534, 1534, 1535, 1535, 1535,
+     1505, 1506,    0, 1506, 1507, 1507, 1507, 1508, 1508, 1508,
+     1509,    0, 1509, 1510, 1510,    0,    0, 1510, 1511, 1511,
+        0,    0, 1511, 1512, 1512, 1512, 1513, 1513, 1513, 1514,
+     1514,    0, 1514, 1515, 1515, 1515, 1516, 1516, 1516, 1517,
+     1517, 1517, 1518, 1518, 1518, 1519, 1519, 1519, 1520, 1520,
+     1520, 1521, 1521, 1521, 1522, 1522,    0,    0, 1522, 1523,
+     1523, 1523, 1524, 1524, 1524, 1525, 1525,    0, 1525, 1526,
+     1526,    0,    0, 1526, 1527, 1527,    0, 1527, 1528, 1528,
+     1529, 1529,    0,    0, 1529, 1530, 1530, 1530, 1531, 1531,
+     1531, 1532, 1532,    0, 1532, 1533,    0, 1533, 1534,    0,
 
-     1536, 1536, 1536, 1537, 1537, 1537, 1538, 1538, 1538, 1539,
-        0, 1539, 1540,    0, 1540, 1541, 1541, 1541, 1542, 1542,
-     1542, 1543,    0, 1543, 1544,    0, 1544, 1545,    0, 1545,
-     1546, 1546, 1546, 1547, 1547, 1547, 1548,    0, 1548, 1549,
-        0,    0, 1549, 1550, 1550,    0, 1550, 1551, 1551,    0,
-        0, 1551, 1552, 1552,    0, 1552, 1553, 1553, 1554, 1554,
-        0,    0, 1554, 1555, 1555, 1555, 1556, 1556, 1556, 1557,
-     1557,    0, 1557, 1558, 1558, 1558,    0, 1558, 1558, 1559,
-     1559, 1559, 1560, 1560, 1560, 1561, 1561, 1561, 1562, 1562,
-     1562, 1563, 1563, 1563, 1564, 1564, 1564, 1565, 1565, 1565,
+     1534, 1535, 1535, 1535, 1536, 1536, 1536, 1537,    0, 1537,
+     1538, 1538, 1538, 1539, 1539, 1539, 1540, 1540, 1540, 1541,
+     1541, 1541, 1542, 1542, 1542, 1543, 1543, 1543, 1544,    0,
+     1544, 1545,    0, 1545, 1546, 1546, 1546, 1547, 1547, 1547,
+     1548,    0, 1548, 1549,    0, 1549, 1550,    0, 1550, 1551,
+     1551, 1551, 1552, 1552, 1552, 1553,    0, 1553, 1554,    0,
+        0, 1554, 1555, 1555,    0, 1555, 1556, 1556,    0,    0,
+     1556, 1557, 1557,    0, 1557, 1558, 1558, 1559, 1559,    0,
+        0, 1559, 1560, 1560, 1560, 1561, 1561, 1561, 1562, 1562,
+        0, 1562, 1563, 1563, 1563,    0, 1563, 1563, 1564, 1564,
 
-     1566, 1566, 1566, 1567, 1567,    0,    0, 1567, 1568, 1568,
-     1568, 1569, 1569, 1569, 1570, 1570,    0, 1570, 1571, 1571,
-        0,    0, 1571, 1572, 1572,    0, 1572, 1573, 1573, 1574,
-     1574,    0,    0, 1574, 1575, 1575, 1575, 1576, 1576, 1576,
-     1577, 1577,    0, 1577, 1578,    0,    0, 1578, 1579, 1579,
-        0, 1579, 1580, 1580,    0,    0, 1580, 1581, 1581,    0,
-     1581, 1582, 1582, 1583, 1583,    0,    0, 1583, 1584, 1584,
-     1584, 1585, 1585, 1585, 1586, 1586,    0, 1586, 1587,    0,
-     1587, 1588,    0, 1588, 1589,    0, 1589, 1590, 1590, 1590,
-     1591, 1591, 1591, 1592,    0, 1592, 1593, 1593, 1593,    0,
+     1564, 1565, 1565, 1565, 1566, 1566, 1566, 1567, 1567, 1567,
+     1568, 1568, 1568, 1569, 1569, 1569, 1570, 1570, 1570, 1571,
+     1571, 1571, 1572, 1572,    0,    0, 1572, 1573, 1573, 1573,
+     1574, 1574, 1574, 1575, 1575,    0, 1575, 1576, 1576,    0,
+        0, 1576, 1577, 1577,    0, 1577, 1578, 1578, 1579, 1579,
+        0,    0, 1579, 1580, 1580, 1580, 1581, 1581, 1581, 1582,
+     1582,    0, 1582, 1583,    0,    0, 1583, 1584, 1584,    0,
+     1584, 1585, 1585,    0,    0, 1585, 1586, 1586,    0, 1586,
+     1587, 1587, 1588, 1588,    0,    0, 1588, 1589, 1589, 1589,
+     1590, 1590, 1590, 1591, 1591,    0, 1591, 1592,    0, 1592,
 
-     1593, 1593, 1594, 1594, 1594, 1595, 1595, 1595, 1596, 1596,
-     1596, 1597, 1597, 1597, 1598, 1598, 1598, 1599, 1599, 1599,
-     1600, 1600, 1600, 1601,    0, 1601, 1602,    0, 1602, 1603,
-     1603, 1603, 1604, 1604, 1604, 1605,    0, 1605, 1606,    0,
-     1606, 1607,    0, 1607, 1608, 1608, 1608, 1609, 1609, 1609,
-     1610,    0, 1610, 1611,    0, 1611, 1612,    0, 1612, 1613,
-        0, 1613, 1614, 1614, 1614, 1615, 1615, 1615, 1616,    0,
-     1616, 1617,    0, 1617, 1618,    0,    0, 1618, 1619, 1619,
-        0, 1619, 1620, 1620,    0,    0, 1620, 1621, 1621,    0,
-     1621, 1622, 1622, 1623, 1623,    0,    0, 1623, 1624, 1624,
+     1593,    0, 1593, 1594,    0, 1594, 1595, 1595, 1595, 1596,
+     1596, 1596, 1597,    0, 1597, 1598, 1598, 1598,    0, 1598,
+     1598, 1599, 1599, 1599, 1600, 1600, 1600, 1601, 1601, 1601,
+     1602, 1602, 1602, 1603, 1603, 1603, 1604, 1604, 1604, 1605,
+     1605, 1605, 1606,    0, 1606, 1607,    0, 1607, 1608, 1608,
+     1608, 1609, 1609, 1609, 1610,    0, 1610, 1611,    0, 1611,
+     1612,    0, 1612, 1613, 1613, 1613, 1614, 1614, 1614, 1615,
+        0, 1615, 1616,    0, 1616, 1617,    0, 1617, 1618,    0,
+     1618, 1619, 1619, 1619, 1620, 1620, 1620, 1621,    0, 1621,
+     1622,    0, 1622, 1623,    0,    0, 1623, 1624, 1624,    0,
 
-     1624, 1625, 1625, 1625, 1626, 1626,    0, 1626, 1627, 1627,
-     1627,    0, 1627, 1627, 1628, 1628, 1628, 1629, 1629, 1629,
-     1630, 1630, 1630, 1631, 1631, 1631, 1632, 1632, 1632, 1633,
-     1633, 1633, 1634, 1634, 1634, 1635, 1635, 1635, 1636, 1636,
-        0,    0, 1636, 1637, 1637, 1637, 1638, 1638, 1638, 1639,
-     1639,    0, 1639, 1640, 1640,    0,    0, 1640, 1641, 1641,
-        0, 1641, 1642, 1642, 1643, 1643,    0,    0, 1643, 1644,
-     1644, 1644, 1645, 1645, 1645, 1646, 1646,    0, 1646, 1647,
-        0,    0, 1647, 1648, 1648,    0, 1648, 1649, 1649,    0,
-        0, 1649, 1650, 1650,    0, 1650, 1651, 1651, 1652, 1652,
+     1624, 1625, 1625,    0,    0, 1625, 1626, 1626,    0, 1626,
+     1627, 1627, 1628, 1628,    0,    0, 1628, 1629, 1629, 1629,
+     1630, 1630, 1630, 1631, 1631,    0, 1631, 1632, 1632, 1632,
+        0, 1632, 1632, 1633, 1633, 1633, 1634, 1634, 1634, 1635,
+     1635, 1635, 1636, 1636, 1636, 1637, 1637, 1637, 1638, 1638,
+     1638, 1639, 1639, 1639, 1640, 1640, 1640, 1641, 1641,    0,
+        0, 1641, 1642, 1642, 1642, 1643, 1643, 1643, 1644, 1644,
+        0, 1644, 1645, 1645,    0,    0, 1645, 1646, 1646,    0,
+     1646, 1647, 1647, 1648, 1648,    0,    0, 1648, 1649, 1649,
+     1649, 1650, 1650, 1650, 1651, 1651,    0, 1651, 1652,    0,
 
-        0,    0, 1652, 1653, 1653, 1653, 1654, 1654, 1654, 1655,
-     1655,    0, 1655, 1656,    0, 1656, 1657,    0,    0, 1657,
-     1658, 1658,    0, 1658, 1659, 1659,    0,    0, 1659, 1660,
-     1660,    0, 1660, 1661, 1661, 1662, 1662,    0,    0, 1662,
-     1663, 1663, 1663, 1664, 1664, 1664, 1665, 1665,    0, 1665,
-     1666,    0, 1666, 1667,    0, 1667, 1668,    0, 1668, 1669,
-     1669, 1669, 1670, 1670, 1670, 1671,    0, 1671, 1672, 1672,
-     1672,    0, 1672, 1672, 1673, 1673, 1673, 1674, 1674, 1674,
-     1675, 1675, 1675, 1676, 1676, 1676, 1677, 1677, 1677, 1678,
-     1678, 1678, 1679, 1679, 1679, 1680, 1680, 1680, 1681, 1681,
+        0, 1652, 1653, 1653,    0, 1653, 1654, 1654,    0,    0,
+     1654, 1655, 1655,    0, 1655, 1656, 1656, 1657, 1657,    0,
+        0, 1657, 1658, 1658, 1658, 1659, 1659, 1659, 1660, 1660,
+        0, 1660, 1661,    0, 1661, 1662,    0,    0, 1662, 1663,
+     1663,    0, 1663, 1664, 1664,    0,    0, 1664, 1665, 1665,
+        0, 1665, 1666, 1666, 1667, 1667,    0,    0, 1667, 1668,
+     1668, 1668, 1669, 1669, 1669, 1670, 1670,    0, 1670, 1671,
+        0, 1671, 1672,    0, 1672, 1673,    0, 1673, 1674, 1674,
+     1674, 1675, 1675, 1675, 1676,    0, 1676, 1677, 1677, 1677,
+        0, 1677, 1677, 1678, 1678, 1678, 1679, 1679, 1679, 1680,
 
-     1681, 1682, 1682, 1682, 1683,    0, 1683, 1684,    0, 1684,
-     1685, 1685, 1685, 1686, 1686, 1686, 1687, 1687, 1687, 1688,
-        0, 1688, 1689,    0, 1689, 1690,    0, 1690, 1691, 1691,
-     1691, 1692, 1692, 1692, 1693, 1693, 1693, 1694,    0, 1694,
-     1695,    0, 1695, 1696,    0, 1696, 1697,    0, 1697, 1698,
-     1698, 1698, 1699, 1699, 1699, 1700, 1700, 1700, 1701,    0,
-     1701, 1702,    0, 1702, 1703,    0, 1703, 1704,    0, 1704,
-     1705, 1705, 1705, 1706, 1706, 1706, 1707, 1707, 1707, 1708,
-        0, 1708, 1709,    0, 1709, 1710,    0,    0, 1710, 1711,
-     1711,    0, 1711, 1712, 1712,    0,    0, 1712, 1713, 1713,
+     1680, 1680, 1681, 1681, 1681, 1682, 1682, 1682, 1683, 1683,
+     1683, 1684, 1684, 1684, 1685, 1685, 1685, 1686, 1686, 1686,
+     1687, 1687, 1687, 1688,    0, 1688, 1689,    0, 1689, 1690,
+     1690, 1690, 1691, 1691, 1691, 1692, 1692, 1692, 1693,    0,
+     1693, 1694,    0, 1694, 1695,    0, 1695, 1696, 1696, 1696,
+     1697, 1697, 1697, 1698, 1698, 1698, 1699,    0, 1699, 1700,
+        0, 1700, 1701,    0, 1701, 1702,    0, 1702, 1703, 1703,
+     1703, 1704, 1704, 1704, 1705, 1705, 1705, 1706,    0, 1706,
+     1707,    0, 1707, 1708,    0, 1708, 1709,    0, 1709, 1710,
+     1710, 1710, 1711, 1711, 1711, 1712, 1712, 1712, 1713,    0,
 
-        0, 1713, 1714, 1714, 1715, 1715,    0,    0, 1715, 1716,
-     1716, 1716, 1717, 1717, 1717, 1718, 1718,    0, 1718, 1719,
-     1719, 1719,    0, 1719, 1719, 1720, 1720, 1720, 1721, 1721,
-     1721, 1722, 1722, 1722, 1723, 1723, 1723, 1724, 1724, 1724,
-     1725, 1725, 1725, 1726, 1726, 1726, 1727, 1727, 1727, 1728,
-        0, 1728, 1729, 1729, 1729, 1730, 1730,    0,    0, 1730,
-     1731, 1731, 1731, 1732, 1732, 1732, 1733, 1733,    0, 1733,
-     1734, 1734,    0,    0, 1734, 1735, 1735,    0, 1735, 1736,
-     1736, 1737, 1737,    0,    0, 1737, 1738, 1738, 1738, 1739,
-     1739, 1739, 1740, 1740,    0, 1740, 1741,    0,    0, 1741,
+     1713, 1714,    0, 1714, 1715,    0,    0, 1715, 1716, 1716,
+        0, 1716, 1717, 1717,    0,    0, 1717, 1718, 1718,    0,
+     1718, 1719, 1719, 1720, 1720,    0,    0, 1720, 1721, 1721,
+     1721, 1722, 1722, 1722, 1723, 1723,    0, 1723, 1724, 1724,
+     1724,    0, 1724, 1724, 1725, 1725, 1725, 1726, 1726, 1726,
+     1727, 1727, 1727, 1728, 1728, 1728, 1729, 1729, 1729, 1730,
+     1730, 1730, 1731, 1731, 1731, 1732, 1732, 1732, 1733,    0,
+     1733, 1734, 1734, 1734, 1735, 1735,    0,    0, 1735, 1736,
+     1736, 1736, 1737, 1737, 1737, 1738, 1738,    0, 1738, 1739,
+     1739,    0,    0, 1739, 1740, 1740,    0, 1740, 1741, 1741,
 
-     1742, 1742,    0, 1742, 1743, 1743,    0,    0, 1743, 1744,
-     1744,    0, 1744, 1745, 1745, 1746, 1746,    0,    0, 1746,
-     1747, 1747, 1747, 1748, 1748, 1748, 1749, 1749,    0, 1749,
-     1750,    0, 1750, 1751,    0,    0, 1751, 1752, 1752,    0,
-     1752, 1753, 1753,    0,    0, 1753, 1754, 1754,    0, 1754,
-     1755, 1755, 1756, 1756,    0,    0, 1756, 1757, 1757, 1757,
-     1758, 1758, 1758, 1759, 1759,    0, 1759, 1760,    0, 1760,
-     1761,    0,    0, 1761, 1762, 1762,    0, 1762, 1763, 1763,
-        0,    0, 1763, 1764, 1764,    0, 1764, 1765, 1765, 1766,
-     1766,    0,    0, 1766, 1767, 1767, 1767, 1768, 1768, 1768,
+     1742, 1742,    0,    0, 1742, 1743, 1743, 1743, 1744, 1744,
+     1744, 1745, 1745,    0, 1745, 1746,    0,    0, 1746, 1747,
+     1747,    0, 1747, 1748, 1748,    0,    0, 1748, 1749, 1749,
+        0, 1749, 1750, 1750, 1751, 1751,    0,    0, 1751, 1752,
+     1752, 1752, 1753, 1753, 1753, 1754, 1754,    0, 1754, 1755,
+        0, 1755, 1756,    0,    0, 1756, 1757, 1757,    0, 1757,
+     1758, 1758,    0,    0, 1758, 1759, 1759,    0, 1759, 1760,
+     1760, 1761, 1761,    0,    0, 1761, 1762, 1762, 1762, 1763,
+     1763, 1763, 1764, 1764,    0, 1764, 1765,    0, 1765, 1766,
+        0,    0, 1766, 1767, 1767,    0, 1767, 1768, 1768,    0,
 
-     1769, 1769,    0, 1769, 1770,    0, 1770, 1771,    0, 1771,
-     1772,    0, 1772, 1773, 1773, 1773, 1774,    0, 1774, 1775,
-     1775, 1775, 1776,    0, 1776, 1777, 1777, 1777,    0, 1777,
-     1777, 1778,    0, 1778, 1779, 1779, 1779, 1780,    0, 1780,
-     1781, 1781, 1781, 1782,    0, 1782, 1783, 1783, 1783, 1784,
-        0, 1784, 1785, 1785, 1785, 1786,    0, 1786, 1787, 1787,
-     1787, 1788,    0, 1788, 1789, 1789, 1789, 1790, 1790,    0,
-        0, 1790, 1791, 1791, 1791, 1792, 1792, 1792, 1793, 1793,
-     1793, 1794, 1794,    0, 1794, 1795, 1795, 1795, 1796,    0,
-     1796, 1797, 1797, 1797, 1798, 1798, 1798, 1799,    0, 1799,
+        0, 1768, 1769, 1769,    0, 1769, 1770, 1770, 1771, 1771,
+        0,    0, 1771, 1772, 1772, 1772, 1773, 1773, 1773, 1774,
+     1774,    0, 1774, 1775,    0, 1775, 1776,    0, 1776, 1777,
+        0, 1777, 1778, 1778, 1778, 1779,    0, 1779, 1780, 1780,
+     1780, 1781,    0, 1781, 1782, 1782, 1782,    0, 1782, 1782,
+     1783,    0, 1783, 1784, 1784, 1784, 1785,    0, 1785, 1786,
+     1786, 1786, 1787,    0, 1787, 1788, 1788, 1788, 1789,    0,
+     1789, 1790, 1790, 1790, 1791,    0, 1791, 1792, 1792, 1792,
+     1793,    0, 1793, 1794, 1794, 1794, 1795, 1795,    0,    0,
+     1795, 1796, 1796, 1796, 1797, 1797, 1797, 1798, 1798, 1798,
 
-     1800,    0, 1800, 1801, 1801, 1801, 1802, 1802, 1802, 1803,
-        0, 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, 1814, 1815,    0, 1815, 1816, 1816,
-     1816, 1817, 1817, 1817, 1818,    0, 1818, 1819,    0,    0,
-     1819, 1820, 1820,    0, 1820, 1821, 1821,    0,    0, 1821,
-     1822, 1822,    0, 1822, 1823, 1823, 1824, 1824,    0,    0,
-     1824, 1825, 1825, 1825, 1826,    0, 1826, 1827, 1827,    0,
-     1827, 1828, 1828, 1828,    0, 1828, 1828, 1829, 1829, 1829,
+     1799, 1799,    0, 1799, 1800, 1800, 1800, 1801,    0, 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, 1814, 1815,
+        0, 1815, 1816, 1816, 1816, 1817, 1817, 1817, 1818,    0,
+     1818, 1819,    0, 1819, 1820,    0, 1820, 1821, 1821, 1821,
+     1822, 1822, 1822, 1823,    0, 1823, 1824,    0,    0, 1824,
+     1825, 1825,    0, 1825, 1826, 1826,    0,    0, 1826, 1827,
+     1827,    0, 1827, 1828, 1828, 1829, 1829,    0,    0, 1829,
 
-     1830, 1830, 1830, 1831,    0, 1831, 1832,    0, 1832, 1833,
-        0, 1833, 1834,    0, 1834, 1835,    0, 1835, 1836,    0,
-     1836, 1837,    0, 1837, 1838, 1838, 1838, 1839, 1839, 1839,
-     1840,    0, 1840, 1841, 1841,    0,    0, 1841, 1842, 1842,
-        0, 1842, 1843, 1843, 1844,    0, 1844, 1845,    0,    0,
-     1845, 1846, 1846,    0, 1846, 1847, 1847,    0,    0, 1847,
-     1848, 1848,    0, 1848, 1849, 1849, 1850,    0, 1850, 1851,
-        0, 1851, 1852,    0,    0, 1852, 1853, 1853,    0, 1853,
-     1854, 1854,    0,    0, 1854, 1855, 1855,    0, 1855, 1856,
-     1856, 1857,    0, 1857, 1858,    0, 1858, 1859,    0,    0,
+     1830, 1830, 1830, 1831,    0, 1831, 1832, 1832,    0, 1832,
+     1833, 1833, 1833,    0, 1833, 1833, 1834, 1834, 1834, 1835,
+     1835, 1835, 1836,    0, 1836, 1837,    0, 1837, 1838,    0,
+     1838, 1839,    0, 1839, 1840,    0, 1840, 1841,    0, 1841,
+     1842,    0, 1842, 1843, 1843, 1843, 1844, 1844, 1844, 1845,
+        0, 1845, 1846, 1846,    0,    0, 1846, 1847, 1847,    0,
+     1847, 1848, 1848, 1849,    0, 1849, 1850,    0,    0, 1850,
+     1851, 1851,    0, 1851, 1852, 1852,    0,    0, 1852, 1853,
+     1853,    0, 1853, 1854, 1854, 1855,    0, 1855, 1856,    0,
+     1856, 1857,    0,    0, 1857, 1858, 1858,    0, 1858, 1859,
 
-     1859, 1860, 1860,    0, 1860, 1861, 1861,    0,    0, 1861,
-     1862, 1862,    0, 1862, 1863, 1863, 1864,    0, 1864, 1865,
-        0, 1865, 1866,    0,    0, 1866, 1867, 1867,    0, 1867,
-     1868, 1868,    0,    0, 1868, 1869, 1869,    0, 1869, 1870,
-     1870, 1871,    0, 1871, 1872,    0, 1872, 1873,    0, 1873,
-     1874,    0, 1874, 1875, 1875, 1875, 1876,    0, 1876, 1877,
-     1877, 1877,    0, 1877, 1877, 1878,    0, 1878, 1879,    0,
-     1879, 1880,    0, 1880, 1881,    0, 1881, 1882,    0, 1882,
-     1883,    0, 1883, 1884,    0, 1884, 1885, 1885,    0,    0,
-     1885, 1886, 1886,    0, 1886, 1887, 1887, 1888,    0, 1888,
+     1859,    0,    0, 1859, 1860, 1860,    0, 1860, 1861, 1861,
+     1862,    0, 1862, 1863,    0, 1863, 1864,    0,    0, 1864,
+     1865, 1865,    0, 1865, 1866, 1866,    0,    0, 1866, 1867,
+     1867,    0, 1867, 1868, 1868, 1869,    0, 1869, 1870,    0,
+     1870, 1871,    0,    0, 1871, 1872, 1872,    0, 1872, 1873,
+     1873,    0,    0, 1873, 1874, 1874,    0, 1874, 1875, 1875,
+     1876,    0, 1876, 1877,    0, 1877, 1878,    0, 1878, 1879,
+        0, 1879, 1880, 1880, 1880, 1881,    0, 1881, 1882, 1882,
+     1882,    0, 1882, 1882, 1883,    0, 1883, 1884,    0, 1884,
+     1885,    0, 1885, 1886,    0, 1886, 1887,    0, 1887, 1888,
 
-     1889,    0, 1889, 1890,    0, 1890, 1891,    0, 1891, 1892,
-        0, 1892, 1893,    0, 1893, 1894,    0, 1894, 1895,    0,
-     1895, 1896,    0, 1896, 1897,    0, 1897, 1898,    0,    0,
-     1898, 1899, 1899,    0,    0, 1899, 1900,    0, 1900, 1901,
-        0, 1901, 1902,    0, 1902, 1903,    0,    0, 1903, 1904,
-        0,    0, 1904, 1905,    0,    0, 1905, 1906,    0,    0,
-     1906, 1907,    0,    0, 1907, 1908,    0, 1908, 1909,    0,
-     1909, 1910,    0,    0, 1910, 1911,    0, 1911, 1912,    0,
-     1912, 1913,    0, 1913, 1914,    0, 1914, 1915,    0, 1915,
-     1916,    0,    0, 1916, 1917,    0, 1917, 1918,    0, 1918,
+        0, 1888, 1889,    0, 1889, 1890, 1890,    0,    0, 1890,
+     1891, 1891,    0, 1891, 1892, 1892, 1893,    0, 1893, 1894,
+        0, 1894, 1895,    0, 1895, 1896,    0, 1896, 1897,    0,
+     1897, 1898,    0, 1898, 1899,    0, 1899, 1900,    0, 1900,
+     1901,    0, 1901, 1902,    0, 1902, 1903,    0,    0, 1903,
+     1904, 1904,    0,    0, 1904, 1905,    0, 1905, 1906,    0,
+     1906, 1907,    0, 1907, 1908,    0,    0, 1908, 1909,    0,
+        0, 1909, 1910,    0,    0, 1910, 1911,    0,    0, 1911,
+     1912,    0,    0, 1912, 1913,    0, 1913, 1914,    0, 1914,
+     1915,    0,    0, 1915, 1916,    0, 1916, 1917,    0, 1917,
 
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458,
-     1458, 1458, 1458, 1458
+     1918,    0, 1918, 1919,    0, 1919, 1920,    0, 1920, 1921,
+        0,    0, 1921, 1922,    0, 1922, 1923,    0, 1923, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+     1463, 1463, 1463
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -2718,15 +2729,6 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.112 2008-02-06 10:21:30 guy Exp $ (LBL)";
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #ifdef WIN32
 #include <pcap-stdinc.h>
 #else /* WIN32 */
@@ -2788,7 +2790,7 @@
 #define yylval pcap_lval
 extern YYSTYPE yylval;
 
-#line 2792 "scanner.c"
+#line 2791 "scanner.c"
 
 #define INITIAL 0
 
@@ -2957,10 +2959,6 @@
 	register char *yy_cp, *yy_bp;
 	register int yy_act;
     
-#line 189 "scanner.l"
-
-#line 2963 "scanner.c"
-
 	if ( !(yy_init) )
 		{
 		(yy_init) = 1;
@@ -2987,6 +2985,11 @@
 		pcap__load_buffer_state( );
 		}
 
+	{
+#line 180 "scanner.l"
+
+#line 2989 "scanner.c"
+
 	while ( 1 )		/* loops until end-of-file is reached */
 		{
 		yy_cp = (yy_c_buf_p);
@@ -3003,7 +3006,7 @@
 yy_match:
 		do
 			{
-			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
 			if ( yy_accept[yy_current_state] )
 				{
 				(yy_last_accepting_state) = yy_current_state;
@@ -3012,13 +3015,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 >= 1459 )
+				if ( yy_current_state >= 1464 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_base[yy_current_state] != 7401 );
+		while ( yy_base[yy_current_state] != 7420 );
 
 yy_find_action:
 		yy_act = yy_accept[yy_current_state];
@@ -3044,257 +3047,257 @@
 
 case 1:
 YY_RULE_SETUP
-#line 190 "scanner.l"
+#line 181 "scanner.l"
 return DST;
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 191 "scanner.l"
+#line 182 "scanner.l"
 return SRC;
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 193 "scanner.l"
+#line 184 "scanner.l"
 return LINK;
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 194 "scanner.l"
+#line 185 "scanner.l"
 return LINK;
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 195 "scanner.l"
+#line 186 "scanner.l"
 return ARP;
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 196 "scanner.l"
+#line 187 "scanner.l"
 return RARP;
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 197 "scanner.l"
+#line 188 "scanner.l"
 return IP;
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 198 "scanner.l"
+#line 189 "scanner.l"
 return SCTP;
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 199 "scanner.l"
+#line 190 "scanner.l"
 return TCP;
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 200 "scanner.l"
+#line 191 "scanner.l"
 return UDP;
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 201 "scanner.l"
+#line 192 "scanner.l"
 return ICMP;
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 202 "scanner.l"
+#line 193 "scanner.l"
 return IGMP;
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 203 "scanner.l"
+#line 194 "scanner.l"
 return IGRP;
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 204 "scanner.l"
+#line 195 "scanner.l"
 return PIM;
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 205 "scanner.l"
+#line 196 "scanner.l"
 return VRRP;
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 206 "scanner.l"
+#line 197 "scanner.l"
 return CARP;
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 207 "scanner.l"
+#line 198 "scanner.l"
 return RADIO;
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 209 "scanner.l"
+#line 200 "scanner.l"
 return IPV6;
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 210 "scanner.l"
+#line 201 "scanner.l"
 return ICMPV6;
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 211 "scanner.l"
+#line 202 "scanner.l"
 return AH;
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 212 "scanner.l"
+#line 203 "scanner.l"
 return ESP;
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 214 "scanner.l"
+#line 205 "scanner.l"
 return ATALK;
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 215 "scanner.l"
+#line 206 "scanner.l"
 return AARP;
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 216 "scanner.l"
+#line 207 "scanner.l"
 return DECNET;
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 217 "scanner.l"
+#line 208 "scanner.l"
 return LAT;
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 218 "scanner.l"
+#line 209 "scanner.l"
 return SCA;
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 219 "scanner.l"
+#line 210 "scanner.l"
 return MOPRC;
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 220 "scanner.l"
+#line 211 "scanner.l"
 return MOPDL;
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 222 "scanner.l"
+#line 213 "scanner.l"
 return ISO;
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 223 "scanner.l"
+#line 214 "scanner.l"
 return ESIS;
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 224 "scanner.l"
+#line 215 "scanner.l"
 return ESIS;
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 225 "scanner.l"
+#line 216 "scanner.l"
 return ISIS;
 	YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 226 "scanner.l"
+#line 217 "scanner.l"
 return ISIS;
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 227 "scanner.l"
+#line 218 "scanner.l"
 return L1;
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 228 "scanner.l"
+#line 219 "scanner.l"
 return L2;
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 229 "scanner.l"
+#line 220 "scanner.l"
 return IIH;
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 230 "scanner.l"
+#line 221 "scanner.l"
 return LSP;
 	YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 231 "scanner.l"
+#line 222 "scanner.l"
 return SNP;
 	YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 232 "scanner.l"
+#line 223 "scanner.l"
 return CSNP;
 	YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 233 "scanner.l"
+#line 224 "scanner.l"
 return PSNP;
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 235 "scanner.l"
+#line 226 "scanner.l"
 return CLNP;
 	YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 237 "scanner.l"
+#line 228 "scanner.l"
 return STP;
 	YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 239 "scanner.l"
+#line 230 "scanner.l"
 return IPX;
 	YY_BREAK
 case 44:
 YY_RULE_SETUP
-#line 241 "scanner.l"
+#line 232 "scanner.l"
 return NETBEUI;
 	YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 243 "scanner.l"
+#line 234 "scanner.l"
 return HOST;
 	YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 244 "scanner.l"
+#line 235 "scanner.l"
 return NET;
 	YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 245 "scanner.l"
+#line 236 "scanner.l"
 return NETMASK;
 	YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 246 "scanner.l"
+#line 237 "scanner.l"
 return PORT;
 	YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 247 "scanner.l"
+#line 238 "scanner.l"
 return PORTRANGE;
 	YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 248 "scanner.l"
+#line 239 "scanner.l"
 return PROTO;
 	YY_BREAK
 case 51:
 YY_RULE_SETUP
-#line 249 "scanner.l"
+#line 240 "scanner.l"
 {
 #ifdef NO_PROTOCHAIN
 		  bpf_error("%s not supported", pcap_text);
@@ -3305,375 +3308,380 @@
 	YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 257 "scanner.l"
+#line 248 "scanner.l"
 return GATEWAY;
 	YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 259 "scanner.l"
+#line 250 "scanner.l"
 return TYPE;
 	YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 260 "scanner.l"
+#line 251 "scanner.l"
 return SUBTYPE;
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 261 "scanner.l"
+#line 252 "scanner.l"
 return DIR;
 	YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 262 "scanner.l"
+#line 253 "scanner.l"
 return ADDR1;
 	YY_BREAK
 case 57:
 YY_RULE_SETUP
-#line 263 "scanner.l"
+#line 254 "scanner.l"
 return ADDR2;
 	YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 264 "scanner.l"
+#line 255 "scanner.l"
 return ADDR3;
 	YY_BREAK
 case 59:
 YY_RULE_SETUP
-#line 265 "scanner.l"
+#line 256 "scanner.l"
 return ADDR4;
 	YY_BREAK
 case 60:
 YY_RULE_SETUP
-#line 266 "scanner.l"
+#line 257 "scanner.l"
 return RA;
 	YY_BREAK
 case 61:
 YY_RULE_SETUP
-#line 267 "scanner.l"
+#line 258 "scanner.l"
 return TA;
 	YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 269 "scanner.l"
+#line 260 "scanner.l"
 return LESS;
 	YY_BREAK
 case 63:
 YY_RULE_SETUP
-#line 270 "scanner.l"
+#line 261 "scanner.l"
 return GREATER;
 	YY_BREAK
 case 64:
 YY_RULE_SETUP
-#line 271 "scanner.l"
+#line 262 "scanner.l"
 return CBYTE;
 	YY_BREAK
 case 65:
 YY_RULE_SETUP
-#line 272 "scanner.l"
+#line 263 "scanner.l"
 return TK_BROADCAST;
 	YY_BREAK
 case 66:
 YY_RULE_SETUP
-#line 273 "scanner.l"
+#line 264 "scanner.l"
 return TK_MULTICAST;
 	YY_BREAK
 case 67:
 YY_RULE_SETUP
-#line 275 "scanner.l"
+#line 266 "scanner.l"
 return AND;
 	YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 276 "scanner.l"
+#line 267 "scanner.l"
 return OR;
 	YY_BREAK
 case 69:
 YY_RULE_SETUP
-#line 277 "scanner.l"
+#line 268 "scanner.l"
 return '!';
 	YY_BREAK
 case 70:
 YY_RULE_SETUP
-#line 279 "scanner.l"
+#line 270 "scanner.l"
 return LEN;
 	YY_BREAK
 case 71:
 YY_RULE_SETUP
-#line 280 "scanner.l"
+#line 271 "scanner.l"
 return INBOUND;
 	YY_BREAK
 case 72:
 YY_RULE_SETUP
-#line 281 "scanner.l"
+#line 272 "scanner.l"
 return OUTBOUND;
 	YY_BREAK
 case 73:
 YY_RULE_SETUP
-#line 283 "scanner.l"
+#line 274 "scanner.l"
 return VLAN;
 	YY_BREAK
 case 74:
 YY_RULE_SETUP
-#line 284 "scanner.l"
+#line 275 "scanner.l"
 return MPLS;
 	YY_BREAK
 case 75:
 YY_RULE_SETUP
-#line 285 "scanner.l"
+#line 276 "scanner.l"
 return PPPOED;
 	YY_BREAK
 case 76:
 YY_RULE_SETUP
-#line 286 "scanner.l"
+#line 277 "scanner.l"
 return PPPOES;
 	YY_BREAK
 case 77:
 YY_RULE_SETUP
-#line 288 "scanner.l"
-return LANE;
+#line 278 "scanner.l"
+return GENEVE;
 	YY_BREAK
 case 78:
 YY_RULE_SETUP
-#line 289 "scanner.l"
-return LLC;
+#line 280 "scanner.l"
+return LANE;
 	YY_BREAK
 case 79:
 YY_RULE_SETUP
-#line 290 "scanner.l"
-return METAC;
+#line 281 "scanner.l"
+return LLC;
 	YY_BREAK
 case 80:
 YY_RULE_SETUP
-#line 291 "scanner.l"
-return BCC;
+#line 282 "scanner.l"
+return METAC;
 	YY_BREAK
 case 81:
 YY_RULE_SETUP
-#line 292 "scanner.l"
-return OAM;
+#line 283 "scanner.l"
+return BCC;
 	YY_BREAK
 case 82:
 YY_RULE_SETUP
-#line 293 "scanner.l"
-return OAMF4;
+#line 284 "scanner.l"
+return OAM;
 	YY_BREAK
 case 83:
 YY_RULE_SETUP
-#line 294 "scanner.l"
-return OAMF4EC;
+#line 285 "scanner.l"
+return OAMF4;
 	YY_BREAK
 case 84:
 YY_RULE_SETUP
-#line 295 "scanner.l"
-return OAMF4SC;
+#line 286 "scanner.l"
+return OAMF4EC;
 	YY_BREAK
 case 85:
 YY_RULE_SETUP
-#line 296 "scanner.l"
-return SC;
+#line 287 "scanner.l"
+return OAMF4SC;
 	YY_BREAK
 case 86:
 YY_RULE_SETUP
-#line 297 "scanner.l"
-return ILMIC;
+#line 288 "scanner.l"
+return SC;
 	YY_BREAK
 case 87:
 YY_RULE_SETUP
-#line 298 "scanner.l"
-return VPI;
+#line 289 "scanner.l"
+return ILMIC;
 	YY_BREAK
 case 88:
 YY_RULE_SETUP
-#line 299 "scanner.l"
-return VCI;
+#line 290 "scanner.l"
+return VPI;
 	YY_BREAK
 case 89:
 YY_RULE_SETUP
-#line 300 "scanner.l"
-return CONNECTMSG;
+#line 291 "scanner.l"
+return VCI;
 	YY_BREAK
 case 90:
 YY_RULE_SETUP
-#line 301 "scanner.l"
-return METACONNECT;
+#line 292 "scanner.l"
+return CONNECTMSG;
 	YY_BREAK
 case 91:
 YY_RULE_SETUP
-#line 303 "scanner.l"
-return PF_IFNAME;
+#line 293 "scanner.l"
+return METACONNECT;
 	YY_BREAK
 case 92:
 YY_RULE_SETUP
-#line 304 "scanner.l"
-return PF_RSET;
+#line 295 "scanner.l"
+return PF_IFNAME;
 	YY_BREAK
 case 93:
 YY_RULE_SETUP
-#line 305 "scanner.l"
-return PF_RNR;
+#line 296 "scanner.l"
+return PF_RSET;
 	YY_BREAK
 case 94:
 YY_RULE_SETUP
-#line 306 "scanner.l"
-return PF_SRNR;
+#line 297 "scanner.l"
+return PF_RNR;
 	YY_BREAK
 case 95:
 YY_RULE_SETUP
-#line 307 "scanner.l"
-return PF_REASON;
+#line 298 "scanner.l"
+return PF_SRNR;
 	YY_BREAK
 case 96:
 YY_RULE_SETUP
-#line 308 "scanner.l"
-return PF_ACTION;
+#line 299 "scanner.l"
+return PF_REASON;
 	YY_BREAK
 case 97:
 YY_RULE_SETUP
-#line 310 "scanner.l"
-return FISU;
+#line 300 "scanner.l"
+return PF_ACTION;
 	YY_BREAK
 case 98:
 YY_RULE_SETUP
-#line 311 "scanner.l"
-return LSSU;
+#line 302 "scanner.l"
+return FISU;
 	YY_BREAK
 case 99:
 YY_RULE_SETUP
-#line 312 "scanner.l"
+#line 303 "scanner.l"
 return LSSU;
 	YY_BREAK
 case 100:
 YY_RULE_SETUP
-#line 313 "scanner.l"
-return MSU;
+#line 304 "scanner.l"
+return LSSU;
 	YY_BREAK
 case 101:
 YY_RULE_SETUP
-#line 314 "scanner.l"
-return HFISU;
+#line 305 "scanner.l"
+return MSU;
 	YY_BREAK
 case 102:
 YY_RULE_SETUP
-#line 315 "scanner.l"
-return HLSSU;
+#line 306 "scanner.l"
+return HFISU;
 	YY_BREAK
 case 103:
 YY_RULE_SETUP
-#line 316 "scanner.l"
-return HMSU;
+#line 307 "scanner.l"
+return HLSSU;
 	YY_BREAK
 case 104:
 YY_RULE_SETUP
-#line 317 "scanner.l"
-return SIO;
+#line 308 "scanner.l"
+return HMSU;
 	YY_BREAK
 case 105:
 YY_RULE_SETUP
-#line 318 "scanner.l"
-return OPC;
+#line 309 "scanner.l"
+return SIO;
 	YY_BREAK
 case 106:
 YY_RULE_SETUP
-#line 319 "scanner.l"
-return DPC;
+#line 310 "scanner.l"
+return OPC;
 	YY_BREAK
 case 107:
 YY_RULE_SETUP
-#line 320 "scanner.l"
-return SLS;
+#line 311 "scanner.l"
+return DPC;
 	YY_BREAK
 case 108:
 YY_RULE_SETUP
-#line 321 "scanner.l"
-return HSIO;
+#line 312 "scanner.l"
+return SLS;
 	YY_BREAK
 case 109:
 YY_RULE_SETUP
-#line 322 "scanner.l"
-return HOPC;
+#line 313 "scanner.l"
+return HSIO;
 	YY_BREAK
 case 110:
 YY_RULE_SETUP
-#line 323 "scanner.l"
-return HDPC;
+#line 314 "scanner.l"
+return HOPC;
 	YY_BREAK
 case 111:
 YY_RULE_SETUP
-#line 324 "scanner.l"
-return HSLS;
+#line 315 "scanner.l"
+return HDPC;
 	YY_BREAK
 case 112:
-/* rule 112 can match eol */
 YY_RULE_SETUP
-#line 326 "scanner.l"
-;
+#line 316 "scanner.l"
+return HSLS;
 	YY_BREAK
 case 113:
+/* rule 113 can match eol */
 YY_RULE_SETUP
-#line 327 "scanner.l"
-return pcap_text[0];
+#line 318 "scanner.l"
+;
 	YY_BREAK
 case 114:
 YY_RULE_SETUP
-#line 328 "scanner.l"
-return GEQ;
+#line 319 "scanner.l"
+return pcap_text[0];
 	YY_BREAK
 case 115:
 YY_RULE_SETUP
-#line 329 "scanner.l"
-return LEQ;
+#line 320 "scanner.l"
+return GEQ;
 	YY_BREAK
 case 116:
 YY_RULE_SETUP
-#line 330 "scanner.l"
-return NEQ;
+#line 321 "scanner.l"
+return LEQ;
 	YY_BREAK
 case 117:
 YY_RULE_SETUP
-#line 331 "scanner.l"
-return '=';
+#line 322 "scanner.l"
+return NEQ;
 	YY_BREAK
 case 118:
 YY_RULE_SETUP
-#line 332 "scanner.l"
-return LSH;
+#line 323 "scanner.l"
+return '=';
 	YY_BREAK
 case 119:
 YY_RULE_SETUP
-#line 333 "scanner.l"
-return RSH;
+#line 324 "scanner.l"
+return LSH;
 	YY_BREAK
 case 120:
 YY_RULE_SETUP
-#line 334 "scanner.l"
+#line 325 "scanner.l"
+return RSH;
+	YY_BREAK
+case 121:
+YY_RULE_SETUP
+#line 326 "scanner.l"
 { yylval.e = pcap_ether_aton(((char *)pcap_text)+1);
 			  if (yylval.e == NULL)
 				bpf_error("malloc");
 			  return AID; }
 	YY_BREAK
-case 121:
+case 122:
 YY_RULE_SETUP
-#line 338 "scanner.l"
+#line 330 "scanner.l"
 { yylval.e = pcap_ether_aton((char *)pcap_text);
 			  if (yylval.e == NULL)
 				bpf_error("malloc");
 			  return EID; }
 	YY_BREAK
-case 122:
-YY_RULE_SETUP
-#line 342 "scanner.l"
-{ yylval.i = stoi((char *)pcap_text); return NUM; }
-	YY_BREAK
 case 123:
 YY_RULE_SETUP
-#line 343 "scanner.l"
-{
-			yylval.s = sdup((char *)pcap_text); return HID; }
+#line 334 "scanner.l"
+{ yylval.i = stoi((char *)pcap_text); return NUM; }
 	YY_BREAK
 case 124:
 YY_RULE_SETUP
-#line 345 "scanner.l"
+#line 335 "scanner.l"
+{
+			yylval.s = sdup((char *)pcap_text); return HID; }
+	YY_BREAK
+case 125:
+YY_RULE_SETUP
+#line 337 "scanner.l"
 {
 #ifdef INET6
 			  struct addrinfo hints, *res;
@@ -3691,159 +3699,159 @@
 #endif /*INET6*/
 			}
 	YY_BREAK
-case 125:
-YY_RULE_SETUP
-#line 361 "scanner.l"
-{ bpf_error("bogus ethernet address %s", pcap_text); }
-	YY_BREAK
 case 126:
 YY_RULE_SETUP
-#line 362 "scanner.l"
-{ yylval.i = 0; return NUM; }
+#line 353 "scanner.l"
+{ bpf_error("bogus ethernet address %s", pcap_text); }
 	YY_BREAK
 case 127:
 YY_RULE_SETUP
-#line 363 "scanner.l"
-{ yylval.i = 1; return NUM; }
+#line 354 "scanner.l"
+{ yylval.i = 0; return NUM; }
 	YY_BREAK
 case 128:
 YY_RULE_SETUP
-#line 364 "scanner.l"
-{ yylval.i = 0; return NUM; }
+#line 355 "scanner.l"
+{ yylval.i = 1; return NUM; }
 	YY_BREAK
 case 129:
 YY_RULE_SETUP
-#line 365 "scanner.l"
-{ yylval.i = 3; return NUM; }
+#line 356 "scanner.l"
+{ yylval.i = 0; return NUM; }
 	YY_BREAK
 case 130:
 YY_RULE_SETUP
-#line 366 "scanner.l"
-{ yylval.i = 4; return NUM; }
+#line 357 "scanner.l"
+{ yylval.i = 3; return NUM; }
 	YY_BREAK
 case 131:
 YY_RULE_SETUP
-#line 367 "scanner.l"
-{ yylval.i = 5; return NUM; }
+#line 358 "scanner.l"
+{ yylval.i = 4; return NUM; }
 	YY_BREAK
 case 132:
 YY_RULE_SETUP
-#line 368 "scanner.l"
-{ yylval.i = 8; return NUM; }
+#line 359 "scanner.l"
+{ yylval.i = 5; return NUM; }
 	YY_BREAK
 case 133:
 YY_RULE_SETUP
-#line 369 "scanner.l"
-{ yylval.i = 9; return NUM; }
+#line 360 "scanner.l"
+{ yylval.i = 8; return NUM; }
 	YY_BREAK
 case 134:
 YY_RULE_SETUP
-#line 370 "scanner.l"
-{ yylval.i = 10; return NUM; }
+#line 361 "scanner.l"
+{ yylval.i = 9; return NUM; }
 	YY_BREAK
 case 135:
 YY_RULE_SETUP
-#line 371 "scanner.l"
-{ yylval.i = 11; return NUM; }
+#line 362 "scanner.l"
+{ yylval.i = 10; return NUM; }
 	YY_BREAK
 case 136:
 YY_RULE_SETUP
-#line 372 "scanner.l"
-{ yylval.i = 12; return NUM; }
+#line 363 "scanner.l"
+{ yylval.i = 11; return NUM; }
 	YY_BREAK
 case 137:
 YY_RULE_SETUP
-#line 373 "scanner.l"
-{ yylval.i = 13; return NUM; }
+#line 364 "scanner.l"
+{ yylval.i = 12; return NUM; }
 	YY_BREAK
 case 138:
 YY_RULE_SETUP
-#line 374 "scanner.l"
-{ yylval.i = 14; return NUM; }
+#line 365 "scanner.l"
+{ yylval.i = 13; return NUM; }
 	YY_BREAK
 case 139:
 YY_RULE_SETUP
-#line 375 "scanner.l"
-{ yylval.i = 15; return NUM; }
+#line 366 "scanner.l"
+{ yylval.i = 14; return NUM; }
 	YY_BREAK
 case 140:
 YY_RULE_SETUP
-#line 376 "scanner.l"
-{ yylval.i = 16; return NUM; }
+#line 367 "scanner.l"
+{ yylval.i = 15; return NUM; }
 	YY_BREAK
 case 141:
 YY_RULE_SETUP
-#line 377 "scanner.l"
-{ yylval.i = 17; return NUM; }
+#line 368 "scanner.l"
+{ yylval.i = 16; return NUM; }
 	YY_BREAK
 case 142:
 YY_RULE_SETUP
-#line 378 "scanner.l"
-{ yylval.i = 18; return NUM; }
+#line 369 "scanner.l"
+{ yylval.i = 17; return NUM; }
 	YY_BREAK
 case 143:
 YY_RULE_SETUP
-#line 379 "scanner.l"
-{ yylval.i = 13; return NUM; }
+#line 370 "scanner.l"
+{ yylval.i = 18; return NUM; }
 	YY_BREAK
 case 144:
 YY_RULE_SETUP
-#line 380 "scanner.l"
-{ yylval.i = 0x01; return NUM; }
+#line 371 "scanner.l"
+{ yylval.i = 13; return NUM; }
 	YY_BREAK
 case 145:
 YY_RULE_SETUP
-#line 381 "scanner.l"
-{ yylval.i = 0x02; return NUM; }
+#line 372 "scanner.l"
+{ yylval.i = 0x01; return NUM; }
 	YY_BREAK
 case 146:
 YY_RULE_SETUP
-#line 382 "scanner.l"
-{ yylval.i = 0x04; return NUM; }
+#line 373 "scanner.l"
+{ yylval.i = 0x02; return NUM; }
 	YY_BREAK
 case 147:
 YY_RULE_SETUP
-#line 383 "scanner.l"
-{ yylval.i = 0x08; return NUM; }
+#line 374 "scanner.l"
+{ yylval.i = 0x04; return NUM; }
 	YY_BREAK
 case 148:
 YY_RULE_SETUP
-#line 384 "scanner.l"
-{ yylval.i = 0x10; return NUM; }
+#line 375 "scanner.l"
+{ yylval.i = 0x08; return NUM; }
 	YY_BREAK
 case 149:
 YY_RULE_SETUP
-#line 385 "scanner.l"
-{ yylval.i = 0x20; return NUM; }
+#line 376 "scanner.l"
+{ yylval.i = 0x10; return NUM; }
 	YY_BREAK
 case 150:
 YY_RULE_SETUP
-#line 386 "scanner.l"
-{
-			 yylval.s = sdup((char *)pcap_text); return ID; }
+#line 377 "scanner.l"
+{ yylval.i = 0x20; return NUM; }
 	YY_BREAK
 case 151:
 YY_RULE_SETUP
-#line 388 "scanner.l"
-{ yylval.s = sdup((char *)pcap_text + 1); return ID; }
+#line 378 "scanner.l"
+{
+			 yylval.s = sdup((char *)pcap_text); return ID; }
 	YY_BREAK
 case 152:
 YY_RULE_SETUP
-#line 389 "scanner.l"
-{
-			bpf_error("illegal token: %s", pcap_text); }
+#line 380 "scanner.l"
+{ yylval.s = sdup((char *)pcap_text + 1); return ID; }
 	YY_BREAK
 case 153:
 YY_RULE_SETUP
-#line 391 "scanner.l"
-{ bpf_error("illegal char '%c'", *pcap_text); }
+#line 381 "scanner.l"
+{
+			bpf_error("illegal token: %s", pcap_text); }
 	YY_BREAK
 case 154:
 YY_RULE_SETUP
-#line 392 "scanner.l"
+#line 383 "scanner.l"
+{ bpf_error("illegal char '%c'", *pcap_text); }
+	YY_BREAK
+case 155:
+YY_RULE_SETUP
+#line 384 "scanner.l"
 ECHO;
 	YY_BREAK
-#line 3847 "scanner.c"
+#line 3852 "scanner.c"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -3974,6 +3982,7 @@
 			"fatal flex scanner internal error--no action found" );
 	} /* end of action switch */
 		} /* end of scanning one token */
+	} /* end of user's declarations */
 } /* end of pcap_lex */
 
 /* yy_get_next_buffer - try to read in a new buffer
@@ -4029,21 +4038,21 @@
 
 	else
 		{
-			int num_to_read =
+			yy_size_t num_to_read =
 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
 		while ( num_to_read <= 0 )
 			{ /* Not enough room in the buffer - grow it. */
 
 			/* just a shorter name for the current buffer */
-			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 
 			int yy_c_buf_p_offset =
 				(int) ((yy_c_buf_p) - b->yy_ch_buf);
 
 			if ( b->yy_is_our_buffer )
 				{
-				int new_size = b->yy_buf_size * 2;
+				yy_size_t new_size = b->yy_buf_size * 2;
 
 				if ( new_size <= 0 )
 					b->yy_buf_size += b->yy_buf_size / 8;
@@ -4074,7 +4083,7 @@
 
 		/* Read in more data. */
 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-			(yy_n_chars), (size_t) num_to_read );
+			(yy_n_chars), num_to_read );
 
 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 		}
@@ -4135,7 +4144,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 >= 1459 )
+			if ( yy_current_state >= 1464 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -4163,13 +4172,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 >= 1459 )
+		if ( yy_current_state >= 1464 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 1458);
+	yy_is_jam = (yy_current_state == 1463);
 
-	return yy_is_jam ? 0 : yy_current_state;
+		return yy_is_jam ? 0 : yy_current_state;
 }
 
 #ifndef YY_NO_INPUT
@@ -4196,7 +4205,7 @@
 
 		else
 			{ /* need more input */
-			int offset = (yy_c_buf_p) - (yytext_ptr);
+			yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
 			++(yy_c_buf_p);
 
 			switch ( yy_get_next_buffer(  ) )
@@ -4356,10 +4365,6 @@
 	pcap_free((void *) b  );
 }
 
-#ifndef __cplusplus
-extern int isatty (int );
-#endif /* __cplusplus */
-    
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
  * such as during a pcap_restart() or at EOF.
@@ -4472,7 +4477,7 @@
  */
 static void pcap_ensure_buffer_stack (void)
 {
-	int num_to_alloc;
+	yy_size_t num_to_alloc;
     
 	if (!(yy_buffer_stack)) {
 
@@ -4569,12 +4574,12 @@
  * 
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE pcap__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
+YY_BUFFER_STATE pcap__scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
 {
 	YY_BUFFER_STATE b;
 	char *buf;
 	yy_size_t n;
-	int i;
+	yy_size_t i;
     
 	/* Get memory for full buffer, including space for trailing EOB's. */
 	n = _yybytes_len + 2;
@@ -4740,7 +4745,7 @@
 
 #define YYTABLES_NAME "yytables"
 
-#line 392 "scanner.l"
+#line 383 "scanner.l"
 
 
 void
diff --git a/scanner.h b/scanner.h
index 934ca4c..d95fb84 100644
--- a/scanner.h
+++ b/scanner.h
@@ -2,5 +2,5 @@
 
 #ifndef YY_DECL
 #define YY_DECL int yylex(void)
-#endif  
+#endif
 YY_DECL;
diff --git a/scanner.l b/scanner.l
index daa5eae..72a83f7 100644
--- a/scanner.l
+++ b/scanner.l
@@ -20,15 +20,6 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.112 2008-02-06 10:21:30 guy Exp $ (LBL)";
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #ifdef WIN32
 #include <pcap-stdinc.h>
 #else /* WIN32 */
@@ -284,6 +275,7 @@
 mpls		return MPLS;
 pppoed		return PPPOED;
 pppoes		return PPPOES;
+geneve		return GENEVE;
 
 lane		return LANE;
 llc		return LLC;
@@ -324,7 +316,7 @@
 hsls		return HSLS;
 
 [ \r\n\t]		;
-[+\-*/:\[\]!<>()&|=]	return yytext[0];
+[+\-*/%:\[\]!<>()&|\^=]	return yytext[0];
 ">="			return GEQ;
 "<="			return LEQ;
 "!="			return NEQ;
diff --git a/sf-pcap-ng.c b/sf-pcap-ng.c
index e0c1fb1..e2cac04 100644
--- a/sf-pcap-ng.c
+++ b/sf-pcap-ng.c
@@ -459,7 +459,7 @@
 				return (-1);
 			}
 			saw_tsresol = 1;
-			tsresol_opt = *(u_int *)optvalue;
+			memcpy(&tsresol_opt, optvalue, sizeof(tsresol_opt));
 			if (tsresol_opt & 0x80) {
 				/*
 				 * Resolution is negative power of 2.
@@ -664,7 +664,7 @@
 
 	/*
 	 * Check whether the first 4 bytes of the file are the block
-	 * type for a pcap-ng savefile. 
+	 * type for a pcap-ng savefile.
 	 */
 	if (magic != BT_SHB) {
 		/*
@@ -1000,7 +1000,7 @@
 				    epbp->timestamp_low;
 			}
 			goto found;
-			
+
 		case BT_SPB:
 			/*
 			 * Get a pointer to the fixed-length portion of the
@@ -1192,7 +1192,7 @@
 			 * Not a packet block, IDB, or SHB; ignore it.
 			 */
 			break;
-		}		 
+		}
 	}
 
 found:
@@ -1210,10 +1210,16 @@
 	}
 
 	/*
-	 * Convert the time stamp to a struct timeval.
+	 * Convert the time stamp to seconds and fractions of a second,
+	 * with the fractions being in units of the file-supplied resolution.
 	 */
 	sec = t / ps->ifaces[interface_id].tsresol + ps->ifaces[interface_id].tsoffset;
 	frac = t % ps->ifaces[interface_id].tsresol;
+
+	/*
+	 * Convert the fractions from units of the file-supplied resolution
+	 * to units of the user-requested resolution.
+	 */
 	switch (ps->ifaces[interface_id].scale_type) {
 
 	case PASS_THROUGH:
@@ -1224,33 +1230,25 @@
 		break;
 
 	case SCALE_UP:
+	case SCALE_DOWN:
 		/*
-		 * The interface resolution is less than what the user
-		 * wants; scale up to that resolution.
+		 * The interface resolution is different from what the
+		 * user wants; convert the fractions to units of the
+		 * resolution the user requested by multiplying by the
+		 * quotient of the user-requested resolution and the
+		 * file-supplied resolution.  We do that by multiplying
+		 * by the user-requested resolution and dividing by the
+		 * file-supplied resolution, as the quotient might not
+		 * fit in an integer.
 		 *
 		 * XXX - if ps->ifaces[interface_id].tsresol is a power
 		 * of 10, we could just multiply by the quotient of
-		 * ps->ifaces[interface_id].tsresol and ps->user_tsresol,
-		 * as we know that's an integer.  That runs less risk of
-		 * overflow.
-		 *
-		 * Is there something clever we could do if
-		 * ps->ifaces[interface_id].tsresol is a power of 2?
-		 */
-		frac *= ps->ifaces[interface_id].tsresol;
-		frac /= ps->user_tsresol;
-		break;
-
-	case SCALE_DOWN:
-		/*
-		 * The interface resolution is greater than what the user
-		 * wants; scale down to that resolution.
-		 *
-		 * XXX - if ps->ifaces[interface_id].tsresol is a power
-		 * of 10, we could just divide by the quotient of
-		 * ps->user_tsresol and ps->ifaces[interface_id].tsresol,
-		 * as we know that's an integer.  That runs less risk of
-		 * overflow.
+		 * ps->user_tsresol and ps->ifaces[interface_id].tsresol
+		 * in the scale-up case, and divide by the quotient of
+		 * ps->ifaces[interface_id].tsresol and ps->user_tsresol
+		 * in the scale-down case, as we know those will be integers.
+		 * That would involve fewer arithmetic operations, and
+		 * would run less risk of overflow.
 		 *
 		 * Is there something clever we could do if
 		 * ps->ifaces[interface_id].tsresol is a power of 2?
diff --git a/sf-pcap.c b/sf-pcap.c
index b298131..eaeddfa 100644
--- a/sf-pcap.c
+++ b/sf-pcap.c
@@ -371,9 +371,9 @@
 	p->bufsize = p->snapshot;
 	if (p->bufsize <= 0) {
 		/*
-		 * Bogus snapshot length; use 64KiB as a fallback.
+		 * Bogus snapshot length; use the maximum as a fallback.
 		 */
-		p->bufsize = 65536;
+		p->bufsize = MAXIMUM_SNAPLEN;
 	}
 	p->buffer = malloc(p->bufsize);
 	if (p->buffer == NULL) {
@@ -500,7 +500,7 @@
 		static u_char *tp = NULL;
 		static size_t tsize = 0;
 
-		if (hdr->caplen > 65535) {
+		if (hdr->caplen > MAXIMUM_SNAPLEN) {
 			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
 			    "bogus savefile header");
 			return (-1);
@@ -682,7 +682,7 @@
  */
 pcap_dumper_t *
 pcap_dump_fopen(pcap_t *p, FILE *f)
-{	
+{
 	int linktype;
 
 	linktype = dlt_to_linktype(p->linktype);
@@ -697,6 +697,168 @@
 	return (pcap_setup_dump(p, linktype, f, "stream"));
 }
 
+pcap_dumper_t *
+pcap_dump_open_append(pcap_t *p, const char *fname)
+{
+	FILE *f;
+	int linktype;
+	int amt_read;
+	struct pcap_file_header ph;
+
+	linktype = dlt_to_linktype(p->linktype);
+	if (linktype == -1) {
+		snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+		    "%s: link-layer type %d isn't supported in savefiles",
+		    fname, linktype);
+		return (NULL);
+	}
+	if (fname[0] == '-' && fname[1] == '\0')
+		return (pcap_setup_dump(p, linktype, stdout, "standard output"));
+
+#if !defined(WIN32) && !defined(MSDOS)
+	f = fopen(fname, "r+");
+#else
+	f = fopen(fname, "rb+");
+#endif
+	if (f == NULL) {
+		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
+		    fname, pcap_strerror(errno));
+		return (NULL);
+	}
+
+	/*
+	 * Try to read a pcap header.
+	 */
+	amt_read = fread(&ph, 1, sizeof (ph), f);
+	if (amt_read != sizeof (ph)) {
+		if (ferror(f)) {
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
+			    fname, pcap_strerror(errno));
+			fclose(f);
+			return (NULL);
+		} else if (feof(f) && amt_read > 0) {
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "%s: truncated pcap file header", fname);
+			fclose(f);
+			return (NULL);
+		}
+	}
+
+#if defined(WIN32) || defined(MSDOS)
+	/*
+	 * We turn off buffering.
+	 * XXX - why?  And why not on the standard output?
+	 */
+	setbuf(f, NULL);
+#endif
+
+	/*
+	 * If a header is already present and:
+	 *
+	 *	it's not for a pcap file of the appropriate resolution
+	 *	and the right byte order for this machine;
+	 *
+	 *	the link-layer header types don't match;
+	 *
+	 *	the snapshot lengths don't match;
+	 *
+	 * return an error.
+	 */
+	if (amt_read > 0) {
+		/*
+		 * A header is already present.
+		 * Do the checks.
+		 */
+		switch (ph.magic) {
+
+		case TCPDUMP_MAGIC:
+			if (p->opt.tstamp_precision != PCAP_TSTAMP_PRECISION_MICRO) {
+				snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+				    "%s: different time stamp precision, cannot append to file", fname);
+				fclose(f);
+				return (NULL);
+			}
+			break;
+
+		case NSEC_TCPDUMP_MAGIC:
+			if (p->opt.tstamp_precision != PCAP_TSTAMP_PRECISION_NANO) {
+				snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+				    "%s: different time stamp precision, cannot append to file", fname);
+				fclose(f);
+				return (NULL);
+			}
+			break;
+
+		case SWAPLONG(TCPDUMP_MAGIC):
+		case SWAPLONG(NSEC_TCPDUMP_MAGIC):
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "%s: different byte order, cannot append to file", fname);
+			fclose(f);
+			return (NULL);
+
+		case KUZNETZOV_TCPDUMP_MAGIC:
+		case SWAPLONG(KUZNETZOV_TCPDUMP_MAGIC):
+		case NAVTEL_TCPDUMP_MAGIC:
+		case SWAPLONG(NAVTEL_TCPDUMP_MAGIC):
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "%s: not a pcap file to which we can append", fname);
+			fclose(f);
+			return (NULL);
+
+		default:
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "%s: not a pcap file", fname);
+			fclose(f);
+			return (NULL);
+		}
+
+		/*
+		 * Good version?
+		 */
+		if (ph.version_major != PCAP_VERSION_MAJOR ||
+		    ph.version_minor != PCAP_VERSION_MINOR) {
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "%s: version is %u.%u, cannot append to file", fname,
+			    ph.version_major, ph.version_minor);
+			fclose(f);
+			return (NULL);
+		}
+		if (linktype != ph.linktype) {
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "%s: different linktype, cannot append to file", fname);
+			fclose(f);
+			return (NULL);
+		}
+		if (p->snapshot != ph.snaplen) {
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+			    "%s: different snaplen, cannot append to file", fname);
+			fclose(f);
+			return (NULL);
+		}
+	} else {
+		/*
+		 * A header isn't present; attempt to write it.
+		 */
+		if (sf_write_header(p, f, linktype, p->tzoff, p->snapshot) == -1) {
+			snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Can't write to %s: %s",
+			    fname, pcap_strerror(errno));
+			(void)fclose(f);
+			return (NULL);
+		}
+	}
+
+	/*
+	 * Start writing at the end of the file.
+	 */
+	if (fseek(f, 0, SEEK_END) == -1) {
+		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Can't seek to end of %s: %s",
+		    fname, pcap_strerror(errno));
+		(void)fclose(f);
+		return (NULL);
+	}
+	return ((pcap_dumper_t *)f);
+}
+
 FILE *
 pcap_dump_file(pcap_dumper_t *p)
 {
diff --git a/sunatmpos.h b/sunatmpos.h
index 916017f..787de85 100644
--- a/sunatmpos.h
+++ b/sunatmpos.h
@@ -28,8 +28,6 @@
  * 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.
- *
- * @(#) $Header: /tcpdump/master/libpcap/sunatmpos.h,v 1.1 2002-07-11 09:06:47 guy Exp $ (LBL)
  */
 
 /* SunATM header for ATM packet */
diff --git a/tests/nonblocktest.c b/tests/capturetest.c
similarity index 74%
rename from tests/nonblocktest.c
rename to tests/capturetest.c
index 70a6bfd..e70e69a 100644
--- a/tests/nonblocktest.c
+++ b/tests/capturetest.c
@@ -25,18 +25,20 @@
 The Regents of the University of California.  All rights reserved.\n";
 #endif
 
-#include <pcap.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
+#include <limits.h>
 #include <unistd.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/select.h>
 #include <poll.h>
 
-char *program_name;
+#include <pcap.h>
+
+static char *program_name;
 
 /* Forwards */
 static void countme(u_char *, const struct pcap_pkthdr *, const u_char *);
@@ -55,8 +57,13 @@
 main(int argc, char **argv)
 {
 	register int op;
-	bpf_u_int32 localnet, netmask;
 	register char *cp, *cmdbuf, *device;
+	long longarg;
+	char *p;
+	int timeout = 1000;
+	int immediate = 0;
+	int nonblock = 0;
+	bpf_u_int32 localnet, netmask;
 	struct bpf_program fcode;
 	char ebuf[PCAP_ERRBUF_SIZE];
 	int status;
@@ -69,13 +76,40 @@
 		program_name = argv[0];
 
 	opterr = 0;
-	while ((op = getopt(argc, argv, "i:")) != -1) {
+	while ((op = getopt(argc, argv, "i:mnt:")) != -1) {
 		switch (op) {
 
 		case 'i':
 			device = optarg;
 			break;
 
+		case 'm':
+			immediate = 1;
+			break;
+
+		case 'n':
+			nonblock = 1;
+			break;
+
+		case 't':
+			longarg = strtol(optarg, &p, 10);
+			if (p == optarg || *p != '\0') {
+				error("Timeout value \"%s\" is not a number",
+				    optarg);
+				/* NOTREACHED */
+			}
+			if (longarg < 0) {
+				error("Timeout value %ld is negative", longarg);
+				/* NOTREACHED */
+			}
+			if (longarg > INT_MAX) {
+				error("Timeout value %ld is too large (> %d)",
+				    longarg, INT_MAX);
+				/* NOTREACHED */
+			}
+			timeout = (int)longarg;
+			break;
+
 		default:
 			usage();
 			/* NOTREACHED */
@@ -88,11 +122,38 @@
 			error("%s", ebuf);
 	}
 	*ebuf = '\0';
-	pd = pcap_open_live(device, 65535, 0, 1000, ebuf);
+	pd = pcap_create(device, ebuf);
 	if (pd == NULL)
 		error("%s", ebuf);
-	else if (*ebuf)
-		warning("%s", ebuf);
+	status = pcap_set_snaplen(pd, 65535);
+	if (status != 0)
+		error("%s: pcap_set_snaplen failed: %s",
+			    device, pcap_statustostr(status));
+	if (immediate) {
+		status = pcap_set_immediate_mode(pd, 1);
+		if (status != 0)
+			error("%s: pcap_set_immediate_mode failed: %s",
+			    device, pcap_statustostr(status));
+	}
+	status = pcap_set_timeout(pd, timeout);
+	if (status != 0)
+		error("%s: pcap_set_timeout failed: %s",
+		    device, pcap_statustostr(status));
+	status = pcap_activate(pd);
+	if (status < 0) {
+		/*
+		 * pcap_activate() failed.
+		 */
+		error("%s: %s\n(%s)", device,
+		    pcap_statustostr(status), pcap_geterr(pd));
+	} else if (status > 0) {
+		/*
+		 * pcap_activate() succeeded, but it's warning us
+		 * of a problem it had.
+		 */
+		warning("%s: %s\n(%s)", device,
+		    pcap_statustostr(status), pcap_geterr(pd));
+	}
 	if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0) {
 		localnet = 0;
 		netmask = 0;
@@ -105,7 +166,7 @@
 
 	if (pcap_setfilter(pd, &fcode) < 0)
 		error("%s", pcap_geterr(pd));
-	if (pcap_setnonblock(pd, 1, ebuf) == -1)
+	if (pcap_setnonblock(pd, nonblock, ebuf) == -1)
 		error("pcap_setnonblock failed: %s", ebuf);
 	printf("Listening on %s\n", device);
 	for (;;) {
@@ -150,7 +211,7 @@
 static void
 usage(void)
 {
-	(void)fprintf(stderr, "Usage: %s [ -sptn ] [ -i interface ] [expression]\n",
+	(void)fprintf(stderr, "Usage: %s [ -mn ] [ -i interface ] [ -t timeout] [expression]\n",
 	    program_name);
 	exit(1);
 }
diff --git a/tests/filtertest.c b/tests/filtertest.c
index a56d1e4..e45db21 100644
--- a/tests/filtertest.c
+++ b/tests/filtertest.c
@@ -23,8 +23,6 @@
 static const char copyright[] _U_ =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
 The Regents of the University of California.  All rights reserved.\n";
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/filtertest.c,v 1.2 2005-08-08 17:50:13 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -53,10 +51,15 @@
 static void usage(void) __attribute__((noreturn));
 static void error(const char *, ...)
     __attribute__((noreturn, format (printf, 1, 2)));
+static void warn(const char *, ...)
+    __attribute__((format (printf, 1, 2)));
 
 extern int optind;
 extern int opterr;
 extern char *optarg;
+#ifdef BDEBUG
+int dflag;
+#endif
 
 /*
  * On Windows, we need to open the file in binary mode, so that
@@ -122,6 +125,23 @@
 	/* NOTREACHED */
 }
 
+/* VARARGS */
+static void
+warn(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);
+	}
+}
+
 /*
  * Copy arg vector into a new buffer, concatenating arguments with spaces.
  */
@@ -161,10 +181,13 @@
 {
 	char *cp;
 	int op;
+#ifndef BDEBUG
 	int dflag;
+#endif
 	char *infile;
 	int Oflag;
 	long snaplen;
+	char *p;
 	int dlt;
 	bpf_u_int32 netmask = PCAP_NETMASK_UNKNOWN;
 	char *cmdbuf;
@@ -175,11 +198,19 @@
 	if(wsockinit() != 0) return 1;
 #endif /* WIN32 */
 
+#ifndef BDEBUG
 	dflag = 1;
+#else
+	/* if optimizer debugging is enabled, output DOT graph
+	 * `dflag=4' is equivalent to -dddd to follow -d/-dd/-ddd
+     * convention in tcpdump command line
+	 */
+	dflag = 4;
+#endif
 	infile = NULL;
 	Oflag = 1;
 	snaplen = 68;
-  
+
 	if ((cp = strrchr(argv[0], '/')) != NULL)
 		program_name = cp + 1;
 	else
@@ -235,9 +266,12 @@
 	}
 
 	dlt = pcap_datalink_name_to_val(argv[optind]);
-	if (dlt < 0)
-		error("invalid data link type %s", argv[optind]);
-	
+	if (dlt < 0) {
+		dlt = (int)strtol(argv[optind], &p, 10);
+		if (p == argv[optind] || *p != '\0')
+			error("invalid data link type %s", argv[optind]);
+	}
+
 	if (infile)
 		cmdbuf = read_infile(infile);
 	else
@@ -249,6 +283,21 @@
 
 	if (pcap_compile(pd, &fcode, cmdbuf, Oflag, netmask) < 0)
 		error("%s", pcap_geterr(pd));
+
+	if (!bpf_validate(fcode.bf_insns, fcode.bf_len))
+		warn("Filter doesn't pass validation");
+
+#ifdef BDEBUG
+	// replace line feed with space
+	for (cp = cmdbuf; *cp != '\0'; ++cp) {
+		if (*cp == '\r' || *cp == '\n') {
+			*cp = ' ';
+		}
+	}
+	// only show machine code if BDEBUG defined, since dflag > 3
+	printf("machine codes for filter: %s\n", cmdbuf);
+#endif
+
 	bpf_dump(&fcode, dflag);
 	pcap_close(pd);
 	exit(0);
diff --git a/tests/findalldevstest.c b/tests/findalldevstest.c
index ec7c950..6d452f8 100644
--- a/tests/findalldevstest.c
+++ b/tests/findalldevstest.c
@@ -11,7 +11,7 @@
 
 #include <pcap.h>
 
-static void ifprint(pcap_if_t *d);
+static int ifprint(pcap_if_t *d);
 static char *iptos(bpf_u_int32 in);
 
 int main(int argc, char **argv)
@@ -20,7 +20,8 @@
   pcap_if_t *d;
   char *s;
   bpf_u_int32 net, mask;
-  
+  int exit_status = 0;
+
   char errbuf[PCAP_ERRBUF_SIZE+1];
   if (pcap_findalldevs(&alldevs, errbuf) == -1)
   {
@@ -29,12 +30,14 @@
   }
   for(d=alldevs;d;d=d->next)
   {
-    ifprint(d);
+    if (!ifprint(d))
+      exit_status = 2;
   }
 
   if ( (s = pcap_lookupdev(errbuf)) == NULL)
   {
     fprintf(stderr,"Error in pcap_lookupdev: %s\n",errbuf);
+    exit_status = 2;
   }
   else
   {
@@ -44,21 +47,23 @@
   if (pcap_lookupnet(s, &net, &mask, errbuf) < 0)
   {
     fprintf(stderr,"Error in pcap_lookupnet: %s\n",errbuf);
+    exit_status = 2;
   }
   else
   {
     printf("Preferred device is on network: %s/%s\n",iptos(net), iptos(mask));
   }
-  
-  exit(0);
+
+  exit(exit_status);
 }
 
-static void ifprint(pcap_if_t *d)
+static int ifprint(pcap_if_t *d)
 {
   pcap_addr_t *a;
 #ifdef INET6
   char ntop_buf[INET6_ADDRSTRLEN];
 #endif
+  int status = 1; /* success */
 
   printf("%s\n",d->name);
   if (d->description)
@@ -66,8 +71,8 @@
   printf("\tLoopback: %s\n",(d->flags & PCAP_IF_LOOPBACK)?"yes":"no");
 
   for(a=d->addresses;a;a=a->next) {
-    switch(a->addr->sa_family)
-    {
+    if (a->addr != NULL)
+      switch(a->addr->sa_family) {
       case AF_INET:
         printf("\tAddress Family: AF_INET\n");
         if (a->addr)
@@ -111,9 +116,15 @@
       default:
         printf("\tAddress Family: Unknown (%d)\n", a->addr->sa_family);
         break;
+      }
+    else
+    {
+      fprintf(stderr, "\tWarning: a->addr is NULL, skipping this address.\n");
+      status = 0;
     }
   }
   printf("\n");
+  return status;
 }
 
 /* From tcptraceroute */
diff --git a/tests/pcap_compile_test.c b/tests/pcap_compile_test.c
deleted file mode 100644
index e80ad62..0000000
--- a/tests/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/tests/valgrindtest.c b/tests/valgrindtest.c
index 0d454d1..72786e4 100644
--- a/tests/valgrindtest.c
+++ b/tests/valgrindtest.c
@@ -23,8 +23,6 @@
 static const char copyright[] _U_ =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
 The Regents of the University of California.  All rights reserved.\n";
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/filtertest.c,v 1.2 2005-08-08 17:50:13 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -233,7 +231,7 @@
 	dorfmon = 0;
 	useactivate = 0;
 	infile = NULL;
-  
+
 	if ((cp = strrchr(argv[0], '/')) != NULL)
 		program_name = cp + 1;
 	else
diff --git a/tokdefs.h b/tokdefs.h
index 75671d3..da9fd91 100644
--- a/tokdefs.h
+++ b/tokdefs.h
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.5.  */
+/* A Bison parser, made by GNU Bison 3.0.2.  */
 
 /* Bison interface for Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
-   
+
+   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+
    This program 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
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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/>.  */
 
@@ -26,136 +26,145 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-   
+
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
+#ifndef YY_PCAP_Y_TAB_H_INCLUDED
+# define YY_PCAP_Y_TAB_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int pcap_debug;
+#endif
 
-/* Tokens.  */
+/* Token type.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   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,
-     ISO = 330,
-     ESIS = 331,
-     CLNP = 332,
-     ISIS = 333,
-     L1 = 334,
-     L2 = 335,
-     IIH = 336,
-     LSP = 337,
-     SNP = 338,
-     CSNP = 339,
-     PSNP = 340,
-     STP = 341,
-     IPX = 342,
-     NETBEUI = 343,
-     LANE = 344,
-     LLC = 345,
-     METAC = 346,
-     BCC = 347,
-     SC = 348,
-     ILMIC = 349,
-     OAMF4EC = 350,
-     OAMF4SC = 351,
-     OAM = 352,
-     OAMF4 = 353,
-     CONNECTMSG = 354,
-     METACONNECT = 355,
-     VPI = 356,
-     VCI = 357,
-     RADIO = 358,
-     FISU = 359,
-     LSSU = 360,
-     MSU = 361,
-     HFISU = 362,
-     HLSSU = 363,
-     HMSU = 364,
-     SIO = 365,
-     OPC = 366,
-     DPC = 367,
-     SLS = 368,
-     HSIO = 369,
-     HOPC = 370,
-     HDPC = 371,
-     HSLS = 372,
-     AND = 373,
-     OR = 374,
-     UMINUS = 375
-   };
+  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,
+    OR = 374,
+    AND = 375,
+    UMINUS = 376
+  };
 #endif
 /* Tokens.  */
 #define DST 258
@@ -230,62 +239,60 @@
 #define MPLS 327
 #define PPPOED 328
 #define PPPOES 329
-#define ISO 330
-#define ESIS 331
-#define CLNP 332
-#define ISIS 333
-#define L1 334
-#define L2 335
-#define IIH 336
-#define LSP 337
-#define SNP 338
-#define CSNP 339
-#define PSNP 340
-#define STP 341
-#define IPX 342
-#define NETBEUI 343
-#define LANE 344
-#define LLC 345
-#define METAC 346
-#define BCC 347
-#define SC 348
-#define ILMIC 349
-#define OAMF4EC 350
-#define OAMF4SC 351
-#define OAM 352
-#define OAMF4 353
-#define CONNECTMSG 354
-#define METACONNECT 355
-#define VPI 356
-#define VCI 357
-#define RADIO 358
-#define FISU 359
-#define LSSU 360
-#define MSU 361
-#define HFISU 362
-#define HLSSU 363
-#define HMSU 364
-#define SIO 365
-#define OPC 366
-#define DPC 367
-#define SLS 368
-#define HSIO 369
-#define HOPC 370
-#define HDPC 371
-#define HSLS 372
-#define AND 373
+#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 OR 374
-#define UMINUS 375
+#define AND 375
+#define UMINUS 376
 
-
-
-
+/* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
 {
-
-/* Line 2068 of yacc.c  */
-#line 242 "grammar.y"
+#line 256 "grammar.y" /* yacc.c:1909  */
 
 	int i;
 	bpf_u_int32 h;
@@ -301,16 +308,15 @@
 	} blk;
 	struct block *rblk;
 
-
-
-/* Line 2068 of yacc.c  */
-#line 308 "y.tab.h"
-} YYSTYPE;
+#line 312 "y.tab.h" /* yacc.c:1909  */
+};
 # define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 #endif
 
+
 extern YYSTYPE pcap_lval;
 
+int pcap_parse (void);
 
+#endif /* !YY_PCAP_Y_TAB_H_INCLUDED  */
diff --git a/version.c b/version.c
index 795bf1e..482671d 100644
--- a/version.c
+++ b/version.c
@@ -1 +1 @@
-char pcap_version[] = "1.5.2";
+char pcap_version[] = "1.7.4";
diff --git a/version.h b/version.h
index 29c81da..a8b2df8 100644
--- a/version.h
+++ b/version.h
@@ -1 +1 @@
-static const char pcap_version_string[] = "libpcap version 1.5.2";
+static const char pcap_version_string[] = "libpcap version 1.7.4";