diff --git a/libpcap/CHANGES b/libpcap/CHANGES index 64734b5d7..f0fd50ea5 100644 --- a/libpcap/CHANGES +++ b/libpcap/CHANGES @@ -1,3 +1,50 @@ +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 +291,7 @@ Mon. October 27, 2008. ken@netfunctional.ca. Summary for 1.0.0 libpcap rele 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 +303,7 @@ Mon. October 27, 2008. ken@netfunctional.ca. Summary for 1.0.0 libpcap rele 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 +316,14 @@ Mon. September 10, 2007. ken@xelerance.com. Summary for 0.9.8 libpcap relea 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 for pf definitions - allows reading of pflog formatted + Require 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 +331,30 @@ Wed. April 25, 2007. ken@xelerance.com. Summary for 0.9.6 libpcap release 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 +366,19 @@ Tue. September 19, 2006. ken@xelerance.com. Summary for 0.9.5 libpcap release 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/libpcap/CREDITS b/libpcap/CREDITS index 69cbbf044..b40152f5e 100644 --- a/libpcap/CREDITS +++ b/libpcap/CREDITS @@ -2,11 +2,12 @@ This file lists people who have contributed to libpcap: The current maintainers: Bill Fenner - Denis Ovsienko + Denis Ovsienko Fulvio Risso Guy Harris Hannes Gredler Michael Richardson + Francois-Xavier Le Bail Additional people who have contributed patches: @@ -45,7 +46,7 @@ Additional people who have contributed patches: David Young Dean Gaudet dhruv - Don Ebright + Don Ebright Dug Song Dustin Spicuzza dzejarczech @@ -83,6 +84,7 @@ Additional people who have contributed patches: Jefferson Ogata Jesper Dangaard Brouer Jesper Peterson + Jesse Gross Jiri Slaby Joerg Mayer John Bankier @@ -105,13 +107,14 @@ Additional people who have contributed patches: Mansour Behabadi Marcus Felipe Pereira Mark C. Brown + Mark Johnston Mark Pizzolato Markus Mayer Martin Husemann Márton Németh Matthew Luckie Max Laier - Michal Labedzki + Michal Labedzki Michal Sekletar Mike Frysinger Mike Kershaw diff --git a/libpcap/INSTALL.txt b/libpcap/INSTALL.txt index 58d8e3c65..18b489aa8 100644 --- a/libpcap/INSTALL.txt +++ b/libpcap/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 @@ where the configure scripts fails to detect it. You will need an ANSI C compiler to build libpcap. The configure script will abort if your compiler is not ANSI compliant. If this happens, use -the 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 @@ packet timestamps aren't very good. This appears to be due to haphazard 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 @@ nametoaddr.c - hostname to address routines 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/libpcap/LICENSE b/libpcap/LICENSE index dea5f7d54..a10474d54 100644 --- a/libpcap/LICENSE +++ b/libpcap/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 @@ are met: 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. diff --git a/libpcap/Makefile.in b/libpcap/Makefile.in index 96e7f0a0b..577b84850 100644 --- a/libpcap/Makefile.in +++ b/libpcap/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 @@ DEFS = @DEFS@ @V_DEFS@ ADDLOBJS = @ADDLOBJS@ ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@ LIBS = @LIBS@ -CFLAGS = @CFLAGS@ -LDFLAGS = @LDFLAGS@ +CROSSFLAGS= +CFLAGS = @CFLAGS@ ${CROSSFLAGS} +LDFLAGS = @LDFLAGS@ ${CROSSFLAGS} DYEXT = @DYEXT@ V_RPATH_OPT = @V_RPATH_OPT@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ @@ -77,7 +76,7 @@ RANLIB = @RANLIB@ @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 \ @@ -99,6 +98,7 @@ PUBHDR = \ pcap/bluetooth.h \ pcap/ipnet.h \ pcap/namedb.h \ + pcap/nflog.h \ pcap/pcap.h \ pcap/sll.h \ pcap/vlan.h \ @@ -121,17 +121,17 @@ HDR = $(PUBHDR) \ 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 \ @@ -284,10 +284,11 @@ EXTRA_DIST = \ msdos/pktdrvr.h \ msdos/readme.dos \ org.tcpdump.chmod_bpf.plist \ - packaging/pcap.spec.in \ pcap-bpf.c \ pcap-bt-linux.c \ pcap-bt-linux.h \ + pcap-bt-monitor-linux.c \ + pcap-bt-monitor-linux.h \ pcap-can-linux.c \ pcap-can-linux.h \ pcap-canusb-linux.c \ @@ -323,6 +324,7 @@ EXTRA_DIST = \ pcap-usb-linux.h \ pcap-win32.c \ runlex.sh \ + scanner.c.top \ scanner.l \ Win32/Include/Gnuc.h \ Win32/Include/addrinfo.h \ @@ -516,15 +518,15 @@ pcap-config: $(srcdir)/pcap-config.in ./config.status # 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) @@ -595,6 +597,8 @@ install: install-shared install-archive pcap-config $(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 \ @@ -678,6 +682,7 @@ uninstall: uninstall-shared 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 \ @@ -717,10 +722,6 @@ distclean: clean 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; \ @@ -731,4 +732,4 @@ releasetar: 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/libpcap/NMAP_MODIFICATIONS/0001-Don-t-autogenerate-Lex-Yacc-files.patch b/libpcap/NMAP_MODIFICATIONS/0001-Don-t-autogenerate-Lex-Yacc-files.patch index a72e3fbb8..07eafe321 100644 --- a/libpcap/NMAP_MODIFICATIONS/0001-Don-t-autogenerate-Lex-Yacc-files.patch +++ b/libpcap/NMAP_MODIFICATIONS/0001-Don-t-autogenerate-Lex-Yacc-files.patch @@ -1,18 +1,18 @@ -From 0198a593ef29d7af319b02dd33f251b58d117827 Mon Sep 17 00:00:00 2001 -From: David Fifield -Date: Mon, 9 Apr 2012 16:55:51 -0700 +From f38b1fc263d65a53746108e2c9afacf1dc6a058a Mon Sep 17 00:00:00 2001 +From: Daniel Miller +Date: Fri, 1 May 2015 14:44:28 +0000 Subject: [PATCH 1/2] Don't autogenerate Lex/Yacc files. --- - Makefile.in | 30 ++++++++++-------------------- - configure.in | 20 -------------------- - 2 files changed, 10 insertions(+), 40 deletions(-) + libpcap/Makefile.in | 33 ++++++++++----------------------- + libpcap/configure.in | 20 -------------------- + 2 files changed, 10 insertions(+), 43 deletions(-) -diff --git Makefile.in Makefile.in -index 912b7e3..0db12a4 100644 ---- Makefile.in -+++ Makefile.in -@@ -67,14 +67,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +diff --git a/libpcap/Makefile.in b/libpcap/Makefile.in +index f317973..577b848 100644 +--- a/libpcap/Makefile.in ++++ b/libpcap/Makefile.in +@@ -69,14 +69,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ RANLIB = @RANLIB@ @@ -27,7 +27,7 @@ index 912b7e3..0db12a4 100644 # Explicitly define compilation rule since SunOS 4's make doesn't like gcc. # Also, gcc does not remove the .o before forking 'as', which can be a # problem if you don't own the file but can write to the directory. -@@ -147,7 +139,7 @@ TAGFILES = \ +@@ -152,7 +144,7 @@ TAGFILES = \ $(SRC) $(HDR) CLEANFILES = $(OBJ) libpcap.* $(TESTS) \ @@ -36,7 +36,7 @@ index 912b7e3..0db12a4 100644 lex.yy.c pcap-config MAN1 = pcap-config.1 -@@ -345,6 +337,15 @@ EXTRA_DIST = \ +@@ -360,6 +352,15 @@ EXTRA_DIST = \ all: libpcap.a shared pcap-config @@ -52,13 +52,16 @@ index 912b7e3..0db12a4 100644 libpcap.a: $(OBJ) @rm -f $@ $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS) -@@ -428,22 +429,11 @@ libpcap.shareda: $(OBJ) +@@ -443,25 +444,11 @@ libpcap.shareda: $(OBJ) # libpcap.none: -scanner.c: $(srcdir)/scanner.l -- @rm -f $@ +- @rm -f $@ $@.bottom - $(srcdir)/runlex.sh $(LEX) -o$@ $< +- mv $@ $@.bottom +- cat $@.top $@.bottom > $@ +- @rm $@.bottom - scanner.o: scanner.c tokdefs.h $(CC) $(FULL_CFLAGS) -c scanner.c @@ -75,11 +78,11 @@ index 912b7e3..0db12a4 100644 grammar.o: grammar.c @rm -f $@ $(CC) $(FULL_CFLAGS) -Dyylval=pcap_lval -c grammar.c -diff --git configure.in configure.in -index 6a146ca..24097b2 100644 ---- configure.in -+++ configure.in -@@ -998,24 +998,6 @@ if test "$V_PCAP" = snf -a "$ac_cv_lbl_snf_api" = no; then +diff --git a/libpcap/configure.in b/libpcap/configure.in +index be4b29e..ec87283 100644 +--- a/libpcap/configure.in ++++ b/libpcap/configure.in +@@ -1051,24 +1051,6 @@ if test "$V_PCAP" = snf -a "$ac_cv_lbl_snf_api" = no; then AC_MSG_ERROR(Specifying the capture type as 'snf' requires the Myricom Sniffer API to be present; use --with-snf=DIR) fi @@ -104,7 +107,7 @@ index 6a146ca..24097b2 100644 # # Assume, by default, no support for shared libraries and V7/BSD convention # for man pages (file formats in section 5, miscellaneous info in section 7). -@@ -1250,13 +1232,11 @@ AC_SUBST(V_CCOPT) +@@ -1351,13 +1333,11 @@ AC_SUBST(V_CCOPT) AC_SUBST(V_DEFS) AC_SUBST(V_FINDALLDEVS) AC_SUBST(V_INCLS) @@ -119,5 +122,5 @@ index 6a146ca..24097b2 100644 AC_SUBST(ADDLARCHIVEOBJS) AC_SUBST(SSRC) -- -1.7.9.5 +1.9.1 diff --git a/libpcap/NMAP_MODIFICATIONS/0002-Add-the-disable-packet-ring-configure-option.patch b/libpcap/NMAP_MODIFICATIONS/0002-Add-the-disable-packet-ring-configure-option.patch deleted file mode 100644 index 89372bb90..000000000 --- a/libpcap/NMAP_MODIFICATIONS/0002-Add-the-disable-packet-ring-configure-option.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 3807934db1b073534a01d9a8546cddcec9be501f Mon Sep 17 00:00:00 2001 -From: David Fifield -Date: Mon, 9 Apr 2012 17:02:40 -0700 -Subject: [PATCH 2/2] Add the --disable-packet-ring configure option. - -This allows the creation of 32-bit binaries that are compatible with -64-bit Linux kernels before version 2.6.27. ---- - configure.in | 18 ++++++++++++++++++ - pcap-linux.c | 18 ++++++++++-------- - config.h.in | 3 +++ - 3 files changed, 31 insertions(+), 8 deletions(-) - -diff --git configure.in configure.in -index 24097b2..5eca6ab 100644 ---- configure.in -+++ configure.in -@@ -1404,6 +1404,24 @@ linux*) - ;; - 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 pcap-linux.c pcap-linux.c -index 17bd0f5..bd2457d 100644 ---- pcap-linux.c -+++ pcap-linux.c -@@ -196,17 +196,19 @@ static const char rcsid[] _U_ = - /* 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 TPACKET_HDRLEN --# define HAVE_PACKET_RING --# ifdef TPACKET3_HDRLEN --# define HAVE_TPACKET3 --# endif /* TPACKET3_HDRLEN */ --# ifdef TPACKET2_HDRLEN --# define HAVE_TPACKET2 --# else /* TPACKET2_HDRLEN */ --# define TPACKET_V1 0 /* Old kernel with only V1, so no TPACKET_Vn defined */ --# endif /* TPACKET2_HDRLEN */ --# endif /* TPACKET_HDRLEN */ -+# ifdef PCAP_SUPPORT_PACKET_RING -+# ifdef TPACKET_HDRLEN -+# define HAVE_PACKET_RING -+# ifdef TPACKET3_HDRLEN -+# define HAVE_TPACKET3 -+# endif /* TPACKET3_HDRLEN */ -+# ifdef TPACKET2_HDRLEN -+# define HAVE_TPACKET2 -+# else /* TPACKET2_HDRLEN */ -+# 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 ---- config.h.in -+++ config.h.in -@@ -271,6 +271,9 @@ - /* target host supports USB sniffing */ - #undef PCAP_SUPPORT_USB - -+/* target host supports packet ring capture */ -+#undef PCAP_SUPPORT_PACKET_RING -+ - /* include ACN support */ - #undef SITA - diff --git a/libpcap/NMAP_MODIFICATIONS/0003-Disable-unnecessary-features.patch b/libpcap/NMAP_MODIFICATIONS/0002-Disable-unnecessary-features.patch similarity index 73% rename from libpcap/NMAP_MODIFICATIONS/0003-Disable-unnecessary-features.patch rename to libpcap/NMAP_MODIFICATIONS/0002-Disable-unnecessary-features.patch index 3e13fbd05..7561ec03d 100644 --- a/libpcap/NMAP_MODIFICATIONS/0003-Disable-unnecessary-features.patch +++ b/libpcap/NMAP_MODIFICATIONS/0002-Disable-unnecessary-features.patch @@ -1,3 +1,8 @@ +From 7a42932439162be1f263986cdc7bbef78840a71a Mon Sep 17 00:00:00 2001 +From: Daniel Miller +Date: Fri, 1 May 2015 14:53:42 +0000 +Subject: [PATCH 2/2] Disable unnecessary features + The following features are disabled: * monitor-mode sniffing of wireless interfaces on Linux, via libnl @@ -6,12 +11,15 @@ The following features are disabled: * canusb support * CAN support * dbus capture support +--- + libpcap/configure.in | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libpcap/configure.in b/libpcap/configure.in -index 5386062..8ceddd7 100644 +index ec87283..ad2e437 100644 --- a/libpcap/configure.in +++ b/libpcap/configure.in -@@ -441,10 +441,10 @@ linux) +@@ -450,10 +450,10 @@ linux) # Do we have libnl? # AC_ARG_WITH(libnl, @@ -23,8 +31,8 @@ index 5386062..8ceddd7 100644 + if test x$with_libnl = xyes ; then have_any_nl="no" - # -@@ -1285,8 +1285,8 @@ solaris*) + incdir=-I/usr/include/libnl3 +@@ -1301,8 +1301,8 @@ solaris*) esac AC_ARG_ENABLE(shared, @@ -35,43 +43,43 @@ index 5386062..8ceddd7 100644 AC_PROG_RANLIB AC_CHECK_TOOL([AR], [ar]) -@@ -1434,9 +1434,9 @@ AC_SUBST(PCAP_SUPPORT_NETFILTER) +@@ -1457,9 +1457,9 @@ AC_SUBST(PCAP_SUPPORT_NETFILTER) AC_SUBST(NETFILTER_SRC) AC_ARG_ENABLE([bluetooth], -[AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])], +[AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=no@:>@])], [], -- [enable_bluetooth=yes]) +- [enable_bluetooth=ifsupportavailable]) + [enable_bluetooth=no]) if test "x$enable_bluetooth" != "xno" ; then dnl check for Bluetooth sniffing support -@@ -1480,9 +1480,9 @@ if test "x$enable_bluetooth" != "xno" ; then +@@ -1536,9 +1536,9 @@ if test "x$enable_bluetooth" != "xno" ; then fi AC_ARG_ENABLE([canusb], -[AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=yes, if support available@:>@])], +[AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=no@:>@])], [], -- [enable_canusb=yes]) +- [enable_canusb=ifsupportavailable]) + [enable_canusb=no]) if test "x$enable_canusb" != "xno" ; then dnl check for canusb support -@@ -1507,9 +1507,9 @@ if test "x$enable_canusb" != "xno" ; then +@@ -1582,9 +1582,9 @@ if test "x$enable_canusb" != "xno" ; then fi AC_ARG_ENABLE([can], -[AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])], +[AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=no@:>@])], [], -- [enable_can=yes]) +- [enable_can=ifsupportavailable]) + [enable_can=no]) if test "x$enable_can" != "xno" ; then dnl check for CAN sniffing support -@@ -1532,9 +1532,9 @@ if test "x$enable_can" != "xno" ; then +@@ -1619,9 +1619,9 @@ if test "x$enable_can" != "xno" ; then fi AC_ARG_ENABLE([dbus], @@ -82,4 +90,7 @@ index 5386062..8ceddd7 100644 + [enable_dbus=no]) if test "x$enable_dbus" != "xno"; then - AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no]) + if test "x$enable_dbus" = "xyes"; then +-- +1.9.1 + diff --git a/libpcap/NMAP_MODIFICATIONS/HOWTO-UPGRADE b/libpcap/NMAP_MODIFICATIONS/HOWTO-UPGRADE index 9cf690ff8..f5eb1aaad 100644 --- a/libpcap/NMAP_MODIFICATIONS/HOWTO-UPGRADE +++ b/libpcap/NMAP_MODIFICATIONS/HOWTO-UPGRADE @@ -9,14 +9,13 @@ cd nmap rsync -rv --delete ~/libpcap-X.Y/ ~/nmap/libpcap/ git add -A libpcap cd libpcap -# Apply the pre-configure patch. -git apply -p0 --directory=libpcap/ ~/NMAP_MODIFICATIONS/pre-configure.patch ./configure make grammar.c scanner.c scanner.h tokdefs.h git add grammar.c scanner.c scanner.h tokdefs.h cd .. # Apply patches. -git apply -p0 --directory=libpcap/ ~/NMAP_MODIFICATIONS/000* +git apply ~/NMAP_MODIFICATIONS/000* +# Make changes as necessary and update the patch files cd libpcap autoconf cd .. diff --git a/libpcap/NMAP_MODIFICATIONS/pre-configure.patch b/libpcap/NMAP_MODIFICATIONS/pre-configure.patch deleted file mode 100644 index 95369793c..000000000 --- a/libpcap/NMAP_MODIFICATIONS/pre-configure.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git scanner.l scanner.l -index 064e9c8..93d7b97 100644 ---- scanner.l -+++ scanner.l -@@ -1,3 +1,10 @@ -+%top{ -+/* Must come first for _LARGE_FILE_API on AIX. */ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+} -+ - %{ - /* - * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 -@@ -25,10 +32,6 @@ 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 - #else /* WIN32 */ diff --git a/libpcap/README b/libpcap/README index 2f14aac9e..9f65948d4 100644 --- a/libpcap/README +++ b/libpcap/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 @@ information on configuring that option. Note to Linux distributions and *BSD systems that include libpcap: -There's now a rule to make a shared library, which should work on Linux +There's now a rule to make a shared library, which should work on Linux and *BSD, among other platforms. -It sets the soname of the library to "libpcap.so.1"; this is what it -should be, *NOT* libpcap.so.1.x or libpcap.so.1.x.y or something such as +It sets the soname of the library to "libpcap.so.1"; this is what it +should be, *NOT* libpcap.so.1.x or libpcap.so.1.x.y or something such as that. -We've been maintaining binary compatibility between libpcap releases for -quite a while; there's no reason to tie a binary linked with libpcap to +We've been maintaining binary compatibility between libpcap releases for +quite a while; there's no reason to tie a binary linked with libpcap to a particular release of libpcap. Problems, bugs, questions, desirable enhancements, etc. should be sent diff --git a/libpcap/README.Win32 b/libpcap/README.Win32 index 503836e34..0a42dab93 100644 --- a/libpcap/README.Win32 +++ b/libpcap/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 @@ How to compile libpcap with Visual Studio 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/libpcap/README.aix b/libpcap/README.aix index 74cd9af65..92e513ff7 100644 --- a/libpcap/README.aix +++ b/libpcap/README.aix @@ -11,6 +11,11 @@ Using BPF: 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 @@ If you use DLPI: 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/libpcap/README.hpux b/libpcap/README.hpux index 88c27f8a2..65ecff97c 100644 --- a/libpcap/README.hpux +++ b/libpcap/README.hpux @@ -5,14 +5,14 @@ HP-UX and cannot upgrade, please continue reading. 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 @@ -27,14 +27,14 @@ which says: >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 @@ and 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 @@ -56,12 +56,12 @@ which says: > 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 @@ which says: From: Harald Skotnes Rick Jones wrote: - + ... > What you are seeing is expected, un-patched, behaviour for an HP-UX @@ -87,7 +87,7 @@ which says: > 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 @@ And another message to tcpdump-workers@tcpdump.org, from Rick Jones: 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 @@ captures on HP-UX 9.x: 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 @@ An additional note, from Jost Martin, for HP-UX 10.20: (thanks to hildeb@www.stahl.bau.tu-bs.de (Ralf Hildebrandt) who posted the security-part some time ago) - <> + <> (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/libpcap/README.linux b/libpcap/README.linux index f92cd22b9..ffcb9288c 100644 --- a/libpcap/README.linux +++ b/libpcap/README.linux @@ -19,13 +19,13 @@ the 2.0[.x] kernel: 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 @@ In addition, there is an option that, in 2.2 and later kernels, will 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/libpcap/README.septel b/libpcap/README.septel index fbc88df38..483de6a7f 100644 --- a/libpcap/README.septel +++ b/libpcap/README.septel @@ -14,7 +14,7 @@ where DIR is the root of the Septel software distribution, for example /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/libpcap/README.tru64 b/libpcap/README.tru64 index 7fe1ef07b..2420d9e12 100644 --- a/libpcap/README.tru64 +++ b/libpcap/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/libpcap/TODO b/libpcap/TODO index 73325e196..aae24c22d 100644 --- a/libpcap/TODO +++ b/libpcap/TODO @@ -6,11 +6,11 @@ Important stuff (to be done before the next release) General -- configure should not be in Git. Most open source projects have an - autogen.sh script to run autoconf etc. after checkout. I think we - should stick to the standard. +- configure should not be in Git. Most open source projects have an + autogen.sh script to run autoconf etc. after checkout. I think we + should stick to the standard. -- The source files should be better documented. There is no official +- The source files should be better documented. There is no official design guideline for what is done where. There should be a common coding style (okay, you can guess that by looking at the code) and a guide for what needs to be documented. @@ -18,7 +18,7 @@ General Less urgent items ----------------- -- Better documentation and cleanup of the interface. I am seeing a few +- Better documentation and cleanup of the interface. I am seeing a few problems at the first glance which needs fixing: + pcap_lookupnet makes little to no sense with protocols != IPv4 + not very well suited for interactive programs (think ethereal). There diff --git a/libpcap/VERSION b/libpcap/VERSION index 8af85beb5..661e7aead 100644 --- a/libpcap/VERSION +++ b/libpcap/VERSION @@ -1 +1 @@ -1.5.3 +1.7.3 diff --git a/libpcap/Win32/Include/Gnuc.h b/libpcap/Win32/Include/Gnuc.h index 0bf4b735f..aa4959873 100644 --- a/libpcap/Win32/Include/Gnuc.h +++ b/libpcap/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/libpcap/Win32/Include/addrinfo.h b/libpcap/Win32/Include/addrinfo.h index 8cb2e65ee..ac4fcce10 100644 --- a/libpcap/Win32/Include/addrinfo.h +++ b/libpcap/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 @@ extern const char *inet_ntop (int, const void *, char *, size_t); #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/libpcap/Win32/Include/arpa/nameser.h b/libpcap/Win32/Include/arpa/nameser.h index 18f185cf5..b20dc1e3f 100644 --- a/libpcap/Win32/Include/arpa/nameser.h +++ b/libpcap/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 #endif #include -#else +#else #include #define __LITTLE_ENDIAN 1 #define __BYTE_ORDER __LITTLE_ENDIAN diff --git a/libpcap/Win32/Include/bittypes.h b/libpcap/Win32/Include/bittypes.h index 7c0cbdeb5..95aa9faa6 100644 --- a/libpcap/Win32/Include/bittypes.h +++ b/libpcap/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 unsigned char u_int8_t; 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/libpcap/Win32/Include/cdecl_ext.h b/libpcap/Win32/Include/cdecl_ext.h index 9591db264..9d40b84cb 100644 --- a/libpcap/Win32/Include/cdecl_ext.h +++ b/libpcap/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/libpcap/Win32/Include/ip6_misc.h b/libpcap/Win32/Include/ip6_misc.h index 562fa6184..0b578c33c 100644 --- a/libpcap/Win32/Include/ip6_misc.h +++ b/libpcap/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/libpcap/Win32/Include/net/if.h b/libpcap/Win32/Include/net/if.h index bf926b6ef..58d3c16e0 100644 --- a/libpcap/Win32/Include/net/if.h +++ b/libpcap/Win32/Include/net/if.h @@ -36,7 +36,7 @@ #ifndef _NET_IF_H_ #define _NET_IF_H_ - + /* * does not depend on on most other systems. This * helps userland compatability. (struct timeval ifi_lastchange) diff --git a/libpcap/Win32/Include/net/netdb.h b/libpcap/Win32/Include/net/netdb.h index b9d45acf6..f7685d250 100644 --- a/libpcap/Win32/Include/net/netdb.h +++ b/libpcap/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 #include #endif diff --git a/libpcap/Win32/Include/sockstorage.h b/libpcap/Win32/Include/sockstorage.h index 557eb4df0..cbad19004 100644 --- a/libpcap/Win32/Include/sockstorage.h +++ b/libpcap/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/libpcap/Win32/Prj/libpcap.dsp b/libpcap/Win32/Prj/libpcap.dsp index 17e5a7037..7082122cc 100644 --- a/libpcap/Win32/Prj/libpcap.dsp +++ b/libpcap/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 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo -!ENDIF +!ENDIF # Begin Target diff --git a/libpcap/Win32/Src/gai_strerror.c b/libpcap/Win32/Src/gai_strerror.c index edd970b92..a36c35d8f 100644 --- a/libpcap/Win32/Src/gai_strerror.c +++ b/libpcap/Win32/Src/gai_strerror.c @@ -67,7 +67,7 @@ static char *ai_errlist[] = { #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/libpcap/Win32/Src/getaddrinfo.c b/libpcap/Win32/Src/getaddrinfo.c index ebfe8c2c9..d3ebda085 100644 --- a/libpcap/Win32/Src/getaddrinfo.c +++ b/libpcap/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 -#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 @@ -76,17 +71,17 @@ static const char rcsid[] _U_ = #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 in_addrany[] = { 0, 0, 0, 0 }; 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 @@ static const struct afd { 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 @@ getaddrinfo(hostname, servname, hints, res) 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 @@ explore_numeric(pai, hostname, servname, res) } while (cur && cur->ai_next) cur = cur->ai_next; - } else + } else ERR(EAI_FAMILY); /*xxx*/ } @@ -960,7 +955,7 @@ get_name(addr, afd, res, numaddr, pai, servname) GET_AI(cur, afd, numaddr); GET_PORT(cur, servname); } - + #ifdef USE_GETIPNODEBY if (hp) freehostent(hp); diff --git a/libpcap/Win32/Src/getnetent.c b/libpcap/Win32/Src/getnetent.c index d4cceb334..95281a548 100644 --- a/libpcap/Win32/Src/getnetent.c +++ b/libpcap/Win32/Src/getnetent.c @@ -85,7 +85,7 @@ again: 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/libpcap/Win32/Src/inet_aton.c b/libpcap/Win32/Src/inet_aton.c index 3da6667c6..db97bceae 100644 --- a/libpcap/Win32/Src/inet_aton.c +++ b/libpcap/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 #include diff --git a/libpcap/Win32/Src/inet_pton.c b/libpcap/Win32/Src/inet_pton.c index 7933a4e69..7fe3813a0 100644 --- a/libpcap/Win32/Src/inet_pton.c +++ b/libpcap/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 #ifdef WIN32 diff --git a/libpcap/aclocal.m4 b/libpcap/aclocal.m4 index 4b643ef0d..02502b27f 100644 --- a/libpcap/aclocal.m4 +++ b/libpcap/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 @@ AC_DEFUN(AC_LBL_CHECK_UNKNOWN_WARNING_OPTION_ERROR, # 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 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/libpcap/arcnet.h b/libpcap/arcnet.h index 4f86043e6..58690985c 100644 --- a/libpcap/arcnet.h +++ b/libpcap/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/libpcap/atmuni31.h b/libpcap/atmuni31.h index 880cc1a8a..0f8543009 100644 --- a/libpcap/atmuni31.h +++ b/libpcap/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/libpcap/bpf/net/bpf_filter.c b/libpcap/bpf/net/bpf_filter.c index 0c4fb0061..ffe04ce35 100644 --- a/libpcap/bpf/net/bpf_filter.c +++ b/libpcap/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 @@ m_xhalf(m, k, err) } #endif +#ifdef __linux__ +#include +#include +#include +#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 @@ bpf_filter(pc, p, wirelen, buflen) case BPF_LD|BPF_W|BPF_ABS: k = pc->k; - if (k + sizeof(int32) > buflen) { + if (k > buflen || sizeof(int32_t) > buflen - k) { #if defined(KERNEL) || defined(_KERNEL) if (m == NULL) return 0; @@ -272,7 +283,7 @@ bpf_filter(pc, p, wirelen, buflen) case BPF_LD|BPF_H|BPF_ABS: k = pc->k; - if (k + sizeof(short) > buflen) { + if (k > buflen || sizeof(int16_t) > buflen - k) { #if defined(KERNEL) || defined(_KERNEL) if (m == NULL) return 0; @@ -288,22 +299,50 @@ bpf_filter(pc, p, wirelen, buflen) continue; case BPF_LD|BPF_B|BPF_ABS: - k = pc->k; - if (k >= buflen) { -#if defined(KERNEL) || defined(_KERNEL) - if (m == NULL) - return 0; - n = m; - MINDEX(len, n, k); - A = mtod(n, u_char *)[k]; - continue; -#else - return 0; -#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 @@ bpf_filter(pc, p, wirelen, buflen) case BPF_LD|BPF_W|BPF_IND: k = X + pc->k; - if (k + sizeof(int32) > buflen) { + if (pc->k > buflen || X > buflen - pc->k || + sizeof(int32_t) > buflen - k) { #if defined(KERNEL) || defined(_KERNEL) if (m == NULL) return 0; @@ -331,7 +371,8 @@ bpf_filter(pc, p, wirelen, buflen) case BPF_LD|BPF_H|BPF_IND: k = X + pc->k; - if (k + sizeof(short) > buflen) { + if (X > buflen || pc->k > buflen - X || + sizeof(int16_t) > buflen - k) { #if defined(KERNEL) || defined(_KERNEL) if (m == NULL) return 0; @@ -348,7 +389,7 @@ bpf_filter(pc, p, wirelen, buflen) case BPF_LD|BPF_B|BPF_IND: k = X + pc->k; - if (k >= buflen) { + if (pc->k >= buflen || X >= buflen - pc->k) { #if defined(KERNEL) || defined(_KERNEL) if (m == NULL) return 0; @@ -469,6 +510,12 @@ bpf_filter(pc, p, wirelen, buflen) 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 @@ bpf_filter(pc, p, wirelen, buflen) 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 @@ bpf_filter(pc, p, wirelen, buflen) 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 @@ bpf_filter(pc, p, wirelen, buflen) 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 @@ bpf_filter(pc, p, wirelen, buflen) } } +u_int +bpf_filter(pc, p, wirelen, buflen) + register const struct bpf_insn *pc; + register const u_char *p; + u_int wirelen; + register u_int buflen; +{ + return bpf_filter_with_aux_data(pc, p, wirelen, buflen, NULL); +} + + /* * Return true if the 'fcode' is a valid filter program. * The constraints are that each jump be forward and to a valid @@ -611,13 +681,16 @@ bpf_validate(f, len) 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/libpcap/bpf_dump.c b/libpcap/bpf_dump.c index e4ff4a239..5eaadc08a 100644 --- a/libpcap/bpf_dump.c +++ b/libpcap/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/libpcap/bpf_image.c b/libpcap/bpf_image.c index e6c0f6261..3e9a23f51 100644 --- a/libpcap/bpf_image.c +++ b/libpcap/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 @@ bpf_image(p, n) 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 @@ bpf_image(p, n) 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 @@ bpf_image(p, n) 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 @@ bpf_image(p, n) 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/libpcap/config.guess b/libpcap/config.guess index c2246a4f7..44290b838 100755 --- a/libpcap/config.guess +++ b/libpcap/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 @@ timestamp='2009-12-30' # 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 . # # 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 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 . + me=`echo "$0" | sed -e 's,.*/,,'` @@ -56,9 +50,7 @@ version="\ 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_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +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 + #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 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 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 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in 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 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 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 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in 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 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 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 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in 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 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 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 @@ EOF 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 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -552,15 +586,16 @@ EOF 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 @@ EOF 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 - #include + #define _HPUX_SOURCE + #include + #include - 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 @@ EOF 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 @@ EOF 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 @@ EOF 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 @@ EOF 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 @@ EOF 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 @@ EOF #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 @@ EOF 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 @@ EOF 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 @@ EOF 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 @@ EOF /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 @@ EOF echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm @@ -1162,11 +1225,11 @@ EOF 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 @@ EOF 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 @@ EOF 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 @@ EOF *: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 @@ EOF 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 @@ EOF 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 < -# include -#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 - 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 -# 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 < header file. */ #undef HAVE_LINUX_ETHTOOL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_IF_BONDING_H + /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_IF_PACKET_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_NET_TSTAMP_H +/* Define to 1 if you have the 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,12 +277,12 @@ /* 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 -/* target host supports packet ring capture */ -#undef PCAP_SUPPORT_PACKET_RING - /* include ACN support */ #undef SITA diff --git a/libpcap/config.sub b/libpcap/config.sub index 85186096a..bc855a2a9 100755 --- a/libpcap/config.sub +++ b/libpcap/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 . # # 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 . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -75,9 +68,7 @@ Report bugs and patches to ." 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 @@ esac # 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 @@ case $os in -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 @@ case $os in os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; @@ -222,6 +218,12 @@ case $os in -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 @@ case $basic_machine in # 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 @@ case $basic_machine in | 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 @@ case $basic_machine in 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 @@ case $basic_machine in # 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 @@ case $basic_machine in | 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 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; - abacus) + abacus) basic_machine=abacus-unknown ;; adobe68k) @@ -481,11 +538,20 @@ case $basic_machine in 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 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16) + cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; @@ -675,7 +741,6 @@ case $basic_machine in 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 @@ case $basic_machine in 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 @@ case $basic_machine in 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 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -772,10 +848,18 @@ case $basic_machine in 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 @@ case $basic_machine in 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 @@ case $basic_machine in ;; 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 @@ case $basic_machine in 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 @@ case $basic_machine in 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 @@ case $basic_machine in 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 @@ case $basic_machine in 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 @@ esac 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 @@ case $os in -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 @@ case $os in -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1391,7 +1481,7 @@ case $os in -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1427,17 +1517,14 @@ case $os in -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; - -nacl*) - ;; + -nacl*) + ;; -none) ;; *) @@ -1460,10 +1547,10 @@ else # 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 @@ case $basic_machine in 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 @@ case $basic_machine in ;; 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 @@ case $basic_machine in *-ibm) os=-aix ;; - *-knuth) + *-knuth) os=-mmixware ;; *-wec) diff --git a/libpcap/configure b/libpcap/configure index e8887360d..91fa6762a 100755 --- a/libpcap/configure +++ b/libpcap/configure @@ -631,6 +631,7 @@ CAN_SRC PCAP_SUPPORT_CAN CANUSB_SRC PCAP_SUPPORT_CANUSB +BT_MONITOR_SRC BT_SRC PCAP_SUPPORT_BT NETFILTER_SRC @@ -741,6 +742,7 @@ with_snf_includes with_snf_libraries enable_universal enable_shared +enable_usb enable_bluetooth enable_canusb enable_can @@ -1376,6 +1378,8 @@ Optional Features: --enable-yydebug build parser debugging code --disable-universal don't build universal on OS X --enable-shared build shared libraries [default=no] + --enable-usb enable nusb support [default=yes, if support + available] --enable-bluetooth enable Bluetooth support [default=no] --enable-canusb enable canusb support [default=no] --enable-can enable CAN support [default=no] @@ -4694,6 +4698,28 @@ done 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 +#include + +" +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; } @@ -5502,6 +5528,13 @@ fi if test x$with_libnl = xyes ; 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. # @@ -5511,7 +5544,7 @@ if ${ac_cv_lib_nl_3_nl_socket_alloc+:} false; then : $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. */ @@ -5546,7 +5579,7 @@ if test "x$ac_cv_lib_nl_3_nl_socket_alloc" = xyes; then : # # 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 @@ -5559,7 +5592,7 @@ $as_echo "#define HAVE_LIBNL_NLE 1" >>confdefs.h $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 @@ -5610,7 +5643,7 @@ if test "x$ac_cv_lib_nl_nl_socket_alloc" = xyes; then : # # 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 @@ -5674,7 +5707,7 @@ if test "x$ac_cv_lib_nl_nl_handle_alloc" = xyes; then : # # Yes. # - LIBS="-lnl $LIBS" + LIBS="${libnldir} -lnl $LIBS" $as_echo "#define HAVE_LIBNL 1" >>confdefs.h @@ -7625,10 +7658,19 @@ ln -s ${srcdir}/bpf/net net -{ $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 @@ -7741,11 +7783,12 @@ $as_echo "#define HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE 1" >>confdefs.h fi fi ;; -*) + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac +fi @@ -7872,23 +7915,75 @@ $as_echo "$ac_cv_lbl_sockaddr_hci_has_hci_channel" >&6; } $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 +#include + +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. @@ -7901,29 +7996,86 @@ 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 @@ -7946,21 +8098,33 @@ if test "x$enable_can" != "xno" ; then " 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 @@ -7975,6 +8139,38 @@ else fi +if test "x$enable_dbus" != "xno"; then + if test "x$enable_dbus" = "xyes"; then + 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 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 + 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 diff --git a/libpcap/configure.in b/libpcap/configure.in index 39989af48..ad2e437bf 100644 --- a/libpcap/configure.in +++ b/libpcap/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 @@ struct rtentry; #include ]) fi +case "$host_os" in +linux*) + AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,, + [ +#include +#include + ]) + ;; +esac + AC_LBL_FIXINCLUDES AC_CHECK_FUNCS(strerror strlcpy) @@ -361,11 +370,11 @@ dlpi) # # 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 @@ linux) if test x$with_libnl = xyes ; 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 @@ linux) # # 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 @@ linux) # # 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 @@ linux) # # Yes. # - LIBS="-lnl $LIBS" + LIBS="${libnldir} -lnl $LIBS" AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]) have_any_nl="yes" ]) @@ -529,7 +545,7 @@ bpf) #include #include ], [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 "$want_dag" != no; then 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 @@ if test $ac_cv_lbl_dag_api = yes; then 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()]) @@ -1329,10 +1345,16 @@ AC_SUBST(DYEXT) 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) @@ -1383,10 +1405,11 @@ AC_INCLUDES_DEFAULT fi fi ;; -*) + *) AC_MSG_RESULT(no) ;; esac +fi AC_SUBST(PCAP_SUPPORT_USB) AC_SUBST(USB_SRC) @@ -1466,17 +1489,50 @@ if test "x$enable_bluetooth" != "xno" ; then 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 +#include +], + [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], @@ -1487,19 +1543,38 @@ AC_ARG_ENABLE([canusb], 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) @@ -1516,15 +1591,27 @@ if test "x$enable_can" != "xno" ; then 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 ] ) ;; *) - 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) @@ -1536,6 +1623,38 @@ AC_ARG_ENABLE([dbus], [], [enable_dbus=no]) +if test "x$enable_dbus" != "xno"; then + if test "x$enable_dbus" = "xyes"; then + 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 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 + 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 + if test "x$enable_dbus" != "xno"; then AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no]) if test "x$PKGCONFIG" != "xno"; then diff --git a/libpcap/dlpisubs.c b/libpcap/dlpisubs.c index 671302f16..131fa279d 100644 --- a/libpcap/dlpisubs.c +++ b/libpcap/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/libpcap/dlpisubs.h b/libpcap/dlpisubs.h index 858bca3c5..cdc531c1f 100644 --- a/libpcap/dlpisubs.h +++ b/libpcap/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/libpcap/etherent.c b/libpcap/etherent.c index d9de11467..707fd9d14 100644 --- a/libpcap/etherent.c +++ b/libpcap/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/libpcap/ethertype.h b/libpcap/ethertype.h index 2d6bbebdd..8bab88163 100644 --- a/libpcap/ethertype.h +++ b/libpcap/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/libpcap/fad-getad.c b/libpcap/fad-getad.c index af371d46b..6fd3360f7 100644 --- a/libpcap/fad-getad.c +++ b/libpcap/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_sa_len(struct sockaddr *addr) * 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 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) * 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 @@ -178,35 +173,12 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) return (-1); } 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 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) 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/libpcap/fad-gifc.c b/libpcap/fad-gifc.c index d453518fd..b0a4105a8 100644 --- a/libpcap/fad-gifc.c +++ b/libpcap/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 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) /* * 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 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) 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 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) ret = -1; break; } - if (!(ifrflags.ifr_flags & IFF_UP)) - continue; /* * Get the netmask for this address on this interface. diff --git a/libpcap/fad-glifc.c b/libpcap/fad-glifc.c index b24b56441..1a820ad90 100644 --- a/libpcap/fad-glifc.c +++ b/libpcap/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 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) #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 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) ret = -1; break; } - if (!(ifrflags.lifr_flags & IFF_UP)) - continue; /* * Get the netmask for this address on this interface. diff --git a/libpcap/fad-null.c b/libpcap/fad-null.c index f6384fd55..cecfbcb46 100644 --- a/libpcap/fad-null.c +++ b/libpcap/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/libpcap/fad-sita.c b/libpcap/fad-sita.c index 76dcb2e77..34ddf1d85 100644 --- a/libpcap/fad-sita.c +++ b/libpcap/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/libpcap/fad-win32.c b/libpcap/fad-win32.c index 653669543..0c856b183 100644 --- a/libpcap/fad-win32.c +++ b/libpcap/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 @@ static const char rcsid[] _U_ = #include #include - -/* - * 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 @@ pcap_add_if_win32(pcap_if_t **devlist, char *name, const char *desc, */ 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 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) char *AdaptersName; ULONG NameLength; char *name; - + /* * Find out how big a buffer we need. * @@ -267,7 +170,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) { 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 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) free(AdaptersName); return (-1); } - + /* * "PacketGetAdapterNames()" returned a list of * null-terminated ASCII interface name strings, @@ -292,7 +195,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) 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 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) * after it. */ desc += 2; - + /* * Loop over the elements in the first list. */ @@ -328,7 +231,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) 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 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) devlist = NULL; } } - + *alldevsp = devlist; free(AdaptersName); return (ret); diff --git a/libpcap/gencode.c b/libpcap/gencode.c index 7bb07fb11..ad938d478 100644 --- a/libpcap/gencode.c +++ b/libpcap/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 @@ static const char rcsid[] _U_ = #define ETHERMTU 1500 +#ifndef ETHERTYPE_TEB +#define ETHERTYPE_TEB 0x6558 +#endif + #ifndef IPPROTO_HOPOPTS #define IPPROTO_HOPOPTS 0 #endif @@ -123,6 +123,8 @@ static const char rcsid[] _U_ = #define IPPROTO_SCTP 132 #endif +#define GENEVE_PORT 6081 + #ifdef HAVE_OS_PROTO_H #include "os-proto.h" #endif @@ -133,11 +135,11 @@ static const char rcsid[] _U_ = 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 */ @@ -166,18 +168,44 @@ static void free_reg(int); 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_mcmp(enum e_offrel, u_int, u_int, bpf_int32, 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_avs_llprefixlen(void); 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 slist *xfer_to_a(struct arth *); 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 @@ syntax() 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 @@ pcap_compile(pcap_t *p, struct bpf_program *program, 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 @@ pcap_compile(pcap_t *p, struct bpf_program *program, #endif lex_cleanup(); freechunks(); - return (-1); + rc = -1; + goto quit; } netmask = mask; @@ -463,7 +485,8 @@ pcap_compile(pcap_t *p, struct bpf_program *program, 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 @@ pcap_compile(pcap_t *p, struct bpf_program *program, lex_cleanup(); freechunks(); - return (0); + + rc = 0; /* We're all okay */ + +quit: + +#ifdef WIN32 + LeaveCriticalSection(&g_PcapCompileCriticalSection); +#endif + + return (rc); } /* @@ -592,7 +624,7 @@ finish_parse(p) * 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 @@ gen_ncmp(offrel, offset, size, mask, jtype, reverse, v) } /* - * 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 @@ static int reg_off_macpl; * * 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_pppoes = 0; 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 @@ static u_int off_payload; /* * 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; 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 @@ init_linktype(p) 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 @@ init_linktype(p) * 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 @@ init_linktype(p) * 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 @@ init_linktype(p) * 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 @@ init_linktype(p) * 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 @@ init_linktype(p) * 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 @@ init_linktype(p) 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 @@ init_linktype(p) * 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 @@ init_linktype(p) * 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 @@ init_linktype(p) * 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 @@ init_linktype(p) 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 @@ init_linktype(p) 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 @@ init_linktype(p) 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 @@ init_linktype(p) 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 @@ init_linktype(p) */ 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 @@ gen_load_a(offrel, offset, size) 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 @@ gen_load_a(offrel, offset, size) 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 @@ gen_load_a(offrel, offset, size) /* * 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 @@ gen_loadx_iphdrlen() * 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 @@ gen_loadx_iphdrlen() 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 @@ gen_ether_linktype(proto) * 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 @@ gen_ether_linktype(proto) * 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 @@ gen_ether_linktype(proto) * 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 @@ gen_ether_linktype(proto) * 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 @@ gen_ether_linktype(proto) * 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 @@ gen_ether_linktype(proto) * 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 @@ gen_ether_linktype(proto) * 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 @@ gen_ether_linktype(proto) * 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 @@ gen_ipnet_linktype(proto) 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 @@ gen_linux_sll_linktype(proto) * 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 @@ gen_linux_sll_linktype(proto) * 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 @@ gen_linux_sll_linktype(proto) * 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 @@ gen_linux_sll_linktype(proto) * 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 @@ gen_linux_sll_linktype(proto) * 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 @@ gen_linux_sll_linktype(proto) * 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 @@ gen_linux_sll_linktype(proto) * 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 @@ gen_load_prism_llprefixlen() * 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 @@ gen_load_prism_llprefixlen() * 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 @@ gen_load_avs_llprefixlen() * 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 @@ gen_load_avs_llprefixlen() * 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 @@ gen_load_radiotap_llprefixlen() * 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 @@ gen_load_radiotap_llprefixlen() * 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 @@ gen_load_radiotap_llprefixlen() 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 @@ static struct slist * 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 @@ gen_load_ppi_llprefixlen() * 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 @@ gen_load_802_11_header_len(struct slist *s, struct slist *snext) 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 @@ gen_load_802_11_header_len(struct slist *s, struct slist *snext) * 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 @@ gen_load_802_11_header_len(struct slist *s, struct slist *snext) * * 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 @@ gen_load_802_11_header_len(struct slist *s, struct slist *snext) 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 @@ gen_load_802_11_header_len(struct slist *s, struct slist *snext) 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 @@ gen_load_802_11_header_len(struct slist *s, struct slist *snext) 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 @@ gen_load_802_11_header_len(struct slist *s, struct slist *snext) * 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 @@ gen_load_802_11_header_len(struct slist *s, struct slist *snext) 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 @@ insert_compute_vloffsets(b) { 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 @@ insert_compute_vloffsets(b) /* * 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 @@ gen_ppi_dlt_check(void) 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; } @@ -2889,6 +2787,43 @@ ethertype_to_ppptype(proto) return (proto); } +/* + * 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 @@ gen_linktype(proto) 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 @@ gen_linktype(proto) 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 @@ gen_linktype(proto) } } - /* - * 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 @@ gen_linktype(proto) /* 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 @@ gen_linktype(proto) 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 @@ gen_linktype(proto) 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 @@ gen_linktype(proto) 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 @@ gen_linktype(proto) * 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 @@ gen_linktype(proto) * 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 @@ gen_linktype(proto) 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 @@ gen_linktype(proto) * 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 @@ gen_linktype(proto) 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 @@ gen_linktype(proto) /* * 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 @@ gen_linktype(proto) * 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 @@ gen_linktype(proto) * * 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 @@ gen_linktype(proto) 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 @@ gen_snap(orgcode, ptype) 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 @@ gen_llc_linktype(proto) /* * 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 @@ gen_llc_linktype(proto) * 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 @@ gen_llc_linktype(proto) * 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 @@ gen_llc_linktype(proto) * 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 @@ gen_hostop(addr, mask, dir, proto, src_off, dst_off) 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 @@ gen_hostop6(addr, mask, dir, proto, src_off, dst_off) /* 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 @@ gen_ehostop(eaddr, dir) 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 @@ gen_fhostop(eaddr, dir) 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 @@ gen_thostop(eaddr, dir) 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 @@ gen_wlanhostop(eaddr, dir) * * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) * 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 @@ gen_wlanhostop(eaddr, dir) * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) * * 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 @@ gen_wlanhostop(eaddr, dir) * * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) * 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 @@ gen_wlanhostop(eaddr, dir) * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) * * 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 @@ gen_wlanhostop(eaddr, dir) * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) * 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 @@ gen_wlanhostop(eaddr, dir) /* * 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 @@ gen_wlanhostop(eaddr, dir) * 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 @@ gen_ipfchostop(eaddr, dir) 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 @@ gen_dnhostop(addr, dir) } 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 @@ gen_mpls_linktype(proto) 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 @@ gen_gateway(eaddr, alist, proto, dir) 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 @@ gen_gateway(eaddr, alist, proto, dir) 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 @@ gen_ipfrag() 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 @@ gen_portop(port, proto, dir) 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 @@ gen_portop6(port, proto, dir) /* 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 @@ gen_portrangeatom(off, v1, v2) 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 @@ gen_portrangeop(port1, port2, proto, dir) 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 @@ gen_portrangeatom6(off, v1, v2) 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 @@ gen_portrangeop6(port1, port2, proto, dir) /* 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 @@ gen_protochain(v, proto, dir) * 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 @@ gen_protochain(v, proto, dir) /* 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 @@ gen_protochain(v, proto, dir) /* 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 @@ gen_protochain(v, proto, dir) */ /* 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 @@ gen_protochain(v, proto, dir) 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 @@ gen_protochain(v, proto, dir) 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 @@ gen_protochain(v, proto, dir) 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 @@ gen_check_802_11_data_frame() * 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 @@ gen_proto(v, proto, dir) */ 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 @@ gen_proto(v, proto, dir) * * 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 @@ gen_proto(v, proto, dir) */ 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 @@ gen_proto(v, proto, dir) * 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 @@ gen_proto(v, proto, dir) * 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 @@ gen_scode(name, q) 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 @@ gen_scode(name, q) 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 @@ gen_scode(name, q) 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 @@ gen_scode(name, q) 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 @@ gen_scode(name, q) 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 @@ gen_scode(name, q) 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 @@ gen_scode(name, q) 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 @@ gen_ncode(s, v, q) 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 @@ gen_ecode(eaddr, q) 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 @@ gen_ecode(eaddr, q) 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 @@ gen_load(proto, inst, size) * 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 @@ gen_load(proto, inst, size) * 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 @@ gen_load(proto, inst, size) * 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 @@ gen_load(proto, inst, size) /* * 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 @@ gen_load(proto, inst, size) 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 @@ gen_byteop(op, idx, val) 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 @@ gen_broadcast(proto) 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 @@ gen_broadcast(proto) 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 @@ gen_broadcast(proto) 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 @@ gen_mac_multicast(offset) 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 @@ gen_multicast(proto) 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 @@ gen_multicast(proto) * * 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 @@ gen_multicast(proto) * 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 @@ gen_multicast(proto) * 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 @@ gen_multicast(proto) * 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 @@ gen_multicast(proto) * * 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 @@ gen_multicast(proto) 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 @@ gen_multicast(proto) 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 @@ gen_inbound(dir) 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 @@ gen_inbound(dir) #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 @@ gen_inbound(dir) 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 @@ gen_inbound(dir) * 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 @@ gen_inbound(dir) /* 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 @@ gen_pf_ifname(const char *ifname) 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 @@ gen_pf_ruleset(char *ruleset) /* 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 @@ gen_pf_rnr(int rnr) /* 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 @@ gen_pf_srnr(int srnr) /* 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 @@ gen_pf_reason(int reason) /* 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 @@ gen_pf_action(int action) /* 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 @@ gen_p80211_type(int type, int mask) 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 @@ gen_p80211_fcdir(int fcdir) /* 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 @@ gen_ahostop(eaddr, dir) 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 @@ gen_ahostop(eaddr, dir) /* 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 @@ struct block * 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 @@ gen_vlan(vlan_num) * 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 @@ gen_vlan(vlan_num) /*NOTREACHED*/ } + vlan_stack_depth++; + return (b0); } @@ -7945,46 +8023,33 @@ struct block * 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 @@ gen_mpls(label_num) /* 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 @@ gen_pppoes(sess_num) */ 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 @@ gen_pppoes(sess_num) * 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 @@ gen_pppoes(sess_num) * 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 @@ gen_atmfield_code(atmfield, jvalue, jtype, reverse) 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 @@ gen_atmfield_code(atmfield, jvalue, jtype, reverse) 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 @@ gen_atmfield_code(atmfield, jvalue, jtype, reverse) 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 @@ gen_atmtype_abbrev(type) * 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 @@ gen_atmtype_abbrev(type) 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 @@ gen_atmtype_abbrev(type) return b1; } -/* +/* * Filtering for MTP2 messages based on li value * FISU, length is null * LSSU, length is 1 or 2 diff --git a/libpcap/gencode.h b/libpcap/gencode.h index afb69338f..67ed0dc07 100644 --- a/libpcap/gencode.h +++ b/libpcap/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 @@ void gen_not(struct block *); 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_broadcast(int); 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/libpcap/grammar.c b/libpcap/grammar.c index 77dd99dbe..f5aa791ca 100644 --- a/libpcap/grammar.c +++ b/libpcap/grammar.c @@ -93,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" @@ -131,6 +127,7 @@ struct rtentry; #include #include #endif +#include "llc.h" #include "ieee80211.h" #include @@ -205,6 +202,23 @@ static const struct tok ieee80211_data_subtypes[] = { { 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; @@ -311,7 +325,7 @@ pfaction_to_num(const char *action) } #endif /* HAVE_NET_PFVAR_H */ -#line 315 "y.tab.c" /* yacc.c:339 */ +#line 329 "y.tab.c" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -418,52 +432,53 @@ extern int pcap_debug; 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, - OR = 373, - AND = 374, - UMINUS = 375 + 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. */ @@ -539,59 +554,60 @@ extern int pcap_debug; #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 OR 373 -#define AND 374 -#define UMINUS 375 +#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 AND 375 +#define UMINUS 376 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 242 "grammar.y" /* yacc.c:355 */ +#line 256 "grammar.y" /* yacc.c:355 */ int i; bpf_u_int32 h; @@ -607,7 +623,7 @@ union YYSTYPE } blk; struct block *rblk; -#line 611 "y.tab.c" /* yacc.c:355 */ +#line 627 "y.tab.c" /* yacc.c:355 */ }; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -622,7 +638,7 @@ int pcap_parse (void); /* Copy the second part of user declarations. */ -#line 626 "y.tab.c" /* yacc.c:358 */ +#line 642 "y.tab.c" /* yacc.c:358 */ #ifdef short # undef short @@ -864,21 +880,21 @@ union yyalloc /* 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 +#define YYNRULES 220 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 285 +#define YYNSTATES 294 /* 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) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -890,16 +906,16 @@ 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, @@ -924,35 +940,36 @@ static const yytype_uint8 yytranslate[] = 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 /* 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 @@ -970,20 +987,21 @@ static const char *const yytname[] = "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", "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", "dir", "reason", "action", - "relop", "irelop", "arth", "narth", "byteop", "pnum", "atmtype", - "atmmultitype", "atmfield", "atmvalue", "atmfieldvalue", "atmlistvalue", - "mtp2type", "mtp3field", "mtp3value", "mtp3fieldvalue", "mtp3listvalue", YY_NULLPTR + "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 @@ -1004,15 +1022,15 @@ static const yytype_uint16 yytoknum[] = 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 -#define YYPACT_NINF -208 +#define YYPACT_NINF -216 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-208))) + (!!((Yystate) == (-216))) #define YYTABLE_NINF -42 @@ -1023,35 +1041,36 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - -208, 15, 226, -208, 1, 30, 32, -208, -208, -208, - -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, - -208, -208, -208, -208, -208, -208, -208, -208, -208, -31, - -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, -10, -1, -208, -208, -6, 21, - -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, 171, -208, -208, -208, - 570, -208, -208, -208, 570, 570, 570, 570, 570, 570, - 570, 570, -208, -208, -208, 570, 570, -208, 112, 123, - 128, -208, -208, -208, 129, 130, 131, -208, -208, -208, - -208, -208, -208, -208, 134, -1, 79, -208, 341, 341, - -208, 4, -208, -208, -208, -208, -208, 116, 142, 145, - -208, -208, 64, -42, -1, 179, 189, 191, 192, -208, - -208, 149, -208, -208, -208, -208, -208, -208, -51, -92, - -92, 99, 110, 33, 33, -208, -208, 79, 79, -208, - -101, -208, -208, -208, -98, -208, -208, -208, -64, -208, - -208, -208, -208, 19, 19, -208, -208, -208, -208, -8, - -208, 160, -208, 112, -208, 129, -208, -208, -208, -208, - -208, 65, -208, -208, -208 + -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 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -1061,53 +1080,54 @@ 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, 11, 10, - 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, 55, 57, 54, 56, 0, - 152, 0, 189, 0, 210, 0, 27, 28, 136, 137, - 130, 0, 192, 213, 153 + 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[] = { - -208, -208, -208, 196, -11, -207, -94, -122, 5, -2, - -208, -208, -82, -208, -208, -208, -208, 42, -208, 7, - -208, -208, -208, -208, -208, -208, -208, -208, -208, -48, - -40, -24, -75, -208, -36, -208, -208, -208, -208, -185, - -208, -208, -208, -208, -173, -208 + -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, 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 + -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 @@ -1115,161 +1135,175 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 93, 141, 217, 249, -13, 122, 123, 92, 124, 98, - 132, 26, -41, 174, 175, 3, 264, 128, 134, 116, - 128, 253, 221, 229, 234, 128, 129, 272, 112, 278, - 274, 178, 179, 180, 181, 214, 207, 212, 109, 121, - 121, 117, 121, 273, 113, 230, 235, 275, 210, 213, - 134, 279, 199, 200, -29, -29, 26, 135, 189, 145, - 195, 201, 202, 203, 216, 127, 190, 110, 196, 111, - 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, 215, 121, - 218, 119, -13, -13, 227, 228, 132, 216, 209, 209, - -41, -41, -13, 232, 134, 208, 208, 98, 98, 88, - -41, 144, 121, 174, 175, 170, 238, 219, 90, 187, - 239, 240, 241, 242, 243, 244, 245, 246, 180, 181, - 251, 247, 248, 174, 175, 252, 193, 255, 256, 276, - 277, 257, 211, 258, 174, 175, 148, 259, 150, 260, - 151, 152, 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, 237, 171, - 172, 173, 263, 208, 208, 98, 98, 174, 175, 0, - 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, + 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, 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, 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, 155, 156, 0, 89, 0, 0, 0, 0, 90, - 0, 0, 157, 158, 159, 160, 161, 162, 163, 164, - 165 + 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, 95, 8, 188, 0, 41, 42, 2, 44, 2, - 92, 37, 0, 64, 65, 0, 223, 118, 93, 37, - 118, 194, 144, 37, 37, 118, 119, 128, 59, 37, - 128, 123, 124, 125, 126, 128, 130, 131, 37, 41, - 42, 59, 44, 250, 59, 59, 59, 254, 130, 131, - 125, 59, 121, 122, 118, 119, 37, 93, 106, 95, - 108, 130, 131, 132, 128, 89, 106, 37, 108, 37, - 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, 128, 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, 126, 129, 37, - 174, 175, 176, 177, 178, 179, 180, 181, 125, 126, - 37, 185, 186, 64, 65, 37, 37, 37, 37, 263, - 264, 37, 208, 209, 64, 65, 5, 61, 7, 37, - 9, 10, 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, 166, 56, - 57, 58, 223, 208, 209, 208, 209, 64, 65, -1, - -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, + 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, -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, 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, 35, 36, -1, 124, -1, -1, -1, -1, 129, - -1, -1, 46, 47, 48, 49, 50, 51, 52, 53, - 54 + -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, 137, 138, 0, 11, 12, 15, 16, 17, 18, + 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, @@ -1277,54 +1311,56 @@ static const yytype_uint8 yystos[] = 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 + 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, 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 + 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. */ @@ -1342,16 +1378,17 @@ static const yytype_uint8 yyr2[] = 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 }; @@ -2028,90 +2065,90 @@ yyreduce: switch (yyn) { case 2: -#line 317 "grammar.y" /* yacc.c:1646 */ +#line 331 "grammar.y" /* yacc.c:1646 */ { finish_parse((yyvsp[0].blk).b); } -#line 2036 "y.tab.c" /* yacc.c:1646 */ +#line 2073 "y.tab.c" /* yacc.c:1646 */ break; case 4: -#line 322 "grammar.y" /* yacc.c:1646 */ +#line 336 "grammar.y" /* yacc.c:1646 */ { (yyval.blk).q = qerr; } -#line 2042 "y.tab.c" /* yacc.c:1646 */ +#line 2079 "y.tab.c" /* yacc.c:1646 */ break; case 6: -#line 325 "grammar.y" /* yacc.c:1646 */ +#line 339 "grammar.y" /* yacc.c:1646 */ { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); } -#line 2048 "y.tab.c" /* yacc.c:1646 */ - break; - - case 7: -#line 326 "grammar.y" /* yacc.c:1646 */ - { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); } -#line 2054 "y.tab.c" /* yacc.c:1646 */ - break; - - case 8: -#line 327 "grammar.y" /* yacc.c:1646 */ - { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); } -#line 2060 "y.tab.c" /* yacc.c:1646 */ - break; - - case 9: -#line 328 "grammar.y" /* yacc.c:1646 */ - { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); } -#line 2066 "y.tab.c" /* yacc.c:1646 */ - break; - - case 10: -#line 330 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk) = (yyvsp[-1].blk); } -#line 2072 "y.tab.c" /* yacc.c:1646 */ - break; - - case 11: -#line 332 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk) = (yyvsp[-1].blk); } -#line 2078 "y.tab.c" /* yacc.c:1646 */ - break; - - case 13: -#line 335 "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 2085 "y.tab.c" /* yacc.c:1646 */ break; - case 14: -#line 337 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk) = (yyvsp[-1].blk); } + case 7: +#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 15: -#line 339 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).b = gen_scode((yyvsp[0].s), (yyval.blk).q = (yyvsp[-1].blk).q); } + case 8: +#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 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 344 "grammar.y" /* yacc.c:1646 */ + { (yyval.blk) = (yyvsp[-1].blk); } +#line 2109 "y.tab.c" /* yacc.c:1646 */ + break; + + case 11: +#line 346 "grammar.y" /* yacc.c:1646 */ + { (yyval.blk) = (yyvsp[-1].blk); } +#line 2115 "y.tab.c" /* yacc.c:1646 */ + break; + + case 13: +#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 351 "grammar.y" /* yacc.c:1646 */ + { (yyval.blk) = (yyvsp[-1].blk); } +#line 2128 "y.tab.c" /* yacc.c:1646 */ + break; + + case 15: +#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 340 "grammar.y" /* yacc.c:1646 */ +#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 2104 "y.tab.c" /* yacc.c:1646 */ +#line 2141 "y.tab.c" /* yacc.c:1646 */ break; case 17: -#line 342 "grammar.y" /* yacc.c:1646 */ +#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 2111 "y.tab.c" /* yacc.c:1646 */ +#line 2148 "y.tab.c" /* yacc.c:1646 */ break; case 18: -#line 344 "grammar.y" /* yacc.c:1646 */ +#line 358 "grammar.y" /* yacc.c:1646 */ { /* Decide how to parse HID based on proto */ (yyval.blk).q = (yyvsp[-1].blk).q; @@ -2125,11 +2162,11 @@ yyreduce: bpf_error("'protochain' modifier applied to ip host"); (yyval.blk).b = gen_ncode((yyvsp[0].s), 0, (yyval.blk).q); } -#line 2129 "y.tab.c" /* yacc.c:1646 */ +#line 2166 "y.tab.c" /* yacc.c:1646 */ break; case 19: -#line 357 "grammar.y" /* yacc.c:1646 */ +#line 371 "grammar.y" /* yacc.c:1646 */ { #ifdef INET6 (yyval.blk).b = gen_mcode6((yyvsp[-2].s), NULL, (yyvsp[0].i), @@ -2139,11 +2176,11 @@ yyreduce: "in this configuration"); #endif /*INET6*/ } -#line 2143 "y.tab.c" /* yacc.c:1646 */ +#line 2180 "y.tab.c" /* yacc.c:1646 */ break; case 20: -#line 366 "grammar.y" /* yacc.c:1646 */ +#line 380 "grammar.y" /* yacc.c:1646 */ { #ifdef INET6 (yyval.blk).b = gen_mcode6((yyvsp[0].s), 0, 128, @@ -2153,12 +2190,12 @@ yyreduce: "in this configuration"); #endif /*INET6*/ } -#line 2157 "y.tab.c" /* yacc.c:1646 */ +#line 2194 "y.tab.c" /* yacc.c:1646 */ break; case 21: -#line 375 "grammar.y" /* yacc.c:1646 */ - { +#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()", @@ -2167,11 +2204,11 @@ yyreduce: */ free((yyvsp[0].e)); } -#line 2171 "y.tab.c" /* yacc.c:1646 */ +#line 2208 "y.tab.c" /* yacc.c:1646 */ break; case 22: -#line 384 "grammar.y" /* yacc.c:1646 */ +#line 398 "grammar.y" /* yacc.c:1646 */ { (yyval.blk).b = gen_acode((yyvsp[0].e), (yyval.blk).q = (yyvsp[-1].blk).q); /* @@ -2181,673 +2218,691 @@ yyreduce: */ free((yyvsp[0].e)); } -#line 2185 "y.tab.c" /* yacc.c:1646 */ - break; - - case 23: -#line 393 "grammar.y" /* yacc.c:1646 */ - { gen_not((yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); } -#line 2191 "y.tab.c" /* yacc.c:1646 */ - break; - - case 24: -#line 395 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk) = (yyvsp[-1].blk); } -#line 2197 "y.tab.c" /* yacc.c:1646 */ - break; - - case 25: -#line 397 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk) = (yyvsp[-1].blk); } -#line 2203 "y.tab.c" /* yacc.c:1646 */ - break; - - case 27: -#line 400 "grammar.y" /* yacc.c:1646 */ - { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); } -#line 2209 "y.tab.c" /* yacc.c:1646 */ - break; - - case 28: -#line 401 "grammar.y" /* yacc.c:1646 */ - { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); } -#line 2215 "y.tab.c" /* yacc.c:1646 */ - break; - - case 29: -#line 403 "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 2222 "y.tab.c" /* yacc.c:1646 */ break; - case 32: -#line 408 "grammar.y" /* yacc.c:1646 */ + case 23: +#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 33: -#line 410 "grammar.y" /* yacc.c:1646 */ - { QSET((yyval.blk).q, (yyvsp[-2].i), (yyvsp[-1].i), (yyvsp[0].i)); } + case 24: +#line 409 "grammar.y" /* yacc.c:1646 */ + { (yyval.blk) = (yyvsp[-1].blk); } #line 2234 "y.tab.c" /* yacc.c:1646 */ break; - case 34: + case 25: #line 411 "grammar.y" /* yacc.c:1646 */ - { QSET((yyval.blk).q, (yyvsp[-1].i), (yyvsp[0].i), Q_DEFAULT); } + { (yyval.blk) = (yyvsp[-1].blk); } #line 2240 "y.tab.c" /* yacc.c:1646 */ break; - case 35: -#line 412 "grammar.y" /* yacc.c:1646 */ - { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, (yyvsp[0].i)); } + case 27: +#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 36: -#line 413 "grammar.y" /* yacc.c:1646 */ - { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, Q_PROTO); } + case 28: +#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 37: -#line 414 "grammar.y" /* yacc.c:1646 */ - { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, Q_PROTOCHAIN); } -#line 2258 "y.tab.c" /* yacc.c:1646 */ - break; - - case 38: -#line 415 "grammar.y" /* yacc.c:1646 */ - { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, (yyvsp[0].i)); } -#line 2264 "y.tab.c" /* yacc.c:1646 */ - break; - - case 39: + case 29: #line 417 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk) = (yyvsp[0].blk); } -#line 2270 "y.tab.c" /* 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 40: -#line 418 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = (yyvsp[-2].blk).q; } -#line 2276 "y.tab.c" /* yacc.c:1646 */ + case 32: +#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 41: -#line 419 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).b = gen_proto_abbrev((yyvsp[0].i)); (yyval.blk).q = qerr; } -#line 2282 "y.tab.c" /* yacc.c:1646 */ + case 33: +#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 42: -#line 420 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).b = gen_relation((yyvsp[-1].i), (yyvsp[-2].a), (yyvsp[0].a), 0); - (yyval.blk).q = qerr; } + case 34: +#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 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 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 43: -#line 422 "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 2296 "y.tab.c" /* yacc.c:1646 */ - break; - - case 44: -#line 424 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).b = (yyvsp[0].rblk); (yyval.blk).q = qerr; } -#line 2302 "y.tab.c" /* yacc.c:1646 */ - break; - - case 45: -#line 425 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).b = gen_atmtype_abbrev((yyvsp[0].i)); (yyval.blk).q = qerr; } -#line 2308 "y.tab.c" /* yacc.c:1646 */ - break; - - case 46: -#line 426 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).b = gen_atmmulti_abbrev((yyvsp[0].i)); (yyval.blk).q = qerr; } -#line 2314 "y.tab.c" /* yacc.c:1646 */ - break; - - case 47: -#line 427 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).b = (yyvsp[0].blk).b; (yyval.blk).q = qerr; } -#line 2320 "y.tab.c" /* yacc.c:1646 */ - break; - - case 48: + case 37: #line 428 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).b = gen_mtp2type_abbrev((yyvsp[0].i)); (yyval.blk).q = qerr; } + { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, Q_PROTOCHAIN); } +#line 2295 "y.tab.c" /* yacc.c:1646 */ + break; + + case 38: +#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 431 "grammar.y" /* yacc.c:1646 */ + { (yyval.blk) = (yyvsp[0].blk); } +#line 2307 "y.tab.c" /* yacc.c:1646 */ + break; + + case 40: +#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 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 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 49: -#line 429 "grammar.y" /* yacc.c:1646 */ + case 43: +#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 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 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 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 441 "grammar.y" /* yacc.c:1646 */ { (yyval.blk).b = (yyvsp[0].blk).b; (yyval.blk).q = qerr; } -#line 2332 "y.tab.c" /* yacc.c:1646 */ +#line 2357 "y.tab.c" /* yacc.c:1646 */ + break; + + case 48: +#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 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 433 "grammar.y" /* yacc.c:1646 */ +#line 447 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_DEFAULT; } -#line 2338 "y.tab.c" /* yacc.c:1646 */ +#line 2375 "y.tab.c" /* yacc.c:1646 */ break; case 52: -#line 436 "grammar.y" /* yacc.c:1646 */ +#line 450 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_SRC; } -#line 2344 "y.tab.c" /* yacc.c:1646 */ +#line 2381 "y.tab.c" /* yacc.c:1646 */ break; case 53: -#line 437 "grammar.y" /* yacc.c:1646 */ +#line 451 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_DST; } -#line 2350 "y.tab.c" /* yacc.c:1646 */ +#line 2387 "y.tab.c" /* yacc.c:1646 */ break; case 54: -#line 438 "grammar.y" /* yacc.c:1646 */ +#line 452 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_OR; } -#line 2356 "y.tab.c" /* yacc.c:1646 */ +#line 2393 "y.tab.c" /* yacc.c:1646 */ break; case 55: -#line 439 "grammar.y" /* yacc.c:1646 */ +#line 453 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_OR; } -#line 2362 "y.tab.c" /* yacc.c:1646 */ +#line 2399 "y.tab.c" /* yacc.c:1646 */ break; case 56: -#line 440 "grammar.y" /* yacc.c:1646 */ +#line 454 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_AND; } -#line 2368 "y.tab.c" /* yacc.c:1646 */ +#line 2405 "y.tab.c" /* yacc.c:1646 */ break; case 57: -#line 441 "grammar.y" /* yacc.c:1646 */ +#line 455 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_AND; } -#line 2374 "y.tab.c" /* yacc.c:1646 */ +#line 2411 "y.tab.c" /* yacc.c:1646 */ break; case 58: -#line 442 "grammar.y" /* yacc.c:1646 */ +#line 456 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ADDR1; } -#line 2380 "y.tab.c" /* yacc.c:1646 */ +#line 2417 "y.tab.c" /* yacc.c:1646 */ break; case 59: -#line 443 "grammar.y" /* yacc.c:1646 */ +#line 457 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ADDR2; } -#line 2386 "y.tab.c" /* yacc.c:1646 */ +#line 2423 "y.tab.c" /* yacc.c:1646 */ break; case 60: -#line 444 "grammar.y" /* yacc.c:1646 */ +#line 458 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ADDR3; } -#line 2392 "y.tab.c" /* yacc.c:1646 */ +#line 2429 "y.tab.c" /* yacc.c:1646 */ break; case 61: -#line 445 "grammar.y" /* yacc.c:1646 */ +#line 459 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ADDR4; } -#line 2398 "y.tab.c" /* yacc.c:1646 */ +#line 2435 "y.tab.c" /* yacc.c:1646 */ break; case 62: -#line 446 "grammar.y" /* yacc.c:1646 */ +#line 460 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_RA; } -#line 2404 "y.tab.c" /* yacc.c:1646 */ +#line 2441 "y.tab.c" /* yacc.c:1646 */ break; case 63: -#line 447 "grammar.y" /* yacc.c:1646 */ +#line 461 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_TA; } -#line 2410 "y.tab.c" /* yacc.c:1646 */ +#line 2447 "y.tab.c" /* yacc.c:1646 */ break; case 64: -#line 450 "grammar.y" /* yacc.c:1646 */ +#line 464 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_HOST; } -#line 2416 "y.tab.c" /* yacc.c:1646 */ +#line 2453 "y.tab.c" /* yacc.c:1646 */ break; case 65: -#line 451 "grammar.y" /* yacc.c:1646 */ +#line 465 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_NET; } -#line 2422 "y.tab.c" /* yacc.c:1646 */ +#line 2459 "y.tab.c" /* yacc.c:1646 */ break; case 66: -#line 452 "grammar.y" /* yacc.c:1646 */ +#line 466 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_PORT; } -#line 2428 "y.tab.c" /* yacc.c:1646 */ +#line 2465 "y.tab.c" /* yacc.c:1646 */ break; case 67: -#line 453 "grammar.y" /* yacc.c:1646 */ +#line 467 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_PORTRANGE; } -#line 2434 "y.tab.c" /* yacc.c:1646 */ +#line 2471 "y.tab.c" /* yacc.c:1646 */ break; case 68: -#line 456 "grammar.y" /* yacc.c:1646 */ +#line 470 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_GATEWAY; } -#line 2440 "y.tab.c" /* yacc.c:1646 */ +#line 2477 "y.tab.c" /* yacc.c:1646 */ break; case 69: -#line 458 "grammar.y" /* yacc.c:1646 */ +#line 472 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_LINK; } -#line 2446 "y.tab.c" /* yacc.c:1646 */ +#line 2483 "y.tab.c" /* yacc.c:1646 */ break; case 70: -#line 459 "grammar.y" /* yacc.c:1646 */ +#line 473 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_IP; } -#line 2452 "y.tab.c" /* yacc.c:1646 */ +#line 2489 "y.tab.c" /* yacc.c:1646 */ break; case 71: -#line 460 "grammar.y" /* yacc.c:1646 */ +#line 474 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ARP; } -#line 2458 "y.tab.c" /* yacc.c:1646 */ +#line 2495 "y.tab.c" /* yacc.c:1646 */ break; case 72: -#line 461 "grammar.y" /* yacc.c:1646 */ +#line 475 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_RARP; } -#line 2464 "y.tab.c" /* yacc.c:1646 */ +#line 2501 "y.tab.c" /* yacc.c:1646 */ break; case 73: -#line 462 "grammar.y" /* yacc.c:1646 */ +#line 476 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_SCTP; } -#line 2470 "y.tab.c" /* yacc.c:1646 */ +#line 2507 "y.tab.c" /* yacc.c:1646 */ break; case 74: -#line 463 "grammar.y" /* yacc.c:1646 */ +#line 477 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_TCP; } -#line 2476 "y.tab.c" /* yacc.c:1646 */ +#line 2513 "y.tab.c" /* yacc.c:1646 */ break; case 75: -#line 464 "grammar.y" /* yacc.c:1646 */ +#line 478 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_UDP; } -#line 2482 "y.tab.c" /* yacc.c:1646 */ +#line 2519 "y.tab.c" /* yacc.c:1646 */ break; case 76: -#line 465 "grammar.y" /* yacc.c:1646 */ +#line 479 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ICMP; } -#line 2488 "y.tab.c" /* yacc.c:1646 */ +#line 2525 "y.tab.c" /* yacc.c:1646 */ break; case 77: -#line 466 "grammar.y" /* yacc.c:1646 */ +#line 480 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_IGMP; } -#line 2494 "y.tab.c" /* yacc.c:1646 */ +#line 2531 "y.tab.c" /* yacc.c:1646 */ break; case 78: -#line 467 "grammar.y" /* yacc.c:1646 */ +#line 481 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_IGRP; } -#line 2500 "y.tab.c" /* yacc.c:1646 */ +#line 2537 "y.tab.c" /* yacc.c:1646 */ break; case 79: -#line 468 "grammar.y" /* yacc.c:1646 */ +#line 482 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_PIM; } -#line 2506 "y.tab.c" /* yacc.c:1646 */ +#line 2543 "y.tab.c" /* yacc.c:1646 */ break; case 80: -#line 469 "grammar.y" /* yacc.c:1646 */ +#line 483 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_VRRP; } -#line 2512 "y.tab.c" /* yacc.c:1646 */ +#line 2549 "y.tab.c" /* yacc.c:1646 */ break; case 81: -#line 470 "grammar.y" /* yacc.c:1646 */ +#line 484 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_CARP; } -#line 2518 "y.tab.c" /* yacc.c:1646 */ +#line 2555 "y.tab.c" /* yacc.c:1646 */ break; case 82: -#line 471 "grammar.y" /* yacc.c:1646 */ +#line 485 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ATALK; } -#line 2524 "y.tab.c" /* yacc.c:1646 */ +#line 2561 "y.tab.c" /* yacc.c:1646 */ break; case 83: -#line 472 "grammar.y" /* yacc.c:1646 */ +#line 486 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_AARP; } -#line 2530 "y.tab.c" /* yacc.c:1646 */ +#line 2567 "y.tab.c" /* yacc.c:1646 */ break; case 84: -#line 473 "grammar.y" /* yacc.c:1646 */ +#line 487 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_DECNET; } -#line 2536 "y.tab.c" /* yacc.c:1646 */ +#line 2573 "y.tab.c" /* yacc.c:1646 */ break; case 85: -#line 474 "grammar.y" /* yacc.c:1646 */ +#line 488 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_LAT; } -#line 2542 "y.tab.c" /* yacc.c:1646 */ +#line 2579 "y.tab.c" /* yacc.c:1646 */ break; case 86: -#line 475 "grammar.y" /* yacc.c:1646 */ +#line 489 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_SCA; } -#line 2548 "y.tab.c" /* yacc.c:1646 */ +#line 2585 "y.tab.c" /* yacc.c:1646 */ break; case 87: -#line 476 "grammar.y" /* yacc.c:1646 */ +#line 490 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_MOPDL; } -#line 2554 "y.tab.c" /* yacc.c:1646 */ +#line 2591 "y.tab.c" /* yacc.c:1646 */ break; case 88: -#line 477 "grammar.y" /* yacc.c:1646 */ +#line 491 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_MOPRC; } -#line 2560 "y.tab.c" /* yacc.c:1646 */ +#line 2597 "y.tab.c" /* yacc.c:1646 */ break; case 89: -#line 478 "grammar.y" /* yacc.c:1646 */ +#line 492 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_IPV6; } -#line 2566 "y.tab.c" /* yacc.c:1646 */ +#line 2603 "y.tab.c" /* yacc.c:1646 */ break; case 90: -#line 479 "grammar.y" /* yacc.c:1646 */ +#line 493 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ICMPV6; } -#line 2572 "y.tab.c" /* yacc.c:1646 */ +#line 2609 "y.tab.c" /* yacc.c:1646 */ break; case 91: -#line 480 "grammar.y" /* yacc.c:1646 */ +#line 494 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_AH; } -#line 2578 "y.tab.c" /* yacc.c:1646 */ +#line 2615 "y.tab.c" /* yacc.c:1646 */ break; case 92: -#line 481 "grammar.y" /* yacc.c:1646 */ +#line 495 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ESP; } -#line 2584 "y.tab.c" /* yacc.c:1646 */ +#line 2621 "y.tab.c" /* yacc.c:1646 */ break; case 93: -#line 482 "grammar.y" /* yacc.c:1646 */ +#line 496 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ISO; } -#line 2590 "y.tab.c" /* yacc.c:1646 */ +#line 2627 "y.tab.c" /* yacc.c:1646 */ break; case 94: -#line 483 "grammar.y" /* yacc.c:1646 */ +#line 497 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ESIS; } -#line 2596 "y.tab.c" /* yacc.c:1646 */ +#line 2633 "y.tab.c" /* yacc.c:1646 */ break; case 95: -#line 484 "grammar.y" /* yacc.c:1646 */ +#line 498 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ISIS; } -#line 2602 "y.tab.c" /* yacc.c:1646 */ +#line 2639 "y.tab.c" /* yacc.c:1646 */ break; case 96: -#line 485 "grammar.y" /* yacc.c:1646 */ +#line 499 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ISIS_L1; } -#line 2608 "y.tab.c" /* yacc.c:1646 */ +#line 2645 "y.tab.c" /* yacc.c:1646 */ break; case 97: -#line 486 "grammar.y" /* yacc.c:1646 */ +#line 500 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ISIS_L2; } -#line 2614 "y.tab.c" /* yacc.c:1646 */ +#line 2651 "y.tab.c" /* yacc.c:1646 */ break; case 98: -#line 487 "grammar.y" /* yacc.c:1646 */ +#line 501 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ISIS_IIH; } -#line 2620 "y.tab.c" /* yacc.c:1646 */ +#line 2657 "y.tab.c" /* yacc.c:1646 */ break; case 99: -#line 488 "grammar.y" /* yacc.c:1646 */ +#line 502 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ISIS_LSP; } -#line 2626 "y.tab.c" /* yacc.c:1646 */ +#line 2663 "y.tab.c" /* yacc.c:1646 */ break; case 100: -#line 489 "grammar.y" /* yacc.c:1646 */ +#line 503 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ISIS_SNP; } -#line 2632 "y.tab.c" /* yacc.c:1646 */ +#line 2669 "y.tab.c" /* yacc.c:1646 */ break; case 101: -#line 490 "grammar.y" /* yacc.c:1646 */ +#line 504 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ISIS_PSNP; } -#line 2638 "y.tab.c" /* yacc.c:1646 */ +#line 2675 "y.tab.c" /* yacc.c:1646 */ break; case 102: -#line 491 "grammar.y" /* yacc.c:1646 */ +#line 505 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_ISIS_CSNP; } -#line 2644 "y.tab.c" /* yacc.c:1646 */ +#line 2681 "y.tab.c" /* yacc.c:1646 */ break; case 103: -#line 492 "grammar.y" /* yacc.c:1646 */ +#line 506 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_CLNP; } -#line 2650 "y.tab.c" /* yacc.c:1646 */ +#line 2687 "y.tab.c" /* yacc.c:1646 */ break; case 104: -#line 493 "grammar.y" /* yacc.c:1646 */ +#line 507 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_STP; } -#line 2656 "y.tab.c" /* yacc.c:1646 */ +#line 2693 "y.tab.c" /* yacc.c:1646 */ break; case 105: -#line 494 "grammar.y" /* yacc.c:1646 */ +#line 508 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_IPX; } -#line 2662 "y.tab.c" /* yacc.c:1646 */ +#line 2699 "y.tab.c" /* yacc.c:1646 */ break; case 106: -#line 495 "grammar.y" /* yacc.c:1646 */ +#line 509 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_NETBEUI; } -#line 2668 "y.tab.c" /* yacc.c:1646 */ +#line 2705 "y.tab.c" /* yacc.c:1646 */ break; case 107: -#line 496 "grammar.y" /* yacc.c:1646 */ +#line 510 "grammar.y" /* yacc.c:1646 */ { (yyval.i) = Q_RADIO; } -#line 2674 "y.tab.c" /* yacc.c:1646 */ +#line 2711 "y.tab.c" /* yacc.c:1646 */ break; case 108: -#line 498 "grammar.y" /* yacc.c:1646 */ +#line 512 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_broadcast((yyvsp[-1].i)); } -#line 2680 "y.tab.c" /* yacc.c:1646 */ +#line 2717 "y.tab.c" /* yacc.c:1646 */ break; case 109: -#line 499 "grammar.y" /* yacc.c:1646 */ +#line 513 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_multicast((yyvsp[-1].i)); } -#line 2686 "y.tab.c" /* yacc.c:1646 */ +#line 2723 "y.tab.c" /* yacc.c:1646 */ break; case 110: -#line 500 "grammar.y" /* yacc.c:1646 */ +#line 514 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_less((yyvsp[0].i)); } -#line 2692 "y.tab.c" /* yacc.c:1646 */ +#line 2729 "y.tab.c" /* yacc.c:1646 */ break; case 111: -#line 501 "grammar.y" /* yacc.c:1646 */ +#line 515 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_greater((yyvsp[0].i)); } -#line 2698 "y.tab.c" /* yacc.c:1646 */ +#line 2735 "y.tab.c" /* yacc.c:1646 */ break; case 112: -#line 502 "grammar.y" /* yacc.c:1646 */ +#line 516 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_byteop((yyvsp[-1].i), (yyvsp[-2].i), (yyvsp[0].i)); } -#line 2704 "y.tab.c" /* yacc.c:1646 */ +#line 2741 "y.tab.c" /* yacc.c:1646 */ break; case 113: -#line 503 "grammar.y" /* yacc.c:1646 */ +#line 517 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_inbound(0); } -#line 2710 "y.tab.c" /* yacc.c:1646 */ +#line 2747 "y.tab.c" /* yacc.c:1646 */ break; case 114: -#line 504 "grammar.y" /* yacc.c:1646 */ +#line 518 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_inbound(1); } -#line 2716 "y.tab.c" /* yacc.c:1646 */ +#line 2753 "y.tab.c" /* yacc.c:1646 */ break; case 115: -#line 505 "grammar.y" /* yacc.c:1646 */ +#line 519 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_vlan((yyvsp[0].i)); } -#line 2722 "y.tab.c" /* yacc.c:1646 */ +#line 2759 "y.tab.c" /* yacc.c:1646 */ break; case 116: -#line 506 "grammar.y" /* yacc.c:1646 */ +#line 520 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_vlan(-1); } -#line 2728 "y.tab.c" /* yacc.c:1646 */ +#line 2765 "y.tab.c" /* yacc.c:1646 */ break; case 117: -#line 507 "grammar.y" /* yacc.c:1646 */ +#line 521 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_mpls((yyvsp[0].i)); } -#line 2734 "y.tab.c" /* yacc.c:1646 */ +#line 2771 "y.tab.c" /* yacc.c:1646 */ break; case 118: -#line 508 "grammar.y" /* yacc.c:1646 */ +#line 522 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_mpls(-1); } -#line 2740 "y.tab.c" /* yacc.c:1646 */ +#line 2777 "y.tab.c" /* yacc.c:1646 */ break; case 119: -#line 509 "grammar.y" /* yacc.c:1646 */ +#line 523 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_pppoed(); } -#line 2746 "y.tab.c" /* yacc.c:1646 */ +#line 2783 "y.tab.c" /* yacc.c:1646 */ break; case 120: -#line 510 "grammar.y" /* yacc.c:1646 */ +#line 524 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_pppoes((yyvsp[0].i)); } -#line 2752 "y.tab.c" /* yacc.c:1646 */ +#line 2789 "y.tab.c" /* yacc.c:1646 */ break; case 121: -#line 511 "grammar.y" /* yacc.c:1646 */ +#line 525 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_pppoes(-1); } -#line 2758 "y.tab.c" /* yacc.c:1646 */ +#line 2795 "y.tab.c" /* yacc.c:1646 */ break; case 122: -#line 512 "grammar.y" /* yacc.c:1646 */ - { (yyval.rblk) = (yyvsp[0].rblk); } -#line 2764 "y.tab.c" /* yacc.c:1646 */ +#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 513 "grammar.y" /* yacc.c:1646 */ - { (yyval.rblk) = (yyvsp[0].rblk); } -#line 2770 "y.tab.c" /* yacc.c:1646 */ +#line 527 "grammar.y" /* yacc.c:1646 */ + { (yyval.rblk) = gen_geneve(-1); } +#line 2807 "y.tab.c" /* yacc.c:1646 */ break; case 124: -#line 516 "grammar.y" /* yacc.c:1646 */ - { (yyval.rblk) = gen_pf_ifname((yyvsp[0].s)); } -#line 2776 "y.tab.c" /* yacc.c:1646 */ +#line 528 "grammar.y" /* yacc.c:1646 */ + { (yyval.rblk) = (yyvsp[0].rblk); } +#line 2813 "y.tab.c" /* yacc.c:1646 */ break; case 125: -#line 517 "grammar.y" /* yacc.c:1646 */ - { (yyval.rblk) = gen_pf_ruleset((yyvsp[0].s)); } -#line 2782 "y.tab.c" /* yacc.c:1646 */ +#line 529 "grammar.y" /* yacc.c:1646 */ + { (yyval.rblk) = (yyvsp[0].rblk); } +#line 2819 "y.tab.c" /* yacc.c:1646 */ break; case 126: -#line 518 "grammar.y" /* yacc.c:1646 */ - { (yyval.rblk) = gen_pf_rnr((yyvsp[0].i)); } -#line 2788 "y.tab.c" /* yacc.c:1646 */ +#line 530 "grammar.y" /* yacc.c:1646 */ + { (yyval.rblk) = (yyvsp[0].rblk); } +#line 2825 "y.tab.c" /* yacc.c:1646 */ break; case 127: -#line 519 "grammar.y" /* yacc.c:1646 */ - { (yyval.rblk) = gen_pf_srnr((yyvsp[0].i)); } -#line 2794 "y.tab.c" /* yacc.c:1646 */ +#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 520 "grammar.y" /* yacc.c:1646 */ - { (yyval.rblk) = gen_pf_reason((yyvsp[0].i)); } -#line 2800 "y.tab.c" /* yacc.c:1646 */ +#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 521 "grammar.y" /* yacc.c:1646 */ - { (yyval.rblk) = gen_pf_action((yyvsp[0].i)); } -#line 2806 "y.tab.c" /* yacc.c:1646 */ +#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 525 "grammar.y" /* yacc.c:1646 */ +#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 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 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 2815 "y.tab.c" /* yacc.c:1646 */ +#line 2870 "y.tab.c" /* yacc.c:1646 */ break; - case 131: -#line 529 "grammar.y" /* yacc.c:1646 */ + case 134: +#line 546 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_p80211_type((yyvsp[0].i), IEEE80211_FC0_TYPE_MASK); } -#line 2823 "y.tab.c" /* yacc.c:1646 */ +#line 2878 "y.tab.c" /* yacc.c:1646 */ break; - case 132: -#line 532 "grammar.y" /* yacc.c:1646 */ + 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 2832 "y.tab.c" /* yacc.c:1646 */ +#line 2887 "y.tab.c" /* yacc.c:1646 */ break; - case 133: -#line 536 "grammar.y" /* yacc.c:1646 */ + case 136: +#line 553 "grammar.y" /* yacc.c:1646 */ { (yyval.rblk) = gen_p80211_fcdir((yyvsp[0].i)); } -#line 2838 "y.tab.c" /* yacc.c:1646 */ +#line 2893 "y.tab.c" /* yacc.c:1646 */ break; - case 135: -#line 540 "grammar.y" /* yacc.c:1646 */ + 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 2847 "y.tab.c" /* yacc.c:1646 */ +#line 2902 "y.tab.c" /* yacc.c:1646 */ break; - case 137: -#line 547 "grammar.y" /* yacc.c:1646 */ + case 140: +#line 564 "grammar.y" /* yacc.c:1646 */ { const struct tok *types = NULL; int i; for (i = 0;; i++) { @@ -2866,11 +2921,11 @@ yyreduce: if ((yyval.i) == -1) bpf_error("unknown 802.11 subtype name"); } -#line 2870 "y.tab.c" /* yacc.c:1646 */ +#line 2925 "y.tab.c" /* yacc.c:1646 */ break; - case 138: -#line 567 "grammar.y" /* yacc.c:1646 */ + case 141: +#line 584 "grammar.y" /* yacc.c:1646 */ { int i; for (i = 0;; i++) { if (ieee80211_type_subtypes[i].tok == NULL) { @@ -2885,11 +2940,48 @@ yyreduce: } } } -#line 2889 "y.tab.c" /* yacc.c:1646 */ +#line 2944 "y.tab.c" /* yacc.c:1646 */ break; - case 140: -#line 584 "grammar.y" /* yacc.c:1646 */ + case 142: +#line 600 "grammar.y" /* yacc.c:1646 */ + { (yyval.rblk) = gen_llc(); } +#line 2950 "y.tab.c" /* yacc.c:1646 */ + break; + + 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[0].s), "tods") == 0) @@ -2901,406 +2993,412 @@ yyreduce: else bpf_error("unknown 802.11 direction"); } -#line 2905 "y.tab.c" /* yacc.c:1646 */ - break; - - case 141: -#line 597 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = (yyvsp[0].i); } -#line 2911 "y.tab.c" /* yacc.c:1646 */ - break; - - case 142: -#line 598 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = pfreason_to_num((yyvsp[0].s)); } -#line 2917 "y.tab.c" /* yacc.c:1646 */ - break; - - case 143: -#line 601 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = pfaction_to_num((yyvsp[0].s)); } -#line 2923 "y.tab.c" /* yacc.c:1646 */ - break; - - case 144: -#line 604 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = BPF_JGT; } -#line 2929 "y.tab.c" /* yacc.c:1646 */ - break; - - case 145: -#line 605 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = BPF_JGE; } -#line 2935 "y.tab.c" /* yacc.c:1646 */ - break; - - case 146: -#line 606 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = BPF_JEQ; } -#line 2941 "y.tab.c" /* yacc.c:1646 */ +#line 2997 "y.tab.c" /* yacc.c:1646 */ break; case 147: -#line 608 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = BPF_JGT; } -#line 2947 "y.tab.c" /* yacc.c:1646 */ +#line 639 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = (yyvsp[0].i); } +#line 3003 "y.tab.c" /* yacc.c:1646 */ break; case 148: -#line 609 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = BPF_JGE; } -#line 2953 "y.tab.c" /* yacc.c:1646 */ +#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 610 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = BPF_JEQ; } -#line 2959 "y.tab.c" /* yacc.c:1646 */ +#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 612 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_loadi((yyvsp[0].i)); } -#line 2965 "y.tab.c" /* yacc.c:1646 */ +#line 646 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = BPF_JGT; } +#line 3021 "y.tab.c" /* yacc.c:1646 */ + break; + + 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 615 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_load((yyvsp[-3].i), (yyvsp[-1].a), 1); } -#line 2971 "y.tab.c" /* yacc.c:1646 */ +#line 648 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = BPF_JEQ; } +#line 3033 "y.tab.c" /* yacc.c:1646 */ break; case 153: -#line 616 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_load((yyvsp[-5].i), (yyvsp[-3].a), (yyvsp[-1].i)); } -#line 2977 "y.tab.c" /* yacc.c:1646 */ +#line 650 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = BPF_JGT; } +#line 3039 "y.tab.c" /* yacc.c:1646 */ break; case 154: -#line 617 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_arth(BPF_ADD, (yyvsp[-2].a), (yyvsp[0].a)); } -#line 2983 "y.tab.c" /* yacc.c:1646 */ +#line 651 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = BPF_JGE; } +#line 3045 "y.tab.c" /* yacc.c:1646 */ break; case 155: -#line 618 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_arth(BPF_SUB, (yyvsp[-2].a), (yyvsp[0].a)); } -#line 2989 "y.tab.c" /* yacc.c:1646 */ +#line 652 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = BPF_JEQ; } +#line 3051 "y.tab.c" /* yacc.c:1646 */ break; case 156: -#line 619 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_arth(BPF_MUL, (yyvsp[-2].a), (yyvsp[0].a)); } -#line 2995 "y.tab.c" /* yacc.c:1646 */ - break; - - case 157: -#line 620 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_arth(BPF_DIV, (yyvsp[-2].a), (yyvsp[0].a)); } -#line 3001 "y.tab.c" /* yacc.c:1646 */ +#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 621 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_arth(BPF_AND, (yyvsp[-2].a), (yyvsp[0].a)); } -#line 3007 "y.tab.c" /* yacc.c:1646 */ +#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 622 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_arth(BPF_OR, (yyvsp[-2].a), (yyvsp[0].a)); } -#line 3013 "y.tab.c" /* yacc.c:1646 */ +#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 623 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_arth(BPF_LSH, (yyvsp[-2].a), (yyvsp[0].a)); } -#line 3019 "y.tab.c" /* yacc.c:1646 */ +#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 624 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_arth(BPF_RSH, (yyvsp[-2].a), (yyvsp[0].a)); } -#line 3025 "y.tab.c" /* yacc.c:1646 */ +#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 625 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_neg((yyvsp[0].a)); } -#line 3031 "y.tab.c" /* yacc.c:1646 */ +#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 626 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = (yyvsp[-1].a); } -#line 3037 "y.tab.c" /* yacc.c:1646 */ +#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 627 "grammar.y" /* yacc.c:1646 */ - { (yyval.a) = gen_loadlen(); } -#line 3043 "y.tab.c" /* yacc.c:1646 */ +#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 629 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = '&'; } -#line 3049 "y.tab.c" /* yacc.c:1646 */ +#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 630 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = '|'; } -#line 3055 "y.tab.c" /* yacc.c:1646 */ +#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 631 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = '<'; } -#line 3061 "y.tab.c" /* yacc.c:1646 */ +#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 632 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = '>'; } -#line 3067 "y.tab.c" /* yacc.c:1646 */ +#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 633 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = '='; } -#line 3073 "y.tab.c" /* yacc.c:1646 */ +#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; + + 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 636 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = (yyvsp[-1].i); } -#line 3079 "y.tab.c" /* yacc.c:1646 */ +#line 670 "grammar.y" /* yacc.c:1646 */ + { (yyval.a) = (yyvsp[-1].a); } +#line 3141 "y.tab.c" /* yacc.c:1646 */ break; case 172: -#line 638 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_LANE; } -#line 3085 "y.tab.c" /* yacc.c:1646 */ +#line 671 "grammar.y" /* yacc.c:1646 */ + { (yyval.a) = gen_loadlen(); } +#line 3147 "y.tab.c" /* yacc.c:1646 */ break; case 173: -#line 639 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_LLC; } -#line 3091 "y.tab.c" /* yacc.c:1646 */ +#line 673 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = '&'; } +#line 3153 "y.tab.c" /* yacc.c:1646 */ break; case 174: -#line 640 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_METAC; } -#line 3097 "y.tab.c" /* yacc.c:1646 */ +#line 674 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = '|'; } +#line 3159 "y.tab.c" /* yacc.c:1646 */ break; case 175: -#line 641 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_BCC; } -#line 3103 "y.tab.c" /* yacc.c:1646 */ +#line 675 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = '<'; } +#line 3165 "y.tab.c" /* yacc.c:1646 */ break; case 176: -#line 642 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_OAMF4EC; } -#line 3109 "y.tab.c" /* yacc.c:1646 */ +#line 676 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = '>'; } +#line 3171 "y.tab.c" /* yacc.c:1646 */ break; case 177: -#line 643 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_OAMF4SC; } -#line 3115 "y.tab.c" /* yacc.c:1646 */ - break; - - case 178: -#line 644 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_SC; } -#line 3121 "y.tab.c" /* yacc.c:1646 */ +#line 677 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = '='; } +#line 3177 "y.tab.c" /* yacc.c:1646 */ break; case 179: -#line 645 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_ILMIC; } -#line 3127 "y.tab.c" /* yacc.c:1646 */ +#line 680 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = (yyvsp[-1].i); } +#line 3183 "y.tab.c" /* yacc.c:1646 */ break; case 180: -#line 647 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_OAM; } -#line 3133 "y.tab.c" /* yacc.c:1646 */ +#line 682 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = A_LANE; } +#line 3189 "y.tab.c" /* yacc.c:1646 */ break; case 181: -#line 648 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_OAMF4; } -#line 3139 "y.tab.c" /* yacc.c:1646 */ +#line 683 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = A_METAC; } +#line 3195 "y.tab.c" /* yacc.c:1646 */ break; case 182: -#line 649 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_CONNECTMSG; } -#line 3145 "y.tab.c" /* yacc.c:1646 */ +#line 684 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = A_BCC; } +#line 3201 "y.tab.c" /* yacc.c:1646 */ break; case 183: -#line 650 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = A_METACONNECT; } -#line 3151 "y.tab.c" /* yacc.c:1646 */ +#line 685 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = A_OAMF4EC; } +#line 3207 "y.tab.c" /* yacc.c:1646 */ break; case 184: -#line 653 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).atmfieldtype = A_VPI; } -#line 3157 "y.tab.c" /* yacc.c:1646 */ +#line 686 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = A_OAMF4SC; } +#line 3213 "y.tab.c" /* yacc.c:1646 */ break; case 185: -#line 654 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).atmfieldtype = A_VCI; } -#line 3163 "y.tab.c" /* yacc.c:1646 */ +#line 687 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = A_SC; } +#line 3219 "y.tab.c" /* yacc.c:1646 */ + break; + + 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 657 "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 3169 "y.tab.c" /* yacc.c:1646 */ +#line 690 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = A_OAM; } +#line 3231 "y.tab.c" /* yacc.c:1646 */ break; case 188: -#line 658 "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 3175 "y.tab.c" /* yacc.c:1646 */ +#line 691 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = A_OAMF4; } +#line 3237 "y.tab.c" /* yacc.c:1646 */ break; case 189: -#line 659 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = qerr; } -#line 3181 "y.tab.c" /* yacc.c:1646 */ +#line 692 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = A_CONNECTMSG; } +#line 3243 "y.tab.c" /* yacc.c:1646 */ break; case 190: -#line 661 "grammar.y" /* yacc.c:1646 */ +#line 693 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = A_METACONNECT; } +#line 3249 "y.tab.c" /* yacc.c:1646 */ + break; + + 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 697 "grammar.y" /* yacc.c:1646 */ + { (yyval.blk).atmfieldtype = A_VCI; } +#line 3261 "y.tab.c" /* yacc.c:1646 */ + break; + + case 194: +#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 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 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 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 3192 "y.tab.c" /* yacc.c:1646 */ - break; - - case 192: -#line 669 "grammar.y" /* yacc.c:1646 */ - { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); } -#line 3198 "y.tab.c" /* yacc.c:1646 */ - break; - - case 193: -#line 672 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = M_FISU; } -#line 3204 "y.tab.c" /* yacc.c:1646 */ - break; - - case 194: -#line 673 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = M_LSSU; } -#line 3210 "y.tab.c" /* yacc.c:1646 */ - break; - - case 195: -#line 674 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = M_MSU; } -#line 3216 "y.tab.c" /* yacc.c:1646 */ - break; - - case 196: -#line 675 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = MH_FISU; } -#line 3222 "y.tab.c" /* yacc.c:1646 */ - break; - - case 197: -#line 676 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = MH_LSSU; } -#line 3228 "y.tab.c" /* yacc.c:1646 */ - break; - - case 198: -#line 677 "grammar.y" /* yacc.c:1646 */ - { (yyval.i) = MH_MSU; } -#line 3234 "y.tab.c" /* yacc.c:1646 */ +#line 3290 "y.tab.c" /* yacc.c:1646 */ break; case 199: -#line 680 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).mtp3fieldtype = M_SIO; } -#line 3240 "y.tab.c" /* yacc.c:1646 */ +#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 681 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).mtp3fieldtype = M_OPC; } -#line 3246 "y.tab.c" /* yacc.c:1646 */ +#line 715 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = M_FISU; } +#line 3302 "y.tab.c" /* yacc.c:1646 */ break; case 201: -#line 682 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).mtp3fieldtype = M_DPC; } -#line 3252 "y.tab.c" /* yacc.c:1646 */ +#line 716 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = M_LSSU; } +#line 3308 "y.tab.c" /* yacc.c:1646 */ break; case 202: -#line 683 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).mtp3fieldtype = M_SLS; } -#line 3258 "y.tab.c" /* yacc.c:1646 */ +#line 717 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = M_MSU; } +#line 3314 "y.tab.c" /* yacc.c:1646 */ break; case 203: -#line 684 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).mtp3fieldtype = MH_SIO; } -#line 3264 "y.tab.c" /* yacc.c:1646 */ +#line 718 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = MH_FISU; } +#line 3320 "y.tab.c" /* yacc.c:1646 */ break; case 204: -#line 685 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).mtp3fieldtype = MH_OPC; } -#line 3270 "y.tab.c" /* yacc.c:1646 */ +#line 719 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = MH_LSSU; } +#line 3326 "y.tab.c" /* yacc.c:1646 */ break; case 205: -#line 686 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).mtp3fieldtype = MH_DPC; } -#line 3276 "y.tab.c" /* yacc.c:1646 */ +#line 720 "grammar.y" /* yacc.c:1646 */ + { (yyval.i) = MH_MSU; } +#line 3332 "y.tab.c" /* yacc.c:1646 */ break; case 206: -#line 687 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).mtp3fieldtype = MH_SLS; } -#line 3282 "y.tab.c" /* yacc.c:1646 */ +#line 723 "grammar.y" /* yacc.c:1646 */ + { (yyval.blk).mtp3fieldtype = M_SIO; } +#line 3338 "y.tab.c" /* yacc.c:1646 */ + break; + + 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 690 "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 3288 "y.tab.c" /* yacc.c:1646 */ +#line 725 "grammar.y" /* yacc.c:1646 */ + { (yyval.blk).mtp3fieldtype = M_DPC; } +#line 3350 "y.tab.c" /* yacc.c:1646 */ break; case 209: -#line 691 "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 3294 "y.tab.c" /* yacc.c:1646 */ +#line 726 "grammar.y" /* yacc.c:1646 */ + { (yyval.blk).mtp3fieldtype = M_SLS; } +#line 3356 "y.tab.c" /* yacc.c:1646 */ break; case 210: -#line 692 "grammar.y" /* yacc.c:1646 */ - { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = qerr; } -#line 3300 "y.tab.c" /* yacc.c:1646 */ +#line 727 "grammar.y" /* yacc.c:1646 */ + { (yyval.blk).mtp3fieldtype = MH_SIO; } +#line 3362 "y.tab.c" /* yacc.c:1646 */ break; case 211: -#line 694 "grammar.y" /* yacc.c:1646 */ +#line 728 "grammar.y" /* yacc.c:1646 */ + { (yyval.blk).mtp3fieldtype = MH_OPC; } +#line 3368 "y.tab.c" /* yacc.c:1646 */ + break; + + 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[-1].blk).mtp3fieldtype; if ((yyval.blk).mtp3fieldtype == M_SIO || @@ -3313,17 +3411,17 @@ yyreduce: (yyval.blk).mtp3fieldtype == MH_SLS) (yyval.blk).b = gen_mtp3field_code((yyval.blk).mtp3fieldtype, (u_int) (yyvsp[0].i), BPF_JEQ, 0); } -#line 3317 "y.tab.c" /* yacc.c:1646 */ +#line 3415 "y.tab.c" /* yacc.c:1646 */ break; - case 213: -#line 708 "grammar.y" /* yacc.c:1646 */ + 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 3323 "y.tab.c" /* yacc.c:1646 */ +#line 3421 "y.tab.c" /* yacc.c:1646 */ break; -#line 3327 "y.tab.c" /* yacc.c:1646 */ +#line 3425 "y.tab.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -3551,5 +3649,5 @@ yyreturn: #endif return yyresult; } -#line 710 "grammar.y" /* yacc.c:1906 */ +#line 753 "grammar.y" /* yacc.c:1906 */ diff --git a/libpcap/grammar.y b/libpcap/grammar.y index e9cc6e6d0..995a514e3 100644 --- a/libpcap/grammar.y +++ b/libpcap/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 @@ struct rtentry; #include #include #endif +#include "llc.h" #include "ieee80211.h" #include @@ -132,6 +129,23 @@ static const struct tok ieee80211_data_subtypes[] = { { 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 @@ pfaction_to_num(const char *action) %type arth narth %type byteop pname pnum relop irelop %type and or paren not null prog -%type other pfvar p80211 +%type other pfvar p80211 pllc %type atmtype atmmultitype %type atmfield %type atmfieldvalue atmvalue atmlistvalue @@ -285,8 +299,8 @@ pfaction_to_num(const char *action) %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 @@ pfaction_to_num(const char *action) %token RADIO %token FISU LSSU MSU HFISU HLSSU HMSU %token SIO OPC DPC SLS HSIO HOPC HDPC HSLS - + %type ID %type EID @@ -372,7 +386,7 @@ nid: ID { $$.b = gen_scode($1, $$.q = $0.q); } "in this configuration"); #endif /*INET6*/ } - | EID { + | EID { $$.b = gen_ecode($1, $$.q = $0.q); /* * $1 was allocated by "pcap_ether_aton()", @@ -509,8 +523,11 @@ other: pqual TK_BROADCAST { $$ = gen_broadcast($1); } | 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 @@ type_subtype: ID { int i; } ; +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 @@ narth: pname '[' arth ']' { $$ = gen_load($1, $3, 1); } | 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 @@ pnum: NUM | paren pnum ')' { $$ = $2; } ; atmtype: LANE { $$ = A_LANE; } - | LLC { $$ = A_LLC; } | METAC { $$ = A_METAC; } | BCC { $$ = A_BCC; } | OAMF4EC { $$ = A_OAMF4EC; } diff --git a/libpcap/inet.c b/libpcap/inet.c index 6ae46ef87..e7d2104e3 100644 --- a/libpcap/inet.c +++ b/libpcap/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 @@ struct rtentry; /* declarations in */ (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 @@ dup_sockaddr(struct sockaddr *sa, size_t sa_length) 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 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name, } 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 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name, 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 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name, } /* - * 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 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name, } /* + * 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 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name, * 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 @@ add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags, #else size_t descrlen = IFDESCRSIZE; #endif /* IFDESCRSIZE */ -#endif /* SIOCGIFDESCR */ -#ifdef SIOCGIFDESCR /* * Get the description for the interface. */ @@ -485,8 +561,53 @@ add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags, 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 @@ add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags, 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 @@ add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags, 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 @@ pcap_lookupnet(device, netp, maskp, errbuf) /* 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 @@ pcap_lookupnet(device, netp, maskp, errbuf) /* 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 @@ pcap_lookupdev(errbuf) 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 @@ pcap_lookupdev(errbuf) free(TAdaptersName); return (char *)(AdaptersName); - } + } } @@ -897,7 +1065,7 @@ pcap_lookupnet(device, netp, maskp, errbuf) 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 @@ pcap_lookupnet(device, netp, maskp, errbuf) *netp &= *maskp; return (0); } - + } *netp = *maskp = 0; diff --git a/libpcap/install-sh b/libpcap/install-sh index ebc66913e..b44de0989 100755 --- a/libpcap/install-sh +++ b/libpcap/install-sh @@ -115,7 +115,7 @@ fi if [ x"$dir_arg" != x ]; then dst=$src src="" - + if [ -d $dst ]; then instcmd=: else @@ -124,7 +124,7 @@ if [ x"$dir_arg" != x ]; then 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 @@ else echo "install: $src does not exist" exit 1 fi - + if [ x"$dst" = x ] then echo "install: no destination specified" @@ -201,17 +201,17 @@ else # 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 @@ else # 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/libpcap/lbl/os-aix4.h b/libpcap/lbl/os-aix4.h index c5dfce251..5cf458627 100644 --- a/libpcap/lbl/os-aix4.h +++ b/libpcap/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/libpcap/lbl/os-hpux11.h b/libpcap/lbl/os-hpux11.h index 5e325a9d1..42c6b60d4 100644 --- a/libpcap/lbl/os-hpux11.h +++ b/libpcap/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/libpcap/lbl/os-osf4.h b/libpcap/lbl/os-osf4.h index 60abcd915..f461eeaff 100644 --- a/libpcap/lbl/os-osf4.h +++ b/libpcap/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/libpcap/lbl/os-osf5.h b/libpcap/lbl/os-osf5.h index 1ebcac62b..52ab1750e 100644 --- a/libpcap/lbl/os-osf5.h +++ b/libpcap/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/libpcap/lbl/os-solaris2.h b/libpcap/lbl/os-solaris2.h index fae2aa3a2..22948b4a2 100644 --- a/libpcap/lbl/os-solaris2.h +++ b/libpcap/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/libpcap/lbl/os-sunos4.h b/libpcap/lbl/os-sunos4.h index cfd4b0468..b73585706 100644 --- a/libpcap/lbl/os-sunos4.h +++ b/libpcap/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/libpcap/lbl/os-ultrix4.h b/libpcap/lbl/os-ultrix4.h index 9f2a155e9..fa1f770f8 100644 --- a/libpcap/lbl/os-ultrix4.h +++ b/libpcap/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/libpcap/llc.h b/libpcap/llc.h index b8c221fa0..b0cf881ca 100644 --- a/libpcap/llc.h +++ b/libpcap/llc.h @@ -17,10 +17,39 @@ * 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/libpcap/missing/snprintf.c b/libpcap/missing/snprintf.c index 8991f2496..9b63f8b1d 100644 --- a/libpcap/missing/snprintf.c +++ b/libpcap/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 #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 #include #include diff --git a/libpcap/mkdep b/libpcap/mkdep index bfe4a2614..1486b185a 100755 --- a/libpcap/mkdep +++ b/libpcap/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/libpcap/msdos/common.dj b/libpcap/msdos/common.dj index 3f64d14e9..ec0ce02b2 100644 --- a/libpcap/msdos/common.dj +++ b/libpcap/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/libpcap/msdos/makefile.dj b/libpcap/msdos/makefile.dj index 7ce58b43d..ae20ada3d 100644 --- a/libpcap/msdos/makefile.dj +++ b/libpcap/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 @@ depend: $(PREREQUISITES) # # Manually generated dependencies -# +# msdos/pktdrvr.c: msdos/pkt_stub.inc scanner.c: scanner.l grammar.c tokdefs.h: grammar.y diff --git a/libpcap/msdos/readme.dos b/libpcap/msdos/readme.dos index 02ef1f7b2..353d0cca0 100644 --- a/libpcap/msdos/readme.dos +++ b/libpcap/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 @@ Extensions to libpcap 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/libpcap/nametoaddr.c b/libpcap/nametoaddr.c index 55439f711..e6483a358 100644 --- a/libpcap/nametoaddr.c +++ b/libpcap/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/libpcap/nlpid.h b/libpcap/nlpid.h index 5327a362b..9dfa752b8 100644 --- a/libpcap/nlpid.h +++ b/libpcap/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/libpcap/optimize.c b/libpcap/optimize.c index 82155436d..ada201976 100644 --- a/libpcap/optimize.c +++ b/libpcap/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 @@ fold_op(struct stmt *s, int v0, int v1) 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 @@ fold_op(struct stmt *s, int v0, int v1) a |= b; break; + case BPF_XOR: + a ^= b; + break; + case BPF_LSH: a <<= b; break; @@ -978,8 +984,10 @@ opt_stmt(struct stmt *s, int val[], int alter) 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 @@ opt_stmt(struct stmt *s, int val[], int alter) * 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 @@ opt_stmt(struct stmt *s, int val[], int alter) 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 @@ opt_stmt(struct stmt *s, int val[], int alter) */ 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 @@ install_bpf_program(pcap_t *p, struct bpf_program *fp) #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 @@ opt_dump(struct block *root) 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/libpcap/packaging/pcap.spec.in b/libpcap/packaging/pcap.spec.in deleted file mode 100644 index ff7b996ec..000000000 --- a/libpcap/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/libpcap/pcap-bpf.c b/libpcap/pcap-bpf.c index 250298a78..b1da1a003 100644 --- a/libpcap/pcap-bpf.c +++ b/libpcap/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_set_datalink_bpf(pcap_t *p, int dlt); */ static int pcap_getnonblock_bpf(pcap_t *p, char *errbuf) -{ +{ #ifdef HAVE_ZEROCOPY_BPF struct pcap_bpf *pb = p->priv; @@ -251,7 +247,7 @@ pcap_getnonblock_bpf(pcap_t *p, char *errbuf) 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 @@ pcap_activate_bpf(pcap_t *p) { 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 @@ pcap_activate_bpf(pcap_t *p) #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 @@ pcap_activate_bpf(pcap_t *p) 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 @@ pcap_activate_bpf(pcap_t *p) 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 @@ pcap_activate_bpf(pcap_t *p) 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 @@ pcap_activate_bpf(pcap_t *p) /* * 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/libpcap/pcap-bpf.h b/libpcap/pcap-bpf.h index 7b7e90a53..ebb64c3f9 100644 --- a/libpcap/pcap-bpf.h +++ b/libpcap/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/libpcap/pcap-bt-linux.c b/libpcap/pcap-bt-linux.c index 6435bcfc2..56df68767 100644 --- a/libpcap/pcap-bt-linux.c +++ b/libpcap/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 * */ -#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 @@ struct pcap_bt { 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 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str) 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 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str) } 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 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str) 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 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str) 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 @@ bt_activate(pcap_t* handle) 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 @@ bt_activate(pcap_t* handle) 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 @@ bt_activate(pcap_t* handle) 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 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us 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 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us pkth.caplen = ret; - /* get direction and timestamp*/ + /* get direction and timestamp*/ cmsg = CMSG_FIRSTHDR(&msg); int in=0; while (cmsg) { @@ -353,7 +349,7 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us } 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 @@ bt_inject_linux(pcap_t *handle, const void *buf, size_t size) 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 @@ bt_stats_linux(pcap_t *handle, struct pcap_stat *stats) 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/libpcap/pcap-bt-linux.h b/libpcap/pcap-bt-linux.h index fbe8f4870..e098654dc 100644 --- a/libpcap/pcap-bt-linux.h +++ b/libpcap/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 - * - * @(#) $Header: /tcpdump/master/libpcap/pcap-bt-linux.h,v 1.5 2008-04-04 19:37:45 guy Exp $ (LBL) */ /* diff --git a/libpcap/pcap-bt-monitor-linux.c b/libpcap/pcap-bt-monitor-linux.c new file mode 100644 index 000000000..f193e2636 --- /dev/null +++ b/libpcap/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 +#include +#include + +#include +#include +#include + +#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/libpcap/pcap-bt-monitor-linux.h b/libpcap/pcap-bt-monitor-linux.h new file mode 100644 index 000000000..aada2bc77 --- /dev/null +++ b/libpcap/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/libpcap/pcap-can-linux.c b/libpcap/pcap-can-linux.c index 80fa41ccf..a8e1e355e 100644 --- a/libpcap/pcap-can-linux.c +++ b/libpcap/pcap-can-linux.c @@ -171,7 +171,7 @@ can_activate(pcap_t* handle) /* 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 @@ can_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u } } 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/libpcap/pcap-canusb-linux.c b/libpcap/pcap-canusb-linux.c index a72f4697f..f44c45e80 100644 --- a/libpcap/pcap-canusb-linux.c +++ b/libpcap/pcap-canusb-linux.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -92,7 +93,7 @@ int canusb_findalldevs(pcap_if_t **alldevsp, char *err_str) 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 @@ int canusb_findalldevs(pcap_if_t **alldevsp, char *err_str) * saying "no CANUSB devices". */ return 0; - } + } cnt = libusb_get_device_list(fdctx,&devs); @@ -111,24 +112,24 @@ int canusb_findalldevs(pcap_if_t **alldevsp, char *err_str) 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 @@ static libusb_device_handle* canusb_opendevice(struct libusb_context *ctx, char* libusb_device** devs; unsigned char serial[65]; int cnt,i,n; - + cnt = libusb_get_device_list(ctx,&devs); for(i=0;iwrpipe, 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; idev, 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 @@ static int canusb_startcapture(struct pcap_canusb* this) 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 @@ static void canusb_clearbufs(struct pcap_canusb* this) 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 @@ static void canusb_close(pcap_t* handle) { libusb_close(canusb->dev); canusb->dev = NULL; - } + } if (canusb->ctx) { libusb_exit(canusb->ctx); @@ -345,9 +347,9 @@ static int canusb_activate(pcap_t* handle) /* * 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 @@ static int canusb_activate(pcap_t* handle) 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 @@ canusb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char int i = 0; struct CAN_Msg msg; struct pcap_pkthdr pkth; - + while(i < max_packets) { int n; @@ -404,10 +406,10 @@ canusb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char 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 @@ canusb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char callback(user, &pkth, (void*)&msg.id); i++; } - + return i; } diff --git a/libpcap/pcap-common.c b/libpcap/pcap-common.c index 6175a5acb..4db496885 100644 --- a/libpcap/pcap-common.c +++ b/libpcap/pcap-common.c @@ -41,6 +41,7 @@ #include "pcap-int.h" #include "pcap/usb.h" +#include "pcap/nflog.h" #include "pcap-common.h" @@ -385,7 +386,7 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The Link Types are used for prepending meta-information * like interface index, interface name * before standard Ethernet, PPP, Frelay & C-HDLC Frames @@ -402,7 +403,7 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for internal communication with a * voice Adapter Card (PIC) */ @@ -477,7 +478,7 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for internal communication with a * integrated service module (ISM). */ @@ -518,7 +519,7 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for capturing data on a secure tunnel interface. */ #define LINKTYPE_JUNIPER_ST 200 @@ -610,11 +611,11 @@ */ #define LINKTYPE_IEEE802_15_4_NONASK_PHY 215 -/* +/* * David Gibson 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 @@ -776,7 +777,7 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . */ #define LINKTYPE_JUNIPER_VS 232 #define LINKTYPE_JUNIPER_SRX_E2E 233 @@ -808,12 +809,12 @@ /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . */ #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 @@ -921,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 @@ -932,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 , 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; @@ -1005,13 +1073,20 @@ dlt_to_linktype(int dlt) 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); @@ -1025,9 +1100,9 @@ dlt_to_linktype(int dlt) } /* - * 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); } @@ -1038,16 +1113,19 @@ linktype_to_dlt(int linktype) 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) @@ -1062,9 +1140,9 @@ linktype_to_dlt(int linktype) } /* - * 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; } @@ -1075,17 +1153,15 @@ linktype_to_dlt(int linktype) * memory-mapped buffer shared by the kernel). * * When reading a DLT_USB_LINUX or DLT_USB_LINUX_MMAPPED capture file, - * we need to convert it from the capturing host's byte order to - * the reading host's byte order. + * we need to convert it from the byte order of the host that wrote + * the file to this host's byte order. */ -void +static void swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf, int header_len_64_bytes) { pcap_usb_header_mmapped *uhdr = (pcap_usb_header_mmapped *)buf; bpf_u_int32 offset = 0; - usb_isodesc *pisodesc; - int32_t numdesc, i; /* * "offset" is the offset *past* the field we're swapping; @@ -1094,7 +1170,7 @@ swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf, */ /* - * 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 */ @@ -1149,6 +1225,17 @@ swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf, } 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 @@ -1177,31 +1264,123 @@ swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf, 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++; + } } } } + +/* + * The DLT_NFLOG "packets" have a mixture of big-endian and host-byte-order + * data. They begin with a fixed-length header with big-endian fields, + * followed by a set of TLVs, where the type and length are in host + * byte order but the values are either big-endian or are a raw byte + * sequence that's the same regardless of the host's byte order. + * + * When reading a DLT_NFLOG capture file, we need to convert the type + * and length values from the byte order of the host that wrote the + * file to the byte order of this host. + */ +static void +swap_nflog_header(const struct pcap_pkthdr *hdr, u_char *buf) +{ + u_char *p = buf; + nflog_hdr_t *nfhdr = (nflog_hdr_t *)buf; + nflog_tlv_t *tlv; + u_int caplen = hdr->caplen; + u_int length = hdr->len; + u_int16_t size; + + if (caplen < (int) sizeof(nflog_hdr_t) || length < (int) sizeof(nflog_hdr_t)) { + /* Not enough data to have any TLVs. */ + return; + } + + if (!(nfhdr->nflog_version) == 0) { + /* Unknown NFLOG version */ + return; + } + + length -= sizeof(nflog_hdr_t); + caplen -= sizeof(nflog_hdr_t); + p += sizeof(nflog_hdr_t); + + while (caplen >= sizeof(nflog_tlv_t)) { + tlv = (nflog_tlv_t *) p; + + /* Swap the type and length. */ + tlv->tlv_type = SWAPSHORT(tlv->tlv_type); + tlv->tlv_length = SWAPSHORT(tlv->tlv_length); + + /* Get the length of the TLV. */ + size = tlv->tlv_length; + if (size % 4 != 0) + size += 4 - size % 4; + + /* Is the TLV's length less than the minimum? */ + if (size < sizeof(nflog_tlv_t)) { + /* Yes. Give up now. */ + return; + } + + /* Do we have enough data for the full TLV? */ + if (caplen < size || length < size) { + /* No. */ + return; + } + + /* Skip over the TLV. */ + length -= size; + caplen -= size; + p += size; + } +} + +void +swap_pseudo_headers(int linktype, struct pcap_pkthdr *hdr, u_char *data) +{ + /* + * Convert pseudo-headers from the byte order of + * the host on which the file was saved to our + * byte order, as necessary. + */ + switch (linktype) { + + case DLT_USB_LINUX: + swap_linux_usb_header(hdr, data, 0); + break; + + case DLT_USB_LINUX_MMAPPED: + swap_linux_usb_header(hdr, data, 1); + break; + + case DLT_NFLOG: + swap_nflog_header(hdr, data); + break; + } +} diff --git a/libpcap/pcap-common.h b/libpcap/pcap-common.h index 0c80ba326..6ac5bcd26 100644 --- a/libpcap/pcap-common.h +++ b/libpcap/pcap-common.h @@ -21,5 +21,5 @@ extern int dlt_to_linktype(int dlt); extern int linktype_to_dlt(int linktype); -extern void swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf, - int header_len_64_bytes); +extern void swap_pseudo_headers(int linktype, struct pcap_pkthdr *hdr, + u_char *data); diff --git a/libpcap/pcap-config.1 b/libpcap/pcap-config.1 index 021f4504c..2a2272b38 100644 --- a/libpcap/pcap-config.1 +++ b/libpcap/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/libpcap/pcap-dag.c b/libpcap/pcap-dag.c index 70a6d6c20..491524893 100644 --- a/libpcap/pcap-dag.c +++ b/libpcap/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 - * Koryn Grant - * Stephen Donnelly + * Modifications: Jesper Peterson + * Koryn Grant + * Stephen Donnelly */ -#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 @@ struct rtentry; /* declarations in */ #include "dagnew.h" #include "dagapi.h" +#include "dagpci.h" #include "pcap-dag.h" @@ -155,7 +151,7 @@ dag_platform_cleanup(pcap_t *p) #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 @@ dag_erf_ext_header_count(uint8_t * erf, size_t len) /* 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) } } - + /* 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) u_char *dp = ((u_char *)header); /* + dag_record_size; */ unsigned short rlen; - + /* * Has "pcap_breakloop()" been called? */ @@ -334,7 +331,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) p->break_loop = 0; return -2; } - + rlen = ntohs(header->rlen); if (rlen < dag_record_size) { @@ -364,7 +361,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) } } } - + if ((header->type & 0x7f) == TYPE_PAD) { continue; } @@ -372,13 +369,13 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ dag_inject(pcap_t *p, const void *buf _U_, size_t size _U_) * 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 @@ static int dag_activate(pcap_t* handle) 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 @@ static int dag_activate(pcap_t* handle) 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 @@ static int dag_activate(pcap_t* handle) 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 @@ static int dag_activate(pcap_t* handle) 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 @@ static int dag_activate(pcap_t* handle) handle->linktype = -1; if (dag_get_datalink(handle) < 0) goto failstop; - + handle->bufsize = 0; if (new_pcap_dag(handle) < 0) { @@ -838,12 +853,12 @@ static int dag_activate(pcap_t* handle) 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 @@ failstop: 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 @@ pcap_t *dag_create(const char *device, char *ebuf, int *is_ours) 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 @@ dag_stats(pcap_t *p, struct pcap_stat *ps) { */ /*pd->stat.ps_recv = 0;*/ /*pd->stat.ps_drop = 0;*/ - + *ps = pd->stat; - + return 0; } @@ -958,6 +993,8 @@ dag_findalldevs(pcap_if_t **devlistp, char *errbuf) 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 @@ dag_findalldevs(pcap_if_t **devlistp, char *errbuf) { 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_findalldevs(pcap_if_t **devlistp, char *errbuf) 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 @@ dag_setnonblock(pcap_t *p, int nonblock, char *errbuf) 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 @@ dag_setnonblock(pcap_t *p, int nonblock, char *errbuf) 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 @@ dag_setnonblock(pcap_t *p, int nonblock, char *errbuf) } return (0); } - + static int dag_get_datalink(pcap_t *p) { @@ -1105,18 +1145,18 @@ dag_get_datalink(pcap_t *p) /* 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 @@ dag_get_datalink(pcap_t *p) 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/libpcap/pcap-dag.h b/libpcap/pcap-dag.h index 47511866e..68520dc82 100644 --- a/libpcap/pcap-dag.h +++ b/libpcap/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/libpcap/pcap-dbus.c b/libpcap/pcap-dbus.c index c878353b9..ab3f12581 100644 --- a/libpcap/pcap-dbus.c +++ b/libpcap/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_write(pcap_t *handle, const void *buf, size_t size) dbus_message_unref(msg); return 0; -} +} static int dbus_stats(pcap_t *handle, struct pcap_stat *stats) @@ -250,8 +250,8 @@ dbus_create(const char *device, char *ebuf, int *is_ours) { 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 @@ dbus_create(const char *device, char *ebuf, int *is_ours) 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/libpcap/pcap-dlpi.c b/libpcap/pcap-dlpi.c index 899313434..c00713526 100644 --- a/libpcap/pcap-dlpi.c +++ b/libpcap/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 @@ pcap_inject_dlpi(pcap_t *p, const void *buf, size_t size) ret = -1; #endif /* raw mode */ return (ret); -} +} #ifndef DL_IPATM #define DL_IPATM 0x12 /* ATM Classical IP interface */ @@ -341,6 +336,8 @@ pcap_activate_dlpi(pcap_t *p) #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 @@ pcap_activate_dlpi(pcap_t *p) #ifndef HAVE_DEV_DLPI char dname2[100]; #endif - int status = PCAP_ERROR; #ifdef HAVE_DEV_DLPI /* @@ -397,6 +393,8 @@ pcap_activate_dlpi(pcap_t *p) 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 @@ pcap_activate_dlpi(pcap_t *p) 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 @@ pcap_activate_dlpi(pcap_t *p) } 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 @@ pcap_activate_dlpi(pcap_t *p) ** 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 @@ pcap_activate_dlpi(pcap_t *p) */ 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 @@ pcap_activate_dlpi(pcap_t *p) ** 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 @@ pcap_activate_dlpi(pcap_t *p) ** 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 @@ pcap_activate_dlpi(pcap_t *p) /* ** 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 @@ pcap_activate_dlpi(pcap_t *p) ** 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 @@ pcap_activate_dlpi(pcap_t *p) /* 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 @@ pcap_activate_dlpi(pcap_t *p) ** 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 @@ pcap_activate_dlpi(pcap_t *p) ** 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 @@ pcap_activate_dlpi(pcap_t *p) ** 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 @@ pcap_activate_dlpi(pcap_t *p) ** 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 @@ pcap_activate_dlpi(pcap_t *p) #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/libpcap/pcap-dos.c b/libpcap/pcap-dos.c index cecc73ced..8632cee66 100644 --- a/libpcap/pcap-dos.c +++ b/libpcap/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 @@ -168,7 +166,7 @@ pcap_t *pcap_create_interface (const char *device, char *ebuf) * network packets. */ static int pcap_activate_dos (pcap_t *pcap) -{ +{ struct pcap_dos *pcapd = pcap->priv; if (pcap->opt.rfmon) { @@ -199,7 +197,7 @@ static int pcap_activate_dos (pcap_t *pcap) !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 @@ int pcap_stats_ex (pcap_t *p, struct pcap_stat_ex *se) 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 @@ int pcap_lookupnet (const char *device, bpf_u_int32 *localnet, } ARGSUSED (device); return (0); -} +} /* * Get a list of all interfaces that are present and that we probe okay. @@ -962,7 +960,7 @@ static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf) * 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 @@ static int pkt_open (struct device *dev) if (!PktInitDriver(mode)) return (0); - + PktResetStatistics (pktInfo.handle); PktQueueBusy (FALSE); return (1); @@ -1292,7 +1290,7 @@ struct device rtl8139_dev LOCKED_VAR = { 0,0,0,0,0,0, &cs89_dev, rtl8139_probe /* dev->probe routine */ - }; + }; /* * Dequeue routine is called by polling. diff --git a/libpcap/pcap-dos.h b/libpcap/pcap-dos.h index f4744378c..bf47fb511 100644 --- a/libpcap/pcap-dos.h +++ b/libpcap/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 @@ extern void _w32_os_yield (void); /* Watt-32's misc.c */ #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/libpcap/pcap-enet.c b/libpcap/pcap-enet.c index 5ad921c25..777d3e3a8 100644 --- a/libpcap/pcap-enet.c +++ b/libpcap/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/libpcap/pcap-filter.manmisc.in b/libpcap/pcap-filter.manmisc.in index 5c11d5c02..d74019467 100644 --- a/libpcap/pcap-filter.manmisc.in +++ b/libpcap/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 @@ The packet may contain, for example, 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 @@ True if the DECNET destination address is .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 @@ name of an anchored ruleset (applies only to packets logged by OpenBSD's 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 @@ of an anchored ruleset (applies only to packets logged by OpenBSD's or 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 @@ changes the decoding offsets for the remainder of \fIexpression\fR on 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 @@ For example: .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 @@ on the assumption that the packet is either a LANE emulated Ethernet 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 @@ Release, or Release Done message. 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/libpcap/pcap-int.h b/libpcap/pcap-int.h index 0c27ec7ac..2f71e1152 100644 --- a/libpcap/pcap-int.h +++ b/libpcap/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 @@ extern CRITICAL_SECTION g_PcapCompileCriticalSection; #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 */ @@ -181,6 +202,11 @@ struct pcap { /* We're accepting only packets in this direction/these directions. */ pcap_direction_t direction; + /* + * Flags to affect BPF code generation. + */ + int bpf_codegen_flags; + /* * Placeholder for filter code if bpf not in kernel. */ @@ -227,6 +253,11 @@ struct pcap { cleanup_op_t cleanup_op; }; +/* + * 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 @@ -387,6 +418,9 @@ int pcap_platform_finddevs(pcap_if_t **, char *); 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/libpcap/pcap-libdlpi.c b/libpcap/pcap-libdlpi.c index 5bc9374ab..333e532b7 100644 --- a/libpcap/pcap-libdlpi.c +++ b/libpcap/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 @@ static int 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 @@ pcap_activate_libdlpi(pcap_t *p) 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 @@ pcap_activate_libdlpi(pcap_t *p) * 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 @@ pcap_activate_libdlpi(pcap_t *p) * 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 @@ pcap_activate_libdlpi(pcap_t *p) 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/libpcap/pcap-linktype.manmisc.in b/libpcap/pcap-linktype.manmisc.in index 890438728..e42c5b367 100644 --- a/libpcap/pcap-linktype.manmisc.in +++ b/libpcap/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/libpcap/pcap-linux.c b/libpcap/pcap-linux.c index bd2457d4b..a226da12e 100644 --- a/libpcap/pcap-linux.c +++ b/libpcap/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 * Added TPACKET_V3 support * Gabor Tatarka - * + * * based on previous works of: * Simon Patarin * Phil Wood @@ -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,21 +188,21 @@ static const char rcsid[] _U_ = # 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 -# define HAVE_TPACKET3 -# endif /* TPACKET3_HDRLEN */ -# ifdef TPACKET2_HDRLEN -# define HAVE_TPACKET2 -# else /* TPACKET2_HDRLEN */ -# define TPACKET_V1 0 /* Old kernel with only V1, so no TPACKET_Vn defined */ -# endif /* TPACKET2_HDRLEN */ -# endif /* TPACKET_HDRLEN */ +# ifdef TPACKET_HDRLEN +# define HAVE_PACKET_RING +# ifdef TPACKET3_HDRLEN +# define HAVE_TPACKET3 +# endif /* TPACKET3_HDRLEN */ +# ifdef TPACKET2_HDRLEN +# define HAVE_TPACKET2 +# else /* TPACKET2_HDRLEN */ +# 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 */ @@ -220,6 +215,14 @@ static const char rcsid[] _U_ = #include #endif +#ifdef HAVE_LINUX_SOCKIOS_H +#include +#endif + +#ifdef HAVE_LINUX_IF_BONDING_H +#include +#endif + /* * Got Wireless Extensions? */ @@ -323,7 +326,7 @@ struct pcap_linux { /* * 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 @@ -341,8 +344,30 @@ static int pcap_setdirection_linux(pcap_t *, pcap_direction_t); 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 @@ -360,6 +385,7 @@ static int create_ring(pcap_t *handle, int *status); 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 @@ -373,6 +399,12 @@ static void pcap_oneshot_mmap(u_char *user, const struct pcap_pkthdr *h, 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 */ @@ -389,7 +421,12 @@ static int has_wext(int sock_fd, const char *device, char *ebuf); 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 @@ -416,26 +453,15 @@ pcap_create_interface(const char *device, char *ebuf) 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) @@ -450,6 +476,8 @@ pcap_create_interface(const char *device, char *ebuf) 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); @@ -873,7 +901,7 @@ added: * 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, @@ -914,6 +942,41 @@ added: } #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) { @@ -972,12 +1035,17 @@ pcap_can_set_rfmon_linux(pcap_t *handle) 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. @@ -1013,7 +1081,7 @@ linux_if_drops(const char * if_name) 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; @@ -1028,7 +1096,7 @@ linux_if_drops(const char * if_name) 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) == ' ') && @@ -1042,20 +1110,20 @@ linux_if_drops(const char * if_name) 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; -} +} /* @@ -1099,7 +1167,7 @@ static void pcap_cleanup_linux( pcap_t *handle ) * 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, @@ -1163,7 +1231,7 @@ static void pcap_cleanup_linux( pcap_t *handle ) */ 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) { @@ -1177,10 +1245,8 @@ static void pcap_cleanup_linux( pcap_t *handle ) /* * 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) { /* @@ -1239,10 +1305,28 @@ pcap_activate_linux(pcap_t *handle) { 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; @@ -1274,12 +1358,12 @@ pcap_activate_linux(pcap_t *handle) 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 */ @@ -1295,16 +1379,17 @@ pcap_activate_linux(pcap_t *handle) * 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. @@ -1331,21 +1416,23 @@ pcap_activate_linux(pcap_t *handle) /* * 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; } } @@ -1353,7 +1440,6 @@ pcap_activate_linux(pcap_t *handle) /* * 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. @@ -1480,6 +1566,7 @@ pcap_read_packet(pcap_t *handle, pcap_handler callback, u_char *userdata) 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 @@ -1660,9 +1747,14 @@ pcap_read_packet(pcap_t *handle, pcap_handler callback, u_char *userdata) 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; } } @@ -1696,8 +1788,8 @@ pcap_read_packet(pcap_t *handle, pcap_handler callback, u_char *userdata) * * 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. */ @@ -1707,9 +1799,8 @@ pcap_read_packet(pcap_t *handle, pcap_handler callback, u_char *userdata) /* 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; } @@ -1832,7 +1923,7 @@ pcap_inject_linux(pcap_t *handle, const void *buf, size_t size) return (-1); } return (ret); -} +} /* * Get the statistics for the given packet capture handle. @@ -1870,8 +1961,8 @@ pcap_stats_linux(pcap_t *handle, struct pcap_stat *stats) #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) @@ -1901,7 +1992,7 @@ pcap_stats_linux(pcap_t *handle, struct pcap_stat *stats) * 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 @@ -1930,7 +2021,7 @@ pcap_stats_linux(pcap_t *handle, struct pcap_stat *stats) * "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. */ @@ -1976,16 +2067,87 @@ pcap_stats_linux(pcap_t *handle, struct pcap_stat *stats) * 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 @@ -1999,6 +2161,8 @@ pcap_stats_linux(pcap_t *handle, struct pcap_stat *stats) * 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) @@ -2008,10 +2172,6 @@ scan_sys_class_net(pcap_if_t **devlistp, char *errbuf) 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"); @@ -2089,66 +2249,10 @@ scan_sys_class_net(pcap_if_t **devlistp, char *errbuf) } /* - * 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; } @@ -2186,9 +2290,6 @@ scan_proc_net_dev(pcap_if_t **devlistp, char *errbuf) 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"); @@ -2237,65 +2338,10 @@ scan_proc_net_dev(pcap_if_t **devlistp, char *errbuf) 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; } @@ -2350,7 +2396,8 @@ pcap_platform_finddevs(pcap_if_t **alldevsp, char *errbuf) /* * 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); @@ -2373,7 +2420,7 @@ pcap_setfilter_linux_common(pcap_t *handle, struct bpf_program *filter, 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; } @@ -2416,12 +2463,13 @@ pcap_setfilter_linux_common(pcap_t *handle, struct bpf_program *filter, * 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)) { @@ -2507,8 +2555,14 @@ pcap_setfilter_linux_common(pcap_t *handle, struct bpf_program *filter, * 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()". @@ -2590,6 +2644,51 @@ map_packet_type_to_sll_type(short int sll_pkttype) } #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 @@ -2608,13 +2707,33 @@ map_packet_type_to_sll_type(short int sll_pkttype) * * 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 @@ -2623,21 +2742,27 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok) * 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 */ @@ -2946,7 +3071,9 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok) /* 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; @@ -2978,6 +3105,21 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok) 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; @@ -3006,6 +3148,10 @@ activate_new(pcap_t *handle) #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 @@ -3109,11 +3255,12 @@ activate_new(pcap_t *handle) 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))) { @@ -3183,7 +3330,8 @@ activate_new(pcap_t *handle) * 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; } @@ -3210,6 +3358,7 @@ activate_new(pcap_t *handle) /* * It doesn't support monitor mode. */ + close(sock_fd); return PCAP_ERROR_RFMON_NOTSUP; } @@ -3316,23 +3465,43 @@ activate_new(pcap_t *handle) 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; @@ -3352,7 +3521,7 @@ activate_new(pcap_t *handle) * 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; @@ -3413,6 +3582,9 @@ activate_mmap(pcap_t *handle, int *status) 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; @@ -3433,7 +3605,7 @@ activate_mmap(pcap_t *handle, int *status) return 1; } #else /* HAVE_PACKET_RING */ -static int +static int activate_mmap(pcap_t *handle _U_, int *status _U_) { return 0; @@ -3457,7 +3629,10 @@ init_tpacket(pcap_t *handle, int version, const char *version_str) 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 */ @@ -3496,6 +3671,36 @@ init_tpacket(pcap_t *handle, int version, const char *version_str) } #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 @@ -3513,11 +3718,10 @@ prepare_tpacket_socket(pcap_t *handle) 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. @@ -3526,28 +3730,87 @@ prepare_tpacket_socket(pcap_t *handle) * 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; } @@ -3591,6 +3854,7 @@ create_ring(pcap_t *handle, int *status) switch (handlep->tp_version) { case TPACKET_V1: + case TPACKET_V1_64: #ifdef HAVE_TPACKET2 case TPACKET_V2: #endif @@ -3718,18 +3982,24 @@ create_ring(pcap_t *handle, int *status) * 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; @@ -3770,7 +4040,7 @@ create_ring(pcap_t *handle, int *status) 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) { @@ -3827,8 +4097,8 @@ create_ring(pcap_t *handle, int *status) } if (setsockopt(handle->fd, SOL_PACKET, PACKET_TIMESTAMP, (void *)×ource, 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; @@ -3843,7 +4113,7 @@ retry: /* 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; @@ -3935,13 +4205,14 @@ destroy_ring(pcap_t *handle) /* 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; } } @@ -3975,7 +4246,7 @@ pcap_oneshot_mmap(u_char *user, const struct pcap_pkthdr *h, memcpy(handlep->oneshot_buffer, bytes, h->caplen); *sp->pkt = handlep->oneshot_buffer; } - + static void pcap_cleanup_linux_mmap( pcap_t *handle ) { @@ -4004,6 +4275,13 @@ pcap_setnonblock_mmap(pcap_t *p, int nonblock, char *errbuf) { 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. @@ -4037,6 +4315,11 @@ pcap_get_ring_frame(pcap_t *handle, int status) 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 : @@ -4181,7 +4464,8 @@ static int pcap_handle_packet_mmap( 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; @@ -4192,7 +4476,7 @@ static int pcap_handle_packet_mmap( 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; } @@ -4207,22 +4491,9 @@ static int pcap_handle_packet_mmap( * 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; @@ -4235,7 +4506,7 @@ static int pcap_handle_packet_mmap( */ 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 @@ -4260,7 +4531,30 @@ static int pcap_handle_packet_mmap( 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; @@ -4277,7 +4571,7 @@ static int pcap_handle_packet_mmap( 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; @@ -4337,6 +4631,7 @@ pcap_read_linux_mmap_v1(pcap_t *handle, int max_packets, pcap_handler callback, h.h1->tp_sec, h.h1->tp_usec, 0, + 0, 0); if (ret == 1) { pkts++; @@ -4376,6 +4671,80 @@ pcap_read_linux_mmap_v1(pcap_t *handle, int max_packets, pcap_handler callback, 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, @@ -4415,7 +4784,8 @@ pcap_read_linux_mmap_v2(pcap_t *handle, int max_packets, pcap_handler callback, #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++; @@ -4465,6 +4835,7 @@ pcap_read_linux_mmap_v3(pcap_t *handle, int max_packets, pcap_handler callback, int pkts = 0; int ret; +again: if (handlep->current_packet == NULL) { /* wait for frames availability.*/ ret = pcap_wait_for_frames_mmap(handle); @@ -4473,8 +4844,13 @@ pcap_read_linux_mmap_v3(pcap_t *handle, int max_packets, pcap_handler callback, } } 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 */ @@ -4510,7 +4886,8 @@ pcap_read_linux_mmap_v3(pcap_t *handle, int max_packets, pcap_handler callback, #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++; @@ -4555,11 +4932,15 @@ pcap_read_linux_mmap_v3(pcap_t *handle, int max_packets, pcap_handler callback, 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; @@ -4652,7 +5033,7 @@ iface_get_id(int fd, const char *device, char *ebuf) 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, @@ -4734,13 +5115,15 @@ has_wext(int sock_fd, const char *device, char *ebuf) { 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; @@ -4872,9 +5255,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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; @@ -5075,9 +5457,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) /* * 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. @@ -5132,12 +5513,11 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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, IFNAMSIZ); + memcpy(ireq.u.name, args, sizeof (int)); if (ioctl(sock_fd, cmd, &ireq) != -1) { /* * Success. @@ -5165,7 +5545,7 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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)); @@ -5185,9 +5565,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) /* * 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) { /* @@ -5225,9 +5604,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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) @@ -5237,9 +5615,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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) @@ -5249,9 +5626,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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); @@ -5268,9 +5644,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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); @@ -5281,9 +5656,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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, @@ -5297,9 +5671,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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)); @@ -5312,9 +5685,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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); @@ -5325,9 +5697,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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); @@ -5338,9 +5709,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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; @@ -5352,9 +5722,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) * 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); @@ -5436,6 +5805,121 @@ enter_rfmon_mode(pcap_t *handle, int sock_fd, const char *device) 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. * @@ -5446,13 +5930,13 @@ enter_rfmon_mode(pcap_t *handle, int sock_fd, const char *device) */ #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; @@ -5467,11 +5951,11 @@ iface_ethtool_ioctl(pcap_t *handle, int cmd, const char *cmdname) 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 @@ -5480,7 +5964,7 @@ iface_get_offload(pcap_t *handle) 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) @@ -5488,7 +5972,7 @@ iface_get_offload(pcap_t *handle) #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) @@ -5501,7 +5985,7 @@ iface_get_offload(pcap_t *handle) * 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) @@ -5509,7 +5993,7 @@ iface_get_offload(pcap_t *handle) #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) @@ -5522,7 +6006,7 @@ iface_get_offload(pcap_t *handle) * 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) @@ -5543,6 +6027,8 @@ iface_get_offload(pcap_t *handle _U_) } #endif /* SIOCETHTOOL */ +#endif /* HAVE_PACKET_RING */ + #endif /* HAVE_PF_PACKET_SOCKETS */ /* ===== Functions to interface to the older kernels ================== */ @@ -5590,7 +6076,7 @@ activate_old(pcap_t *handle) /* 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; } @@ -5608,7 +6094,7 @@ activate_old(pcap_t *handle) * 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); @@ -5619,7 +6105,7 @@ activate_old(pcap_t *handle) 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)); @@ -5757,7 +6243,7 @@ iface_bind_old(int fd, const char *device, char *ebuf) 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)); @@ -5796,7 +6282,7 @@ iface_get_mtu(int fd, const char *device, char *ebuf) 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, @@ -5816,7 +6302,7 @@ iface_get_arptype(int fd, const char *device, char *ebuf) 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, @@ -5883,18 +6369,19 @@ fix_program(pcap_t *handle, struct sock_fprog *fcode, int is_mmapped) * 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; @@ -6027,20 +6514,40 @@ set_kernel_filter(pcap_t *handle, struct sock_fprog *fcode) * "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; } } @@ -6063,11 +6570,16 @@ set_kernel_filter(pcap_t *handle, struct sock_fprog *fcode) 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/libpcap/pcap-namedb.h b/libpcap/pcap-namedb.h index d0b223108..d5908c920 100644 --- a/libpcap/pcap-namedb.h +++ b/libpcap/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/libpcap/pcap-netfilter-linux.c b/libpcap/pcap-netfilter-linux.c index aa8edbba7..3ee6faa3b 100644 --- a/libpcap/pcap-netfilter-linux.c +++ b/libpcap/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 /* 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 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c 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 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c 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 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c 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 @@ netfilter_inject_linux(pcap_t *handle, const void *buf, size_t size) { 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 @@ netfilter_send_config_msg(const pcap_t *handle, u_int16_t msg_type, int ack, u_i struct sockaddr_nl snl; static unsigned int seq_id; - + if (!seq_id) seq_id = time(NULL); ++seq_id; @@ -342,7 +344,7 @@ nflog_send_config_cmd(const pcap_t *handle, u_int16_t group_id, u_int8_t cmd, u_ 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 @@ nfqueue_send_config_cmd(const pcap_t *handle, u_int16_t group_id, u_int8_t cmd, 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 @@ netfilter_activate(pcap_t* handle) dev += strlen(NFQUEUE_IFACE); type = NFQUEUE; } - + if (type != OTHER && *dev == ':') { dev++; while (*dev) { @@ -438,7 +440,7 @@ netfilter_activate(pcap_t* handle) 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 @@ netfilter_activate(pcap_t* handle) 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 @@ netfilter_create(const char *device, char *ebuf, int *is_ours) /* 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 @@ netfilter_create(const char *device, char *ebuf, int *is_ours) 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/libpcap/pcap-netfilter-linux.h b/libpcap/pcap-netfilter-linux.h index 882a40219..01d9b394f 100644 --- a/libpcap/pcap-netfilter-linux.h +++ b/libpcap/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/libpcap/pcap-nit.c b/libpcap/pcap-nit.c index 40e640cdc..a8355f9d6 100644 --- a/libpcap/pcap-nit.c +++ b/libpcap/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 @@ pcap_inject_nit(pcap_t *p, const void *buf, size_t size) return (-1); } return (ret); -} +} static int nit_setflags(pcap_t *p) diff --git a/libpcap/pcap-null.c b/libpcap/pcap-null.c index 673738685..934fb2cc0 100644 --- a/libpcap/pcap-null.c +++ b/libpcap/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/libpcap/pcap-pf.c b/libpcap/pcap-pf.c index 8de6e58f6..e03b2ed1f 100644 --- a/libpcap/pcap-pf.c +++ b/libpcap/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 @@ pcap_inject_pf(pcap_t *p, const void *buf, size_t size) return (-1); } return (ret); -} +} static int pcap_stats_pf(pcap_t *p, struct pcap_stat *ps) diff --git a/libpcap/pcap-savefile.manfile.in b/libpcap/pcap-savefile.manfile.in index c20e003a8..622f6c6e7 100644 --- a/libpcap/pcap-savefile.manfile.in +++ b/libpcap/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/libpcap/pcap-septel.c b/libpcap/pcap-septel.c index 4ca7a6056..61cd2f577 100644 --- a/libpcap/pcap-septel.c +++ b/libpcap/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 @@ septel_inject(pcap_t *handle, const void *buf _U_, size_t size _U_) * 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 @@ static int septel_stats(pcap_t *p, struct pcap_stat *ps) { 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 @@ static int septel_stats(pcap_t *p, struct pcap_stat *ps) { 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/libpcap/pcap-septel.h b/libpcap/pcap-septel.h index b72f35bc4..b6e1168b0 100644 --- a/libpcap/pcap-septel.h +++ b/libpcap/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/libpcap/pcap-sita.c b/libpcap/pcap-sita.c index 7ab801ece..b35b106e5 100644 --- a/libpcap/pcap-sita.c +++ b/libpcap/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 @@ static int read_client_nbytes(int fd, int count, unsigned char *buf) { 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 @@ static void empty_unit(int chassis, int geoslot) { 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 @@ static void sort_if_table(void) { } 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/libpcap/pcap-sita.h b/libpcap/pcap-sita.h index b232ee2c3..9c35c6ac1 100644 --- a/libpcap/pcap-sita.h +++ b/libpcap/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/libpcap/pcap-snf.c b/libpcap/pcap-snf.c index ee6ffa4dc..03dc08def 100644 --- a/libpcap/pcap-snf.c +++ b/libpcap/pcap-snf.c @@ -16,6 +16,9 @@ #include #include +#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 @@ static int 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 @@ snf_platform_cleanup(pcap_t *p) 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 @@ snf_setnonblock(pcap_t *p, int nonblock, char *errbuf) 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 @@ snf_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ snf_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) } } - 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 @@ snf_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ snf_setfilter(pcap_t *p, struct bpf_program *fp) 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 @@ snf_activate(pcap_t* p) 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 @@ snf_activate(pcap_t* p) /* 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 @@ snf_activate(pcap_t* p) 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 @@ snf_activate(pcap_t* p) 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 @@ snf_create(const char *device, char *ebuf, int *is_ours) 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/libpcap/pcap-snit.c b/libpcap/pcap-snit.c index 12656b8e5..0ce786030 100644 --- a/libpcap/pcap-snit.c +++ b/libpcap/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 @@ static int pcap_inject_snit(pcap_t *p, const void *buf, size_t size) { struct strbuf ctl, data; - + /* * XXX - can we just do * diff --git a/libpcap/pcap-snoop.c b/libpcap/pcap-snoop.c index a49db87f0..f622f31fa 100644 --- a/libpcap/pcap-snoop.c +++ b/libpcap/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 @@ again: 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 @@ pcap_inject_snoop(pcap_t *p, const void *buf, size_t size) return (-1); } return (ret); -} +} static int pcap_stats_snoop(pcap_t *p, struct pcap_stat *ps) diff --git a/libpcap/pcap-stdinc.h b/libpcap/pcap-stdinc.h index f1c736e50..f70dcce86 100644 --- a/libpcap/pcap-stdinc.h +++ b/libpcap/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 - #include - -#include "bittypes.h" #include #include -#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 -#else /*__MINGW32__*/ -/* MSVC compiler */ -#ifndef _UINTPTR_T_DEFINED -#ifdef _WIN64 -typedef unsigned __int64 uintptr_t; + #include #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 _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 #endif /*__MINGW32__*/ + #endif /* pcap_stdinc_h */ diff --git a/libpcap/pcap-tstamp.manmisc.in b/libpcap/pcap-tstamp.manmisc.in index 2cd32c621..74a9a35d0 100644 --- a/libpcap/pcap-tstamp.manmisc.in +++ b/libpcap/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 @@ The time stamp types are listed here; the first value is the #define to 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 @@ precision of this time stamp is unspecified; it might or might not be 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 @@ Time stamp provided by the network adapter on which the capture is being 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/libpcap/pcap-usb-linux.c b/libpcap/pcap-usb-linux.c index f0892a7bd..957273a87 100644 --- a/libpcap/pcap-usb-linux.c +++ b/libpcap/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 * */ -#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 int usb_setdirection_linux(pcap_t *, pcap_direction_t); 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 @@ usb_findalldevs(pcap_if_t **alldevsp, char *err_str) 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 @@ usb_findalldevs(pcap_if_t **alldevsp, char *err_str) 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 @@ usb_findalldevs(pcap_if_t **alldevsp, char *err_str) 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 @@ int usb_mmap(pcap_t* handle) 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 @@ probe_devices(int bus) 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 @@ probe_devices(int bus) } closedir(dir); } +#endif /* HAVE_LINUX_USBDEVICE_FS_H */ pcap_t * usb_create(const char *device, char *ebuf, int *is_ours) @@ -364,7 +363,7 @@ usb_activate(pcap_t* handle) } /*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 @@ usb_activate(pcap_t* handle) 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 @@ usb_activate(pcap_t* handle) /* 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 @@ usb_activate(pcap_t* handle) * 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 @@ usb_activate(pcap_t* handle) 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 /Documentation/usb/usbmon.txt and - * /drivers/usb/mon/mon_text.c for urb string + * see /Documentation/usb/usbmon.txt and + * /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 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u 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, ×tamp, &etype, - &pipeid1, &pipeid2, &dev_addr, &ep_num, status, + ret = sscanf(string, "%x %d %c %c%c:%d:%d %s%n", &tag, ×tamp, &etype, + &pipeid1, &pipeid2, &dev_addr, &ep_num, status, &cnt); if (ret < 8) { @@ -518,10 +521,10 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u 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 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u 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 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u uhdr->setup_flag = 0; } - else + else uhdr->setup_flag = 1; /* read urb data */ @@ -602,7 +605,7 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u } 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 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u return -1; } - if (urb_tag != '=') + if (urb_tag != '=') goto got; /* skip urb tag and following space */ @@ -628,7 +631,7 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u /* 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 @@ usb_inject_linux(pcap_t *handle, const void *buf, size_t size) 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 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) } 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 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) /* 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 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) 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 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) return 0; } -static int +static int usb_setdirection_linux(pcap_t *p, pcap_direction_t d) { p->direction = d; @@ -751,7 +754,7 @@ usb_setdirection_linux(pcap_t *p, pcap_direction_t d) } -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 @@ usb_stats_linux_bin(pcap_t *handle, struct pcap_stat *stats) } /* - * see /Documentation/usb/usbmon.txt and + * see /Documentation/usb/usbmon.txt and * /drivers/usb/mon/mon_bin.c binary ABI */ static int @@ -830,7 +833,7 @@ usb_read_linux_bin(pcap_t *handle, int max_packets, pcap_handler callback, u_cha } /* - * see /Documentation/usb/usbmon.txt and + * see /Documentation/usb/usbmon.txt and * /drivers/usb/mon/mon_bin.c binary ABI */ #define VEC_SIZE 32 @@ -884,7 +887,7 @@ usb_read_linux_mmap(pcap_t *handle, int max_packets, pcap_handler callback, u_ch for (i=0; immapbuf[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 @@ usb_read_linux_mmap(pcap_t *handle, int max_packets, pcap_handler callback, u_ch } /* 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/libpcap/pcap-usb-linux.h b/libpcap/pcap-usb-linux.h index d64386dbb..234a262f9 100644 --- a/libpcap/pcap-usb-linux.h +++ b/libpcap/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 - * - * @(#) $Header: /tcpdump/master/libpcap/pcap-usb-linux.h,v 1.5 2008-04-04 19:37:45 guy Exp $ (LBL) */ /* diff --git a/libpcap/pcap-win32.c b/libpcap/pcap-win32.c index 87b3fc6ac..f449f7965 100644 --- a/libpcap/pcap-win32.c +++ b/libpcap/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 #include #ifdef __MINGW32__ @@ -77,6 +72,8 @@ static int pcap_setnonblock_win32(pcap_t *, int, char *); 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 @@ BOOL WINAPI DllMain( } /* 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 @@ pcap_read_win32_npf(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ pcap_read_win32_npf(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ pcap_read_win32_npf(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* * 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 @@ pcap_read_win32_npf(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* 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 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* 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 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) { caplen = packet_len; } - + break; } - + if(caplen > p->snapshot) caplen = p->snapshot; @@ -365,14 +395,14 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) * 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_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) 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 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) } } 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 @@ pcap_activate_win32(pcap_t *p) 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 @@ pcap_activate_win32(pcap_t *p) 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 @@ pcap_activate_win32(pcap_t *p) } /* Set promiscuous mode */ - if (p->opt.promisc) + if (p->opt.promisc) { if (PacketSetHwFilter(p->adapter,NDIS_PACKET_TYPE_PROMISCUOUS) == FALSE) @@ -596,7 +626,7 @@ pcap_activate_win32(pcap_t *p) goto bad; } } - else + else { if (PacketSetHwFilter(p->adapter,NDIS_PACKET_TYPE_ALL_LOCAL) == FALSE) { @@ -617,8 +647,8 @@ pcap_activate_win32(pcap_t *p) 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 @@ pcap_activate_win32(pcap_t *p) 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 @@ pcap_activate_win32(pcap_t *p) else #ifdef HAVE_DAG_API { - /* - * Dag Card + /* + * Dag Card */ LONG status; HKEY dagkey; @@ -673,8 +703,8 @@ pcap_activate_win32(pcap_t *p) 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 @@ pcap_activate_win32(pcap_t *p) 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,16 +824,51 @@ pcap_create_interface(const char *device, char *ebuf) 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 @@ -817,23 +882,23 @@ pcap_setfilter_win32_npf(pcap_t *p, struct bpf_program *fp) /* * 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/libpcap/pcap.3pcap.in b/libpcap/pcap.3pcap.in index 1408deb23..c02ac43ef 100644 --- a/libpcap/pcap.3pcap.in +++ b/libpcap/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 @@ arbitrarily long period of time. .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 @@ open a .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 @@ get name for a time stamp type .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 @@ bytes of the packet on success, and NULL on error. .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 @@ for packets to become available. On some, but 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 @@ Non-blocking mode is often combined with routines such as .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 @@ will return \-1 if no such descriptor exists. In addition, for various 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 @@ get a string for an error or warning status code .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/libpcap/pcap.c b/libpcap/pcap.c index 6b16ceab6..4e9c94a72 100644 --- a/libpcap/pcap.c +++ b/libpcap/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 @@ static const char rcsid[] _U_ = #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 @@ static const char rcsid[] _U_ = #include "pcap-dbus.h" #endif -int +int pcap_not_initialized(pcap_t *pcap _U_) { /* this means 'not initialized' */ @@ -221,7 +220,7 @@ pcap_next(pcap_t *p, struct pcap_pkthdr *h) 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_findalldevs(pcap_if_t **alldevsp, char *errbuf) 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_findalldevs(pcap_if_t **alldevsp, char *errbuf) 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_findalldevs(pcap_if_t **alldevsp, char *errbuf) 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 @@ struct capture_source_type { #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 @@ pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf) /* * Get the list of regular interfaces first. - */ + */ if (pcap_findalldevs_interfaces(alldevsp, errbuf) == -1) return (-1); /* failure */ @@ -392,6 +397,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf) return (-1); } } + return (0); } @@ -506,7 +512,7 @@ pcap_alloc_pcap_t(char *ebuf, size_t size) #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 @@ pcap_create_common(const char *source, char *ebuf, size_t size) 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 @@ static struct dlt_choice dlt_choices[] = { 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 @@ static struct dlt_choice dlt_choices[] = { 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 @@ pcap_setnonblock_fd(pcap_t *p, int nonblock, char *errbuf) #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 @@ pcap_open_dead_with_tstamp_precision(int linktype, int snaplen, u_int precision) 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 @@ pcap_offline_filter(const struct bpf_program *fp, const struct pcap_pkthdr *h, { 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/libpcap/pcap.h b/libpcap/pcap.h index 490a4bfb4..174e32d25 100644 --- a/libpcap/pcap.h +++ b/libpcap/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/libpcap/pcap/bluetooth.h b/libpcap/pcap/bluetooth.h index 813bea347..01bd5a2e9 100644 --- a/libpcap/pcap/bluetooth.h +++ b/libpcap/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 - * - * @(#) $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/libpcap/pcap/bpf.h b/libpcap/pcap/bpf.h index ad36eb618..215d5ca03 100644 --- a/libpcap/pcap/bpf.h +++ b/libpcap/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 * , 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 @@ typedef u_int bpf_u_int32; #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 @@ struct bpf_program { u_int bf_len; struct bpf_insn *bf_insns; }; - + /* * Link-layer header type codes. * @@ -430,7 +429,7 @@ struct bpf_program { */ #define DLT_SUNATM 123 /* Solaris+SunATM */ -/* +/* * Reserved as per request from Kent Dahlgren * for private use. */ @@ -673,7 +672,7 @@ struct bpf_program { /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * 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 @@ struct bpf_program { /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for internal communication with a * voice Adapter Card (PIC) */ @@ -765,7 +764,7 @@ struct bpf_program { /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for internal communication with a * integrated service module (ISM). */ @@ -808,7 +807,7 @@ struct bpf_program { /* * Juniper-private data link type, as per request from - * Hannes Gredler . + * Hannes Gredler . * The DLT_ is used for capturing data on a secure tunnel interface. */ #define DLT_JUNIPER_ST 200 @@ -900,11 +899,11 @@ struct bpf_program { */ #define DLT_IEEE802_15_4_NONASK_PHY 215 -/* +/* * David Gibson 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 @@ struct bpf_program { #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 @@ -1213,7 +1212,7 @@ struct bpf_program { /* * 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 @@ struct bpf_program { */ #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 , formats for Zwave captures. + */ +#define DLT_ZWAVE_R1_R2 261 +#define DLT_ZWAVE_R3 262 + +/* + * per Steve Karg , 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 @@ struct bpf_program { /* * 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 @@ struct bpf_program { #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 @@ struct bpf_program { #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 @@ struct bpf_program { #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 @@ struct bpf_program { /* 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. @@ -1312,6 +1476,16 @@ struct bpf_insn { bpf_u_int32 k; }; +/* + * 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. */ @@ -1321,9 +1495,11 @@ struct bpf_insn { #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/libpcap/pcap/namedb.h b/libpcap/pcap/namedb.h index e31455791..d3a343225 100644 --- a/libpcap/pcap/namedb.h +++ b/libpcap/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/libpcap/pcap/nflog.h b/libpcap/pcap/nflog.h new file mode 100644 index 000000000..388dd0c55 --- /dev/null +++ b/libpcap/pcap/nflog.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2013, Petar Alilovic, + * Faculty of Electrical Engineering and Computing, University of Zagreb + * All rights reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + */ + +#ifndef _PCAP_NFLOG_H__ +#define _PCAP_NFLOG_H__ + +/* + * Structure of an NFLOG header and TLV parts, as described at + * http://www.tcpdump.org/linktypes/LINKTYPE_NFLOG.html + * + * The NFLOG header is big-endian. + * + * The TLV length and type are in host byte order. The value is either + * big-endian or is an array of bytes in some externally-specified byte + * order (text string, link-layer address, link-layer header, packet + * data, etc.). + */ +typedef struct nflog_hdr { + u_int8_t nflog_family; /* address family */ + u_int8_t nflog_version; /* version */ + u_int16_t nflog_rid; /* resource ID */ +} nflog_hdr_t; + +typedef struct nflog_tlv { + u_int16_t tlv_length; /* tlv length */ + u_int16_t tlv_type; /* tlv type */ + /* value follows this */ +} nflog_tlv_t; + +typedef struct nflog_packet_hdr { + u_int16_t hw_protocol; /* hw protocol */ + u_int8_t hook; /* netfilter hook */ + u_int8_t pad; /* padding to 32 bits */ +} nflog_packet_hdr_t; + +typedef struct nflog_hwaddr { + u_int16_t hw_addrlen; /* address length */ + u_int16_t pad; /* padding to 32-bit boundary */ + u_int8_t hw_addr[8]; /* address, up to 8 bytes */ +} nflog_hwaddr_t; + +typedef struct nflog_timestamp { + u_int64_t sec; + u_int64_t usec; +} nflog_timestamp_t; + +/* + * TLV types. + */ +#define NFULA_PACKET_HDR 1 /* nflog_packet_hdr_t */ +#define NFULA_MARK 2 /* packet mark from skbuff */ +#define NFULA_TIMESTAMP 3 /* nflog_timestamp_t for skbuff's time stamp */ +#define NFULA_IFINDEX_INDEV 4 /* ifindex of device on which packet received (possibly bridge group) */ +#define NFULA_IFINDEX_OUTDEV 5 /* ifindex of device on which packet transmitted (possibly bridge group) */ +#define NFULA_IFINDEX_PHYSINDEV 6 /* ifindex of physical device on which packet received (not bridge group) */ +#define NFULA_IFINDEX_PHYSOUTDEV 7 /* ifindex of physical device on which packet transmitted (not bridge group) */ +#define NFULA_HWADDR 8 /* nflog_hwaddr_t for hardware address */ +#define NFULA_PAYLOAD 9 /* packet payload */ +#define NFULA_PREFIX 10 /* text string - null-terminated, count includes NUL */ +#define NFULA_UID 11 /* UID owning socket on which packet was sent/received */ +#define NFULA_SEQ 12 /* sequence number of packets on this NFLOG socket */ +#define NFULA_SEQ_GLOBAL 13 /* sequence number of pakets on all NFLOG sockets */ +#define NFULA_GID 14 /* GID owning socket on which packet was sent/received */ +#define NFULA_HWTYPE 15 /* ARPHRD_ type of skbuff's device */ +#define NFULA_HWHEADER 16 /* skbuff's MAC-layer header */ +#define NFULA_HWLEN 17 /* length of skbuff's MAC-layer header */ + +#endif diff --git a/libpcap/pcap/pcap.h b/libpcap/pcap/pcap.h index f2dd2d612..c9fab4c11 100644 --- a/libpcap/pcap/pcap.h +++ b/libpcap/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 @@ struct pcap_file_header { /* * 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 @@ struct pcap_if { }; #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 @@ int pcap_fileno(pcap_t *); 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 @@ void pcap_freealldevs(pcap_if_t *); 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 , with a * different signature, but, on other BSD-flavored UN*Xes, it's not * declared in , 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/libpcap/pcap/sll.h b/libpcap/pcap/sll.h index 7ad811d7c..38da29f50 100644 --- a/libpcap/pcap/sll.h +++ b/libpcap/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/libpcap/pcap/usb.h b/libpcap/pcap/usb.h index aa3512258..83955271f 100644 --- a/libpcap/pcap/usb.h +++ b/libpcap/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 - * - * @(#) $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/libpcap/pcap/vlan.h b/libpcap/pcap/vlan.h index 41aa8c786..021f61290 100644 --- a/libpcap/pcap/vlan.h +++ b/libpcap/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/libpcap/pcap_activate.3pcap b/libpcap/pcap_activate.3pcap index f963d35e5..61887a7be 100644 --- a/libpcap/pcap_activate.3pcap +++ b/libpcap/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/libpcap/pcap_breakloop.3pcap b/libpcap/pcap_breakloop.3pcap index e437af8a8..6744924d0 100644 --- a/libpcap/pcap_breakloop.3pcap +++ b/libpcap/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 @@ If \-2 is returned from .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/libpcap/pcap_can_set_rfmon.3pcap b/libpcap/pcap_can_set_rfmon.3pcap index 00b92a403..b5798046d 100644 --- a/libpcap/pcap_can_set_rfmon.3pcap +++ b/libpcap/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/libpcap/pcap_close.3pcap b/libpcap/pcap_close.3pcap index 810664dbd..91eb677ef 100644 --- a/libpcap/pcap_close.3pcap +++ b/libpcap/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/libpcap/pcap_compile.3pcap.in b/libpcap/pcap_compile.3pcap.in index 7dbdad5a1..0e5276a16 100644 --- a/libpcap/pcap_compile.3pcap.in +++ b/libpcap/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/libpcap/pcap_create.3pcap b/libpcap/pcap_create.3pcap index 153f9fd69..5c537fc55 100644 --- a/libpcap/pcap_create.3pcap +++ b/libpcap/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/libpcap/pcap_datalink.3pcap.in b/libpcap/pcap_datalink.3pcap.in index 51d5d66da..b07fc28f0 100644 --- a/libpcap/pcap_datalink.3pcap.in +++ b/libpcap/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/libpcap/pcap_datalink_name_to_val.3pcap b/libpcap/pcap_datalink_name_to_val.3pcap index 9c8e18a3c..4bc1728a0 100644 --- a/libpcap/pcap_datalink_name_to_val.3pcap +++ b/libpcap/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 @@ removed, to the corresponding link-layer header type value. The 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/libpcap/pcap_datalink_val_to_name.3pcap b/libpcap/pcap_datalink_val_to_name.3pcap index 5acba7763..0b178253d 100644 --- a/libpcap/pcap_datalink_val_to_name.3pcap +++ b/libpcap/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/libpcap/pcap_dump.3pcap b/libpcap/pcap_dump.3pcap index 1ccd82a6f..95f3040a3 100644 --- a/libpcap/pcap_dump.3pcap +++ b/libpcap/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 @@ Note that its calling arguments are suitable for use with .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/libpcap/pcap_dump_close.3pcap b/libpcap/pcap_dump_close.3pcap index 4ed820b03..afd00cb49 100644 --- a/libpcap/pcap_dump_close.3pcap +++ b/libpcap/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/libpcap/pcap_dump_file.3pcap b/libpcap/pcap_dump_file.3pcap index 9e51a2a98..982b0dc9d 100644 --- a/libpcap/pcap_dump_file.3pcap +++ b/libpcap/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/libpcap/pcap_dump_flush.3pcap b/libpcap/pcap_dump_flush.3pcap index b553883aa..ba98dee1d 100644 --- a/libpcap/pcap_dump_flush.3pcap +++ b/libpcap/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/libpcap/pcap_dump_ftell.3pcap b/libpcap/pcap_dump_ftell.3pcap index 1d0f96f35..6d5c82805 100644 --- a/libpcap/pcap_dump_ftell.3pcap +++ b/libpcap/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/libpcap/pcap_dump_open.3pcap.in b/libpcap/pcap_dump_open.3pcap.in index 2a5dc9de1..0b2e3c629 100644 --- a/libpcap/pcap_dump_open.3pcap.in +++ b/libpcap/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 @@ pcap_dump_open, pcap_dump_fopen \- open a file to which to write packets .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 @@ the same format as those used by .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 @@ or returned by an earlier call to .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/libpcap/pcap_file.3pcap b/libpcap/pcap_file.3pcap index 1471ab63c..7b18c81dc 100644 --- a/libpcap/pcap_file.3pcap +++ b/libpcap/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/libpcap/pcap_fileno.3pcap b/libpcap/pcap_fileno.3pcap index 723733e73..39d068b44 100644 --- a/libpcap/pcap_fileno.3pcap +++ b/libpcap/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/libpcap/pcap_findalldevs.3pcap b/libpcap/pcap_findalldevs.3pcap index 2e56d0916..00bb911f9 100644 --- a/libpcap/pcap_findalldevs.3pcap +++ b/libpcap/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 @@ device flags: .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 @@ for IPv6 addresses, it can be interpreted as if it pointed to a .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/libpcap/pcap_freecode.3pcap b/libpcap/pcap_freecode.3pcap index 31b4f8971..c3c3ea6e0 100644 --- a/libpcap/pcap_freecode.3pcap +++ b/libpcap/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/libpcap/pcap_get_selectable_fd.3pcap b/libpcap/pcap_get_selectable_fd.3pcap index ae33dbb2e..6640577ea 100644 --- a/libpcap/pcap_get_selectable_fd.3pcap +++ b/libpcap/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 @@ int pcap_get_selectable_fd(pcap_t *p); 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 @@ or (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/libpcap/pcap_geterr.3pcap b/libpcap/pcap_geterr.3pcap index 1a4ea3476..fcabec3b5 100644 --- a/libpcap/pcap_geterr.3pcap +++ b/libpcap/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/libpcap/pcap_inject.3pcap b/libpcap/pcap_inject.3pcap index 79a3eea6d..7ccdf2c50 100644 --- a/libpcap/pcap_inject.3pcap +++ b/libpcap/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/libpcap/pcap_is_swapped.3pcap b/libpcap/pcap_is_swapped.3pcap index 29646d12e..a120616d3 100644 --- a/libpcap/pcap_is_swapped.3pcap +++ b/libpcap/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/libpcap/pcap_lib_version.3pcap b/libpcap/pcap_lib_version.3pcap index 7b39be181..3ec2e32d5 100644 --- a/libpcap/pcap_lib_version.3pcap +++ b/libpcap/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/libpcap/pcap_list_datalinks.3pcap.in b/libpcap/pcap_list_datalinks.3pcap.in index 9dfb3422a..f8493466c 100644 --- a/libpcap/pcap_list_datalinks.3pcap.in +++ b/libpcap/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 @@ is used to get a list of the supported link-layer header types of the 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/libpcap/pcap_lookupdev.3pcap b/libpcap/pcap_lookupdev.3pcap index 8b23cb870..79dda429e 100644 --- a/libpcap/pcap_lookupdev.3pcap +++ b/libpcap/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/libpcap/pcap_lookupnet.3pcap b/libpcap/pcap_lookupnet.3pcap index 75c82cfc7..a3d14ae7f 100644 --- a/libpcap/pcap_lookupnet.3pcap +++ b/libpcap/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/libpcap/pcap_loop.3pcap b/libpcap/pcap_loop.3pcap index c2ba33c23..011d85c72 100644 --- a/libpcap/pcap_loop.3pcap +++ b/libpcap/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 @@ causes all the packets received in one buffer to be processed when 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/libpcap/pcap_major_version.3pcap b/libpcap/pcap_major_version.3pcap index 31903dcfd..a0858380c 100644 --- a/libpcap/pcap_major_version.3pcap +++ b/libpcap/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/libpcap/pcap_next_ex.3pcap b/libpcap/pcap_next_ex.3pcap index c1de33b2c..c310c2f00 100644 --- a/libpcap/pcap_next_ex.3pcap +++ b/libpcap/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 @@ -115,9 +113,9 @@ for Ethernet. .SH RETURN VALUE .B pcap_next_ex() returns 1 if the packet was read without problems, 0 -if packets are being read from a live capture, and the timeout expired, +if packets are being read from a live capture and the timeout expired, \-1 if an error occurred while reading the packet, and \-2 if -packets are being read from a ``savefile'', and there are no more +packets are being read from a ``savefile'' and there are no more packets to read from the savefile. If \-1 is returned, .B pcap_geterr() diff --git a/libpcap/pcap_offline_filter.3pcap b/libpcap/pcap_offline_filter.3pcap index 3f11022d5..b471c6a74 100644 --- a/libpcap/pcap_offline_filter.3pcap +++ b/libpcap/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/libpcap/pcap_open_dead.3pcap.in b/libpcap/pcap_open_dead.3pcap.in index 812946b0f..2d1b48cca 100644 --- a/libpcap/pcap_open_dead.3pcap.in +++ b/libpcap/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/libpcap/pcap_open_live.3pcap b/libpcap/pcap_open_live.3pcap index 0889a2a25..715994b0f 100644 --- a/libpcap/pcap_open_live.3pcap +++ b/libpcap/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/libpcap/pcap_open_offline.3pcap.in b/libpcap/pcap_open_offline.3pcap.in index d38608d47..72397298d 100644 --- a/libpcap/pcap_open_offline.3pcap.in +++ b/libpcap/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 @@ and .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/libpcap/pcap_set_buffer_size.3pcap b/libpcap/pcap_set_buffer_size.3pcap index 060e923e8..fea1df74a 100644 --- a/libpcap/pcap_set_buffer_size.3pcap +++ b/libpcap/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/libpcap/pcap_set_datalink.3pcap b/libpcap/pcap_set_datalink.3pcap index 9af32d069..60a7bfc81 100644 --- a/libpcap/pcap_set_datalink.3pcap +++ b/libpcap/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/libpcap/pcap_set_promisc.3pcap b/libpcap/pcap_set_promisc.3pcap index 382260c74..5d1757275 100644 --- a/libpcap/pcap_set_promisc.3pcap +++ b/libpcap/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/libpcap/pcap_set_rfmon.3pcap b/libpcap/pcap_set_rfmon.3pcap index ee7355686..a386e8b1f 100644 --- a/libpcap/pcap_set_rfmon.3pcap +++ b/libpcap/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/libpcap/pcap_set_snaplen.3pcap b/libpcap/pcap_set_snaplen.3pcap index 74195d936..8080ea129 100644 --- a/libpcap/pcap_set_snaplen.3pcap +++ b/libpcap/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/libpcap/pcap_set_timeout.3pcap b/libpcap/pcap_set_timeout.3pcap index 0b66f21e9..b7282037b 100644 --- a/libpcap/pcap_set_timeout.3pcap +++ b/libpcap/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 @@ sets the read timeout that will be used on a capture handle when 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/libpcap/pcap_set_tstamp_precision.3pcap.in b/libpcap/pcap_set_tstamp_precision.3pcap.in index 053a4c6bc..85fa84dc5 100644 --- a/libpcap/pcap_set_tstamp_precision.3pcap.in +++ b/libpcap/pcap_set_tstamp_precision.3pcap.in @@ -48,7 +48,7 @@ use options .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/libpcap/pcap_set_tstamp_type.3pcap.in b/libpcap/pcap_set_tstamp_type.3pcap.in index 261c31520..fd673bd4f 100644 --- a/libpcap/pcap_set_tstamp_type.3pcap.in +++ b/libpcap/pcap_set_tstamp_type.3pcap.in @@ -52,7 +52,7 @@ for a list of all the time stamp types. 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/libpcap/pcap_setdirection.3pcap b/libpcap/pcap_setdirection.3pcap index bd0fb253e..871a5b04a 100644 --- a/libpcap/pcap_setdirection.3pcap +++ b/libpcap/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 used to specify a direction that packets will be captured. 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/libpcap/pcap_setfilter.3pcap b/libpcap/pcap_setfilter.3pcap index 89d5da7f7..c737797f3 100644 --- a/libpcap/pcap_setfilter.3pcap +++ b/libpcap/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/libpcap/pcap_setnonblock.3pcap b/libpcap/pcap_setnonblock.3pcap index b00fce100..a99ea076e 100644 --- a/libpcap/pcap_setnonblock.3pcap +++ b/libpcap/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 @@ immediately rather than blocking waiting for packets to arrive. 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/libpcap/pcap_snapshot.3pcap b/libpcap/pcap_snapshot.3pcap index f8e40977d..47eb42a38 100644 --- a/libpcap/pcap_snapshot.3pcap +++ b/libpcap/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/libpcap/pcap_stats.3pcap b/libpcap/pcap_stats.3pcap index a953e211d..159054e74 100644 --- a/libpcap/pcap_stats.3pcap +++ b/libpcap/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/libpcap/pcap_statustostr.3pcap b/libpcap/pcap_statustostr.3pcap index da18f6912..77b8c5f10 100644 --- a/libpcap/pcap_statustostr.3pcap +++ b/libpcap/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/libpcap/pcap_strerror.3pcap b/libpcap/pcap_strerror.3pcap index 8e6319bbf..71851623d 100644 --- a/libpcap/pcap_strerror.3pcap +++ b/libpcap/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/libpcap/pcap_tstamp_type_name_to_val.3pcap b/libpcap/pcap_tstamp_type_name_to_val.3pcap index 8fcc4d75c..22dd15fff 100644 --- a/libpcap/pcap_tstamp_type_name_to_val.3pcap +++ b/libpcap/pcap_tstamp_type_name_to_val.3pcap @@ -38,7 +38,7 @@ translates a time stamp type name to the corresponding time stamp type 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/libpcap/ppp.h b/libpcap/ppp.h index 4e1d08de1..d6e70c151 100644 --- a/libpcap/ppp.h +++ b/libpcap/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/libpcap/runlex.sh b/libpcap/runlex.sh index 74f216171..06b8bd450 100755 --- a/libpcap/runlex.sh +++ b/libpcap/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 @@ else # # 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 @@ cat <$header_file $prefixline #ifndef YY_DECL #define YY_DECL int yylex(void) -#endif +#endif YY_DECL; EOF diff --git a/libpcap/savefile.c b/libpcap/savefile.c index 73e3ea9e3..783ec45bb 100644 --- a/libpcap/savefile.c +++ b/libpcap/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 @@ pcap_t* pcap_hopen_offline_with_tstamp_precision(intptr_t osfd, u_int precision, 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 @@ found: */ 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/libpcap/scanner.c b/libpcap/scanner.c index 2e7145258..41b2736ae 100644 --- a/libpcap/scanner.c +++ b/libpcap/scanner.c @@ -1,13 +1,9 @@ -#line 2 "scanner.c" -#line 2 "scanner.l" -/* Must come first for _LARGE_FILE_API on AIX. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#line 2 "scanner.c" - - -#line 11 "scanner.c" +#line 4 "scanner.c" #define YY_INT_ALIGNED short int @@ -395,8 +391,8 @@ static void yy_fatal_error (yyconst char msg[] ); *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 @@ -404,168 +400,169 @@ struct yy_trans_info 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] = @@ -573,13 +570,13 @@ static yyconst flex_int32_t yy_ec[256] = 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, @@ -602,7 +599,7 @@ static yyconst flex_int32_t yy_ec[256] = 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, @@ -610,230 +607,231 @@ static yyconst flex_int32_t yy_meta[54] = 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, @@ -842,11 +840,11 @@ static yyconst flex_int16_t yy_def[1919] = 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, @@ -855,1837 +853,1842 @@ static yyconst flex_int16_t yy_def[1919] = 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, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 593, 593, 597, 518, 599, - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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 + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, 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, - - 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, - - 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, - - 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, - - 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, 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, - - 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, - - 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, 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 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, - - 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - 1458, 1458, 1458, 1458 + 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, + + 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, + + 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, + + 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, + + 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, + + 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, 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, 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, + + 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, + + 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, + + 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, + + 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, + + 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, 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, + + 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, 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, 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, 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, + + 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, + + 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, 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, + + 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, + + 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, 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, 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, + + 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, + + 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; @@ -2703,8 +2706,7 @@ int pcap__flex_debug = 0; #define YY_RESTORE_YY_MORE_OFFSET char *pcap_text; #line 1 "scanner.l" - -#line 9 "scanner.l" +#line 2 "scanner.l" /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 * The Regents of the University of California. All rights reserved. @@ -2726,11 +2728,6 @@ char *pcap_text; * 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 WIN32 #include #else /* WIN32 */ @@ -2792,7 +2789,7 @@ static const char *in_buffer; #define yylval pcap_lval extern YYSTYPE yylval; -#line 2796 "scanner.c" +#line 2790 "scanner.c" #define INITIAL 0 @@ -2961,9 +2958,9 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 192 "scanner.l" +#line 180 "scanner.l" -#line 2967 "scanner.c" +#line 2961 "scanner.c" if ( !(yy_init) ) { @@ -3016,13 +3013,13 @@ yy_match: 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]; @@ -3048,257 +3045,257 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 193 "scanner.l" +#line 181 "scanner.l" return DST; YY_BREAK case 2: YY_RULE_SETUP -#line 194 "scanner.l" +#line 182 "scanner.l" return SRC; YY_BREAK case 3: YY_RULE_SETUP -#line 196 "scanner.l" +#line 184 "scanner.l" return LINK; YY_BREAK case 4: YY_RULE_SETUP -#line 197 "scanner.l" +#line 185 "scanner.l" return LINK; YY_BREAK case 5: YY_RULE_SETUP -#line 198 "scanner.l" +#line 186 "scanner.l" return ARP; YY_BREAK case 6: YY_RULE_SETUP -#line 199 "scanner.l" +#line 187 "scanner.l" return RARP; YY_BREAK case 7: YY_RULE_SETUP -#line 200 "scanner.l" +#line 188 "scanner.l" return IP; YY_BREAK case 8: YY_RULE_SETUP -#line 201 "scanner.l" +#line 189 "scanner.l" return SCTP; YY_BREAK case 9: YY_RULE_SETUP -#line 202 "scanner.l" +#line 190 "scanner.l" return TCP; YY_BREAK case 10: YY_RULE_SETUP -#line 203 "scanner.l" +#line 191 "scanner.l" return UDP; YY_BREAK case 11: YY_RULE_SETUP -#line 204 "scanner.l" +#line 192 "scanner.l" return ICMP; YY_BREAK case 12: YY_RULE_SETUP -#line 205 "scanner.l" +#line 193 "scanner.l" return IGMP; YY_BREAK case 13: YY_RULE_SETUP -#line 206 "scanner.l" +#line 194 "scanner.l" return IGRP; YY_BREAK case 14: YY_RULE_SETUP -#line 207 "scanner.l" +#line 195 "scanner.l" return PIM; YY_BREAK case 15: YY_RULE_SETUP -#line 208 "scanner.l" +#line 196 "scanner.l" return VRRP; YY_BREAK case 16: YY_RULE_SETUP -#line 209 "scanner.l" +#line 197 "scanner.l" return CARP; YY_BREAK case 17: YY_RULE_SETUP -#line 210 "scanner.l" +#line 198 "scanner.l" return RADIO; YY_BREAK case 18: YY_RULE_SETUP -#line 212 "scanner.l" +#line 200 "scanner.l" return IPV6; YY_BREAK case 19: YY_RULE_SETUP -#line 213 "scanner.l" +#line 201 "scanner.l" return ICMPV6; YY_BREAK case 20: YY_RULE_SETUP -#line 214 "scanner.l" +#line 202 "scanner.l" return AH; YY_BREAK case 21: YY_RULE_SETUP -#line 215 "scanner.l" +#line 203 "scanner.l" return ESP; YY_BREAK case 22: YY_RULE_SETUP -#line 217 "scanner.l" +#line 205 "scanner.l" return ATALK; YY_BREAK case 23: YY_RULE_SETUP -#line 218 "scanner.l" +#line 206 "scanner.l" return AARP; YY_BREAK case 24: YY_RULE_SETUP -#line 219 "scanner.l" +#line 207 "scanner.l" return DECNET; YY_BREAK case 25: YY_RULE_SETUP -#line 220 "scanner.l" +#line 208 "scanner.l" return LAT; YY_BREAK case 26: YY_RULE_SETUP -#line 221 "scanner.l" +#line 209 "scanner.l" return SCA; YY_BREAK case 27: YY_RULE_SETUP -#line 222 "scanner.l" +#line 210 "scanner.l" return MOPRC; YY_BREAK case 28: YY_RULE_SETUP -#line 223 "scanner.l" +#line 211 "scanner.l" return MOPDL; YY_BREAK case 29: YY_RULE_SETUP -#line 225 "scanner.l" +#line 213 "scanner.l" return ISO; YY_BREAK case 30: YY_RULE_SETUP -#line 226 "scanner.l" +#line 214 "scanner.l" return ESIS; YY_BREAK case 31: YY_RULE_SETUP -#line 227 "scanner.l" +#line 215 "scanner.l" return ESIS; YY_BREAK case 32: YY_RULE_SETUP -#line 228 "scanner.l" +#line 216 "scanner.l" return ISIS; YY_BREAK case 33: YY_RULE_SETUP -#line 229 "scanner.l" +#line 217 "scanner.l" return ISIS; YY_BREAK case 34: YY_RULE_SETUP -#line 230 "scanner.l" +#line 218 "scanner.l" return L1; YY_BREAK case 35: YY_RULE_SETUP -#line 231 "scanner.l" +#line 219 "scanner.l" return L2; YY_BREAK case 36: YY_RULE_SETUP -#line 232 "scanner.l" +#line 220 "scanner.l" return IIH; YY_BREAK case 37: YY_RULE_SETUP -#line 233 "scanner.l" +#line 221 "scanner.l" return LSP; YY_BREAK case 38: YY_RULE_SETUP -#line 234 "scanner.l" +#line 222 "scanner.l" return SNP; YY_BREAK case 39: YY_RULE_SETUP -#line 235 "scanner.l" +#line 223 "scanner.l" return CSNP; YY_BREAK case 40: YY_RULE_SETUP -#line 236 "scanner.l" +#line 224 "scanner.l" return PSNP; YY_BREAK case 41: YY_RULE_SETUP -#line 238 "scanner.l" +#line 226 "scanner.l" return CLNP; YY_BREAK case 42: YY_RULE_SETUP -#line 240 "scanner.l" +#line 228 "scanner.l" return STP; YY_BREAK case 43: YY_RULE_SETUP -#line 242 "scanner.l" +#line 230 "scanner.l" return IPX; YY_BREAK case 44: YY_RULE_SETUP -#line 244 "scanner.l" +#line 232 "scanner.l" return NETBEUI; YY_BREAK case 45: YY_RULE_SETUP -#line 246 "scanner.l" +#line 234 "scanner.l" return HOST; YY_BREAK case 46: YY_RULE_SETUP -#line 247 "scanner.l" +#line 235 "scanner.l" return NET; YY_BREAK case 47: YY_RULE_SETUP -#line 248 "scanner.l" +#line 236 "scanner.l" return NETMASK; YY_BREAK case 48: YY_RULE_SETUP -#line 249 "scanner.l" +#line 237 "scanner.l" return PORT; YY_BREAK case 49: YY_RULE_SETUP -#line 250 "scanner.l" +#line 238 "scanner.l" return PORTRANGE; YY_BREAK case 50: YY_RULE_SETUP -#line 251 "scanner.l" +#line 239 "scanner.l" return PROTO; YY_BREAK case 51: YY_RULE_SETUP -#line 252 "scanner.l" +#line 240 "scanner.l" { #ifdef NO_PROTOCHAIN bpf_error("%s not supported", pcap_text); @@ -3309,375 +3306,380 @@ YY_RULE_SETUP YY_BREAK case 52: YY_RULE_SETUP -#line 260 "scanner.l" +#line 248 "scanner.l" return GATEWAY; YY_BREAK case 53: YY_RULE_SETUP -#line 262 "scanner.l" +#line 250 "scanner.l" return TYPE; YY_BREAK case 54: YY_RULE_SETUP -#line 263 "scanner.l" +#line 251 "scanner.l" return SUBTYPE; YY_BREAK case 55: YY_RULE_SETUP -#line 264 "scanner.l" +#line 252 "scanner.l" return DIR; YY_BREAK case 56: YY_RULE_SETUP -#line 265 "scanner.l" +#line 253 "scanner.l" return ADDR1; YY_BREAK case 57: YY_RULE_SETUP -#line 266 "scanner.l" +#line 254 "scanner.l" return ADDR2; YY_BREAK case 58: YY_RULE_SETUP -#line 267 "scanner.l" +#line 255 "scanner.l" return ADDR3; YY_BREAK case 59: YY_RULE_SETUP -#line 268 "scanner.l" +#line 256 "scanner.l" return ADDR4; YY_BREAK case 60: YY_RULE_SETUP -#line 269 "scanner.l" +#line 257 "scanner.l" return RA; YY_BREAK case 61: YY_RULE_SETUP -#line 270 "scanner.l" +#line 258 "scanner.l" return TA; YY_BREAK case 62: YY_RULE_SETUP -#line 272 "scanner.l" +#line 260 "scanner.l" return LESS; YY_BREAK case 63: YY_RULE_SETUP -#line 273 "scanner.l" +#line 261 "scanner.l" return GREATER; YY_BREAK case 64: YY_RULE_SETUP -#line 274 "scanner.l" +#line 262 "scanner.l" return CBYTE; YY_BREAK case 65: YY_RULE_SETUP -#line 275 "scanner.l" +#line 263 "scanner.l" return TK_BROADCAST; YY_BREAK case 66: YY_RULE_SETUP -#line 276 "scanner.l" +#line 264 "scanner.l" return TK_MULTICAST; YY_BREAK case 67: YY_RULE_SETUP -#line 278 "scanner.l" +#line 266 "scanner.l" return AND; YY_BREAK case 68: YY_RULE_SETUP -#line 279 "scanner.l" +#line 267 "scanner.l" return OR; YY_BREAK case 69: YY_RULE_SETUP -#line 280 "scanner.l" +#line 268 "scanner.l" return '!'; YY_BREAK case 70: YY_RULE_SETUP -#line 282 "scanner.l" +#line 270 "scanner.l" return LEN; YY_BREAK case 71: YY_RULE_SETUP -#line 283 "scanner.l" +#line 271 "scanner.l" return INBOUND; YY_BREAK case 72: YY_RULE_SETUP -#line 284 "scanner.l" +#line 272 "scanner.l" return OUTBOUND; YY_BREAK case 73: YY_RULE_SETUP -#line 286 "scanner.l" +#line 274 "scanner.l" return VLAN; YY_BREAK case 74: YY_RULE_SETUP -#line 287 "scanner.l" +#line 275 "scanner.l" return MPLS; YY_BREAK case 75: YY_RULE_SETUP -#line 288 "scanner.l" +#line 276 "scanner.l" return PPPOED; YY_BREAK case 76: YY_RULE_SETUP -#line 289 "scanner.l" +#line 277 "scanner.l" return PPPOES; YY_BREAK case 77: YY_RULE_SETUP -#line 291 "scanner.l" -return LANE; +#line 278 "scanner.l" +return GENEVE; YY_BREAK case 78: YY_RULE_SETUP -#line 292 "scanner.l" -return LLC; +#line 280 "scanner.l" +return LANE; YY_BREAK case 79: YY_RULE_SETUP -#line 293 "scanner.l" -return METAC; +#line 281 "scanner.l" +return LLC; YY_BREAK case 80: YY_RULE_SETUP -#line 294 "scanner.l" -return BCC; +#line 282 "scanner.l" +return METAC; YY_BREAK case 81: YY_RULE_SETUP -#line 295 "scanner.l" -return OAM; +#line 283 "scanner.l" +return BCC; YY_BREAK case 82: YY_RULE_SETUP -#line 296 "scanner.l" -return OAMF4; +#line 284 "scanner.l" +return OAM; YY_BREAK case 83: YY_RULE_SETUP -#line 297 "scanner.l" -return OAMF4EC; +#line 285 "scanner.l" +return OAMF4; YY_BREAK case 84: YY_RULE_SETUP -#line 298 "scanner.l" -return OAMF4SC; +#line 286 "scanner.l" +return OAMF4EC; YY_BREAK case 85: YY_RULE_SETUP -#line 299 "scanner.l" -return SC; +#line 287 "scanner.l" +return OAMF4SC; YY_BREAK case 86: YY_RULE_SETUP -#line 300 "scanner.l" -return ILMIC; +#line 288 "scanner.l" +return SC; YY_BREAK case 87: YY_RULE_SETUP -#line 301 "scanner.l" -return VPI; +#line 289 "scanner.l" +return ILMIC; YY_BREAK case 88: YY_RULE_SETUP -#line 302 "scanner.l" -return VCI; +#line 290 "scanner.l" +return VPI; YY_BREAK case 89: YY_RULE_SETUP -#line 303 "scanner.l" -return CONNECTMSG; +#line 291 "scanner.l" +return VCI; YY_BREAK case 90: YY_RULE_SETUP -#line 304 "scanner.l" -return METACONNECT; +#line 292 "scanner.l" +return CONNECTMSG; YY_BREAK case 91: YY_RULE_SETUP -#line 306 "scanner.l" -return PF_IFNAME; +#line 293 "scanner.l" +return METACONNECT; YY_BREAK case 92: YY_RULE_SETUP -#line 307 "scanner.l" -return PF_RSET; +#line 295 "scanner.l" +return PF_IFNAME; YY_BREAK case 93: YY_RULE_SETUP -#line 308 "scanner.l" -return PF_RNR; +#line 296 "scanner.l" +return PF_RSET; YY_BREAK case 94: YY_RULE_SETUP -#line 309 "scanner.l" -return PF_SRNR; +#line 297 "scanner.l" +return PF_RNR; YY_BREAK case 95: YY_RULE_SETUP -#line 310 "scanner.l" -return PF_REASON; +#line 298 "scanner.l" +return PF_SRNR; YY_BREAK case 96: YY_RULE_SETUP -#line 311 "scanner.l" -return PF_ACTION; +#line 299 "scanner.l" +return PF_REASON; YY_BREAK case 97: YY_RULE_SETUP -#line 313 "scanner.l" -return FISU; +#line 300 "scanner.l" +return PF_ACTION; YY_BREAK case 98: YY_RULE_SETUP -#line 314 "scanner.l" -return LSSU; +#line 302 "scanner.l" +return FISU; YY_BREAK case 99: YY_RULE_SETUP -#line 315 "scanner.l" +#line 303 "scanner.l" return LSSU; YY_BREAK case 100: YY_RULE_SETUP -#line 316 "scanner.l" -return MSU; +#line 304 "scanner.l" +return LSSU; YY_BREAK case 101: YY_RULE_SETUP -#line 317 "scanner.l" -return HFISU; +#line 305 "scanner.l" +return MSU; YY_BREAK case 102: YY_RULE_SETUP -#line 318 "scanner.l" -return HLSSU; +#line 306 "scanner.l" +return HFISU; YY_BREAK case 103: YY_RULE_SETUP -#line 319 "scanner.l" -return HMSU; +#line 307 "scanner.l" +return HLSSU; YY_BREAK case 104: YY_RULE_SETUP -#line 320 "scanner.l" -return SIO; +#line 308 "scanner.l" +return HMSU; YY_BREAK case 105: YY_RULE_SETUP -#line 321 "scanner.l" -return OPC; +#line 309 "scanner.l" +return SIO; YY_BREAK case 106: YY_RULE_SETUP -#line 322 "scanner.l" -return DPC; +#line 310 "scanner.l" +return OPC; YY_BREAK case 107: YY_RULE_SETUP -#line 323 "scanner.l" -return SLS; +#line 311 "scanner.l" +return DPC; YY_BREAK case 108: YY_RULE_SETUP -#line 324 "scanner.l" -return HSIO; +#line 312 "scanner.l" +return SLS; YY_BREAK case 109: YY_RULE_SETUP -#line 325 "scanner.l" -return HOPC; +#line 313 "scanner.l" +return HSIO; YY_BREAK case 110: YY_RULE_SETUP -#line 326 "scanner.l" -return HDPC; +#line 314 "scanner.l" +return HOPC; YY_BREAK case 111: YY_RULE_SETUP -#line 327 "scanner.l" -return HSLS; +#line 315 "scanner.l" +return HDPC; YY_BREAK case 112: -/* rule 112 can match eol */ YY_RULE_SETUP -#line 329 "scanner.l" -; +#line 316 "scanner.l" +return HSLS; YY_BREAK case 113: +/* rule 113 can match eol */ YY_RULE_SETUP -#line 330 "scanner.l" -return pcap_text[0]; +#line 318 "scanner.l" +; YY_BREAK case 114: YY_RULE_SETUP -#line 331 "scanner.l" -return GEQ; +#line 319 "scanner.l" +return pcap_text[0]; YY_BREAK case 115: YY_RULE_SETUP -#line 332 "scanner.l" -return LEQ; +#line 320 "scanner.l" +return GEQ; YY_BREAK case 116: YY_RULE_SETUP -#line 333 "scanner.l" -return NEQ; +#line 321 "scanner.l" +return LEQ; YY_BREAK case 117: YY_RULE_SETUP -#line 334 "scanner.l" -return '='; +#line 322 "scanner.l" +return NEQ; YY_BREAK case 118: YY_RULE_SETUP -#line 335 "scanner.l" -return LSH; +#line 323 "scanner.l" +return '='; YY_BREAK case 119: YY_RULE_SETUP -#line 336 "scanner.l" -return RSH; +#line 324 "scanner.l" +return LSH; YY_BREAK case 120: YY_RULE_SETUP -#line 337 "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 341 "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 345 "scanner.l" -{ yylval.i = stoi((char *)pcap_text); return NUM; } - YY_BREAK case 123: YY_RULE_SETUP -#line 346 "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 348 "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; @@ -3695,159 +3697,159 @@ YY_RULE_SETUP #endif /*INET6*/ } YY_BREAK -case 125: -YY_RULE_SETUP -#line 364 "scanner.l" -{ bpf_error("bogus ethernet address %s", pcap_text); } - YY_BREAK case 126: YY_RULE_SETUP -#line 365 "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 366 "scanner.l" -{ yylval.i = 1; return NUM; } +#line 354 "scanner.l" +{ yylval.i = 0; return NUM; } YY_BREAK case 128: YY_RULE_SETUP -#line 367 "scanner.l" -{ yylval.i = 0; return NUM; } +#line 355 "scanner.l" +{ yylval.i = 1; return NUM; } YY_BREAK case 129: YY_RULE_SETUP -#line 368 "scanner.l" -{ yylval.i = 3; return NUM; } +#line 356 "scanner.l" +{ yylval.i = 0; return NUM; } YY_BREAK case 130: YY_RULE_SETUP -#line 369 "scanner.l" -{ yylval.i = 4; return NUM; } +#line 357 "scanner.l" +{ yylval.i = 3; return NUM; } YY_BREAK case 131: YY_RULE_SETUP -#line 370 "scanner.l" -{ yylval.i = 5; return NUM; } +#line 358 "scanner.l" +{ yylval.i = 4; return NUM; } YY_BREAK case 132: YY_RULE_SETUP -#line 371 "scanner.l" -{ yylval.i = 8; return NUM; } +#line 359 "scanner.l" +{ yylval.i = 5; return NUM; } YY_BREAK case 133: YY_RULE_SETUP -#line 372 "scanner.l" -{ yylval.i = 9; return NUM; } +#line 360 "scanner.l" +{ yylval.i = 8; return NUM; } YY_BREAK case 134: YY_RULE_SETUP -#line 373 "scanner.l" -{ yylval.i = 10; return NUM; } +#line 361 "scanner.l" +{ yylval.i = 9; return NUM; } YY_BREAK case 135: YY_RULE_SETUP -#line 374 "scanner.l" -{ yylval.i = 11; return NUM; } +#line 362 "scanner.l" +{ yylval.i = 10; return NUM; } YY_BREAK case 136: YY_RULE_SETUP -#line 375 "scanner.l" -{ yylval.i = 12; return NUM; } +#line 363 "scanner.l" +{ yylval.i = 11; return NUM; } YY_BREAK case 137: YY_RULE_SETUP -#line 376 "scanner.l" -{ yylval.i = 13; return NUM; } +#line 364 "scanner.l" +{ yylval.i = 12; return NUM; } YY_BREAK case 138: YY_RULE_SETUP -#line 377 "scanner.l" -{ yylval.i = 14; return NUM; } +#line 365 "scanner.l" +{ yylval.i = 13; return NUM; } YY_BREAK case 139: YY_RULE_SETUP -#line 378 "scanner.l" -{ yylval.i = 15; return NUM; } +#line 366 "scanner.l" +{ yylval.i = 14; return NUM; } YY_BREAK case 140: YY_RULE_SETUP -#line 379 "scanner.l" -{ yylval.i = 16; return NUM; } +#line 367 "scanner.l" +{ yylval.i = 15; return NUM; } YY_BREAK case 141: YY_RULE_SETUP -#line 380 "scanner.l" -{ yylval.i = 17; return NUM; } +#line 368 "scanner.l" +{ yylval.i = 16; return NUM; } YY_BREAK case 142: YY_RULE_SETUP -#line 381 "scanner.l" -{ yylval.i = 18; return NUM; } +#line 369 "scanner.l" +{ yylval.i = 17; return NUM; } YY_BREAK case 143: YY_RULE_SETUP -#line 382 "scanner.l" -{ yylval.i = 13; return NUM; } +#line 370 "scanner.l" +{ yylval.i = 18; return NUM; } YY_BREAK case 144: YY_RULE_SETUP -#line 383 "scanner.l" -{ yylval.i = 0x01; return NUM; } +#line 371 "scanner.l" +{ yylval.i = 13; return NUM; } YY_BREAK case 145: YY_RULE_SETUP -#line 384 "scanner.l" -{ yylval.i = 0x02; return NUM; } +#line 372 "scanner.l" +{ yylval.i = 0x01; return NUM; } YY_BREAK case 146: YY_RULE_SETUP -#line 385 "scanner.l" -{ yylval.i = 0x04; return NUM; } +#line 373 "scanner.l" +{ yylval.i = 0x02; return NUM; } YY_BREAK case 147: YY_RULE_SETUP -#line 386 "scanner.l" -{ yylval.i = 0x08; return NUM; } +#line 374 "scanner.l" +{ yylval.i = 0x04; return NUM; } YY_BREAK case 148: YY_RULE_SETUP -#line 387 "scanner.l" -{ yylval.i = 0x10; return NUM; } +#line 375 "scanner.l" +{ yylval.i = 0x08; return NUM; } YY_BREAK case 149: YY_RULE_SETUP -#line 388 "scanner.l" -{ yylval.i = 0x20; return NUM; } +#line 376 "scanner.l" +{ yylval.i = 0x10; return NUM; } YY_BREAK case 150: YY_RULE_SETUP -#line 389 "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 391 "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 392 "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 394 "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 395 "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 3851 "scanner.c" +#line 3850 "scanner.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -4139,7 +4141,7 @@ static int yy_get_next_buffer (void) 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]; @@ -4167,11 +4169,11 @@ static int yy_get_next_buffer (void) 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; } @@ -4744,7 +4746,7 @@ void pcap_free (void * ptr ) #define YYTABLES_NAME "yytables" -#line 395 "scanner.l" +#line 384 "scanner.l" void diff --git a/libpcap/scanner.c.top b/libpcap/scanner.c.top new file mode 100644 index 000000000..c7cde56cf --- /dev/null +++ b/libpcap/scanner.c.top @@ -0,0 +1,3 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif diff --git a/libpcap/scanner.h b/libpcap/scanner.h index 934ca4ccf..d95fb8417 100644 --- a/libpcap/scanner.h +++ b/libpcap/scanner.h @@ -2,5 +2,5 @@ #ifndef YY_DECL #define YY_DECL int yylex(void) -#endif +#endif YY_DECL; diff --git a/libpcap/scanner.l b/libpcap/scanner.l index 43a425076..72a83f7fa 100644 --- a/libpcap/scanner.l +++ b/libpcap/scanner.l @@ -1,10 +1,3 @@ -%top{ -/* Must come first for _LARGE_FILE_API on AIX. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -} - %{ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -27,11 +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 WIN32 #include #else /* WIN32 */ @@ -287,6 +275,7 @@ vlan return VLAN; mpls return MPLS; pppoed return PPPOED; pppoes return PPPOES; +geneve return GENEVE; lane return LANE; llc return LLC; @@ -327,7 +316,7 @@ hdpc return HDPC; hsls return HSLS; [ \r\n\t] ; -[+\-*/:\[\]!<>()&|=] return yytext[0]; +[+\-*/%:\[\]!<>()&|\^=] return yytext[0]; ">=" return GEQ; "<=" return LEQ; "!=" return NEQ; diff --git a/libpcap/sf-pcap-ng.c b/libpcap/sf-pcap-ng.c index 71fa057ee..e2cac0495 100644 --- a/libpcap/sf-pcap-ng.c +++ b/libpcap/sf-pcap-ng.c @@ -459,7 +459,7 @@ process_idb_options(pcap_t *p, struct block_cursor *cursor, u_int *tsresol, 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 @@ pcap_ng_check_header(bpf_u_int32 magic, FILE *fp, u_int precision, char *errbuf, /* * 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 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) epbp->timestamp_low; } goto found; - + case BT_SPB: /* * Get a pointer to the fixed-length portion of the @@ -1192,7 +1192,7 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) * Not a packet block, IDB, or SHB; ignore it. */ break; - } + } } found: @@ -1210,10 +1210,16 @@ found: } /* - * 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 @@ found: 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? @@ -1269,23 +1267,8 @@ found: if (*data == NULL) return (-1); - if (p->swapped) { - /* - * Convert pseudo-headers from the byte order of - * the host on which the file was saved to our - * byte order, as necessary. - */ - switch (p->linktype) { - - case DLT_USB_LINUX: - swap_linux_usb_header(hdr, *data, 0); - break; - - case DLT_USB_LINUX_MMAPPED: - swap_linux_usb_header(hdr, *data, 1); - break; - } - } + if (p->swapped) + swap_pseudo_headers(p->linktype, hdr, *data); return (0); } diff --git a/libpcap/sf-pcap.c b/libpcap/sf-pcap.c index d129dc7b4..eaeddfa87 100644 --- a/libpcap/sf-pcap.c +++ b/libpcap/sf-pcap.c @@ -371,9 +371,9 @@ pcap_check_header(bpf_u_int32 magic, FILE *fp, u_int precision, char *errbuf, 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 @@ pcap_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) 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); @@ -559,23 +559,8 @@ pcap_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) } *data = p->buffer; - if (p->swapped) { - /* - * Convert pseudo-headers from the byte order of - * the host on which the file was saved to our - * byte order, as necessary. - */ - switch (p->linktype) { - - case DLT_USB_LINUX: - swap_linux_usb_header(hdr, *data, 0); - break; - - case DLT_USB_LINUX_MMAPPED: - swap_linux_usb_header(hdr, *data, 1); - break; - } - } + if (p->swapped) + swap_pseudo_headers(p->linktype, hdr, *data); return (0); } @@ -697,7 +682,7 @@ pcap_dump_open(pcap_t *p, const char *fname) */ pcap_dumper_t * pcap_dump_fopen(pcap_t *p, FILE *f) -{ +{ int linktype; linktype = dlt_to_linktype(p->linktype); @@ -712,6 +697,168 @@ pcap_dump_fopen(pcap_t *p, FILE *f) 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/libpcap/sunatmpos.h b/libpcap/sunatmpos.h index 916017fa9..787de8574 100644 --- a/libpcap/sunatmpos.h +++ b/libpcap/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/libpcap/tests/nonblocktest.c b/libpcap/tests/capturetest.c similarity index 74% rename from libpcap/tests/nonblocktest.c rename to libpcap/tests/capturetest.c index 70a6bfdaa..e70e69a51 100644 --- a/libpcap/tests/nonblocktest.c +++ b/libpcap/tests/capturetest.c @@ -25,18 +25,20 @@ static const char copyright[] = The Regents of the University of California. All rights reserved.\n"; #endif -#include #include #include #include #include +#include #include #include #include #include #include -char *program_name; +#include + +static char *program_name; /* Forwards */ static void countme(u_char *, const struct pcap_pkthdr *, const u_char *); @@ -55,8 +57,13 @@ int 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 @@ main(int argc, char **argv) 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 @@ main(int argc, char **argv) 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 @@ main(int argc, char **argv) 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 @@ countme(u_char *user, const struct pcap_pkthdr *h, const u_char *sp) 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/libpcap/tests/filtertest.c b/libpcap/tests/filtertest.c index a56d1e49e..e45db21ea 100644 --- a/libpcap/tests/filtertest.c +++ b/libpcap/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 char *program_name; 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 @@ error(const char *fmt, ...) /* 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 @@ main(int argc, char **argv) { 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 @@ main(int argc, char **argv) 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 @@ main(int argc, char **argv) } 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 @@ main(int argc, char **argv) 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/libpcap/tests/findalldevstest.c b/libpcap/tests/findalldevstest.c index ec7c95015..6d452f8fe 100644 --- a/libpcap/tests/findalldevstest.c +++ b/libpcap/tests/findalldevstest.c @@ -11,7 +11,7 @@ #include -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 @@ int main(int argc, char **argv) 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 @@ int main(int argc, char **argv) } 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 @@ int main(int argc, char **argv) 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 @@ static void ifprint(pcap_if_t *d) 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 @@ static void ifprint(pcap_if_t *d) 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/libpcap/tests/valgrindtest.c b/libpcap/tests/valgrindtest.c index 0d454d149..72786e41a 100644 --- a/libpcap/tests/valgrindtest.c +++ b/libpcap/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 @@ main(int argc, char **argv) dorfmon = 0; useactivate = 0; infile = NULL; - + if ((cp = strrchr(argv[0], '/')) != NULL) program_name = cp + 1; else diff --git a/libpcap/tokdefs.h b/libpcap/tokdefs.h index 113ec4635..da9fd9132 100644 --- a/libpcap/tokdefs.h +++ b/libpcap/tokdefs.h @@ -117,52 +117,53 @@ extern int pcap_debug; 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, - OR = 373, - AND = 374, - UMINUS = 375 + 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. */ @@ -238,59 +239,60 @@ extern int pcap_debug; #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 OR 373 -#define AND 374 -#define UMINUS 375 +#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 AND 375 +#define UMINUS 376 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 242 "grammar.y" /* yacc.c:1909 */ +#line 256 "grammar.y" /* yacc.c:1909 */ int i; bpf_u_int32 h; @@ -306,7 +308,7 @@ union YYSTYPE } blk; struct block *rblk; -#line 310 "y.tab.h" /* yacc.c:1909 */ +#line 312 "y.tab.h" /* yacc.c:1909 */ }; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1