diff --git a/libpcap/CHANGES b/libpcap/CHANGES index de3ac954f4..3c82052df0 100644 --- a/libpcap/CHANGES +++ b/libpcap/CHANGES @@ -1,3 +1,77 @@ +Friday December 9, 2011. guy@alum.mit.edu. +Summary for 1.2.1 libpcap release + Update README file. + Fix typoes in README.linux file. + Clean up some compiler warnings. + Fix Linux compile problems and tests for ethtool.h. + Treat Debian/kFreeBSD and GNU/Hurd as systems with GNU + toolchains. + Support 802.1 QinQ as a form of VLAN in filters. + Treat "carp" as equivalent to "vrrp" in filters. + Fix code generated for "ip6 protochain". + Add some new link-layer header types. + Support capturing NetFilter log messages on Linux. + Clean up some error messages. + Turn off monitor mode on exit for mac80211 interfaces on Linux. + Fix problems turning monitor mode on for non-mac80211 interfaces + on Linux. + Properly fail if /sys/class/net or /proc/net/dev exist but can't + be opened. + Fail if pcap_activate() is called on an already-activated + pcap_t, and add a test program for that. + Fix filtering in pcap-ng files. + Don't build for PowerPC on Mac OS X Lion. + Simplify handling of new DLT_/LINKTYPE_ values. + Expand pcap(3PCAP) man page. + +Sunday July 24, 2011. mcr@sandelman.ca. +Summary for 1.2 libpcap release + All of the changes listed below for 1.1.1 and 1.1.2. + Changes to error handling for pcap_findalldevs(). + Fix the calculation of the frame size in memory-mapped captures. + Add a link-layer header type for STANAG 5066 D_PDUs. + Add a link-layer type for a variant of 3GPP TS 27.010. + Noted real nature of LINKTYPE_ARCNET. + Add a link-layer type for DVB-CI. + Fix configure-script discovery of VLAN acceleration support. + see http://netoptimizer.blogspot.com/2010/09/tcpdump-vs-vlan-tags.html + Linux, HP-UX, AIX, NetBSD and OpenBSD compilation/conflict fixes. + Protect against including AIX 5.x's having been included. + Add DLT_DBUS, for raw D-Bus messages. + Treat either EPERM or EACCES as "no soup for you". + Changes to permissions on DLPI systems. + Add DLT_IEEE802_15_4_NOFCS for 802.15.4 interfaces. + +Fri. August 6, 2010. guy@alum.mit.edu. +Summary for 1.1.2 libpcap release + Return DLT_ values, not raw LINKTYPE_ values from + pcap_datalink() when reading pcap-ng files + Add support for "wlan ra" and "wlan ta", to check the RA and TA + of WLAN frames that have them + Don't crash if "wlan addr{1,2,3,4}" are used without 802.11 + headers + Do filtering on USB and Bluetooth capturing + On FreeBSD/SPARC64, use -fPIC - it's apparently necessary + Check for valid port numbers (fit in a 16-bit unsigned field) in + "port" filters + Reject attempts to put savefiles into non-blocking mode + Check for "no such device" for the "get the media types" ioctl + in *BSD + Improve error messages from bpf_open(), and let it do the error + handling + Return more specific errors from pcap_can_set_rfmon(); fix + documentation + Update description fetching code for FreeBSD, fix code for + OpenBSD + Ignore /sys/net/dev files if we get ENODEV for them, not just + ENXIO; fixes handling of bonding devices on Linux + Fix check for a constant 0 argument to BPF_DIV + Use the right version of ar when cross-building + Free any filter set on a savefile when the savefile is closed + Include the CFLAGS setting when configure was run in the + compiler flags + Add support for 802.15.4 interfaces on Linux + Thu. April 1, 2010. guy@alum.mit.edu. Summary for 1.1.1 libpcap release Update CHANGES to reflect more of the changes in 1.1.0. diff --git a/libpcap/CREDITS b/libpcap/CREDITS index 2d7c09e9d0..68b283fd8d 100644 --- a/libpcap/CREDITS +++ b/libpcap/CREDITS @@ -1,145 +1,154 @@ This file lists people who have contributed to libpcap: The current maintainers: - Bill Fenner - Fulvio Risso - Guy Harris - Hannes Gredler - Michael Richardson + Bill Fenner + Fulvio Risso + Guy Harris + Hannes Gredler + Michael Richardson Additional people who have contributed patches: - Alan Bawden - Albert Chin - Alexander 'Leo' Bergolth - Alexey Kuznetsov - Alon Bar-Lev - Andrew Brown - Antti Kantee - Arien Vijn - Arkadiusz Miskiewicz - Armando L. Caro Jr. - Assar Westerlund - Brian Ginsbach - Charles M. Hannum - Chris G. Demetriou - Chris Lightfoot - Chris Maynard - Chris Pepper - Christian Bell - Christian Peron - Daniele Orlandi - Darren Reed - David Kaelbling - David Young - Dean Gaudet - Don Ebright - Dug Song - Dustin Spicuzza - Eric Anderson - Erik de Castro Lopo - Felix Obenhuber - Florent Drouin - Franz Schaefer - Fulko Hew - Fumiyuki Shimizu - Gianluca Varenni - Gilbert Hoyek - Gisle Vanem - Graeme Hewson - Greg Stark - Greg Troxel - Gregor Maier - Guillaume Pelat - Hagen Paul Pfeifer - Hyung Sik Yoon - Igor Khristophorov - Jan-Philip Velders - Jason R. Thorpe - Javier Achirica - Jean Tourrilhes - Jean-Louis Charton - Jefferson Ogata - Jesper Peterson - Joerg Mayer - John Bankier - Jon Lindgren - Jon Smirl - Juergen Schoenwaelder - Jung-uk Kim - Kazushi Sugyo - Klaus Klein - Koryn Grant - Kris Katterjohn - Krzysztof Halasa - Lorenzo Cavallaro - Loris Degioanni - Love Hörnquist-Ã…strand - Luis Martin Garcia - Maciej W. Rozycki - Marcus Felipe Pereira - Mark C. Brown - Mark Pizzolato - Markus Mayer - Martin Husemann - Márton Németh - Matthew Luckie - Max Laier - Mike Frysinger - Mike Kershaw - Mike Wiacek - Monroe Williams - N. Leiten - Nicolas Dade - Octavian Cerna - Olaf Kirch - Ollie Wild - Onno van der Linden - Paolo Abeni - Patrick Marie - Patrick McHardy - Paul Mundt - Pavel Kankovsky - Pawel Pokrywka - Peter Fales - Peter Jeremy - Peter Volkov - Phil Wood - Rafal Maszkowski - - Richard Stearn - Rick Jones - Robert Edmonds - Roberto Mariani - Romain Francoise - Sagun Shakya - Scott Barron - Scott Gifford - Sebastian Krahmer - Sebastien Roy - Sepherosa Ziehau - Shaun Clowes - Solomon Peachy - Stefan Hudson - Stephen Donnelly - Takashi Yamamoto - Tanaka Shin-ya - Tobias Poschwatta - Tony Li - Torsten Landschoff - Uns Lider - Uwe Girlich - Wesley Shields - Xianjie Zhang - Xin Li - Yen Yen Lim - Yvan Vanhullebus - Yoann Vandoorselaere + Alan Bawden + Albert Chin + Alexander 'Leo' Bergolth + Alexey Kuznetsov + Alon Bar-Lev + Andrew Brown + + Antti Kantee + Arien Vijn + Arkadiusz Miskiewicz + Armando L. Caro Jr. + Assar Westerlund + Brian Ginsbach + Charles M. Hannum + Chris G. Demetriou + Chris Lightfoot + Chris Maynard + Chris Pepper + Christian Bell + Christian Peron + Daniele Orlandi + Darren Reed + David Kaelbling + David Young + Dean Gaudet + Don Ebright + Dug Song + Dustin Spicuzza + Eric Anderson + Erik de Castro Lopo + Felix Obenhuber + Florent Drouin + Franz Schaefer + frederich + Fulko Hew + Fumiyuki Shimizu + Garrett Cooper + Gianluca Varenni + Gilbert Hoyek + Gisle Vanem + Graeme Hewson + Greg Stark + Greg Troxel + Gregor Maier + Guillaume Pelat + Hagen Paul Pfeifer + Henri Doreau + Hyung Sik Yoon + Igor Khristophorov + Jan-Philip Velders + Jason R. Thorpe + Javier Achirica + Jean Tourrilhes + Jean-Louis Charton + Jefferson Ogata + Jesper Dangaard Brouer + Jesper Peterson + Joerg Mayer + John Bankier + Jon Lindgren + Jon Smirl + Juergen Schoenwaelder + Julien Moutinho + Jung-uk Kim + Kazushi Sugyo + Klaus Klein + Koryn Grant + Kris Katterjohn + Krzysztof Halasa + Lorenzo Cavallaro + Loris Degioanni + Love Hörnquist-Ã…strand + Luis MartinGarcia + Maciej W. Rozycki + Marcus Felipe Pereira + Mark C. Brown + Mark Pizzolato + Markus Mayer + Martin Husemann + Márton Németh + Matthew Luckie + Max Laier + Mike Frysinger + Mike Kershaw + Mike Wiacek + Miroslav Lichvar + Monroe Williams + + N. Leiten + Nicolas Dade + Octavian Cerna + Olaf Kirch + Ollie Wild + Onno van der Linden + Paolo Abeni + Patrick Marie + Patrick McHardy + Paul Mundt + Pavel Kankovsky + Pawel Pokrywka + Peter Fales + Peter Jeremy + Peter Volkov + Phil Wood + Rafal Maszkowski + + Richard Stearn + Rick Jones + Robert Edmonds + Roberto Mariani + Romain Francoise + Sagun Shakya + Scott Barron + Scott Gifford + Scott Mcmillan + Sebastian Krahmer + Sebastien Roy + Sepherosa Ziehau + Shaun Clowes + Solomon Peachy + Stefan Hudson + Stephen Donnelly + Takashi Yamamoto + Tanaka Shin-ya + Tobias Poschwatta + Tony Li + Torsten Landschoff + Uns Lider + Uwe Girlich + Wesley Shields + Xianjie Zhang + Xin Li + Yen Yen Lim + Yvan Vanhullebus + Yoann Vandoorselaere The original LBL crew: - Steve McCanne - Craig Leres - Van Jacobson + Steve McCanne + Craig Leres + Van Jacobson Past maintainers: - Jun-ichiro itojun Hagino + Jun-ichiro itojun Hagino diff --git a/libpcap/Makefile.in b/libpcap/Makefile.in index e7ac6a95c3..0db12a484c 100644 --- a/libpcap/Makefile.in +++ b/libpcap/Makefile.in @@ -46,19 +46,21 @@ VPATH = @srcdir@ LD = /usr/bin/ld CC = @CC@ +AR = @AR@ CCOPT = @V_CCOPT@ INCLS = -I. @V_INCLS@ DEFS = @DEFS@ @V_DEFS@ ADDLOBJS = @ADDLOBJS@ ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@ LIBS = @LIBS@ +CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ DYEXT = @DYEXT@ V_RPATH_OPT = @V_RPATH_OPT@ PROG=libpcap # Standard CFLAGS -CFLAGS = @CFLAGS@ $(CCOPT) $(INCLS) $(DEFS) +FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS) INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -70,9 +72,9 @@ RANLIB = @RANLIB@ # problem if you don't own the file but can write to the directory. .c.o: @rm -f $@ - $(CC) $(CFLAGS) -c $(srcdir)/$*.c + $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c -PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@ +PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@ @NETFILTER_SRC@ FSRC = fad-@V_FINDALLDEVS@.c SSRC = @SSRC@ CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \ @@ -115,14 +117,29 @@ HDR = $(PUBHDR) \ sf-pcap-ng.h \ sunatmpos.h +TESTS = \ + filtertest \ + findalldevstest \ + nonblocktest \ + opentest \ + selpolltest + +TESTS_SRC = \ + tests/filtertest.c \ + tests/findalldevstest.c \ + tests/nonblocktest.c \ + tests/opentest.c \ + tests/reactivatetest.c \ + tests/selpolltest.c + GENHDR = \ scanner.h tokdefs.h version.h TAGFILES = \ $(SRC) $(HDR) -CLEANFILES = $(OBJ) libpcap.* filtertest findalldevstest selpolltest \ - opentest $(PROG)-`cat $(srcdir)/VERSION`.tar.gz \ +CLEANFILES = $(OBJ) libpcap.* $(TESTS) \ + $(PROG)-`cat $(srcdir)/VERSION`.tar.gz \ lex.yy.c pcap-config MAN1 = pcap-config.1 @@ -133,8 +150,10 @@ MAN3PCAP_EXPAND = \ pcap_datalink.3pcap.in \ pcap_dump_open.3pcap.in \ pcap_list_datalinks.3pcap.in \ + pcap_list_tstamp_types.3pcap.in \ pcap_open_dead.3pcap.in \ - pcap_open_offline.3pcap.in + pcap_open_offline.3pcap.in \ + pcap_set_tstamp_type.3pcap.in MAN3PCAP_NOEXPAND = \ pcap_activate.3pcap \ @@ -152,9 +171,7 @@ MAN3PCAP_NOEXPAND = \ pcap_file.3pcap \ pcap_fileno.3pcap \ pcap_findalldevs.3pcap \ - pcap_freealldevs.3pcap \ pcap_freecode.3pcap \ - pcap_free_datalinks.3pcap \ pcap_get_selectable_fd.3pcap \ pcap_geterr.3pcap \ pcap_inject.3pcap \ @@ -179,7 +196,9 @@ MAN3PCAP_NOEXPAND = \ pcap_snapshot.3pcap \ pcap_stats.3pcap \ pcap_statustostr.3pcap \ - pcap_strerror.3pcap + pcap_strerror.3pcap \ + pcap_tstamp_type_name_to_val.3pcap \ + pcap_tstamp_type_val_to_name.3pcap MAN3PCAP = $(MAN3PCAP_NOEXPAND) $(MAN3PCAP_EXPAND:.in=) @@ -188,9 +207,11 @@ MANFILE = \ MANMISC = \ pcap-filter.manmisc.in \ - pcap-linktype.manmisc.in + pcap-linktype.manmisc.in \ + pcap-tstamp.manmisc.in EXTRA_DIST = \ + $(TESTS_SRC) \ CHANGES \ ChmodBPF/ChmodBPF \ ChmodBPF/StartupParameters.plist \ @@ -229,8 +250,6 @@ EXTRA_DIST = \ fad-null.c \ fad-sita.c \ fad-win32.c \ - filtertest.c \ - findalldevstest.c \ grammar.y \ install-sh \ lbl/os-aix4.h \ @@ -255,7 +274,6 @@ EXTRA_DIST = \ msdos/pktdrvr.c \ msdos/pktdrvr.h \ msdos/readme.dos \ - opentest.c \ org.tcpdump.chmod_bpf.plist \ packaging/pcap.spec.in \ pcap-bpf.c \ @@ -274,6 +292,8 @@ EXTRA_DIST = \ pcap-libdlpi.c \ pcap-linux.c \ pcap-namedb.h \ + pcap-netfilter-linux.c \ + pcap-netfilter-linux.h \ pcap-nit.c \ pcap-null.c \ pcap-pf.c \ @@ -291,7 +311,6 @@ EXTRA_DIST = \ pcap-win32.c \ runlex.sh \ scanner.l \ - selpolltest.c \ Win32/Include/Gnuc.h \ Win32/Include/addrinfo.h \ Win32/Include/bittypes.h \ @@ -329,7 +348,7 @@ scanner.c: libpcap.a: $(OBJ) @rm -f $@ - ar rc $@ $(OBJ) $(ADDLARCHIVEOBJS) + $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS) $(RANLIB) $@ shared: libpcap.$(DYEXT) @@ -402,7 +421,7 @@ libpcap.sl: $(OBJ) libpcap.shareda: $(OBJ) @rm -f $@ shr.o $(CC) @V_SHLIB_OPT@ -o shr.o $(OBJ) $(ADDLOBJS) $(LDFLAGS) $(LIBS) - ar rc $@ shr.o + $(AR) rc $@ shr.o # # For platforms that don't support shared libraries (or on which we @@ -411,19 +430,19 @@ libpcap.shareda: $(OBJ) libpcap.none: scanner.o: scanner.c tokdefs.h - $(CC) $(CFLAGS) -c scanner.c + $(CC) $(FULL_CFLAGS) -c scanner.c pcap.o: version.h grammar.o: grammar.c @rm -f $@ - $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c + $(CC) $(FULL_CFLAGS) -Dyylval=pcap_lval -c grammar.c version.o: version.c - $(CC) $(CFLAGS) -c version.c + $(CC) $(FULL_CFLAGS) -c version.c snprintf.o: $(srcdir)/missing/snprintf.c - $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c + $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c version.c: $(srcdir)/VERSION @rm -f $@ @@ -457,35 +476,47 @@ bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c bpf_filter.o: bpf_filter.c - $(CC) $(CFLAGS) -c bpf_filter.c + $(CC) $(FULL_CFLAGS) -c bpf_filter.c # # Generate the pcap-config script. # -pcap-config: $(srcdir)/pcap-config.in +# Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<"; +# for example, the Solaris 9 make man page says +# +# Because make assigns $< and $* as it would for implicit rules +# (according to the suffixes list and the directory contents), +# they may be unreliable when used within explicit target entries. +# +# and this is an explicit target entry. +# +# Therefore, instead of using $<, we explicitly put in $(srcdir)/pcap-config.in. +# +pcap-config: $(srcdir)/pcap-config.in ./config.status @rm -f $@ $@.tmp - sed -e 's|@includedir[@]|$(includedir)|g' \ - -e 's|@libdir[@]|$(libdir)|g' \ - -e 's|@LIBS[@]|$(LIBS)|g' \ - -e 's|@V_RPATH_OPT[@]|$(V_RPATH_OPT)|g' \ - $(srcdir)/pcap-config.in >$@.tmp + ./config.status --file=$@.tmp:$(srcdir)/pcap-config.in mv $@.tmp $@ chmod a+x $@ # # Test programs - not built by default, and not installed. # -filtertest: filtertest.c libpcap.a - $(CC) $(CFLAGS) -I. -L. -o filtertest $(srcdir)/filtertest.c libpcap.a $(LIBS) +tests: $(TESTS) + +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) -findalldevstest: findalldevstest.c libpcap.a - $(CC) $(CFLAGS) -I. -L. -o findalldevstest $(srcdir)/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) -selpolltest: selpolltest.c libpcap.a - $(CC) $(CFLAGS) -I. -L. -o selpolltest $(srcdir)/selpolltest.c libpcap.a $(LIBS) +opentest: tests/opentest.c libpcap.a + $(CC) $(FULL_CFLAGS) -I. -L. -o opentest $(srcdir)/tests/opentest.c libpcap.a $(LIBS) -opentest: opentest.c libpcap.a - $(CC) $(CFLAGS) -I. -L. -o opentest $(srcdir)/opentest.c libpcap.a $(LIBS) +selpolltest: tests/selpolltest.c libpcap.a + $(CC) $(FULL_CFLAGS) -I. -L. -o selpolltest $(srcdir)/tests/selpolltest.c libpcap.a $(LIBS) install: install-shared install-archive pcap-config [ -d $(DESTDIR)$(libdir) ] || \ @@ -523,12 +554,21 @@ install: install-shared install-archive pcap-config rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_dump_open.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap + ln $(DESTDIR)$(mandir)/man3/pcap_findalldevs.3pcap \ + $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_geterr.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_inject.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap + ln $(DESTDIR)$(mandir)/man3/pcap_list_datalinks.3pcap \ + $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap + ln $(DESTDIR)$(mandir)/man3/pcap_list_tstamp_types.3pcap \ + $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_loop.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap @@ -612,8 +652,11 @@ uninstall: uninstall-shared rm -f $(DESTDIR)$(mandir)/man3/$$i; done rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap @@ -650,7 +693,7 @@ clean: distclean: clean rm -f Makefile config.cache config.log config.status \ - config.h gnuc.h os-proto.h bpf_filter.c pcap-config \ + config.h gnuc.h net os-proto.h bpf_filter.c pcap-config \ stamp-h stamp-h.in rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=) rm -rf autom4te.cache diff --git a/libpcap/NMAP_MODIFICATIONS b/libpcap/NMAP_MODIFICATIONS deleted file mode 100644 index 908ea5e165..0000000000 --- a/libpcap/NMAP_MODIFICATIONS +++ /dev/null @@ -1,249 +0,0 @@ -o Included this file, renamed directory from libpcap-1.0.0 to libpcap. - -o Added @CFLAGS@ to the CFLAGS definition in Makefile.in to pick up -g - if configure determines that it is supported: - ---- Makefile.in.orig 2009-11-04 11:35:44.000000000 -0700 -+++ Makefile.in 2009-11-04 11:50:02.000000000 -0700 -@@ -55,7 +55,7 @@ - PROG=libpcap - - # Standard CFLAGS --CFLAGS = $(CCOPT) $(INCLS) $(DEFS) -+CFLAGS = @CFLAGS@ $(CCOPT) $(INCLS) $(DEFS) - - INSTALL = @INSTALL@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ - -o Eliminated Lex/Yacc requirement and added the generated files: - grammar.c - scanner.c - scanner.h - tokdefs.h - ---- Makefile.in.orig 2009-11-04 11:35:44.000000000 -0700 -+++ Makefile.in 2009-11-04 11:46:43.000000000 -0700 -@@ -55,21 +55,13 @@ - PROG=libpcap - - # Standard CFLAGS --CFLAGS = $(CCOPT) $(INCLS) $(DEFS) -+CFLAGS = @CFLAGS@ $(CCOPT) $(INCLS) $(DEFS) - - INSTALL = @INSTALL@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ - INSTALL_DATA = @INSTALL_DATA@ - RANLIB = @RANLIB@ - --# --# Flex and bison allow you to specify the prefixes of the global symbols --# used by the generated parser. This allows programs to use lex/yacc --# and link against libpcap. If you don't have flex or bison, get them. --# --LEX = @V_LEX@ --YACC = @V_YACC@ -- - # 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. -@@ -122,7 +114,7 @@ - TAGFILES = \ - $(SRC) $(HDR) $(TAGHDR) - --CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c -+CLEANFILES = $(OBJ) libpcap.a lex.yy.c - - MAN1 = pcap-config.1 - -@@ -313,6 +305,15 @@ - - all: libpcap.a pcap-config - -+# Inhibit implicit rule Make seems to have for using yacc/lex to -+# recompile new scanner.c/grammar.c -- we ship ones which we want to -+# use instead. -+grammar.c: -+ echo "Not rebuilding grammar.c" -+ -+scanner.c: -+ echo "Not rebuilding scanner.c" -+ - libpcap.a: $(OBJ) - @rm -f $@ - $(AR) rc $@ $(OBJ) $(LIBS) -@@ -344,22 +345,11 @@ - -compatibility_version 1 \ - -current_version `sed 's/[^0-9.].*$$//' $(srcdir)/VERSION` - --scanner.c: $(srcdir)/scanner.l -- @rm -f $@ -- ./runlex.sh $(LEX) -o$@ $< -- - scanner.o: scanner.c tokdefs.h - $(CC) $(CFLAGS) -c scanner.c - - pcap.o: version.h - --tokdefs.h: grammar.c --grammar.c: $(srcdir)/grammar.y -- @rm -f grammar.c tokdefs.h -- $(YACC) -d $< -- mv y.tab.c grammar.c -- mv y.tab.h tokdefs.h -- - grammar.o: grammar.c - @rm -f $@ - $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c ---- configure.in.orig 2009-10-27 16:20:34.000000000 -0600 -+++ configure.in 2009-10-27 16:14:32.000000000 -0600 -@@ -848,24 +848,6 @@ - fi - - --AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_) --if test "$V_LEX" = lex ; then --# Some versions of lex can't handle the definitions section of scanner.l . --# Try lexing it and complain if it can't deal. -- AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex, -- if lex -t scanner.l > /dev/null 2>&1; then -- tcpdump_cv_capable_lex=yes -- else -- tcpdump_cv_capable_lex=insufficient -- fi) -- if test $tcpdump_cv_capable_lex = insufficient ; then -- AC_MSG_ERROR([Your operating system's lex is insufficient to compile -- libpcap. flex is a lex replacement that has many advantages, including -- being able to compile libpcap. For more information, see -- http://www.gnu.org/software/flex/flex.html .]) -- fi --fi -- - # - # Assume a.out/ELF convention for shared library names (".so"), and - # V7/BSD convention for man pages (file formats in section 5, -@@ -1004,10 +986,8 @@ - AC_SUBST(V_DEFS) - AC_SUBST(V_INCLS) - AC_SUBST(V_LIBS) --AC_SUBST(V_LEX) - AC_SUBST(V_PCAP) - AC_SUBST(V_FINDALLDEVS) --AC_SUBST(V_YACC) - AC_SUBST(SSRC) - AC_SUBST(DYEXT) - AC_SUBST(DAGLIBS) - -o Added a --disable-packet-ring configure option to allow the creation - of 32-bit binaries compatible with 64-bit Linux kernels before 2.6.27. - -Index: configure.in -=================================================================== ---- configure.in (revision 17694) -+++ configure.in (working copy) -@@ -1396,6 +1396,24 @@ - AC_SUBST(CAN_SRC) - fi - -+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) -Index: pcap-linux.c -=================================================================== ---- pcap-linux.c (revision 17694) -+++ pcap-linux.c (working copy) -@@ -232,17 +232,19 @@ - # endif /* PACKET_HOST */ - - -- /* 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 TPACKET2_HDRLEN --# define HAVE_TPACKET2 --# else --# define TPACKET_V1 0 --# endif /* TPACKET2_HDRLEN */ --# endif /* TPACKET_HDRLEN */ -+# ifdef PCAP_SUPPORT_PACKET_RING -+ /* 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 TPACKET2_HDRLEN -+# define HAVE_TPACKET2 -+# else -+# define TPACKET_V1 0 -+# endif /* TPACKET2_HDRLEN */ -+# endif /* TPACKET_HDRLEN */ -+# endif /* PCAP_SUPPORT_PACKET_RING */ - #endif /* PF_PACKET */ - - #ifdef SO_ATTACH_FILTER - -o Regenerated configure. - -o Added a memset() call that removes a Valgrind error. More info at: - - -Index: pcap-linux.c -=================================================================== ---- pcap-linux.c (revision 20314) -+++ pcap-linux.c (working copy) -@@ -2148,6 +2148,7 @@ - struct sock_fprog fcode; - int can_filter_in_kernel; - int err = 0; -+ memset(&fcode, 0, sizeof(struct sock_fprog)); - #endif - - if (!handle) - -o Moved the inclusion of config.h to the top of scanner.c to work - around _LARGE_FILES definition difficulties on AIX. - ---- libpcap/scanner.l -+++ libpcap/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 47944d7a72..a206474aa1 100644 --- a/libpcap/README +++ b/libpcap/README @@ -63,13 +63,14 @@ added overhead (especially, for selective filters). Ideally, libpcap would translate BPF filters into a filter program that is compatible with the underlying kernel subsystem, but this is not yet implemented. -BPF is standard in 4.4BSD, BSD/OS, NetBSD, FreeBSD, and OpenBSD. DEC -OSF/1/Digital UNIX/Tru64 UNIX uses the packetfilter interface but has -been extended to accept BPF filters (which libpcap utilizes). Also, you -can add BPF filter support to Ultrix using the kernel source and/or -object patches available in: - - ftp://gatekeeper.dec.com/pub/DEC/net/bpfext42.tar.Z. +BPF is standard in 4.4BSD, BSD/OS, NetBSD, FreeBSD, OpenBSD, DragonFly +BSD, and Mac OS X; an older, modified and undocumented version is +standard in AIX. {DEC OSF/1, Digital UNIX, Tru64 UNIX} uses the +packetfilter interface but has been extended to accept BPF filters +(which libpcap utilizes). Also, you can add BPF filter support to +Ultrix using the kernel source and/or object patches available in: + + http://www.tcpdump.org/other/bpfext42.tar.Z Linux, in the 2.2 kernel and later kernels, has a "Socket Filter" mechanism that accepts BPF filters; see the README.linux file for diff --git a/libpcap/README.linux b/libpcap/README.linux index 226b2438b4..f92cd22b9e 100644 --- a/libpcap/README.linux +++ b/libpcap/README.linux @@ -97,12 +97,12 @@ reported by pcap_stats on Linux are as follows: 2.2.x ===== ps_recv Number of packets that were accepted by the pcap filter -ps_drops Always 0, this statistic is not gatherd on this platform +ps_drop Always 0, this statistic is not gatherd on this platform 2.4.x ===== -ps_rec Number of packets that were accepted by the pcap filter -ps_drops Number of packets that had passed filtering but were not +ps_recv Number of packets that were accepted by the pcap filter +ps_drop Number of packets that had passed filtering but were not passed on to pcap due to things like buffer shortage, etc. - This is useful because these are packets you are interested in - but won't be reported by, for example, tcpdump output. + This is useful because these are packets you are interested in + but won't be reported by, for example, tcpdump output. diff --git a/libpcap/VERSION b/libpcap/VERSION index 524cb55242..6085e94650 100644 --- a/libpcap/VERSION +++ b/libpcap/VERSION @@ -1 +1 @@ -1.1.1 +1.2.1 diff --git a/libpcap/Win32/Include/Gnuc.h b/libpcap/Win32/Include/Gnuc.h new file mode 100644 index 0000000000..0bf4b735fb --- /dev/null +++ b/libpcap/Win32/Include/Gnuc.h @@ -0,0 +1,46 @@ +/* @(#) $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 +#if __STDC__ +#define __P(protos) protos +#else +#define __P(protos) () +#endif +#endif + +/* inline foo */ +#ifndef __cplusplus +#ifdef __GNUC__ +#define inline __inline +#else +#define inline +#endif +#endif + +/* + * Handle new and old "dead" routine prototypes + * + * For example: + * + * __dead void foo(void) __attribute__((volatile)); + * + */ +#ifdef __GNUC__ +#ifndef __dead +#define __dead volatile +#endif +#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +#ifndef __attribute__ +#define __attribute__(args) +#endif +#endif +#else +#ifndef __dead +#define __dead +#endif +#ifndef __attribute__ +#define __attribute__(args) +#endif +#endif diff --git a/libpcap/Win32/Include/addrinfo.h b/libpcap/Win32/Include/addrinfo.h new file mode 100644 index 0000000000..8cb2e65ee1 --- /dev/null +++ b/libpcap/Win32/Include/addrinfo.h @@ -0,0 +1,146 @@ +/* + * 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: + * 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. 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 + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT 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. + */ + +/* $Id: addrinfo.h,v 1.1 2002-08-01 08:33:05 risso Exp $ */ + +#ifndef HAVE_ADDRINFO + +/* + * Error return codes from getaddrinfo() + */ +#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ +#define EAI_AGAIN 2 /* temporary failure in name resolution */ +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +#define EAI_NODATA 7 /* no address associated with hostname */ +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error returned in errno */ +#define EAI_BADHINTS 12 +#define EAI_PROTOCOL 13 +#define EAI_MAX 14 + +/* internal error */ +#define NETDB_INTERNAL -1 /* see errno */ + +/* + * Flag values for getaddrinfo() + */ +#define AI_PASSIVE 0x00000001 /* get address to use bind() */ +#define AI_CANONNAME 0x00000002 /* fill ai_canonname */ +#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ +/* valid flags for addrinfo */ +#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST) + +#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ +#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ +#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ +#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ +/* special recommended flags for getipnodebyname */ +#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) + +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; + +extern void freeaddrinfo (struct addrinfo *); +extern void freehostent (struct hostent *); +extern char *gai_strerror (int); +extern int getaddrinfo (const char *, const char *, + const struct addrinfo *, struct addrinfo **); +extern int getnameinfo (const struct sockaddr *, size_t, char *, + size_t, char *, size_t, int); +extern struct hostent *getipnodebyaddr (const void *, size_t, int, int *); +extern struct hostent *getipnodebyname (const char *, int, int, int *); +extern int inet_pton (int, const char *, void *); +extern const char *inet_ntop (int, const void *, char *, size_t); +#else + +#ifndef EAI_BADHINTS +#define EAI_BADHINTS 12 +#endif + +#ifndef EAI_PROTOCOL +#define EAI_PROTOCOL 13 +#endif + +#ifndef EAI_MAX +#define EAI_MAX 14 +#endif + +#ifndef NETDB_INTERNAL +#define NETDB_INTERNAL -1 /* see errno */ +#endif + +#ifndef AI_MASK +/* valid flags for addrinfo */ +#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST) +#endif + +#endif /* HAVE_ADDRINFO */ + +/* + * Constants for getnameinfo() + */ +#ifndef NI_MAXHOST +#define NI_MAXHOST 1025 +#endif +#ifndef NI_MAXSERV +#define NI_MAXSERV 32 +#endif + +/* + * Flag values for getnameinfo() + */ +#ifndef NI_NOFQDN +#define NI_NOFQDN 0x00000001 +#endif +#ifndef NI_NUMERICHOST +#define NI_NUMERICHOST 0x00000002 +#endif +#ifndef NI_NAMEREQD +#define NI_NAMEREQD 0x00000004 +#endif +#ifndef NI_NUMERICSERV +#define NI_NUMERICSERV 0x00000008 +#endif +#ifndef NI_DGRAM +#define NI_DGRAM 0x00000010 +#endif + diff --git a/libpcap/Win32/Include/arpa/nameser.h b/libpcap/Win32/Include/arpa/nameser.h new file mode 100644 index 0000000000..18f185cf5b --- /dev/null +++ b/libpcap/Win32/Include/arpa/nameser.h @@ -0,0 +1,349 @@ +/* + * ++Copyright++ 1983, 1989, 1993 + * - + * 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * 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 + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +/* + * @(#)nameser.h 8.1 (Berkeley) 6/2/93 + * nameser.h,v 1.2 1995/05/06 14:23:54 hjl Exp + */ + +#ifndef _NAMESER_H_ +#define _NAMESER_H_ + +#ifndef WIN32 +#include +#if (!defined(BSD)) || (BSD < 199306) +# include +#else +# include +#endif +#include +#else +#include +#define __LITTLE_ENDIAN 1 +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +/* + * revision information. this is the release date in YYYYMMDD format. + * it can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__BIND > 19931104)". do not + * compare for equality; rather, use it to determine whether your resolver + * is new enough to contain a certain feature. + */ + +#define __BIND 19940417 /* interface version stamp */ + +/* + * Define constants based on rfc883 + */ +#define PACKETSZ 512 /* maximum packet size */ +#define MAXDNAME 256 /* maximum domain name */ +#define MAXCDNAME 255 /* maximum compressed domain name */ +#define MAXLABEL 63 /* maximum length of domain label */ +#define HFIXEDSZ 12 /* #/bytes of fixed data in header */ +#define QFIXEDSZ 4 /* #/bytes of fixed data in query */ +#define RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#define INT32SZ 4 /* for systems without 32-bit ints */ +#define INT16SZ 2 /* for systems without 16-bit ints */ +#define INADDRSZ 4 /* for sizeof(struct inaddr) != 4 */ + +/* + * Internet nameserver port number + */ +#define NAMESERVER_PORT 53 + +/* + * Currently defined opcodes + */ +#define QUERY 0x0 /* standard query */ +#define IQUERY 0x1 /* inverse query */ +#define STATUS 0x2 /* nameserver status query */ +/*#define xxx 0x3 *//* 0x3 reserved */ +#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */ +#ifdef ALLOW_UPDATES + /* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */ +# define UPDATEA 0x9 /* add resource record */ +# define UPDATED 0xa /* delete a specific resource record */ +# define UPDATEDA 0xb /* delete all named resource record */ +# define UPDATEM 0xc /* modify a specific resource record */ +# define UPDATEMA 0xd /* modify all named resource record */ +# define ZONEINIT 0xe /* initial zone transfer */ +# define ZONEREF 0xf /* incremental zone referesh */ +#endif + +/* + * Currently defined response codes + */ +#ifdef HAVE_ADDRINFO +#define NOERROR 0 /* no error */ +#endif /* HAVE_ADDRINFO */ +#define FORMERR 1 /* format error */ +#define SERVFAIL 2 /* server failure */ +#define NXDOMAIN 3 /* non existent domain */ +#define NOTIMP 4 /* not implemented */ +#define REFUSED 5 /* query refused */ +#ifdef ALLOW_UPDATES + /* non standard */ +# define NOCHANGE 0xf /* update failed to change db */ +#endif + +/* + * Type values for resources and queries + */ +#define T_A 1 /* host address */ +#define T_NS 2 /* authoritative server */ +#define T_MD 3 /* mail destination */ +#define T_MF 4 /* mail forwarder */ +#define T_CNAME 5 /* canonical name */ +#define T_SOA 6 /* start of authority zone */ +#define T_MB 7 /* mailbox domain name */ +#define T_MG 8 /* mail group member */ +#define T_MR 9 /* mail rename name */ +#define T_NULL 10 /* null resource record */ +#define T_WKS 11 /* well known service */ +#define T_PTR 12 /* domain name pointer */ +#define T_HINFO 13 /* host information */ +#define T_MINFO 14 /* mailbox information */ +#define T_MX 15 /* mail routing information */ +#define T_TXT 16 /* text strings */ +#define T_RP 17 /* responsible person */ +#define T_AFSDB 18 /* AFS cell database */ +#define T_X25 19 /* X_25 calling address */ +#define T_ISDN 20 /* ISDN calling address */ +#define T_RT 21 /* router */ +#define T_NSAP 22 /* NSAP address */ +#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */ +#define T_SIG 24 /* security signature */ +#define T_KEY 25 /* security key */ +#define T_PX 26 /* X.400 mail mapping */ +#define T_GPOS 27 /* geographical position (withdrawn) */ +#define T_AAAA 28 /* IP6 Address */ +#define T_LOC 29 /* Location Information */ + /* non standard */ +#define T_UINFO 100 /* user (finger) information */ +#define T_UID 101 /* user ID */ +#define T_GID 102 /* group ID */ +#define T_UNSPEC 103 /* Unspecified format (binary data) */ + /* Query type values which do not appear in resource records */ +#define T_AXFR 252 /* transfer zone of authority */ +#define T_MAILB 253 /* transfer mailbox records */ +#define T_MAILA 254 /* transfer mail agent records */ +#define T_ANY 255 /* wildcard match */ + +/* + * Values for class field + */ + +#define C_IN 1 /* the arpa internet */ +#define C_CHAOS 3 /* for chaos net (MIT) */ +#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */ + /* Query class values which do not appear in resource records */ +#define C_ANY 255 /* wildcard match */ + +/* + * Status return codes for T_UNSPEC conversion routines + */ +#define CONV_SUCCESS 0 +#define CONV_OVERFLOW (-1) +#define CONV_BADFMT (-2) +#define CONV_BADCKSUM (-3) +#define CONV_BADBUFLEN (-4) + +#ifndef __BYTE_ORDER +#if (BSD >= 199103) +# include +#else +#ifdef linux +# include +#else +#define __LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */ +#define __BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ +#define __PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/ + +#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \ + defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ + defined(__alpha__) || defined(__alpha) +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ + defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ + defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\ + defined(apollo) || defined(__convex__) || defined(_CRAY) || \ + defined(__hppa) || defined(__hp9000) || \ + defined(__hp9000s300) || defined(__hp9000s700) || \ + defined (BIT_ZERO_ON_LEFT) || defined(m68k) +#define __BYTE_ORDER __BIG_ENDIAN +#endif +#endif /* linux */ +#endif /* BSD */ +#endif /* __BYTE_ORDER */ + +#if !defined(__BYTE_ORDER) || \ + (__BYTE_ORDER != __BIG_ENDIAN && __BYTE_ORDER != __LITTLE_ENDIAN && \ + __BYTE_ORDER != __PDP_ENDIAN) + /* you must determine what the correct bit order is for + * your compiler - the next line is an intentional error + * which will force your compiles to bomb until you fix + * the above macros. + */ + error "Undefined or invalid __BYTE_ORDER"; +#endif + +/* + * Structure for query header. The order of the fields is machine- and + * compiler-dependent, depending on the byte/bit order and the layout + * of bit fields. We use bit fields only in int variables, as this + * is all ANSI requires. This requires a somewhat confusing rearrangement. + */ + +typedef struct { + unsigned id :16; /* query identification number */ +#if __BYTE_ORDER == __BIG_ENDIAN + /* fields in third byte */ + unsigned qr: 1; /* response flag */ + unsigned opcode: 4; /* purpose of message */ + unsigned aa: 1; /* authoritive answer */ + unsigned tc: 1; /* truncated message */ + unsigned rd: 1; /* recursion desired */ + /* fields in fourth byte */ + unsigned ra: 1; /* recursion available */ + unsigned pr: 1; /* primary server req'd (!standard) */ + unsigned unused :2; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned rcode :4; /* response code */ +#endif +#if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN + /* fields in third byte */ + unsigned rd :1; /* recursion desired */ + unsigned tc :1; /* truncated message */ + unsigned aa :1; /* authoritive answer */ + unsigned opcode :4; /* purpose of message */ + unsigned qr :1; /* response flag */ + /* fields in fourth byte */ + unsigned rcode :4; /* response code */ + unsigned unused :2; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned pr :1; /* primary server req'd (!standard) */ + unsigned ra :1; /* recursion available */ +#endif + /* remaining bytes */ + unsigned qdcount :16; /* number of question entries */ + unsigned ancount :16; /* number of answer entries */ + unsigned nscount :16; /* number of authority entries */ + unsigned arcount :16; /* number of resource entries */ +} HEADER; + +/* + * Defines for handling compressed domain names + */ +#define INDIR_MASK 0xc0 + +/* + * Structure for passing resource records around. + */ +struct rrec { + int16_t r_zone; /* zone number */ + int16_t r_class; /* class number */ + int16_t r_type; /* type number */ + u_int32_t r_ttl; /* time to live */ + int r_size; /* size of data area */ + char *r_data; /* pointer to data */ +}; + +//extern u_int16_t _getshort __P((const u_char *)); +//extern u_int32_t _getlong __P((const u_char *)); + +/* + * Inline versions of get/put short/long. Pointer is advanced. + * + * These macros demonstrate the property of C whereby it can be + * portable or it can be elegant but rarely both. + */ +#define GETSHORT(s, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (s) = ((u_int16_t)t_cp[0] << 8) \ + | ((u_int16_t)t_cp[1]) \ + ; \ + (cp) += INT16SZ; \ +} + +#define GETLONG(l, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (l) = ((u_int32_t)t_cp[0] << 24) \ + | ((u_int32_t)t_cp[1] << 16) \ + | ((u_int32_t)t_cp[2] << 8) \ + | ((u_int32_t)t_cp[3]) \ + ; \ + (cp) += INT32SZ; \ +} + +#define PUTSHORT(s, cp) { \ + register u_int16_t t_s = (u_int16_t)(s); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_s >> 8; \ + *t_cp = t_s; \ + (cp) += INT16SZ; \ +} + +#define PUTLONG(l, cp) { \ + register u_int32_t t_l = (u_int32_t)(l); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_l >> 24; \ + *t_cp++ = t_l >> 16; \ + *t_cp++ = t_l >> 8; \ + *t_cp = t_l; \ + (cp) += INT32SZ; \ +} + +#endif /* !_NAMESER_H_ */ diff --git a/libpcap/Win32/Include/bittypes.h b/libpcap/Win32/Include/bittypes.h new file mode 100644 index 0000000000..7c0cbdeb5f --- /dev/null +++ b/libpcap/Win32/Include/bittypes.h @@ -0,0 +1,89 @@ +/* + * 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: + * 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. 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 + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT 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 _BITTYPES_H +#define _BITTYPES_H + +#ifndef HAVE_U_INT8_T +typedef unsigned char u_int8_t; +typedef signed char int8_t; +#endif /* HAVE_U_INT8_T */ + +#ifndef HAVE_U_INT16_T +typedef unsigned short u_int16_t; +typedef signed short int16_t; +#endif /* HAVE_U_INT16_T */ + +#ifndef HAVE_U_INT32_T +typedef unsigned int u_int32_t; +typedef signed int int32_t; +#endif /* HAVE_U_INT32_T */ + +#ifndef HAVE_U_INT64_T +#ifdef _MSC_EXTENSIONS +typedef unsigned _int64 u_int64_t; +typedef _int64 int64_t; +#else /* _MSC_EXTENSIONS */ +typedef unsigned long long u_int64_t; +typedef long long int64_t; +#endif /* _MSC_EXTENSIONS */ +#endif /* HAVE_U_INT64_T */ + +#ifndef PRId64 +#ifdef _MSC_EXTENSIONS +#define PRId64 "I64d" +#else /* _MSC_EXTENSIONS */ +#define PRId64 "lld" +#endif /* _MSC_EXTENSIONS */ +#endif /* PRId64 */ + +#ifndef PRIo64 +#ifdef _MSC_EXTENSIONS +#define PRIo64 "I64o" +#else /* _MSC_EXTENSIONS */ +#define PRIo64 "llo" +#endif /* _MSC_EXTENSIONS */ +#endif /* PRIo64 */ + +#ifndef PRIx64 +#ifdef _MSC_EXTENSIONS +#define PRIx64 "I64x" +#else /* _MSC_EXTENSIONS */ +#define PRIx64 "llx" +#endif /* _MSC_EXTENSIONS */ +#endif /* PRIx64 */ + +#ifndef PRIu64 +#ifdef _MSC_EXTENSIONS +#define PRIu64 "I64u" +#else /* _MSC_EXTENSIONS */ +#define PRIu64 "llu" +#endif /* _MSC_EXTENSIONS */ +#endif /* PRIu64 */ + +#endif /* _BITTYPES_H */ diff --git a/libpcap/Win32/Include/cdecl_ext.h b/libpcap/Win32/Include/cdecl_ext.h new file mode 100644 index 0000000000..9591db2645 --- /dev/null +++ b/libpcap/Win32/Include/cdecl_ext.h @@ -0,0 +1,37 @@ +/* + * 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: + * 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. 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 + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT 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 HAVE_PORTABLE_PROTOTYPE + +#if defined(__STDC__) || defined(__cplusplus) +#define __P(protos) protos /* full-blown ANSI C */ +#else +#define __P(protos) () /* traditional C preprocessor */ +#endif + +#endif /* !HAVE_PORTABLE_PROTOTYPE */ diff --git a/libpcap/Win32/Include/inetprivate.h b/libpcap/Win32/Include/inetprivate.h new file mode 100644 index 0000000000..e25ed3d6c9 --- /dev/null +++ b/libpcap/Win32/Include/inetprivate.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 1999 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * 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. Neither the name of the Politecnico di Torino 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 + * "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. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern void _sethtent(int f); +extern void _endhtent(void); +extern struct hostent *_gethtent(void); +extern struct hostent *_gethtbyname(const char *name); +extern struct hostent *_gethtbyaddr(const char *addr, int len, + int type); +extern int _validuser(FILE *hostf, const char *rhost, + const char *luser, const char *ruser, int baselen); +extern int _checkhost(const char *rhost, const char *lhost, int len); +#if 0 +extern void putlong(u_long l, u_char *msgp); +extern void putshort(u_short l, u_char *msgp); +extern u_int32_t _getlong(register const u_char *msgp); +extern u_int16_t _getshort(register const u_char *msgp); +extern void p_query(char *msg); +extern void fp_query(char *msg, FILE *file); +extern char *p_cdname(char *cp, char *msg, FILE *file); +extern char *p_rr(char *cp, char *msg, FILE *file); +extern char *p_type(int type); +extern char * p_class(int class); +extern char *p_time(u_long value); +#endif +extern char * hostalias(const char *name); +extern void sethostfile(char *name); +extern void _res_close (void); +extern void ruserpass(const char *host, char **aname, char **apass); diff --git a/libpcap/Win32/Include/ip6_misc.h b/libpcap/Win32/Include/ip6_misc.h new file mode 100644 index 0000000000..562fa6184e --- /dev/null +++ b/libpcap/Win32/Include/ip6_misc.h @@ -0,0 +1,163 @@ +/* + * Copyright (c) 1993, 1994, 1997 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.5 2006-01-22 18:02:18 gianluca Exp $ (LBL) + */ + +/* + * This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows + */ + +#include + +#include + +#ifndef __MINGW32__ +#define IN_MULTICAST(a) IN_CLASSD(a) +#endif + +#define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000) + +#define IN_LOOPBACKNET 127 + +#if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) +/* IPv6 address */ +struct in6_addr + { + union + { + u_int8_t u6_addr8[16]; + u_int16_t u6_addr16[8]; + u_int32_t u6_addr32[4]; + } in6_u; +#define s6_addr in6_u.u6_addr8 +#define s6_addr16 in6_u.u6_addr16 +#define s6_addr32 in6_u.u6_addr32 +#define s6_addr64 in6_u.u6_addr64 + }; + +#define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } +#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } +#endif /* __MINGW32__ */ + + +#if (defined _MSC_VER) || (defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF)) +typedef unsigned short sa_family_t; +#endif + + +#if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) + +#define __SOCKADDR_COMMON(sa_prefix) \ + sa_family_t sa_prefix##family + +/* Ditto, for IPv6. */ +struct sockaddr_in6 + { + __SOCKADDR_COMMON (sin6_); + u_int16_t sin6_port; /* Transport layer port # */ + u_int32_t sin6_flowinfo; /* IPv6 flow information */ + struct in6_addr sin6_addr; /* IPv6 address */ + }; + +#define IN6_IS_ADDR_V4MAPPED(a) \ + ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \ + (((u_int32_t *) (a))[2] == htonl (0xffff))) + +#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff) + +#define IN6_IS_ADDR_LINKLOCAL(a) \ + ((((u_int32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000)) + +#define IN6_IS_ADDR_LOOPBACK(a) \ + (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \ + ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1)) +#endif /* __MINGW32__ */ + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] + +/* + * IPV6 extension headers + */ +#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ +#define IPPROTO_IPV6 41 /* IPv6 header. */ +#define IPPROTO_ROUTING 43 /* IPv6 routing header */ +#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ +#define IPPROTO_ESP 50 /* encapsulating security payload */ +#define IPPROTO_AH 51 /* authentication header */ +#define IPPROTO_ICMPV6 58 /* ICMPv6 */ +#define IPPROTO_NONE 59 /* IPv6 no next header */ +#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ +#define IPPROTO_PIM 103 /* Protocol Independent Multicast. */ + +#define IPV6_RTHDR_TYPE_0 0 + +/* Option types and related macros */ +#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ +#define IP6OPT_PADN 0x01 /* 00 0 00001 */ +#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ +#define IP6OPT_JUMBO_LEN 6 +#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */ + +#define IP6OPT_RTALERT_LEN 4 +#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ +#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ +#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ +#define IP6OPT_MINLEN 2 + +#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ +#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ +#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ +#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ +#define IP6OPT_EID 0x8a /* 10 0 01010 */ + +#define IP6OPT_TYPE(o) ((o) & 0xC0) +#define IP6OPT_TYPE_SKIP 0x00 +#define IP6OPT_TYPE_DISCARD 0x40 +#define IP6OPT_TYPE_FORCEICMP 0x80 +#define IP6OPT_TYPE_ICMP 0xC0 + +#define IP6OPT_MUTABLE 0x20 + + +#if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) +#ifndef EAI_ADDRFAMILY +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; +#endif +#endif /* __MINGW32__ */ diff --git a/libpcap/Win32/Include/net/if.h b/libpcap/Win32/Include/net/if.h new file mode 100644 index 0000000000..bf926b6ef5 --- /dev/null +++ b/libpcap/Win32/Include/net/if.h @@ -0,0 +1,230 @@ +/* + * Copyright (c) 1982, 1986, 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if.h,v 1.49.2.1 1999/08/29 16:28:15 peter Exp $ + */ + +#ifndef _NET_IF_H_ +#define _NET_IF_H_ + +/* + * does not depend on on most other systems. This + * helps userland compatability. (struct timeval ifi_lastchange) + */ +#ifndef KERNEL +#include +#endif + +/* + * Structure describing information about an interface + * which may be of interest to management entities. + */ +struct if_data { + /* generic interface information */ + u_char ifi_type; /* ethernet, tokenring, etc */ + u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ + u_char ifi_addrlen; /* media address length */ + u_char ifi_hdrlen; /* media header length */ + u_char ifi_recvquota; /* polling quota for receive intrs */ + u_char ifi_xmitquota; /* polling quota for xmit intrs */ + u_long ifi_mtu; /* maximum transmission unit */ + u_long ifi_metric; /* routing metric (external only) */ + u_long ifi_baudrate; /* linespeed */ + /* volatile statistics */ + u_long ifi_ipackets; /* packets received on interface */ + u_long ifi_ierrors; /* input errors on interface */ + u_long ifi_opackets; /* packets sent on interface */ + u_long ifi_oerrors; /* output errors on interface */ + u_long ifi_collisions; /* collisions on csma interfaces */ + u_long ifi_ibytes; /* total number of octets received */ + u_long ifi_obytes; /* total number of octets sent */ + u_long ifi_imcasts; /* packets received via multicast */ + u_long ifi_omcasts; /* packets sent via multicast */ + u_long ifi_iqdrops; /* dropped on input, this interface */ + u_long ifi_noproto; /* destined for unsupported protocol */ + u_long ifi_recvtiming; /* usec spent receiving when timing */ + u_long ifi_xmittiming; /* usec spent xmitting when timing */ + struct timeval ifi_lastchange; /* time of last administrative change */ +}; + +/* ws2tcpip.h has interface flags: IFF_* */ +#if 0 +#define IFF_UP 0x1 /* interface is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_DEBUG 0x4 /* turn on debugging */ +#define IFF_LOOPBACK 0x8 /* is a loopback net */ +#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ +/*#define IFF_NOTRAILERS 0x20 * obsolete: avoid use of trailers */ +#define IFF_RUNNING 0x40 /* resources allocated */ +#define IFF_NOARP 0x80 /* no address resolution protocol */ +#define IFF_PROMISC 0x100 /* receive all packets */ +#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ +#define IFF_OACTIVE 0x400 /* transmission in progress */ +#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ +#define IFF_LINK0 0x1000 /* per link layer defined bit */ +#define IFF_LINK1 0x2000 /* per link layer defined bit */ +#define IFF_LINK2 0x4000 /* per link layer defined bit */ +#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */ +#define IFF_MULTICAST 0x8000 /* supports multicast */ +#endif /* 0 */ + +/* flags set internally only: */ +#define IFF_CANTCHANGE \ + (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ + IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI) + +#define IFQ_MAXLEN 50 +#define IFNET_SLOWHZ 1 /* granularity is 1 second */ + +/* + * Message format for use in obtaining information about interfaces + * from getkerninfo and the routing socket + */ +struct if_msghdr { + u_short ifm_msglen; /* to skip over non-understood messages */ + u_char ifm_version; /* future binary compatability */ + u_char ifm_type; /* message type */ + int ifm_addrs; /* like rtm_addrs */ + int ifm_flags; /* value of if_flags */ + u_short ifm_index; /* index for associated ifp */ + struct if_data ifm_data;/* statistics and other data about if */ +}; + +/* + * Message format for use in obtaining information about interface addresses + * from getkerninfo and the routing socket + */ +struct ifa_msghdr { + u_short ifam_msglen; /* to skip over non-understood messages */ + u_char ifam_version; /* future binary compatability */ + u_char ifam_type; /* message type */ + int ifam_addrs; /* like rtm_addrs */ + int ifam_flags; /* value of ifa_flags */ + u_short ifam_index; /* index for associated ifp */ + int ifam_metric; /* value of ifa_metric */ +}; + +/* + * Message format for use in obtaining information about multicast addresses + * from the routing socket + */ +struct ifma_msghdr { + u_short ifmam_msglen; /* to skip over non-understood messages */ + u_char ifmam_version; /* future binary compatability */ + u_char ifmam_type; /* message type */ + int ifmam_addrs; /* like rtm_addrs */ + int ifmam_flags; /* value of ifa_flags */ + u_short ifmam_index; /* index for associated ifp */ +}; + +/* + * Interface request structure used for socket + * ioctl's. All interface ioctl's must have parameter + * definitions which begin with ifr_name. The + * remainder may be interface specific. + */ +struct ifreq { +#define IFNAMSIZ 16 + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + short ifru_flags; + int ifru_metric; + int ifru_mtu; + int ifru_phys; + int ifru_media; + caddr_t ifru_data; + } ifr_ifru; +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +#define ifr_phys ifr_ifru.ifru_phys /* physical wire */ +#define ifr_media ifr_ifru.ifru_media /* physical media */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +}; + +#define _SIZEOF_ADDR_IFREQ(ifr) \ + ((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \ + (sizeof(struct ifreq) - sizeof(struct sockaddr) + \ + (ifr).ifr_addr.sa_len) : sizeof(struct ifreq)) + +struct ifaliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr ifra_addr; + struct sockaddr ifra_broadaddr; + struct sockaddr ifra_mask; +}; + +struct ifmediareq { + char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + int ifm_current; /* current media options */ + int ifm_mask; /* don't care mask */ + int ifm_status; /* media status */ + int ifm_active; /* active options */ + int ifm_count; /* # entries in ifm_ulist array */ + int *ifm_ulist; /* media words */ +}; +/* + * Structure used in SIOCGIFCONF request. + * Used to retrieve interface configuration + * for machine (useful for programs which + * must know all networks accessible). + */ +struct ifconf { + int ifc_len; /* size of associated buffer */ + union { + caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ +}; + +#ifdef KERNEL +#ifdef MALLOC_DECLARE +MALLOC_DECLARE(M_IFADDR); +MALLOC_DECLARE(M_IFMADDR); +#endif +#endif + +/* XXX - this should go away soon */ +#ifdef KERNEL +#include +#endif + +#endif /* !_NET_IF_H_ */ diff --git a/libpcap/Win32/Include/net/netdb.h b/libpcap/Win32/Include/net/netdb.h new file mode 100644 index 0000000000..b9d45acf6d --- /dev/null +++ b/libpcap/Win32/Include/net/netdb.h @@ -0,0 +1,164 @@ +/*- + * Copyright (c) 1980, 1983, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)netdb.h 8.1 (Berkeley) 6/2/93 + * netdb.h,v 1.4 1995/08/14 04:05:04 hjl Exp + * - + * 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 + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#ifndef _NETDB_H_ +#define _NETDB_H_ + +#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) +#include +#include +#endif + +#include +#include + +#define _PATH_HEQUIV __PATH_ETC_INET"/hosts.equiv" +#define _PATH_HOSTS __PATH_ETC_INET"/hosts" +#define _PATH_NETWORKS __PATH_ETC_INET"/networks" +#define _PATH_PROTOCOLS __PATH_ETC_INET"/protocols" +#define _PATH_SERVICES __PATH_ETC_INET"/services" +#define _PATH_RESCONF __PATH_ETC_INET"/resolv.conf" +#define _PATH_RPC __PATH_ETC_INET"/rpc" + +struct rpcent { + char *r_name; /* name of server for this rpc program */ + char **r_aliases; /* alias list */ + int r_number; /* rpc program number */ +}; + +#ifndef WIN32 +#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) + +#define __NETDB_MAXALIASES 35 +#define __NETDB_MAXADDRS 35 + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (left in extern int h_errno). + */ +#define h_errno (*__h_errno_location ()) +#else +extern int h_errno; +#endif +#endif + +#define NETDB_INTERNAL -1 /* see errno */ +#define NETDB_SUCCESS 0 /* no problem */ + +//#include + +void endhostent (void); +void endnetent (void); +void endprotoent (void); +void endservent (void); +void endrpcent (void); +struct hostent *gethostent (void); +struct netent *getnetbyaddr (long, int); /* u_long? */ +struct netent *getnetbyname (const char *); +struct netent *getnetent (void); +struct protoent *getprotoent (void); +struct servent *getservent (void); +struct rpcent *getrpcent (void); +struct rpcent *getrpcbyname (const char *); +struct rpcent *getrpcbynumber (int); +void herror (const char *); +void sethostent (int); +/* void sethostfile (const char *); */ +void setnetent (int); +void setprotoent (int); +void setservent (int); +void setrpcent (int); + +#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) +struct hostent *gethostbyaddr_r (const char *__addr, + int __length, int __type, + struct hostent *__result, + char *__buffer, int __buflen, int *__h_errnop); +struct hostent *gethostbyname_r (const char * __name, + struct hostent *__result, char *__buffer, + int __buflen, int *__h_errnop); +struct hostent *gethostent_r (struct hostent *__result, + char *__buffer, int __buflen, int *__h_errnop); +struct netent *getnetbyaddr_r (long __net, int __type, + struct netent *__result, char *__buffer, + int __buflen); +struct netent *getnetbyname_r (const char * __name, + struct netent *__result, char *__buffer, + int __buflen); +struct netent *getnetent_r (struct netent *__result, + char *__buffer, int __buflen); +struct protoent *getprotobyname_r (const char * __name, + struct protoent *__result, char *__buffer, + int __buflen); +struct protoent *getprotobynumber_r (int __proto, + struct protoent *__result, char *__buffer, + int __buflen); +struct protoent *getprotoent_r (struct protoent *__result, + char *__buffer, int __buflen); +struct servent *getservbyname_r (const char * __name, + const char *__proto, struct servent *__result, + char *__buffer, int __buflen); +struct servent *getservbyport_r (int __port, + const char *__proto, struct servent *__result, + char *__buffer, int __buflen); +struct servent *getservent_r (struct servent *__result, + char *__buffer, int __buflen); + +int *__h_errno_location (void); + +#endif + +#endif /* !_NETDB_H_ */ diff --git a/libpcap/Win32/Include/net/paths.h b/libpcap/Win32/Include/net/paths.h new file mode 100644 index 0000000000..987de4f0dc --- /dev/null +++ b/libpcap/Win32/Include/net/paths.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)paths.h 5.15 (Berkeley) 5/29/91 + */ + +#ifndef _PATHS_H_ +#define _PATHS_H_ + +#if 0 +#define __PATH_ETC_INET "/usr/etc/inet" +#else +#define __PATH_ETC_INET "/etc" +#endif + +/* Default search path. */ +#define _PATH_DEFPATH "/usr/local/bin:/usr/bin:/bin:." +#define _PATH_DEFPATH_ROOT "/sbin:/bin:/usr/sbin:/usr/bin" + +#define _PATH_BSHELL "/bin/sh" +#define _PATH_CONSOLE "/dev/console" +#define _PATH_CSHELL "/bin/csh" +#define _PATH_DEVDB "/var/run/dev.db" +#define _PATH_DEVNULL "/dev/null" +#define _PATH_DRUM "/dev/drum" +#define _PATH_HEQUIV __PATH_ETC_INET"/hosts.equiv" +#define _PATH_KMEM "/dev/kmem" +#define _PATH_MAILDIR "/var/spool/mail" +#define _PATH_MAN "/usr/man" +#define _PATH_MEM "/dev/mem" +#define _PATH_LOGIN "/bin/login" +#define _PATH_NOLOGIN "/etc/nologin" +#define _PATH_SENDMAIL "/usr/sbin/sendmail" +#define _PATH_SHELLS "/etc/shells" +#define _PATH_TTY "/dev/tty" +#define _PATH_UNIX "/vmlinux" +#define _PATH_VI "/usr/bin/vi" + +/* Provide trailing slash, since mostly used for building pathnames. */ +#define _PATH_DEV "/dev/" +#define _PATH_TMP "/tmp/" +#define _PATH_VARRUN "/var/run/" +#define _PATH_VARTMP "/var/tmp/" + +#define _PATH_KLOG "/proc/kmsg" +#define _PATH_LOGCONF __PATH_ETC_INET"/syslog.conf" +#if 0 +#define _PATH_LOGPID __PATH_ETC_INET"/syslog.pid" +#else +#define _PATH_LOGPID "/var/run/syslog.pid" +#endif +#define _PATH_LOG "/dev/log" +#define _PATH_CONSOLE "/dev/console" + +#if 0 +#define _PATH_UTMP "/var/adm/utmp" +#define _PATH_WTMP "/var/adm/wtmp" +#define _PATH_LASTLOG "/var/adm/lastlog" +#else +#define _PATH_UTMP "/var/run/utmp" +#define _PATH_WTMP "/var/log/wtmp" +#define _PATH_LASTLOG "/var/log/lastlog" +#endif + +#define _PATH_LOCALE "/usr/lib/locale" + +#define _PATH_RWHODIR "/var/spool/rwho" + +#if _MIT_POSIX_THREADS +/* For the MIT pthreads */ +#define _PATH_PTY "/dev/" +#define _PATH_TZDIR "/usr/lib/zoneinfo" +#define _PATH_TZFILE "/usr/lib/zoneinfo/localtime" +#endif + +#endif /* !_PATHS_H_ */ diff --git a/libpcap/Win32/Include/sockstorage.h b/libpcap/Win32/Include/sockstorage.h new file mode 100644 index 0000000000..557eb4df0a --- /dev/null +++ b/libpcap/Win32/Include/sockstorage.h @@ -0,0 +1,38 @@ +/* + * 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: + * 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. 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 + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT 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. + */ +struct sockaddr_storage { +#ifdef HAVE_SOCKADDR_SA_LEN + u_int8_t __ss_len; + u_int8_t __ss_family; + u_int8_t fill[126]; +#else + u_int8_t __ss_family; + u_int8_t fill[127]; +#endif /* HAVE_SOCKADDR_SA_LEN */ +}; diff --git a/libpcap/Win32/Prj/libpcap.dsp b/libpcap/Win32/Prj/libpcap.dsp new file mode 100644 index 0000000000..17e5a7037d --- /dev/null +++ b/libpcap/Win32/Prj/libpcap.dsp @@ -0,0 +1,168 @@ +# Microsoft Developer Studio Project File - Name="libpcap" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +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 NMAKE /f "libpcap.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libpcap.mak" CFG="libpcap - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libpcap - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libpcap - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libpcap - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../" /I "../../lbl/" /I "../../bpf/" /I "../include/" /I "../../../../common" /I "../../../../dag/include" /I "../../../../dag/drv/windows" /D "NDEBUG" /D "YY_NEVER_INTERACTIVE" /D yylval=pcap_lval /D "_USRDLL" /D "LIBPCAP_EXPORTS" /D "HAVE_STRERROR" /D "__STDC__" /D "INET6" /D "_WINDOWS" /D "_MBCS" /D "HAVE_ADDRINFO" /D "WIN32" /D _U_= /D "HAVE_SNPRINTF" /D "HAVE_VSNPRINTF" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "libpcap - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../" /I "../../lbl/" /I "../../bpf/" /I "../include/" /I "../../../../common" /I "../../../../dag/include" /I "../../../../dag/drv/windows" /D "_DEBUG" /D "YY_NEVER_INTERACTIVE" /D yylval=pcap_lval /D "_USRDLL" /D "LIBPCAP_EXPORTS" /D "HAVE_STRERROR" /D "__STDC__" /D "INET6" /D "_WINDOWS" /D "_MBCS" /D "HAVE_ADDRINFO" /D "WIN32" /D _U_= /D "HAVE_SNPRINTF" /D "HAVE_VSNPRINTF" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "libpcap - Win32 Release" +# Name "libpcap - Win32 Debug" +# Begin Source File + +SOURCE=..\..\bpf_dump.c +# End Source File +# Begin Source File + +SOURCE=..\..\bpf\net\bpf_filter.c +# End Source File +# Begin Source File + +SOURCE=..\..\bpf_image.c +# End Source File +# Begin Source File + +SOURCE=..\..\etherent.c +# End Source File +# Begin Source File + +SOURCE="..\..\fad-win32.c" +# End Source File +# Begin Source File + +SOURCE=..\Src\ffs.c +# End Source File +# Begin Source File + +SOURCE=..\..\gencode.c +# End Source File +# Begin Source File + +SOURCE=..\Src\getnetbynm.c +# End Source File +# Begin Source File + +SOURCE=..\Src\getnetent.c +# End Source File +# Begin Source File + +SOURCE=..\Src\getservent.c +# End Source File +# Begin Source File + +SOURCE=..\..\grammar.c +# End Source File +# Begin Source File + +SOURCE=..\..\inet.c +# End Source File +# Begin Source File + +SOURCE=..\Src\inet_aton.c +# End Source File +# Begin Source File + +SOURCE=..\Src\inet_net.c +# End Source File +# Begin Source File + +SOURCE=..\Src\inet_pton.c +# End Source File +# Begin Source File + +SOURCE=..\..\nametoaddr.c +# End Source File +# Begin Source File + +SOURCE=..\..\optimize.c +# End Source File +# Begin Source File + +SOURCE="..\..\Pcap-win32.c" +# End Source File +# Begin Source File + +SOURCE=..\..\pcap.c +# End Source File +# Begin Source File + +SOURCE=..\..\savefile.c +# End Source File +# Begin Source File + +SOURCE=..\..\scanner.c +# End Source File +# End Target +# End Project diff --git a/libpcap/Win32/Prj/libpcap.dsw b/libpcap/Win32/Prj/libpcap.dsw new file mode 100644 index 0000000000..8cdff2d020 --- /dev/null +++ b/libpcap/Win32/Prj/libpcap.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "libpcap"=".\libpcap.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/libpcap/Win32/Src/ffs.c b/libpcap/Win32/Src/ffs.c new file mode 100644 index 0000000000..099ff8e4c9 --- /dev/null +++ b/libpcap/Win32/Src/ffs.c @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)ffs.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include + +/* + * ffs -- vax ffs instruction + */ +int +ffs(mask) + register int mask; +{ + register int bit; + + if (mask == 0) + return(0); + for (bit = 1; !(mask & 1); bit++) + mask >>= 1; + return(bit); +} diff --git a/libpcap/Win32/Src/gai_strerror.c b/libpcap/Win32/Src/gai_strerror.c new file mode 100644 index 0000000000..edd970b927 --- /dev/null +++ b/libpcap/Win32/Src/gai_strerror.c @@ -0,0 +1,83 @@ +/* + * 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: + * 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. 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 + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT 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. + */ + +/* +#include + +__FBSDID("$FreeBSD: /repoman/r/ncvs/src/lib/libc/net/gai_strerror.c,v 1.1 2005/04/06 12:45:51 ume Exp $"); + +*/ + +#ifdef WIN32 + +#include + +#else + +#include + +#endif + +/* Entries EAI_ADDRFAMILY (1) and EAI_NODATA (7) are obsoleted, but left */ +/* for backward compatibility with userland code prior to 2553bis-02 */ +static char *ai_errlist[] = { + "Success", /* 0 */ + "Address family for hostname not supported", /* 1 */ + "Temporary failure in name resolution", /* EAI_AGAIN */ + "Invalid value for ai_flags", /* EAI_BADFLAGS */ + "Non-recoverable failure in name resolution", /* EAI_FAIL */ + "ai_family not supported", /* EAI_FAMILY */ + "Memory allocation failure", /* EAI_MEMORY */ + "No address associated with hostname", /* 7 */ + "hostname nor servname provided, or not known", /* EAI_NONAME */ + "servname not supported for ai_socktype", /* EAI_SERVICE */ + "ai_socktype not supported", /* EAI_SOCKTYPE */ + "System error returned in errno", /* EAI_SYSTEM */ + "Invalid value for hints", /* EAI_BADHINTS */ + "Resolved protocol is unknown" /* EAI_PROTOCOL */ +}; + +#ifndef EAI_MAX +#define EAI_MAX (sizeof(ai_errlist)/sizeof(ai_errlist[0])) +#endif + +/* on MingW, gai_strerror is available. + We need to compile gai_strerrorA only for Cygwin + */ +#ifndef gai_strerror + +char * +WSAAPI gai_strerrorA(int ecode) +{ + if (ecode >= 0 && ecode < EAI_MAX) + return ai_errlist[ecode]; + return "Unknown error"; +} + +#endif /* gai_strerror */ \ No newline at end of file diff --git a/libpcap/Win32/Src/getaddrinfo.c b/libpcap/Win32/Src/getaddrinfo.c new file mode 100644 index 0000000000..ebfe8c2c95 --- /dev/null +++ b/libpcap/Win32/Src/getaddrinfo.c @@ -0,0 +1,1129 @@ +/* + * 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: + * 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. 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 + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT 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 FAITH" part is local hack for supporting IPv4-v6 translator. + * + * Issues to be discussed: + * - Thread safe-ness must be checked. + * - Return values. There are nonstandard return values defined and used + * in the source code. This is because RFC2553 is silent about which error + * code must be returned for which situation. + * Note: + * - We use getipnodebyname() just for thread-safeness. There's no intent + * to let it do PF_UNSPEC (actually we never pass PF_UNSPEC to + * getipnodebyname(). + * - The code filters out AFs that are not supported by the kernel, + * when globbing NULL hostname (to loopback, or wildcard). Is it the right + * thing to do? What is the relationship with post-RFC2553 AI_ADDRCONFIG + * in ai_flags? + */ + +/* + * 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 +#if 0 +#include +#endif +#ifndef __MINGW32__ +#include +#endif +#include +#include +#include +#include +#include +#include + +#ifndef HAVE_PORTABLE_PROTOTYPE +#include "cdecl_ext.h" +#endif + +#ifndef HAVE_U_INT32_T +#include "bittypes.h" +#endif + +#ifndef HAVE_SOCKADDR_STORAGE +#ifndef __MINGW32__ +#include "sockstorage.h" +#endif +#endif + +#ifdef NEED_ADDRINFO_H +#include "addrinfo.h" +#ifdef WIN32 +#include "ip6_misc.h" +#endif +#endif + + +#if defined(__KAME__) && defined(INET6) +# define FAITH +#endif + +#define SUCCESS 0 +#define ANY 0 +#define YES 1 +#define NO 0 + +#ifdef FAITH +static int translate = NO; +static struct in6_addr faith_prefix = IN6ADDR_ANY_INIT; +#endif + +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 in6_loopback[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 +}; + +struct sockinet { + u_char si_len; + u_char si_family; + u_short si_port; + u_int32_t si_scope_id; +}; + +static const struct afd { + int a_af; + int a_addrlen; + int a_socklen; + int a_off; + const char *a_addrany; + const char *a_loopback; + int a_scoped; +} afdl [] = { +#ifdef INET6 + {PF_INET6, sizeof(struct in6_addr), + sizeof(struct sockaddr_in6), + offsetof(struct sockaddr_in6, sin6_addr), + in6_addrany, in6_loopback, 1}, +#endif + {PF_INET, sizeof(struct in_addr), + sizeof(struct sockaddr_in), + offsetof(struct sockaddr_in, sin_addr), + in_addrany, in_loopback, 0}, + {0, 0, 0, 0, NULL, NULL, 0}, +}; + +struct explore { + int e_af; + int e_socktype; + int e_protocol; + const char *e_protostr; + int e_wild; +#define WILD_AF(ex) ((ex)->e_wild & 0x01) +#define WILD_SOCKTYPE(ex) ((ex)->e_wild & 0x02) +#define WILD_PROTOCOL(ex) ((ex)->e_wild & 0x04) +}; + +static const struct explore explore[] = { +#if 0 + { PF_LOCAL, 0, ANY, ANY, NULL, 0x01 }, +#endif +#ifdef INET6 + { PF_INET6, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, + { PF_INET6, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, + { PF_INET6, SOCK_RAW, ANY, NULL, 0x05 }, +#endif + { PF_INET, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, + { PF_INET, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, + { PF_INET, SOCK_RAW, ANY, NULL, 0x05 }, + { -1, 0, 0, NULL, 0 }, +}; + +#ifdef INET6 +#define PTON_MAX 16 +#else +#define PTON_MAX 4 +#endif + + +static int str_isnumber __P((const char *)); +static int explore_fqdn __P((const struct addrinfo *, const char *, + const char *, struct addrinfo **)); +static int explore_null __P((const struct addrinfo *, const char *, + const char *, struct addrinfo **)); +static int explore_numeric __P((const struct addrinfo *, const char *, + const char *, struct addrinfo **)); +static int explore_numeric_scope __P((const struct addrinfo *, const char *, + const char *, struct addrinfo **)); +static int get_name __P((const char *, const struct afd *, struct addrinfo **, + char *, const struct addrinfo *, const char *)); +static int get_canonname __P((const struct addrinfo *, + struct addrinfo *, const char *)); +static struct addrinfo *get_ai __P((const struct addrinfo *, + const struct afd *, const char *)); +static int get_portmatch __P((const struct addrinfo *, const char *)); +static int get_port __P((struct addrinfo *, const char *, int)); +static const struct afd *find_afd __P((int)); + +static char *ai_errlist[] = { + "Success", + "Address family for hostname not supported", /* EAI_ADDRFAMILY */ + "Temporary failure in name resolution", /* EAI_AGAIN */ + "Invalid value for ai_flags", /* EAI_BADFLAGS */ + "Non-recoverable failure in name resolution", /* EAI_FAIL */ + "ai_family not supported", /* EAI_FAMILY */ + "Memory allocation failure", /* EAI_MEMORY */ + "No address associated with hostname", /* EAI_NODATA */ + "hostname nor servname provided, or not known", /* EAI_NONAME */ + "servname not supported for ai_socktype", /* EAI_SERVICE */ + "ai_socktype not supported", /* EAI_SOCKTYPE */ + "System error returned in errno", /* EAI_SYSTEM */ + "Invalid value for hints", /* EAI_BADHINTS */ + "Resolved protocol is unknown", /* EAI_PROTOCOL */ + "Unknown error", /* EAI_MAX */ +}; + +/* XXX macros that make external reference is BAD. */ + +#define GET_AI(ai, afd, addr) \ +do { \ + /* external reference: pai, error, and label free */ \ + (ai) = get_ai(pai, (afd), (addr)); \ + if ((ai) == NULL) { \ + error = EAI_MEMORY; \ + goto free; \ + } \ +} while (0) + +#define GET_PORT(ai, serv) \ +do { \ + /* external reference: error and label free */ \ + error = get_port((ai), (serv), 0); \ + if (error != 0) \ + goto free; \ +} while (0) + +#define GET_CANONNAME(ai, str) \ +do { \ + /* external reference: pai, error and label free */ \ + error = get_canonname(pai, (ai), (str)); \ + if (error != 0) \ + goto free; \ +} while (0) + +#define ERR(err) \ +do { \ + /* external reference: error, and label bad */ \ + error = (err); \ + goto bad; \ +} while (0) + +#define MATCH_FAMILY(x, y, w) \ + ((x) == (y) || ((w) && ((x) == PF_UNSPEC || (y) == PF_UNSPEC))) +#define MATCH(x, y, w) \ + ((x) == (y) || ((w) && ((x) == ANY || (y) == ANY))) + +#if defined(DEFINE_ADDITIONAL_IPV6_STUFF) +char * +gai_strerror(ecode) + int ecode; +{ + if (ecode < 0 || ecode > EAI_MAX) + ecode = EAI_MAX; + return ai_errlist[ecode]; +} +#endif + +void +freeaddrinfo(ai) + struct addrinfo *ai; +{ + struct addrinfo *next; + + do { + next = ai->ai_next; + if (ai->ai_canonname) + free(ai->ai_canonname); + /* no need to free(ai->ai_addr) */ + free(ai); + } while ((ai = next) != NULL); +} + +static int +str_isnumber(p) + const char *p; +{ + char *q = (char *)p; + while (*q) { + if (! isdigit(*q)) + return NO; + q++; + } + return YES; +} + +int +getaddrinfo(hostname, servname, hints, res) + const char *hostname, *servname; + const struct addrinfo *hints; + struct addrinfo **res; +{ + struct addrinfo sentinel; + struct addrinfo *cur; + int error = 0; + struct addrinfo ai; + struct addrinfo ai0; + struct addrinfo *pai; + const struct afd *afd; + const struct explore *ex; + +#ifdef FAITH + static int firsttime = 1; + + if (firsttime) { + /* translator hack */ + char *q = getenv("GAI"); + if (q && inet_pton(AF_INET6, q, &faith_prefix) == 1) + translate = YES; + firsttime = 0; + } +#endif + + sentinel.ai_next = NULL; + cur = &sentinel; + pai = &ai; + pai->ai_flags = 0; + pai->ai_family = PF_UNSPEC; + pai->ai_socktype = ANY; + pai->ai_protocol = ANY; + pai->ai_addrlen = 0; + pai->ai_canonname = NULL; + pai->ai_addr = NULL; + pai->ai_next = NULL; + + if (hostname == NULL && servname == NULL) + return EAI_NONAME; + if (hints) { + /* error check for hints */ + if (hints->ai_addrlen || hints->ai_canonname || + hints->ai_addr || hints->ai_next) + ERR(EAI_BADHINTS); /* xxx */ + if (hints->ai_flags & ~AI_MASK) + ERR(EAI_BADFLAGS); + switch (hints->ai_family) { + case PF_UNSPEC: + case PF_INET: +#ifdef INET6 + case PF_INET6: +#endif + break; + default: + ERR(EAI_FAMILY); + } + memcpy(pai, hints, sizeof(*pai)); + + /* + * if both socktype/protocol are specified, check if they + * are meaningful combination. + */ + if (pai->ai_socktype != ANY && pai->ai_protocol != ANY) { + for (ex = explore; ex->e_af >= 0; ex++) { + if (pai->ai_family != ex->e_af) + continue; + if (ex->e_socktype == ANY) + continue; + if (ex->e_protocol == ANY) + continue; + if (pai->ai_socktype == ex->e_socktype + && pai->ai_protocol != ex->e_protocol) { + ERR(EAI_BADHINTS); + } + } + } + } + + /* + * check for special cases. (1) numeric servname is disallowed if + * socktype/protocol are left unspecified. (2) servname is disallowed + * for raw and other inet{,6} sockets. + */ + if (MATCH_FAMILY(pai->ai_family, PF_INET, 1) +#ifdef PF_INET6 + || MATCH_FAMILY(pai->ai_family, PF_INET6, 1) +#endif + ) { + ai0 = *pai; + + if (pai->ai_family == PF_UNSPEC) { +#ifdef PF_INET6 + pai->ai_family = PF_INET6; +#else + pai->ai_family = PF_INET; +#endif + } + error = get_portmatch(pai, servname); + if (error) + ERR(error); + + *pai = ai0; + } + + ai0 = *pai; + + /* NULL hostname, or numeric hostname */ + for (ex = explore; ex->e_af >= 0; ex++) { + *pai = ai0; + + if (!MATCH_FAMILY(pai->ai_family, ex->e_af, WILD_AF(ex))) + continue; + if (!MATCH(pai->ai_socktype, ex->e_socktype, WILD_SOCKTYPE(ex))) + continue; + if (!MATCH(pai->ai_protocol, ex->e_protocol, WILD_PROTOCOL(ex))) + continue; + + if (pai->ai_family == PF_UNSPEC) + pai->ai_family = ex->e_af; + if (pai->ai_socktype == ANY && ex->e_socktype != ANY) + pai->ai_socktype = ex->e_socktype; + if (pai->ai_protocol == ANY && ex->e_protocol != ANY) + pai->ai_protocol = ex->e_protocol; + + if (hostname == NULL) + error = explore_null(pai, hostname, servname, &cur->ai_next); + else + error = explore_numeric_scope(pai, hostname, servname, &cur->ai_next); + + if (error) + goto free; + + while (cur && cur->ai_next) + cur = cur->ai_next; + } + + /* + * XXX + * If numreic representation of AF1 can be interpreted as FQDN + * representation of AF2, we need to think again about the code below. + */ + if (sentinel.ai_next) + goto good; + + if (pai->ai_flags & AI_NUMERICHOST) + ERR(EAI_NONAME); + if (hostname == NULL) + ERR(EAI_NONAME); + + /* + * hostname as alphabetical name. + * we would like to prefer AF_INET6 than AF_INET, so we'll make a + * outer loop by AFs. + */ + for (afd = afdl; afd->a_af; afd++) { + *pai = ai0; + + if (!MATCH_FAMILY(pai->ai_family, afd->a_af, 1)) + continue; + + for (ex = explore; ex->e_af >= 0; ex++) { + *pai = ai0; + + if (pai->ai_family == PF_UNSPEC) + pai->ai_family = afd->a_af; + + if (!MATCH_FAMILY(pai->ai_family, ex->e_af, WILD_AF(ex))) + continue; + if (!MATCH(pai->ai_socktype, ex->e_socktype, + WILD_SOCKTYPE(ex))) { + continue; + } + if (!MATCH(pai->ai_protocol, ex->e_protocol, + WILD_PROTOCOL(ex))) { + continue; + } + + if (pai->ai_family == PF_UNSPEC) + pai->ai_family = ex->e_af; + if (pai->ai_socktype == ANY && ex->e_socktype != ANY) + pai->ai_socktype = ex->e_socktype; + if (pai->ai_protocol == ANY && ex->e_protocol != ANY) + pai->ai_protocol = ex->e_protocol; + + error = explore_fqdn(pai, hostname, servname, + &cur->ai_next); + + while (cur && cur->ai_next) + cur = cur->ai_next; + } + } + + /* XXX */ + if (sentinel.ai_next) + error = 0; + + if (error) + goto free; + if (error == 0) { + if (sentinel.ai_next) { + good: + *res = sentinel.ai_next; + return SUCCESS; + } else + error = EAI_FAIL; + } + free: + bad: + if (sentinel.ai_next) + freeaddrinfo(sentinel.ai_next); + *res = NULL; + return error; +} + +/* + * FQDN hostname, DNS lookup + */ +static int +explore_fqdn(pai, hostname, servname, res) + const struct addrinfo *pai; + const char *hostname; + const char *servname; + struct addrinfo **res; +{ + struct hostent *hp; + int h_error; + int af; + char **aplist = NULL, *apbuf = NULL; + char *ap; + struct addrinfo sentinel, *cur; + int i; +#ifndef USE_GETIPNODEBY + int naddrs; +#endif + const struct afd *afd; + int error; + + *res = NULL; + sentinel.ai_next = NULL; + cur = &sentinel; + + /* + * Do not filter unsupported AFs here. We need to honor content of + * databases (/etc/hosts, DNS and others). Otherwise we cannot + * replace gethostbyname() by getaddrinfo(). + */ + + /* + * if the servname does not match socktype/protocol, ignore it. + */ + if (get_portmatch(pai, servname) != 0) + return 0; + + afd = find_afd(pai->ai_family); + + /* + * post-RFC2553: should look at (pai->ai_flags & AI_ADDRCONFIG) + * rather than hardcoding it. we may need to add AI_ADDRCONFIG + * handling code by ourselves in case we don't have getipnodebyname(). + */ +#ifdef USE_GETIPNODEBY + hp = getipnodebyname(hostname, pai->ai_family, AI_ADDRCONFIG, &h_error); +#else +#ifdef HAVE_GETHOSTBYNAME2 + hp = gethostbyname2(hostname, pai->ai_family); +#else + if (pai->ai_family != AF_INET) + return 0; + hp = gethostbyname(hostname); +#ifdef HAVE_H_ERRNO + h_error = h_errno; +#else + h_error = EINVAL; +#endif +#endif /*HAVE_GETHOSTBYNAME2*/ +#endif /*USE_GETIPNODEBY*/ + + if (hp == NULL) { + switch (h_error) { + case HOST_NOT_FOUND: + case NO_DATA: + error = EAI_NODATA; + break; + case TRY_AGAIN: + error = EAI_AGAIN; + break; + case NO_RECOVERY: + case NETDB_INTERNAL: + default: + error = EAI_FAIL; + break; + } + } else if ((hp->h_name == NULL) || (hp->h_name[0] == 0) + || (hp->h_addr_list[0] == NULL)) { +#ifdef USE_GETIPNODEBY + freehostent(hp); +#endif + hp = NULL; + error = EAI_FAIL; + } + + if (hp == NULL) + goto free; + +#ifdef USE_GETIPNODEBY + aplist = hp->h_addr_list; +#else + /* + * hp will be overwritten if we use gethostbyname2(). + * always deep copy for simplification. + */ + for (naddrs = 0; hp->h_addr_list[naddrs] != NULL; naddrs++) + ; + naddrs++; + aplist = (char **)malloc(sizeof(aplist[0]) * naddrs); + apbuf = (char *)malloc(hp->h_length * naddrs); + if (aplist == NULL || apbuf == NULL) { + error = EAI_MEMORY; + goto free; + } + memset(aplist, 0, sizeof(aplist[0]) * naddrs); + for (i = 0; i < naddrs; i++) { + if (hp->h_addr_list[i] == NULL) { + aplist[i] = NULL; + continue; + } + memcpy(&apbuf[i * hp->h_length], hp->h_addr_list[i], + hp->h_length); + aplist[i] = &apbuf[i * hp->h_length]; + } +#endif + + for (i = 0; aplist[i] != NULL; i++) { + af = hp->h_addrtype; + ap = aplist[i]; +#ifdef AF_INET6 + if (af == AF_INET6 + && IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) { + af = AF_INET; + ap = ap + sizeof(struct in6_addr) + - sizeof(struct in_addr); + } +#endif + + if (af != pai->ai_family) + continue; + + if ((pai->ai_flags & AI_CANONNAME) == 0) { + GET_AI(cur->ai_next, afd, ap); + GET_PORT(cur->ai_next, servname); + } else { + /* + * if AI_CANONNAME and if reverse lookup + * fail, return ai anyway to pacify + * calling application. + * + * XXX getaddrinfo() is a name->address + * translation function, and it looks + * strange that we do addr->name + * translation here. + */ + get_name(ap, afd, &cur->ai_next, + ap, pai, servname); + } + + while (cur && cur->ai_next) + cur = cur->ai_next; + } + + *res = sentinel.ai_next; + return 0; + +free: +#ifdef USE_GETIPNODEBY + if (hp) + freehostent(hp); +#endif + if (aplist) + free(aplist); + if (apbuf) + free(apbuf); + if (sentinel.ai_next) + freeaddrinfo(sentinel.ai_next); + return error; +} + +/* + * hostname == NULL. + * passive socket -> anyaddr (0.0.0.0 or ::) + * non-passive socket -> localhost (127.0.0.1 or ::1) + */ +static int +explore_null(pai, hostname, servname, res) + const struct addrinfo *pai; + const char *hostname; + const char *servname; + struct addrinfo **res; +{ + int s; + const struct afd *afd; + struct addrinfo *cur; + struct addrinfo sentinel; + int error; + + *res = NULL; + sentinel.ai_next = NULL; + cur = &sentinel; + + /* + * filter out AFs that are not supported by the kernel + * XXX errno? + */ + s = socket(pai->ai_family, SOCK_DGRAM, 0); + if (s < 0) { + if (errno != EMFILE) + return 0; + } else + close(s); + + /* + * if the servname does not match socktype/protocol, ignore it. + */ + if (get_portmatch(pai, servname) != 0) + return 0; + + afd = find_afd(pai->ai_family); + + if (pai->ai_flags & AI_PASSIVE) { + GET_AI(cur->ai_next, afd, afd->a_addrany); + /* xxx meaningless? + * GET_CANONNAME(cur->ai_next, "anyaddr"); + */ + GET_PORT(cur->ai_next, servname); + } else { + GET_AI(cur->ai_next, afd, afd->a_loopback); + /* xxx meaningless? + * GET_CANONNAME(cur->ai_next, "localhost"); + */ + GET_PORT(cur->ai_next, servname); + } + cur = cur->ai_next; + + *res = sentinel.ai_next; + return 0; + +free: + if (sentinel.ai_next) + freeaddrinfo(sentinel.ai_next); + return error; +} + +/* + * numeric hostname + */ +static int +explore_numeric(pai, hostname, servname, res) + const struct addrinfo *pai; + const char *hostname; + const char *servname; + struct addrinfo **res; +{ + const struct afd *afd; + struct addrinfo *cur; + struct addrinfo sentinel; + int error; + char pton[PTON_MAX]; + int flags; + + *res = NULL; + sentinel.ai_next = NULL; + cur = &sentinel; + + /* + * if the servname does not match socktype/protocol, ignore it. + */ + if (get_portmatch(pai, servname) != 0) + return 0; + + afd = find_afd(pai->ai_family); + flags = pai->ai_flags; + + if (inet_pton(afd->a_af, hostname, pton) == 1) { + u_int32_t v4a; +#ifdef INET6 + u_char pfx; +#endif + + switch (afd->a_af) { + case AF_INET: + v4a = (u_int32_t)ntohl(((struct in_addr *)pton)->s_addr); + if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) + flags &= ~AI_CANONNAME; + v4a >>= IN_CLASSA_NSHIFT; + if (v4a == 0 || v4a == IN_LOOPBACKNET) + flags &= ~AI_CANONNAME; + break; +#ifdef INET6 + case AF_INET6: + pfx = ((struct in6_addr *)pton)->s6_addr[0]; + if (pfx == 0 || pfx == 0xfe || pfx == 0xff) + flags &= ~AI_CANONNAME; + break; +#endif + } + + if (pai->ai_family == afd->a_af || + pai->ai_family == PF_UNSPEC /*?*/) { + if ((flags & AI_CANONNAME) == 0) { + GET_AI(cur->ai_next, afd, pton); + GET_PORT(cur->ai_next, servname); + } else { + /* + * if AI_CANONNAME and if reverse lookup + * fail, return ai anyway to pacify + * calling application. + * + * XXX getaddrinfo() is a name->address + * translation function, and it looks + * strange that we do addr->name + * translation here. + */ + get_name(pton, afd, &cur->ai_next, + pton, pai, servname); + } + while (cur && cur->ai_next) + cur = cur->ai_next; + } else + ERR(EAI_FAMILY); /*xxx*/ + } + + *res = sentinel.ai_next; + return 0; + +free: +bad: + if (sentinel.ai_next) + freeaddrinfo(sentinel.ai_next); + return error; +} + +/* + * numeric hostname with scope + */ +static int +explore_numeric_scope(pai, hostname, servname, res) + const struct addrinfo *pai; + const char *hostname; + const char *servname; + struct addrinfo **res; +{ +#ifndef SCOPE_DELIMITER + return explore_numeric(pai, hostname, servname, res); +#else + const struct afd *afd; + struct addrinfo *cur; + int error; + char *cp, *hostname2 = NULL; + int scope; + struct sockaddr_in6 *sin6; + + /* + * if the servname does not match socktype/protocol, ignore it. + */ + if (get_portmatch(pai, servname) != 0) + return 0; + + afd = find_afd(pai->ai_family); + if (!afd->a_scoped) + return explore_numeric(pai, hostname, servname, res); + + cp = strchr(hostname, SCOPE_DELIMITER); + if (cp == NULL) + return explore_numeric(pai, hostname, servname, res); + + /* + * Handle special case of + */ + hostname2 = strdup(hostname); + if (hostname2 == NULL) + return EAI_MEMORY; + /* terminate at the delimiter */ + hostname2[cp - hostname] = '\0'; + + cp++; + switch (pai->ai_family) { +#ifdef INET6 + case AF_INET6: + scope = if_nametoindex(cp); + if (scope == 0) { + free(hostname2); + return (EAI_NONAME); + } + break; +#endif + } + + error = explore_numeric(pai, hostname2, servname, res); + if (error == 0) { + for (cur = *res; cur; cur = cur->ai_next) { + if (cur->ai_family != AF_INET6) + continue; + sin6 = (struct sockaddr_in6 *)cur->ai_addr; + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) || + IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr)) + sin6->sin6_scope_id = scope; + } + } + + free(hostname2); + + return error; +#endif +} + +static int +get_name(addr, afd, res, numaddr, pai, servname) + const char *addr; + const struct afd *afd; + struct addrinfo **res; + char *numaddr; + const struct addrinfo *pai; + const char *servname; +{ + struct hostent *hp = NULL; + struct addrinfo *cur = NULL; + int error = 0; + char *ap = NULL, *cn = NULL; +#ifdef USE_GETIPNODEBY + int h_error; + + hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error); +#else + hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af); +#endif + if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { +#ifdef USE_GETIPNODEBY + GET_AI(cur, afd, hp->h_addr_list[0]); + GET_PORT(cur, servname); + GET_CANONNAME(cur, hp->h_name); +#else + /* hp will be damaged if we use gethostbyaddr() */ + if ((ap = (char *)malloc(hp->h_length)) == NULL) { + error = EAI_MEMORY; + goto free; + } + memcpy(ap, hp->h_addr_list[0], hp->h_length); + if ((cn = strdup(hp->h_name)) == NULL) { + error = EAI_MEMORY; + goto free; + } + + GET_AI(cur, afd, ap); + GET_PORT(cur, servname); + GET_CANONNAME(cur, cn); + free(ap); ap = NULL; + free(cn); cn = NULL; +#endif + } else { + GET_AI(cur, afd, numaddr); + GET_PORT(cur, servname); + } + +#ifdef USE_GETIPNODEBY + if (hp) + freehostent(hp); +#endif + *res = cur; + return SUCCESS; + free: + if (cur) + freeaddrinfo(cur); + if (ap) + free(ap); + if (cn) + free(cn); +#ifdef USE_GETIPNODEBY + if (hp) + freehostent(hp); +#endif + *res = NULL; + return error; +} + +static int +get_canonname(pai, ai, str) + const struct addrinfo *pai; + struct addrinfo *ai; + const char *str; +{ + if ((pai->ai_flags & AI_CANONNAME) != 0) { + ai->ai_canonname = strdup(str); + if (ai->ai_canonname == NULL) + return EAI_MEMORY; + } + return 0; +} + +static struct addrinfo * +get_ai(pai, afd, addr) + const struct addrinfo *pai; + const struct afd *afd; + const char *addr; +{ + char *p; + struct addrinfo *ai; + + ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) + + (afd->a_socklen)); + if (ai == NULL) + return NULL; + + memcpy(ai, pai, sizeof(struct addrinfo)); + ai->ai_addr = (struct sockaddr *)(ai + 1); + memset(ai->ai_addr, 0, afd->a_socklen); +#ifdef HAVE_SOCKADDR_SA_LEN + ai->ai_addr->sa_len = afd->a_socklen; +#endif + ai->ai_addrlen = afd->a_socklen; + ai->ai_addr->sa_family = ai->ai_family = afd->a_af; + p = (char *)(ai->ai_addr); + memcpy(p + afd->a_off, addr, afd->a_addrlen); + return ai; +} + +static int +get_portmatch(ai, servname) + const struct addrinfo *ai; + const char *servname; +{ + + /* get_port does not touch first argument. when matchonly == 1. */ + return get_port((struct addrinfo *)ai, servname, 1); +} + +static int +get_port(ai, servname, matchonly) + struct addrinfo *ai; + const char *servname; + int matchonly; +{ + const char *proto; + struct servent *sp; + int port; + int allownumeric; + + if (servname == NULL) + return 0; + switch (ai->ai_family) { + case AF_INET: +#ifdef AF_INET6 + case AF_INET6: +#endif + break; + default: + return 0; + } + + switch (ai->ai_socktype) { + case SOCK_RAW: + return EAI_SERVICE; + case SOCK_DGRAM: + case SOCK_STREAM: + allownumeric = 1; + break; + case ANY: + allownumeric = 0; + break; + default: + return EAI_SOCKTYPE; + } + + if (str_isnumber(servname)) { + if (!allownumeric) + return EAI_SERVICE; + port = htons(atoi(servname)); + if (port < 0 || port > 65535) + return EAI_SERVICE; + } else { + switch (ai->ai_socktype) { + case SOCK_DGRAM: + proto = "udp"; + break; + case SOCK_STREAM: + proto = "tcp"; + break; + default: + proto = NULL; + break; + } + + if ((sp = getservbyname(servname, proto)) == NULL) + return EAI_SERVICE; + port = sp->s_port; + } + + if (!matchonly) { + switch (ai->ai_family) { + case AF_INET: + ((struct sockaddr_in *)ai->ai_addr)->sin_port = port; + break; +#ifdef INET6 + case AF_INET6: + ((struct sockaddr_in6 *)ai->ai_addr)->sin6_port = port; + break; +#endif + } + } + + return 0; +} + +static const struct afd * +find_afd(af) + int af; +{ + const struct afd *afd; + + if (af == PF_UNSPEC) + return NULL; + for (afd = afdl; afd->a_af; afd++) { + if (afd->a_af == af) + return afd; + } + return NULL; +} + + +#endif /*__MING64__*/ diff --git a/libpcap/Win32/Src/getnetbynm.c b/libpcap/Win32/Src/getnetbynm.c new file mode 100644 index 0000000000..fa4d398e54 --- /dev/null +++ b/libpcap/Win32/Src/getnetbynm.c @@ -0,0 +1,44 @@ +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University 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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getnetbyname.c 5.5 (Berkeley) 6/27/88"; +#endif /* LIBC_SCCS and not lint */ + +#include "inetprivate.h" + +extern int _net_stayopen; + +struct netent * +getnetbyname(const char *name) +{ + register struct netent *p; + register char **cp; + + setnetent(_net_stayopen); + while (p = getnetent()) { + if (strcmp(p->n_name, name) == 0) + break; + for (cp = p->n_aliases; *cp != 0; cp++) + if (strcmp(*cp, name) == 0) + goto found; + } +found: + if (!_net_stayopen) + endnetent(); + return (p); +} diff --git a/libpcap/Win32/Src/getnetent.c b/libpcap/Win32/Src/getnetent.c new file mode 100644 index 0000000000..d4cceb3343 --- /dev/null +++ b/libpcap/Win32/Src/getnetent.c @@ -0,0 +1,119 @@ +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University 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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getnetent.c 5.5 (Berkeley) 6/27/88"; +#endif /* LIBC_SCCS and not lint */ + +#include "inetprivate.h" + +#define MAXALIASES 35 + +static char NETDB[] = _PATH_NETWORKS; +static FILE *netf = NULL; +static char line[BUFSIZ+1]; +static struct netent net; +static char *net_aliases[MAXALIASES]; +static char *any(char *, char *); + +int _net_stayopen; +extern u_int32_t inet_network(const char *cp); + +void +setnetent(f) + int f; +{ + if (netf == NULL) + netf = fopen(NETDB, "r" ); + else + rewind(netf); + _net_stayopen |= f; +} + +void +endnetent() +{ + if (netf) { + fclose(netf); + netf = NULL; + } + _net_stayopen = 0; +} + +struct netent * +getnetent() +{ + char *p; + register char *cp, **q; + + if (netf == NULL && (netf = fopen(NETDB, "r" )) == NULL) + return (NULL); +again: + p = fgets(line, BUFSIZ, netf); + if (p == NULL) + return (NULL); + if (*p == '#') + goto again; + cp = any(p, "#\n"); + if (cp == NULL) + goto again; + *cp = '\0'; + net.n_name = p; + cp = any(p, " \t"); + if (cp == NULL) + goto again; + *cp++ = '\0'; + while (*cp == ' ' || *cp == '\t') + cp++; + p = any(cp, " \t"); + if (p != NULL) + *p++ = '\0'; + net.n_net = inet_network(cp); + net.n_addrtype = AF_INET; + q = net.n_aliases = net_aliases; + if (p != NULL) + cp = p; + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (q < &net_aliases[MAXALIASES - 1]) + *q++ = cp; + cp = any(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + } + *q = NULL; + return (&net); +} + +static char * +any(cp, match) + register char *cp; + char *match; +{ + register char *mp, c; + + while (c = *cp) { + for (mp = match; *mp; mp++) + if (*mp == c) + return (cp); + cp++; + } + return ((char *)0); +} diff --git a/libpcap/Win32/Src/getopt.c b/libpcap/Win32/Src/getopt.c new file mode 100644 index 0000000000..03c2086efd --- /dev/null +++ b/libpcap/Win32/Src/getopt.c @@ -0,0 +1,121 @@ +/* + * Copyright (c) 1987, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include + +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG "" + +/* + * getopt -- + * Parse argc/argv argument vector. + */ +int +getopt(nargc, nargv, ostr) + int nargc; + char * const *nargv; + const char *ostr; +{ +#ifdef WIN32 + char *__progname="windump"; +#else + extern char *__progname; +#endif + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return (-1); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return (-1); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means -1. + */ + if (optopt == (int)'-') + return (-1); + if (!*place) + ++optind; + if (opterr && *ostr != ':') + (void)fprintf(stderr, + "%s: illegal option -- %c\n", __progname, optopt); + return (BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (*ostr == ':') + return (BADARG); + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + __progname, optopt); + return (BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return (optopt); /* dump back option letter */ +} diff --git a/libpcap/Win32/Src/getservent.c b/libpcap/Win32/Src/getservent.c new file mode 100644 index 0000000000..61b8cb04b7 --- /dev/null +++ b/libpcap/Win32/Src/getservent.c @@ -0,0 +1,125 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#define MAXALIASES 35 + +static char SERVDB[] = _PATH_SERVICES; +static FILE *servf = NULL; +static char line[BUFSIZ+1]; +static struct servent serv; +static char *serv_aliases[MAXALIASES]; +int _serv_stayopen; + +void +setservent(f) + int f; +{ + if (servf == NULL) + servf = fopen(SERVDB, "r" ); + else + rewind(servf); + _serv_stayopen |= f; +} + +void +endservent() +{ + if (servf) { + fclose(servf); + servf = NULL; + } + _serv_stayopen = 0; +} + +struct servent * +getservent() +{ + char *p; + register char *cp, **q; + + if (servf == NULL && (servf = fopen(SERVDB, "r" )) == NULL) + return (NULL); +again: + if ((p = fgets(line, BUFSIZ, servf)) == NULL) + return (NULL); + if (*p == '#') + goto again; + cp = strpbrk(p, "#\n"); + if (cp == NULL) + goto again; + *cp = '\0'; + serv.s_name = p; + p = strpbrk(p, " \t"); + if (p == NULL) + goto again; + *p++ = '\0'; + while (*p == ' ' || *p == '\t') + p++; + cp = strpbrk(p, ",/"); + if (cp == NULL) + goto again; + *cp++ = '\0'; + serv.s_port = htons((u_short)atoi(p)); + serv.s_proto = cp; + q = serv.s_aliases = serv_aliases; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (q < &serv_aliases[MAXALIASES - 1]) + *q++ = cp; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; + } + *q = NULL; + return (&serv); +} diff --git a/libpcap/Win32/Src/inet_aton.c b/libpcap/Win32/Src/inet_aton.c new file mode 100644 index 0000000000..3da6667c6a --- /dev/null +++ b/libpcap/Win32/Src/inet_aton.c @@ -0,0 +1,61 @@ +/* + * 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 + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE 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. + */ + +/* $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 + +/* Minimal implementation of inet_aton. + * Cannot distinguish between failure and a local broadcast address. */ + +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif + +int +inet_aton(const char *cp, struct in_addr *addr) +{ + addr->s_addr = inet_addr(cp); + return (addr->s_addr == INADDR_NONE) ? 0 : 1; +} diff --git a/libpcap/Win32/Src/inet_net.c b/libpcap/Win32/Src/inet_net.c new file mode 100644 index 0000000000..5bbe3914ef --- /dev/null +++ b/libpcap/Win32/Src/inet_net.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include "inetprivate.h" + +/* + * Internet network address interpretation routine. + * The library routines call this routine to interpret + * network numbers. + */ +u_int32_t +inet_network(const char *cp) +{ + register u_long val, base, n; + register char c; + u_long parts[4], *pp = parts; + register int i; + +again: + /* + * Collect number up to ``.''. + * Values are specified as for C: + * 0x=hex, 0=octal, other=decimal. + */ + val = 0; base = 10; + /* + * The 4.4BSD version of this file also accepts 'x__' as a hexa + * number. I don't think this is correct. -- Uli + */ + if (*cp == '0') { + if (*++cp == 'x' || *cp == 'X') + base = 16, cp++; + else + base = 8; + } + while ((c = *cp)) { + if (isdigit(c)) { + val = (val * base) + (c - '0'); + cp++; + continue; + } + if (base == 16 && isxdigit(c)) { + val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A')); + cp++; + continue; + } + break; + } + if (*cp == '.') { + if (pp >= parts + 4) + return (INADDR_NONE); + *pp++ = val, cp++; + goto again; + } + if (*cp && !isspace(*cp)) + return (INADDR_NONE); + *pp++ = val; + n = pp - parts; + if (n > 4) + return (INADDR_NONE); + for (val = 0, i = 0; i < (int)n; i++) { + val <<= 8; + val |= parts[i] & 0xff; + } + return (val); +} diff --git a/libpcap/Win32/Src/inet_pton.c b/libpcap/Win32/Src/inet_pton.c new file mode 100644 index 0000000000..7933a4e69b --- /dev/null +++ b/libpcap/Win32/Src/inet_pton.c @@ -0,0 +1,71 @@ +/* + * 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 + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE 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. + */ + +/* $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 +#ifndef EAFNOSUPPORT +#define EAFNOSUPPORT 97 /* not present in errno.h provided with VC */ +#endif +#endif + +#ifdef __MINGW32__ +int* _errno(); +#define errno (*_errno()) +#endif /* __MINGW32__ */ + +#include + +int inet_aton(const char *cp, struct in_addr *addr); + +int +inet_pton(int af, const char *src, void *dst) +{ + if (af != AF_INET) { + errno = EAFNOSUPPORT; + return -1; + } + return inet_aton (src, dst); +} diff --git a/libpcap/aclocal.m4 b/libpcap/aclocal.m4 index e5841edf07..20db44fa59 100644 --- a/libpcap/aclocal.m4 +++ b/libpcap/aclocal.m4 @@ -245,7 +245,24 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT, # or accepts command-line arguments like # those the GNU linker accepts. # - V_CCOPT="$V_CCOPT -fpic" + # Some instruction sets require -fPIC on some + # operating systems. Check for them. If you + # have a combination that requires it, add it + # here. + # + PIC_OPT=-fpic + case "$host_cpu" in + + sparc64*) + case "$host_os" in + + freebsd*) + PIC_OPT=-fPIC + ;; + esac + ;; + esac + V_CCOPT="$V_CCOPT $PIC_OPT" V_SONAME_OPT="-Wl,-soname," V_RPATH_OPT="-Wl,-rpath," ;; @@ -978,8 +995,9 @@ dnl code that would use that member, or we wouldn't compile in any case). dnl AC_DEFUN(AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI, [AC_MSG_CHECKING(if tpacket_auxdata struct has tp_vlan_tci member) - AC_CACHE_VAL(ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1, + AC_CACHE_VAL(ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci, AC_TRY_COMPILE([ +# include # include ], [u_int i = sizeof(((struct tpacket_auxdata *)0)->tp_vlan_tci)], ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci=yes, diff --git a/libpcap/bpf/net/bpf_filter.c b/libpcap/bpf/net/bpf_filter.c index a51ed78756..0c4fb00616 100644 --- a/libpcap/bpf/net/bpf_filter.c +++ b/libpcap/bpf/net/bpf_filter.c @@ -405,7 +405,18 @@ bpf_filter(pc, p, wirelen, buflen) continue; case BPF_JMP|BPF_JA: +#if defined(KERNEL) || defined(_KERNEL) + /* + * No backward jumps allowed. + */ pc += pc->k; +#else + /* + * XXX - we currently implement "ip6 protochain" + * with backward jumps, so sign-extend pc->k. + */ + pc += (bpf_int32)pc->k; +#endif continue; case BPF_JMP|BPF_JGT|BPF_K: @@ -608,7 +619,7 @@ bpf_validate(f, len) /* * Check for constant division by 0. */ - if (BPF_RVAL(p->code) == BPF_K && p->k == 0) + if (BPF_SRC(p->code) == BPF_K && p->k == 0) return 0; break; default: diff --git a/libpcap/config.guess b/libpcap/config.guess new file mode 100755 index 0000000000..c2246a4f7f --- /dev/null +++ b/libpcap/config.guess @@ -0,0 +1,1502 @@ +#! /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. + +timestamp='2009-12-30' + +# 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 +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# 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. +# +# 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. +# +# 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 + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +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. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# 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*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # 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)` + 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 ;; + *) 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) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + 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 + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *: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:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # 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 ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + 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` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -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" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #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); + + 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 + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + 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 ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # 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 + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`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 + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + 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} + 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 + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + 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}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + 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 ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + 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. + # 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 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { 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; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + 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 + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + 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 + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + 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` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + 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 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/libpcap/config.h.in b/libpcap/config.h.in index 0259ca29e4..fb5ae09629 100644 --- a/libpcap/config.h.in +++ b/libpcap/config.h.in @@ -18,6 +18,9 @@ /* define if you have streams capable DAG API */ #undef HAVE_DAG_STREAMS_API +/* define if you have vdag_set_device_info() */ +#undef HAVE_DAG_VDAG + /* Define to 1 if you have the declaration of `ether_hostton', and to 0 if you don't. */ #undef HAVE_DECL_ETHER_HOSTTON @@ -52,15 +55,30 @@ /* if libnl exists */ #undef HAVE_LIBNL +/* if libnl exists and is version 2.x */ +#undef HAVE_LIBNL_2_x + /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_COMPILER_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_ETHTOOL_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 + /* if tp_vlan_tci exists */ #undef HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TYPES_H + /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_USBDEVICE_FS_H @@ -76,6 +94,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IF_ETHER_H +/* Define to 1 if you have the header file. */ +#undef HAVE_NETPACKET_IF_PACKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETPACKET_PACKET_H + /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_MEDIA_H @@ -220,8 +244,8 @@ /* target host supports CAN sniffing */ #undef PCAP_SUPPORT_CAN -/* use Linux packet ring capture if available */ -#undef PCAP_SUPPORT_PACKET_RING +/* target host supports netfilter sniffing */ +#undef PCAP_SUPPORT_NETFILTER /* target host supports USB sniffing */ #undef PCAP_SUPPORT_USB diff --git a/libpcap/config.sub b/libpcap/config.sub new file mode 100755 index 0000000000..85186096a9 --- /dev/null +++ b/libpcap/config.sub @@ -0,0 +1,1708 @@ +#! /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. + +timestamp='2009-12-31' + +# 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 +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# 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. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +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. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# 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* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -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) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | 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 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | 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 \ + | ubicom32 \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-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. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | 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-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | 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-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + 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 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + 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 + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # 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 + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -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* \ + | -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* \ + | -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* \ + | -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*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/libpcap/configure b/libpcap/configure index c34c3bdd09..86f32fb04e 100755 --- a/libpcap/configure +++ b/libpcap/configure @@ -1,12 +1,12 @@ #! /bin/sh # From configure.in Revision: 1.168 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65. +# Generated by GNU Autoconf 2.68. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -90,6 +90,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -215,11 +216,18 @@ IFS=$as_save_IFS # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -317,7 +325,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -357,19 +365,19 @@ else fi # as_fn_arith -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -531,7 +539,7 @@ test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -601,6 +609,8 @@ CAN_SRC PCAP_SUPPORT_CAN BT_SRC PCAP_SUPPORT_BT +NETFILTER_SRC +PCAP_SUPPORT_NETFILTER USB_SRC PCAP_SUPPORT_USB MAN_MISC_INFO @@ -618,6 +628,7 @@ V_INCLS V_FINDALLDEVS V_DEFS V_CCOPT +AR RANLIB HAVE_LINUX_TPACKET_AUXDATA LIBOBJS @@ -701,6 +712,7 @@ with_septel with_snf with_snf_includes with_snf_libraries +enable_universal enable_bluetooth enable_can enable_packet_ring @@ -776,8 +788,9 @@ do fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -822,7 +835,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -848,7 +861,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1052,7 +1065,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1068,7 +1081,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1098,8 +1111,8 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) @@ -1107,7 +1120,7 @@ Try \`$0 --help' for more information." # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1117,7 +1130,7 @@ Try \`$0 --help' for more information." $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1125,13 +1138,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1154,7 +1167,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1168,8 +1181,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1184,9 +1197,9 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1225,11 +1238,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1269,7 +1282,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1333,6 +1346,7 @@ Optional Features: getaddrinfo available] --enable-optimizer-dbg build optimizer debugging code --enable-yydebug build parser debugging code + --disable-universal don't build universal on OS X --enable-bluetooth enable Bluetooth support [default=yes, if support available] --enable-can enable CAN support [default=yes, if support @@ -1437,9 +1451,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.65 +generated by GNU Autoconf 2.68 -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1483,7 +1497,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1509,7 +1523,7 @@ $as_echo "$ac_try_echo"; } >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { + test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : @@ -1520,7 +1534,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1533,10 +1547,10 @@ fi ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1572,7 +1586,7 @@ if ac_fn_c_try_cpp "$LINENO"; then : else ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } @@ -1599,7 +1613,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1608,7 +1622,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel @@ -1649,7 +1663,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1663,7 +1677,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1681,7 +1695,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1694,7 +1708,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1735,7 +1749,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -1780,7 +1794,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1793,7 +1807,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1848,19 +1862,22 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func -# ac_fn_c_check_decl LINENO SYMBOL VAR -# ------------------------------------ -# Tests whether SYMBOL is declared, setting cache variable VAR accordingly. +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5 -$as_echo_n "checking whether $2 is declared... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1869,8 +1886,12 @@ $4 int main () { -#ifndef $2 - (void) $2; +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif #endif ; @@ -1887,7 +1908,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF @@ -1895,7 +1916,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.65. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2005,11 +2026,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -2043,11 +2062,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do @@ -2060,11 +2077,9 @@ _ASBOX echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do @@ -2078,11 +2093,9 @@ _ASBOX fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo @@ -2137,7 +2150,12 @@ _ACEOF ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -2152,7 +2170,11 @@ do { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2228,7 +2250,7 @@ if $ac_cache_corrupted; then $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2244,16 +2266,22 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi done if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -2267,27 +2295,27 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : +if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -2305,14 +2333,14 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : +if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi @@ -2320,7 +2348,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -2338,14 +2366,14 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } -if test "${ac_cv_target+set}" = set; then : +if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi @@ -2353,7 +2381,7 @@ fi $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; -*) as_fn_error "invalid value of canonical target" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' @@ -2404,7 +2432,7 @@ fi set dummy shlicc2; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_SHLICC2+set}" = set; then : +if ${ac_cv_prog_SHLICC2+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$SHLICC2"; then @@ -2460,7 +2488,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2500,7 +2528,7 @@ if test -z "$ac_cv_prog_CC"; then set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2553,7 +2581,7 @@ if test -z "$CC"; then set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2593,7 +2621,7 @@ if test -z "$CC"; then set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2652,7 +2680,7 @@ if test -z "$CC"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2696,7 +2724,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2750,8 +2778,8 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -2865,9 +2893,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -2909,8 +2936,8 @@ done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -2967,9 +2994,9 @@ $as_echo "$ac_try_echo"; } >&5 else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. +as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -2980,7 +3007,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3020,8 +3047,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3031,7 +3058,7 @@ OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3068,7 +3095,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3146,7 +3173,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -3252,7 +3279,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu else { $as_echo "$as_me:${as_lineno-$LINENO}: checking gcc version" >&5 $as_echo_n "checking gcc version... " >&6; } - if test "${ac_cv_lbl_gcc_vers+set}" = set; then : + if ${ac_cv_lbl_gcc_vers+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_lbl_gcc_vers=`$CC -v 2>&1 | \ @@ -3271,7 +3298,7 @@ $as_echo "$ac_cv_lbl_gcc_vers" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking that $CC handles ansi prototypes" >&5 $as_echo_n "checking that $CC handles ansi prototypes... " >&6; } - if test "${ac_cv_lbl_cc_ansi_prototypes+set}" = set; then : + if ${ac_cv_lbl_cc_ansi_prototypes+:} false; then : $as_echo_n "(cached) " >&6 else @@ -3304,7 +3331,7 @@ $as_echo "$ac_cv_lbl_cc_ansi_prototypes" >&6; } $as_echo_n "checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)... " >&6; } savedcflags="$CFLAGS" CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS" - if test "${ac_cv_lbl_cc_hpux_cc_aa+set}" = set; then : + if ${ac_cv_lbl_cc_hpux_cc_aa+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3329,7 +3356,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lbl_cc_hpux_cc_aa" >&5 $as_echo "$ac_cv_lbl_cc_hpux_cc_aa" >&6; } if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then - as_fn_error "see the INSTALL doc for more info" "$LINENO" 5 + as_fn_error $? "see the INSTALL doc for more info" "$LINENO" 5 fi CFLAGS="$savedcflags" V_CCOPT="-Aa $V_CCOPT" @@ -3343,7 +3370,7 @@ $as_echo "#define _HPUX_SOURCE 1" >>confdefs.h $as_echo_n "checking for ansi mode in DEC compiler ($CC -std1)... " >&6; } savedcflags="$CFLAGS" CFLAGS="-std1" - if test "${ac_cv_lbl_cc_osf1_cc_std1+set}" = set; then : + if ${ac_cv_lbl_cc_osf1_cc_std1+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3368,14 +3395,14 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lbl_cc_osf1_cc_std1" >&5 $as_echo "$ac_cv_lbl_cc_osf1_cc_std1" >&6; } if test $ac_cv_lbl_cc_osf1_cc_std1 = no ; then - as_fn_error "see the INSTALL doc for more info" "$LINENO" 5 + as_fn_error $? "see the INSTALL doc for more info" "$LINENO" 5 fi CFLAGS="$savedcflags" V_CCOPT="-std1 $V_CCOPT" ;; *) - as_fn_error "see the INSTALL doc for more info" "$LINENO" 5 + as_fn_error $? "see the INSTALL doc for more info" "$LINENO" 5 ;; esac fi @@ -3399,7 +3426,7 @@ $as_echo "$ac_cv_lbl_cc_osf1_cc_std1" >&6; } ultrix*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking that Ultrix $CC hacks const in prototypes" >&5 $as_echo_n "checking that Ultrix $CC hacks const in prototypes... " >&6; } - if test "${ac_cv_lbl_cc_const_proto+set}" = set; then : + if ${ac_cv_lbl_cc_const_proto+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3460,7 +3487,24 @@ $as_echo "#define const /**/" >>confdefs.h # or accepts command-line arguments like # those the GNU linker accepts. # - V_CCOPT="$V_CCOPT -fpic" + # Some instruction sets require -fPIC on some + # operating systems. Check for them. If you + # have a combination that requires it, add it + # here. + # + PIC_OPT=-fpic + case "$host_cpu" in + + sparc64*) + case "$host_os" in + + freebsd*) + PIC_OPT=-fPIC + ;; + esac + ;; + esac + V_CCOPT="$V_CCOPT $PIC_OPT" V_SONAME_OPT="-Wl,-soname," V_RPATH_OPT="-Wl,-rpath," ;; @@ -3567,7 +3611,7 @@ $as_echo "#define const /**/" >>confdefs.h $as_echo_n "checking for inline... " >&6; } save_CFLAGS="$CFLAGS" CFLAGS="$V_CCOPT" - if test "${ac_cv_lbl_inline+set}" = set; then : + if ${ac_cv_lbl_inline+:} false; then : $as_echo_n "(cached) " >&6 else @@ -3628,7 +3672,7 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__" >&5 $as_echo_n "checking for __attribute__... " >&6; } -if test "${ac_cv___attribute__+set}" = set; then : +if ${ac_cv___attribute__+:} false; then : $as_echo_n "(cached) " >&6 else @@ -3684,7 +3728,7 @@ if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -3714,7 +3758,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -3730,11 +3774,11 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi @@ -3773,7 +3817,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -3789,18 +3833,18 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -3812,7 +3856,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -3861,7 +3905,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP @@ -3875,7 +3919,7 @@ $as_echo "$ac_cv_path_GREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -3927,7 +3971,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP @@ -3942,7 +3986,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4059,8 +4103,7 @@ 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" "$ac_includes_default " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +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 @@ -4073,7 +4116,7 @@ done for ac_header in sys/bitypes.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/bitypes.h" "ac_cv_header_sys_bitypes_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_bitypes_h" = x""yes; then : +if test "x$ac_cv_header_sys_bitypes_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_BITYPES_H 1 _ACEOF @@ -4088,7 +4131,7 @@ ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default #include #endif " -if test "x$ac_cv_type_int8_t" = x""yes; then : +if test "x$ac_cv_type_int8_t" = xyes; then : else @@ -4101,7 +4144,7 @@ ac_fn_c_check_type "$LINENO" "u_int8_t" "ac_cv_type_u_int8_t" "$ac_includes_defa #include #endif " -if test "x$ac_cv_type_u_int8_t" = x""yes; then : +if test "x$ac_cv_type_u_int8_t" = xyes; then : else @@ -4110,7 +4153,7 @@ $as_echo "#define u_int8_t unsigned char" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" -if test "x$ac_cv_type_int16_t" = x""yes; then : +if test "x$ac_cv_type_int16_t" = xyes; then : else @@ -4127,7 +4170,7 @@ ac_fn_c_check_type "$LINENO" "u_int16_t" "ac_cv_type_u_int16_t" "$ac_includes_de #include #endif " -if test "x$ac_cv_type_u_int16_t" = x""yes; then : +if test "x$ac_cv_type_u_int16_t" = xyes; then : else @@ -4140,7 +4183,7 @@ ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_defaul #include #endif " -if test "x$ac_cv_type_int32_t" = x""yes; then : +if test "x$ac_cv_type_int32_t" = xyes; then : else @@ -4153,7 +4196,7 @@ ac_fn_c_check_type "$LINENO" "u_int32_t" "ac_cv_type_u_int32_t" "$ac_includes_de #include #endif " -if test "x$ac_cv_type_u_int32_t" = x""yes; then : +if test "x$ac_cv_type_u_int32_t" = xyes; then : else @@ -4166,7 +4209,7 @@ ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_defaul #include #endif " -if test "x$ac_cv_type_int64_t" = x""yes; then : +if test "x$ac_cv_type_int64_t" = xyes; then : else @@ -4179,7 +4222,7 @@ ac_fn_c_check_type "$LINENO" "u_int64_t" "ac_cv_type_u_int64_t" "$ac_includes_de #include #endif " -if test "x$ac_cv_type_u_int64_t" = x""yes; then : +if test "x$ac_cv_type_u_int64_t" = xyes; then : else @@ -4200,7 +4243,7 @@ if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } -if test "${ac_cv_sys_largefile_CC+set}" = set; then : +if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no @@ -4251,7 +4294,7 @@ $as_echo "$ac_cv_sys_largefile_CC" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if test "${ac_cv_sys_file_offset_bits+set}" = set; then : +if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do @@ -4320,7 +4363,7 @@ rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } -if test "${ac_cv_sys_large_files+set}" = set; then : +if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do @@ -4391,7 +4434,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 $as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } -if test "${ac_cv_sys_largefile_source+set}" = set; then : +if ${ac_cv_sys_largefile_source+:} false; then : $as_echo_n "(cached) " >&6 else while :; do @@ -4462,8 +4505,32 @@ for ac_header in sys/ioccom.h sys/sockio.h limits.h paths.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +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 + +for ac_header in linux/types.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "linux/types.h" "ac_cv_header_linux_types_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_types_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LINUX_TYPES_H 1 +_ACEOF + +fi + +done + +for ac_header in linux/if_packet.h netpacket/packet.h netpacket/if_packet.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +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 @@ -4478,7 +4545,7 @@ do : #include #include " -if test "x$ac_cv_header_net_pfvar_h" = x""yes; then : +if test "x$ac_cv_header_net_pfvar_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NET_PFVAR_H 1 _ACEOF @@ -4526,7 +4593,7 @@ do : ac_fn_c_check_header_compile "$LINENO" "netinet/if_ether.h" "ac_cv_header_netinet_if_ether_h" "#include #include " -if test "x$ac_cv_header_netinet_if_ether_h" = x""yes; then : +if test "x$ac_cv_header_netinet_if_ether_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NETINET_IF_ETHER_H 1 _ACEOF @@ -4555,7 +4622,7 @@ struct mbuf; struct rtentry; #include " -if test "x$ac_cv_header_netinet_if_ether_h" = x""yes; then : +if test "x$ac_cv_header_netinet_if_ether_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NETINET_IF_ETHER_H 1 _ACEOF @@ -4569,7 +4636,7 @@ fi 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; } - if test "${ac_cv_lbl_gcc_fixincludes+set}" = set; then : + if ${ac_cv_lbl_gcc_fixincludes+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4608,7 +4675,7 @@ $as_echo "$ac_cv_lbl_gcc_fixincludes" >&6; } if test $ac_cv_lbl_gcc_fixincludes = no ; then # Don't cache failure unset ac_cv_lbl_gcc_fixincludes - as_fn_error "see the INSTALL for more info" "$LINENO" 5 + as_fn_error $? "see the INSTALL for more info" "$LINENO" 5 fi fi @@ -4616,8 +4683,7 @@ for ac_func in strerror strlcpy do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -4631,8 +4697,7 @@ for ac_func in vsnprintf snprintf do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -4662,7 +4727,7 @@ fi # Some strange OSes (SINIX) have it in libsocket: { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 $as_echo_n "checking for library containing gethostbyname... " >&6; } -if test "${ac_cv_search_gethostbyname+set}" = set; then : +if ${ac_cv_search_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -4696,11 +4761,11 @@ for ac_lib in '' nsl socket resolv; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_gethostbyname+set}" = set; then : + if ${ac_cv_search_gethostbyname+:} false; then : break fi done -if test "${ac_cv_search_gethostbyname+set}" = set; then : +if ${ac_cv_search_gethostbyname+:} false; then : else ac_cv_search_gethostbyname=no @@ -4722,7 +4787,7 @@ fi then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lsocket" >&5 $as_echo_n "checking for gethostbyname in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_gethostbyname+set}" = set; then : +if ${ac_cv_lib_socket_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4756,14 +4821,14 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_gethostbyname" >&5 $as_echo "$ac_cv_lib_socket_gethostbyname" >&6; } -if test "x$ac_cv_lib_socket_gethostbyname" = x""yes; then : +if test "x$ac_cv_lib_socket_gethostbyname" = xyes; then : LIBS="-lsocket -lnsl $LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 $as_echo_n "checking for library containing socket... " >&6; } -if test "${ac_cv_search_socket+set}" = set; then : +if ${ac_cv_search_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -4797,11 +4862,11 @@ for ac_lib in '' socket; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_socket+set}" = set; then : + if ${ac_cv_search_socket+:} false; then : break fi done -if test "${ac_cv_search_socket+set}" = set; then : +if ${ac_cv_search_socket+:} false; then : else ac_cv_search_socket=no @@ -4818,7 +4883,7 @@ if test "$ac_res" != no; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_socket+set}" = set; then : +if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4852,7 +4917,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = x""yes; then : +if test "x$ac_cv_lib_socket_socket" = xyes; then : LIBS="-lsocket -lnsl $LIBS" fi @@ -4861,7 +4926,7 @@ fi # DLPI needs putmsg under HPUX so test for -lstr while we're at it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing putmsg" >&5 $as_echo_n "checking for library containing putmsg... " >&6; } -if test "${ac_cv_search_putmsg+set}" = set; then : +if ${ac_cv_search_putmsg+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -4895,11 +4960,11 @@ for ac_lib in '' str; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_putmsg+set}" = set; then : + if ${ac_cv_search_putmsg+:} false; then : break fi done -if test "${ac_cv_search_putmsg+set}" = set; then : +if ${ac_cv_search_putmsg+:} false; then : else ac_cv_search_putmsg=no @@ -4931,7 +4996,7 @@ fi for ac_func in ether_hostton do : ac_fn_c_check_func "$LINENO" "ether_hostton" "ac_cv_func_ether_hostton" -if test "x$ac_cv_func_ether_hostton" = x""yes; then : +if test "x$ac_cv_func_ether_hostton" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ETHER_HOSTTON 1 _ACEOF @@ -4958,7 +5023,7 @@ struct rtentry; #include " -if test "x$ac_cv_have_decl_ether_hostton" = x""yes; then : +if test "x$ac_cv_have_decl_ether_hostton" = xyes; then : $as_echo "#define NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON /**/" >>confdefs.h @@ -4977,7 +5042,7 @@ fi for ac_header in netinet/ether.h do : ac_fn_c_check_header_mongrel "$LINENO" "netinet/ether.h" "ac_cv_header_netinet_ether_h" "$ac_includes_default" -if test "x$ac_cv_header_netinet_ether_h" = x""yes; then : +if test "x$ac_cv_header_netinet_ether_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NETINET_ETHER_H 1 _ACEOF @@ -4998,7 +5063,7 @@ done #include " -if test "x$ac_cv_have_decl_ether_hostton" = x""yes; then : +if test "x$ac_cv_have_decl_ether_hostton" = xyes; then : $as_echo "#define NETINET_ETHER_H_DECLARES_ETHER_HOSTTON /**/" >>confdefs.h @@ -5027,7 +5092,7 @@ struct rtentry; #include " -if test "x$ac_cv_type_struct_ether_addr" = x""yes; then : +if test "x$ac_cv_type_struct_ether_addr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_ETHER_ADDR 1 @@ -5088,7 +5153,7 @@ $as_echo "$as_me: Enabling SITA ACN support" >&6;} else if test -z "$with_pcap" && test "$cross_compiling" = yes; then - as_fn_error "pcap type not determined when cross-compiling; use --with-pcap=..." "$LINENO" 5 + as_fn_error $? "pcap type not determined when cross-compiling; use --with-pcap=..." "$LINENO" 5 fi # Check whether --with-pcap was given. @@ -5163,7 +5228,7 @@ dlpi) LDFLAGS="$LIBS -L/lib" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlpi_walk in -ldlpi" >&5 $as_echo_n "checking for dlpi_walk in -ldlpi... " >&6; } -if test "${ac_cv_lib_dlpi_dlpi_walk+set}" = set; then : +if ${ac_cv_lib_dlpi_dlpi_walk+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5197,7 +5262,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dlpi_dlpi_walk" >&5 $as_echo "$ac_cv_lib_dlpi_dlpi_walk" >&6; } -if test "x$ac_cv_lib_dlpi_dlpi_walk" = x""yes; then : +if test "x$ac_cv_lib_dlpi_dlpi_walk" = xyes; then : LIBS="-ldlpi $LIBS" V_PCAP=libdlpi @@ -5215,7 +5280,7 @@ fi # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether is usable" >&5 $as_echo_n "checking whether is usable... " >&6; } - if test "${ac_cv_sys_dlpi_usable+set}" = set; then : + if ${ac_cv_sys_dlpi_usable+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5244,7 +5309,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_dlpi_usable" >&5 $as_echo "$ac_cv_sys_dlpi_usable" >&6; } if test $ac_cv_sys_dlpi_usable = no ; then - as_fn_error " is not usable on this system; it probably has a non-standard DLPI" "$LINENO" 5 + as_fn_error $? " is not usable on this system; it probably has a non-standard DLPI" "$LINENO" 5 fi # @@ -5284,7 +5349,7 @@ $as_echo "no" >&6; } # { $as_echo "$as_me:${as_lineno-$LINENO}: checking if dl_passive_req_t struct exists" >&5 $as_echo_n "checking if dl_passive_req_t struct exists... " >&6; } - if test "${ac_cv_lbl_has_dl_passive_req_t+set}" = set; then : + if ${ac_cv_lbl_has_dl_passive_req_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5318,33 +5383,6 @@ $as_echo "#define HAVE_DLPI_PASSIVE 1" >>confdefs.h ;; linux) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking Linux kernel version" >&5 -$as_echo_n "checking Linux kernel version... " >&6; } - if test "$cross_compiling" = yes; then - if test "${ac_cv_linux_vers+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_linux_vers=unknown -fi - - else - if test "${ac_cv_linux_vers+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_linux_vers=`uname -r 2>&1 | \ - sed -n -e '$s/.* //' -e '$s/\..*//p'` -fi - - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_linux_vers" >&5 -$as_echo "$ac_cv_linux_vers" >&6; } - if test $ac_cv_linux_vers = unknown ; then - as_fn_error "cannot determine linux version when cross-compiling" "$LINENO" 5 - fi - if test $ac_cv_linux_vers -lt 2 ; then - as_fn_error "version 2 or higher required; see the INSTALL doc for more info" "$LINENO" 5 - fi - # # Do we have the wireless extensions? # @@ -5356,7 +5394,7 @@ do : #include " -if test "x$ac_cv_header_linux_wireless_h" = x""yes; then : +if test "x$ac_cv_header_linux_wireless_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_WIRELESS_H 1 _ACEOF @@ -5377,9 +5415,66 @@ fi if test x$with_libnl != xno ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_handle_alloc in -lnl" >&5 + # + # Try libnl 2.x first. + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_socket_alloc in -lnl" >&5 +$as_echo_n "checking for nl_socket_alloc in -lnl... " >&6; } +if ${ac_cv_lib_nl_nl_socket_alloc+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnl $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 nl_socket_alloc (); +int +main () +{ +return nl_socket_alloc (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_nl_nl_socket_alloc=yes +else + ac_cv_lib_nl_nl_socket_alloc=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_nl_nl_socket_alloc" >&5 +$as_echo "$ac_cv_lib_nl_nl_socket_alloc" >&6; } +if test "x$ac_cv_lib_nl_nl_socket_alloc" = xyes; then : + + # + # Yes, we have libnl 2.x. + # + LIBS="-lnl-genl -lnl $LIBS" + +$as_echo "#define HAVE_LIBNL 1" >>confdefs.h + + +$as_echo "#define HAVE_LIBNL_2_x 1" >>confdefs.h + + +else + + # + # No, we don't; do we have libnl 1.x? + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_handle_alloc in -lnl" >&5 $as_echo_n "checking for nl_handle_alloc in -lnl... " >&6; } -if test "${ac_cv_lib_nl_nl_handle_alloc+set}" = set; then : +if ${ac_cv_lib_nl_nl_handle_alloc+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5413,23 +5508,51 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nl_nl_handle_alloc" >&5 $as_echo "$ac_cv_lib_nl_nl_handle_alloc" >&6; } -if test "x$ac_cv_lib_nl_nl_handle_alloc" = x""yes; then : - LIBS="-lnl $LIBS" +if test "x$ac_cv_lib_nl_nl_handle_alloc" = xyes; then : + + # + # Yes. + # + LIBS="-lnl $LIBS" $as_echo "#define HAVE_LIBNL 1" >>confdefs.h + else - if test x$with_libnl = xyes ; then - as_fn_error "libnl support requested but libnl not found" "$LINENO" 5 - fi + + # + # No, we don't have libnl at all. + # + if test x$with_libnl = xyes ; then + as_fn_error $? "libnl support requested but libnl not found" "$LINENO" 5 + fi + +fi + fi fi + for ac_header in linux/ethtool.h +do : + ac_fn_c_check_header_compile "$LINENO" "linux/ethtool.h" "ac_cv_header_linux_ethtool_h" " +$ac_includes_default +#include + +" +if test "x$ac_cv_header_linux_ethtool_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LINUX_ETHTOOL_H 1 +_ACEOF + +fi + +done + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if if_packet.h has tpacket_stats defined" >&5 $as_echo_n "checking if if_packet.h has tpacket_stats defined... " >&6; } - if test "${ac_cv_lbl_tpacket_stats+set}" = set; then : + if ${ac_cv_lbl_tpacket_stats+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5461,12 +5584,13 @@ $as_echo "#define HAVE_TPACKET_STATS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if tpacket_auxdata struct has tp_vlan_tci member" >&5 $as_echo_n "checking if tpacket_auxdata struct has tp_vlan_tci member... " >&6; } - if test "${ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1+set}" = set; then : + if ${ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +# include # include int main () @@ -5502,7 +5626,7 @@ bpf) for ac_header in net/if_media.h do : ac_fn_c_check_header_mongrel "$LINENO" "net/if_media.h" "ac_cv_header_net_if_media_h" "$ac_includes_default" -if test "x$ac_cv_header_net_if_media_h" = x""yes; then : +if test "x$ac_cv_header_net_if_media_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NET_IF_MEDIA_H 1 _ACEOF @@ -5554,7 +5678,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #include " -if test "x$ac_cv_type_struct_BPF_TIMEVAL" = x""yes; then : +if test "x$ac_cv_type_struct_BPF_TIMEVAL" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_BPF_TIMEVAL 1 @@ -5594,14 +5718,14 @@ then V_FINDALLDEVS=null else ac_fn_c_check_func "$LINENO" "getifaddrs" "ac_cv_func_getifaddrs" -if test "x$ac_cv_func_getifaddrs" = x""yes; then : +if test "x$ac_cv_func_getifaddrs" = xyes; then : # # We have "getifaddrs()"; make sure we have # as well, just in case some platform is really weird. # ac_fn_c_check_header_mongrel "$LINENO" "ifaddrs.h" "ac_cv_header_ifaddrs_h" "$ac_includes_default" -if test "x$ac_cv_header_ifaddrs_h" = x""yes; then : +if test "x$ac_cv_header_ifaddrs_h" = xyes; then : # # We have the header, so we use "getifaddrs()" to @@ -5620,7 +5744,7 @@ else # but without "ifaddrs.h", if there is something # we can do on those systems. # - as_fn_error "Your system has getifaddrs() but doesn't have a usable ." "$LINENO" 5 + as_fn_error $? "Your system has getifaddrs() but doesn't have a usable ." "$LINENO" 5 fi @@ -5642,8 +5766,7 @@ else do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +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 @@ -5660,7 +5783,7 @@ done # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have SIOCGLIFCONF" >&5 $as_echo_n "checking whether we have SIOCGLIFCONF... " >&6; } - if test "${ac_cv_lbl_have_siocglifconf+set}" = set; then : + if ${ac_cv_lbl_have_siocglifconf+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5755,7 +5878,7 @@ fi if test "$enable_ipv6" != "no"; then ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" -if test "x$ac_cv_func_getaddrinfo" = x""yes; then : +if test "x$ac_cv_func_getaddrinfo" = xyes; then : $as_echo "#define INET6 1" >>confdefs.h @@ -5766,8 +5889,8 @@ else if test "$enable_ipv6" != "ifavailable"; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "--enable-ipv6 was given, but getaddrinfo isn't available -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "--enable-ipv6 was given, but getaddrinfo isn't available +See \`config.log' for more details" "$LINENO" 5; } fi fi @@ -5870,7 +5993,7 @@ linux|bpf|dag) # If they expressed no preference, don't include it. # if test $want_dag = yes; then - as_fn_error "DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types" "$LINENO" 5 + as_fn_error $? "DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types" "$LINENO" 5 elif test $want_dag = yes; then want_dag=no fi @@ -5898,7 +6021,7 @@ $as_echo_n "checking whether we have DAG API headers... " >&6; } if test -z "$dag_tools_dir"; then dag_tools_dir="$dag_root/tools" - fi + fi if test -r $dag_include_dir/dagapi.h; then ac_cv_lbl_dag_api=yes @@ -5907,143 +6030,9 @@ $as_echo_n "checking whether we have DAG API headers... " >&6; } $as_echo "$ac_cv_lbl_dag_api ($dag_include_dir)" >&6; } fi -if test $ac_cv_lbl_dag_api = yes; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dagapi.o" >&5 -$as_echo_n "checking dagapi.o... " >&6; } - dagapi_obj=no - if test -r $dag_tools_dir/dagapi.o; then - # 2.4.x. - dagapi_obj=$dag_tools_dir/dagapi.o - elif test -r $dag_lib_dir/dagapi.o; then - # 2.5.x. - dagapi_obj=$dag_lib_dir/dagapi.o - elif test -r $dag_lib_dir/libdag.a; then - # 2.5.x. - ar x $dag_lib_dir/libdag.a dagapi.o 2>/dev/null - if test -r ./dagapi.o; then - dagapi_obj=./dagapi.o - else - ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o 2>/dev/null - if test -r ./libdag_la-dagapi.o; then - dagapi_obj=./libdag_la-dagapi.o - fi - fi - fi - - if test $dagapi_obj = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)" >&5 -$as_echo "no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)" >&6; } - ac_cv_lbl_dag_api=no - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($dagapi_obj)" >&5 -$as_echo "yes ($dagapi_obj)" >&6; } - fi -fi - -if test $ac_cv_lbl_dag_api = yes; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dagopts.o" >&5 -$as_echo_n "checking dagopts.o... " >&6; } - dagopts_obj=no - if test -r $dag_tools_dir/dagopts.o; then - # 2.4.x. - dagopts_obj=$dag_tools_dir/dagopts.o - elif test -r $dag_lib_dir/dagopts.o; then - # 2.5.x. - dagopts_obj=$dag_lib_dir/dagopts.o - elif test -r $dag_lib_dir/libdag.a; then - # 2.5.x. - ar x $dag_lib_dir/libdag.a dagopts.o 2>/dev/null - if test -r ./dagopts.o; then - dagopts_obj=./dagopts.o - else - ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o 2>/dev/null - if test -r ./libdag_la-dagopts.o; then - dagopts_obj=./libdag_la-dagopts.o - fi - fi - fi - - if test $dagopts_obj = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)" >&5 -$as_echo "no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)" >&6; } - ac_cv_lbl_dag_api=no - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($dagopts_obj)" >&5 -$as_echo "yes ($dagopts_obj)" >&6; } - fi -fi - -if test $ac_cv_lbl_dag_api = yes; then - # Under 2.5.x only we need to add dagreg.o. - if test -r $dag_include_dir/dagreg.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dagreg.o" >&5 -$as_echo_n "checking dagreg.o... " >&6; } - dagreg_obj=no - if test -r $dag_lib_dir/dagreg.o; then - # Object file is ready and waiting. - dagreg_obj=$dag_lib_dir/dagreg.o - elif test -r $dag_lib_dir/libdag.a; then - # Extract from libdag.a. - ar x $dag_lib_dir/libdag.a dagreg.o 2>/dev/null - if test -r ./dagreg.o; then - dagreg_obj=./dagreg.o - else - ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o 2>/dev/null - if test -r ./libdag_la-dagreg.o; then - dagreg_obj=./libdag_la-dagreg.o - fi - fi - fi - - if test $dagreg_obj = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (checked $dag_lib_dir $dag_lib_dir/libdag.a)" >&5 -$as_echo "no (checked $dag_lib_dir $dag_lib_dir/libdag.a)" >&6; } - ac_cv_lbl_dag_api=no - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($dagreg_obj)" >&5 -$as_echo "yes ($dagreg_obj)" >&6; } - fi - fi -fi - -if test $ac_cv_lbl_dag_api = yes; then - # Under 2.5.x only we need to add dagutil.o. - if test -r $dag_include_dir/dagutil.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dagutil.o" >&5 -$as_echo_n "checking dagutil.o... " >&6; } - dagutil_obj=no - if test -r $dag_lib_dir/dagutil.o; then - # Object file is ready and waiting. - dagutil_obj=$dag_lib_dir/dagutil.o - elif test -r $dag_lib_dir/libdag.a; then - # Extract from libdag.a. - ar x $dag_lib_dir/libdag.a dagutil.o 2>/dev/null - if test -r ./dagutil.o; then - dagutil_obj=./dagutil.o - else - ar x $dag_lib_dir/libdag.a libdag_la-dagutil.o 2>/dev/null - if test -r ./libdag_la-dagutil.o; then - dagutil_obj=./libdag_la-dagutil.o - fi - fi - fi - - if test $dagutil_obj = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (checked $dag_lib_dir $dag_lib_dir/libdag.a)" >&5 -$as_echo "no (checked $dag_lib_dir $dag_lib_dir/libdag.a)" >&6; } - ac_cv_lbl_dag_api=no - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($dagutil_obj)" >&5 -$as_echo "yes ($dagutil_obj)" >&6; } - fi - fi -fi - if test $ac_cv_lbl_dag_api = yes; then V_INCLS="$V_INCLS -I$dag_include_dir" - ADDLARCHIVEOBJS="$ADDLARCHIVEOBJS $dagapi_obj $dagopts_obj $dagreg_obj $dagutil_obj" + if test $V_PCAP != dag ; then SSRC="pcap-dag.c" fi @@ -6055,7 +6044,7 @@ if test $ac_cv_lbl_dag_api = yes; then LDFLAGS="-L$dag_lib_dir" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dag_attach_stream in -ldag" >&5 $as_echo_n "checking for dag_attach_stream in -ldag... " >&6; } -if test "${ac_cv_lib_dag_dag_attach_stream+set}" = set; then : +if ${ac_cv_lib_dag_dag_attach_stream+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -6089,7 +6078,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dag_dag_attach_stream" >&5 $as_echo "$ac_cv_lib_dag_dag_attach_stream" >&6; } -if test "x$ac_cv_lib_dag_dag_attach_stream" = x""yes; then : +if test "x$ac_cv_lib_dag_dag_attach_stream" = xyes; then : dag_streams="1" else dag_streams="0" @@ -6097,7 +6086,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dag_get_erf_types in -ldag" >&5 $as_echo_n "checking for dag_get_erf_types in -ldag... " >&6; } -if test "${ac_cv_lib_dag_dag_get_erf_types+set}" = set; then : +if ${ac_cv_lib_dag_dag_get_erf_types+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -6131,7 +6120,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dag_dag_get_erf_types" >&5 $as_echo "$ac_cv_lib_dag_dag_get_erf_types" >&6; } -if test "x$ac_cv_lib_dag_dag_get_erf_types" = x""yes; then : +if test "x$ac_cv_lib_dag_dag_get_erf_types" = xyes; then : $as_echo "#define HAVE_DAG_GET_ERF_TYPES 1" >>confdefs.h @@ -6140,7 +6129,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dag_get_stream_erf_types in -ldag" >&5 $as_echo_n "checking for dag_get_stream_erf_types in -ldag... " >&6; } -if test "${ac_cv_lib_dag_dag_get_stream_erf_types+set}" = set; then : +if ${ac_cv_lib_dag_dag_get_stream_erf_types+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -6174,13 +6163,14 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dag_dag_get_stream_erf_types" >&5 $as_echo "$ac_cv_lib_dag_dag_get_stream_erf_types" >&6; } -if test "x$ac_cv_lib_dag_dag_get_stream_erf_types" = x""yes; then : +if test "x$ac_cv_lib_dag_dag_get_stream_erf_types" = xyes; then : $as_echo "#define HAVE_DAG_GET_STREAM_ERF_TYPES 1" >>confdefs.h fi + LDFLAGS=$saved_ldflags if test "$dag_streams" = 1; then @@ -6188,6 +6178,56 @@ fi $as_echo "#define HAVE_DAG_STREAMS_API 1" >>confdefs.h LIBS="$LIBS -ldag" + LDFLAGS="$LDFLAGS -L$dag_lib_dir" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vdag_set_device_info in -lvdag" >&5 +$as_echo_n "checking for vdag_set_device_info in -lvdag... " >&6; } +if ${ac_cv_lib_vdag_vdag_set_device_info+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lvdag $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 vdag_set_device_info (); +int +main () +{ +return vdag_set_device_info (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_vdag_vdag_set_device_info=yes +else + ac_cv_lib_vdag_vdag_set_device_info=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_vdag_vdag_set_device_info" >&5 +$as_echo "$ac_cv_lib_vdag_vdag_set_device_info" >&6; } +if test "x$ac_cv_lib_vdag_vdag_set_device_info" = xyes; then : + ac_dag_have_vdag="1" +else + ac_dag_have_vdag="0" +fi + + if test "$ac_dag_have_vdag" = 1; then + +$as_echo "#define HAVE_DAG_VDAG 1" >>confdefs.h + + LIBS="$LIBS -lpthread" + fi fi @@ -6203,13 +6243,13 @@ if test $ac_cv_lbl_dag_api = no; then $as_echo "no" >&6; } if test "$want_dag" = yes; then # User wanted DAG support but we couldn't find it. - as_fn_error "DAG API requested, but not found at $dag_root: use --without-dag" "$LINENO" 5 + as_fn_error $? "DAG API requested, but not found at $dag_root: use --without-dag" "$LINENO" 5 fi if test "$V_PCAP" = dag; then # User requested "dag" capture type but the DAG API wasn't # found. - as_fn_error "Specifying the capture type as \"dag\" requires the DAG API to be present; use the --with-dag options to specify the location. (Try \"./configure --help\" for more information.)" "$LINENO" 5 + as_fn_error $? "Specifying the capture type as \"dag\" requires the DAG API to be present; use the --with-dag options to specify the location. (Try \"./configure --help\" for more information.)" "$LINENO" 5 fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -6258,7 +6298,7 @@ linux|septel) # If they expressed no preference, don't include it. # if test $want_septel = yes; then - as_fn_error "Septel support only available with 'linux' and 'septel' packet capture types" "$LINENO" 5 + as_fn_error $? "Septel support only available with 'linux' and 'septel' packet capture types" "$LINENO" 5 elif test $want_septel = yes; then want_septel=no fi @@ -6292,7 +6332,7 @@ $as_echo_n "checking whether we have Septel API... " >&6; } $as_echo "$ac_cv_lbl_septel_api" >&6; } if test $ac_cv_lbl_septel_api = no; then if test "$want_septel" = yes; then - as_fn_error "Septel API not found under directory $septel_root; use --without-septel" "$LINENO" 5 + as_fn_error $? "Septel API not found under directory $septel_root; use --without-septel" "$LINENO" 5 fi else @@ -6302,7 +6342,7 @@ $as_echo "#define HAVE_SEPTEL_API 1" >>confdefs.h fi if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then - as_fn_error "Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR" "$LINENO" 5 + as_fn_error $? "Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR" "$LINENO" 5 fi # Check for Myricom SNF support. @@ -6371,7 +6411,7 @@ bpf|linux|snf) # If they expressed no preference, don't include it. # if test $want_snf = yes; then - as_fn_error "Myricom SNF support only available with 'bpf' 'linux' and 'snf' packet capture types" "$LINENO" 5 + as_fn_error $? "Myricom SNF support only available with 'bpf' 'linux' and 'snf' packet capture types" "$LINENO" 5 elif test $want_snf = yes; then want_snf=no fi @@ -6404,14 +6444,14 @@ $as_echo "$ac_cv_lbl_snf_api ($snf_root)" >&6; } if test $ac_cv_lbl_snf_api = no; then if test "$want_snf" = yes; then - as_fn_error "SNF API headers not found under $snf_include_dir; use --without-snf" "$LINENO" 5 + as_fn_error $? "SNF API headers not found under $snf_include_dir; use --without-snf" "$LINENO" 5 fi else saved_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -L$snf_lib_dir" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snf_init in -lsnf" >&5 $as_echo_n "checking for snf_init in -lsnf... " >&6; } -if test "${ac_cv_lib_snf_snf_init+set}" = set; then : +if ${ac_cv_lib_snf_snf_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -6445,7 +6485,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_snf_snf_init" >&5 $as_echo "$ac_cv_lib_snf_snf_init" >&6; } -if test "x$ac_cv_lib_snf_snf_init" = x""yes; then : +if test "x$ac_cv_lib_snf_snf_init" = xyes; then : ac_cv_lbl_snf_api="yes" else ac_cv_lbl_snf_api="no" @@ -6455,7 +6495,7 @@ fi if test $ac_cv_lbl_snf_api = no; then if test "$want_snf" = yes; then - as_fn_error "SNF API cannot correctly be linked check config.log; use --without-snf" "$LINENO" 5 + as_fn_error $? "SNF API cannot correctly be linked check config.log; use --without-snf" "$LINENO" 5 fi else V_INCLS="$V_INCLS -I$snf_include_dir" @@ -6472,7 +6512,7 @@ $as_echo "#define HAVE_SNF_API 1" >>confdefs.h fi if test "$V_PCAP" = snf -a "$ac_cv_lbl_snf_api" = no; then - as_fn_error "Specifying the capture type as 'snf' requires the Myricom Sniffer API to be present; use --with-snf=DIR" "$LINENO" 5 + as_fn_error $? "Specifying the capture type as 'snf' requires the Myricom Sniffer API to be present; use --with-snf=DIR" "$LINENO" 5 fi # @@ -6533,6 +6573,49 @@ $as_echo "yes" >&6; } darwin*) DYEXT="dylib" V_CCOPT="$V_CCOPT -fno-common" + # Check whether --enable-universal was given. +if test "${enable_universal+set}" = set; then : + enableval=$enable_universal; +fi + + if test "$enable_universal" != "no"; then + case "$host_os" in + + darwin9.*) + # + # Leopard. Build for 32-bit PowerPC, 64-bit + # PowerPC, x86, and x86-64, with 32-bit PowerPC + # first. (That's what Apple does.) + # + V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64" + LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64" + ;; + + darwin10.*) + # + # Snow Leopard. Build for x86-64, x86, and + # 32-bit PowerPC, with x86-64 first. (That's + # what Apple does, even though Snow Leopard + # doesn't run on PPC, so PPC libpcap runs under + # Rosetta, and Rosetta doesn't support BPF + # ioctls, so PPC programs can't do live + # captures.) + # + V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc" + LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc" + ;; + + darwin11.*) + # + # Lion. Build for x86-64 and x86, with x86-64 + # first. (That's probably what Apple does, + # given that Rosetta is gone.) + # + V_CCOPT="$V_CCOPT -arch x86_64 -arch i386" + LDFLAGS="$LDFLAGS -arch x86_64 -arch i386" + ;; + esac + fi ;; hpux9*) @@ -6596,7 +6679,7 @@ irix*) MAN_MISC_INFO=5 ;; -linux*|freebsd*|netbsd*|openbsd*|dragonfly*) +linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*) DYEXT="so" # @@ -6621,7 +6704,7 @@ osf*) sinix*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if SINIX compiler defines sinix" >&5 $as_echo_n "checking if SINIX compiler defines sinix... " >&6; } - if test "${ac_cv_cc_sinix_defined+set}" = set; then : + if ${ac_cv_cc_sinix_defined+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6671,7 +6754,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -6711,7 +6794,7 @@ if test -z "$ac_cv_prog_RANLIB"; then set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -6758,6 +6841,98 @@ else RANLIB="$ac_cv_prog_RANLIB" fi +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + rm -f os-proto.h if test "${LBL_CFLAGS+set}" = set; then @@ -6800,7 +6975,7 @@ $as_echo "$as_me: WARNING: can't find $name" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sockaddr struct has the sa_len member" >&5 $as_echo_n "checking if sockaddr struct has the sa_len member... " >&6; } - if test "${ac_cv_lbl_sockaddr_has_sa_len+set}" = set; then : + if ${ac_cv_lbl_sockaddr_has_sa_len+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6834,7 +7009,7 @@ $as_echo "#define HAVE_SOCKADDR_SA_LEN 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sockaddr_storage struct exists" >&5 $as_echo_n "checking if sockaddr_storage struct exists... " >&6; } - if test "${ac_cv_lbl_has_sockaddr_storage+set}" = set; then : + if ${ac_cv_lbl_has_sockaddr_storage+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6868,7 +7043,7 @@ $as_echo "#define HAVE_SOCKADDR_STORAGE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking if dl_hp_ppa_info_t struct has dl_module_id_1 member" >&5 $as_echo_n "checking if dl_hp_ppa_info_t struct has dl_module_id_1 member... " >&6; } - if test "${ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1+set}" = set; then : + if ${ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6903,7 +7078,7 @@ $as_echo "#define HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking if unaligned accesses fail" >&5 $as_echo_n "checking if unaligned accesses fail... " >&6; } - if test "${ac_cv_lbl_unaligned_fail+set}" = set; then : + if ${ac_cv_lbl_unaligned_fail+:} false; then : $as_echo_n "(cached) " >&6 else case "$host_cpu" in @@ -7030,28 +7205,28 @@ linux*) $as_echo "#define PCAP_SUPPORT_USB 1" >>confdefs.h - USB_SRC=pcap-usb-linux.c - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + USB_SRC=pcap-usb-linux.c + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null` - if test $? -ne 0 ; then - ac_usb_dev_name="usbmon" - fi + ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null` + if test $? -ne 0 ; then + ac_usb_dev_name="usbmon" + fi cat >>confdefs.h <<_ACEOF #define LINUX_USB_MON_DEV "/dev/$ac_usb_dev_name" _ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: Device for USB sniffing is /dev/$ac_usb_dev_name" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Device for USB sniffing is /dev/$ac_usb_dev_name" >&5 $as_echo "$as_me: Device for USB sniffing is /dev/$ac_usb_dev_name" >&6;} - # - # Do we have a version of available? - # If so, we might need it for . - # - for ac_header in linux/compiler.h + # + # Do we have a version of available? + # If so, we might need it for . + # + for ac_header in linux/compiler.h do : ac_fn_c_check_header_mongrel "$LINENO" "linux/compiler.h" "ac_cv_header_linux_compiler_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_compiler_h" = x""yes; then : +if test "x$ac_cv_header_linux_compiler_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_COMPILER_H 1 _ACEOF @@ -7060,15 +7235,15 @@ fi done - if test "$ac_cv_header_linux_compiler_h" = yes; then - # - # Yes - include it when testing for . - # - for ac_header in linux/usbdevice_fs.h + if test "$ac_cv_header_linux_compiler_h" = yes; then + # + # Yes - include it when testing for . + # + for ac_header in linux/usbdevice_fs.h do : ac_fn_c_check_header_compile "$LINENO" "linux/usbdevice_fs.h" "ac_cv_header_linux_usbdevice_fs_h" "#include " -if test "x$ac_cv_header_linux_usbdevice_fs_h" = x""yes; then : +if test "x$ac_cv_header_linux_usbdevice_fs_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_USBDEVICE_FS_H 1 _ACEOF @@ -7077,11 +7252,11 @@ fi done - else - for ac_header in linux/usbdevice_fs.h + else + for ac_header in linux/usbdevice_fs.h do : ac_fn_c_check_header_mongrel "$LINENO" "linux/usbdevice_fs.h" "ac_cv_header_linux_usbdevice_fs_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_usbdevice_fs_h" = x""yes; then : +if test "x$ac_cv_header_linux_usbdevice_fs_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_USBDEVICE_FS_H 1 _ACEOF @@ -7090,17 +7265,17 @@ fi done - fi - if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then - # - # OK, does it define bRequestType? Older versions of the kernel - # define fields with names like "requesttype, "request", and - # "value", rather than "bRequestType", "bRequest", and - # "wValue". - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if usbdevfs_ctrltransfer struct has bRequestType member" >&5 + fi + if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then + # + # OK, does it define bRequestType? Older versions of the kernel + # define fields with names like "requesttype, "request", and + # "value", rather than "bRequestType", "bRequest", and + # "wValue". + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if usbdevfs_ctrltransfer struct has bRequestType member" >&5 $as_echo_n "checking if usbdevfs_ctrltransfer struct has bRequestType member... " >&6; } - if test "${ac_cv_usbdevfs_ctrltransfer_has_bRequestType+set}" = set; then : + if ${ac_cv_usbdevfs_ctrltransfer_has_bRequestType+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7113,7 +7288,7 @@ $ac_includes_default #ifdef HAVE_LINUX_COMPILER_H #include #endif -# include +#include int main () { @@ -7130,19 +7305,81 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_usbdevfs_ctrltransfer_has_bRequestType" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_usbdevfs_ctrltransfer_has_bRequestType" >&5 $as_echo "$ac_cv_usbdevfs_ctrltransfer_has_bRequestType" >&6; } - if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then + if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then $as_echo "#define HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE 1" >>confdefs.h - fi - fi - ;; + fi + fi + ;; +*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; +esac + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the platform could support netfilter sniffing" >&5 +$as_echo_n "checking whether the platform could support netfilter sniffing... " >&6; } +case "$host_os" in +linux*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + # + # Life's too short to deal with trying to get this to compile + # if you don't get the right types defined with + # __KERNEL_STRICT_NAMES getting defined by some other include. + # + # Check whether the includes Just Work. If not, don't turn on + # netfilter support. + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can compile the netfilter support" >&5 +$as_echo_n "checking whether we can compile the netfilter support... " >&6; } + if ${ac_cv_netfilter_can_compile+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$ac_includes_default +#include +#include + +#include +#include +#include +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_netfilter_can_compile=yes +else + ac_cv_netfilter_can_compile=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_netfilter_can_compile" >&5 +$as_echo "$ac_cv_netfilter_can_compile" >&6; } + if test $ac_cv_netfilter_can_compile = yes ; then + +$as_echo "#define PCAP_SUPPORT_NETFILTER 1" >>confdefs.h + + NETFILTER_SRC=pcap-netfilter-linux.c + fi + ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - ;; + ;; esac @@ -7158,14 +7395,14 @@ fi if test "x$enable_bluetooth" != "xno" ; then case "$host_os" in linux*) - ac_fn_c_check_header_mongrel "$LINENO" "bluetooth/bluetooth.h" "ac_cv_header_bluetooth_bluetooth_h" "$ac_includes_default" -if test "x$ac_cv_header_bluetooth_bluetooth_h" = x""yes; then : + ac_fn_c_check_header_mongrel "$LINENO" "bluetooth/bluetooth.h" "ac_cv_header_bluetooth_bluetooth_h" "$ac_includes_default" +if test "x$ac_cv_header_bluetooth_bluetooth_h" = xyes; then : $as_echo "#define PCAP_SUPPORT_BT 1" >>confdefs.h - BT_SRC=pcap-bt-linux.c - { $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is supported" >&5 + BT_SRC=pcap-bt-linux.c + { $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is supported" >&5 $as_echo "$as_me: Bluetooth sniffing is supported" >&6;} else @@ -7175,11 +7412,11 @@ $as_echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel t fi - ;; + ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: no Bluetooth sniffing support implemented for $host_os" >&5 + { $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;} - ;; + ;; esac @@ -7199,7 +7436,7 @@ if test "x$enable_can" != "xno" ; then ac_fn_c_check_header_compile "$LINENO" "linux/can.h" "ac_cv_header_linux_can_h" "#include " -if test "x$ac_cv_header_linux_can_h" = x""yes; then : +if test "x$ac_cv_header_linux_can_h" = xyes; then : $as_echo "#define PCAP_SUPPORT_CAN 1" >>confdefs.h @@ -7222,6 +7459,27 @@ $as_echo "$as_me: no CAN sniffing support implemented for $host_os" >&6;} fi +case "$host_os" in +linux*) + for ac_header in linux/net_tstamp.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "linux/net_tstamp.h" "ac_cv_header_linux_net_tstamp_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_net_tstamp_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LINUX_NET_TSTAMP_H 1 +_ACEOF + +fi + +done + + ;; +*) + { $as_echo "$as_me:${as_lineno-$LINENO}: no hardware timestamp support implemented for $host_os" >&5 +$as_echo "$as_me: no hardware timestamp support implemented for $host_os" >&6;} + ;; +esac + # Check whether --enable-packet-ring was given. if test "${enable_packet_ring+set}" = set; then : enableval=$enable_packet_ring; @@ -7254,7 +7512,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -7334,7 +7592,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' ac_config_headers="$ac_config_headers config.h" -ac_config_files="$ac_config_files Makefile pcap-filter.manmisc pcap-linktype.manmisc pcap-savefile.manfile pcap.3pcap pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap pcap_list_datalinks.3pcap pcap_open_dead.3pcap pcap_open_offline.3pcap" +ac_config_files="$ac_config_files Makefile pcap-filter.manmisc pcap-linktype.manmisc pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap pcap_list_datalinks.3pcap pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap pcap_open_offline.3pcap pcap_set_tstamp_type.3pcap" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -7400,10 +7658,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -7419,6 +7688,7 @@ DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' @@ -7434,7 +7704,7 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -7535,6 +7805,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -7580,19 +7851,19 @@ export LANGUAGE (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -7788,7 +8059,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -7842,7 +8113,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.65. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -7904,10 +8175,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.65, +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -7923,11 +8194,16 @@ ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) + --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -7949,6 +8225,7 @@ do $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; @@ -7961,7 +8238,7 @@ do ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' + as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; @@ -7970,7 +8247,7 @@ Try \`$0 --help' for more information.";; ac_cs_silent=: ;; # This is an error. - -*) as_fn_error "unrecognized option: \`$1' + -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" @@ -8023,16 +8300,19 @@ do "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "pcap-filter.manmisc") CONFIG_FILES="$CONFIG_FILES pcap-filter.manmisc" ;; "pcap-linktype.manmisc") CONFIG_FILES="$CONFIG_FILES pcap-linktype.manmisc" ;; + "pcap-tstamp.manmisc") CONFIG_FILES="$CONFIG_FILES pcap-tstamp.manmisc" ;; "pcap-savefile.manfile") CONFIG_FILES="$CONFIG_FILES pcap-savefile.manfile" ;; "pcap.3pcap") CONFIG_FILES="$CONFIG_FILES pcap.3pcap" ;; "pcap_compile.3pcap") CONFIG_FILES="$CONFIG_FILES pcap_compile.3pcap" ;; "pcap_datalink.3pcap") CONFIG_FILES="$CONFIG_FILES pcap_datalink.3pcap" ;; "pcap_dump_open.3pcap") CONFIG_FILES="$CONFIG_FILES pcap_dump_open.3pcap" ;; "pcap_list_datalinks.3pcap") CONFIG_FILES="$CONFIG_FILES pcap_list_datalinks.3pcap" ;; + "pcap_list_tstamp_types.3pcap") CONFIG_FILES="$CONFIG_FILES pcap_list_tstamp_types.3pcap" ;; "pcap_open_dead.3pcap") CONFIG_FILES="$CONFIG_FILES pcap_open_dead.3pcap" ;; "pcap_open_offline.3pcap") CONFIG_FILES="$CONFIG_FILES pcap_open_offline.3pcap" ;; + "pcap_set_tstamp_type.3pcap") CONFIG_FILES="$CONFIG_FILES pcap_set_tstamp_type.3pcap" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -8054,9 +8334,10 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -8064,12 +8345,13 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -8086,12 +8368,12 @@ if test "x$ac_cr" = x; then fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' + ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -8100,18 +8382,18 @@ _ACEOF echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -8119,7 +8401,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -8167,7 +8449,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -8199,21 +8481,29 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi @@ -8225,7 +8515,7 @@ fi # test -n "$CONFIG_FILES" # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -8237,11 +8527,11 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -8326,7 +8616,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -8339,7 +8629,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -8358,7 +8648,7 @@ do for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -8367,7 +8657,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -8393,8 +8683,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -8524,23 +8814,24 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 +which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} +which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -8549,21 +8840,21 @@ which seems to be undefined. Please make sure it is defined." >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; @@ -8578,7 +8869,7 @@ _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -8599,7 +8890,7 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit $? + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 diff --git a/libpcap/configure.in b/libpcap/configure.in index e56462b081..5eca6ab6ca 100644 --- a/libpcap/configure.in +++ b/libpcap/configure.in @@ -103,6 +103,8 @@ dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris. dnl AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h) +AC_CHECK_HEADERS(linux/types.h) +AC_CHECK_HEADERS(linux/if_packet.h netpacket/packet.h netpacket/if_packet.h) AC_CHECK_HEADERS(net/pfvar.h, , , [#include #include #include ]) @@ -152,7 +154,7 @@ needsnprintf=no AC_CHECK_FUNCS(vsnprintf snprintf,, [needsnprintf=yes]) if test $needsnprintf = yes; then - AC_LIBOBJ(snprintf) + AC_LIBOBJ([snprintf]) fi # @@ -410,23 +412,6 @@ dlpi) ;; linux) - AC_MSG_CHECKING(Linux kernel version) - if test "$cross_compiling" = yes; then - AC_CACHE_VAL(ac_cv_linux_vers, - ac_cv_linux_vers=unknown) - else - AC_CACHE_VAL(ac_cv_linux_vers, - ac_cv_linux_vers=`uname -r 2>&1 | \ - sed -n -e '$s/.* //' -e '$s/\..*//p'`) - fi - AC_MSG_RESULT($ac_cv_linux_vers) - if test $ac_cv_linux_vers = unknown ; then - AC_MSG_ERROR(cannot determine linux version when cross-compiling) - fi - if test $ac_cv_linux_vers -lt 2 ; then - AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info) - fi - # # Do we have the wireless extensions? # @@ -445,15 +430,46 @@ linux) with_libnl=$withval,,) if test x$with_libnl != xno ; then - AC_CHECK_LIB(nl, nl_handle_alloc, - LIBS="-lnl $LIBS" - AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]), - if test x$with_libnl = xyes ; then - AC_MSG_ERROR([libnl support requested but libnl not found]) - fi - ) + # + # Try libnl 2.x first. + # + AC_CHECK_LIB(nl, nl_socket_alloc, + [ + # + # Yes, we have libnl 2.x. + # + LIBS="-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]) + ], + [ + # + # No, we don't; do we have libnl 1.x? + # + AC_CHECK_LIB(nl, nl_handle_alloc, + [ + # + # Yes. + # + LIBS="-lnl $LIBS" + AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]) + ], + [ + # + # No, we don't have libnl at all. + # + if test x$with_libnl = xyes ; then + AC_MSG_ERROR([libnl support requested but libnl not found]) + fi + ]) + ]) fi + AC_CHECK_HEADERS(linux/ethtool.h,,, + [ +AC_INCLUDES_DEFAULT +#include + ]) AC_LBL_TPACKET_STATS AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI ;; @@ -727,7 +743,7 @@ if test "$want_dag" != no; then if test -z "$dag_tools_dir"; then dag_tools_dir="$dag_root/tools" - fi + fi if test -r $dag_include_dir/dagapi.h; then ac_cv_lbl_dag_api=yes @@ -735,131 +751,9 @@ if test "$want_dag" != no; then AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)]) fi -if test $ac_cv_lbl_dag_api = yes; then - - AC_MSG_CHECKING([dagapi.o]) - dagapi_obj=no - if test -r $dag_tools_dir/dagapi.o; then - # 2.4.x. - dagapi_obj=$dag_tools_dir/dagapi.o - elif test -r $dag_lib_dir/dagapi.o; then - # 2.5.x. - dagapi_obj=$dag_lib_dir/dagapi.o - elif test -r $dag_lib_dir/libdag.a; then - # 2.5.x. - ar x $dag_lib_dir/libdag.a dagapi.o 2>/dev/null - if test -r ./dagapi.o; then - dagapi_obj=./dagapi.o - else - ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o 2>/dev/null - if test -r ./libdag_la-dagapi.o; then - dagapi_obj=./libdag_la-dagapi.o - fi - fi - fi - - if test $dagapi_obj = no; then - AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)]) - ac_cv_lbl_dag_api=no - else - AC_MSG_RESULT([yes ($dagapi_obj)]) - fi -fi - -if test $ac_cv_lbl_dag_api = yes; then - - AC_MSG_CHECKING([dagopts.o]) - dagopts_obj=no - if test -r $dag_tools_dir/dagopts.o; then - # 2.4.x. - dagopts_obj=$dag_tools_dir/dagopts.o - elif test -r $dag_lib_dir/dagopts.o; then - # 2.5.x. - dagopts_obj=$dag_lib_dir/dagopts.o - elif test -r $dag_lib_dir/libdag.a; then - # 2.5.x. - ar x $dag_lib_dir/libdag.a dagopts.o 2>/dev/null - if test -r ./dagopts.o; then - dagopts_obj=./dagopts.o - else - ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o 2>/dev/null - if test -r ./libdag_la-dagopts.o; then - dagopts_obj=./libdag_la-dagopts.o - fi - fi - fi - - if test $dagopts_obj = no; then - AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)]) - ac_cv_lbl_dag_api=no - else - AC_MSG_RESULT([yes ($dagopts_obj)]) - fi -fi - -if test $ac_cv_lbl_dag_api = yes; then - # Under 2.5.x only we need to add dagreg.o. - if test -r $dag_include_dir/dagreg.h; then - AC_MSG_CHECKING([dagreg.o]) - dagreg_obj=no - if test -r $dag_lib_dir/dagreg.o; then - # Object file is ready and waiting. - dagreg_obj=$dag_lib_dir/dagreg.o - elif test -r $dag_lib_dir/libdag.a; then - # Extract from libdag.a. - ar x $dag_lib_dir/libdag.a dagreg.o 2>/dev/null - if test -r ./dagreg.o; then - dagreg_obj=./dagreg.o - else - ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o 2>/dev/null - if test -r ./libdag_la-dagreg.o; then - dagreg_obj=./libdag_la-dagreg.o - fi - fi - fi - - if test $dagreg_obj = no; then - AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)]) - ac_cv_lbl_dag_api=no - else - AC_MSG_RESULT([yes ($dagreg_obj)]) - fi - fi -fi - -if test $ac_cv_lbl_dag_api = yes; then - # Under 2.5.x only we need to add dagutil.o. - if test -r $dag_include_dir/dagutil.h; then - AC_MSG_CHECKING([dagutil.o]) - dagutil_obj=no - if test -r $dag_lib_dir/dagutil.o; then - # Object file is ready and waiting. - dagutil_obj=$dag_lib_dir/dagutil.o - elif test -r $dag_lib_dir/libdag.a; then - # Extract from libdag.a. - ar x $dag_lib_dir/libdag.a dagutil.o 2>/dev/null - if test -r ./dagutil.o; then - dagutil_obj=./dagutil.o - else - ar x $dag_lib_dir/libdag.a libdag_la-dagutil.o 2>/dev/null - if test -r ./libdag_la-dagutil.o; then - dagutil_obj=./libdag_la-dagutil.o - fi - fi - fi - - if test $dagutil_obj = no; then - AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)]) - ac_cv_lbl_dag_api=no - else - AC_MSG_RESULT([yes ($dagutil_obj)]) - fi - fi -fi - if test $ac_cv_lbl_dag_api = yes; then V_INCLS="$V_INCLS -I$dag_include_dir" - ADDLARCHIVEOBJS="$ADDLARCHIVEOBJS $dagapi_obj $dagopts_obj $dagreg_obj $dagutil_obj" + if test $V_PCAP != dag ; then SSRC="pcap-dag.c" fi @@ -874,11 +768,19 @@ if test $ac_cv_lbl_dag_api = yes; then AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])]) AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [ AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])]) + LDFLAGS=$saved_ldflags if test "$dag_streams" = 1; 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()]) + LIBS="$LIBS -lpthread" + fi fi AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API]) @@ -1151,6 +1053,46 @@ aix*) darwin*) DYEXT="dylib" V_CCOPT="$V_CCOPT -fno-common" + AC_ARG_ENABLE(universal, + AC_HELP_STRING([--disable-universal],[don't build universal on OS X])) + if test "$enable_universal" != "no"; then + case "$host_os" in + + darwin9.*) + # + # Leopard. Build for 32-bit PowerPC, 64-bit + # PowerPC, x86, and x86-64, with 32-bit PowerPC + # first. (That's what Apple does.) + # + V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64" + LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64" + ;; + + darwin10.*) + # + # Snow Leopard. Build for x86-64, x86, and + # 32-bit PowerPC, with x86-64 first. (That's + # what Apple does, even though Snow Leopard + # doesn't run on PPC, so PPC libpcap runs under + # Rosetta, and Rosetta doesn't support BPF + # ioctls, so PPC programs can't do live + # captures.) + # + V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc" + LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc" + ;; + + darwin11.*) + # + # Lion. Build for x86-64 and x86, with x86-64 + # first. (That's probably what Apple does, + # given that Rosetta is gone.) + # + V_CCOPT="$V_CCOPT -arch x86_64 -arch i386" + LDFLAGS="$LDFLAGS -arch x86_64 -arch i386" + ;; + esac + fi ;; hpux9*) @@ -1216,7 +1158,7 @@ irix*) MAN_MISC_INFO=5 ;; -linux*|freebsd*|netbsd*|openbsd*|dragonfly*) +linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*) DYEXT="so" # @@ -1265,6 +1207,7 @@ solaris*) esac AC_PROG_RANLIB +AC_CHECK_TOOL([AR], [ar]) AC_LBL_DEVEL(V_CCOPT) @@ -1305,38 +1248,38 @@ 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) - ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null` - if test $? -ne 0 ; then - ac_usb_dev_name="usbmon" - fi - AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing]) - AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name) - # - # Do we have a version of available? - # If so, we might need it for . - # - AC_CHECK_HEADERS(linux/compiler.h) - if test "$ac_cv_header_linux_compiler_h" = yes; then - # - # Yes - include it when testing for . - # - AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include ]) - else - AC_CHECK_HEADERS(linux/usbdevice_fs.h) - fi - if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then - # - # OK, does it define bRequestType? Older versions of the kernel - # define fields with names like "requesttype, "request", and - # "value", rather than "bRequestType", "bRequest", and - # "wValue". - # - AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member) - AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType, - AC_TRY_COMPILE([ + AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing]) + USB_SRC=pcap-usb-linux.c + AC_MSG_RESULT(yes) + ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null` + if test $? -ne 0 ; then + ac_usb_dev_name="usbmon" + fi + AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing]) + AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name) + # + # Do we have a version of available? + # If so, we might need it for . + # + AC_CHECK_HEADERS(linux/compiler.h) + if test "$ac_cv_header_linux_compiler_h" = yes; then + # + # Yes - include it when testing for . + # + AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include ]) + else + AC_CHECK_HEADERS(linux/usbdevice_fs.h) + fi + if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then + # + # OK, does it define bRequestType? Older versions of the kernel + # define fields with names like "requesttype, "request", and + # "value", rather than "bRequestType", "bRequest", and + # "wValue". + # + AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member) + AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType, + AC_TRY_COMPILE([ AC_INCLUDES_DEFAULT #ifdef HAVE_SYS_BITYPES_H #include @@ -1344,24 +1287,64 @@ AC_INCLUDES_DEFAULT #ifdef HAVE_LINUX_COMPILER_H #include #endif -# include ], - [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)], - ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes, - ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no)) - AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType) - if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then - AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1, - [if struct usbdevfs_ctrltransfer has bRequestType]) - fi - fi - ;; +#include ], + [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)], + ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes, + ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no)) + AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType) + if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then + AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1, + [if struct usbdevfs_ctrltransfer has bRequestType]) + fi + fi + ;; *) - AC_MSG_RESULT(no) - ;; + AC_MSG_RESULT(no) + ;; esac AC_SUBST(PCAP_SUPPORT_USB) AC_SUBST(USB_SRC) +dnl check for netfilter sniffing support +AC_MSG_CHECKING(whether the platform could support netfilter sniffing) +case "$host_os" in +linux*) + AC_MSG_RESULT(yes) + # + # Life's too short to deal with trying to get this to compile + # if you don't get the right types defined with + # __KERNEL_STRICT_NAMES getting defined by some other include. + # + # Check whether the includes Just Work. If not, don't turn on + # netfilter support. + # + AC_MSG_CHECKING(whether we can compile the netfilter support) + AC_CACHE_VAL(ac_cv_netfilter_can_compile, + AC_TRY_COMPILE([ +AC_INCLUDES_DEFAULT +#include +#include + +#include +#include +#include ], + [], + ac_cv_netfilter_can_compile=yes, + ac_cv_netfilter_can_compile=no)) + AC_MSG_RESULT($ac_cv_netfilter_can_compile) + if test $ac_cv_netfilter_can_compile = yes ; then + AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1, + [target host supports netfilter sniffing]) + NETFILTER_SRC=pcap-netfilter-linux.c + fi + ;; +*) + AC_MSG_RESULT(no) + ;; +esac +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@:>@])], ,enable_bluetooth=yes) @@ -1370,18 +1353,18 @@ if test "x$enable_bluetooth" != "xno" ; then dnl check for Bluetooth sniffing support case "$host_os" in linux*) - AC_CHECK_HEADER(bluetooth/bluetooth.h, - [ + AC_CHECK_HEADER(bluetooth/bluetooth.h, + [ AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing]) - BT_SRC=pcap-bt-linux.c - AC_MSG_NOTICE(Bluetooth sniffing is supported) + BT_SRC=pcap-bt-linux.c + AC_MSG_NOTICE(Bluetooth sniffing is supported) ], AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it) - ) - ;; + ) + ;; *) - AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os) - ;; + AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os) + ;; esac AC_SUBST(PCAP_SUPPORT_BT) AC_SUBST(BT_SRC) @@ -1411,6 +1394,16 @@ if test "x$enable_can" != "xno" ; then AC_SUBST(CAN_SRC) fi +dnl check for hardware timestamp support +case "$host_os" in +linux*) + AC_CHECK_HEADERS([linux/net_tstamp.h]) + ;; +*) + AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os) + ;; +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 @@ -1434,10 +1427,11 @@ AC_PROG_INSTALL AC_CONFIG_HEADER(config.h) AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc - pcap-savefile.manfile pcap.3pcap pcap_compile.3pcap - pcap_datalink.3pcap pcap_dump_open.3pcap - pcap_list_datalinks.3pcap pcap_open_dead.3pcap - pcap_open_offline.3pcap) + pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap + pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap + pcap_list_datalinks.3pcap pcap_list_tstamp_types.3pcap + pcap_open_dead.3pcap pcap_open_offline.3pcap + pcap_set_tstamp_type.3pcap) if test -f .devel ; then make depend diff --git a/libpcap/ethertype.h b/libpcap/ethertype.h index d22b92778e..2d6bbebddd 100644 --- a/libpcap/ethertype.h +++ b/libpcap/ethertype.h @@ -117,3 +117,6 @@ #ifndef ETHERTYPE_LOOPBACK #define ETHERTYPE_LOOPBACK 0x9000 #endif +#ifndef ETHERTYPE_8021QINQ +#define ETHERTYPE_8021QINQ 0x9100 +#endif diff --git a/libpcap/fad-getad.c b/libpcap/fad-getad.c index 831ddae7aa..742ae1facb 100644 --- a/libpcap/fad-getad.c +++ b/libpcap/fad-getad.c @@ -61,15 +61,21 @@ static const char rcsid[] _U_ = #endif #ifdef AF_PACKET +# ifdef HAVE_NETPACKET_PACKET_H +/* Solaris 11 and later, Linux distributions with newer glibc */ +# include +# else /* HAVE_NETPACKET_PACKET_H */ +/* LynxOS, Linux distributions with older glibc */ # ifdef __Lynx__ /* LynxOS */ # include -# else +# else /* __Lynx__ */ /* Linux */ # include # include -# endif -#endif +# endif /* __Lynx__ */ +# endif /* HAVE_NETPACKET_PACKET_H */ +#endif /* AF_PACKET */ /* * This is fun. diff --git a/libpcap/gencode.c b/libpcap/gencode.c index 14f4b75095..6045806215 100644 --- a/libpcap/gencode.c +++ b/libpcap/gencode.c @@ -47,7 +47,7 @@ static const char rcsid[] _U_ = * XXX - why was this included even on UNIX? */ #ifdef __MINGW32__ -#include "IP6_misc.h" +#include "ip6_misc.h" #endif #ifndef WIN32 @@ -772,7 +772,8 @@ static int reg_off_ll; * 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. + * to the beginning of the raw packet data, of the Ethernet header, and + * for Ethernet with various additional information. */ static u_int off_mac; @@ -1238,26 +1239,6 @@ init_linktype(p) off_nl_nosnap = 0; /* no 802.2 LLC */ return; - case DLT_LINUX_IRDA: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_DOCSIS: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - case DLT_SYMANTEC_FIREWALL: off_linktype = 6; off_macpl = 44; @@ -1366,6 +1347,16 @@ init_linktype(p) off_nl_nosnap = -1; return; + 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_nl = -1; + off_nl_nosnap = -1; + return; + case DLT_MTP2: off_li = 2; off_sio = 3; @@ -1411,126 +1402,6 @@ init_linktype(p) return; #endif - case DLT_LINUX_LAPD: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_USB: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_BLUETOOTH_HCI_H4: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_USB_LINUX: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_CAN20B: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_IEEE802_15_4_LINUX: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_IEEE802_16_MAC_CPS_RADIO: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_IEEE802_15_4: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_SITA: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_RAIF1: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_IPMB: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - - case DLT_BLUETOOTH_HCI_H4_WITH_PHDR: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; - case DLT_AX25_KISS: /* * Currently, only raw "link[N:M]" filtering is supported. @@ -1542,52 +1413,43 @@ init_linktype(p) off_mac = 1; /* step over the kiss length byte */ return; - case DLT_IEEE802_15_4_NONASK_PHY: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; + case DLT_IPNET: + off_linktype = 1; + off_macpl = 24; /* ipnet header length */ + off_nl = 0; off_nl_nosnap = -1; return; - case DLT_MPLS: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; + 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_nl = 0; /* Ethernet II */ + off_nl_nosnap = 3; /* 802.3+802.2 */ return; - case DLT_USB_LINUX_MMAPPED: - /* - * Currently, only raw "link[N:M]" filtering is supported. - */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; + 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_nl = 0; /* Ethernet II */ + off_nl_nosnap = 3; /* 802.3+802.2 */ return; - case DLT_CAN_SOCKETCAN: + default: /* - * Currently, only raw "link[N:M]" filtering is supported. + * For values in the range in which we've assigned new + * DLT_ values, only raw "link[N:M]" filtering is supported. */ - off_linktype = -1; - off_macpl = -1; - off_nl = -1; - off_nl_nosnap = -1; - return; + if (linktype >= DLT_MATCHING_MIN && + linktype <= DLT_MATCHING_MAX) { + off_linktype = -1; + off_macpl = -1; + off_nl = -1; + off_nl_nosnap = -1; + return; + } - case DLT_IPNET: - off_linktype = 1; - off_macpl = 24; /* ipnet header length */ - off_nl = 0; - off_nl_nosnap = -1; - return; } bpf_error("unknown data link type %d", linktype); /* NOTREACHED */ @@ -3059,6 +2921,8 @@ gen_linktype(proto) switch (linktype) { case DLT_EN10MB: + case DLT_NETANALYZER: + case DLT_NETANALYZER_TRANSPARENT: return gen_ether_linktype(proto); /*NOTREACHED*/ break; @@ -3462,6 +3326,11 @@ gen_linktype(proto) case DLT_JUNIPER_VP: case DLT_JUNIPER_ST: case DLT_JUNIPER_ISM: + case DLT_JUNIPER_VS: + case DLT_JUNIPER_SRX_E2E: + case DLT_JUNIPER_FIBRECHANNEL: + case DLT_JUNIPER_ATM_CEMIC: + /* just lets verify the magic number for now - * on ATM we may have up to 6 different encapsulations on the wire * and need a lot of heuristics to figure out that the payload @@ -3511,6 +3380,7 @@ gen_linktype(proto) case DLT_IEEE802_15_4: case DLT_IEEE802_15_4_LINUX: case DLT_IEEE802_15_4_NONASK_PHY: + case DLT_IEEE802_15_4_NOFCS: bpf_error("IEEE 802.15.4 link-layer type filtering not implemented"); case DLT_IEEE802_16_MAC_CPS_RADIO: @@ -3785,6 +3655,30 @@ gen_ehostop(eaddr, dir) b1 = gen_ehostop(eaddr, Q_DST); gen_or(b0, b1); return b1; + + case Q_ADDR1: + bpf_error("'addr1' is only supported on 802.11 with 802.11 headers"); + break; + + case Q_ADDR2: + bpf_error("'addr2' is only supported on 802.11 with 802.11 headers"); + break; + + case Q_ADDR3: + bpf_error("'addr3' is only supported on 802.11 with 802.11 headers"); + break; + + case Q_ADDR4: + bpf_error("'addr4' is only supported on 802.11 with 802.11 headers"); + break; + + case Q_RA: + bpf_error("'ra' is only supported on 802.11 with 802.11 headers"); + break; + + case Q_TA: + bpf_error("'ta' is only supported on 802.11 with 802.11 headers"); + break; } abort(); /* NOTREACHED */ @@ -3827,6 +3721,30 @@ gen_fhostop(eaddr, dir) b1 = gen_fhostop(eaddr, Q_DST); gen_or(b0, b1); return b1; + + case Q_ADDR1: + bpf_error("'addr1' is only supported on 802.11"); + break; + + case Q_ADDR2: + bpf_error("'addr2' is only supported on 802.11"); + break; + + case Q_ADDR3: + bpf_error("'addr3' is only supported on 802.11"); + break; + + case Q_ADDR4: + bpf_error("'addr4' is only supported on 802.11"); + break; + + case Q_RA: + bpf_error("'ra' is only supported on 802.11"); + break; + + case Q_TA: + bpf_error("'ta' is only supported on 802.11"); + break; } abort(); /* NOTREACHED */ @@ -3861,6 +3779,30 @@ gen_thostop(eaddr, dir) b1 = gen_thostop(eaddr, Q_DST); gen_or(b0, b1); return b1; + + case Q_ADDR1: + bpf_error("'addr1' is only supported on 802.11"); + break; + + case Q_ADDR2: + bpf_error("'addr2' is only supported on 802.11"); + break; + + case Q_ADDR3: + bpf_error("'addr3' is only supported on 802.11"); + break; + + case Q_ADDR4: + bpf_error("'addr4' is only supported on 802.11"); + break; + + case Q_RA: + bpf_error("'ra' is only supported on 802.11"); + break; + + case Q_TA: + bpf_error("'ta' is only supported on 802.11"); + break; } abort(); /* NOTREACHED */ @@ -4154,8 +4096,79 @@ gen_wlanhostop(eaddr, dir) gen_and(b1, b0); return b0; + case Q_RA: + /* + * Not present in management frames; addr1 in other + * frames. + */ + + /* + * If the high-order bit of the type value is 0, this + * is a management frame. + * I.e, check "(link[0] & 0x08)". + */ + s = gen_load_a(OR_LINK, 0, BPF_B); + b1 = new_block(JMP(BPF_JSET)); + b1->s.k = 0x08; + b1->stmts = s; + + /* + * Check addr1. + */ + b0 = gen_bcmp(OR_LINK, 4, 6, eaddr); + + /* + * AND that with the check of addr1. + */ + gen_and(b1, b0); + return (b0); + + case Q_TA: + /* + * Not present in management frames; addr2, if present, + * in other frames. + */ + + /* + * Not present in CTS or ACK control frames. + */ + b0 = gen_mcmp(OR_LINK, 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, + IEEE80211_FC0_SUBTYPE_MASK); + gen_not(b1); + b2 = gen_mcmp(OR_LINK, 0, BPF_B, IEEE80211_FC0_SUBTYPE_ACK, + IEEE80211_FC0_SUBTYPE_MASK); + gen_not(b2); + gen_and(b1, b2); + gen_or(b0, b2); + + /* + * If the high-order bit of the type value is 0, this + * is a management frame. + * I.e, check "(link[0] & 0x08)". + */ + s = gen_load_a(OR_LINK, 0, BPF_B); + b1 = new_block(JMP(BPF_JSET)); + b1->s.k = 0x08; + b1->stmts = s; + + /* + * AND that with the check for frames other than + * CTS and ACK frames. + */ + gen_and(b1, b2); + + /* + * Check addr2. + */ + b1 = gen_bcmp(OR_LINK, 10, 6, eaddr); + gen_and(b2, b1); + return b1; + /* - * XXX - add RA, TA, and BSSID keywords? + * XXX - add BSSID keyword? */ case Q_ADDR1: return (gen_bcmp(OR_LINK, 4, 6, eaddr)); @@ -4251,6 +4264,30 @@ gen_ipfchostop(eaddr, dir) b1 = gen_ipfchostop(eaddr, Q_DST); gen_or(b0, b1); return b1; + + case Q_ADDR1: + bpf_error("'addr1' is only supported on 802.11"); + break; + + case Q_ADDR2: + bpf_error("'addr2' is only supported on 802.11"); + break; + + case Q_ADDR3: + bpf_error("'addr3' is only supported on 802.11"); + break; + + case Q_ADDR4: + bpf_error("'addr4' is only supported on 802.11"); + break; + + case Q_RA: + bpf_error("'ra' is only supported on 802.11"); + break; + + case Q_TA: + bpf_error("'ta' is only supported on 802.11"); + break; } abort(); /* NOTREACHED */ @@ -4444,6 +4481,9 @@ gen_host(addr, mask, proto, dir, type) case Q_VRRP: bpf_error("'vrrp' modifier applied to %s", typestr); + case Q_CARP: + bpf_error("'carp' modifier applied to %s", typestr); + case Q_ATALK: bpf_error("ATALK host filtering not implemented"); @@ -4563,6 +4603,9 @@ gen_host6(addr, mask, proto, dir, type) case Q_VRRP: bpf_error("'vrrp' modifier applied to %s", typestr); + case Q_CARP: + bpf_error("'carp' modifier applied to %s", typestr); + case Q_ATALK: bpf_error("ATALK host filtering not implemented"); @@ -4647,6 +4690,8 @@ gen_gateway(eaddr, alist, proto, dir) case Q_RARP: switch (linktype) { case DLT_EN10MB: + case DLT_NETANALYZER: + case DLT_NETANALYZER_TRANSPARENT: b0 = gen_ehostop(eaddr, Q_OR); break; case DLT_FDDI: @@ -4776,6 +4821,14 @@ gen_proto_abbrev(proto) b1 = gen_proto(IPPROTO_VRRP, Q_IP, Q_DEFAULT); break; +#ifndef IPPROTO_CARP +#define IPPROTO_CARP 112 +#endif + + case Q_CARP: + b1 = gen_proto(IPPROTO_CARP, Q_IP, Q_DEFAULT); + break; + case Q_IP: b1 = gen_linktype(ETHERTYPE_IP); break; @@ -4957,7 +5010,7 @@ gen_ipfrag() struct slist *s; struct block *b; - /* not ip frag */ + /* not IPv4 frag other than the first frag */ s = gen_load_a(OR_NET, 6, BPF_H); b = new_block(JMP(BPF_JSET)); b->s.k = 0x1fff; @@ -5000,7 +5053,7 @@ gen_portop(port, proto, dir) { struct block *b0, *b1, *tmp; - /* ip proto 'proto' */ + /* ip proto 'proto' and not a fragment other than the first fragment */ tmp = gen_cmp(OR_NET, 9, BPF_B, (bpf_int32)proto); b0 = gen_ipfrag(); gen_and(tmp, b0); @@ -5092,6 +5145,7 @@ gen_portop6(port, proto, dir) struct block *b0, *b1, *tmp; /* ip6 proto 'proto' */ + /* XXX - catch the first fragment of a fragmented packet? */ b0 = gen_cmp(OR_NET, 6, BPF_B, (bpf_int32)proto); switch (dir) { @@ -5193,7 +5247,7 @@ gen_portrangeop(port1, port2, proto, dir) { struct block *b0, *b1, *tmp; - /* ip proto 'proto' */ + /* ip proto 'proto' and not a fragment other than the first fragment */ tmp = gen_cmp(OR_NET, 9, BPF_B, (bpf_int32)proto); b0 = gen_ipfrag(); gen_and(tmp, b0); @@ -5297,6 +5351,7 @@ gen_portrangeop6(port1, port2, proto, dir) struct block *b0, *b1, *tmp; /* ip6 proto 'proto' */ + /* XXX - catch the first fragment of a fragmented packet? */ b0 = gen_cmp(OR_NET, 6, BPF_B, (bpf_int32)proto); switch (dir) { @@ -5574,12 +5629,9 @@ gen_protochain(v, proto, dir) /* * in short, - * A = P[X]; - * X = X + (P[X + 1] + 1) * 8; + * A = P[X + packet head]; + * X = X + (P[X + packet head + 1] + 1) * 8; */ - /* A = X */ - s[i] = new_stmt(BPF_MISC|BPF_TXA); - i++; /* A = P[X + packet head] */ s[i] = new_stmt(BPF_LD|BPF_IND|BPF_B); s[i]->s.k = off_macpl + off_nl; @@ -5588,19 +5640,9 @@ gen_protochain(v, proto, dir) s[i] = new_stmt(BPF_ST); s[i]->s.k = reg2; i++; - /* A = X */ - s[i] = new_stmt(BPF_MISC|BPF_TXA); - i++; - /* A += 1 */ - s[i] = new_stmt(BPF_ALU|BPF_ADD|BPF_K); - s[i]->s.k = 1; - i++; - /* X = A */ - s[i] = new_stmt(BPF_MISC|BPF_TAX); - i++; - /* A = P[X + packet head]; */ + /* A = P[X + packet head + 1]; */ s[i] = new_stmt(BPF_LD|BPF_IND|BPF_B); - s[i]->s.k = off_macpl + off_nl; + s[i]->s.k = off_macpl + off_nl + 1; i++; /* A += 1 */ s[i] = new_stmt(BPF_ALU|BPF_ADD|BPF_K); @@ -5610,6 +5652,10 @@ gen_protochain(v, proto, dir) s[i] = new_stmt(BPF_ALU|BPF_MUL|BPF_K); s[i]->s.k = 8; i++; + /* A += X */ + s[i] = new_stmt(BPF_ALU|BPF_ADD|BPF_X); + s[i]->s.k = 0; + i++; /* X = A; */ s[i] = new_stmt(BPF_MISC|BPF_TAX); i++; @@ -5933,6 +5979,10 @@ gen_proto(v, proto, dir) bpf_error("'vrrp proto' is bogus"); /* NOTREACHED */ + case Q_CARP: + bpf_error("'carp proto' is bogus"); + /* NOTREACHED */ + #ifdef INET6 case Q_IPV6: b0 = gen_linktype(ETHERTYPE_IPV6); @@ -6016,6 +6066,8 @@ gen_scode(name, q) switch (linktype) { case DLT_EN10MB: + case DLT_NETANALYZER: + case DLT_NETANALYZER_TRANSPARENT: eaddr = pcap_ether_hostton(name); if (eaddr == NULL) bpf_error( @@ -6197,6 +6249,10 @@ gen_scode(name, q) /* override PROTO_UNDEF */ real_proto = IPPROTO_SCTP; } + if (port < 0) + bpf_error("illegal port number %d < 0", port); + if (port > 65535) + bpf_error("illegal port number %d > 65535", port); #ifndef INET6 return gen_port(port, real_proto, dir); #else @@ -6238,6 +6294,15 @@ gen_scode(name, q) /* override PROTO_UNDEF */ real_proto = IPPROTO_SCTP; } + if (port1 < 0) + bpf_error("illegal port number %d < 0", port1); + if (port1 > 65535) + bpf_error("illegal port number %d > 65535", port1); + if (port2 < 0) + bpf_error("illegal port number %d < 0", port2); + if (port2 > 65535) + bpf_error("illegal port number %d > 65535", port2); + #ifndef INET6 return gen_portrange(port1, port2, real_proto, dir); #else @@ -6389,6 +6454,9 @@ gen_ncode(s, v, q) else bpf_error("illegal qualifier of 'port'"); + if (v > 65535) + bpf_error("illegal port number %u > 65535", v); + #ifndef INET6 return gen_port((int)v, proto, dir); #else @@ -6412,6 +6480,9 @@ gen_ncode(s, v, q) else bpf_error("illegal qualifier of 'portrange'"); + if (v > 65535) + bpf_error("illegal port number %u > 65535", v); + #ifndef INET6 return gen_portrange((int)v, (int)v, proto, dir); #else @@ -6516,6 +6587,8 @@ gen_ecode(eaddr, q) if ((q.addr == Q_HOST || q.addr == Q_DEFAULT) && q.proto == Q_LINK) { switch (linktype) { case DLT_EN10MB: + case DLT_NETANALYZER: + case DLT_NETANALYZER_TRANSPARENT: return gen_ehostop(eaddr, (int)q.dir); case DLT_FDDI: return gen_fhostop(eaddr, (int)q.dir); @@ -6645,7 +6718,7 @@ gen_load(proto, inst, size) /* * Load into the X register the offset computed into the - * register specifed by "index". + * register specified by "index". */ s = xfer_to_x(inst); @@ -6677,7 +6750,7 @@ gen_load(proto, inst, size) * the link-layer header. 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 specifed + * register the offset computed into the register specified * by "index". */ if (s != NULL) { @@ -6726,7 +6799,7 @@ gen_load(proto, inst, size) * 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 specifed + * register the offset computed into the register specified * by "index". */ if (s != NULL) { @@ -6771,6 +6844,7 @@ gen_load(proto, inst, size) case Q_IGRP: case Q_PIM: case Q_VRRP: + case Q_CARP: /* * The offset is relative to the beginning of * the transport-layer header. @@ -7119,6 +7193,8 @@ gen_broadcast(proto) case DLT_ARCNET_LINUX: return gen_ahostop(abroadcast, Q_DST); case DLT_EN10MB: + case DLT_NETANALYZER: + case DLT_NETANALYZER_TRANSPARENT: return gen_ehostop(ebroadcast, Q_DST); case DLT_FDDI: return gen_fhostop(ebroadcast, Q_DST); @@ -7214,6 +7290,8 @@ gen_multicast(proto) /* all ARCnet multicasts use the same address */ return gen_ahostop(abroadcast, Q_DST); case DLT_EN10MB: + case DLT_NETANALYZER: + case DLT_NETANALYZER_TRANSPARENT: /* ether[0] & 1 != 0 */ return gen_mac_multicast(0); case DLT_FDDI: @@ -7477,6 +7555,11 @@ gen_inbound(dir) case DLT_JUNIPER_VP: case DLT_JUNIPER_ST: case DLT_JUNIPER_ISM: + case DLT_JUNIPER_VS: + case DLT_JUNIPER_SRX_E2E: + case DLT_JUNIPER_FIBRECHANNEL: + case DLT_JUNIPER_ATM_CEMIC: + /* juniper flags (including direction) are stored * the byte after the 3-byte magic number */ if (dir) { @@ -7757,6 +7840,30 @@ gen_ahostop(eaddr, dir) b1 = gen_ahostop(eaddr, Q_DST); gen_or(b0, b1); return b1; + + case Q_ADDR1: + bpf_error("'addr1' is only supported on 802.11"); + break; + + case Q_ADDR2: + bpf_error("'addr2' is only supported on 802.11"); + break; + + case Q_ADDR3: + bpf_error("'addr3' is only supported on 802.11"); + break; + + case Q_ADDR4: + bpf_error("'addr4' is only supported on 802.11"); + break; + + case Q_RA: + bpf_error("'ra' is only supported on 802.11"); + break; + + case Q_TA: + bpf_error("'ta' is only supported on 802.11"); + break; } abort(); /* NOTREACHED */ @@ -7811,9 +7918,15 @@ gen_vlan(vlan_num) switch (linktype) { case DLT_EN10MB: - /* check for VLAN */ + 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) { @@ -7874,6 +7987,8 @@ gen_mpls(label_num) case DLT_C_HDLC: /* fall through */ case DLT_EN10MB: + case DLT_NETANALYZER: + case DLT_NETANALYZER_TRANSPARENT: b0 = gen_linktype(ETHERTYPE_MPLS); break; diff --git a/libpcap/gencode.h b/libpcap/gencode.h index e2388b78c4..e8b0593da9 100644 --- a/libpcap/gencode.h +++ b/libpcap/gencode.h @@ -126,6 +126,8 @@ #define Q_RADIO 40 +#define Q_CARP 41 + /* Directional qualifiers. */ #define Q_SRC 1 @@ -136,6 +138,8 @@ #define Q_ADDR2 6 #define Q_ADDR3 7 #define Q_ADDR4 8 +#define Q_RA 9 +#define Q_TA 10 #define Q_DEFAULT 0 #define Q_UNDEF 255 diff --git a/libpcap/grammar.c b/libpcap/grammar.c index 38d93fe360..60c2f15c66 100644 --- a/libpcap/grammar.c +++ b/libpcap/grammar.c @@ -1,10 +1,8 @@ +/* A Bison parser, made by GNU Bison 2.5. */ -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -75,7 +73,7 @@ /* Copy the first part of user declarations. */ -/* Line 189 of yacc.c */ +/* Line 268 of yacc.c */ #line 1 "grammar.y" /* @@ -318,8 +316,8 @@ pfaction_to_num(const char *action) #endif /* HAVE_NET_PFVAR_H */ -/* Line 189 of yacc.c */ -#line 323 "y.tab.c" +/* Line 268 of yacc.c */ +#line 321 "y.tab.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -370,90 +368,93 @@ pfaction_to_num(const char *action) IGRP = 279, PIM = 280, VRRP = 281, - ATALK = 282, - AARP = 283, - DECNET = 284, - LAT = 285, - SCA = 286, - MOPRC = 287, - MOPDL = 288, - TK_BROADCAST = 289, - TK_MULTICAST = 290, - NUM = 291, - INBOUND = 292, - OUTBOUND = 293, - PF_IFNAME = 294, - PF_RSET = 295, - PF_RNR = 296, - PF_SRNR = 297, - PF_REASON = 298, - PF_ACTION = 299, - TYPE = 300, - SUBTYPE = 301, - DIR = 302, - ADDR1 = 303, - ADDR2 = 304, - ADDR3 = 305, - ADDR4 = 306, - LINK = 307, - GEQ = 308, - LEQ = 309, - NEQ = 310, - ID = 311, - EID = 312, - HID = 313, - HID6 = 314, - AID = 315, - LSH = 316, - RSH = 317, - LEN = 318, - IPV6 = 319, - ICMPV6 = 320, - AH = 321, - ESP = 322, - VLAN = 323, - MPLS = 324, - PPPOED = 325, - PPPOES = 326, - ISO = 327, - ESIS = 328, - CLNP = 329, - ISIS = 330, - L1 = 331, - L2 = 332, - IIH = 333, - LSP = 334, - SNP = 335, - CSNP = 336, - PSNP = 337, - STP = 338, - IPX = 339, - NETBEUI = 340, - LANE = 341, - LLC = 342, - METAC = 343, - BCC = 344, - SC = 345, - ILMIC = 346, - OAMF4EC = 347, - OAMF4SC = 348, - OAM = 349, - OAMF4 = 350, - CONNECTMSG = 351, - METACONNECT = 352, - VPI = 353, - VCI = 354, - RADIO = 355, - FISU = 356, - LSSU = 357, - MSU = 358, - SIO = 359, - OPC = 360, - DPC = 361, - SLS = 362, - AND = 363, - OR = 364, - UMINUS = 365 + CARP = 282, + ATALK = 283, + AARP = 284, + DECNET = 285, + LAT = 286, + SCA = 287, + MOPRC = 288, + MOPDL = 289, + TK_BROADCAST = 290, + TK_MULTICAST = 291, + NUM = 292, + INBOUND = 293, + OUTBOUND = 294, + PF_IFNAME = 295, + PF_RSET = 296, + PF_RNR = 297, + PF_SRNR = 298, + PF_REASON = 299, + PF_ACTION = 300, + TYPE = 301, + SUBTYPE = 302, + DIR = 303, + ADDR1 = 304, + ADDR2 = 305, + ADDR3 = 306, + ADDR4 = 307, + RA = 308, + TA = 309, + LINK = 310, + GEQ = 311, + LEQ = 312, + NEQ = 313, + ID = 314, + EID = 315, + HID = 316, + HID6 = 317, + AID = 318, + LSH = 319, + RSH = 320, + LEN = 321, + IPV6 = 322, + ICMPV6 = 323, + AH = 324, + ESP = 325, + VLAN = 326, + MPLS = 327, + PPPOED = 328, + PPPOES = 329, + ISO = 330, + ESIS = 331, + CLNP = 332, + ISIS = 333, + L1 = 334, + L2 = 335, + IIH = 336, + LSP = 337, + SNP = 338, + CSNP = 339, + PSNP = 340, + STP = 341, + IPX = 342, + NETBEUI = 343, + LANE = 344, + LLC = 345, + METAC = 346, + BCC = 347, + SC = 348, + ILMIC = 349, + OAMF4EC = 350, + OAMF4SC = 351, + OAM = 352, + OAMF4 = 353, + CONNECTMSG = 354, + METACONNECT = 355, + VPI = 356, + VCI = 357, + RADIO = 358, + FISU = 359, + LSSU = 360, + MSU = 361, + SIO = 362, + OPC = 363, + DPC = 364, + SLS = 365, + AND = 366, + OR = 367, + UMINUS = 368 }; #endif /* Tokens. */ @@ -481,90 +482,93 @@ pfaction_to_num(const char *action) #define IGRP 279 #define PIM 280 #define VRRP 281 -#define ATALK 282 -#define AARP 283 -#define DECNET 284 -#define LAT 285 -#define SCA 286 -#define MOPRC 287 -#define MOPDL 288 -#define TK_BROADCAST 289 -#define TK_MULTICAST 290 -#define NUM 291 -#define INBOUND 292 -#define OUTBOUND 293 -#define PF_IFNAME 294 -#define PF_RSET 295 -#define PF_RNR 296 -#define PF_SRNR 297 -#define PF_REASON 298 -#define PF_ACTION 299 -#define TYPE 300 -#define SUBTYPE 301 -#define DIR 302 -#define ADDR1 303 -#define ADDR2 304 -#define ADDR3 305 -#define ADDR4 306 -#define LINK 307 -#define GEQ 308 -#define LEQ 309 -#define NEQ 310 -#define ID 311 -#define EID 312 -#define HID 313 -#define HID6 314 -#define AID 315 -#define LSH 316 -#define RSH 317 -#define LEN 318 -#define IPV6 319 -#define ICMPV6 320 -#define AH 321 -#define ESP 322 -#define VLAN 323 -#define MPLS 324 -#define PPPOED 325 -#define PPPOES 326 -#define ISO 327 -#define ESIS 328 -#define CLNP 329 -#define ISIS 330 -#define L1 331 -#define L2 332 -#define IIH 333 -#define LSP 334 -#define SNP 335 -#define CSNP 336 -#define PSNP 337 -#define STP 338 -#define IPX 339 -#define NETBEUI 340 -#define LANE 341 -#define LLC 342 -#define METAC 343 -#define BCC 344 -#define SC 345 -#define ILMIC 346 -#define OAMF4EC 347 -#define OAMF4SC 348 -#define OAM 349 -#define OAMF4 350 -#define CONNECTMSG 351 -#define METACONNECT 352 -#define VPI 353 -#define VCI 354 -#define RADIO 355 -#define FISU 356 -#define LSSU 357 -#define MSU 358 -#define SIO 359 -#define OPC 360 -#define DPC 361 -#define SLS 362 -#define AND 363 -#define OR 364 -#define UMINUS 365 +#define CARP 282 +#define ATALK 283 +#define AARP 284 +#define DECNET 285 +#define LAT 286 +#define SCA 287 +#define MOPRC 288 +#define MOPDL 289 +#define TK_BROADCAST 290 +#define TK_MULTICAST 291 +#define NUM 292 +#define INBOUND 293 +#define OUTBOUND 294 +#define PF_IFNAME 295 +#define PF_RSET 296 +#define PF_RNR 297 +#define PF_SRNR 298 +#define PF_REASON 299 +#define PF_ACTION 300 +#define TYPE 301 +#define SUBTYPE 302 +#define DIR 303 +#define ADDR1 304 +#define ADDR2 305 +#define ADDR3 306 +#define ADDR4 307 +#define RA 308 +#define TA 309 +#define LINK 310 +#define GEQ 311 +#define LEQ 312 +#define NEQ 313 +#define ID 314 +#define EID 315 +#define HID 316 +#define HID6 317 +#define AID 318 +#define LSH 319 +#define RSH 320 +#define LEN 321 +#define IPV6 322 +#define ICMPV6 323 +#define AH 324 +#define ESP 325 +#define VLAN 326 +#define MPLS 327 +#define PPPOED 328 +#define PPPOES 329 +#define 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 SIO 362 +#define OPC 363 +#define DPC 364 +#define SLS 365 +#define AND 366 +#define OR 367 +#define UMINUS 368 @@ -573,7 +577,7 @@ pfaction_to_num(const char *action) typedef union YYSTYPE { -/* Line 214 of yacc.c */ +/* Line 293 of yacc.c */ #line 242 "grammar.y" int i; @@ -592,8 +596,8 @@ typedef union YYSTYPE -/* Line 214 of yacc.c */ -#line 597 "y.tab.c" +/* Line 293 of yacc.c */ +#line 601 "y.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -604,8 +608,8 @@ typedef union YYSTYPE /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 609 "y.tab.c" +/* Line 343 of yacc.c */ +#line 613 "y.tab.c" #ifdef short # undef short @@ -655,7 +659,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -708,11 +712,11 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -735,24 +739,24 @@ YYID (yyi) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -781,23 +785,7 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of @@ -817,23 +805,43 @@ union yyalloc #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 669 +#define YYLAST 700 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 126 +#define YYNTOKENS 129 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 46 /* YYNRULES -- Number of rules. */ -#define YYNRULES 202 +#define YYNRULES 205 /* YYNRULES -- Number of states. */ -#define YYNSTATES 274 +#define YYNSTATES 277 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 365 +#define YYMAXUTOK 368 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -844,16 +852,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, 110, 2, 2, 2, 2, 112, 2, - 119, 118, 115, 113, 2, 114, 2, 116, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 125, 2, - 122, 121, 120, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 113, 2, 2, 2, 2, 115, 2, + 122, 121, 118, 116, 2, 117, 2, 119, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 128, 2, + 125, 124, 123, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 123, 2, 124, 2, 2, 2, 2, 2, 2, + 2, 126, 2, 127, 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, 111, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 114, 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, @@ -877,7 +885,7 @@ static const yytype_uint8 yytranslate[] = 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, 117 + 105, 106, 107, 108, 109, 110, 111, 112, 120 }; #if YYDEBUG @@ -895,74 +903,74 @@ static const yytype_uint16 yyprhs[] = 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, - 244, 246, 248, 250, 252, 254, 257, 260, 263, 266, - 271, 273, 275, 278, 280, 283, 285, 287, 289, 291, - 294, 297, 300, 303, 306, 309, 312, 317, 320, 323, - 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, - 346, 348, 350, 352, 354, 356, 358, 360, 362, 367, - 374, 378, 382, 386, 390, 394, 398, 402, 406, 409, - 413, 415, 417, 419, 421, 423, 425, 427, 431, 433, - 435, 437, 439, 441, 443, 445, 447, 449, 451, 453, - 455, 457, 459, 461, 464, 467, 471, 473, 475, 479, - 481, 483, 485, 487, 489, 491, 493, 495, 498, 501, - 505, 507, 509 + 244, 246, 248, 250, 252, 254, 256, 258, 260, 263, + 266, 269, 272, 277, 279, 281, 284, 286, 289, 291, + 293, 295, 297, 300, 303, 306, 309, 312, 315, 318, + 323, 326, 329, 332, 334, 336, 338, 340, 342, 344, + 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, + 366, 368, 373, 380, 384, 388, 392, 396, 400, 404, + 408, 412, 415, 419, 421, 423, 425, 427, 429, 431, + 433, 437, 439, 441, 443, 445, 447, 449, 451, 453, + 455, 457, 459, 461, 463, 465, 467, 470, 473, 477, + 479, 481, 485, 487, 489, 491, 493, 495, 497, 499, + 501, 504, 507, 511, 513, 515 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 127, 0, -1, 128, 129, -1, 128, -1, -1, 138, - -1, 129, 130, 138, -1, 129, 130, 132, -1, 129, - 131, 138, -1, 129, 131, 132, -1, 108, -1, 109, - -1, 133, -1, 160, -1, 135, 136, 118, -1, 56, - -1, 58, 116, 36, -1, 58, 8, 58, -1, 58, - -1, 59, 116, 36, -1, 59, -1, 57, -1, 60, - -1, 134, 132, -1, 110, -1, 119, -1, 133, -1, - 137, 130, 132, -1, 137, 131, 132, -1, 160, -1, - 136, -1, 140, -1, 134, 138, -1, 141, 142, 143, - -1, 141, 142, -1, 141, 143, -1, 141, 13, -1, - 141, 14, -1, 141, 144, -1, 139, 132, -1, 135, - 129, 118, -1, 145, -1, 157, 155, 157, -1, 157, - 156, 157, -1, 146, -1, 161, -1, 162, -1, 163, - 164, -1, 167, -1, 168, 169, -1, 145, -1, -1, - 4, -1, 3, -1, 4, 109, 3, -1, 3, 109, - 4, -1, 4, 108, 3, -1, 3, 108, 4, -1, - 48, -1, 49, -1, 50, -1, 51, -1, 5, -1, - 7, -1, 9, -1, 10, -1, 6, -1, 52, -1, - 18, -1, 16, -1, 17, -1, 19, -1, 20, -1, - 21, -1, 22, -1, 23, -1, 24, -1, 25, -1, - 26, -1, 27, -1, 28, -1, 29, -1, 30, -1, - 31, -1, 33, -1, 32, -1, 64, -1, 65, -1, - 66, -1, 67, -1, 72, -1, 73, -1, 75, -1, - 76, -1, 77, -1, 78, -1, 79, -1, 80, -1, - 82, -1, 81, -1, 74, -1, 83, -1, 84, -1, - 85, -1, 100, -1, 141, 34, -1, 141, 35, -1, - 11, 36, -1, 12, 36, -1, 15, 36, 159, 36, - -1, 37, -1, 38, -1, 68, 160, -1, 68, -1, - 69, 160, -1, 69, -1, 70, -1, 71, -1, 147, - -1, 141, 148, -1, 39, 56, -1, 40, 56, -1, - 41, 36, -1, 42, 36, -1, 43, 153, -1, 44, - 154, -1, 45, 149, 46, 150, -1, 45, 149, -1, - 46, 151, -1, 47, 152, -1, 36, -1, 56, -1, - 36, -1, 56, -1, 56, -1, 36, -1, 56, -1, - 36, -1, 56, -1, 56, -1, 120, -1, 53, -1, - 121, -1, 54, -1, 122, -1, 55, -1, 160, -1, - 158, -1, 145, 123, 157, 124, -1, 145, 123, 157, - 125, 36, 124, -1, 157, 113, 157, -1, 157, 114, - 157, -1, 157, 115, 157, -1, 157, 116, 157, -1, - 157, 112, 157, -1, 157, 111, 157, -1, 157, 61, - 157, -1, 157, 62, 157, -1, 114, 157, -1, 135, - 158, 118, -1, 63, -1, 112, -1, 111, -1, 122, - -1, 120, -1, 121, -1, 36, -1, 135, 160, 118, - -1, 86, -1, 87, -1, 88, -1, 89, -1, 92, - -1, 93, -1, 90, -1, 91, -1, 94, -1, 95, - -1, 96, -1, 97, -1, 98, -1, 99, -1, 165, - -1, 155, 36, -1, 156, 36, -1, 135, 166, 118, - -1, 36, -1, 165, -1, 166, 131, 165, -1, 101, - -1, 102, -1, 103, -1, 104, -1, 105, -1, 106, - -1, 107, -1, 170, -1, 155, 36, -1, 156, 36, - -1, 135, 171, 118, -1, 36, -1, 170, -1, 171, - 131, 170, -1 + 130, 0, -1, 131, 132, -1, 131, -1, -1, 141, + -1, 132, 133, 141, -1, 132, 133, 135, -1, 132, + 134, 141, -1, 132, 134, 135, -1, 111, -1, 112, + -1, 136, -1, 163, -1, 138, 139, 121, -1, 59, + -1, 61, 119, 37, -1, 61, 8, 61, -1, 61, + -1, 62, 119, 37, -1, 62, -1, 60, -1, 63, + -1, 137, 135, -1, 113, -1, 122, -1, 136, -1, + 140, 133, 135, -1, 140, 134, 135, -1, 163, -1, + 139, -1, 143, -1, 137, 141, -1, 144, 145, 146, + -1, 144, 145, -1, 144, 146, -1, 144, 13, -1, + 144, 14, -1, 144, 147, -1, 142, 135, -1, 138, + 132, 121, -1, 148, -1, 160, 158, 160, -1, 160, + 159, 160, -1, 149, -1, 164, -1, 165, -1, 166, + 167, -1, 170, -1, 171, 172, -1, 148, -1, -1, + 4, -1, 3, -1, 4, 112, 3, -1, 3, 112, + 4, -1, 4, 111, 3, -1, 3, 111, 4, -1, + 49, -1, 50, -1, 51, -1, 52, -1, 53, -1, + 54, -1, 5, -1, 7, -1, 9, -1, 10, -1, + 6, -1, 55, -1, 18, -1, 16, -1, 17, -1, + 19, -1, 20, -1, 21, -1, 22, -1, 23, -1, + 24, -1, 25, -1, 26, -1, 27, -1, 28, -1, + 29, -1, 30, -1, 31, -1, 32, -1, 34, -1, + 33, -1, 67, -1, 68, -1, 69, -1, 70, -1, + 75, -1, 76, -1, 78, -1, 79, -1, 80, -1, + 81, -1, 82, -1, 83, -1, 85, -1, 84, -1, + 77, -1, 86, -1, 87, -1, 88, -1, 103, -1, + 144, 35, -1, 144, 36, -1, 11, 37, -1, 12, + 37, -1, 15, 37, 162, 37, -1, 38, -1, 39, + -1, 71, 163, -1, 71, -1, 72, 163, -1, 72, + -1, 73, -1, 74, -1, 150, -1, 144, 151, -1, + 40, 59, -1, 41, 59, -1, 42, 37, -1, 43, + 37, -1, 44, 156, -1, 45, 157, -1, 46, 152, + 47, 153, -1, 46, 152, -1, 47, 154, -1, 48, + 155, -1, 37, -1, 59, -1, 37, -1, 59, -1, + 59, -1, 37, -1, 59, -1, 37, -1, 59, -1, + 59, -1, 123, -1, 56, -1, 124, -1, 57, -1, + 125, -1, 58, -1, 163, -1, 161, -1, 148, 126, + 160, 127, -1, 148, 126, 160, 128, 37, 127, -1, + 160, 116, 160, -1, 160, 117, 160, -1, 160, 118, + 160, -1, 160, 119, 160, -1, 160, 115, 160, -1, + 160, 114, 160, -1, 160, 64, 160, -1, 160, 65, + 160, -1, 117, 160, -1, 138, 161, 121, -1, 66, + -1, 115, -1, 114, -1, 125, -1, 123, -1, 124, + -1, 37, -1, 138, 163, 121, -1, 89, -1, 90, + -1, 91, -1, 92, -1, 95, -1, 96, -1, 93, + -1, 94, -1, 97, -1, 98, -1, 99, -1, 100, + -1, 101, -1, 102, -1, 168, -1, 158, 37, -1, + 159, 37, -1, 138, 169, 121, -1, 37, -1, 168, + -1, 169, 134, 168, -1, 104, -1, 105, -1, 106, + -1, 107, -1, 108, -1, 109, -1, 110, -1, 173, + -1, 158, 37, -1, 159, 37, -1, 138, 174, 121, + -1, 37, -1, 173, -1, 174, 134, 173, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -974,21 +982,21 @@ static const yytype_uint16 yyrline[] = 404, 406, 407, 409, 410, 411, 412, 413, 414, 416, 417, 418, 419, 421, 423, 424, 425, 426, 427, 428, 431, 432, 435, 436, 437, 438, 439, 440, 441, 442, - 443, 444, 447, 448, 449, 450, 453, 455, 456, 457, + 443, 444, 445, 446, 449, 450, 451, 452, 455, 457, 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, 494, 495, 496, 497, 498, + 488, 489, 490, 491, 492, 493, 494, 495, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, - 511, 512, 513, 514, 515, 516, 519, 524, 527, 531, - 534, 535, 541, 542, 562, 578, 579, 592, 593, 596, - 599, 600, 601, 603, 604, 605, 607, 608, 610, 611, - 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, - 622, 624, 625, 626, 627, 628, 630, 631, 633, 634, - 635, 636, 637, 638, 639, 640, 642, 643, 644, 645, - 648, 649, 651, 652, 653, 654, 656, 663, 664, 667, - 668, 669, 672, 673, 674, 675, 677, 678, 679, 680, - 682, 691, 692 + 509, 510, 511, 514, 515, 516, 517, 518, 519, 522, + 527, 530, 534, 537, 538, 544, 545, 565, 581, 582, + 595, 596, 599, 602, 603, 604, 606, 607, 608, 610, + 611, 613, 614, 615, 616, 617, 618, 619, 620, 621, + 622, 623, 624, 625, 627, 628, 629, 630, 631, 633, + 634, 636, 637, 638, 639, 640, 641, 642, 643, 645, + 646, 647, 648, 651, 652, 654, 655, 656, 657, 659, + 666, 667, 670, 671, 672, 675, 676, 677, 678, 680, + 681, 682, 683, 685, 694, 695 }; #endif @@ -1000,25 +1008,25 @@ static const char *const yytname[] = "$end", "error", "$undefined", "DST", "SRC", "HOST", "GATEWAY", "NET", "NETMASK", "PORT", "PORTRANGE", "LESS", "GREATER", "PROTO", "PROTOCHAIN", "CBYTE", "ARP", "RARP", "IP", "SCTP", "TCP", "UDP", "ICMP", "IGMP", - "IGRP", "PIM", "VRRP", "ATALK", "AARP", "DECNET", "LAT", "SCA", "MOPRC", - "MOPDL", "TK_BROADCAST", "TK_MULTICAST", "NUM", "INBOUND", "OUTBOUND", - "PF_IFNAME", "PF_RSET", "PF_RNR", "PF_SRNR", "PF_REASON", "PF_ACTION", - "TYPE", "SUBTYPE", "DIR", "ADDR1", "ADDR2", "ADDR3", "ADDR4", "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", "SIO", - "OPC", "DPC", "SLS", "AND", "OR", "'!'", "'|'", "'&'", "'+'", "'-'", - "'*'", "'/'", "UMINUS", "')'", "'('", "'>'", "'='", "'<'", "'['", "']'", - "':'", "$accept", "prog", "null", "expr", "and", "or", "id", "nid", - "not", "paren", "pid", "qid", "term", "head", "rterm", "pqual", "dqual", - "aqual", "ndaqual", "pname", "other", "pfvar", "p80211", "type", - "subtype", "type_subtype", "dir", "reason", "action", "relop", "irelop", - "arth", "narth", "byteop", "pnum", "atmtype", "atmmultitype", "atmfield", - "atmvalue", "atmfieldvalue", "atmlistvalue", "mtp2type", "mtp3field", - "mtp3value", "mtp3fieldvalue", "mtp3listvalue", 0 + "IGRP", "PIM", "VRRP", "CARP", "ATALK", "AARP", "DECNET", "LAT", "SCA", + "MOPRC", "MOPDL", "TK_BROADCAST", "TK_MULTICAST", "NUM", "INBOUND", + "OUTBOUND", "PF_IFNAME", "PF_RSET", "PF_RNR", "PF_SRNR", "PF_REASON", + "PF_ACTION", "TYPE", "SUBTYPE", "DIR", "ADDR1", "ADDR2", "ADDR3", + "ADDR4", "RA", "TA", "LINK", "GEQ", "LEQ", "NEQ", "ID", "EID", "HID", + "HID6", "AID", "LSH", "RSH", "LEN", "IPV6", "ICMPV6", "AH", "ESP", + "VLAN", "MPLS", "PPPOED", "PPPOES", "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", "SIO", "OPC", "DPC", "SLS", "AND", "OR", "'!'", + "'|'", "'&'", "'+'", "'-'", "'*'", "'/'", "UMINUS", "')'", "'('", "'>'", + "'='", "'<'", "'['", "']'", "':'", "$accept", "prog", "null", "expr", + "and", "or", "id", "nid", "not", "paren", "pid", "qid", "term", "head", + "rterm", "pqual", "dqual", "aqual", "ndaqual", "pname", "other", "pfvar", + "p80211", "type", "subtype", "type_subtype", "dir", "reason", "action", + "relop", "irelop", "arth", "narth", "byteop", "pnum", "atmtype", + "atmmultitype", "atmfield", "atmvalue", "atmfieldvalue", "atmlistvalue", + "mtp2type", "mtp3field", "mtp3value", "mtp3fieldvalue", "mtp3listvalue", 0 }; #endif @@ -1038,35 +1046,35 @@ static const yytype_uint16 yytoknum[] = 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 33, 124, 38, 43, 45, 42, 47, 365, 41, 40, - 62, 61, 60, 91, 93, 58 + 365, 366, 367, 33, 124, 38, 43, 45, 42, 47, + 368, 41, 40, 62, 61, 60, 91, 93, 58 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 126, 127, 127, 128, 129, 129, 129, 129, 129, - 130, 131, 132, 132, 132, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 134, 135, 136, 136, 136, 137, - 137, 138, 138, 139, 139, 139, 139, 139, 139, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 141, 141, 142, 142, 142, 142, 142, 142, 142, 142, - 142, 142, 143, 143, 143, 143, 144, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, - 149, 149, 150, 150, 151, 152, 152, 153, 153, 154, - 155, 155, 155, 156, 156, 156, 157, 157, 158, 158, - 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, - 158, 159, 159, 159, 159, 159, 160, 160, 161, 161, - 161, 161, 161, 161, 161, 161, 162, 162, 162, 162, - 163, 163, 164, 164, 164, 164, 165, 166, 166, 167, - 167, 167, 168, 168, 168, 168, 169, 169, 169, 169, - 170, 171, 171 + 0, 129, 130, 130, 131, 132, 132, 132, 132, 132, + 133, 134, 135, 135, 135, 136, 136, 136, 136, 136, + 136, 136, 136, 136, 137, 138, 139, 139, 139, 140, + 140, 141, 141, 142, 142, 142, 142, 142, 142, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 144, 144, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 146, 146, 146, 146, 147, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 150, 150, 150, 150, 150, 150, 151, + 151, 151, 151, 152, 152, 153, 153, 154, 155, 155, + 156, 156, 157, 158, 158, 158, 159, 159, 159, 160, + 160, 161, 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 162, 162, 162, 162, 162, 163, + 163, 164, 164, 164, 164, 164, 164, 164, 164, 165, + 165, 165, 165, 166, 166, 167, 167, 167, 167, 168, + 169, 169, 170, 170, 170, 171, 171, 171, 171, 172, + 172, 172, 172, 173, 174, 174 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1082,288 +1090,301 @@ static const yytype_uint8 yyr2[] = 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, 2, 2, 2, 2, 4, - 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, - 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 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, 2, 2, + 2, 2, 4, 1, 1, 2, 1, 2, 1, 1, + 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, + 2, 2, 2, 1, 1, 1, 1, 1, 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, 2, 2, 3, - 1, 1, 3 + 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, + 2, 2, 3, 1, 1, 3 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { - 4, 0, 51, 1, 0, 0, 0, 69, 70, 68, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 85, 84, 166, 110, 111, 0, 0, - 0, 0, 0, 0, 67, 160, 86, 87, 88, 89, - 113, 115, 116, 117, 90, 91, 100, 92, 93, 94, - 95, 96, 97, 99, 98, 101, 102, 103, 168, 169, - 170, 171, 174, 175, 172, 173, 176, 177, 178, 179, - 180, 181, 104, 189, 190, 191, 192, 193, 194, 195, - 24, 0, 25, 2, 51, 51, 5, 0, 31, 0, - 50, 44, 118, 0, 147, 146, 45, 46, 0, 48, - 0, 107, 108, 0, 120, 121, 122, 123, 137, 138, - 124, 139, 125, 0, 112, 114, 0, 0, 158, 10, - 11, 51, 51, 32, 0, 147, 146, 15, 21, 18, - 20, 22, 39, 12, 0, 0, 13, 53, 52, 62, - 66, 63, 64, 65, 36, 37, 105, 106, 0, 0, - 0, 58, 59, 60, 61, 34, 35, 38, 119, 0, - 141, 143, 145, 0, 0, 0, 0, 0, 0, 0, - 0, 140, 142, 144, 0, 0, 186, 0, 0, 0, - 47, 182, 200, 0, 0, 0, 49, 196, 162, 161, - 164, 165, 163, 0, 0, 0, 7, 51, 51, 6, - 146, 9, 8, 40, 159, 167, 0, 0, 0, 23, - 26, 30, 0, 29, 0, 0, 0, 0, 130, 131, - 127, 134, 128, 135, 136, 129, 33, 0, 156, 157, - 155, 154, 150, 151, 152, 153, 42, 43, 187, 0, - 183, 184, 201, 0, 197, 198, 109, 146, 17, 16, - 19, 14, 0, 0, 57, 55, 56, 54, 0, 148, - 0, 185, 0, 199, 0, 27, 28, 132, 133, 126, - 0, 188, 202, 149 + 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, 169, 113, 114, 0, + 0, 0, 0, 0, 0, 69, 163, 89, 90, 91, + 92, 116, 118, 119, 120, 93, 94, 103, 95, 96, + 97, 98, 99, 100, 102, 101, 104, 105, 106, 171, + 172, 173, 174, 177, 178, 175, 176, 179, 180, 181, + 182, 183, 184, 107, 192, 193, 194, 195, 196, 197, + 198, 24, 0, 25, 2, 51, 51, 5, 0, 31, + 0, 50, 44, 121, 0, 150, 149, 45, 46, 0, + 48, 0, 110, 111, 0, 123, 124, 125, 126, 140, + 141, 127, 142, 128, 0, 115, 117, 0, 0, 161, + 10, 11, 51, 51, 32, 0, 150, 149, 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, 122, 0, 144, 146, 148, 0, 0, 0, 0, + 0, 0, 0, 0, 143, 145, 147, 0, 0, 189, + 0, 0, 0, 47, 185, 203, 0, 0, 0, 49, + 199, 165, 164, 167, 168, 166, 0, 0, 0, 7, + 51, 51, 6, 149, 9, 8, 40, 162, 170, 0, + 0, 0, 23, 26, 30, 0, 29, 0, 0, 0, + 0, 133, 134, 130, 137, 131, 138, 139, 132, 33, + 0, 159, 160, 158, 157, 153, 154, 155, 156, 42, + 43, 190, 0, 186, 187, 204, 0, 200, 201, 112, + 149, 17, 16, 19, 14, 0, 0, 57, 55, 56, + 54, 0, 151, 0, 188, 0, 202, 0, 27, 28, + 135, 136, 129, 0, 191, 205, 152 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 1, 2, 124, 121, 122, 209, 133, 134, 116, - 211, 212, 86, 87, 88, 89, 155, 156, 157, 117, - 91, 92, 158, 220, 269, 222, 225, 110, 112, 174, - 175, 93, 94, 193, 95, 96, 97, 98, 180, 181, - 239, 99, 100, 186, 187, 243 + -1, 1, 2, 125, 122, 123, 212, 134, 135, 117, + 214, 215, 87, 88, 89, 90, 158, 159, 160, 118, + 92, 93, 161, 223, 272, 225, 228, 111, 113, 177, + 178, 94, 95, 196, 96, 97, 98, 99, 183, 184, + 242, 100, 101, 189, 190, 246 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -198 +#define YYPACT_NINF -193 static const yytype_int16 yypact[] = { - -198, 19, 216, -198, 1, 40, 61, -198, -198, -198, - -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, - -198, -198, -198, -198, -198, -198, -198, -198, -27, 54, - 81, 82, -13, 58, -198, -198, -198, -198, -198, -198, - -24, -24, -198, -198, -198, -198, -198, -198, -198, -198, - -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, - -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, - -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, - -198, 530, -198, -54, 426, 426, -198, 151, -198, 618, - 13, -198, -198, 525, -198, -198, -198, -198, 52, -198, - 102, -198, -198, -90, -198, -198, -198, -198, -198, -198, - -198, -198, -198, -24, -198, -198, 530, -89, -198, -198, - -198, 321, 321, -198, -60, 12, 17, -198, -198, -4, - 33, -198, -198, -198, 151, 151, -198, -29, -6, -198, - -198, -198, -198, -198, -198, -198, -198, -198, -12, 67, - -11, -198, -198, -198, -198, 170, -198, -198, -198, 530, - -198, -198, -198, 530, 530, 530, 530, 530, 530, 530, - 530, -198, -198, -198, 530, 530, -198, 114, 115, 118, - -198, -198, -198, 122, 123, 128, -198, -198, -198, -198, - -198, -198, -198, 129, 17, -44, -198, 321, 321, -198, - 16, -198, -198, -198, -198, -198, 110, 133, 134, -198, - -198, 60, -54, 17, 172, 181, 183, 185, -198, -198, - 143, -198, -198, -198, -198, -198, -198, -51, 68, 68, - 78, 99, -7, -7, -198, -198, -44, -44, -198, -34, - -198, -198, -198, -5, -198, -198, -198, -52, -198, -198, - -198, -198, 151, 151, -198, -198, -198, -198, -9, -198, - 161, -198, 114, -198, 122, -198, -198, -198, -198, -198, - 74, -198, -198, -198 + -193, 25, 218, -193, -6, 15, 44, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, 18, + 37, 74, 76, -22, 59, -193, -193, -193, -193, -193, + -193, -20, -20, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, 541, -193, -55, 434, 434, -193, -15, -193, + 646, 11, -193, -193, 523, -193, -193, -193, -193, 48, + -193, 52, -193, -193, -95, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -20, -193, -193, 541, -1, -193, + -193, -193, 326, 326, -193, -53, 17, 28, -193, -193, + -3, 34, -193, -193, -193, -15, -15, -193, -39, 36, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -21, + 77, -16, -193, -193, -193, -193, -193, -193, 147, -193, + -193, -193, 541, -193, -193, -193, 541, 541, 541, 541, + 541, 541, 541, 541, -193, -193, -193, 541, 541, -193, + 118, 125, 126, -193, -193, -193, 127, 130, 149, -193, + -193, -193, -193, -193, -193, -193, 150, 28, 96, -193, + 326, 326, -193, 3, -193, -193, -193, -193, -193, 128, + 151, 153, -193, -193, 70, -55, 28, 188, 189, 191, + 192, -193, -193, 154, -193, -193, -193, -193, -193, -193, + -52, 66, 66, 152, 62, 40, 40, -193, -193, 96, + 96, -193, -43, -193, -193, -193, -41, -193, -193, -193, + -51, -193, -193, -193, -193, -15, -15, -193, -193, -193, + -193, -10, -193, 159, -193, 118, -193, 127, -193, -193, + -193, -193, -193, 73, -193, -193, -193 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -198, -198, -198, 197, 8, -197, -86, -121, 5, -2, - -198, -198, -81, -198, -198, -198, -198, 45, -198, 7, - -198, -198, -198, -198, -198, -198, -198, -198, -198, -72, - -47, -22, -83, -198, -35, -198, -198, -198, -198, -169, - -198, -198, -198, -198, -163, -198 + -193, -193, -193, 195, -13, -192, -87, -127, 6, -2, + -193, -193, -81, -193, -193, -193, -193, 45, -193, 8, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -75, + -67, -27, -84, -193, -35, -193, -193, -193, -193, -162, + -193, -193, -193, -193, -172, -193 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ + number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -42 static const yytype_int16 yytable[] = { - 85, 132, 125, 123, 206, 114, 115, 84, 238, 90, - 163, 164, 25, -41, 210, 253, -13, 163, 164, 3, - 242, 188, 189, 108, 218, 223, 178, 267, 184, 104, - 190, 191, 192, 125, 159, 196, 201, 101, 113, 113, - 199, 202, 262, 109, 219, 224, 264, 268, 119, 120, - 126, 179, 136, 185, 119, 120, -29, -29, 203, 118, - 165, 166, 167, 168, 169, 170, 205, 165, 166, 167, - 168, 169, 170, 259, 260, 120, 102, 210, 194, 214, - 215, 126, 85, 85, 261, 135, 200, 200, 176, 84, - 84, 90, 90, 271, 195, 82, 177, 103, 183, 136, - 213, 272, 216, 217, 120, 160, 161, 162, 169, 170, - 105, 113, 207, 263, 111, 125, 123, 106, 107, 198, - 198, -41, -41, 221, -13, -13, 197, 197, 90, 90, - 204, -41, 135, 113, -13, 205, 159, 227, 182, 163, - 164, 228, 229, 230, 231, 232, 233, 234, 235, 208, - 176, 240, 236, 237, 241, 160, 161, 162, 182, 244, - 163, 164, 200, 247, 245, 246, 265, 266, 248, 249, - 250, 82, 171, 172, 173, 139, 254, 141, 251, 142, - 143, 167, 168, 169, 170, 255, 256, 25, 257, 258, - 166, 167, 168, 169, 170, 198, 85, 270, 273, 83, - 226, 0, 197, 197, 90, 90, 0, 127, 128, 129, - 130, 131, 167, 168, 169, 170, -3, 136, 136, 0, - 252, 82, 171, 172, 173, 0, 0, 4, 5, 0, - 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 135, 135, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 80, 0, 0, 0, 0, 0, 0, 34, 0, - 82, 0, 0, 0, 0, 0, 0, 0, 0, 35, - 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, 0, 0, 80, 0, 0, 0, - 81, 0, 4, 5, 0, 82, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 0, 0, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 0, 0, 0, 0, - 0, 0, 0, 34, 0, 0, 0, 127, 128, 129, - 130, 131, 0, 0, 35, 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, 0, - 0, 80, 0, 0, 0, 81, 0, 4, 5, 0, - 82, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 86, 133, 126, -13, 124, 209, 115, 116, 85, 213, + 91, -41, 166, 167, 245, 109, 221, 26, 241, 191, + 192, 226, 26, 256, 181, 3, 187, 270, 193, 194, + 195, 102, 182, 126, 188, 199, 204, 110, 222, 114, + 114, 202, 205, 227, 128, 129, 130, 131, 132, 271, + 265, 127, 103, 137, 267, 119, 120, 121, 120, 121, + -29, -29, 168, 169, 170, 171, 172, 173, 206, 121, + 208, 121, 217, 218, 213, 262, 263, 105, 264, 197, + 266, 104, 127, 86, 86, 179, 136, 203, 203, 185, + 198, 85, 85, 91, 91, 275, 106, 180, 81, 186, + 137, 216, 83, 274, 163, 164, 165, 83, 163, 164, + 165, 107, 114, 108, -13, -13, 210, 126, 112, 124, + 201, 201, -41, -41, -13, 162, 166, 167, 200, 200, + 91, 91, -41, 136, 114, 230, 224, 162, 207, 231, + 232, 233, 234, 235, 236, 237, 238, 219, 220, 208, + 239, 240, 140, 211, 142, 179, 143, 144, 172, 173, + 166, 167, 243, 244, 185, 203, 250, 247, 268, 269, + 83, 174, 175, 176, 83, 174, 175, 176, 170, 171, + 172, 173, 170, 171, 172, 173, 248, 249, 252, 251, + 253, 254, 257, 258, 259, 260, 273, 84, 201, 86, + 276, 261, 255, 229, 0, 0, 200, 200, 91, 91, + 168, 169, 170, 171, 172, 173, 166, 167, -3, 0, + 137, 137, 0, 0, 0, 0, 0, 0, 0, 4, + 5, 0, 0, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 136, 136, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 0, 0, 0, 169, 170, 171, + 172, 173, 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, 0, + 0, 81, 0, 0, 0, 82, 0, 4, 5, 0, + 83, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 0, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 0, 0, 0, 0, 0, 0, 0, 34, 0, + 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, 128, 129, 130, 131, 132, + 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, 0, 0, 81, + 0, 0, 0, 82, 0, 4, 5, 0, 83, 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, 0, 0, 80, 0, 0, 0, - 81, 0, 0, 0, 0, 82, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 0, 0, 25, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 160, 161, - 162, 0, 34, 0, 0, 0, 163, 164, 0, 0, - 0, 0, 0, 35, 36, 37, 38, 39, 0, 0, - 0, 0, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 0, 0, 0, 0, - 0, 137, 138, 139, 140, 141, 0, 142, 143, 0, - 72, 144, 145, 0, 0, 0, 165, 166, 167, 168, - 169, 170, 0, 0, 81, 171, 172, 173, 0, 82, - 0, 0, 146, 147, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 148, 149, 150, 151, 152, 153, 154 + 76, 77, 78, 79, 80, 0, 0, 81, 0, 0, + 0, 82, 0, 0, 0, 0, 83, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 0, 0, 26, 163, + 164, 165, 0, 0, 0, 0, 0, 166, 167, 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, + 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, + 171, 172, 173, 0, 73, 0, 174, 175, 176, 138, + 139, 140, 141, 142, 0, 143, 144, 0, 82, 145, + 146, 0, 0, 83, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 147, 148, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 149, 150, 151, 152, 153, 154, 155, 156, + 157 }; +#define yypact_value_is_default(yystate) \ + ((yystate) == (-193)) + +#define yytable_value_is_error(yytable_value) \ + YYID (0) + static const yytype_int16 yycheck[] = { - 2, 87, 85, 84, 8, 40, 41, 2, 177, 2, - 61, 62, 36, 0, 135, 212, 0, 61, 62, 0, - 183, 111, 112, 36, 36, 36, 98, 36, 100, 56, - 120, 121, 122, 116, 123, 121, 122, 36, 40, 41, - 121, 122, 239, 56, 56, 56, 243, 56, 108, 109, - 85, 98, 87, 100, 108, 109, 108, 109, 118, 81, - 111, 112, 113, 114, 115, 116, 118, 111, 112, 113, - 114, 115, 116, 124, 125, 109, 36, 198, 113, 108, - 109, 116, 84, 85, 118, 87, 121, 122, 36, 84, - 85, 84, 85, 262, 116, 119, 98, 36, 100, 134, - 135, 264, 108, 109, 109, 53, 54, 55, 115, 116, - 56, 113, 116, 118, 56, 198, 197, 36, 36, 121, - 122, 108, 109, 56, 108, 109, 121, 122, 121, 122, - 118, 118, 134, 135, 118, 118, 123, 159, 36, 61, - 62, 163, 164, 165, 166, 167, 168, 169, 170, 116, - 36, 36, 174, 175, 36, 53, 54, 55, 36, 36, - 61, 62, 197, 198, 36, 36, 252, 253, 58, 36, - 36, 119, 120, 121, 122, 5, 4, 7, 118, 9, - 10, 113, 114, 115, 116, 4, 3, 36, 3, 46, - 112, 113, 114, 115, 116, 197, 198, 36, 124, 2, - 155, -1, 197, 198, 197, 198, -1, 56, 57, 58, - 59, 60, 113, 114, 115, 116, 0, 252, 253, -1, - 212, 119, 120, 121, 122, -1, -1, 11, 12, -1, - -1, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 2, 88, 86, 0, 85, 8, 41, 42, 2, 136, + 2, 0, 64, 65, 186, 37, 37, 37, 180, 114, + 115, 37, 37, 215, 99, 0, 101, 37, 123, 124, + 125, 37, 99, 117, 101, 122, 123, 59, 59, 41, + 42, 122, 123, 59, 59, 60, 61, 62, 63, 59, + 242, 86, 37, 88, 246, 82, 111, 112, 111, 112, + 111, 112, 114, 115, 116, 117, 118, 119, 121, 112, + 121, 112, 111, 112, 201, 127, 128, 59, 121, 114, + 121, 37, 117, 85, 86, 37, 88, 122, 123, 37, + 117, 85, 86, 85, 86, 267, 59, 99, 113, 101, + 135, 136, 122, 265, 56, 57, 58, 122, 56, 57, + 58, 37, 114, 37, 111, 112, 119, 201, 59, 200, + 122, 123, 111, 112, 121, 126, 64, 65, 122, 123, + 122, 123, 121, 135, 136, 162, 59, 126, 121, 166, + 167, 168, 169, 170, 171, 172, 173, 111, 112, 121, + 177, 178, 5, 119, 7, 37, 9, 10, 118, 119, + 64, 65, 37, 37, 37, 200, 201, 37, 255, 256, + 122, 123, 124, 125, 122, 123, 124, 125, 116, 117, + 118, 119, 116, 117, 118, 119, 37, 37, 37, 61, + 37, 121, 4, 4, 3, 3, 37, 2, 200, 201, + 127, 47, 215, 158, -1, -1, 200, 201, 200, 201, + 114, 115, 116, 117, 118, 119, 64, 65, 0, -1, + 255, 256, -1, -1, -1, -1, -1, -1, -1, 11, + 12, -1, -1, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 255, 256, 37, 38, 39, 40, 41, + 42, 43, 44, 45, -1, -1, -1, 115, 116, 117, + 118, 119, -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, -1, + -1, 113, -1, -1, -1, 117, -1, 11, 12, -1, + 122, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 252, 253, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 110, -1, -1, -1, -1, -1, -1, 52, -1, - 119, -1, -1, -1, -1, -1, -1, -1, -1, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 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, -1, -1, 110, -1, -1, -1, - 114, -1, 11, 12, -1, 119, 15, 16, 17, 18, + 104, 105, 106, 107, 108, 109, 110, -1, -1, 113, + -1, -1, -1, 117, -1, 11, 12, -1, 122, 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, -1, -1, 113, -1, -1, + -1, 117, -1, -1, -1, -1, 122, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, -1, -1, 36, 37, 38, - 39, 40, 41, 42, 43, 44, -1, -1, -1, -1, - -1, -1, -1, 52, -1, -1, -1, 56, 57, 58, - 59, 60, -1, -1, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 29, 30, 31, 32, 33, 34, -1, -1, 37, 56, + 57, 58, -1, -1, -1, -1, -1, 64, 65, -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, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, - -1, 110, -1, -1, -1, 114, -1, 11, 12, -1, - 119, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, - 44, -1, -1, -1, -1, -1, -1, -1, 52, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, -1, -1, 110, -1, -1, -1, - 114, -1, -1, -1, -1, 119, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, -1, -1, 36, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 53, 54, - 55, -1, 52, -1, -1, -1, 61, 62, -1, -1, - -1, -1, -1, 63, 64, 65, 66, 67, -1, -1, - -1, -1, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, -1, -1, -1, -1, - -1, 3, 4, 5, 6, 7, -1, 9, 10, -1, - 100, 13, 14, -1, -1, -1, 111, 112, 113, 114, - 115, 116, -1, -1, 114, 120, 121, 122, -1, 119, - -1, -1, 34, 35, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 45, 46, 47, 48, 49, 50, 51 + -1, -1, -1, -1, -1, -1, -1, 114, 115, 116, + 117, 118, 119, -1, 103, -1, 123, 124, 125, 3, + 4, 5, 6, 7, -1, 9, 10, -1, 117, 13, + 14, -1, -1, 122, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 35, 36, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 46, 47, 48, 49, 50, 51, 52, 53, + 54 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 127, 128, 0, 11, 12, 15, 16, 17, 18, + 0, 130, 131, 0, 11, 12, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 52, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 110, 114, 119, 129, 134, 135, 138, 139, 140, 141, - 145, 146, 147, 157, 158, 160, 161, 162, 163, 167, - 168, 36, 36, 36, 56, 56, 36, 36, 36, 56, - 153, 56, 154, 135, 160, 160, 135, 145, 157, 108, - 109, 130, 131, 138, 129, 158, 160, 56, 57, 58, - 59, 60, 132, 133, 134, 135, 160, 3, 4, 5, - 6, 7, 9, 10, 13, 14, 34, 35, 45, 46, - 47, 48, 49, 50, 51, 142, 143, 144, 148, 123, - 53, 54, 55, 61, 62, 111, 112, 113, 114, 115, - 116, 120, 121, 122, 155, 156, 36, 135, 155, 156, - 164, 165, 36, 135, 155, 156, 169, 170, 111, 112, - 120, 121, 122, 159, 160, 157, 132, 134, 135, 138, - 160, 132, 138, 118, 118, 118, 8, 116, 116, 132, - 133, 136, 137, 160, 108, 109, 108, 109, 36, 56, - 149, 56, 151, 36, 56, 152, 143, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 165, 166, - 36, 36, 170, 171, 36, 36, 36, 160, 58, 36, - 36, 118, 130, 131, 4, 4, 3, 3, 46, 124, - 125, 118, 131, 118, 131, 132, 132, 36, 56, 150, - 36, 165, 170, 124 + 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 55, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 113, 117, 122, 132, 137, 138, 141, 142, 143, + 144, 148, 149, 150, 160, 161, 163, 164, 165, 166, + 170, 171, 37, 37, 37, 59, 59, 37, 37, 37, + 59, 156, 59, 157, 138, 163, 163, 138, 148, 160, + 111, 112, 133, 134, 141, 132, 161, 163, 59, 60, + 61, 62, 63, 135, 136, 137, 138, 163, 3, 4, + 5, 6, 7, 9, 10, 13, 14, 35, 36, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 145, 146, + 147, 151, 126, 56, 57, 58, 64, 65, 114, 115, + 116, 117, 118, 119, 123, 124, 125, 158, 159, 37, + 138, 158, 159, 167, 168, 37, 138, 158, 159, 172, + 173, 114, 115, 123, 124, 125, 162, 163, 160, 135, + 137, 138, 141, 163, 135, 141, 121, 121, 121, 8, + 119, 119, 135, 136, 139, 140, 163, 111, 112, 111, + 112, 37, 59, 152, 59, 154, 37, 59, 155, 146, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 168, 169, 37, 37, 173, 174, 37, 37, 37, + 163, 61, 37, 37, 121, 133, 134, 4, 4, 3, + 3, 47, 127, 128, 121, 134, 121, 134, 135, 135, + 37, 59, 153, 37, 168, 173, 127 }; #define yyerrok (yyerrstatus = 0) @@ -1378,9 +1399,18 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -1390,7 +1420,6 @@ do \ { \ yychar = (Token); \ yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ @@ -1432,19 +1461,10 @@ while (YYID (0)) #endif -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ +/* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif @@ -1636,7 +1656,6 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -1739,115 +1758,142 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = 0; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } - if (yysize_overflow) - return YYSIZE_MAXIMUM; + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1880,6 +1926,7 @@ yydestruct (yymsg, yytype, yyvaluep) } } + /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus @@ -1906,10 +1953,9 @@ YYSTYPE yylval; int yynerrs; - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1933,8 +1979,6 @@ yyparse () #endif #endif { - - int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -2089,7 +2133,7 @@ yyparse () /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -2120,8 +2164,8 @@ yyparse () yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -2176,7 +2220,7 @@ yyparse () { case 2: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 316 "grammar.y" { finish_parse((yyvsp[(2) - (2)].blk).b); @@ -2185,56 +2229,56 @@ yyparse () case 4: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 321 "grammar.y" { (yyval.blk).q = qerr; } break; case 6: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 324 "grammar.y" { gen_and((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); } break; case 7: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 325 "grammar.y" { gen_and((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); } break; case 8: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 326 "grammar.y" { gen_or((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); } break; case 9: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 327 "grammar.y" { gen_or((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); } break; case 10: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 329 "grammar.y" { (yyval.blk) = (yyvsp[(0) - (1)].blk); } break; case 11: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 331 "grammar.y" { (yyval.blk) = (yyvsp[(0) - (1)].blk); } break; case 13: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 334 "grammar.y" { (yyval.blk).b = gen_ncode(NULL, (bpf_u_int32)(yyvsp[(1) - (1)].i), (yyval.blk).q = (yyvsp[(0) - (1)].blk).q); } @@ -2242,21 +2286,21 @@ yyparse () case 14: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 336 "grammar.y" { (yyval.blk) = (yyvsp[(2) - (3)].blk); } break; case 15: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 338 "grammar.y" { (yyval.blk).b = gen_scode((yyvsp[(1) - (1)].s), (yyval.blk).q = (yyvsp[(0) - (1)].blk).q); } break; case 16: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 339 "grammar.y" { (yyval.blk).b = gen_mcode((yyvsp[(1) - (3)].s), NULL, (yyvsp[(3) - (3)].i), (yyval.blk).q = (yyvsp[(0) - (3)].blk).q); } @@ -2264,7 +2308,7 @@ yyparse () case 17: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 341 "grammar.y" { (yyval.blk).b = gen_mcode((yyvsp[(1) - (3)].s), (yyvsp[(3) - (3)].s), 0, (yyval.blk).q = (yyvsp[(0) - (3)].blk).q); } @@ -2272,7 +2316,7 @@ yyparse () case 18: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 343 "grammar.y" { /* Decide how to parse HID based on proto */ @@ -2291,7 +2335,7 @@ yyparse () case 19: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 356 "grammar.y" { #ifdef INET6 @@ -2306,7 +2350,7 @@ yyparse () case 20: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 365 "grammar.y" { #ifdef INET6 @@ -2321,7 +2365,7 @@ yyparse () case 21: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 374 "grammar.y" { (yyval.blk).b = gen_ecode((yyvsp[(1) - (1)].e), (yyval.blk).q = (yyvsp[(0) - (1)].blk).q); @@ -2336,7 +2380,7 @@ yyparse () case 22: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 383 "grammar.y" { (yyval.blk).b = gen_acode((yyvsp[(1) - (1)].e), (yyval.blk).q = (yyvsp[(0) - (1)].blk).q); @@ -2351,42 +2395,42 @@ yyparse () case 23: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 392 "grammar.y" { gen_not((yyvsp[(2) - (2)].blk).b); (yyval.blk) = (yyvsp[(2) - (2)].blk); } break; case 24: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 394 "grammar.y" { (yyval.blk) = (yyvsp[(0) - (1)].blk); } break; case 25: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 396 "grammar.y" { (yyval.blk) = (yyvsp[(0) - (1)].blk); } break; case 27: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 399 "grammar.y" { gen_and((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); } break; case 28: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 400 "grammar.y" { gen_or((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); } break; case 29: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 402 "grammar.y" { (yyval.blk).b = gen_ncode(NULL, (bpf_u_int32)(yyvsp[(1) - (1)].i), (yyval.blk).q = (yyvsp[(0) - (1)].blk).q); } @@ -2394,77 +2438,77 @@ yyparse () case 32: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 407 "grammar.y" { gen_not((yyvsp[(2) - (2)].blk).b); (yyval.blk) = (yyvsp[(2) - (2)].blk); } break; case 33: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 409 "grammar.y" { QSET((yyval.blk).q, (yyvsp[(1) - (3)].i), (yyvsp[(2) - (3)].i), (yyvsp[(3) - (3)].i)); } break; case 34: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 410 "grammar.y" { QSET((yyval.blk).q, (yyvsp[(1) - (2)].i), (yyvsp[(2) - (2)].i), Q_DEFAULT); } break; case 35: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 411 "grammar.y" { QSET((yyval.blk).q, (yyvsp[(1) - (2)].i), Q_DEFAULT, (yyvsp[(2) - (2)].i)); } break; case 36: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 412 "grammar.y" { QSET((yyval.blk).q, (yyvsp[(1) - (2)].i), Q_DEFAULT, Q_PROTO); } break; case 37: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 413 "grammar.y" { QSET((yyval.blk).q, (yyvsp[(1) - (2)].i), Q_DEFAULT, Q_PROTOCHAIN); } break; case 38: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 414 "grammar.y" { QSET((yyval.blk).q, (yyvsp[(1) - (2)].i), Q_DEFAULT, (yyvsp[(2) - (2)].i)); } break; case 39: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 416 "grammar.y" { (yyval.blk) = (yyvsp[(2) - (2)].blk); } break; case 40: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 417 "grammar.y" { (yyval.blk).b = (yyvsp[(2) - (3)].blk).b; (yyval.blk).q = (yyvsp[(1) - (3)].blk).q; } break; case 41: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 418 "grammar.y" { (yyval.blk).b = gen_proto_abbrev((yyvsp[(1) - (1)].i)); (yyval.blk).q = qerr; } break; case 42: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 419 "grammar.y" { (yyval.blk).b = gen_relation((yyvsp[(2) - (3)].i), (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a), 0); (yyval.blk).q = qerr; } @@ -2472,7 +2516,7 @@ yyparse () case 43: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 421 "grammar.y" { (yyval.blk).b = gen_relation((yyvsp[(2) - (3)].i), (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a), 1); (yyval.blk).q = qerr; } @@ -2480,621 +2524,642 @@ yyparse () case 44: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 423 "grammar.y" { (yyval.blk).b = (yyvsp[(1) - (1)].rblk); (yyval.blk).q = qerr; } break; case 45: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 424 "grammar.y" { (yyval.blk).b = gen_atmtype_abbrev((yyvsp[(1) - (1)].i)); (yyval.blk).q = qerr; } break; case 46: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 425 "grammar.y" { (yyval.blk).b = gen_atmmulti_abbrev((yyvsp[(1) - (1)].i)); (yyval.blk).q = qerr; } break; case 47: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 426 "grammar.y" { (yyval.blk).b = (yyvsp[(2) - (2)].blk).b; (yyval.blk).q = qerr; } break; case 48: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 427 "grammar.y" { (yyval.blk).b = gen_mtp2type_abbrev((yyvsp[(1) - (1)].i)); (yyval.blk).q = qerr; } break; case 49: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 428 "grammar.y" { (yyval.blk).b = (yyvsp[(2) - (2)].blk).b; (yyval.blk).q = qerr; } break; case 51: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 432 "grammar.y" { (yyval.i) = Q_DEFAULT; } break; case 52: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 435 "grammar.y" { (yyval.i) = Q_SRC; } break; case 53: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 436 "grammar.y" { (yyval.i) = Q_DST; } break; case 54: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 437 "grammar.y" { (yyval.i) = Q_OR; } break; case 55: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 438 "grammar.y" { (yyval.i) = Q_OR; } break; case 56: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 439 "grammar.y" { (yyval.i) = Q_AND; } break; case 57: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 440 "grammar.y" { (yyval.i) = Q_AND; } break; case 58: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 441 "grammar.y" { (yyval.i) = Q_ADDR1; } break; case 59: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 442 "grammar.y" { (yyval.i) = Q_ADDR2; } break; case 60: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 443 "grammar.y" { (yyval.i) = Q_ADDR3; } break; case 61: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 444 "grammar.y" { (yyval.i) = Q_ADDR4; } break; case 62: -/* Line 1455 of yacc.c */ -#line 447 "grammar.y" - { (yyval.i) = Q_HOST; } +/* Line 1806 of yacc.c */ +#line 445 "grammar.y" + { (yyval.i) = Q_RA; } break; case 63: -/* Line 1455 of yacc.c */ -#line 448 "grammar.y" - { (yyval.i) = Q_NET; } +/* Line 1806 of yacc.c */ +#line 446 "grammar.y" + { (yyval.i) = Q_TA; } break; case 64: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 449 "grammar.y" - { (yyval.i) = Q_PORT; } + { (yyval.i) = Q_HOST; } break; case 65: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 450 "grammar.y" - { (yyval.i) = Q_PORTRANGE; } + { (yyval.i) = Q_NET; } break; case 66: -/* Line 1455 of yacc.c */ -#line 453 "grammar.y" - { (yyval.i) = Q_GATEWAY; } +/* Line 1806 of yacc.c */ +#line 451 "grammar.y" + { (yyval.i) = Q_PORT; } break; case 67: -/* Line 1455 of yacc.c */ -#line 455 "grammar.y" - { (yyval.i) = Q_LINK; } +/* Line 1806 of yacc.c */ +#line 452 "grammar.y" + { (yyval.i) = Q_PORTRANGE; } break; case 68: -/* Line 1455 of yacc.c */ -#line 456 "grammar.y" - { (yyval.i) = Q_IP; } +/* Line 1806 of yacc.c */ +#line 455 "grammar.y" + { (yyval.i) = Q_GATEWAY; } break; case 69: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 457 "grammar.y" - { (yyval.i) = Q_ARP; } + { (yyval.i) = Q_LINK; } break; case 70: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 458 "grammar.y" - { (yyval.i) = Q_RARP; } + { (yyval.i) = Q_IP; } break; case 71: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 459 "grammar.y" - { (yyval.i) = Q_SCTP; } + { (yyval.i) = Q_ARP; } break; case 72: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 460 "grammar.y" - { (yyval.i) = Q_TCP; } + { (yyval.i) = Q_RARP; } break; case 73: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 461 "grammar.y" - { (yyval.i) = Q_UDP; } + { (yyval.i) = Q_SCTP; } break; case 74: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 462 "grammar.y" - { (yyval.i) = Q_ICMP; } + { (yyval.i) = Q_TCP; } break; case 75: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 463 "grammar.y" - { (yyval.i) = Q_IGMP; } + { (yyval.i) = Q_UDP; } break; case 76: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 464 "grammar.y" - { (yyval.i) = Q_IGRP; } + { (yyval.i) = Q_ICMP; } break; case 77: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 465 "grammar.y" - { (yyval.i) = Q_PIM; } + { (yyval.i) = Q_IGMP; } break; case 78: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 466 "grammar.y" - { (yyval.i) = Q_VRRP; } + { (yyval.i) = Q_IGRP; } break; case 79: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 467 "grammar.y" - { (yyval.i) = Q_ATALK; } + { (yyval.i) = Q_PIM; } break; case 80: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 468 "grammar.y" - { (yyval.i) = Q_AARP; } + { (yyval.i) = Q_VRRP; } break; case 81: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 469 "grammar.y" - { (yyval.i) = Q_DECNET; } + { (yyval.i) = Q_CARP; } break; case 82: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 470 "grammar.y" - { (yyval.i) = Q_LAT; } + { (yyval.i) = Q_ATALK; } break; case 83: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 471 "grammar.y" - { (yyval.i) = Q_SCA; } + { (yyval.i) = Q_AARP; } break; case 84: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 472 "grammar.y" - { (yyval.i) = Q_MOPDL; } + { (yyval.i) = Q_DECNET; } break; case 85: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 473 "grammar.y" - { (yyval.i) = Q_MOPRC; } + { (yyval.i) = Q_LAT; } break; case 86: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 474 "grammar.y" - { (yyval.i) = Q_IPV6; } + { (yyval.i) = Q_SCA; } break; case 87: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 475 "grammar.y" - { (yyval.i) = Q_ICMPV6; } + { (yyval.i) = Q_MOPDL; } break; case 88: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 476 "grammar.y" - { (yyval.i) = Q_AH; } + { (yyval.i) = Q_MOPRC; } break; case 89: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 477 "grammar.y" - { (yyval.i) = Q_ESP; } + { (yyval.i) = Q_IPV6; } break; case 90: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 478 "grammar.y" - { (yyval.i) = Q_ISO; } + { (yyval.i) = Q_ICMPV6; } break; case 91: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 479 "grammar.y" - { (yyval.i) = Q_ESIS; } + { (yyval.i) = Q_AH; } break; case 92: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 480 "grammar.y" - { (yyval.i) = Q_ISIS; } + { (yyval.i) = Q_ESP; } break; case 93: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 481 "grammar.y" - { (yyval.i) = Q_ISIS_L1; } + { (yyval.i) = Q_ISO; } break; case 94: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 482 "grammar.y" - { (yyval.i) = Q_ISIS_L2; } + { (yyval.i) = Q_ESIS; } break; case 95: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 483 "grammar.y" - { (yyval.i) = Q_ISIS_IIH; } + { (yyval.i) = Q_ISIS; } break; case 96: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 484 "grammar.y" - { (yyval.i) = Q_ISIS_LSP; } + { (yyval.i) = Q_ISIS_L1; } break; case 97: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 485 "grammar.y" - { (yyval.i) = Q_ISIS_SNP; } + { (yyval.i) = Q_ISIS_L2; } break; case 98: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 486 "grammar.y" - { (yyval.i) = Q_ISIS_PSNP; } + { (yyval.i) = Q_ISIS_IIH; } break; case 99: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 487 "grammar.y" - { (yyval.i) = Q_ISIS_CSNP; } + { (yyval.i) = Q_ISIS_LSP; } break; case 100: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 488 "grammar.y" - { (yyval.i) = Q_CLNP; } + { (yyval.i) = Q_ISIS_SNP; } break; case 101: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 489 "grammar.y" - { (yyval.i) = Q_STP; } + { (yyval.i) = Q_ISIS_PSNP; } break; case 102: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 490 "grammar.y" - { (yyval.i) = Q_IPX; } + { (yyval.i) = Q_ISIS_CSNP; } break; case 103: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 491 "grammar.y" - { (yyval.i) = Q_NETBEUI; } + { (yyval.i) = Q_CLNP; } break; case 104: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 492 "grammar.y" - { (yyval.i) = Q_RADIO; } + { (yyval.i) = Q_STP; } break; case 105: -/* Line 1455 of yacc.c */ -#line 494 "grammar.y" - { (yyval.rblk) = gen_broadcast((yyvsp[(1) - (2)].i)); } +/* Line 1806 of yacc.c */ +#line 493 "grammar.y" + { (yyval.i) = Q_IPX; } break; case 106: -/* Line 1455 of yacc.c */ -#line 495 "grammar.y" - { (yyval.rblk) = gen_multicast((yyvsp[(1) - (2)].i)); } +/* Line 1806 of yacc.c */ +#line 494 "grammar.y" + { (yyval.i) = Q_NETBEUI; } break; case 107: -/* Line 1455 of yacc.c */ -#line 496 "grammar.y" - { (yyval.rblk) = gen_less((yyvsp[(2) - (2)].i)); } +/* Line 1806 of yacc.c */ +#line 495 "grammar.y" + { (yyval.i) = Q_RADIO; } break; case 108: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 497 "grammar.y" - { (yyval.rblk) = gen_greater((yyvsp[(2) - (2)].i)); } + { (yyval.rblk) = gen_broadcast((yyvsp[(1) - (2)].i)); } break; case 109: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 498 "grammar.y" - { (yyval.rblk) = gen_byteop((yyvsp[(3) - (4)].i), (yyvsp[(2) - (4)].i), (yyvsp[(4) - (4)].i)); } + { (yyval.rblk) = gen_multicast((yyvsp[(1) - (2)].i)); } break; case 110: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 499 "grammar.y" - { (yyval.rblk) = gen_inbound(0); } + { (yyval.rblk) = gen_less((yyvsp[(2) - (2)].i)); } break; case 111: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 500 "grammar.y" - { (yyval.rblk) = gen_inbound(1); } + { (yyval.rblk) = gen_greater((yyvsp[(2) - (2)].i)); } break; case 112: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 501 "grammar.y" - { (yyval.rblk) = gen_vlan((yyvsp[(2) - (2)].i)); } + { (yyval.rblk) = gen_byteop((yyvsp[(3) - (4)].i), (yyvsp[(2) - (4)].i), (yyvsp[(4) - (4)].i)); } break; case 113: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 502 "grammar.y" - { (yyval.rblk) = gen_vlan(-1); } + { (yyval.rblk) = gen_inbound(0); } break; case 114: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 503 "grammar.y" - { (yyval.rblk) = gen_mpls((yyvsp[(2) - (2)].i)); } + { (yyval.rblk) = gen_inbound(1); } break; case 115: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 504 "grammar.y" - { (yyval.rblk) = gen_mpls(-1); } + { (yyval.rblk) = gen_vlan((yyvsp[(2) - (2)].i)); } break; case 116: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 505 "grammar.y" - { (yyval.rblk) = gen_pppoed(); } + { (yyval.rblk) = gen_vlan(-1); } break; case 117: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 506 "grammar.y" - { (yyval.rblk) = gen_pppoes(); } + { (yyval.rblk) = gen_mpls((yyvsp[(2) - (2)].i)); } break; case 118: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 507 "grammar.y" - { (yyval.rblk) = (yyvsp[(1) - (1)].rblk); } + { (yyval.rblk) = gen_mpls(-1); } break; case 119: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 508 "grammar.y" - { (yyval.rblk) = (yyvsp[(2) - (2)].rblk); } + { (yyval.rblk) = gen_pppoed(); } break; case 120: -/* Line 1455 of yacc.c */ -#line 511 "grammar.y" - { (yyval.rblk) = gen_pf_ifname((yyvsp[(2) - (2)].s)); } +/* Line 1806 of yacc.c */ +#line 509 "grammar.y" + { (yyval.rblk) = gen_pppoes(); } break; case 121: -/* Line 1455 of yacc.c */ -#line 512 "grammar.y" - { (yyval.rblk) = gen_pf_ruleset((yyvsp[(2) - (2)].s)); } +/* Line 1806 of yacc.c */ +#line 510 "grammar.y" + { (yyval.rblk) = (yyvsp[(1) - (1)].rblk); } break; case 122: -/* Line 1455 of yacc.c */ -#line 513 "grammar.y" - { (yyval.rblk) = gen_pf_rnr((yyvsp[(2) - (2)].i)); } +/* Line 1806 of yacc.c */ +#line 511 "grammar.y" + { (yyval.rblk) = (yyvsp[(2) - (2)].rblk); } break; case 123: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 514 "grammar.y" - { (yyval.rblk) = gen_pf_srnr((yyvsp[(2) - (2)].i)); } + { (yyval.rblk) = gen_pf_ifname((yyvsp[(2) - (2)].s)); } break; case 124: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 515 "grammar.y" - { (yyval.rblk) = gen_pf_reason((yyvsp[(2) - (2)].i)); } + { (yyval.rblk) = gen_pf_ruleset((yyvsp[(2) - (2)].s)); } break; case 125: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 516 "grammar.y" - { (yyval.rblk) = gen_pf_action((yyvsp[(2) - (2)].i)); } + { (yyval.rblk) = gen_pf_rnr((yyvsp[(2) - (2)].i)); } break; case 126: -/* Line 1455 of yacc.c */ -#line 520 "grammar.y" +/* Line 1806 of yacc.c */ +#line 517 "grammar.y" + { (yyval.rblk) = gen_pf_srnr((yyvsp[(2) - (2)].i)); } + break; + + case 127: + +/* Line 1806 of yacc.c */ +#line 518 "grammar.y" + { (yyval.rblk) = gen_pf_reason((yyvsp[(2) - (2)].i)); } + break; + + case 128: + +/* Line 1806 of yacc.c */ +#line 519 "grammar.y" + { (yyval.rblk) = gen_pf_action((yyvsp[(2) - (2)].i)); } + break; + + case 129: + +/* Line 1806 of yacc.c */ +#line 523 "grammar.y" { (yyval.rblk) = gen_p80211_type((yyvsp[(2) - (4)].i) | (yyvsp[(4) - (4)].i), IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK); } break; - case 127: + case 130: -/* Line 1455 of yacc.c */ -#line 524 "grammar.y" +/* Line 1806 of yacc.c */ +#line 527 "grammar.y" { (yyval.rblk) = gen_p80211_type((yyvsp[(2) - (2)].i), IEEE80211_FC0_TYPE_MASK); } break; - case 128: + case 131: -/* Line 1455 of yacc.c */ -#line 527 "grammar.y" +/* Line 1806 of yacc.c */ +#line 530 "grammar.y" { (yyval.rblk) = gen_p80211_type((yyvsp[(2) - (2)].i), IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK); } break; - case 129: + case 132: -/* Line 1455 of yacc.c */ -#line 531 "grammar.y" +/* Line 1806 of yacc.c */ +#line 534 "grammar.y" { (yyval.rblk) = gen_p80211_fcdir((yyvsp[(2) - (2)].i)); } break; - case 131: + case 134: -/* Line 1455 of yacc.c */ -#line 535 "grammar.y" +/* Line 1806 of yacc.c */ +#line 538 "grammar.y" { (yyval.i) = str2tok((yyvsp[(1) - (1)].s), ieee80211_types); if ((yyval.i) == -1) bpf_error("unknown 802.11 type name"); } break; - case 133: + case 136: -/* Line 1455 of yacc.c */ -#line 542 "grammar.y" +/* Line 1806 of yacc.c */ +#line 545 "grammar.y" { const struct tok *types = NULL; int i; for (i = 0;; i++) { @@ -3115,10 +3180,10 @@ yyparse () } break; - case 134: + case 137: -/* Line 1455 of yacc.c */ -#line 562 "grammar.y" +/* Line 1806 of yacc.c */ +#line 565 "grammar.y" { int i; for (i = 0;; i++) { if (ieee80211_type_subtypes[i].tok == NULL) { @@ -3135,10 +3200,10 @@ yyparse () } break; - case 136: + case 139: -/* Line 1455 of yacc.c */ -#line 579 "grammar.y" +/* Line 1806 of yacc.c */ +#line 582 "grammar.y" { if (pcap_strcasecmp((yyvsp[(1) - (1)].s), "nods") == 0) (yyval.i) = IEEE80211_FC1_DIR_NODS; else if (pcap_strcasecmp((yyvsp[(1) - (1)].s), "tods") == 0) @@ -3152,332 +3217,332 @@ yyparse () } break; - case 137: - -/* Line 1455 of yacc.c */ -#line 592 "grammar.y" - { (yyval.i) = (yyvsp[(1) - (1)].i); } - break; - - case 138: - -/* Line 1455 of yacc.c */ -#line 593 "grammar.y" - { (yyval.i) = pfreason_to_num((yyvsp[(1) - (1)].s)); } - break; - - case 139: - -/* Line 1455 of yacc.c */ -#line 596 "grammar.y" - { (yyval.i) = pfaction_to_num((yyvsp[(1) - (1)].s)); } - break; - case 140: -/* Line 1455 of yacc.c */ -#line 599 "grammar.y" - { (yyval.i) = BPF_JGT; } +/* Line 1806 of yacc.c */ +#line 595 "grammar.y" + { (yyval.i) = (yyvsp[(1) - (1)].i); } break; case 141: -/* Line 1455 of yacc.c */ -#line 600 "grammar.y" - { (yyval.i) = BPF_JGE; } +/* Line 1806 of yacc.c */ +#line 596 "grammar.y" + { (yyval.i) = pfreason_to_num((yyvsp[(1) - (1)].s)); } break; case 142: -/* Line 1455 of yacc.c */ -#line 601 "grammar.y" - { (yyval.i) = BPF_JEQ; } +/* Line 1806 of yacc.c */ +#line 599 "grammar.y" + { (yyval.i) = pfaction_to_num((yyvsp[(1) - (1)].s)); } break; case 143: -/* Line 1455 of yacc.c */ -#line 603 "grammar.y" +/* Line 1806 of yacc.c */ +#line 602 "grammar.y" { (yyval.i) = BPF_JGT; } break; case 144: -/* Line 1455 of yacc.c */ -#line 604 "grammar.y" +/* Line 1806 of yacc.c */ +#line 603 "grammar.y" { (yyval.i) = BPF_JGE; } break; case 145: -/* Line 1455 of yacc.c */ -#line 605 "grammar.y" +/* Line 1806 of yacc.c */ +#line 604 "grammar.y" { (yyval.i) = BPF_JEQ; } break; case 146: -/* Line 1455 of yacc.c */ -#line 607 "grammar.y" - { (yyval.a) = gen_loadi((yyvsp[(1) - (1)].i)); } +/* Line 1806 of yacc.c */ +#line 606 "grammar.y" + { (yyval.i) = BPF_JGT; } break; - case 148: + case 147: -/* Line 1455 of yacc.c */ -#line 610 "grammar.y" - { (yyval.a) = gen_load((yyvsp[(1) - (4)].i), (yyvsp[(3) - (4)].a), 1); } +/* Line 1806 of yacc.c */ +#line 607 "grammar.y" + { (yyval.i) = BPF_JGE; } break; - case 149: + case 148: -/* Line 1455 of yacc.c */ -#line 611 "grammar.y" - { (yyval.a) = gen_load((yyvsp[(1) - (6)].i), (yyvsp[(3) - (6)].a), (yyvsp[(5) - (6)].i)); } +/* Line 1806 of yacc.c */ +#line 608 "grammar.y" + { (yyval.i) = BPF_JEQ; } break; - case 150: + case 149: -/* Line 1455 of yacc.c */ -#line 612 "grammar.y" - { (yyval.a) = gen_arth(BPF_ADD, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } +/* Line 1806 of yacc.c */ +#line 610 "grammar.y" + { (yyval.a) = gen_loadi((yyvsp[(1) - (1)].i)); } break; case 151: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 613 "grammar.y" - { (yyval.a) = gen_arth(BPF_SUB, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } + { (yyval.a) = gen_load((yyvsp[(1) - (4)].i), (yyvsp[(3) - (4)].a), 1); } break; case 152: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 614 "grammar.y" - { (yyval.a) = gen_arth(BPF_MUL, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } + { (yyval.a) = gen_load((yyvsp[(1) - (6)].i), (yyvsp[(3) - (6)].a), (yyvsp[(5) - (6)].i)); } break; case 153: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 615 "grammar.y" - { (yyval.a) = gen_arth(BPF_DIV, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } + { (yyval.a) = gen_arth(BPF_ADD, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } break; case 154: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 616 "grammar.y" - { (yyval.a) = gen_arth(BPF_AND, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } + { (yyval.a) = gen_arth(BPF_SUB, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } break; case 155: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 617 "grammar.y" - { (yyval.a) = gen_arth(BPF_OR, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } + { (yyval.a) = gen_arth(BPF_MUL, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } break; case 156: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 618 "grammar.y" - { (yyval.a) = gen_arth(BPF_LSH, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } + { (yyval.a) = gen_arth(BPF_DIV, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } break; case 157: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 619 "grammar.y" - { (yyval.a) = gen_arth(BPF_RSH, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } + { (yyval.a) = gen_arth(BPF_AND, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } break; case 158: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 620 "grammar.y" - { (yyval.a) = gen_neg((yyvsp[(2) - (2)].a)); } + { (yyval.a) = gen_arth(BPF_OR, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } break; case 159: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 621 "grammar.y" - { (yyval.a) = (yyvsp[(2) - (3)].a); } + { (yyval.a) = gen_arth(BPF_LSH, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } break; case 160: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 622 "grammar.y" - { (yyval.a) = gen_loadlen(); } + { (yyval.a) = gen_arth(BPF_RSH, (yyvsp[(1) - (3)].a), (yyvsp[(3) - (3)].a)); } break; case 161: -/* Line 1455 of yacc.c */ -#line 624 "grammar.y" - { (yyval.i) = '&'; } +/* Line 1806 of yacc.c */ +#line 623 "grammar.y" + { (yyval.a) = gen_neg((yyvsp[(2) - (2)].a)); } break; case 162: -/* Line 1455 of yacc.c */ -#line 625 "grammar.y" - { (yyval.i) = '|'; } +/* Line 1806 of yacc.c */ +#line 624 "grammar.y" + { (yyval.a) = (yyvsp[(2) - (3)].a); } break; case 163: -/* Line 1455 of yacc.c */ -#line 626 "grammar.y" - { (yyval.i) = '<'; } +/* Line 1806 of yacc.c */ +#line 625 "grammar.y" + { (yyval.a) = gen_loadlen(); } break; case 164: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 627 "grammar.y" - { (yyval.i) = '>'; } + { (yyval.i) = '&'; } break; case 165: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 628 "grammar.y" - { (yyval.i) = '='; } + { (yyval.i) = '|'; } break; - case 167: + case 166: -/* Line 1455 of yacc.c */ -#line 631 "grammar.y" - { (yyval.i) = (yyvsp[(2) - (3)].i); } +/* Line 1806 of yacc.c */ +#line 629 "grammar.y" + { (yyval.i) = '<'; } break; - case 168: + case 167: -/* Line 1455 of yacc.c */ -#line 633 "grammar.y" - { (yyval.i) = A_LANE; } +/* Line 1806 of yacc.c */ +#line 630 "grammar.y" + { (yyval.i) = '>'; } break; - case 169: + case 168: -/* Line 1455 of yacc.c */ -#line 634 "grammar.y" - { (yyval.i) = A_LLC; } +/* Line 1806 of yacc.c */ +#line 631 "grammar.y" + { (yyval.i) = '='; } break; case 170: -/* Line 1455 of yacc.c */ -#line 635 "grammar.y" - { (yyval.i) = A_METAC; } +/* Line 1806 of yacc.c */ +#line 634 "grammar.y" + { (yyval.i) = (yyvsp[(2) - (3)].i); } break; case 171: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 636 "grammar.y" - { (yyval.i) = A_BCC; } + { (yyval.i) = A_LANE; } break; case 172: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 637 "grammar.y" - { (yyval.i) = A_OAMF4EC; } + { (yyval.i) = A_LLC; } break; case 173: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 638 "grammar.y" - { (yyval.i) = A_OAMF4SC; } + { (yyval.i) = A_METAC; } break; case 174: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 639 "grammar.y" - { (yyval.i) = A_SC; } + { (yyval.i) = A_BCC; } break; case 175: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 640 "grammar.y" - { (yyval.i) = A_ILMIC; } + { (yyval.i) = A_OAMF4EC; } break; case 176: -/* Line 1455 of yacc.c */ -#line 642 "grammar.y" - { (yyval.i) = A_OAM; } +/* Line 1806 of yacc.c */ +#line 641 "grammar.y" + { (yyval.i) = A_OAMF4SC; } break; case 177: -/* Line 1455 of yacc.c */ -#line 643 "grammar.y" - { (yyval.i) = A_OAMF4; } +/* Line 1806 of yacc.c */ +#line 642 "grammar.y" + { (yyval.i) = A_SC; } break; case 178: -/* Line 1455 of yacc.c */ -#line 644 "grammar.y" - { (yyval.i) = A_CONNECTMSG; } +/* Line 1806 of yacc.c */ +#line 643 "grammar.y" + { (yyval.i) = A_ILMIC; } break; case 179: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 645 "grammar.y" - { (yyval.i) = A_METACONNECT; } + { (yyval.i) = A_OAM; } break; case 180: -/* Line 1455 of yacc.c */ -#line 648 "grammar.y" - { (yyval.blk).atmfieldtype = A_VPI; } +/* Line 1806 of yacc.c */ +#line 646 "grammar.y" + { (yyval.i) = A_OAMF4; } break; case 181: -/* Line 1455 of yacc.c */ -#line 649 "grammar.y" - { (yyval.blk).atmfieldtype = A_VCI; } +/* Line 1806 of yacc.c */ +#line 647 "grammar.y" + { (yyval.i) = A_CONNECTMSG; } + break; + + case 182: + +/* Line 1806 of yacc.c */ +#line 648 "grammar.y" + { (yyval.i) = A_METACONNECT; } break; case 183: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ +#line 651 "grammar.y" + { (yyval.blk).atmfieldtype = A_VPI; } + break; + + case 184: + +/* Line 1806 of yacc.c */ #line 652 "grammar.y" + { (yyval.blk).atmfieldtype = A_VCI; } + break; + + case 186: + +/* Line 1806 of yacc.c */ +#line 655 "grammar.y" { (yyval.blk).b = gen_atmfield_code((yyvsp[(0) - (2)].blk).atmfieldtype, (bpf_int32)(yyvsp[(2) - (2)].i), (bpf_u_int32)(yyvsp[(1) - (2)].i), 0); } break; - case 184: + case 187: -/* Line 1455 of yacc.c */ -#line 653 "grammar.y" +/* Line 1806 of yacc.c */ +#line 656 "grammar.y" { (yyval.blk).b = gen_atmfield_code((yyvsp[(0) - (2)].blk).atmfieldtype, (bpf_int32)(yyvsp[(2) - (2)].i), (bpf_u_int32)(yyvsp[(1) - (2)].i), 1); } break; - case 185: + case 188: -/* Line 1455 of yacc.c */ -#line 654 "grammar.y" +/* Line 1806 of yacc.c */ +#line 657 "grammar.y" { (yyval.blk).b = (yyvsp[(2) - (3)].blk).b; (yyval.blk).q = qerr; } break; - case 186: + case 189: -/* Line 1455 of yacc.c */ -#line 656 "grammar.y" +/* Line 1806 of yacc.c */ +#line 659 "grammar.y" { (yyval.blk).atmfieldtype = (yyvsp[(0) - (1)].blk).atmfieldtype; if ((yyval.blk).atmfieldtype == A_VPI || @@ -3486,87 +3551,87 @@ yyparse () } break; - case 188: + case 191: -/* Line 1455 of yacc.c */ -#line 664 "grammar.y" +/* Line 1806 of yacc.c */ +#line 667 "grammar.y" { gen_or((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); } break; - case 189: + case 192: -/* Line 1455 of yacc.c */ -#line 667 "grammar.y" +/* Line 1806 of yacc.c */ +#line 670 "grammar.y" { (yyval.i) = M_FISU; } break; - case 190: + case 193: -/* Line 1455 of yacc.c */ -#line 668 "grammar.y" +/* Line 1806 of yacc.c */ +#line 671 "grammar.y" { (yyval.i) = M_LSSU; } break; - case 191: + case 194: -/* Line 1455 of yacc.c */ -#line 669 "grammar.y" +/* Line 1806 of yacc.c */ +#line 672 "grammar.y" { (yyval.i) = M_MSU; } break; - case 192: + case 195: -/* Line 1455 of yacc.c */ -#line 672 "grammar.y" +/* Line 1806 of yacc.c */ +#line 675 "grammar.y" { (yyval.blk).mtp3fieldtype = M_SIO; } break; - case 193: + case 196: -/* Line 1455 of yacc.c */ -#line 673 "grammar.y" +/* Line 1806 of yacc.c */ +#line 676 "grammar.y" { (yyval.blk).mtp3fieldtype = M_OPC; } break; - case 194: + case 197: -/* Line 1455 of yacc.c */ -#line 674 "grammar.y" +/* Line 1806 of yacc.c */ +#line 677 "grammar.y" { (yyval.blk).mtp3fieldtype = M_DPC; } break; - case 195: + case 198: -/* Line 1455 of yacc.c */ -#line 675 "grammar.y" +/* Line 1806 of yacc.c */ +#line 678 "grammar.y" { (yyval.blk).mtp3fieldtype = M_SLS; } break; - case 197: + case 200: -/* Line 1455 of yacc.c */ -#line 678 "grammar.y" +/* Line 1806 of yacc.c */ +#line 681 "grammar.y" { (yyval.blk).b = gen_mtp3field_code((yyvsp[(0) - (2)].blk).mtp3fieldtype, (u_int)(yyvsp[(2) - (2)].i), (u_int)(yyvsp[(1) - (2)].i), 0); } break; - case 198: + case 201: -/* Line 1455 of yacc.c */ -#line 679 "grammar.y" +/* Line 1806 of yacc.c */ +#line 682 "grammar.y" { (yyval.blk).b = gen_mtp3field_code((yyvsp[(0) - (2)].blk).mtp3fieldtype, (u_int)(yyvsp[(2) - (2)].i), (u_int)(yyvsp[(1) - (2)].i), 1); } break; - case 199: + case 202: -/* Line 1455 of yacc.c */ -#line 680 "grammar.y" +/* Line 1806 of yacc.c */ +#line 683 "grammar.y" { (yyval.blk).b = (yyvsp[(2) - (3)].blk).b; (yyval.blk).q = qerr; } break; - case 200: + case 203: -/* Line 1455 of yacc.c */ -#line 682 "grammar.y" +/* Line 1806 of yacc.c */ +#line 685 "grammar.y" { (yyval.blk).mtp3fieldtype = (yyvsp[(0) - (1)].blk).mtp3fieldtype; if ((yyval.blk).mtp3fieldtype == M_SIO || @@ -3577,19 +3642,30 @@ yyparse () } break; - case 202: + case 205: -/* Line 1455 of yacc.c */ -#line 692 "grammar.y" +/* Line 1806 of yacc.c */ +#line 695 "grammar.y" { gen_or((yyvsp[(1) - (3)].blk).b, (yyvsp[(3) - (3)].blk).b); (yyval.blk) = (yyvsp[(3) - (3)].blk); } break; -/* Line 1455 of yacc.c */ -#line 3591 "y.tab.c" +/* Line 1806 of yacc.c */ +#line 3656 "y.tab.c" default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -3617,6 +3693,10 @@ yyparse () | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -3624,37 +3704,36 @@ yyparse () #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } @@ -3713,7 +3792,7 @@ yyparse () for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -3772,8 +3851,13 @@ yyparse () yyreturn: if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -3798,7 +3882,7 @@ yyparse () -/* Line 1675 of yacc.c */ -#line 694 "grammar.y" +/* Line 2067 of yacc.c */ +#line 697 "grammar.y" diff --git a/libpcap/grammar.y b/libpcap/grammar.y index 4c52579ba3..f2ba28b1e5 100644 --- a/libpcap/grammar.y +++ b/libpcap/grammar.y @@ -272,12 +272,12 @@ pfaction_to_num(const char *action) %token DST SRC HOST GATEWAY %token NET NETMASK PORT PORTRANGE LESS GREATER PROTO PROTOCHAIN CBYTE -%token ARP RARP IP SCTP TCP UDP ICMP IGMP IGRP PIM VRRP +%token ARP RARP IP SCTP TCP UDP ICMP IGMP IGRP PIM VRRP CARP %token ATALK AARP DECNET LAT SCA MOPRC MOPDL %token TK_BROADCAST TK_MULTICAST %token NUM INBOUND OUTBOUND %token PF_IFNAME PF_RSET PF_RNR PF_SRNR PF_REASON PF_ACTION -%token TYPE SUBTYPE DIR ADDR1 ADDR2 ADDR3 ADDR4 +%token TYPE SUBTYPE DIR ADDR1 ADDR2 ADDR3 ADDR4 RA TA %token LINK %token GEQ LEQ NEQ %token ID EID HID HID6 AID @@ -442,6 +442,8 @@ dqual: SRC { $$ = Q_SRC; } | ADDR2 { $$ = Q_ADDR2; } | ADDR3 { $$ = Q_ADDR3; } | ADDR4 { $$ = Q_ADDR4; } + | RA { $$ = Q_RA; } + | TA { $$ = Q_TA; } ; /* address type qualifiers */ aqual: HOST { $$ = Q_HOST; } @@ -464,6 +466,7 @@ pname: LINK { $$ = Q_LINK; } | IGRP { $$ = Q_IGRP; } | PIM { $$ = Q_PIM; } | VRRP { $$ = Q_VRRP; } + | CARP { $$ = Q_CARP; } | ATALK { $$ = Q_ATALK; } | AARP { $$ = Q_AARP; } | DECNET { $$ = Q_DECNET; } diff --git a/libpcap/inet.c b/libpcap/inet.c index 0b16a65907..6ae46ef876 100644 --- a/libpcap/inet.c +++ b/libpcap/inet.c @@ -133,6 +133,7 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name, pcap_t *p; pcap_if_t *curdev, *prevdev, *nextdev; int this_instance; + char open_errbuf[PCAP_ERRBUF_SIZE]; /* * Is there already an entry in the list for this interface? @@ -192,11 +193,11 @@ 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, errbuf); + p = pcap_open_live(en_name, 68, 0, 0, open_errbuf); free(en_name); } else #endif /* __APPLE */ - p = pcap_open_live(name, 68, 0, 0, errbuf); + p = pcap_open_live(name, 68, 0, 0, open_errbuf); if (p == NULL) { /* * No. Don't bother including it. @@ -431,26 +432,53 @@ add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags, strlcpy(ifrdesc.ifr_name, name, sizeof ifrdesc.ifr_name); s = socket(AF_INET, SOCK_DGRAM, 0); if (s >= 0) { +#ifdef __FreeBSD__ + /* + * On FreeBSD, if the buffer isn't big enough for the + * description, the ioctl succeeds, but the description + * isn't copied, ifr_buffer.length is set to the description + * length, and ifr_buffer.buffer is set to NULL. + */ for (;;) { free(description); if ((description = malloc(descrlen)) != NULL) { -#ifdef __FreeBSD__ ifrdesc.ifr_buffer.buffer = description; ifrdesc.ifr_buffer.length = descrlen; -#else /* __FreeBSD__ */ - ifrdesc.ifr_data = (caddr_t)description; -#endif /* __FreeBSD__ */ - if (ioctl(s, SIOCGIFDESCR, &ifrdesc) == 0) - break; -#ifdef __FreeBSD__ - else if (errno == ENAMETOOLONG) - descrlen = ifrdesc.ifr_buffer.length; -#endif /* __FreeBSD__ */ - else + if (ioctl(s, SIOCGIFDESCR, &ifrdesc) == 0) { + if (ifrdesc.ifr_buffer.buffer == + description) + break; + else + descrlen = ifrdesc.ifr_buffer.length; + } else { + /* + * Failed to get interface description. + */ + free(description); + description = NULL; break; + } } else break; } +#else /* __FreeBSD__ */ + /* + * The only other OS that currently supports + * SIOCGIFDESCR is OpenBSD, and it has no way + * to get the description length - it's clamped + * to a maximum of IFDESCRSIZE. + */ + if ((description = malloc(descrlen)) != NULL) { + ifrdesc.ifr_data = (caddr_t)description; + if (ioctl(s, SIOCGIFDESCR, &ifrdesc) != 0) { + /* + * Failed to get interface description. + */ + free(description); + description = NULL; + } + } +#endif /* __FreeBSD__ */ close(s); if (description != NULL && strlen(description) == 0) { free(description); @@ -850,8 +878,10 @@ pcap_lookupdev(errbuf) */ while(NAdapts--) { - strcpy((char*)tUstr, tAstr); - (char*)tUstr += strlen(tAstr) + 1;; + char* tmp = (char*)tUstr; + strcpy(tmp, tAstr); + tmp += strlen(tAstr) + 1; + tUstr = (WCHAR*)tmp; tAstr += strlen(tAstr) + 1; } diff --git a/libpcap/install-sh b/libpcap/install-sh new file mode 100755 index 0000000000..ebc66913e9 --- /dev/null +++ b/libpcap/install-sh @@ -0,0 +1,250 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/libpcap/msdos/bin2c.c b/libpcap/msdos/bin2c.c new file mode 100644 index 0000000000..d82056e17a --- /dev/null +++ b/libpcap/msdos/bin2c.c @@ -0,0 +1,43 @@ +#include +#include +#include +#include + +static void Abort (char *fmt,...) +{ + va_list args; + va_start (args, fmt); + vfprintf (stderr, fmt, args); + va_end (args); + exit (1); +} + +int main (int argc, char **argv) +{ + FILE *inFile; + FILE *outFile = stdout; + time_t now = time (NULL); + int ch, i; + + if (argc != 2) + Abort ("Usage: %s bin-file [> result]", argv[0]); + + if ((inFile = fopen(argv[1],"rb")) == NULL) + Abort ("Cannot open %s\n", argv[1]); + + fprintf (outFile, + "/* data statements for file %s at %.24s */\n" + "/* Generated by BIN2C, G.Vanem 1995 */\n", + argv[1], ctime(&now)); + + i = 0; + while ((ch = fgetc(inFile)) != EOF) + { + if (i++ % 12 == 0) + fputs ("\n ", outFile); + fprintf (outFile, "0x%02X,", ch); + } + fputc ('\n', outFile); + fclose (inFile); + return (0); +} diff --git a/libpcap/msdos/common.dj b/libpcap/msdos/common.dj new file mode 100644 index 0000000000..3f64d14e92 --- /dev/null +++ b/libpcap/msdos/common.dj @@ -0,0 +1,80 @@ +# +# 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 + +default: check_gcclib all + +GCCLIB = /djgpp/lib/gcc-lib/djgpp/3.31 +MAKEFILE = Makefile.dj + +# +# DLX 2.91+ lib. Change path to suite. +# Not used anymore. Uses DXE3 now. +# +# DLX_LIB = $(DJDIR)/contrib/dlx.291/libdlx.a +# DLX_LINK = $(DJDIR)/bin/dlxgen.exe + +WATT32_ROOT = $(subst \,/,$(WATT_ROOT)) + + +ifeq ($(wildcard $(GCCLIB)/libgcc.a),) +check_gcclib: + @echo libgcc.a not found. Set \"$(GCCLIB)\" to \"/djgpp/lib/gcc-lib/djgpp/3.X\" +endif + + +# +# Include 32-bit driver support +# +USE_32BIT_DRIVERS = 0 + +# +# Use loadable driver modules instead of statically linking +# all drivers. +# +USE_32BIT_MODULES = 0 + +# +# Put interrupt sensitive code/data in locked sections +# Do `make clean' in all affected directories after changing this. +# +USE_SECTION_LOCKING = 0 + +# +# Set to 1 to use exception handler lib (only for me) +# +USE_EXCEPT = 0 + +CC = gcc.exe +LD = ld.exe +ASM = nasm.exe -fbin -dDEBUG +YACC = bison.exe +LEX = flex.exe + +CFLAGS = -g -gcoff -O2 -Wall -I. -I$(WATT32_ROOT)/inc + +ifeq ($(USE_EXCEPT),1) + CFLAGS += -DUSE_EXCEPT + EXC_LIB = d:/prog/mw/except/lib/libexc.a +endif + +ifeq ($(USE_SECTION_LOCKING),1) + CFLAGS += -DUSE_SECTION_LOCKING +endif + +ifeq ($(USE_32BIT_DRIVERS),1) + CFLAGS += -DUSE_32BIT_DRIVERS +endif + +%.o: %.c + $(CC) -c $(CFLAGS) $< + @echo + +%.o: %.s + $(CC) -c $(CFLAGS) -x assembler-with-cpp -o $@ $< + @echo + diff --git a/libpcap/msdos/makefile b/libpcap/msdos/makefile new file mode 100644 index 0000000000..cdb4e7cd06 --- /dev/null +++ b/libpcap/msdos/makefile @@ -0,0 +1,184 @@ +# +# Makefile for dos-libpcap. NB. This makefile requires a Borland +# compatible make tool. +# +# Targets: +# Borland C 4.0+ (DOS large model) +# Metaware HighC 3.3+ (PharLap 386|DosX) +# + +.AUTODEPEND +.SWAP + +!if "$(WATT_ROOT)" == "" +!error Environment variable "WATT_ROOT" not set. +!endif + +WATT_INC = $(WATT_ROOT)\inc + +DEFS = -DMSDOS -DDEBUG -DNDIS_DEBUG -D_U_= -Dinline= \ + -DHAVE_STRERROR -DHAVE_LIMITS_H + +ASM = tasm.exe -t -l -mx -m2 -DDEBUG + +SOURCE = grammar.c scanner.c bpf_filt.c bpf_imag.c bpf_dump.c \ + etherent.c gencode.c nametoad.c pcap-dos.c optimize.c \ + savefile.c pcap.c inet.c msdos\ndis2.c msdos\pktdrvr.c \ + missing\snprintf.c + +BORLAND_OBJ = $(SOURCE:.c=.obj) msdos\pkt_rx0.obj msdos\ndis_0.obj + +HIGHC_OBJ = $(SOURCE:.c=.o32) msdos\pkt_rx0.o32 + +all: + @echo Usage: make pcap_bc.lib or pcap_hc.lib + + +pcap_bc.lib: bcc.arg $(BORLAND_OBJ) pcap_bc + + +pcap_hc.lib: hc386.arg $(HIGHC_OBJ) + 386lib $< @&&| + -nowarn -nobackup -twocase -replace $(HIGHC_OBJ) +| + +pcap_bc: $(BORLAND_OBJ) + @tlib pcap_bc.lib /C @&&| + -+$(**:.obj=-+) +| + +.c.obj: + bcc.exe @bcc.arg -o$*.obj $*.c + +.c.o32: + hc386.exe @hc386.arg -o $*.o32 $*.c + +.asm.obj: + $(ASM) $*.asm, $*.obj + +.asm.o32: + $(ASM) -DDOSX=1 $*.asm, $*.o32 + +scanner.c: scanner.l + flex -Ppcap_ -7 -oscanner.c scanner.l + +grammar.c tokdefs.h: grammar.y + bison --name-prefix=pcap_ --yacc --defines grammar.y + - @del grammar.c + - @del tokdefs.h + ren y_tab.c grammar.c + ren y_tab.h tokdefs.h + +bcc.arg: msdos\Makefile + @copy &&| + $(DEFS) -ml -c -v -3 -O2 -po -RT- -w- + -I$(WATT_INC) -I. -I.\msdos\pm_drvr -H=$(TEMP)\bcc.sym +| $< + +hc386.arg: msdos\Makefile + @copy &&| + # -DUSE_32BIT_DRIVERS + $(DEFS) -DDOSX=1 -w3 -c -g -O5 + -I$(WATT_INC) -I. -I.\msdos\pm_drvr + -Hsuffix=.o32 + -Hnocopyr + -Hpragma=Offwarn(491,553,572) + -Hon=Recognize_library # make memcpy/strlen etc. inline + -Hoff=Behaved # turn off some optimiser warnings +| $< + +clean: + @del *.obj + @del *.o32 + @del *.lst + @del *.map + @del bcc.arg + @del hc386.arg + @del grammar.c + @del tokdefs.h + @del scanner.c + @echo Cleaned + +# +# dependencies +# +pkt_rx0.obj: msdos\pkt_rx0.asm + +bpf_filt.obj: bpf_filt.c pcap-int.h pcap.h pcap-bpf.h gnuc.h + +bpf_imag.obj: bpf_imag.c pcap-int.h pcap.h pcap-bpf.h + +bpf_dump.obj: bpf_dump.c pcap.h pcap-bpf.h + +etherent.obj: etherent.c pcap-int.h pcap.h pcap-bpf.h pcap-namedb.h + +optimize.obj: optimize.c pcap-int.h pcap.h pcap-bpf.h gencode.h + +savefile.obj: savefile.c pcap-int.h pcap.h pcap-bpf.h + +pcap.obj: pcap.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h + +inet.obj: inet.c pcap-int.h pcap.h pcap-bpf.h + +grammar.obj: grammar.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ + pf.h pcap-namedb.h + +scanner.obj: scanner.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ + pcap-namedb.h tokdefs.h + +gencode.obj: gencode.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h \ + ethertype.h nlpid.h llc.h gencode.h atmuni31.h sunatmpos.h ppp.h sll.h \ + arcnet.h pf.h pcap-namedb.h + +nametoad.obj: nametoad.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ + pcap-namedb.h ethertype.h + +pcap-dos.obj: pcap-dos.c pcap.h pcap-bpf.h pcap-dos.h pcap-int.h \ + msdos\pktdrvr.h + +pktdrvr.obj: msdos\pktdrvr.c gnuc.h pcap-dos.h pcap-int.h \ + pcap.h pcap-bpf.h msdos\pktdrvr.h msdos\pkt_stub.inc + +ndis2.obj: msdos\ndis2.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h \ + msdos\ndis2.h + +pkt_rx0.o32: msdos\pkt_rx0.asm + +bpf_filt.o32: bpf_filt.c pcap-int.h pcap.h pcap-bpf.h gnuc.h + +bpf_imag.o32: bpf_imag.c pcap-int.h pcap.h pcap-bpf.h + +bpf_dump.o32: bpf_dump.c pcap.h pcap-bpf.h + +etherent.o32: etherent.c pcap-int.h pcap.h pcap-bpf.h pcap-namedb.h + +optimize.o32: optimize.c pcap-int.h pcap.h pcap-bpf.h gencode.h + +savefile.o32: savefile.c pcap-int.h pcap.h pcap-bpf.h + +pcap.o32: pcap.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h + +inet.o32: inet.c pcap-int.h pcap.h pcap-bpf.h + +grammar.o32: grammar.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ + pf.h pcap-namedb.h + +scanner.o32: scanner.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ + pcap-namedb.h tokdefs.h + +gencode.o32: gencode.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h \ + ethertype.h nlpid.h llc.h gencode.h atmuni31.h sunatmpos.h ppp.h sll.h \ + arcnet.h pf.h pcap-namedb.h + +nametoad.o32: nametoad.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ + pcap-namedb.h ethertype.h + +pcap-dos.o32: pcap-dos.c pcap.h pcap-bpf.h pcap-dos.h pcap-int.h \ + msdos\pktdrvr.h + +pktdrvr.o32: msdos\pktdrvr.c gnuc.h pcap-dos.h pcap-int.h \ + pcap.h pcap-bpf.h msdos\pktdrvr.h msdos\pkt_stub.inc + +ndis2.o32: msdos\ndis2.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h \ + msdos\ndis2.h + diff --git a/libpcap/msdos/makefile.dj b/libpcap/msdos/makefile.dj new file mode 100644 index 0000000000..7ce58b43d1 --- /dev/null +++ b/libpcap/msdos/makefile.dj @@ -0,0 +1,152 @@ +# +# GNU Makefile for DOS-libpcap. djgpp version. +# +# Use this makefile from the libpcap root directory. +# E.g. like this: +# +# 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 + +PREREQUISITES = scanner.c grammar.c tokdefs.h version.h msdos/pkt_stub.inc + +include msdos/common.dj + +DRIVER_DIR = ./msdos/pm_drvr + +CFLAGS += -DDEBUG -DNDIS_DEBUG -DHAVE_LIMITS_H -DHAVE_STRERROR \ + -D_U_='__attribute__((unused))' -DHAVE_VERSION_H + +# CFLAGS += -Dyylval=pcap_lval -DBDEBUG -DNDEBUG + +SOURCES = grammar.c scanner.c bpf_filt.c bpf_imag.c bpf_dump.c \ + etherent.c gencode.c nametoad.c pcap-dos.c optimize.c \ + savefile.c pcap.c inet.c msdos\pktdrvr.c msdos/ndis2.c \ + missing/snprintf.c + +OBJECTS = $(notdir $(SOURCES:.c=.o)) +TEMPBIN = tmp.bin + +ifeq ($(USE_32BIT_DRIVERS),1) + PM_OBJECTS = $(addprefix $(DRIVER_DIR)/, \ + printk.o pci.o pci-scan.o bios32.o dma.o irq.o intwrap.o \ + lock.o kmalloc.o quirks.o timer.o net_init.o) + # + # Static link of drivers + # + ifeq ($(USE_32BIT_MODULES),0) + PM_OBJECTS += $(addprefix $(DRIVER_DIR)/, \ + accton.o 8390.o 3c503.o 3c509.o 3c59x.o 3c515.o \ + 3c575_cb.o 3c90x.o ne.o wd.o cs89x0.o rtl8139.o) + endif +endif + +all: libpcap.a + +ifeq ($(USE_32BIT_DRIVERS),1) +$(PM_OBJECTS): + $(MAKE) -f Makefile.dj -C $(DRIVER_DIR) $(notdir $@) +endif + +libpcap.a: version.h $(OBJECTS) $(PM_OBJECTS) + rm -f $@ + ar rs $@ $^ + +msdos/pkt_stub.inc: msdos/bin2c.exe msdos/pkt_rx1.S + $(ASM) -o $(TEMPBIN) -lmsdos/pkt_rx1.lst msdos/pkt_rx1.S + ./msdos/bin2c $(TEMPBIN) > $@ + rm -f $(TEMPBIN) + +grammar.c tokdefs.h: grammar.y + rm -f grammar.c tokdefs.h + $(YACC) --name-prefix=pcap_ --yacc --defines grammar.y + mv -f y_tab.c grammar.c + mv -f y_tab.h tokdefs.h + +version.h: ./VERSION + @echo '/* Generated from VERSION. Do not edit */' > $@ + sed -e 's/.*/static char pcap_version_string[] = "libpcap (&)";/' ./VERSION >> $@ + +scanner.c: scanner.l + $(LEX) -Ppcap_ -7 -t $^ > $@ + @echo + +msdos/bin2c.exe: msdos/bin2c.c + $(CC) $*.c -o $*.exe + +clean: + $(MAKE) -f Makefile.dj -C $(DRIVER_DIR) clean + $(MAKE) -f Makefile.dj -C libcpcap clean + rm -f $(OBJECTS) msdos/pkt_rx1.lst Makefile.bak $(PREREQUISITES) + +vclean: clean + rm -f libpcap.a msdos/bin2c.exe + +# +# Generated dependencies; Due to some hacks in gcc 2.95 and djgpp 2.03 +# we must prevent "$(DJDIR)/bin/../include/sys/version.h" from beeing +# included in dependency output (or else this makefile cannot be used on +# another machine). We therefore use a special 'specs' file during +# pre-processing. +# +MM_SPECS = specs.tmp +MAKEFILE = msdos/Makefile.dj + +depend: $(PREREQUISITES) + @echo Generating dependencies.. + @cp $(MAKEFILE) Makefile.bak + @echo "*cpp: %(cpp_cpu) %{posix:-D_POSIX_SOURCE} -remap" > $(MM_SPECS) + sed -e "/^# DO NOT DELETE THIS LINE/,$$d" < Makefile.bak > $(MAKEFILE) + echo "# DO NOT DELETE THIS LINE" >> $(MAKEFILE) + $(CC) -MM -specs=$(MM_SPECS) $(CFLAGS) $(SOURCES) >> $(MAKEFILE) + rm -f $(MM_SPECS) + +# +# Manually generated dependencies +# +msdos/pktdrvr.c: msdos/pkt_stub.inc +scanner.c: scanner.l +grammar.c tokdefs.h: grammar.y +grammar.h: grammar.y +scanner.l: pcap-int.h pcap-namedb.h gencode.h grammar.h gnuc.h +grammar.y: pcap-int.h gencode.h pcap-namedb.h gnuc.h + +# +# Automatically generated dependencies +# +# DO NOT DELETE THIS LINE +grammar.o: grammar.c pcap-int.h pcap.h pcap-bpf.h gencode.h pf.h \ + pcap-namedb.h +scanner.o: scanner.c pcap-int.h pcap.h pcap-bpf.h gencode.h pcap-namedb.h \ + tokdefs.h +bpf_filt.o: bpf_filt.c pcap-int.h pcap.h pcap-bpf.h gnuc.h +bpf_imag.o: bpf_imag.c pcap-int.h pcap.h pcap-bpf.h +bpf_dump.o: bpf_dump.c pcap.h pcap-bpf.h +etherent.o: etherent.c pcap-int.h pcap.h pcap-bpf.h pcap-namedb.h +gencode.o: gencode.c pcap-dos.h msdos/pm_drvr/lock.h pcap-int.h pcap.h \ + pcap-bpf.h ethertype.h nlpid.h llc.h gencode.h atmuni31.h sunatmpos.h \ + ppp.h sll.h arcnet.h pf.h pcap-namedb.h +nametoad.o: nametoad.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ + pcap-namedb.h ethertype.h +pcap-dos.o: pcap-dos.c msdos/pm_drvr/pmdrvr.h msdos/pm_drvr/iface.h \ + msdos/pm_drvr/lock.h msdos/pm_drvr/ioport.h pcap-dos.h pcap-int.h \ + pcap.h pcap-bpf.h msdos/pm_drvr/kmalloc.h msdos/pm_drvr/bitops.h \ + msdos/pm_drvr/timer.h msdos/pm_drvr/dma.h msdos/pm_drvr/irq.h \ + msdos/pm_drvr/printk.h msdos/pm_drvr/pci.h msdos/pm_drvr/bios32.h \ + msdos/pm_drvr/module.h msdos/pm_drvr/3c501.h msdos/pm_drvr/3c503.h \ + msdos/pm_drvr/3c509.h msdos/pm_drvr/3c59x.h msdos/pm_drvr/3c515.h \ + msdos/pm_drvr/3c90x.h msdos/pm_drvr/3c575_cb.h msdos/pm_drvr/ne.h \ + msdos/pm_drvr/wd.h msdos/pm_drvr/accton.h msdos/pm_drvr/cs89x0.h \ + msdos/pm_drvr/rtl8139.h msdos/pm_drvr/ne2k-pci.h msdos/pktdrvr.h +optimize.o: optimize.c pcap-int.h pcap.h pcap-bpf.h gencode.h +savefile.o: savefile.c pcap-int.h pcap.h pcap-bpf.h +pcap.o: pcap.c pcap-dos.h msdos/pm_drvr/lock.h pcap-int.h pcap.h \ + pcap-bpf.h +inet.o: inet.c pcap-int.h pcap.h pcap-bpf.h +pktdrvr.o: msdos/pktdrvr.c gnuc.h pcap-dos.h msdos/pm_drvr/lock.h \ + pcap-int.h pcap.h pcap-bpf.h msdos/pktdrvr.h msdos/pkt_stub.inc +ndis2.o: msdos/ndis2.c pcap-dos.h msdos/pm_drvr/lock.h pcap-int.h pcap.h \ + pcap-bpf.h msdos/ndis2.h +snprintf.o: missing/snprintf.c pcap-int.h pcap.h pcap-bpf.h diff --git a/libpcap/msdos/makefile.wc b/libpcap/msdos/makefile.wc new file mode 100644 index 0000000000..e0d5672d6e --- /dev/null +++ b/libpcap/msdos/makefile.wc @@ -0,0 +1,131 @@ +# +# Watcom Makefile for dos-libpcap. +# +# Specify MODEL = `3r' or `3s' +# Specify TARGET = `pharlap' or `dos4g' +# +# Use this makefile from the libpcap root directory. +# E.g. like this: +# +# c:\net\pcap> wmake -f msdos\makefile.wc +# + +MODEL = 3s +TARGET = dos4g + +OBJDIR = msdos\$(TARGET).w$(MODEL) +LIB = $(OBJDIR)\pcap.lib + +.EXTENSIONS: .l .y + +DEFS = -dDEBUG -dNDIS_DEBUG -d_U_= -dHAVE_LIMITS_H -dHAVE_STRERROR & + -dHAVE_SNPRINTF -dHAVE_VSNPRINTF + +CC = wcc386.exe +ASM = wasm.exe -$(MODEL) $(DEFS) -dDOSX -dDOS4GW -zq -bt=dos -fr=nul -d3 -s + +OBJS = $(OBJDIR)\grammar.obj $(OBJDIR)\scanner.obj $(OBJDIR)\pcap.obj & + $(OBJDIR)\bpf_filt.obj $(OBJDIR)\bpf_imag.obj $(OBJDIR)\bpf_dump.obj & + $(OBJDIR)\etherent.obj $(OBJDIR)\gencode.obj $(OBJDIR)\nametoad.obj & + $(OBJDIR)\pcap-dos.obj $(OBJDIR)\pktdrvr.obj $(OBJDIR)\optimize.obj & + $(OBJDIR)\savefile.obj $(OBJDIR)\inet.obj $(OBJDIR)\ndis2.obj + +CFLAGS = $(DEFS) $(YYDEFS) -I. -I$(%watt_root)\inc -I.\msdos\pm_drvr & + -$(MODEL) -mf -zff -zgf -zq -bt=dos -fr=nul -w6 -fpi & + -oilrtf -zm + +TEMPBIN = tmp.bin + +all: $(OBJDIR) $(OBJDIR)\pcap.lib + +$(OBJDIR): + - mkdir $(OBJDIR) + +$(OBJDIR)\pcap.lib: $(OBJS) wlib.arg + wlib -q -b -c $(OBJDIR)\pcap.lib @wlib.arg + +wlib.arg: msdos\makefile.wc + %create $^@ + for %f in ($(OBJS)) do %append $^@ +- %f + +$(OBJDIR)\pktdrvr.obj: msdos\pkt_stub.inc msdos\pktdrvr.c gnuc.h & + pcap-dos.h pcap-int.h pcap.h msdos\pktdrvr.h + *$(CC) $(CFLAGS) msdos\pktdrvr.c -fo=$@ + +$(OBJDIR)\ndis2.obj: msdos\ndis2.c + *$(CC) $(CFLAGS) msdos\ndis2.c -fo=$@ + +.ERASE +.c{$(OBJDIR)}.obj: + *$(CC) $(CFLAGS) $[@ -fo=$@ + +grammar.c tokdefs.h: grammar.y + bison --name-prefix=pcap_ --yacc --defines $[@ + - @del grammar.c + - @del tokdefs.h + ren y_tab.c grammar.c + ren y_tab.h tokdefs.h + +scanner.c: scanner.l + flex -Ppcap_ -7 -o$@ $[@ + +msdos\pkt_stub.inc: bin2c.exe msdos\pkt_rx1.S + nasm -fbin -dDEBUG -o $(TEMPBIN) -lmsdos\pkt_rx1.lst msdos\pkt_rx1.S + bin2c.exe $(TEMPBIN) > $@ + @del $(TEMPBIN) + +bin2c.exe: msdos\bin2c.c + wcl $[@ + +clean realclean vclean: .SYMBOLIC + for %f in (dos4g.w3r dos4g.w3s pharlap.w3r pharlap.w3s) do & + @del %f\*.obj + @del grammar.c + @del tokdefs.h + @del scanner.c + @del bin2c.exe + @del bin2c.obj + @del msdos\pkt_stub.inc + @echo Cleaned + +# +# dependencies +# +$(OBJDIR)\bpf_filt.obj: bpf_filt.c pcap-int.h pcap.h pcap-bpf.h gnuc.h + +$(OBJDIR)\bpf_imag.obj: bpf_imag.c pcap-int.h pcap.h pcap-bpf.h + +$(OBJDIR)\bpf_dump.obj: bpf_dump.c pcap.h pcap-bpf.h + +$(OBJDIR)\etherent.obj: etherent.c pcap-int.h pcap.h pcap-bpf.h pcap-nam.h + +$(OBJDIR)\optimize.obj: optimize.c pcap-int.h pcap.h pcap-bpf.h gencode.h + +$(OBJDIR)\savefile.obj: savefile.c pcap-int.h pcap.h pcap-bpf.h + +$(OBJDIR)\pcap.obj: pcap.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h + +$(OBJDIR)\inet.obj: inet.c pcap-int.h pcap.h pcap-bpf.h + +$(OBJDIR)\grammar.obj: grammar.c pcap-int.h pcap.h pcap-bpf.h gencode.h & + pf.h pcap-nam.h + +$(OBJDIR)\scanner.obj: scanner.c pcap-int.h pcap.h pcap-bpf.h gencode.h & + pcap-nam.h tokdefs.h + +$(OBJDIR)\gencode.obj: gencode.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h & + ethertyp.h nlpid.h llc.h gencode.h atmuni31.h sunatmpo.h ppp.h sll.h & + arcnet.h pf.h pcap-nam.h + +$(OBJDIR)\nametoad.obj: nametoad.c pcap-int.h pcap.h pcap-bpf.h gencode.h & + pcap-nam.h ethertyp.h + +$(OBJDIR)\pcap-dos.obj: pcap-dos.c pcap.h pcap-bpf.h pcap-dos.h pcap-int.h & + msdos\pktdrvr.h + +$(OBJDIR)\pktdrvr.obj: msdos\pktdrvr.c gnuc.h pcap-dos.h pcap-int.h & + pcap.h pcap-bpf.h msdos\pktdrvr.h msdos\pkt_stub.inc + +$(OBJDIR)\ndis2.obj: msdos\ndis2.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h & + msdos\ndis2.h + diff --git a/libpcap/msdos/ndis2.c b/libpcap/msdos/ndis2.c new file mode 100644 index 0000000000..0a5ea2a7b8 --- /dev/null +++ b/libpcap/msdos/ndis2.c @@ -0,0 +1,860 @@ +/* + * Copyright (c) 1993,1994 + * Texas A&M University. 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 Texas A&M University + * and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY 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 UNIVERSITY 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. + * + * Developers: + * David K. Hess, Douglas Lee Schales, David R. Safford + * + * Heavily modified for Metaware HighC + GNU C 2.8+ + * Gisle Vanem 1998 + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "pcap-dos.h" +#include "pcap-int.h" +#include "msdos/ndis2.h" + +#if defined(USE_NDIS2) + +/* + * Packet buffer handling + */ +extern int FreePktBuf (PktBuf *buf); +extern int EnquePktBuf (PktBuf *buf); +extern PktBuf* AllocPktBuf (void); + +/* + * Various defines + */ +#define MAX_NUM_DEBUG_STRINGS 90 +#define DEBUG_STRING_LENGTH 80 +#define STACK_POOL_SIZE 6 +#define STACK_SIZE 256 + +#define MEDIA_FDDI 1 +#define MEDIA_ETHERNET 2 +#define MEDIA_TOKEN 3 + +static int startDebug = 0; +static int stopDebug = 0; + +static DWORD droppedPackets = 0L; +static WORD frameSize = 0; +static WORD headerSize = 0; +static int mediaType = 0; +static char *lastErr = NULL; + +static BYTE debugStrings [MAX_NUM_DEBUG_STRINGS][DEBUG_STRING_LENGTH]; +static BYTE *freeStacks [STACK_POOL_SIZE]; +static int freeStackPtr = STACK_POOL_SIZE - 1; + +static ProtMan protManEntry = NULL; +static WORD protManDS = 0; +static volatile int xmitPending; + +static struct _PktBuf *txBufPending; +static struct _CardHandle *handle; +static struct _CommonChars common; +static struct _ProtocolChars protChars; +static struct _ProtDispatch lowerTable; + +static struct _FailingModules failingModules; +static struct _BindingsList bindings; + +static struct { + WORD err_num; + char *err_text; + } ndis_errlist[] = { + + { ERR_SUCCESS, + "The function completed successfully.\n" }, + + { ERR_WAIT_FOR_RELEASE, + "The ReceiveChain completed successfully but the protocol has\n" + "retained control of the buffer.\n" }, + + { ERR_REQUEST_QUEUED, + "The current request has been queued.\n" }, + + { ERR_FRAME_NOT_RECOGNIZED, + "Frame not recognized.\n" }, + + { ERR_FRAME_REJECTED, + "Frame was discarded.\n" }, + + { ERR_FORWARD_FRAME, + "Protocol wishes to forward frame to another protocol.\n" }, + + { ERR_OUT_OF_RESOURCE, + "Out of resource.\n" }, + + { ERR_INVALID_PARAMETER, + "Invalid parameter.\n" }, + + { ERR_INVALID_FUNCTION, + "Invalid function.\n" }, + + { ERR_NOT_SUPPORTED, + "Not supported.\n" }, + + { ERR_HARDWARE_ERROR, + "Hardware error.\n" }, + + { ERR_TRANSMIT_ERROR, + "The packet was not transmitted due to an error.\n" }, + + { ERR_NO_SUCH_DESTINATION, + "Token ring packet was not recognized when transmitted.\n" }, + + { ERR_BUFFER_TOO_SMALL, + "Provided buffer was too small.\n" }, + + { ERR_ALREADY_STARTED, + "Network drivers already started.\n" }, + + { ERR_INCOMPLETE_BINDING, + "Protocol driver could not complete its bindings.\n" }, + + { ERR_DRIVER_NOT_INITIALIZED, + "MAC did not initialize properly.\n" }, + + { ERR_HARDWARE_NOT_FOUND, + "Hardware not found.\n" }, + + { ERR_HARDWARE_FAILURE, + "Hardware failure.\n" }, + + { ERR_CONFIGURATION_FAILURE, + "Configuration failure.\n" }, + + { ERR_INTERRUPT_CONFLICT, + "Interrupt conflict.\n" }, + + { ERR_INCOMPATIBLE_MAC, + "The MAC is not compatible with the protocol.\n" }, + + { ERR_INITIALIZATION_FAILED, + "Initialization failed.\n" }, + + { ERR_NO_BINDING, + "Binding did not occur.\n" }, + + { ERR_NETWORK_MAY_NOT_BE_CONNECTED, + "The network may not be connected to the adapter.\n" }, + + { ERR_INCOMPATIBLE_OS_VERSION, + "The version of the operating system is incompatible with the protocol.\n" }, + + { ERR_ALREADY_REGISTERED, + "The protocol is already registered.\n" }, + + { ERR_PATH_NOT_FOUND, + "PROTMAN.EXE could not be found.\n" }, + + { ERR_INSUFFICIENT_MEMORY, + "Insufficient memory.\n" }, + + { ERR_INFO_NOT_FOUND, + "Protocol Mananger info structure is lost or corrupted.\n" }, + + { ERR_GENERAL_FAILURE, + "General failure.\n" } +}; + +/* + * Some handy macros + */ +#define PERROR(str) printf("%s (%d): %s\n", __FILE__,__LINE__,str) +#define DEBUG_RING() (debugStrings[stopDebug+1 == MAX_NUM_DEBUG_STRINGS ? \ + stopDebug = 0 : ++stopDebug]) + +/* + * needs rewrite for DOSX + */ +#define MAC_DISPATCH(hnd) ((struct _MacUpperDispatch*)(hnd)->common->upperDispatchTable) +#define MAC_STATUS(hnd) ((struct _MacStatusTable*) (hnd)->common->serviceStatus) +#define MAC_CHAR(hnd) ((struct _MacChars*) (hnd)->common->serviceChars) + +#ifdef NDIS_DEBUG + #define DEBUG0(str) printf (str) + #define DEBUG1(fmt,a) printf (fmt,a) + #define DEBUG2(fmt,a,b) printf (fmt,a,b) + #define TRACE0(str) sprintf (DEBUG_RING(),str) + #define TRACE1(fmt,a) sprintf (DEBUG_RING(),fmt,a) +#else + #define DEBUG0(str) ((void)0) + #define DEBUG1(fmt,a) ((void)0) + #define DEBUG2(fmt,a,b) ((void)0) + #define TRACE0(str) ((void)0) + #define TRACE1(fmt,a) ((void)0) +#endif + +/* + * This routine is called from both threads + */ +void NdisFreeStack (BYTE *aStack) +{ + GUARD(); + + if (freeStackPtr == STACK_POOL_SIZE - 1) + PERROR ("tried to free too many stacks"); + + freeStacks[++freeStackPtr] = aStack; + + if (freeStackPtr == 0) + TRACE0 ("freeStackPtr went positive\n"); + + UNGUARD(); +} + +/* + * This routine is called from callbacks to allocate local data + */ +BYTE *NdisAllocStack (void) +{ + BYTE *stack; + + GUARD(); + + if (freeStackPtr < 0) + { + /* Ran out of stack buffers. Return NULL which will start + * dropping packets + */ + TRACE0 ("freeStackPtr went negative\n"); + stack = 0; + } + else + stack = freeStacks[freeStackPtr--]; + + UNGUARD(); + return (stack); +} + +CALLBACK (NdisSystemRequest (DWORD param1, DWORD param2, WORD param3, + WORD opcode, WORD targetDS)) +{ + static int bindEntry = 0; + struct _CommonChars *macCommon; + volatile WORD result; + + switch (opcode) + { + case REQ_INITIATE_BIND: + macCommon = (struct _CommonChars*) param2; + if (macCommon == NULL) + { + printf ("There is an NDIS misconfiguration.\n"); + result = ERR_GENERAL_FAILURE; + break; + } + DEBUG2 ("module name %s\n" + "module type %s\n", + macCommon->moduleName, + ((MacChars*) macCommon->serviceChars)->macName); + + /* Binding to the MAC */ + result = macCommon->systemRequest ((DWORD)&common, (DWORD)&macCommon, + 0, REQ_BIND, + macCommon->moduleDS); + + if (!strcmp(bindings.moduleName[bindEntry], handle->moduleName)) + handle->common = macCommon; + else PERROR ("unknown module"); + ++bindEntry; + break; + + case REQ_INITIATE_UNBIND: + macCommon = (struct _CommonChars*) param2; + result = macCommon->systemRequest ((DWORD)&common, 0, + 0, REQ_UNBIND, + macCommon->moduleDS); + break; + + default: + result = ERR_GENERAL_FAILURE; + break; + } + ARGSUSED (param1); + ARGSUSED (param3); + ARGSUSED (targetDS); + return (result); +} + +CALLBACK (NdisRequestConfirm (WORD protId, WORD macId, WORD reqHandle, + WORD status, WORD request, WORD protDS)) +{ + ARGSUSED (protId); ARGSUSED (macId); + ARGSUSED (reqHandle); ARGSUSED (status); + ARGSUSED (request); ARGSUSED (protDS); + return (ERR_SUCCESS); +} + +CALLBACK (NdisTransmitConfirm (WORD protId, WORD macId, WORD reqHandle, + WORD status, WORD protDS)) +{ + xmitPending--; + FreePktBuf (txBufPending); /* Add passed ECB back to the free list */ + + ARGSUSED (reqHandle); + ARGSUSED (status); + ARGSUSED (protDS); + return (ERR_SUCCESS); +} + + +/* + * The primary function for receiving packets + */ +CALLBACK (NdisReceiveLookahead (WORD macId, WORD frameSize, + WORD bytesAvail, BYTE *buffer, + BYTE *indicate, WORD protDS)) +{ + int result; + PktBuf *pktBuf; + WORD bytesCopied; + struct _TDBufDescr tDBufDescr; + +#if 0 + TRACE1 ("lookahead length = %d, ", bytesAvail); + TRACE1 ("ecb = %08lX, ", *ecb); + TRACE1 ("count = %08lX\n", count); + TRACE1 ("offset = %08lX, ", offset); + TRACE1 ("timesAllowed = %d, ", timesAllowed); + TRACE1 ("packet size = %d\n", look->dataLookAheadLen); +#endif + + /* Allocate a buffer for the packet + */ + if ((pktBuf = AllocPktBuf()) == NULL) + { + droppedPackets++; + return (ERR_FRAME_REJECTED); + } + + /* + * Now kludge things. Note we will have to undo this later. This will + * make the packet contiguous after the MLID has done the requested copy. + */ + + tDBufDescr.tDDataCount = 1; + tDBufDescr.tDBufDescrRec[0].tDPtrType = NDIS_PTR_PHYSICAL; + tDBufDescr.tDBufDescrRec[0].tDDataPtr = pktBuf->buffer; + tDBufDescr.tDBufDescrRec[0].tDDataLen = pktBuf->length; + tDBufDescr.tDBufDescrRec[0].dummy = 0; + + result = MAC_DISPATCH(handle)->transferData (&bytesCopied, 0, &tDBufDescr, + handle->common->moduleDS); + pktBuf->packetLength = bytesCopied; + + if (result == ERR_SUCCESS) + EnquePktBuf(pktBuf); + else FreePktBuf (pktBuf); + + ARGSUSED (frameSize); + ARGSUSED (bytesAvail); + ARGSUSED (indicate); + ARGSUSED (protDS); + + return (ERR_SUCCESS); +} + +CALLBACK (NdisIndicationComplete (WORD macId, WORD protDS)) +{ + ARGSUSED (macId); + ARGSUSED (protDS); + + /* We don't give a hoot about these. Just return + */ + return (ERR_SUCCESS); +} + +/* + * This is the OTHER way we may receive packets + */ +CALLBACK (NdisReceiveChain (WORD macId, WORD frameSize, WORD reqHandle, + struct _RxBufDescr *rxBufDescr, + BYTE *indicate, WORD protDS)) +{ + struct _PktBuf *pktBuf; + int i; + + /* + * For now we copy the entire packet over to a PktBuf structure. This may be + * a performance hit but this routine probably isn't called very much, and + * it is a lot of work to do it otherwise. Also if it is a filter protocol + * packet we could end up sucking up MAC buffes. + */ + + if ((pktBuf = AllocPktBuf()) == NULL) + { + droppedPackets++; + return (ERR_FRAME_REJECTED); + } + pktBuf->packetLength = 0; + + /* Copy the packet to the buffer + */ + for (i = 0; i < rxBufDescr->rxDataCount; ++i) + { + struct _RxBufDescrRec *rxDescr = &rxBufDescr->rxBufDescrRec[i]; + + memcpy (pktBuf->buffer + pktBuf->packetLength, + rxDescr->rxDataPtr, rxDescr->rxDataLen); + pktBuf->packetLength += rxDescr->rxDataLen; + } + + EnquePktBuf (pktBuf); + + ARGSUSED (frameSize); + ARGSUSED (reqHandle); + ARGSUSED (indicate); + ARGSUSED (protDS); + + /* This frees up the buffer for the MAC to use + */ + return (ERR_SUCCESS); +} + +CALLBACK (NdisStatusProc (WORD macId, WORD param1, BYTE *indicate, + WORD opcode, WORD protDS)) +{ + switch (opcode) + { + case STATUS_RING_STATUS: + break; + case STATUS_ADAPTER_CHECK: + break; + case STATUS_START_RESET: + break; + case STATUS_INTERRUPT: + break; + case STATUS_END_RESET: + break; + default: + break; + } + ARGSUSED (macId); + ARGSUSED (param1); + ARGSUSED (indicate); + ARGSUSED (opcode); + ARGSUSED (protDS); + + /* We don't need to do anything about this stuff yet + */ + return (ERR_SUCCESS); +} + +/* + * Tell the NDIS driver to start the delivery of the packet + */ +int NdisSendPacket (struct _PktBuf *pktBuf, int macId) +{ + struct _TxBufDescr txBufDescr; + int result; + + xmitPending++; + txBufPending = pktBuf; /* we only have 1 pending Tx at a time */ + + txBufDescr.txImmedLen = 0; + txBufDescr.txImmedPtr = NULL; + txBufDescr.txDataCount = 1; + txBufDescr.txBufDescrRec[0].txPtrType = NDIS_PTR_PHYSICAL; + txBufDescr.txBufDescrRec[0].dummy = 0; + txBufDescr.txBufDescrRec[0].txDataLen = pktBuf->packetLength; + txBufDescr.txBufDescrRec[0].txDataPtr = pktBuf->buffer; + + result = MAC_DISPATCH(handle)->transmitChain (common.moduleId, + pktBuf->handle, + &txBufDescr, + handle->common->moduleDS); + switch (result) + { + case ERR_OUT_OF_RESOURCE: + /* Note that this should not happen but if it does there is not + * much we can do about it + */ + printf ("ERROR: transmit queue overflowed\n"); + return (0); + + case ERR_SUCCESS: + /* Everything was hunky dory and synchronous. Free up the + * packet buffer + */ + xmitPending--; + FreePktBuf (pktBuf); + return (1); + + case ERR_REQUEST_QUEUED: + /* Everything was hunky dory and asynchronous. Do nothing + */ + return (1); + + default: + printf ("Tx fail, code = %04X\n", result); + return (0); + } +} + + + +static int ndis_nerr = sizeof(ndis_errlist) / sizeof(ndis_errlist[0]); + +static char *Ndis_strerror (WORD errorCode) +{ + static char buf[30]; + int i; + + for (i = 0; i < ndis_nerr; i++) + if (errorCode == ndis_errlist[i].err_num) + return (ndis_errlist[i].err_text); + + sprintf (buf,"unknown error %d",errorCode); + return (buf); +} + + +char *NdisLastError (void) +{ + char *errStr = lastErr; + lastErr = NULL; + return (errStr); +} + +int NdisOpen (void) +{ + struct _ReqBlock reqBlock; + int result; + int ndisFd = open (NDIS_PATH, O_RDONLY); + + if (ndisFd < 0) + { + printf ("Could not open NDIS Protocol Manager device.\n"); + return (0); + } + + memset (&reqBlock, 0, sizeof(ReqBlock)); + + reqBlock.opcode = PM_GET_PROTOCOL_MANAGER_LINKAGE; + + result = NdisGetLinkage (ndisFd, (char*)&reqBlock, sizeof(ReqBlock)); + if (result != 0) + { + printf ("Could not get Protocol Manager linkage.\n"); + close (ndisFd); + return (0); + } + + close (ndisFd); + protManEntry = (ProtMan) reqBlock.pointer1; + protManDS = reqBlock.word1; + + DEBUG2 ("Entry Point = %04X:%04X\n", FP_SEG(protManEntry),FP_OFF(protManEntry)); + DEBUG1 ("ProtMan DS = %04X\n", protManDS); + return (1); +} + + +int NdisRegisterAndBind (int promis) +{ + struct _ReqBlock reqBlock; + WORD result; + + memset (&common,0,sizeof(common)); + + common.tableSize = sizeof (common); + + common.majorNdisVersion = 2; + common.minorNdisVersion = 0; + common.majorModuleVersion = 2; + common.minorModuleVersion = 0; + + /* Indicates binding from below and dynamically loaded + */ + common.moduleFlags = 0x00000006L; + + strcpy (common.moduleName, "PCAP"); + + common.protocolLevelUpper = 0xFF; + common.protocolLevelLower = 1; + common.interfaceLower = 1; +#ifdef __DJGPP__ + common.moduleDS = _dos_ds; /* the callback data segment */ +#else + common.moduleDS = _DS; +#endif + + common.systemRequest = (SystemRequest) systemRequestGlue; + common.serviceChars = (BYTE*) &protChars; + common.serviceStatus = NULL; + common.upperDispatchTable = NULL; + common.lowerDispatchTable = (BYTE*) &lowerTable; + + protChars.length = sizeof (protChars); + protChars.name[0] = 0; + protChars.type = 0; + + lowerTable.backPointer = &common; + lowerTable.requestConfirm = requestConfirmGlue; + lowerTable.transmitConfirm = transmitConfirmGlue; + lowerTable.receiveLookahead = receiveLookaheadGlue; + lowerTable.indicationComplete = indicationCompleteGlue; + lowerTable.receiveChain = receiveChainGlue; + lowerTable.status = statusGlue; + lowerTable.flags = 3; + if (promis) + lowerTable.flags |= 4; /* promiscous mode (receive everything) */ + + bindings.numBindings = 1; + strcpy (bindings.moduleName[0], handle->moduleName); + + /* Register ourselves with NDIS + */ + reqBlock.opcode = PM_REGISTER_MODULE; + reqBlock.pointer1 = (BYTE FAR*) &common; + reqBlock.pointer2 = (BYTE FAR*) &bindings; + + result = (*protManEntry) (&reqBlock, protManDS); + if (result) + { + printf ("Protman registering failed: %s\n", Ndis_strerror(result)); + return (0); + } + + /* Start the binding process + */ + reqBlock.opcode = PM_BIND_AND_START; + reqBlock.pointer1 = (BYTE FAR*) &failingModules; + + result = (*protManEntry) (&reqBlock, protManDS); + if (result) + { + printf ("Start binding failed: %s\n", Ndis_strerror(result)); + return (0); + } + return (1); +} + +static int CheckMacFeatures (CardHandle *card) +{ + DWORD serviceFlags; + BYTE _far *mediaString; + BYTE _far *mac_addr; + + DEBUG2 ("checking card features\n" + "common table address = %08lX, macId = %d\n", + card->common, card->common->moduleId); + + serviceFlags = MAC_CHAR (handle)->serviceFlags; + + if ((serviceFlags & SF_PROMISCUOUS) == 0) + { + printf ("The MAC %s does not support promiscuous mode.\n", + card->moduleName); + return (0); + } + + mediaString = MAC_CHAR (handle)->macName; + + DEBUG1 ("media type = %s\n",mediaString); + + /* Get the media type. And set the header size + */ + if (!strncmp(mediaString,"802.3",5) || + !strncmp(mediaString,"DIX",3) || + !strncmp(mediaString,"DIX+802.3",9)) + headerSize = sizeof (EthernetIIHeader); + + else if (!strncmp(mediaString,"FDDI",4)) + headerSize = sizeof (FddiHeader) + + sizeof (Ieee802Dot2SnapHeader); + else + { + printf ("Unsupported MAC type: `%s'\n", mediaString); + return (0); + } + + frameSize = MAC_CHAR (handle)->maxFrameSize; + mac_addr = MAC_CHAR (handle)->currentAddress; + + printf ("Hardware address: %02X:%02X:%02X:%02X:%02X:%02X\n", + mac_addr[0], mac_addr[1], mac_addr[2], + mac_addr[3], mac_addr[4], mac_addr[5]); + return (1); +} + +static int NdisStartMac (CardHandle *card) +{ + WORD result; + + /* Set the lookahead length + */ + result = MAC_DISPATCH(handle)->request (common.moduleId, 0, + headerSize, 0, + REQ_SET_LOOKAHEAD, + card->common->moduleDS); + + /* We assume that if we got INVALID PARAMETER then either this + * is not supported or will work anyway. NE2000 does this. + */ + if (result != ERR_SUCCESS && result != ERR_INVALID_PARAMETER) + { + DEBUG1 ("Set lookahead failed: %s\n", Ndis_strerror(result)); + return (0); + } + + /* Set the packet filter. Note that for some medias and drivers we + * must specify all three flags or the card(s) will not operate correctly. + */ + result = MAC_DISPATCH(handle)->request (common.moduleId, 0, + /* all packets */ FILTER_PROMISCUOUS | + /* packets to us */ FILTER_DIRECTED | + /* broadcasts */ FILTER_BROADCAST, + 0, REQ_SET_PACKET_FILTER, + card->common->moduleDS); + if (result != ERR_SUCCESS) + { + DEBUG1 ("Set packet filter failed: %s\n", Ndis_strerror(result)); + return (0); + } + + /* If OPEN/CLOSE supported then open the adapter + */ + if (MAC_CHAR(handle)->serviceFlags & SF_OPEN_CLOSE) + { + result = MAC_DISPATCH(handle)->request (common.moduleId, 0, 0, NULL, + REQ_OPEN_ADAPTER, + card->common->moduleDS); + if (result != ERR_SUCCESS) + { + DEBUG1 ("Opening the MAC failed: %s\n", Ndis_strerror(result)); + return (0); + } + } + return (1); +} + +void NdisShutdown (void) +{ + struct _ReqBlock reqBlock; + int result, i; + + if (!handle) + return; + + /* If the adapters support open and are open then close them + */ + if ((MAC_CHAR(handle)->serviceFlags & SF_OPEN_CLOSE) && + (MAC_STATUS(handle)->macStatus & MAC_OPEN)) + { + result = MAC_DISPATCH(handle)->request (common.moduleId, 0, 0, 0, + REQ_CLOSE_ADAPTER, + handle->common->moduleDS); + if (result != ERR_SUCCESS) + { + printf ("Closing the MAC failed: %s\n", Ndis_strerror(result)); + return; + } + } + + /* Tell the Protocol Manager to unbind and stop + */ + reqBlock.opcode = PM_UNBIND_AND_STOP; + reqBlock.pointer1 = (BYTE FAR*) &failingModules; + reqBlock.pointer2 = NULL; + + result = (*protManEntry) (&reqBlock, protManDS); + if (result) + printf ("Unbind failed: %s\n", Ndis_strerror(result)); + + for (i = 0; i < STACK_POOL_SIZE; ++i) + free (freeStacks[i] - STACK_SIZE); + + handle = NULL; +} + +int NdisInit (int promis) +{ + int i, result; + + /* Allocate the real mode stacks used for NDIS callbacks + */ + for (i = 0; i < STACK_POOL_SIZE; ++i) + { + freeStacks[i] = malloc (STACK_SIZE); + if (!freeStacks[i]) + return (0); + freeStacks[i] += STACK_SIZE; + } + + if (!NdisOpen()) + return (0); + + if (!NdisRegisterAndBind(promis)) + return (0); + + DEBUG1 ("My module id: %d\n", common.moduleId); + DEBUG1 ("Handle id; %d\n", handle->common->moduleId); + DEBUG1 ("MAC card: %-16s - ", handle->moduleName); + + atexit (NdisShutdown); + + if (!CheckMacFeatures(&handle)) + return (0); + + switch (mediaType) + { + case MEDIA_FDDI: + DEBUG0 ("Media type: FDDI"); + break; + case MEDIA_ETHERNET: + DEBUG0 ("Media type: ETHERNET"); + break; + default: + DEBUG0 ("Unsupported media.\n"); + return (0); + } + + DEBUG1 (" - Frame size: %d\n", frameSize); + + if (!NdisStartMac(&handle)) + return (0); + return (1); +} +#endif /* USE_NDIS2 */ + diff --git a/libpcap/msdos/ndis2.h b/libpcap/msdos/ndis2.h new file mode 100644 index 0000000000..dc72f4c6a8 --- /dev/null +++ b/libpcap/msdos/ndis2.h @@ -0,0 +1,559 @@ +/* + * Copyright (c) 1993,1994 + * Texas A&M University. 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 Texas A&M University + * and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY 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 UNIVERSITY 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. + * + * Developers: + * David K. Hess, Douglas Lee Schales, David R. Safford + * + * Heavily modified for Metaware HighC + GNU C 2.8+ + * Gisle Vanem 1998 + */ + +#ifndef __PCAP_NDIS_H +#define __PCAP_NDIS_H + +#if defined (__HIGHC__) + #define pascal _CC(_CALLEE_POPS_STACK & ~_REVERSE_PARMS) /* calling convention */ + #define CALLBACK(foo) pascal WORD foo + #define PAS_PTR(x,arg) typedef FAR WORD pascal (*x) arg + #define GUARD() _inline (0x9C,0xFA) /* pushfd, cli */ + #define UNGUARD() _inline (0x9D) /* popfd */ + #define FAR _far + +#elif defined(__GNUC__) + #define CALLBACK(foo) WORD foo __attribute__((stdcall)) + #define PAS_PTR(x,arg) typedef WORD (*x) arg __attribute__((stdcall)) + #define GUARD() __asm__ __volatile__ ("pushfd; cli") + #define UNGUARD() __asm__ __volatile__ ("popfd") + #define FAR + +#elif defined (__TURBOC__) + #define CALLBACK(foo) WORD pascal foo + #define PAS_PTR(x,arg) typedef WORD pascal (_far *x) arg + #define GUARD() _asm { pushf; cli } + #define UNGUARD() _asm { popf } + #define FAR _far + +#elif defined (__WATCOMC__) + #define CALLBACK(foo) WORD pascal foo + #define PAS_PTR(x,arg) typedef WORD pascal (_far *x) arg + #define GUARD() _disable() + #define UNGUARD() _enable() + #define FAR _far + +#else + #error Unsupported compiler +#endif + + +/* + * Forwards + */ +struct _ReqBlock; +struct _TxBufDescr; +struct _TDBufDescr; + +/* + * Protocol Manager API + */ +PAS_PTR (ProtMan, (struct _ReqBlock FAR*, WORD)); + +/* + * System request + */ +PAS_PTR (SystemRequest, (DWORD, DWORD, WORD, WORD, WORD)); + +/* + * MAC API + */ +PAS_PTR (TransmitChain, (WORD, WORD, struct _TxBufDescr FAR*, WORD)); +PAS_PTR (TransferData, (WORD*,WORD, struct _TDBufDescr FAR*, WORD)); +PAS_PTR (Request, (WORD, WORD, WORD, DWORD, WORD, WORD)); +PAS_PTR (ReceiveRelease,(WORD, WORD)); +PAS_PTR (IndicationOn, (WORD)); +PAS_PTR (IndicationOff, (WORD)); + + +typedef enum { + HARDWARE_NOT_INSTALLED = 0, + HARDWARE_FAILED_DIAG = 1, + HARDWARE_FAILED_CONFIG = 2, + HARDWARE_HARD_FAULT = 3, + HARDWARE_SOFT_FAULT = 4, + HARDWARE_OK = 7, + HARDWARE_MASK = 0x0007, + MAC_BOUND = 0x0008, + MAC_OPEN = 0x0010, + DIAG_IN_PROGRESS = 0x0020 + } NdisMacStatus; + +typedef enum { + STATUS_RING_STATUS = 1, + STATUS_ADAPTER_CHECK = 2, + STATUS_START_RESET = 3, + STATUS_INTERRUPT = 4, + STATUS_END_RESET = 5 + } NdisStatus; + +typedef enum { + FILTER_DIRECTED = 1, + FILTER_BROADCAST = 2, + FILTER_PROMISCUOUS = 4, + FILTER_SOURCE_ROUTE = 8 + } NdisPacketFilter; + +typedef enum { + REQ_INITIATE_DIAGNOSTICS = 1, + REQ_READ_ERROR_LOG = 2, + REQ_SET_STATION_ADDRESS = 3, + REQ_OPEN_ADAPTER = 4, + REQ_CLOSE_ADAPTER = 5, + REQ_RESET_MAC = 6, + REQ_SET_PACKET_FILTER = 7, + REQ_ADD_MULTICAST_ADDRESS = 8, + REQ_DELETE_MULTICAST_ADDRESS = 9, + REQ_UPDATE_STATISTICS = 10, + REQ_CLEAR_STATISTICS = 11, + REQ_INTERRUPT_REQUEST = 12, + REQ_SET_FUNCTIONAL_ADDRESS = 13, + REQ_SET_LOOKAHEAD = 14 + } NdisGeneralRequest; + +typedef enum { + SF_BROADCAST = 0x00000001L, + SF_MULTICAST = 0x00000002L, + SF_FUNCTIONAL = 0x00000004L, + SF_PROMISCUOUS = 0x00000008L, + SF_SOFT_ADDRESS = 0x00000010L, + SF_STATS_CURRENT = 0x00000020L, + SF_INITIATE_DIAGS = 0x00000040L, + SF_LOOPBACK = 0x00000080L, + SF_RECEIVE_CHAIN = 0x00000100L, + SF_SOURCE_ROUTING = 0x00000200L, + SF_RESET_MAC = 0x00000400L, + SF_OPEN_CLOSE = 0x00000800L, + SF_INTERRUPT_REQUEST = 0x00001000L, + SF_SOURCE_ROUTING_BRIDGE = 0x00002000L, + SF_VIRTUAL_ADDRESSES = 0x00004000L + } NdisMacServiceFlags; + +typedef enum { + REQ_INITIATE_BIND = 1, + REQ_BIND = 2, + REQ_INITIATE_PREBIND = 3, + REQ_INITIATE_UNBIND = 4, + REQ_UNBIND = 5 + } NdisSysRequest; + +typedef enum { + PM_GET_PROTOCOL_MANAGER_INFO = 1, + PM_REGISTER_MODULE = 2, + PM_BIND_AND_START = 3, + PM_GET_PROTOCOL_MANAGER_LINKAGE = 4, + PM_GET_PROTOCOL_INI_PATH = 5, + PM_REGISTER_PROTOCOL_MANAGER_INFO = 6, + PM_INIT_AND_REGISTER = 7, + PM_UNBIND_AND_STOP = 8, + PM_BIND_STATUS = 9, + PM_REGISTER_STATUS = 10 + } NdisProtManager; + + +typedef enum { + ERR_SUCCESS = 0x00, + ERR_WAIT_FOR_RELEASE = 0x01, + ERR_REQUEST_QUEUED = 0x02, + ERR_FRAME_NOT_RECOGNIZED = 0x03, + ERR_FRAME_REJECTED = 0x04, + ERR_FORWARD_FRAME = 0x05, + ERR_OUT_OF_RESOURCE = 0x06, + ERR_INVALID_PARAMETER = 0x07, + ERR_INVALID_FUNCTION = 0x08, + ERR_NOT_SUPPORTED = 0x09, + ERR_HARDWARE_ERROR = 0x0A, + ERR_TRANSMIT_ERROR = 0x0B, + ERR_NO_SUCH_DESTINATION = 0x0C, + ERR_BUFFER_TOO_SMALL = 0x0D, + ERR_ALREADY_STARTED = 0x20, + ERR_INCOMPLETE_BINDING = 0x21, + ERR_DRIVER_NOT_INITIALIZED = 0x22, + ERR_HARDWARE_NOT_FOUND = 0x23, + ERR_HARDWARE_FAILURE = 0x24, + ERR_CONFIGURATION_FAILURE = 0x25, + ERR_INTERRUPT_CONFLICT = 0x26, + ERR_INCOMPATIBLE_MAC = 0x27, + ERR_INITIALIZATION_FAILED = 0x28, + ERR_NO_BINDING = 0x29, + ERR_NETWORK_MAY_NOT_BE_CONNECTED = 0x2A, + ERR_INCOMPATIBLE_OS_VERSION = 0x2B, + ERR_ALREADY_REGISTERED = 0x2C, + ERR_PATH_NOT_FOUND = 0x2D, + ERR_INSUFFICIENT_MEMORY = 0x2E, + ERR_INFO_NOT_FOUND = 0x2F, + ERR_GENERAL_FAILURE = 0xFF + } NdisError; + +#define NDIS_PARAM_INTEGER 0 +#define NDIS_PARAM_STRING 1 + +#define NDIS_TX_BUF_LENGTH 8 +#define NDIS_TD_BUF_LENGTH 1 +#define NDIS_RX_BUF_LENGTH 8 + +#define NDIS_PTR_PHYSICAL 0 +#define NDIS_PTR_VIRTUAL 2 + +#define NDIS_PATH "PROTMAN$" + + +typedef struct _CommonChars { + WORD tableSize; + BYTE majorNdisVersion; /* 2 - Latest version */ + BYTE minorNdisVersion; /* 0 */ + WORD reserved1; + BYTE majorModuleVersion; + BYTE minorModuleVersion; + DWORD moduleFlags; + /* 0 - Binding at upper boundary supported + * 1 - Binding at lower boundary supported + * 2 - Dynamically bound. + * 3-31 - Reserved, must be zero. + */ + BYTE moduleName[16]; + BYTE protocolLevelUpper; + /* 1 - MAC + * 2 - Data Link + * 3 - Network + * 4 - Transport + * 5 - Session + * -1 - Not specified + */ + BYTE interfaceUpper; + BYTE protocolLevelLower; + /* 0 - Physical + * 1 - MAC + * 2 - Data Link + * 3 - Network + * 4 - Transport + * 5 - Session + * -1 - Not specified + */ + BYTE interfaceLower; + WORD moduleId; + WORD moduleDS; + SystemRequest systemRequest; + BYTE *serviceChars; + BYTE *serviceStatus; + BYTE *upperDispatchTable; + BYTE *lowerDispatchTable; + BYTE *reserved2; /* Must be NULL */ + BYTE *reserved3; /* Must be NULL */ + } CommonChars; + + +typedef struct _MulticastList { + WORD maxMulticastAddresses; + WORD numberMulticastAddresses; + BYTE multicastAddress[16][16]; + } MulticastList; + + +typedef struct _MacChars { + WORD tableSize; + BYTE macName[16]; + WORD addressLength; + BYTE permanentAddress[16]; + BYTE currentAddress[16]; + DWORD currentFunctionalAddress; + MulticastList *multicastList; + DWORD linkSpeed; + DWORD serviceFlags; + WORD maxFrameSize; + DWORD txBufferSize; + WORD txBufferAllocSize; + DWORD rxBufferSize; + WORD rxBufferAllocSize; + BYTE ieeeVendor[3]; + BYTE vendorAdapter; + BYTE *vendorAdapterDescription; + WORD interruptLevel; + WORD txQueueDepth; + WORD maxDataBlocks; + } MacChars; + + +typedef struct _ProtocolChars { + WORD length; + BYTE name[16]; + WORD type; + } ProtocolChars; + + +typedef struct _MacUpperDispatch { + CommonChars *backPointer; + Request request; + TransmitChain transmitChain; + TransferData transferData; + ReceiveRelease receiveRelease; + IndicationOn indicationOn; + IndicationOff indicationOff; + } MacUpperDispatch; + + +typedef struct _MacStatusTable { + WORD tableSize; + DWORD lastDiag; + DWORD macStatus; + WORD packetFilter; + BYTE *mediaSpecificStats; + DWORD lastClear; + DWORD totalFramesRx; + DWORD totalFramesCrc; + DWORD totalBytesRx; + DWORD totalDiscardBufSpaceRx; + DWORD totalMulticastRx; + DWORD totalBroadcastRx; + DWORD obsolete1[5]; + DWORD totalDiscardHwErrorRx; + DWORD totalFramesTx; + DWORD totalBytesTx; + DWORD totalMulticastTx; + DWORD totalBroadcastTx; + DWORD obsolete2[2]; + DWORD totalDiscardTimeoutTx; + DWORD totalDiscardHwErrorTx; + } MacStatusTable; + + +typedef struct _ProtDispatch { + CommonChars *backPointer; + DWORD flags; + /* 0 - handles non-LLC frames + * 1 - handles specific-LSAP LLC frames + * 2 - handles specific-LSAP LLC frames + * 3-31 - reserved must be 0 + */ + void (*requestConfirm) (void); + void (*transmitConfirm) (void); + void (*receiveLookahead) (void); + void (*indicationComplete) (void); + void (*receiveChain) (void); + void (*status) (void); + } ProtDispatch; + + +typedef struct _ReqBlock { + WORD opcode; + WORD status; + BYTE FAR *pointer1; + BYTE FAR *pointer2; + WORD word1; + } ReqBlock; + + +typedef struct _TxBufDescrRec { + BYTE txPtrType; + BYTE dummy; + WORD txDataLen; + BYTE *txDataPtr; + } TxBufDescrRec; + + +typedef struct _TxBufDescr { + WORD txImmedLen; + BYTE *txImmedPtr; + WORD txDataCount; + TxBufDescrRec txBufDescrRec[NDIS_TX_BUF_LENGTH]; + } TxBufDescr; + + +typedef struct _TDBufDescrRec { + BYTE tDPtrType; + BYTE dummy; + WORD tDDataLen; + BYTE *tDDataPtr; + } TDBufDescrRec; + + +typedef struct _TDBufDescr { + WORD tDDataCount; + TDBufDescrRec tDBufDescrRec[NDIS_TD_BUF_LENGTH]; + } TDBufDescr; + + +typedef struct _RxBufDescrRec { + WORD rxDataLen; + BYTE *rxDataPtr; + } RxBufDescrRec; + + +typedef struct _RxBufDescr { + WORD rxDataCount; + RxBufDescrRec rxBufDescrRec[NDIS_RX_BUF_LENGTH]; + } RxBufDescr; + + +typedef struct _PktBuf { + struct _PktBuf *nextLink; + struct _PktBuf *prevLink; + int handle; + int length; + int packetLength; + DWORD sequence; + BYTE *buffer; + } PktBuf; + + +typedef struct _CardHandle { + BYTE moduleName[16]; + CommonChars *common; + } CardHandle; + + +typedef struct _BindingsList { + WORD numBindings; + BYTE moduleName[2][16]; + } BindingsList; + + +typedef struct _FailingModules { + BYTE upperModuleName[16]; + BYTE lowerModuleName[16]; + } FailingModules; + + +typedef union _HardwareAddress { + BYTE bytes[6]; + WORD words[3]; + struct { + BYTE bytes[6]; + } addr; + } HardwareAddress; + + +typedef struct _FddiHeader { + BYTE frameControl; + HardwareAddress etherDestHost; + HardwareAddress etherSrcHost; + } FddiHeader; + + +typedef struct _EthernetIIHeader { + HardwareAddress etherDestHost; + HardwareAddress etherSrcHost; + WORD etherType; + } EthernetIIHeader; + + +typedef struct _Ieee802Dot5Header { + HardwareAddress etherDestHost; + HardwareAddress etherSrcHost; + BYTE routeInfo[30]; + } Ieee802Dot5Header; + + +typedef struct _Ieee802Dot2SnapHeader { + BYTE dsap; /* 0xAA */ + BYTE ssap; /* 0xAA */ + BYTE control; /* 3 */ + BYTE protocolId[5]; + } Ieee802Dot2SnapHeader; + + +/* + * Prototypes + */ +extern char *NdisLastError (void); +extern int NdisOpen (void); +extern int NdisInit (int promis); +extern int NdisRegisterAndBind (int promis); +extern void NdisShutdown (void); +extern void NdisCheckMacFeatures (struct _CardHandle *card); +extern int NdisSendPacket (struct _PktBuf *pktBuf, int macId); + +/* + * Assembly "glue" functions + */ +extern int systemRequestGlue(); +extern int requestConfirmGlue(); +extern int transmitConfirmGlue(); +extern int receiveLookaheadGlue(); +extern int indicationCompleteGlue(); +extern int receiveChainGlue(); +extern int statusGlue(); + +/* + * IOCTL function + */ +#ifdef __SMALL__ +extern int _far NdisGetLinkage (int handle, char *data, int size); +#else +extern int NdisGetLinkage (int handle, char *data, int size); +#endif + +/* + * NDIS callback handlers + */ +CALLBACK (NdisSystemRequest (DWORD,DWORD, WORD, WORD, WORD)); +CALLBACK (NdisRequestConfirm ( WORD, WORD, WORD, WORD, WORD,WORD)); +CALLBACK (NdisTransmitConfirm ( WORD, WORD, WORD, WORD, WORD)); +CALLBACK (NdisReceiveLookahead ( WORD, WORD, WORD, BYTE*, BYTE*, WORD)); +CALLBACK (NdisReceiveChain ( WORD, WORD, WORD, struct _RxBufDescr*, BYTE*, WORD)); +CALLBACK (NdisStatusProc ( WORD, WORD, BYTE*, WORD,WORD)); +CALLBACK (NdisIndicationComplete( WORD, WORD)); + +BYTE *NdisAllocStack (void); +void NdisFreeStack (BYTE*); + +#ifdef __HIGHC__ + #define RENAME_ASM_SYM(x) pragma Alias(x,"@" #x "") /* prepend `@' */ + #define RENAME_C_SYM(x) pragma Alias(x,"_" #x "") /* prepend `_' */ + + RENAME_ASM_SYM (systemRequestGlue); + RENAME_ASM_SYM (requestConfirmGlue); + RENAME_ASM_SYM (transmitConfirmGlue); + RENAME_ASM_SYM (receiveLookaheadGlue); + RENAME_ASM_SYM (indicationCompleteGlue); + RENAME_ASM_SYM (receiveChainGlue); + RENAME_ASM_SYM (statusGlue); + RENAME_ASM_SYM (NdisGetLinkage); + RENAME_C_SYM (NdisSystemRequest); + RENAME_C_SYM (NdisRequestConfirm); + RENAME_C_SYM (NdisTransmitConfirm); + RENAME_C_SYM (NdisReceiveLookahead); + RENAME_C_SYM (NdisIndicationComplete); + RENAME_C_SYM (NdisReceiveChain); + RENAME_C_SYM (NdisStatusProc); + RENAME_C_SYM (NdisAllocStack); + RENAME_C_SYM (NdisFreeStack); +#endif + +#endif diff --git a/libpcap/msdos/ndis_0.asm b/libpcap/msdos/ndis_0.asm new file mode 100644 index 0000000000..2990985fee --- /dev/null +++ b/libpcap/msdos/ndis_0.asm @@ -0,0 +1,188 @@ +PAGE 60,132 +NAME NDIS_0 + +ifdef DOSX + .386 + _TEXT SEGMENT PUBLIC DWORD USE16 'CODE' + _TEXT ENDS + _DATA SEGMENT PUBLIC DWORD USE16 'CODE' + _DATA ENDS + _TEXT32 SEGMENT PUBLIC BYTE USE32 'CODE' + _TEXT32 ENDS + CB_DSEG EQU ; DOSX is tiny-model + D_SEG EQU <_TEXT SEGMENT> + D_END EQU <_TEXT ENDS> + ASSUME CS:_TEXT,DS:_TEXT + + PUSHREGS equ + POPREGS equ + + PUBPROC macro name + align 4 + public @&name + @&name label near + endm +else + .286 + _TEXT SEGMENT PUBLIC DWORD 'CODE' + _TEXT ENDS + _DATA SEGMENT PUBLIC DWORD 'DATA' + _DATA ENDS + CB_DSEG EQU ; 16bit is small/large model + D_SEG EQU <_DATA SEGMENT> + D_END EQU <_DATA ENDS> + ASSUME CS:_TEXT,DS:_DATA + + PUSHREGS equ + POPREGS equ + + PUBPROC macro name + public _&name + _&name label far + endm +endif + +;------------------------------------------- + +D_SEG + +D_END + + +_TEXT SEGMENT + +EXTRN _NdisSystemRequest : near +EXTRN _NdisRequestConfirm : near +EXTRN _NdisTransmitConfirm : near +EXTRN _NdisReceiveLookahead : near +EXTRN _NdisIndicationComplete : near +EXTRN _NdisReceiveChain : near +EXTRN _NdisStatusProc : near +EXTRN _NdisAllocStack : near +EXTRN _NdisFreeStack : near + +; +; *ALL* interrupt threads come through this macro. +; +CALLBACK macro callbackProc, argsSize + + pushf + PUSHREGS ;; Save the registers + + push es + push ds + mov ax,CB_DSEG ;; Load DS + mov ds,ax + call _NdisAllocStack ;; Get and install a stack. + + mov bx,ss ;; Save off the old stack in other regs + mov cx,sp + mov ss,dx ;; Install the new one + mov sp,ax + push bx ;; Save the old one on to the new stack + push cx + sub sp,&argsSize ;; Allocate space for arguments on the stack + + mov ax,ss ;; Set up the destination for the move + mov es,ax + mov di,sp + mov ds,bx ;; Set up the source for the move. + mov si,cx + add si,4+6+32 + + mov cx,&argsSize ;; Move the arguments to the stack. + shr cx,1 + cld + rep movsw + + mov ax,CB_DSEG ;; Set my data segment again. + mov ds,ax + + call &callbackProc ;; Call the real callback. + pop di ;; Pop off the old stack + pop si + mov bx,ss ;; Save off the current allocated stack. + mov cx,sp + mov ss,si ;; Restore the old stack + mov sp,di + push ax ;; Save the return code + push bx ;; Free the stack. Push the pointer to it + push cx + call _NdisFreeStack + add sp,4 + pop ax ;; Get the return code back + add di,32 ;; Get a pointer to ax on the stack + mov word ptr ss:[di],ax + pop ds + pop es + + POPREGS + popf +endm + +; +; Define all of the callbacks for the NDIS procs. +; + +PUBPROC systemRequestGlue +CALLBACK _NdisSystemRequest,14 +RETF + +PUBPROC requestConfirmGlue +CALLBACK _NdisRequestConfirm,12 +RETF + +PUBPROC transmitConfirmGlue +CALLBACK _NdisTransmitConfirm,10 +RETF + +PUBPROC receiveLookaheadGlue +CALLBACK _NdisReceiveLookahead,16 +RETF + +PUBPROC indicationCompleteGlue +CALLBACK _NdisIndicationComplete,4 +RETF + +PUBPROC receiveChainGlue +CALLBACK _NdisReceiveChain,16 +RETF + +PUBPROC statusGlue +CALLBACK _NdisStatusProc,12 +RETF + +; +; int FAR NdisGetLinkage (int handle, char *data, int size); +; + +ifdef DOSX + PUBPROC NdisGetLinkage + push ebx + mov ebx, [esp+8] ; device handle + mov eax, 4402h ; IOCTRL read function + mov edx, [esp+12] ; DS:EDX -> result data + mov ecx, [esp+16] ; ECX = length + int 21h + pop ebx + jc @fail + xor eax, eax + @fail: ret + +else + PUBPROC NdisGetLinkage + enter 0, 0 + mov bx, [bp+6] + mov ax, 4402h + mov dx, [bp+8] + mov cx, [bp+12] + int 21h + jc @fail + xor ax, ax + @fail: leave + retf +endif + +ENDS + +END diff --git a/libpcap/msdos/pkt_rx0.asm b/libpcap/msdos/pkt_rx0.asm new file mode 100644 index 0000000000..94f3d098c3 --- /dev/null +++ b/libpcap/msdos/pkt_rx0.asm @@ -0,0 +1,197 @@ +PAGE 60,132 +NAME PKT_RX + +ifdef ??version ; using TASM + masm + jumps +endif + +PUBLIC _pktDrop, _pktRxBuf, _pktTxBuf, _pktTemp +PUBLIC _rxOutOfs, _rxInOfs, _PktReceiver, _pktRxEnd + +; +; these sizes MUST be equal to the sizes in PKTDRVR.H +; + +RX_BUF_SIZE = 1500 ; max message size on Ethernet +TX_BUF_SIZE = 1500 + +ifdef DOSX + .386 + NUM_RX_BUF = 32 ; # of RX element buffers + _TEXT SEGMENT PUBLIC DWORD USE16 'CODE' + _TEXT ENDS + _DATA SEGMENT PUBLIC DWORD USE16 'CODE' + _DATA ENDS + D_SEG EQU <_TEXT SEGMENT> + D_END EQU <_TEXT ENDS> + ASSUME CS:_TEXT,DS:_TEXT +else + .286 + NUM_RX_BUF = 10 + _TEXT SEGMENT PUBLIC DWORD 'CODE' + _TEXT ENDS + _DATA SEGMENT PUBLIC DWORD 'DATA' + _DATA ENDS + D_SEG EQU <_DATA SEGMENT> + D_END EQU <_DATA ENDS> + ASSUME CS:_TEXT,DS:_DATA +endif + +;------------------------------------------- + +D_SEG + +RX_ELEMENT STRUC + firstCount dw 0 ; # of bytes on 1st call + secondCount dw 0 ; # of bytes on 2nd call + handle dw 0 ; handle for upcall + destinAdr db 6 dup (0) ; packet destination address + sourceAdr db 6 dup (0) ; packet source address + protocol dw 0 ; packet protocol number + rxBuffer db RX_BUF_SIZE dup (0) ; RX buffer +ENDS + align 4 +_rxOutOfs dw offset _pktRxBuf ; ring buffer offsets +_rxInOfs dw offset _pktRxBuf ; into _pktRxBuf +_pktDrop dw 0,0 ; packet drop counter +_pktTemp db 20 dup (0) ; temp work area +_pktTxBuf db (TX_BUF_SIZE+14) dup (0) ; TX buffer +_pktRxBuf RX_ELEMENT NUM_RX_BUF dup (<>) ; RX structures + LAST_OFS = offset $ + + screenSeg dw 0B800h + newInOffset dw 0 + + fanChars db '-\|/' + fanIndex dw 0 + +D_END + +_TEXT SEGMENT + + +SHOW_RX MACRO + push es + push bx + mov bx, screenSeg + mov es, bx ;; r-mode segment of colour screen + mov di, 158 ;; upper right corner - 1 + mov bx, fanIndex + mov al, fanChars[bx] ;; get write char + mov ah, 15 ;; and white colour + stosw ;; write to screen at ES:EDI + inc fanIndex ;; update next index + and fanIndex, 3 + pop bx + pop es +ENDM + +;------------------------------------------------------------------------ +; +; This macro return ES:DI to tail of Rx queue + +ENQUEUE MACRO + LOCAL @noWrap + mov ax, _rxInOfs ;; DI = current in-offset + add ax, SIZE RX_ELEMENT ;; point to next _pktRxBuf buffer + cmp ax, LAST_OFS ;; pointing past last ? + jb @noWrap ;; no - jump + lea ax, _pktRxBuf ;; yes, point to 1st buffer + align 4 +@noWrap: cmp ax, _rxOutOfs ;; in-ofs = out-ofs ? + je @dump ;; yes, queue is full + mov di, _rxInOfs ;; ES:DI -> buffer at queue input + mov newInOffset, ax ;; remember new input offset + + ;; NOTE. rxInOfs is updated after the packet has been copied + ;; to ES:DI (= DS:SI on 2nd call) by the packet driver + +ENDM + +;------------------------------------------------------------------------ +; +; This routine gets called by the packet driver twice: +; 1st time (AX=0) it requests an address where to put the packet +; +; 2nd time (AX=1) the packet has been copied to this location (DS:SI) +; BX has client handle (stored in RX_ELEMENT.handle). +; CX has # of bytes in packet on both call. They should be equal. +; +; A test for equality is done by putting CX in _pktRxBuf [n].firstCount +; and _pktRxBuf[n].secondCount, and CL on first call in +; _pktRxBuf[n].rxBuffer[CX]. These values are checked in "PktReceive" +; (PKTDRVR.C) +; +;--------------------------------------------------------------------- + +_PktReceiver: + pushf + cli ; no distraction wanted ! + push ds + push bx +ifdef DOSX + mov bx, cs +else + mov bx, SEG _DATA +endif + mov ds, bx + mov es, bx ; ES = DS = CS or seg _DATA + pop bx ; restore handle + + cmp ax, 0 ; first call? (AX=0) + jne @post ; AX=1: second call, do post process + +ifdef DEBUG + SHOW_RX ; show that a packet is received +endif + cmp cx, RX_BUF_SIZE+14 ; size OK ? + ja @skip ; no, packet to large for us + + ENQUEUE ; ES:DI -> _pktRxBuf[n] + + mov [di].firstCount, cx ; remember the first count. + mov [di].handle, bx ; remember the handle. + add di, 6 ; ES:DI -> _pktRxBuf[n].destinAdr + pop ds + popf + retf ; far return to driver with ES:DI + + align 4 +@dump: inc _pktDrop[0] ; discard the packet on 1st call + adc _pktDrop[2], 0 ; increment packets lost + +@skip: xor di, di ; return ES:DI = NIL pointer + xor ax, ax + mov es, ax + pop ds + popf + retf + + align 4 +@post: or si, si ; DS:SI->_pktRxBuf[n][n].destinAdr + jz @discard ; make sure we don't use NULL-pointer + + sub si, 6 ; DS:SI -> _pktRxBuf[n].destinAdr + ; + ; push si + ; push [si].firstCount + ; call bpf_filter_match ; run the filter here some day? + ; add sp, 4 + ; cmp ax, 0 + ; je @discard + + mov [si].secondCount, cx + mov ax, newInOffset + mov _rxInOfs, ax ; update _pktRxBuf input offset + + align 4 +@discard:pop ds + popf + retf + +_pktRxEnd db 0 ; marker for end of r-mode code/data + +_TEXT ENDS + +END diff --git a/libpcap/msdos/pkt_rx1.s b/libpcap/msdos/pkt_rx1.s new file mode 100644 index 0000000000..b294a3695e --- /dev/null +++ b/libpcap/msdos/pkt_rx1.s @@ -0,0 +1,155 @@ +; +; This file requires NASM 0.97+ to assemble +; +; Currently used only for djgpp + DOS4GW targets +; +; these sizes MUST be equal to the sizes in PKTDRVR.H +; +%define ETH_MTU 1500 ; max data size on Ethernet +%define ETH_MIN 60 ; min/max total frame size +%define ETH_MAX (ETH_MTU+2*6+2) +%define NUM_RX_BUF 32 ; # of RX element buffers +%define RX_SIZE (ETH_MAX+6) ; sizeof(RX_ELEMENT) = 1514+6 +%idefine offset + +struc RX_ELEMENT + .firstCount resw 1 ; # of bytes on 1st call + .secondCount resw 1 ; # of bytes on 2nd call + .handle resw 1 ; handle for upcall + ; .timeStamp resw 4 ; 64-bit RDTSC value + .destinAdr resb 6 ; packet destination address + .sourceAdr resb 6 ; packet source address + .protocol resw 1 ; packet protocol number + .rxBuffer resb ETH_MTU ; RX buffer +endstruc + +;------------------------------------------- + +[org 0] ; assemble to .bin file + +_rxOutOfs dw offset _pktRxBuf ; ring buffer offsets +_rxInOfs dw offset _pktRxBuf ; into _pktRxBuf +_pktDrop dw 0,0 ; packet drop counter +_pktTemp resb 20 ; temp work area +_pktTxBuf resb (ETH_MAX) ; TX buffer +_pktRxBuf resb (RX_SIZE*NUM_RX_BUF) ; RX structures + LAST_OFS equ $ + +screenSeg dw 0B800h +newInOffset dw 0 + +fanChars db '-\|/' +fanIndex dw 0 + +%macro SHOW_RX 0 + push es + push bx + mov bx, [screenSeg] + mov es, bx ;; r-mode segment of colour screen + mov di, 158 ;; upper right corner - 1 + mov bx, [fanIndex] + mov al, [fanChars+bx] ;; get write char + mov ah, 15 ;; and white colour + cld ;; Needed? + stosw ;; write to screen at ES:EDI + inc word [fanIndex] ;; update next index + and word [fanIndex], 3 + pop bx + pop es +%endmacro + +;PutTimeStamp +; rdtsc +; mov [si].timeStamp, eax +; mov [si+4].timeStamp, edx +; ret + + +;------------------------------------------------------------------------ +; +; This routine gets called by the packet driver twice: +; 1st time (AX=0) it requests an address where to put the packet +; +; 2nd time (AX=1) the packet has been copied to this location (DS:SI) +; BX has client handle (stored in RX_ELEMENT.handle). +; CX has # of bytes in packet on both call. They should be equal. +; A test for equality is done by putting CX in _pktRxBuf [n].firstCount +; and _pktRxBuf[n].secondCount, and CL on first call in +; _pktRxBuf[n].rxBuffer[CX]. These values are checked in "PktReceive" +; (PKTDRVR.C) +; +;--------------------------------------------------------------------- + +_PktReceiver: + pushf + cli ; no distraction wanted ! + push ds + push bx + mov bx, cs + mov ds, bx + mov es, bx ; ES = DS = CS or seg _DATA + pop bx ; restore handle + + cmp ax, 0 ; first call? (AX=0) + jne @post ; AX=1: second call, do post process + +%ifdef DEBUG + SHOW_RX ; show that a packet is received +%endif + + cmp cx, ETH_MAX ; size OK ? + ja @skip ; no, too big + + mov ax, [_rxInOfs] + add ax, RX_SIZE + cmp ax, LAST_OFS + jb @noWrap + mov ax, offset _pktRxBuf +@noWrap: + cmp ax, [_rxOutOfs] + je @dump + mov di, [_rxInOfs] ; ES:DI -> _pktRxBuf[n] + mov [newInOffset], ax + + mov [di], cx ; remember firstCount. + mov [di+4], bx ; remember handle. + add di, 6 ; ES:DI -> _pktRxBuf[n].destinAdr + pop ds + popf + retf ; far return to driver with ES:DI + +@dump: add word [_pktDrop+0], 1 ; discard the packet on 1st call + adc word [_pktDrop+2], 0 ; increment packets lost + +@skip: xor di, di ; return ES:DI = NIL pointer + xor ax, ax + mov es, ax + pop ds + popf + retf + +@post: or si, si ; DS:SI->_pktRxBuf[n][n].destinAdr + jz @discard ; make sure we don't use NULL-pointer + + ; + ; push si + ; call bpf_filter_match ; run the filter here some day + ; pop si + ; cmp ax, 0 + ; je @discard + + mov [si-6+2], cx ; store _pktRxBuf[n].secondCount + mov ax, [newInOffset] + mov [_rxInOfs], ax ; update _pktRxBuf input offset + + ; call PutTimeStamp + +@discard: + pop ds + popf + retf + +_pktRxEnd db 0 ; marker for end of r-mode code/data + +END + diff --git a/libpcap/msdos/pktdrvr.c b/libpcap/msdos/pktdrvr.c new file mode 100644 index 0000000000..cd22ee6459 --- /dev/null +++ b/libpcap/msdos/pktdrvr.c @@ -0,0 +1,1436 @@ +/* + * File.........: pktdrvr.c + * + * Responsible..: Gisle Vanem, giva@bgnett.no + * + * Created......: 26.Sept 1995 + * + * Description..: Packet-driver interface for 16/32-bit C : + * Borland C/C++ 3.0+ small/large model + * Watcom C/C++ 11+, DOS4GW flat model + * Metaware HighC 3.1+ and PharLap 386|DosX + * GNU C/C++ 2.7+ and djgpp 2.x extender + * + * References...: PC/TCP Packet driver Specification. rev 1.09 + * FTP Software Inc. + * + */ + +#include +#include +#include +#include + +#include "pcap-dos.h" +#include "pcap-int.h" +#include "msdos/pktdrvr.h" + +#if (DOSX) +#define NUM_RX_BUF 32 /* # of buffers in Rx FIFO queue */ +#else +#define NUM_RX_BUF 10 +#endif + +#define DIM(x) (sizeof((x)) / sizeof(x[0])) +#define PUTS(s) do { \ + if (!pktInfo.quiet) \ + pktInfo.error ? \ + printf ("%s: %s\n", s, pktInfo.error) : \ + printf ("%s\n", pktInfo.error = s); \ + } while (0) + +#if defined(__HIGHC__) + extern UINT _mwenv; + +#elif defined(__DJGPP__) + #include + #include + #include + #include + #include + +#elif defined(__WATCOMC__) + #include + #include + extern char _Extender; + +#else + extern void far PktReceiver (void); +#endif + + +#if (DOSX & (DJGPP|DOS4GW)) + #include + + struct DPMI_regs { + DWORD r_di; + DWORD r_si; + DWORD r_bp; + DWORD reserved; + DWORD r_bx; + DWORD r_dx; + DWORD r_cx; + DWORD r_ax; + WORD r_flags; + WORD r_es, r_ds, r_fs, r_gs; + WORD r_ip, r_cs, r_sp, r_ss; + }; + + /* Data located in a real-mode segment. This becomes far at runtime + */ + typedef struct { /* must match data/code in pkt_rx1.s */ + WORD _rxOutOfs; + WORD _rxInOfs; + DWORD _pktDrop; + BYTE _pktTemp [20]; + TX_ELEMENT _pktTxBuf[1]; + RX_ELEMENT _pktRxBuf[NUM_RX_BUF]; + WORD _dummy[2]; /* screenSeg,newInOffset */ + BYTE _fanChars[4]; + WORD _fanIndex; + BYTE _PktReceiver[15]; /* starts on a paragraph (16byte) */ + } PktRealStub; + #include + + static BYTE real_stub_array [] = { + #include "pkt_stub.inc" /* generated opcode array */ + }; + + #define rxOutOfs offsetof (PktRealStub,_rxOutOfs) + #define rxInOfs offsetof (PktRealStub,_rxInOfs) + #define PktReceiver offsetof (PktRealStub,_PktReceiver [para_skip]) + #define pktDrop offsetof (PktRealStub,_pktDrop) + #define pktTemp offsetof (PktRealStub,_pktTemp) + #define pktTxBuf offsetof (PktRealStub,_pktTxBuf) + #define FIRST_RX_BUF offsetof (PktRealStub,_pktRxBuf [0]) + #define LAST_RX_BUF offsetof (PktRealStub,_pktRxBuf [NUM_RX_BUF-1]) + +#else + extern WORD rxOutOfs; /* offsets into pktRxBuf FIFO queue */ + extern WORD rxInOfs; + extern DWORD pktDrop; /* # packets dropped in PktReceiver() */ + extern BYTE pktRxEnd; /* marks the end of r-mode code/data */ + + extern RX_ELEMENT pktRxBuf [NUM_RX_BUF]; /* PktDrvr Rx buffers */ + extern TX_ELEMENT pktTxBuf; /* PktDrvr Tx buffer */ + extern char pktTemp[20]; /* PktDrvr temp area */ + + #define FIRST_RX_BUF (WORD) &pktRxBuf [0] + #define LAST_RX_BUF (WORD) &pktRxBuf [NUM_RX_BUF-1] +#endif + + +#ifdef __BORLANDC__ /* Use Borland's inline functions */ + #define memcpy __memcpy__ + #define memcmp __memcmp__ + #define memset __memset__ +#endif + + +#if (DOSX & PHARLAP) + extern void PktReceiver (void); /* in pkt_rx0.asm */ + static int RealCopy (ULONG, ULONG, REALPTR*, FARPTR*, USHORT*); + + #undef FP_SEG + #undef FP_OFF + #define FP_OFF(x) ((WORD)(x)) + #define FP_SEG(x) ((WORD)(realBase >> 16)) + #define DOS_ADDR(s,o) (((DWORD)(s) << 16) + (WORD)(o)) + #define r_ax eax + #define r_bx ebx + #define r_dx edx + #define r_cx ecx + #define r_si esi + #define r_di edi + #define r_ds ds + #define r_es es + LOCAL FARPTR protBase; + LOCAL REALPTR realBase; + LOCAL WORD realSeg; /* DOS para-address of allocated area */ + LOCAL SWI_REGS reg; + + static WORD _far *rxOutOfsFp, *rxInOfsFp; + +#elif (DOSX & DJGPP) + static _go32_dpmi_seginfo rm_mem; + static __dpmi_regs reg; + static DWORD realBase; + static int para_skip = 0; + + #define DOS_ADDR(s,o) (((WORD)(s) << 4) + (o)) + #define r_ax x.ax + #define r_bx x.bx + #define r_dx x.dx + #define r_cx x.cx + #define r_si x.si + #define r_di x.di + #define r_ds x.ds + #define r_es x.es + +#elif (DOSX & DOS4GW) + LOCAL struct DPMI_regs reg; + LOCAL WORD rm_base_seg, rm_base_sel; + LOCAL DWORD realBase; + LOCAL int para_skip = 0; + + LOCAL DWORD dpmi_get_real_vector (int intr); + LOCAL WORD dpmi_real_malloc (int size, WORD *selector); + LOCAL void dpmi_real_free (WORD selector); + #define DOS_ADDR(s,o) (((DWORD)(s) << 4) + (WORD)(o)) + +#else /* real-mode Borland etc. */ + static struct { + WORD r_ax, r_bx, r_cx, r_dx, r_bp; + WORD r_si, r_di, r_ds, r_es, r_flags; + } reg; +#endif + +#ifdef __HIGHC__ + #pragma Alias (pktDrop, "_pktDrop") + #pragma Alias (pktRxBuf, "_pktRxBuf") + #pragma Alias (pktTxBuf, "_pktTxBuf") + #pragma Alias (pktTemp, "_pktTemp") + #pragma Alias (rxOutOfs, "_rxOutOfs") + #pragma Alias (rxInOfs, "_rxInOfs") + #pragma Alias (pktRxEnd, "_pktRxEnd") + #pragma Alias (PktReceiver,"_PktReceiver") +#endif + + +PUBLIC PKT_STAT pktStat; /* statistics for packets */ +PUBLIC PKT_INFO pktInfo; /* packet-driver information */ + +PUBLIC PKT_RX_MODE receiveMode = PDRX_DIRECT; +PUBLIC ETHER myAddress = { 0, 0, 0, 0, 0, 0 }; +PUBLIC ETHER ethBroadcast = { 255,255,255,255,255,255 }; + +LOCAL struct { /* internal statistics */ + DWORD tooSmall; /* size < ETH_MIN */ + DWORD tooLarge; /* size > ETH_MAX */ + DWORD badSync; /* count_1 != count_2 */ + DWORD wrongHandle; /* upcall to wrong handle */ + } intStat; + +/***************************************************************************/ + +PUBLIC const char *PktGetErrorStr (int errNum) +{ + static const char *errStr[] = { + "", + "Invalid handle number", + "No interfaces of specified class found", + "No interfaces of specified type found", + "No interfaces of specified number found", + "Bad packet type specified", + "Interface does not support multicast", + "Packet driver cannot terminate", + "Invalid receiver mode specified", + "Insufficient memory space", + "Type previously accessed, and not released", + "Command out of range, or not implemented", + "Cannot send packet (usually hardware error)", + "Cannot change hardware address ( > 1 handle open)", + "Hardware address has bad length or format", + "Cannot reset interface (more than 1 handle open)", + "Bad Check-sum", + "Bad size", + "Bad sync" , + "Source hit" + }; + + if (errNum < 0 || errNum >= DIM(errStr)) + return ("Unknown driver error."); + return (errStr [errNum]); +} + +/**************************************************************************/ + +PUBLIC const char *PktGetClassName (WORD class) +{ + switch (class) + { + case PD_ETHER: + return ("DIX-Ether"); + case PD_PRONET10: + return ("ProNET-10"); + case PD_IEEE8025: + return ("IEEE 802.5"); + case PD_OMNINET: + return ("OmniNet"); + case PD_APPLETALK: + return ("AppleTalk"); + case PD_SLIP: + return ("SLIP"); + case PD_STARTLAN: + return ("StartLAN"); + case PD_ARCNET: + return ("ArcNet"); + case PD_AX25: + return ("AX.25"); + case PD_KISS: + return ("KISS"); + case PD_IEEE8023_2: + return ("IEEE 802.3 w/802.2 hdr"); + case PD_FDDI8022: + return ("FDDI w/802.2 hdr"); + case PD_X25: + return ("X.25"); + case PD_LANstar: + return ("LANstar"); + case PD_PPP: + return ("PPP"); + default: + return ("unknown"); + } +} + +/**************************************************************************/ + +PUBLIC char const *PktRXmodeStr (PKT_RX_MODE mode) +{ + static const char *modeStr [] = { + "Receiver turned off", + "Receive only directly addressed packets", + "Receive direct & broadcast packets", + "Receive direct,broadcast and limited multicast packets", + "Receive direct,broadcast and all multicast packets", + "Receive all packets (promiscuouos mode)" + }; + + if (mode > DIM(modeStr)) + return ("??"); + return (modeStr [mode-1]); +} + +/**************************************************************************/ + +LOCAL __inline BOOL PktInterrupt (void) +{ + BOOL okay; + +#if (DOSX & PHARLAP) + _dx_real_int ((UINT)pktInfo.intr, ®); + okay = ((reg.flags & 1) == 0); /* OK if carry clear */ + +#elif (DOSX & DJGPP) + __dpmi_int ((int)pktInfo.intr, ®); + okay = ((reg.x.flags & 1) == 0); + +#elif (DOSX & DOS4GW) + union REGS r; + struct SREGS s; + + memset (&r, 0, sizeof(r)); + segread (&s); + r.w.ax = 0x300; + r.x.ebx = pktInfo.intr; + r.w.cx = 0; + s.es = FP_SEG (®); + r.x.edi = FP_OFF (®); + reg.r_flags = 0; + reg.r_ss = reg.r_sp = 0; /* DPMI host provides stack */ + + int386x (0x31, &r, &r, &s); + okay = (!r.w.cflag); + +#else + reg.r_flags = 0; + intr (pktInfo.intr, (struct REGPACK*)®); + okay = ((reg.r_flags & 1) == 0); +#endif + + if (okay) + pktInfo.error = NULL; + else pktInfo.error = PktGetErrorStr (reg.r_dx >> 8); + return (okay); +} + +/**************************************************************************/ + +/* + * Search for packet driver at interrupt 60h through 80h. If ASCIIZ + * string "PKT DRVR" found at offset 3 in the interrupt handler, return + * interrupt number, else return zero in pktInfo.intr + */ +PUBLIC BOOL PktSearchDriver (void) +{ + BYTE intr = 0x20; + BOOL found = FALSE; + + while (!found && intr < 0xFF) + { + static char str[12]; /* 3 + strlen("PKT DRVR") */ + static char pktStr[9] = "PKT DRVR"; /* ASCIIZ string at ofs 3 */ + DWORD rp; /* in interrupt routine */ + +#if (DOSX & PHARLAP) + _dx_rmiv_get (intr, &rp); + ReadRealMem (&str, (REALPTR)rp, sizeof(str)); + +#elif (DOSX & DJGPP) + __dpmi_raddr realAdr; + __dpmi_get_real_mode_interrupt_vector (intr, &realAdr); + rp = (realAdr.segment << 4) + realAdr.offset16; + dosmemget (rp, sizeof(str), &str); + +#elif (DOSX & DOS4GW) + rp = dpmi_get_real_vector (intr); + memcpy (&str, (void*)rp, sizeof(str)); + +#else + _fmemcpy (&str, getvect(intr), sizeof(str)); +#endif + + found = memcmp (&str[3],&pktStr,sizeof(pktStr)) == 0; + intr++; + } + pktInfo.intr = (found ? intr-1 : 0); + return (found); +} + + +/**************************************************************************/ + +static BOOL PktSetAccess (void) +{ + reg.r_ax = 0x0200 + pktInfo.class; + reg.r_bx = 0xFFFF; + reg.r_dx = 0; + reg.r_cx = 0; + +#if (DOSX & PHARLAP) + reg.ds = 0; + reg.esi = 0; + reg.es = RP_SEG (realBase); + reg.edi = (WORD) &PktReceiver; + +#elif (DOSX & DJGPP) + reg.x.ds = 0; + reg.x.si = 0; + reg.x.es = rm_mem.rm_segment; + reg.x.di = PktReceiver; + +#elif (DOSX & DOS4GW) + reg.r_ds = 0; + reg.r_si = 0; + reg.r_es = rm_base_seg; + reg.r_di = PktReceiver; + +#else + reg.r_ds = 0; + reg.r_si = 0; + reg.r_es = FP_SEG (&PktReceiver); + reg.r_di = FP_OFF (&PktReceiver); +#endif + + if (!PktInterrupt()) + return (FALSE); + + pktInfo.handle = reg.r_ax; + return (TRUE); +} + +/**************************************************************************/ + +PUBLIC BOOL PktReleaseHandle (WORD handle) +{ + reg.r_ax = 0x0300; + reg.r_bx = handle; + return PktInterrupt(); +} + +/**************************************************************************/ + +PUBLIC BOOL PktTransmit (const void *eth, int len) +{ + if (len > ETH_MTU) + return (FALSE); + + reg.r_ax = 0x0400; /* Function 4, send pkt */ + reg.r_cx = len; /* total size of frame */ + +#if (DOSX & DJGPP) + dosmemput (eth, len, realBase+pktTxBuf); + reg.x.ds = rm_mem.rm_segment; /* DOS data segment and */ + reg.x.si = pktTxBuf; /* DOS offset to buffer */ + +#elif (DOSX & DOS4GW) + memcpy ((void*)(realBase+pktTxBuf), eth, len); + reg.r_ds = rm_base_seg; + reg.r_si = pktTxBuf; + +#elif (DOSX & PHARLAP) + memcpy (&pktTxBuf, eth, len); + reg.r_ds = FP_SEG (&pktTxBuf); + reg.r_si = FP_OFF (&pktTxBuf); + +#else + reg.r_ds = FP_SEG (eth); + reg.r_si = FP_OFF (eth); +#endif + + return PktInterrupt(); +} + +/**************************************************************************/ + +#if (DOSX & (DJGPP|DOS4GW)) +LOCAL __inline BOOL CheckElement (RX_ELEMENT *rx) +#else +LOCAL __inline BOOL CheckElement (RX_ELEMENT _far *rx) +#endif +{ + WORD count_1, count_2; + + /* + * We got an upcall to the same RMCB with wrong handle. + * This can happen if we failed to release handle at program exit + */ + if (rx->handle != pktInfo.handle) + { + pktInfo.error = "Wrong handle"; + intStat.wrongHandle++; + PktReleaseHandle (rx->handle); + return (FALSE); + } + count_1 = rx->firstCount; + count_2 = rx->secondCount; + + if (count_1 != count_2) + { + pktInfo.error = "Bad sync"; + intStat.badSync++; + return (FALSE); + } + if (count_1 > ETH_MAX) + { + pktInfo.error = "Large esize"; + intStat.tooLarge++; + return (FALSE); + } +#if 0 + if (count_1 < ETH_MIN) + { + pktInfo.error = "Small esize"; + intStat.tooSmall++; + return (FALSE); + } +#endif + return (TRUE); +} + +/**************************************************************************/ + +PUBLIC BOOL PktTerminHandle (WORD handle) +{ + reg.r_ax = 0x0500; + reg.r_bx = handle; + return PktInterrupt(); +} + +/**************************************************************************/ + +PUBLIC BOOL PktResetInterface (WORD handle) +{ + reg.r_ax = 0x0700; + reg.r_bx = handle; + return PktInterrupt(); +} + +/**************************************************************************/ + +PUBLIC BOOL PktSetReceiverMode (PKT_RX_MODE mode) +{ + if (pktInfo.class == PD_SLIP || pktInfo.class == PD_PPP) + return (TRUE); + + reg.r_ax = 0x1400; + reg.r_bx = pktInfo.handle; + reg.r_cx = (WORD)mode; + + if (!PktInterrupt()) + return (FALSE); + + receiveMode = mode; + return (TRUE); +} + +/**************************************************************************/ + +PUBLIC BOOL PktGetReceiverMode (PKT_RX_MODE *mode) +{ + reg.r_ax = 0x1500; + reg.r_bx = pktInfo.handle; + + if (!PktInterrupt()) + return (FALSE); + + *mode = reg.r_ax; + return (TRUE); +} + +/**************************************************************************/ + +static PKT_STAT initialStat; /* statistics at startup */ +static BOOL resetStat = FALSE; /* statistics reset ? */ + +PUBLIC BOOL PktGetStatistics (WORD handle) +{ + reg.r_ax = 0x1800; + reg.r_bx = handle; + + if (!PktInterrupt()) + return (FALSE); + +#if (DOSX & PHARLAP) + ReadRealMem (&pktStat, DOS_ADDR(reg.ds,reg.esi), sizeof(pktStat)); + +#elif (DOSX & DJGPP) + dosmemget (DOS_ADDR(reg.x.ds,reg.x.si), sizeof(pktStat), &pktStat); + +#elif (DOSX & DOS4GW) + memcpy (&pktStat, (void*)DOS_ADDR(reg.r_ds,reg.r_si), sizeof(pktStat)); + +#else + _fmemcpy (&pktStat, MK_FP(reg.r_ds,reg.r_si), sizeof(pktStat)); +#endif + + return (TRUE); +} + +/**************************************************************************/ + +PUBLIC BOOL PktSessStatistics (WORD handle) +{ + if (!PktGetStatistics(pktInfo.handle)) + return (FALSE); + + if (resetStat) + { + pktStat.inPackets -= initialStat.inPackets; + pktStat.outPackets -= initialStat.outPackets; + pktStat.inBytes -= initialStat.inBytes; + pktStat.outBytes -= initialStat.outBytes; + pktStat.inErrors -= initialStat.inErrors; + pktStat.outErrors -= initialStat.outErrors; + pktStat.outErrors -= initialStat.outErrors; + pktStat.lost -= initialStat.lost; + } + return (TRUE); +} + +/**************************************************************************/ + +PUBLIC BOOL PktResetStatistics (WORD handle) +{ + if (!PktGetStatistics(pktInfo.handle)) + return (FALSE); + + memcpy (&initialStat, &pktStat, sizeof(initialStat)); + resetStat = TRUE; + return (TRUE); +} + +/**************************************************************************/ + +PUBLIC BOOL PktGetAddress (ETHER *addr) +{ + reg.r_ax = 0x0600; + reg.r_bx = pktInfo.handle; + reg.r_cx = sizeof (*addr); + +#if (DOSX & DJGPP) + reg.x.es = rm_mem.rm_segment; + reg.x.di = pktTemp; +#elif (DOSX & DOS4GW) + reg.r_es = rm_base_seg; + reg.r_di = pktTemp; +#else + reg.r_es = FP_SEG (&pktTemp); + reg.r_di = FP_OFF (&pktTemp); /* ES:DI = address for result */ +#endif + + if (!PktInterrupt()) + return (FALSE); + +#if (DOSX & PHARLAP) + ReadRealMem (addr, realBase + (WORD)&pktTemp, sizeof(*addr)); + +#elif (DOSX & DJGPP) + dosmemget (realBase+pktTemp, sizeof(*addr), addr); + +#elif (DOSX & DOS4GW) + memcpy (addr, (void*)(realBase+pktTemp), sizeof(*addr)); + +#else + memcpy ((void*)addr, &pktTemp, sizeof(*addr)); +#endif + + return (TRUE); +} + +/**************************************************************************/ + +PUBLIC BOOL PktSetAddress (const ETHER *addr) +{ + /* copy addr to real-mode scrath area */ + +#if (DOSX & PHARLAP) + WriteRealMem (realBase + (WORD)&pktTemp, (void*)addr, sizeof(*addr)); + +#elif (DOSX & DJGPP) + dosmemput (addr, sizeof(*addr), realBase+pktTemp); + +#elif (DOSX & DOS4GW) + memcpy ((void*)(realBase+pktTemp), addr, sizeof(*addr)); + +#else + memcpy (&pktTemp, (void*)addr, sizeof(*addr)); +#endif + + reg.r_ax = 0x1900; + reg.r_cx = sizeof (*addr); /* address length */ + +#if (DOSX & DJGPP) + reg.x.es = rm_mem.rm_segment; /* DOS offset to param */ + reg.x.di = pktTemp; /* DOS segment to param */ +#elif (DOSX & DOS4GW) + reg.r_es = rm_base_seg; + reg.r_di = pktTemp; +#else + reg.r_es = FP_SEG (&pktTemp); + reg.r_di = FP_OFF (&pktTemp); +#endif + + return PktInterrupt(); +} + +/**************************************************************************/ + +PUBLIC BOOL PktGetDriverInfo (void) +{ + pktInfo.majVer = 0; + pktInfo.minVer = 0; + memset (&pktInfo.name, 0, sizeof(pktInfo.name)); + reg.r_ax = 0x01FF; + reg.r_bx = 0; + + if (!PktInterrupt()) + return (FALSE); + + pktInfo.number = reg.r_cx & 0xFF; + pktInfo.class = reg.r_cx >> 8; +#if 0 + pktInfo.minVer = reg.r_bx % 10; + pktInfo.majVer = reg.r_bx / 10; +#else + pktInfo.majVer = reg.r_bx; // !! +#endif + pktInfo.funcs = reg.r_ax & 0xFF; + pktInfo.type = reg.r_dx & 0xFF; + +#if (DOSX & PHARLAP) + ReadRealMem (&pktInfo.name, DOS_ADDR(reg.ds,reg.esi), sizeof(pktInfo.name)); + +#elif (DOSX & DJGPP) + dosmemget (DOS_ADDR(reg.x.ds,reg.x.si), sizeof(pktInfo.name), &pktInfo.name); + +#elif (DOSX & DOS4GW) + memcpy (&pktInfo.name, (void*)DOS_ADDR(reg.r_ds,reg.r_si), sizeof(pktInfo.name)); + +#else + _fmemcpy (&pktInfo.name, MK_FP(reg.r_ds,reg.r_si), sizeof(pktInfo.name)); +#endif + return (TRUE); +} + +/**************************************************************************/ + +PUBLIC BOOL PktGetDriverParam (void) +{ + reg.r_ax = 0x0A00; + + if (!PktInterrupt()) + return (FALSE); + +#if (DOSX & PHARLAP) + ReadRealMem (&pktInfo.majVer, DOS_ADDR(reg.es,reg.edi), PKT_PARAM_SIZE); + +#elif (DOSX & DJGPP) + dosmemget (DOS_ADDR(reg.x.es,reg.x.di), PKT_PARAM_SIZE, &pktInfo.majVer); + +#elif (DOSX & DOS4GW) + memcpy (&pktInfo.majVer, (void*)DOS_ADDR(reg.r_es,reg.r_di), PKT_PARAM_SIZE); + +#else + _fmemcpy (&pktInfo.majVer, MK_FP(reg.r_es,reg.r_di), PKT_PARAM_SIZE); +#endif + return (TRUE); +} + +/**************************************************************************/ + +#if (DOSX & PHARLAP) + PUBLIC int PktReceive (BYTE *buf, int max) + { + WORD inOfs = *rxInOfsFp; + WORD outOfs = *rxOutOfsFp; + + if (outOfs != inOfs) + { + RX_ELEMENT _far *head = (RX_ELEMENT _far*)(protBase+outOfs); + int size, len = max; + + if (CheckElement(head)) + { + size = min (head->firstCount, sizeof(RX_ELEMENT)); + len = min (size, max); + _fmemcpy (buf, &head->destin, len); + } + else + size = -1; + + outOfs += sizeof (RX_ELEMENT); + if (outOfs > LAST_RX_BUF) + outOfs = FIRST_RX_BUF; + *rxOutOfsFp = outOfs; + return (size); + } + return (0); + } + + PUBLIC void PktQueueBusy (BOOL busy) + { + *rxOutOfsFp = busy ? (*rxInOfsFp + sizeof(RX_ELEMENT)) : *rxInOfsFp; + if (*rxOutOfsFp > LAST_RX_BUF) + *rxOutOfsFp = FIRST_RX_BUF; + *(DWORD _far*)(protBase + (WORD)&pktDrop) = 0; + } + + PUBLIC WORD PktBuffersUsed (void) + { + WORD inOfs = *rxInOfsFp; + WORD outOfs = *rxOutOfsFp; + + if (inOfs >= outOfs) + return (inOfs - outOfs) / sizeof(RX_ELEMENT); + return (NUM_RX_BUF - (outOfs - inOfs) / sizeof(RX_ELEMENT)); + } + + PUBLIC DWORD PktRxDropped (void) + { + return (*(DWORD _far*)(protBase + (WORD)&pktDrop)); + } + +#elif (DOSX & DJGPP) + PUBLIC int PktReceive (BYTE *buf, int max) + { + WORD ofs = _farpeekw (_dos_ds, realBase+rxOutOfs); + + if (ofs != _farpeekw (_dos_ds, realBase+rxInOfs)) + { + RX_ELEMENT head; + int size, len = max; + + head.firstCount = _farpeekw (_dos_ds, realBase+ofs); + head.secondCount = _farpeekw (_dos_ds, realBase+ofs+2); + head.handle = _farpeekw (_dos_ds, realBase+ofs+4); + + if (CheckElement(&head)) + { + size = min (head.firstCount, sizeof(RX_ELEMENT)); + len = min (size, max); + dosmemget (realBase+ofs+6, len, buf); + } + else + size = -1; + + ofs += sizeof (RX_ELEMENT); + if (ofs > LAST_RX_BUF) + _farpokew (_dos_ds, realBase+rxOutOfs, FIRST_RX_BUF); + else _farpokew (_dos_ds, realBase+rxOutOfs, ofs); + return (size); + } + return (0); + } + + PUBLIC void PktQueueBusy (BOOL busy) + { + WORD ofs; + + disable(); + ofs = _farpeekw (_dos_ds, realBase+rxInOfs); + if (busy) + ofs += sizeof (RX_ELEMENT); + + if (ofs > LAST_RX_BUF) + _farpokew (_dos_ds, realBase+rxOutOfs, FIRST_RX_BUF); + else _farpokew (_dos_ds, realBase+rxOutOfs, ofs); + _farpokel (_dos_ds, realBase+pktDrop, 0UL); + enable(); + } + + PUBLIC WORD PktBuffersUsed (void) + { + WORD inOfs, outOfs; + + disable(); + inOfs = _farpeekw (_dos_ds, realBase+rxInOfs); + outOfs = _farpeekw (_dos_ds, realBase+rxOutOfs); + enable(); + if (inOfs >= outOfs) + return (inOfs - outOfs) / sizeof(RX_ELEMENT); + return (NUM_RX_BUF - (outOfs - inOfs) / sizeof(RX_ELEMENT)); + } + + PUBLIC DWORD PktRxDropped (void) + { + return _farpeekl (_dos_ds, realBase+pktDrop); + } + +#elif (DOSX & DOS4GW) + PUBLIC int PktReceive (BYTE *buf, int max) + { + WORD ofs = *(WORD*) (realBase+rxOutOfs); + + if (ofs != *(WORD*) (realBase+rxInOfs)) + { + RX_ELEMENT head; + int size, len = max; + + head.firstCount = *(WORD*) (realBase+ofs); + head.secondCount = *(WORD*) (realBase+ofs+2); + head.handle = *(WORD*) (realBase+ofs+4); + + if (CheckElement(&head)) + { + size = min (head.firstCount, sizeof(RX_ELEMENT)); + len = min (size, max); + memcpy (buf, (const void*)(realBase+ofs+6), len); + } + else + size = -1; + + ofs += sizeof (RX_ELEMENT); + if (ofs > LAST_RX_BUF) + *(WORD*) (realBase+rxOutOfs) = FIRST_RX_BUF; + else *(WORD*) (realBase+rxOutOfs) = ofs; + return (size); + } + return (0); + } + + PUBLIC void PktQueueBusy (BOOL busy) + { + WORD ofs; + + _disable(); + ofs = *(WORD*) (realBase+rxInOfs); + if (busy) + ofs += sizeof (RX_ELEMENT); + + if (ofs > LAST_RX_BUF) + *(WORD*) (realBase+rxOutOfs) = FIRST_RX_BUF; + else *(WORD*) (realBase+rxOutOfs) = ofs; + *(DWORD*) (realBase+pktDrop) = 0UL; + _enable(); + } + + PUBLIC WORD PktBuffersUsed (void) + { + WORD inOfs, outOfs; + + _disable(); + inOfs = *(WORD*) (realBase+rxInOfs); + outOfs = *(WORD*) (realBase+rxOutOfs); + _enable(); + if (inOfs >= outOfs) + return (inOfs - outOfs) / sizeof(RX_ELEMENT); + return (NUM_RX_BUF - (outOfs - inOfs) / sizeof(RX_ELEMENT)); + } + + PUBLIC DWORD PktRxDropped (void) + { + return *(DWORD*) (realBase+pktDrop); + } + +#else /* real-mode small/large model */ + + PUBLIC int PktReceive (BYTE *buf, int max) + { + if (rxOutOfs != rxInOfs) + { + RX_ELEMENT far *head = (RX_ELEMENT far*) MK_FP (_DS,rxOutOfs); + int size, len = max; + + if (CheckElement(head)) + { + size = min (head->firstCount, sizeof(RX_ELEMENT)); + len = min (size, max); + _fmemcpy (buf, &head->destin, len); + } + else + size = -1; + + rxOutOfs += sizeof (RX_ELEMENT); + if (rxOutOfs > LAST_RX_BUF) + rxOutOfs = FIRST_RX_BUF; + return (size); + } + return (0); + } + + PUBLIC void PktQueueBusy (BOOL busy) + { + rxOutOfs = busy ? (rxInOfs + sizeof(RX_ELEMENT)) : rxInOfs; + if (rxOutOfs > LAST_RX_BUF) + rxOutOfs = FIRST_RX_BUF; + pktDrop = 0L; + } + + PUBLIC WORD PktBuffersUsed (void) + { + WORD inOfs = rxInOfs; + WORD outOfs = rxOutOfs; + + if (inOfs >= outOfs) + return ((inOfs - outOfs) / sizeof(RX_ELEMENT)); + return (NUM_RX_BUF - (outOfs - inOfs) / sizeof(RX_ELEMENT)); + } + + PUBLIC DWORD PktRxDropped (void) + { + return (pktDrop); + } +#endif + +/**************************************************************************/ + +LOCAL __inline void PktFreeMem (void) +{ +#if (DOSX & PHARLAP) + if (realSeg) + { + _dx_real_free (realSeg); + realSeg = 0; + } +#elif (DOSX & DJGPP) + if (rm_mem.rm_segment) + { + unsigned ofs; /* clear the DOS-mem to prevent further upcalls */ + + for (ofs = 0; ofs < 16 * rm_mem.size / 4; ofs += 4) + _farpokel (_dos_ds, realBase + ofs, 0); + _go32_dpmi_free_dos_memory (&rm_mem); + rm_mem.rm_segment = 0; + } +#elif (DOSX & DOS4GW) + if (rm_base_sel) + { + dpmi_real_free (rm_base_sel); + rm_base_sel = 0; + } +#endif +} + +/**************************************************************************/ + +PUBLIC BOOL PktExitDriver (void) +{ + if (pktInfo.handle) + { + if (!PktSetReceiverMode(PDRX_BROADCAST)) + PUTS ("Error restoring receiver mode."); + + if (!PktReleaseHandle(pktInfo.handle)) + PUTS ("Error releasing PKT-DRVR handle."); + + PktFreeMem(); + pktInfo.handle = 0; + } + + if (pcap_pkt_debug >= 1) + printf ("Internal stats: too-small %lu, too-large %lu, bad-sync %lu, " + "wrong-handle %lu\n", + intStat.tooSmall, intStat.tooLarge, + intStat.badSync, intStat.wrongHandle); + return (TRUE); +} + +#if (DOSX & (DJGPP|DOS4GW)) +static void dump_pkt_stub (void) +{ + int i; + + fprintf (stderr, "PktReceiver %lu, pkt_stub[PktReceiver] =\n", + PktReceiver); + for (i = 0; i < 15; i++) + fprintf (stderr, "%02X, ", real_stub_array[i+PktReceiver]); + fputs ("\n", stderr); +} +#endif + +/* + * Front end initialization routine + */ +PUBLIC BOOL PktInitDriver (PKT_RX_MODE mode) +{ + PKT_RX_MODE rxMode; + BOOL writeInfo = (pcap_pkt_debug >= 3); + + pktInfo.quiet = (pcap_pkt_debug < 3); + +#if (DOSX & PHARLAP) && defined(__HIGHC__) + if (_mwenv != 2) + { + fprintf (stderr, "Only Pharlap DOS extender supported.\n"); + return (FALSE); + } +#endif + +#if (DOSX & PHARLAP) && defined(__WATCOMC__) + if (_Extender != 1) + { + fprintf (stderr, "Only DOS4GW style extenders supported.\n"); + return (FALSE); + } +#endif + + if (!PktSearchDriver()) + { + PUTS ("Packet driver not found."); + PktFreeMem(); + return (FALSE); + } + + if (!PktGetDriverInfo()) + { + PUTS ("Error getting pkt-drvr information."); + PktFreeMem(); + return (FALSE); + } + +#if (DOSX & PHARLAP) + if (RealCopy((ULONG)&rxOutOfs, (ULONG)&pktRxEnd, + &realBase, &protBase, (USHORT*)&realSeg)) + { + rxOutOfsFp = (WORD _far *) (protBase + (WORD) &rxOutOfs); + rxInOfsFp = (WORD _far *) (protBase + (WORD) &rxInOfs); + *rxOutOfsFp = FIRST_RX_BUF; + *rxInOfsFp = FIRST_RX_BUF; + } + else + { + PUTS ("Cannot allocate real-mode stub."); + return (FALSE); + } + +#elif (DOSX & (DJGPP|DOS4GW)) + if (sizeof(real_stub_array) > 0xFFFF) + { + fprintf (stderr, "`real_stub_array[]' too big.\n"); + return (FALSE); + } +#if (DOSX & DJGPP) + rm_mem.size = (sizeof(real_stub_array) + 15) / 16; + + if (_go32_dpmi_allocate_dos_memory(&rm_mem) || rm_mem.rm_offset != 0) + { + PUTS ("real-mode init failed."); + return (FALSE); + } + realBase = (rm_mem.rm_segment << 4); + dosmemput (&real_stub_array, sizeof(real_stub_array), realBase); + _farpokel (_dos_ds, realBase+rxOutOfs, FIRST_RX_BUF); + _farpokel (_dos_ds, realBase+rxInOfs, FIRST_RX_BUF); + +#elif (DOSX & DOS4GW) + rm_base_seg = dpmi_real_malloc (sizeof(real_stub_array), &rm_base_sel); + if (!rm_base_seg) + { + PUTS ("real-mode init failed."); + return (FALSE); + } + realBase = (rm_base_seg << 4); + memcpy ((void*)realBase, &real_stub_array, sizeof(real_stub_array)); + *(WORD*) (realBase+rxOutOfs) = FIRST_RX_BUF; + *(WORD*) (realBase+rxInOfs) = FIRST_RX_BUF; + +#endif + { + int pushf = PktReceiver; + + while (real_stub_array[pushf++] != 0x9C && /* pushf */ + real_stub_array[pushf] != 0xFA) /* cli */ + { + if (++para_skip > 16) + { + fprintf (stderr, "Something wrong with `pkt_stub.inc'.\n"); + para_skip = 0; + dump_pkt_stub(); + return (FALSE); + } + } + if (*(WORD*)(real_stub_array + offsetof(PktRealStub,_dummy)) != 0xB800) + { + fprintf (stderr, "`real_stub_array[]' is misaligned.\n"); + return (FALSE); + } + } + + if (pcap_pkt_debug > 2) + dump_pkt_stub(); + +#else + rxOutOfs = FIRST_RX_BUF; + rxInOfs = FIRST_RX_BUF; +#endif + + if (!PktSetAccess()) + { + PUTS ("Error setting pkt-drvr access."); + PktFreeMem(); + return (FALSE); + } + + if (!PktGetAddress(&myAddress)) + { + PUTS ("Error fetching adapter address."); + PktFreeMem(); + return (FALSE); + } + + if (!PktSetReceiverMode(mode)) + { + PUTS ("Error setting receiver mode."); + PktFreeMem(); + return (FALSE); + } + + if (!PktGetReceiverMode(&rxMode)) + { + PUTS ("Error getting receiver mode."); + PktFreeMem(); + return (FALSE); + } + + if (writeInfo) + printf ("Pkt-driver information:\n" + " Version : %d.%d\n" + " Name : %.15s\n" + " Class : %u (%s)\n" + " Type : %u\n" + " Number : %u\n" + " Funcs : %u\n" + " Intr : %Xh\n" + " Handle : %u\n" + " Extended : %s\n" + " Hi-perf : %s\n" + " RX mode : %s\n" + " Eth-addr : %02X:%02X:%02X:%02X:%02X:%02X\n", + + pktInfo.majVer, pktInfo.minVer, pktInfo.name, + pktInfo.class, PktGetClassName(pktInfo.class), + pktInfo.type, pktInfo.number, + pktInfo.funcs, pktInfo.intr, pktInfo.handle, + pktInfo.funcs == 2 || pktInfo.funcs == 6 ? "Yes" : "No", + pktInfo.funcs == 5 || pktInfo.funcs == 6 ? "Yes" : "No", + PktRXmodeStr(rxMode), + myAddress[0], myAddress[1], myAddress[2], + myAddress[3], myAddress[4], myAddress[5]); + +#if defined(DEBUG) && (DOSX & PHARLAP) + if (writeInfo) + { + DWORD rAdr = realBase + (WORD)&PktReceiver; + unsigned sel, ofs; + + printf ("\nReceiver at %04X:%04X\n", RP_SEG(rAdr), RP_OFF(rAdr)); + printf ("Realbase = %04X:%04X\n", RP_SEG(realBase),RP_OFF(realBase)); + + sel = _FP_SEG (protBase); + ofs = _FP_OFF (protBase); + printf ("Protbase = %04X:%08X\n", sel,ofs); + printf ("RealSeg = %04X\n", realSeg); + + sel = _FP_SEG (rxOutOfsFp); + ofs = _FP_OFF (rxOutOfsFp); + printf ("rxOutOfsFp = %04X:%08X\n", sel,ofs); + + sel = _FP_SEG (rxInOfsFp); + ofs = _FP_OFF (rxInOfsFp); + printf ("rxInOfsFp = %04X:%08X\n", sel,ofs); + + printf ("Ready: *rxOutOfsFp = %04X *rxInOfsFp = %04X\n", + *rxOutOfsFp, *rxInOfsFp); + + PktQueueBusy (TRUE); + printf ("Busy: *rxOutOfsFp = %04X *rxInOfsFp = %04X\n", + *rxOutOfsFp, *rxInOfsFp); + } +#endif + + memset (&pktStat, 0, sizeof(pktStat)); /* clear statistics */ + PktQueueBusy (TRUE); + return (TRUE); +} + + +/* + * DPMI functions only for Watcom + DOS4GW extenders + */ +#if (DOSX & DOS4GW) +LOCAL DWORD dpmi_get_real_vector (int intr) +{ + union REGS r; + + r.x.eax = 0x200; + r.x.ebx = (DWORD) intr; + int386 (0x31, &r, &r); + return ((r.w.cx << 4) + r.w.dx); +} + +LOCAL WORD dpmi_real_malloc (int size, WORD *selector) +{ + union REGS r; + + r.x.eax = 0x0100; /* DPMI allocate DOS memory */ + r.x.ebx = (size + 15) / 16; /* Number of paragraphs requested */ + int386 (0x31, &r, &r); + if (r.w.cflag & 1) + return (0); + + *selector = r.w.dx; + return (r.w.ax); /* Return segment address */ +} + +LOCAL void dpmi_real_free (WORD selector) +{ + union REGS r; + + r.x.eax = 0x101; /* DPMI free DOS memory */ + r.x.ebx = selector; /* Selector to free */ + int386 (0x31, &r, &r); +} +#endif + + +#if defined(DOSX) && (DOSX & PHARLAP) +/* + * Description: + * This routine allocates conventional memory for the specified block + * of code (which must be within the first 64K of the protected mode + * program segment) and copies the code to it. + * + * The caller should free up the conventional memory block when it + * is done with the conventional memory. + * + * NOTE THIS ROUTINE REQUIRES 386|DOS-EXTENDER 3.0 OR LATER. + * + * Calling arguments: + * start_offs start of real mode code in program segment + * end_offs 1 byte past end of real mode code in program segment + * real_basep returned; real mode ptr to use as a base for the + * real mode code (eg, to get the real mode FAR + * addr of a function foo(), take + * real_basep + (ULONG) foo). + * This pointer is constructed such that + * offsets within the real mode segment are + * the same as the link-time offsets in the + * protected mode program segment + * prot_basep returned; prot mode ptr to use as a base for getting + * to the conventional memory, also constructed + * so that adding the prot mode offset of a + * function or variable to the base gets you a + * ptr to the function or variable in the + * conventional memory block. + * rmem_adrp returned; real mode para addr of allocated + * conventional memory block, to be used to free + * up the conventional memory when done. DO NOT + * USE THIS TO CONSTRUCT A REAL MODE PTR, USE + * REAL_BASEP INSTEAD SO THAT OFFSETS WORK OUT + * CORRECTLY. + * + * Returned values: + * 0 if error + * 1 if success + */ +int RealCopy (ULONG start_offs, + ULONG end_offs, + REALPTR *real_basep, + FARPTR *prot_basep, + USHORT *rmem_adrp) +{ + ULONG rm_base; /* base real mode para addr for accessing */ + /* allocated conventional memory */ + UCHAR *source; /* source pointer for copy */ + FARPTR destin; /* destination pointer for copy */ + ULONG len; /* number of bytes to copy */ + ULONG temp; + USHORT stemp; + + /* First check for valid inputs + */ + if (start_offs >= end_offs || end_offs > 0x10000) + return (FALSE); + + /* Round start_offs down to a paragraph (16-byte) boundary so we can set up + * the real mode pointer easily. Round up end_offs to make sure we allocate + * enough paragraphs + */ + start_offs &= ~15; + end_offs = (15 + (end_offs << 4)) >> 4; + + /* Allocate the conventional memory for our real mode code. Remember to + * round byte count UP to 16-byte paragraph size. We alloc it + * above the DOS data buffer so both the DOS data buffer and the appl + * conventional mem block can still be resized. + * + * First just try to alloc it; if we can't get it, shrink the appl mem + * block down to the minimum, try to alloc the memory again, then grow the + * appl mem block back to the maximum. (Don't try to shrink the DOS data + * buffer to free conventional memory; it wouldn't be good for this routine + * to have the possible side effect of making file I/O run slower.) + */ + len = ((end_offs - start_offs) + 15) >> 4; + if (_dx_real_above(len, rmem_adrp, &stemp) != _DOSE_NONE) + { + if (_dx_cmem_usage(0, 0, &temp, &temp) != _DOSE_NONE) + return (FALSE); + + if (_dx_real_above(len, rmem_adrp, &stemp) != _DOSE_NONE) + *rmem_adrp = 0; + + if (_dx_cmem_usage(0, 1, &temp, &temp) != _DOSE_NONE) + { + if (*rmem_adrp != 0) + _dx_real_free (*rmem_adrp); + return (FALSE); + } + + if (*rmem_adrp == 0) + return (FALSE); + } + + /* Construct real mode & protected mode pointers to access the allocated + * memory. Note we know start_offs is aligned on a paragraph (16-byte) + * boundary, because we rounded it down. + * + * We make the offsets come out rights by backing off the real mode selector + * by start_offs. + */ + rm_base = ((ULONG) *rmem_adrp) - (start_offs >> 4); + RP_SET (*real_basep, 0, rm_base); + FP_SET (*prot_basep, rm_base << 4, SS_DOSMEM); + + /* Copy the real mode code/data to the allocated memory + */ + source = (UCHAR *) start_offs; + destin = *prot_basep; + FP_SET (destin, FP_OFF(*prot_basep) + start_offs, FP_SEL(*prot_basep)); + len = end_offs - start_offs; + WriteFarMem (destin, source, len); + + return (TRUE); +} +#endif /* DOSX && (DOSX & PHARLAP) */ diff --git a/libpcap/msdos/pktdrvr.h b/libpcap/msdos/pktdrvr.h new file mode 100644 index 0000000000..08898ae868 --- /dev/null +++ b/libpcap/msdos/pktdrvr.h @@ -0,0 +1,153 @@ +#ifndef __PKTDRVR_H +#define __PKTDRVR_H + +#define PUBLIC +#define LOCAL static + +#define RX_BUF_SIZE ETH_MTU /* buffer size variables. NB !! */ +#define TX_BUF_SIZE ETH_MTU /* must be same as in pkt_rx*.* */ + +#ifdef __HIGHC__ +#pragma Off(Align_members) +#else +#pragma pack(1) +#endif + +typedef enum { /* Packet-driver classes */ + PD_ETHER = 1, + PD_PRONET10 = 2, + PD_IEEE8025 = 3, + PD_OMNINET = 4, + PD_APPLETALK = 5, + PD_SLIP = 6, + PD_STARTLAN = 7, + PD_ARCNET = 8, + PD_AX25 = 9, + PD_KISS = 10, + PD_IEEE8023_2 = 11, + PD_FDDI8022 = 12, + PD_X25 = 13, + PD_LANstar = 14, + PD_PPP = 18 + } PKT_CLASS; + +typedef enum { /* Packet-driver receive modes */ + PDRX_OFF = 1, /* turn off receiver */ + PDRX_DIRECT, /* receive only to this interface */ + PDRX_BROADCAST, /* DIRECT + broadcast packets */ + PDRX_MULTICAST1, /* BROADCAST + limited multicast */ + PDRX_MULTICAST2, /* BROADCAST + all multicast */ + PDRX_ALL_PACKETS, /* receive all packets on network */ + } PKT_RX_MODE; + +typedef struct { + char type[8]; + char len; + } PKT_FRAME; + + +typedef struct { + BYTE class; /* = 1 for DEC/Interl/Xerox Ethernet */ + BYTE number; /* = 0 for single LAN adapter */ + WORD type; /* = 13 for 3C523 */ + BYTE funcs; /* Basic/Extended/HiPerf functions */ + WORD intr; /* user interrupt vector number */ + WORD handle; /* Handle associated with session */ + BYTE name [15]; /* Name of adapter interface,ie.3C523*/ + BOOL quiet; /* (don't) print errors to stdout */ + const char *error; /* address of error string */ + BYTE majVer; /* Major driver implementation ver. */ + BYTE minVer; /* Minor driver implementation ver. */ + BYTE dummyLen; /* length of following data */ + WORD MAClength; /* HiPerformance data, N/A */ + WORD MTU; /* HiPerformance data, N/A */ + WORD multicast; /* HiPerformance data, N/A */ + WORD rcvrBuffers; /* valid for */ + WORD UMTbufs; /* High Performance drivers only */ + WORD postEOIintr; /* Usage ?? */ + } PKT_INFO; + +#define PKT_PARAM_SIZE 14 /* members majVer - postEOIintr */ + + +typedef struct { + DWORD inPackets; /* # of packets received */ + DWORD outPackets; /* # of packets transmitted */ + DWORD inBytes; /* # of bytes received */ + DWORD outBytes; /* # of bytes transmitted */ + DWORD inErrors; /* # of reception errors */ + DWORD outErrors; /* # of transmission errors */ + DWORD lost; /* # of packets lost (RX) */ + } PKT_STAT; + + +typedef struct { + ETHER destin; + ETHER source; + WORD proto; + BYTE data [TX_BUF_SIZE]; + } TX_ELEMENT; + +typedef struct { + WORD firstCount; /* # of bytes on 1st */ + WORD secondCount; /* and 2nd upcall */ + WORD handle; /* instance that upcalled */ + ETHER destin; /* E-net destination address */ + ETHER source; /* E-net source address */ + WORD proto; /* protocol number */ + BYTE data [RX_BUF_SIZE]; + } RX_ELEMENT; + + +#ifdef __HIGHC__ +#pragma pop(Align_members) +#else +#pragma pack() +#endif + + +/* + * Prototypes for publics + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern PKT_STAT pktStat; /* statistics for packets */ +extern PKT_INFO pktInfo; /* packet-driver information */ + +extern PKT_RX_MODE receiveMode; +extern ETHER myAddress, ethBroadcast; + +extern BOOL PktInitDriver (PKT_RX_MODE mode); +extern BOOL PktExitDriver (void); + +extern const char *PktGetErrorStr (int errNum); +extern const char *PktGetClassName (WORD class); +extern const char *PktRXmodeStr (PKT_RX_MODE mode); +extern BOOL PktSearchDriver (void); +extern int PktReceive (BYTE *buf, int max); +extern BOOL PktTransmit (const void *eth, int len); +extern DWORD PktRxDropped (void); +extern BOOL PktReleaseHandle (WORD handle); +extern BOOL PktTerminHandle (WORD handle); +extern BOOL PktResetInterface (WORD handle); +extern BOOL PktSetReceiverMode(PKT_RX_MODE mode); +extern BOOL PktGetReceiverMode(PKT_RX_MODE *mode); +extern BOOL PktGetStatistics (WORD handle); +extern BOOL PktSessStatistics (WORD handle); +extern BOOL PktResetStatistics(WORD handle); +extern BOOL PktGetAddress (ETHER *addr); +extern BOOL PktSetAddress (const ETHER *addr); +extern BOOL PktGetDriverInfo (void); +extern BOOL PktGetDriverParam (void); +extern void PktQueueBusy (BOOL busy); +extern WORD PktBuffersUsed (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __PKTDRVR_H */ + diff --git a/libpcap/msdos/readme.dos b/libpcap/msdos/readme.dos new file mode 100644 index 0000000000..02ef1f7b25 --- /dev/null +++ b/libpcap/msdos/readme.dos @@ -0,0 +1,162 @@ +@(#) $Header: /tcpdump/master/libpcap/msdos/readme.dos,v 1.3 2004-12-19 19:47:01 guy Exp $ (LBL) + +libpcap for DOS +--------------- + +This file contains some notes on building and using libpcap for MS-DOS. +Look in `README' and `pcap.man' for usage and details. These targets are +supported: + + - Borland C 4.0+ small or large model. + - Metaware HighC 3.1+ with PharLap DOS-extender + - GNU C 2.7+ with djgpp 2.01+ DOS extender + - Watcom C 11.x with DOS4GW extender + +Note: the files in the libpcap.zip contains short trucated filenames. + So for djgpp to work with these, disable the use of long file names by + setting "LFN=n" in the environment. + +Files specific to DOS are pcap-dos.[ch] and the assembly and C files in +the MSDOS sub-directory. Remember to built lipcap libraries from the top +install directory. And not from the MSDOS sub-directory. + +Note for djgpp users: + If you got the libpcap from the official site www.tcpdump, then that + distribution does NOT contain any sources for building 32-bit drivers. + Instead get the full version at + http://www.bgnett.no/~giva/pcap/libpcap.zip + + and set "USE_32BIT_DRIVERS = 1" in msdos\common.dj. + + + +Requirements +------------ + +DOS-libpcap currently only works reliably with a real-mode Ethernet packet- +driver. This driver must be installed prior to using any program (e.g. +tcpdump) compiled with libpcap. Work is underway to implement protected- +mode drivers for 32-bit targets (djgpp only). The 3Com 3c509 driver is +working almost perfectly. Due to lack of LAN-cards, I've not had the +opportunity to test other drivers. These 32-bit drivers are modified +Linux drivers. + + +Required packages +----------------- + +The following packages and tools must be present for all targets. + +1. Watt-32 tcp/ip library. This library is *not* used to send or + receive network data. It's mostly used to access the 'hosts' + file and other features. Get 'watt32s*.zip' at: + + http://www.bgnett.no/~giva/ + +2. Exception handler and disassember library (libexc.a) is needed if + "USE_EXCEPT = 1" in common.dj. Available at: + + http://www.bgnett.no/~giva/misc/exc_dx07.zip + +3. Flex & Bison is used to generate parser for the filter handler + pcap_compile: + + ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/flx254b.zip + ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsn128b.zip + +4. NASM assembler v 0.98 or later is required when building djgpp and + Watcom targets: + + ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/nasm098p.zip + +5. sed (Stream Editor) is required for doing `make depend'. + It's available at + ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/sed*.zip + + A touch tool to update the time-stamp of a file. E.g. + ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/grep*.zip + +6. For djgpp rm.exe and cp.exe are required. These should already be + part of your djgpp installation. Also required (experimental at the + time) for djgpp is DLX 2.91 or later. This tool is for the generation + of dynamically loadable modules. + + +Compiling libpcap +----------------- + +Follow these steps in building libpcap: + +1. Make sure you've installed Watt-32 properly (see it's `INSTALL' file). + During that installation a environment variable `WATT_ROOT' is set. + This variable is used for building libpcap also (`WATT_INC' is + deducted from `WATT_ROOT'). djgpp users should also define environment + variables `C_INCLUDE_PATH' and `LIBRARY_PATH' to point to the include + directory and library directory respectively. E.g. put this in your + AUTOEXEC.BAT: + set C_INCLUDE_PATH=c:/net/watt/inc + set LIBRARY_PATH=c:/net/watt/lib + +2. Revise the msdos/common.dj file for your djgpp/gcc installation; + - change the value of `GCCLIB' to match location of libgcc.a. + - set `USE_32BIT_DRIVERS = 1' to build 32-bit driver objects. + + +3. Build pcap by using appropriate makefile. For djgpp, use: + `make -f msdos/makefile.dj' (i.e. GNU `make') + + For a Watcom target say: + `wmake -f msdos\makefile.wc' + + For a Borland target say: + `maker -f msdos\Makefile pcap_bc.lib' (Borland's `maker.exe') + + And for a HighC/Pharlap target say: + `maker -f msdos\Makefile pcap_hc.lib' (Borland's `maker.exe') + + You might like to change some `CFLAGS' -- only `DEBUG' define currently + have any effect. It shows a rotating "fan" in upper right corner of + screen. Remove `DEBUG' if you don't like it. You could add + `-fomit-frame-pointer' to `CFLAGS' to speed up the generated code. + But note, this makes debugging and crash-traceback difficult. Only + add it if you're fully confident your application is 100% stable. + + Note: Code in `USE_NDIS2' does not work at the moment. + +4. The resulting libraries are put in current directory. There's no + test-program for `libpcap'. Linking the library with `tcpdump' is + the ultimate test anyway. + + + +Extensions to libpcap +--------------------- + +I've included some extra functions to DOS-libpcap: + + `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' + that is called from application's configure process (see tcpdump's + config.c file). libpcap keeps a set of tables that are searched for + a name/value match. Currently only used to set debug-levels and + parameters for the 32-bit network drivers. + + `pcap_set_wait (pcap_t *, void (*)(void), int)' : + + Only effective when reading offline traffic from dump-files. + Function `pcap_offline_read()' will wait (and optionally yield) + before printing next packet. This will simulate the pace the packets + where actually recorded. + + + +Happy sniffing ! + + +Gisle Vanem + + +October 1999, 2004 + diff --git a/libpcap/net b/libpcap/net deleted file mode 120000 index b3eaca9500..0000000000 --- a/libpcap/net +++ /dev/null @@ -1 +0,0 @@ -./bpf/net \ No newline at end of file diff --git a/libpcap/packaging/pcap.spec.in b/libpcap/packaging/pcap.spec.in new file mode 100644 index 0000000000..4a7a82271e --- /dev/null +++ b/libpcap/packaging/pcap.spec.in @@ -0,0 +1,75 @@ +%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 +%{_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 b4482e9f1c..1d3c8cb4f0 100644 --- a/libpcap/pcap-bpf.c +++ b/libpcap/pcap-bpf.c @@ -31,8 +31,8 @@ static const char rcsid[] _U_ = #ifdef HAVE_ZEROCOPY_BPF #include #endif -#include #include +#include /* * defines ioctls, but doesn't include . * @@ -186,77 +186,67 @@ static int pcap_setfilter_bpf(pcap_t *p, struct bpf_program *fp); static int pcap_setdirection_bpf(pcap_t *, pcap_direction_t); static int pcap_set_datalink_bpf(pcap_t *p, int dlt); -#ifdef HAVE_ZEROCOPY_BPF /* - * For zerocopy bpf, we need to override the setnonblock/getnonblock routines - * so we don't call select(2) if the pcap handle is in non-blocking mode. We - * preserve the timeout supplied by pcap_open functions to make sure it - * does not get clobbered if the pcap handle moves between blocking and non- - * blocking mode. + * For zerocopy bpf, the setnonblock/getnonblock routines need to modify + * p->md.timeout so we don't call select(2) if the pcap handle is in non- + * blocking mode. We preserve the timeout supplied by pcap_open functions + * to make sure it does not get clobbered if the pcap handle moves between + * blocking and non-blocking mode. */ static int -pcap_getnonblock_zbuf(pcap_t *p, char *errbuf) +pcap_getnonblock_bpf(pcap_t *p, char *errbuf) { - /* - * Use a negative value for the timeout to represent that the - * pcap handle is in non-blocking mode. - */ - return (p->md.timeout < 0); +#ifdef HAVE_ZEROCOPY_BPF + if (p->md.zerocopy) { + /* + * Use a negative value for the timeout to represent that the + * pcap handle is in non-blocking mode. + */ + return (p->md.timeout < 0); + } +#endif + return (pcap_getnonblock_fd(p, errbuf)); } static int -pcap_setnonblock_zbuf(pcap_t *p, int nonblock, char *errbuf) +pcap_setnonblock_bpf(pcap_t *p, int nonblock, char *errbuf) { - /* - * Map each value to the corresponding 2's complement, to - * preserve the timeout value provided with pcap_set_timeout. - * (from pcap-linux.c). - */ - if (nonblock) { - if (p->md.timeout >= 0) { - /* - * Timeout is non-negative, so we're not already - * in non-blocking mode; set it to the 2's - * complement, to make it negative, as an - * indication that we're in non-blocking mode. - */ - p->md.timeout = p->md.timeout * -1 - 1; - } - } else { - if (p->md.timeout < 0) { - /* - * Timeout is negative, so we're not already - * in blocking mode; reverse the previous - * operation, to make the timeout non-negative - * again. - */ - p->md.timeout = (p->md.timeout + 1) * -1; +#ifdef HAVE_ZEROCOPY_BPF + if (p->md.zerocopy) { + /* + * Map each value to the corresponding 2's complement, to + * preserve the timeout value provided with pcap_set_timeout. + * (from pcap-linux.c). + */ + if (nonblock) { + if (p->md.timeout >= 0) { + /* + * Timeout is non-negative, so we're not + * currently in non-blocking mode; set it + * to the 2's complement, to make it + * negative, as an indication that we're + * in non-blocking mode. + */ + p->md.timeout = p->md.timeout * -1 - 1; + } + } else { + if (p->md.timeout < 0) { + /* + * Timeout is negative, so we're currently + * in blocking mode; reverse the previous + * operation, to make the timeout non-negative + * again. + */ + p->md.timeout = (p->md.timeout + 1) * -1; + } } + return (0); } - return (0); -} - -/* - * Zero-copy specific close method. Un-map the shared buffers then call - * pcap_cleanup_live_common. - */ -static void -pcap_cleanup_zbuf(pcap_t *p) -{ - /* - * Delete the mappings. Note that p->buffer gets initialized to one - * of the mmapped regions in this case, so do not try and free it - * directly; null it out so that pcap_cleanup_live_common() doesn't - * try to free it. - */ - if (p->md.zbuf1 != MAP_FAILED && p->md.zbuf1 != NULL) - (void) munmap(p->md.zbuf1, p->md.zbufsize); - if (p->md.zbuf2 != MAP_FAILED && p->md.zbuf2 != NULL) - (void) munmap(p->md.zbuf2, p->md.zbufsize); - p->buffer = NULL; - pcap_cleanup_live_common(p); +#endif + return (pcap_setnonblock_fd(p, nonblock, errbuf)); } +#ifdef HAVE_ZEROCOPY_BPF /* * Zero-copy BPF buffer routines to check for and acknowledge BPF data in * shared memory buffers. @@ -410,7 +400,7 @@ pcap_ack_zbuf(pcap_t *p) p->buffer = NULL; return (0); } -#endif +#endif /* HAVE_ZEROCOPY_BPF */ pcap_t * pcap_create(const char *device, char *ebuf) @@ -435,6 +425,10 @@ pcap_create(const char *device, char *ebuf) return (p); } +/* + * On success, returns a file descriptor for a BPF device. + * On failure, returns a PCAP_ERROR_ value, and sets p->errbuf. + */ static int bpf_open(pcap_t *p) { @@ -495,12 +489,52 @@ bpf_open(pcap_t *p) * XXX better message for all minors used */ if (fd < 0) { - if (errno == EACCES) + switch (errno) { + + case ENOENT: + fd = PCAP_ERROR; + if (n == 1) { + /* + * /dev/bpf0 doesn't exist, which + * means we probably have no BPF + * devices. + */ + snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + "(there are no BPF devices)"); + } else { + /* + * We got EBUSY on at least one + * BPF device, so we have BPF + * devices, but all the ones + * that exist are busy. + */ + snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + "(all BPF devices are busy)"); + } + break; + + case EACCES: + /* + * Got EACCES on the last device we tried, + * and EBUSY on all devices before that, + * if any. + */ fd = PCAP_ERROR_PERM_DENIED; - else + snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + "(cannot open BPF device) %s: %s", device, + pcap_strerror(errno)); + break; + + default: + /* + * Some other problem. + */ fd = PCAP_ERROR; - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "(no devices found) %s: %s", - device, pcap_strerror(errno)); + snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + "(cannot open BPF device) %s: %s", device, + pcap_strerror(errno)); + break; + } } #endif @@ -673,14 +707,23 @@ pcap_can_set_rfmon_bpf(pcap_t *p) */ fd = bpf_open(p); if (fd < 0) - return (fd); + return (fd); /* fd is the appropriate error code */ /* * Now bind to the device. */ (void)strncpy(ifr.ifr_name, p->opt.source, sizeof(ifr.ifr_name)); if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) { - if (errno == ENETDOWN) { + switch (errno) { + + case ENXIO: + /* + * There's no such device. + */ + close(fd); + return (PCAP_ERROR_NO_SUCH_DEVICE); + + case ENETDOWN: /* * Return a "network down" indication, so that * the application can report that rather than @@ -690,7 +733,8 @@ pcap_can_set_rfmon_bpf(pcap_t *p) */ close(fd); return (PCAP_ERROR_IFACE_NOT_UP); - } else { + + default: snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSETIF: %s: %s", p->opt.source, pcap_strerror(errno)); @@ -911,14 +955,28 @@ pcap_read_bpf(pcap_t *p, int cnt, pcap_handler callback, u_char *user) * processed so far. */ if (p->break_loop) { + p->bp = bp; + p->cc = ep - bp; + /* + * ep is set based on the return value of read(), + * but read() from a BPF device doesn't necessarily + * return a value that's a multiple of the alignment + * value for BPF_WORDALIGN(). However, whenever we + * increment bp, we round up the increment value by + * a value rounded up by BPF_WORDALIGN(), so we + * could increment bp past ep after processing the + * last packet in the buffer. + * + * We treat ep < bp as an indication that this + * happened, and just set p->cc to 0. + */ + if (p->cc < 0) + p->cc = 0; if (n == 0) { p->break_loop = 0; return (PCAP_ERROR_BREAK); - } else { - p->bp = bp; - p->cc = ep - bp; + } else return (n); - } } caplen = bhp->bh_caplen; @@ -970,6 +1028,11 @@ pcap_read_bpf(pcap_t *p, int cnt, pcap_handler callback, u_char *user) if (++n >= cnt && cnt > 0) { p->bp = bp; p->cc = ep - bp; + /* + * See comment above about p->cc < 0. + */ + if (p->cc < 0) + p->cc = 0; return (n); } } else { @@ -1270,15 +1333,19 @@ pcap_cleanup_bpf(pcap_t *p) } #ifdef HAVE_ZEROCOPY_BPF - /* - * In zero-copy mode, p->buffer is just a pointer into one of the two - * memory-mapped buffers, so no need to free it. - */ if (p->md.zerocopy) { + /* + * Delete the mappings. Note that p->buffer gets + * initialized to one of the mmapped regions in + * this case, so do not try and free it directly; + * null it out so that pcap_cleanup_live_common() + * doesn't try to free it. + */ if (p->md.zbuf1 != MAP_FAILED && p->md.zbuf1 != NULL) - munmap(p->md.zbuf1, p->md.zbufsize); + (void) munmap(p->md.zbuf1, p->md.zbufsize); if (p->md.zbuf2 != MAP_FAILED && p->md.zbuf2 != NULL) - munmap(p->md.zbuf2, p->md.zbufsize); + (void) munmap(p->md.zbuf2, p->md.zbufsize); + p->buffer = NULL; } #endif if (p->md.device != NULL) { @@ -1392,7 +1459,15 @@ pcap_activate_bpf(pcap_t *p) { int status = 0; int fd; +#ifdef LIFNAMSIZ + struct lifreq ifr; + char *ifrname = ifr.lifr_name; + const size_t ifnamsiz = sizeof(ifr.lifr_name); +#else struct ifreq ifr; + char *ifrname = ifr.ifr_name; + const size_t ifnamsiz = sizeof(ifr.ifr_name); +#endif struct bpf_version bv; #ifdef __APPLE__ int sockfd; @@ -1484,9 +1559,8 @@ pcap_activate_bpf(pcap_t *p) */ sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (sockfd != -1) { - strlcpy(ifr.ifr_name, - p->opt.source, - sizeof(ifr.ifr_name)); + strlcpy(ifrname, + p->opt.source, ifnamsiz); if (ioctl(sockfd, SIOCGIFFLAGS, (char *)&ifr) < 0) { /* @@ -1551,14 +1625,6 @@ pcap_activate_bpf(pcap_t *p) */ p->md.zerocopy = 1; - /* - * Set the cleanup and set/get nonblocking mode ops - * as appropriate for zero-copy mode. - */ - p->cleanup_op = pcap_cleanup_zbuf; - p->setnonblock_op = pcap_setnonblock_zbuf; - p->getnonblock_op = pcap_getnonblock_zbuf; - /* * How to pick a buffer size: first, query the maximum buffer * size supported by zero-copy. This also lets us quickly @@ -1608,7 +1674,7 @@ pcap_activate_bpf(pcap_t *p) pcap_strerror(errno)); goto bad; } - (void)strncpy(ifr.ifr_name, p->opt.source, sizeof(ifr.ifr_name)); + (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)); @@ -1638,9 +1704,13 @@ pcap_activate_bpf(pcap_t *p) /* * Now bind to the device. */ - (void)strncpy(ifr.ifr_name, p->opt.source, - sizeof(ifr.ifr_name)); - if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) { + (void)strncpy(ifrname, p->opt.source, ifnamsiz); +#ifdef BIOCSETLIF + if (ioctl(fd, BIOCSETLIF, (caddr_t)&ifr) < 0) +#else + if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) +#endif + { status = check_setif_failure(p, errno); goto bad; } @@ -1667,9 +1737,12 @@ pcap_activate_bpf(pcap_t *p) */ (void) ioctl(fd, BIOCSBLEN, (caddr_t)&v); - (void)strncpy(ifr.ifr_name, p->opt.source, - sizeof(ifr.ifr_name)); + (void)strncpy(ifrname, p->opt.source, ifnamsiz); +#ifdef BIOCSETLIF + if (ioctl(fd, BIOCSETLIF, (caddr_t)&ifr) >= 0) +#else if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) >= 0) +#endif break; /* that size worked; we're done */ if (errno != ENOBUFS) { @@ -2160,8 +2233,8 @@ pcap_activate_bpf(pcap_t *p) p->setfilter_op = pcap_setfilter_bpf; p->setdirection_op = pcap_setdirection_bpf; p->set_datalink_op = pcap_set_datalink_bpf; - p->getnonblock_op = pcap_getnonblock_fd; - p->setnonblock_op = pcap_setnonblock_fd; + p->getnonblock_op = pcap_getnonblock_bpf; + p->setnonblock_op = pcap_setnonblock_bpf; p->stats_op = pcap_stats_bpf; p->cleanup_op = pcap_cleanup_bpf; @@ -2214,17 +2287,28 @@ monitor_mode(pcap_t *p, int set) /* * Can't get the media types. */ - if (errno == EINVAL) { + switch (errno) { + + case ENXIO: + /* + * There's no such device. + */ + close(sock); + return (PCAP_ERROR_NO_SUCH_DEVICE); + + case EINVAL: /* * Interface doesn't support SIOC{G,S}IFMEDIA. */ close(sock); return (PCAP_ERROR_RFMON_NOTSUP); + + default: + snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + "SIOCGIFMEDIA 1: %s", pcap_strerror(errno)); + close(sock); + return (PCAP_ERROR); } - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "SIOCGIFMEDIA 1: %s", - pcap_strerror(errno)); - close(sock); - return (PCAP_ERROR); } if (req.ifm_count == 0) { /* diff --git a/libpcap/pcap-bt-linux.c b/libpcap/pcap-bt-linux.c index 55c1b6a1da..0c6c08d199 100644 --- a/libpcap/pcap-bt-linux.c +++ b/libpcap/pcap-bt-linux.c @@ -85,8 +85,8 @@ bt_platform_finddevs(pcap_if_t **alldevsp, char *err_str) /* if bluetooth is not supported this this is not fatal*/ if (errno == EAFNOSUPPORT) return 0; - snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't open raw Bluetooth socket %d:%s", - errno, strerror(errno)); + snprintf(err_str, PCAP_ERRBUF_SIZE, + "Can't open raw Bluetooth socket: %s", strerror(errno)); return -1; } @@ -103,8 +103,9 @@ bt_platform_finddevs(pcap_if_t **alldevsp, char *err_str) if (ioctl(sock, HCIGETDEVLIST, (void *) dev_list) < 0) { - snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't get Bluetooth device list via ioctl %d:%s", - errno, strerror(errno)); + snprintf(err_str, PCAP_ERRBUF_SIZE, + "Can't get Bluetooth device list via ioctl: %s", + strerror(errno)); ret = -1; goto free; } @@ -182,8 +183,8 @@ bt_activate(pcap_t* handle) /* Create HCI socket */ handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); if (handle->fd < 0) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't create raw socket %d:%s", - errno, strerror(errno)); + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Can't create raw socket: %s", strerror(errno)); return PCAP_ERROR; } @@ -196,15 +197,15 @@ bt_activate(pcap_t* handle) opt = 1; if (setsockopt(handle->fd, SOL_HCI, HCI_DATA_DIR, &opt, sizeof(opt)) < 0) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't enable data direction info %d:%s", - errno, strerror(errno)); + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Can't enable data direction info: %s", strerror(errno)); goto close_fail; } opt = 1; if (setsockopt(handle->fd, SOL_HCI, HCI_TIME_STAMP, &opt, sizeof(opt)) < 0) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't enable time stamp %d:%s", - errno, strerror(errno)); + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Can't enable time stamp: %s", strerror(errno)); goto close_fail; } @@ -214,8 +215,8 @@ bt_activate(pcap_t* handle) 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, "Can't set filter %d:%s", - errno, strerror(errno)); + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Can't set filter: %s", strerror(errno)); goto close_fail; } @@ -224,8 +225,9 @@ bt_activate(pcap_t* handle) addr.hci_family = AF_BLUETOOTH; addr.hci_dev = handle->md.ifindex; if (bind(handle->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't attach to device %d %d:%s", - handle->md.ifindex, errno, strerror(errno)); + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Can't attach to device %d: %s", handle->md.ifindex, + strerror(errno)); goto close_fail; } @@ -237,7 +239,7 @@ bt_activate(pcap_t* handle) goto close_fail; } - if (handle->opt.buffer_size == 0) { + if (handle->opt.buffer_size != 0) { /* * Set the socket buffer size to the specified value. */ @@ -264,6 +266,7 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us struct cmsghdr *cmsg; struct msghdr msg; struct iovec iv; + ssize_t ret; struct pcap_pkthdr pkth; pcap_bluetooth_h4_header* bthdr; @@ -279,21 +282,22 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us /* ignore interrupt system call error */ do { - pkth.caplen = recvmsg(handle->fd, &msg, 0); + ret = recvmsg(handle->fd, &msg, 0); if (handle->break_loop) { handle->break_loop = 0; return -2; } - } while ((pkth.caplen == -1) && (errno == EINTR)); + } while ((ret == -1) && (errno == EINTR)); - - if (pkth.caplen < 0) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't receive packet %d:%s", - errno, strerror(errno)); + if (ret < 0) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Can't receive packet: %s", strerror(errno)); return -1; } + pkth.caplen = ret; + /* get direction and timestamp*/ cmsg = CMSG_FIRSTHDR(&msg); int in=0; @@ -342,14 +346,14 @@ bt_stats_linux(pcap_t *handle, struct pcap_stat *stats) struct hci_dev_stats * s = &dev_info.stat; dev_info.dev_id = handle->md.ifindex; - /* ingnore eintr */ + /* 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 get stats" - " via ioctl %d:%s", errno, strerror(errno)); + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Can't get stats via ioctl: %s", strerror(errno)); return (-1); } diff --git a/libpcap/pcap-common.c b/libpcap/pcap-common.c index 979b5e364d..f188eeb750 100644 --- a/libpcap/pcap-common.c +++ b/libpcap/pcap-common.c @@ -18,21 +18,9 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * savefile.c - supports offline use of tcpdump - * Extraction/creation by Jeffrey Mogul, DECWRL - * Modified by Steve McCanne, LBL. - * - * Used to save the received packet headers, after filtering, to - * a file, and then read them later. - * The first record in the file contains saved values for the machine - * dependent values so we can print the dump file on any architecture. + * pcap-common.c - common code for pcap and pcap-ng files */ -#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 @@ -106,6 +94,23 @@ static const char rcsid[] _U_ = * file, and new values after that one might have been assigned. Also, * do *NOT* use any values below 100 - those might already have been * taken by one (or more!) organizations. + * + * Any platform that defines additional DLT_* codes should: + * + * request a LINKTYPE_* code and value from tcpdump.org, + * as per the above; + * + * add, in their version of libpcap, an entry to map + * those DLT_* codes to the corresponding LINKTYPE_* + * code; + * + * redefine, in their "net/bpf.h", any DLT_* values + * that collide with the values used by their additional + * DLT_* codes, to remove those collisions (but without + * making them collide with any of the LINKTYPE_* + * values equal to 50 or above; they should also avoid + * defining DLT_* values that collide with those + * LINKTYPE_* values, either). */ #define LINKTYPE_NULL DLT_NULL #define LINKTYPE_ETHERNET DLT_EN10MB /* also for 100Mb and up */ @@ -114,7 +119,7 @@ static const char rcsid[] _U_ = #define LINKTYPE_PRONET DLT_PRONET #define LINKTYPE_CHAOS DLT_CHAOS #define LINKTYPE_TOKEN_RING DLT_IEEE802 /* DLT_IEEE802 is used for Token Ring */ -#define LINKTYPE_ARCNET DLT_ARCNET /* BSD-style headers */ +#define LINKTYPE_ARCNET_BSD DLT_ARCNET /* BSD-style headers */ #define LINKTYPE_SLIP DLT_SLIP #define LINKTYPE_PPP DLT_PPP #define LINKTYPE_FDDI DLT_FDDI @@ -140,10 +145,29 @@ static const char rcsid[] _U_ = #define LINKTYPE_SYMANTEC_FIREWALL 99 /* Symantec Enterprise Firewall */ +/* + * These correspond to DLT_s that have different values on different + * platforms; we map between these values in capture files and + * the DLT_ values as returned by pcap_datalink() and passed to + * pcap_open_dead(). + */ #define LINKTYPE_ATM_RFC1483 100 /* LLC/SNAP-encapsulated ATM */ #define LINKTYPE_RAW 101 /* raw IP */ #define LINKTYPE_SLIP_BSDOS 102 /* BSD/OS SLIP BPF header */ #define LINKTYPE_PPP_BSDOS 103 /* BSD/OS PPP BPF header */ + +/* + * Values starting with 104 are used for newly-assigned link-layer + * header type values; for those link-layer header types, the DLT_ + * value returned by pcap_datalink() and passed to pcap_open_dead(), + * and the LINKTYPE_ value that appears in capture files, are the + * same. + * + * LINKTYPE_MATCHING_MIN is the lowest such value; LINKTYPE_MATCHING_MAX + * is the highest such value. + */ +#define LINKTYPE_MATCHING_MIN 104 /* lowest value in the "matching" range */ + #define LINKTYPE_C_HDLC 104 /* Cisco HDLC */ #define LINKTYPE_IEEE802_11 105 /* IEEE 802.11 (wireless) */ #define LINKTYPE_ATM_CLIP 106 /* Linux Classical IP over ATM */ @@ -544,39 +568,39 @@ static const char rcsid[] _U_ = * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman * . */ -#define LINKTYPE_IPMB_LINUX 209 +#define LINKTYPE_IPMB_LINUX 209 /* * FlexRay automotive bus - http://www.flexray.com/ - as requested * by Hannes Kaelber . */ -#define LINKTYPE_FLEXRAY 210 +#define LINKTYPE_FLEXRAY 210 /* * Media Oriented Systems Transport (MOST) bus for multimedia * transport - http://www.mostcooperation.com/ - as requested * by Hannes Kaelber . */ -#define LINKTYPE_MOST 211 +#define LINKTYPE_MOST 211 /* * Local Interconnect Network (LIN) bus for vehicle networks - * http://www.lin-subbus.org/ - as requested by Hannes Kaelber * . */ -#define LINKTYPE_LIN 212 +#define LINKTYPE_LIN 212 /* * X2E-private data link type used for serial line capture, * as requested by Hannes Kaelber . */ -#define LINKTYPE_X2E_SERIAL 213 +#define LINKTYPE_X2E_SERIAL 213 /* * X2E-private data link type used for the Xoraya data logger * family, as requested by Hannes Kaelber . */ -#define LINKTYPE_X2E_XORAYA 214 +#define LINKTYPE_X2E_XORAYA 214 /* * IEEE 802.15.4, exactly as it appears in the spec (no padding, no @@ -595,22 +619,22 @@ static const char rcsid[] _U_ = * is used to communicate keystrokes and mouse movements from the * Linux kernel to display systems, such as Xorg. */ -#define LINKTYPE_LINUX_EVDEV 216 +#define LINKTYPE_LINUX_EVDEV 216 /* * GSM Um and Abis interfaces, preceded by a "gsmtap" header. * * Requested by Harald Welte . */ -#define LINKTYPE_GSMTAP_UM 217 -#define LINKTYPE_GSMTAP_ABIS 218 +#define LINKTYPE_GSMTAP_UM 217 +#define LINKTYPE_GSMTAP_ABIS 218 /* * MPLS, with an MPLS label as the link-layer header. * Requested by Michele Marchetto on behalf * of OpenBSD. */ -#define LINKTYPE_MPLS 219 +#define LINKTYPE_MPLS 219 /* * USB packets, beginning with a Linux USB header, with the USB header @@ -622,7 +646,7 @@ static const char rcsid[] _U_ = * DECT packets, with a pseudo-header; requested by * Matthias Wenzel . */ -#define LINKTYPE_DECT 221 +#define LINKTYPE_DECT 221 /* * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" @@ -633,7 +657,7 @@ static const char rcsid[] _U_ = * legal before I can submit a patch. * */ -#define LINKTYPE_AOS 222 +#define LINKTYPE_AOS 222 /* * Wireless HART (Highway Addressable Remote Transducer) @@ -642,13 +666,13 @@ static const char rcsid[] _U_ = * * Requested by Sam Roberts . */ -#define LINKTYPE_WIHART 223 +#define LINKTYPE_WIHART 223 /* * Fibre Channel FC-2 frames, beginning with a Frame_Header. * Requested by Kahou Lei . */ -#define LINKTYPE_FC_2 224 +#define LINKTYPE_FC_2 224 /* * Fibre Channel FC-2 frames, beginning with an encoding of the @@ -710,7 +734,7 @@ static const char rcsid[] _U_ = * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates * which of those it is. */ -#define LINKTYPE_IPNET 226 +#define LINKTYPE_IPNET 226 /* * CAN (Controller Area Network) frames, with a pseudo-header as supplied @@ -719,15 +743,114 @@ static const char rcsid[] _U_ = * * Requested by Felix Obenhuber . */ -#define LINKTYPE_CAN_SOCKETCAN 227 +#define LINKTYPE_CAN_SOCKETCAN 227 /* * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies * whether it's v4 or v6. Requested by Darren Reed . */ -#define LINKTYPE_IPV4 228 -#define LINKTYPE_IPV6 229 +#define LINKTYPE_IPV4 228 +#define LINKTYPE_IPV6 229 + +/* + * IEEE 802.15.4, exactly as it appears in the spec (no padding, no + * nothing), and with no FCS at the end of the frame; requested by + * Jon Smirl . + */ +#define LINKTYPE_IEEE802_15_4_NOFCS 230 + +/* + * Raw D-Bus: + * + * http://www.freedesktop.org/wiki/Software/dbus + * + * messages: + * + * http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages + * + * starting with the endianness flag, followed by the message type, etc., + * but without the authentication handshake before the message sequence: + * + * http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol + * + * Requested by Martin Vidner . + */ +#define LINKTYPE_DBUS 231 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + */ +#define LINKTYPE_JUNIPER_VS 232 +#define LINKTYPE_JUNIPER_SRX_E2E 233 +#define LINKTYPE_JUNIPER_FIBRECHANNEL 234 + +/* + * DVB-CI (DVB Common Interface for communication between a PC Card + * module and a DVB receiver). See + * + * http://www.kaiser.cx/pcap-dvbci.html + * + * for the specification. + * + * Requested by Martin Kaiser . + */ +#define LINKTYPE_DVB_CI 235 + +/* + * Variant of 3GPP TS 27.010 multiplexing protocol. Requested + * by Hans-Christoph Schemmel . + */ +#define LINKTYPE_MUX27010 236 + +/* + * STANAG 5066 D_PDUs. Requested by M. Baris Demiray + * . + */ +#define LINKTYPE_STANAG_5066_D_PDU 237 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + */ +#define LINKTYPE_JUNIPER_ATM_CEMIC 238 + +/* + * NetFilter LOG messages + * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets) + * + * Requested by Jakub Zawadzki + */ +#define LINKTYPE_NFLOG 239 +/* + * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type + * for Ethernet packets with a 4-byte pseudo-header and always + * with the payload including the FCS, as supplied by their + * netANALYZER hardware and software. + * + * Requested by Holger P. Frommer + */ +#define LINKTYPE_NETANALYZER 240 + +/* + * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type + * for Ethernet packets with a 4-byte pseudo-header and FCS and + * 1 byte of SFD, as supplied by their netANALYZER hardware and + * software. + * + * Requested by Holger P. Frommer + */ +#define LINKTYPE_NETANALYZER_TRANSPARENT 241 + +/* + * IP-over-Infiniband, as specified by RFC 4391. + * + * Requested by Petr Sumbera . + */ +#define LINKTYPE_IPOIB 242 + +#define LINKTYPE_MATCHING_MAX 242 /* highest value in the "matching" range */ static struct linktype_map { int dlt; @@ -744,7 +867,7 @@ static struct linktype_map { { DLT_PRONET, LINKTYPE_PRONET }, { DLT_CHAOS, LINKTYPE_CHAOS }, { DLT_IEEE802, LINKTYPE_TOKEN_RING }, - { DLT_ARCNET, LINKTYPE_ARCNET }, + { DLT_ARCNET, LINKTYPE_ARCNET_BSD }, { DLT_SLIP, LINKTYPE_SLIP }, { DLT_PPP, LINKTYPE_PPP }, { DLT_FDDI, LINKTYPE_FDDI }, @@ -785,295 +908,12 @@ static struct linktype_map { /* NetBSD PPP over Ethernet */ { DLT_PPP_ETHER, LINKTYPE_PPP_ETHER }, - /* IEEE 802.11 wireless */ - { DLT_IEEE802_11, LINKTYPE_IEEE802_11 }, - - /* Frame Relay */ - { DLT_FRELAY, LINKTYPE_FRELAY }, - - /* OpenBSD loopback */ - { DLT_LOOP, LINKTYPE_LOOP }, - - /* OpenBSD IPSEC enc */ - { DLT_ENC, LINKTYPE_ENC }, - - /* Linux cooked socket capture */ - { DLT_LINUX_SLL, LINKTYPE_LINUX_SLL }, - - /* Apple LocalTalk hardware */ - { DLT_LTALK, LINKTYPE_LTALK }, - - /* Acorn Econet */ - { DLT_ECONET, LINKTYPE_ECONET }, - - /* OpenBSD DLT_PFLOG */ - { DLT_PFLOG, LINKTYPE_PFLOG }, - - /* For Cisco-internal use */ - { DLT_CISCO_IOS, LINKTYPE_CISCO_IOS }, - - /* Prism II monitor-mode header plus 802.11 header */ - { DLT_PRISM_HEADER, LINKTYPE_PRISM_HEADER }, - - /* FreeBSD Aironet driver stuff */ - { DLT_AIRONET_HEADER, LINKTYPE_AIRONET_HEADER }, - - /* Siemens HiPath HDLC */ - { DLT_HHDLC, LINKTYPE_HHDLC }, - - /* RFC 2625 IP-over-Fibre Channel */ - { DLT_IP_OVER_FC, LINKTYPE_IP_OVER_FC }, - - /* Solaris+SunATM */ - { DLT_SUNATM, LINKTYPE_SUNATM }, - - /* RapidIO */ - { DLT_RIO, LINKTYPE_RIO }, - - /* PCI Express */ - { DLT_PCI_EXP, LINKTYPE_PCI_EXP }, - - /* Xilinx Aurora link layer */ - { DLT_AURORA, LINKTYPE_AURORA }, - - /* 802.11 plus BSD radio header */ - { DLT_IEEE802_11_RADIO, LINKTYPE_IEEE802_11_RADIO }, - - /* Tazmen Sniffer Protocol */ - { DLT_TZSP, LINKTYPE_TZSP }, - - /* Arcnet with Linux-style link-layer headers */ - { DLT_ARCNET_LINUX, LINKTYPE_ARCNET_LINUX }, - - /* Juniper-internal chassis encapsulation */ - { DLT_JUNIPER_MLPPP, LINKTYPE_JUNIPER_MLPPP }, - { DLT_JUNIPER_MLFR, LINKTYPE_JUNIPER_MLFR }, - { DLT_JUNIPER_ES, LINKTYPE_JUNIPER_ES }, - { DLT_JUNIPER_GGSN, LINKTYPE_JUNIPER_GGSN }, - { DLT_JUNIPER_MFR, LINKTYPE_JUNIPER_MFR }, - { DLT_JUNIPER_ATM2, LINKTYPE_JUNIPER_ATM2 }, - { DLT_JUNIPER_SERVICES, LINKTYPE_JUNIPER_SERVICES }, - { DLT_JUNIPER_ATM1, LINKTYPE_JUNIPER_ATM1 }, - - /* Apple IP-over-IEEE 1394 cooked header */ - { DLT_APPLE_IP_OVER_IEEE1394, LINKTYPE_APPLE_IP_OVER_IEEE1394 }, - - /* SS7 */ - { DLT_MTP2_WITH_PHDR, LINKTYPE_MTP2_WITH_PHDR }, - { DLT_MTP2, LINKTYPE_MTP2 }, - { DLT_MTP3, LINKTYPE_MTP3 }, - { DLT_SCCP, LINKTYPE_SCCP }, - - /* DOCSIS MAC frames */ - { DLT_DOCSIS, LINKTYPE_DOCSIS }, - - /* IrDA IrLAP packets + Linux-cooked header */ - { DLT_LINUX_IRDA, LINKTYPE_LINUX_IRDA }, - - /* IBM SP and Next Federation switches */ - { DLT_IBM_SP, LINKTYPE_IBM_SP }, - { DLT_IBM_SN, LINKTYPE_IBM_SN }, - - /* 802.11 plus AVS radio header */ - { DLT_IEEE802_11_RADIO_AVS, LINKTYPE_IEEE802_11_RADIO_AVS }, - /* - * Any platform that defines additional DLT_* codes should: - * - * request a LINKTYPE_* code and value from tcpdump.org, - * as per the above; - * - * add, in their version of libpcap, an entry to map - * those DLT_* codes to the corresponding LINKTYPE_* - * code; - * - * redefine, in their "net/bpf.h", any DLT_* values - * that collide with the values used by their additional - * DLT_* codes, to remove those collisions (but without - * making them collide with any of the LINKTYPE_* - * values equal to 50 or above; they should also avoid - * defining DLT_* values that collide with those - * LINKTYPE_* values, either). + * All LINKTYPE_ values between LINKTYPE_MATCHING_MIN + * and LINKTYPE_MATCHING_MAX are mapped to identical + * DLT_ values. */ - /* Juniper-internal chassis encapsulation */ - { DLT_JUNIPER_MONITOR, LINKTYPE_JUNIPER_MONITOR }, - - /* BACnet MS/TP */ - { DLT_BACNET_MS_TP, LINKTYPE_BACNET_MS_TP }, - - /* PPP for pppd, with direction flag in the PPP header */ - { DLT_PPP_PPPD, LINKTYPE_PPP_PPPD}, - - /* Juniper-internal chassis encapsulation */ - { DLT_JUNIPER_PPPOE, LINKTYPE_JUNIPER_PPPOE }, - { DLT_JUNIPER_PPPOE_ATM,LINKTYPE_JUNIPER_PPPOE_ATM }, - - /* GPRS LLC */ - { DLT_GPRS_LLC, LINKTYPE_GPRS_LLC }, - - /* Transparent Generic Framing Procedure (ITU-T G.7041/Y.1303) */ - { DLT_GPF_T, LINKTYPE_GPF_T }, - - /* Framed Generic Framing Procedure (ITU-T G.7041/Y.1303) */ - { DLT_GPF_F, LINKTYPE_GPF_F }, - - { DLT_GCOM_T1E1, LINKTYPE_GCOM_T1E1 }, - { DLT_GCOM_SERIAL, LINKTYPE_GCOM_SERIAL }, - - /* Juniper-internal chassis encapsulation */ - { DLT_JUNIPER_PIC_PEER, LINKTYPE_JUNIPER_PIC_PEER }, - - /* Endace types */ - { DLT_ERF_ETH, LINKTYPE_ERF_ETH }, - { DLT_ERF_POS, LINKTYPE_ERF_POS }, - - /* viSDN LAPD */ - { DLT_LINUX_LAPD, LINKTYPE_LINUX_LAPD }, - - /* Juniper meta-information before Ether, PPP, Frame Relay, C-HDLC Frames */ - { DLT_JUNIPER_ETHER, LINKTYPE_JUNIPER_ETHER }, - { DLT_JUNIPER_PPP, LINKTYPE_JUNIPER_PPP }, - { DLT_JUNIPER_FRELAY, LINKTYPE_JUNIPER_FRELAY }, - { DLT_JUNIPER_CHDLC, LINKTYPE_JUNIPER_CHDLC }, - - /* Multi Link Frame Relay (FRF.16) */ - { DLT_MFR, LINKTYPE_MFR }, - - /* Juniper Voice PIC */ - { DLT_JUNIPER_VP, LINKTYPE_JUNIPER_VP }, - - /* Controller Area Network (CAN) v2.0B */ - { DLT_A429, LINKTYPE_A429 }, - - /* Arinc 653 Interpartition Communication messages */ - { DLT_A653_ICM, LINKTYPE_A653_ICM }, - - /* USB */ - { DLT_USB, LINKTYPE_USB }, - - /* Bluetooth HCI UART transport layer */ - { DLT_BLUETOOTH_HCI_H4, LINKTYPE_BLUETOOTH_HCI_H4 }, - - /* IEEE 802.16 MAC Common Part Sublayer */ - { DLT_IEEE802_16_MAC_CPS, LINKTYPE_IEEE802_16_MAC_CPS }, - - /* USB with Linux header */ - { DLT_USB_LINUX, LINKTYPE_USB_LINUX }, - - /* Controller Area Network (CAN) v2.0B */ - { DLT_CAN20B, LINKTYPE_CAN20B }, - - /* IEEE 802.15.4 with address fields padded */ - { DLT_IEEE802_15_4_LINUX, LINKTYPE_IEEE802_15_4_LINUX }, - - /* Per Packet Information encapsulated packets */ - { DLT_PPI, LINKTYPE_PPI }, - - /* IEEE 802.16 MAC Common Part Sublayer plus radiotap header */ - { DLT_IEEE802_16_MAC_CPS_RADIO, LINKTYPE_IEEE802_16_MAC_CPS_RADIO }, - - /* Juniper Voice ISM */ - { DLT_JUNIPER_ISM, LINKTYPE_JUNIPER_ISM }, - - /* IEEE 802.15.4 exactly as it appears in the spec */ - { DLT_IEEE802_15_4, LINKTYPE_IEEE802_15_4 }, - - /* Various link-layer types for SITA */ - { DLT_SITA, LINKTYPE_SITA }, - - /* Various link-layer types for Endace */ - { DLT_ERF, LINKTYPE_ERF }, - - /* Special header for u10 Networks boards */ - { DLT_RAIF1, LINKTYPE_RAIF1 }, - - /* IPMB */ - { DLT_IPMB, LINKTYPE_IPMB }, - - /* Juniper Secure Tunnel */ - { DLT_JUNIPER_ST, LINKTYPE_JUNIPER_ST }, - - /* Bluetooth HCI UART transport layer, with pseudo-header */ - { DLT_BLUETOOTH_HCI_H4_WITH_PHDR, LINKTYPE_BLUETOOTH_HCI_H4_WITH_PHDR }, - - /* AX.25 with KISS header */ - { DLT_AX25_KISS, LINKTYPE_AX25_KISS }, - - /* Raw LAPD, with no pseudo-header */ - { DLT_LAPD, LINKTYPE_LAPD }, - - /* PPP with one-byte pseudo-header giving direction */ - { DLT_PPP_WITH_DIR, LINKTYPE_PPP_WITH_DIR }, - - /* Cisco HDLC with one-byte pseudo-header giving direction */ - { DLT_C_HDLC_WITH_DIR, LINKTYPE_C_HDLC_WITH_DIR }, - - /* Frame Relay with one-byte pseudo-header giving direction */ - { DLT_FRELAY_WITH_DIR, LINKTYPE_FRELAY_WITH_DIR }, - - /* LAPB with one-byte pseudo-header giving direction */ - { DLT_LAPB_WITH_DIR, LINKTYPE_LAPB_WITH_DIR }, - - /* IPMB with Linux pseudo-header */ - { DLT_IPMB_LINUX, LINKTYPE_IPMB_LINUX }, - - /* FlexRay */ - { DLT_FLEXRAY, LINKTYPE_FLEXRAY }, - - /* MOST */ - { DLT_MOST, LINKTYPE_MOST }, - - /* LIN */ - { DLT_LIN, LINKTYPE_LIN }, - - /* X2E-private serial line capture */ - { DLT_X2E_SERIAL, LINKTYPE_X2E_SERIAL }, - - /* X2E-private for Xoraya data logger family */ - { DLT_X2E_XORAYA, LINKTYPE_X2E_XORAYA }, - - /* IEEE 802.15.4 with PHY data for non-ASK PHYs */ - { DLT_IEEE802_15_4_NONASK_PHY, LINKTYPE_IEEE802_15_4_NONASK_PHY }, - - /* Input device events from Linux /dev/input/eventN devices */ - { DLT_LINUX_EVDEV, LINKTYPE_LINUX_EVDEV }, - - /* GSM types */ - { DLT_GSMTAP_UM, LINKTYPE_GSMTAP_UM }, - { DLT_GSMTAP_ABIS, LINKTYPE_GSMTAP_ABIS }, - - /* MPLS, with an MPLS label as the link-layer header */ - { DLT_MPLS, LINKTYPE_MPLS }, - - /* USB with padded Linux header */ - { DLT_USB_LINUX_MMAPPED, LINKTYPE_USB_LINUX_MMAPPED }, - - /* DECT packets with a pseudo-header */ - { DLT_DECT, LINKTYPE_DECT }, - - /* AOS Space Data Link Protocol */ - { DLT_AOS, LINKTYPE_AOS }, - - /* Wireless HART */ - { DLT_WIHART, LINKTYPE_WIHART }, - - /* Fibre Channel FC-2 frames without SOF or EOF */ - { DLT_FC_2, LINKTYPE_FC_2 }, - - /* Fibre Channel FC-2 frames with SOF and EOF */ - { DLT_FC_2_WITH_FRAME_DELIMS, LINKTYPE_FC_2_WITH_FRAME_DELIMS }, - - /* Solaris IPNET */ - { DLT_IPNET, LINKTYPE_IPNET }, - - /* CAN frames with SocketCAN headers */ - { DLT_CAN_SOCKETCAN, LINKTYPE_CAN_SOCKETCAN }, - - /* Raw IPv4/IPv6 */ - { DLT_IPV4, LINKTYPE_IPV4 }, - { DLT_IPV6, LINKTYPE_IPV6 }, - { -1, -1 } }; @@ -1082,6 +922,15 @@ dlt_to_linktype(int dlt) { int i; + /* + * Map the values in the matching range. + */ + if (dlt >= DLT_MATCHING_MIN && dlt <= DLT_MATCHING_MAX) + return (dlt); + + /* + * Map the values outside that range. + */ for (i = 0; map[i].dlt != -1; i++) { if (map[i].dlt == dlt) return (map[i].linktype); @@ -1089,8 +938,8 @@ dlt_to_linktype(int dlt) /* * If we don't have a mapping for this DLT_ code, return an - * error; that means that the table above needs to have an - * entry added. + * error; that means that this is a value with no corresponding + * LINKTYPE_ code, and we need to assign one. */ return (-1); } @@ -1100,6 +949,16 @@ linktype_to_dlt(int linktype) { int i; + /* + * Map the values in the matching range. + */ + if (linktype >= LINKTYPE_MATCHING_MIN && + linktype <= LINKTYPE_MATCHING_MAX) + return (linktype); + + /* + * Map the values outside that range. + */ for (i = 0; map[i].linktype != -1; i++) { if (map[i].linktype == linktype) return (map[i].dlt); @@ -1127,33 +986,72 @@ 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; + * we skip the field *before* checking to make sure + * the captured data length includes the entire field. + */ /* * The URB id is a totally opaque value; do we really need to * convert it to the reading host's byte order??? */ - if (hdr->caplen < 8) + offset += 8; /* skip past id */ + if (hdr->caplen < offset) return; uhdr->id = SWAPLL(uhdr->id); - if (hdr->caplen < 14) + + offset += 4; /* skip past various 1-byte fields */ + + offset += 2; /* skip past bus_id */ + if (hdr->caplen < offset) return; uhdr->bus_id = SWAPSHORT(uhdr->bus_id); - if (hdr->caplen < 24) + + offset += 2; /* skip past various 1-byte fields */ + + offset += 8; /* skip past ts_sec */ + if (hdr->caplen < offset) return; uhdr->ts_sec = SWAPLL(uhdr->ts_sec); - if (hdr->caplen < 28) + + offset += 4; /* skip past ts_usec */ + if (hdr->caplen < offset) return; uhdr->ts_usec = SWAPLONG(uhdr->ts_usec); - if (hdr->caplen < 32) + + offset += 4; /* skip past status */ + if (hdr->caplen < offset) return; uhdr->status = SWAPLONG(uhdr->status); - if (hdr->caplen < 36) + + offset += 4; /* skip past urb_len */ + if (hdr->caplen < offset) return; uhdr->urb_len = SWAPLONG(uhdr->urb_len); - if (hdr->caplen < 40) + + offset += 4; /* skip past data_len */ + if (hdr->caplen < offset) return; uhdr->data_len = SWAPLONG(uhdr->data_len); + if (uhdr->transfer_type == URB_ISOCHRONOUS) { + offset += 4; /* skip past s.iso.error_count */ + if (hdr->caplen < offset) + return; + uhdr->s.iso.error_count = SWAPLONG(uhdr->s.iso.error_count); + + offset += 4; /* skip past s.iso.numdesc */ + if (hdr->caplen < offset) + return; + uhdr->s.iso.numdesc = SWAPLONG(uhdr->s.iso.numdesc); + } else + offset += 8; /* skip USB setup header */ + if (header_len_64_bytes) { /* * This is either the "version 1" header, with @@ -1163,17 +1061,50 @@ swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf, * at the end. Byte swap them as if this were * a "version 1" header. */ - if (hdr->caplen < 52) + offset += 4; /* skip past interval */ + if (hdr->caplen < offset) return; uhdr->interval = SWAPLONG(uhdr->interval); - if (hdr->caplen < 56) + + offset += 4; /* skip past start_frame */ + if (hdr->caplen < offset) return; uhdr->start_frame = SWAPLONG(uhdr->start_frame); - if (hdr->caplen < 60) + + offset += 4; /* skip past xfer_flags */ + if (hdr->caplen < offset) return; uhdr->xfer_flags = SWAPLONG(uhdr->xfer_flags); - if (hdr->caplen < 64) + + offset += 4; /* skip past ndesc */ + if (hdr->caplen < offset) return; uhdr->ndesc = SWAPLONG(uhdr->ndesc); } + + if (uhdr->transfer_type == URB_ISOCHRONOUS) { + /* swap the values in struct linux_usb_isodesc */ + 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); + + offset += 4; /* skip past offset */ + if (hdr->caplen < offset) + return; + pisodesc->offset = SWAPLONG(pisodesc->offset); + + offset += 4; /* skip past len */ + if (hdr->caplen < offset) + return; + pisodesc->len = SWAPLONG(pisodesc->len); + + offset += 4; /* skip past padding */ + + pisodesc++; + } + } } diff --git a/libpcap/pcap-config.in b/libpcap/pcap-config.in index 37526d7fed..206be3b4a6 100644 --- a/libpcap/pcap-config.in +++ b/libpcap/pcap-config.in @@ -4,6 +4,13 @@ # Script to give the appropriate compiler flags and linker flags # to use when building code that uses libpcap. # +prefix="@prefix@" +exec_prefix="@exec_prefix@" +includedir="@includedir@" +libdir="@libdir@" +V_RPATH_OPT="@V_RPATH_OPT@" +LIBS="@LIBS@" + static=0 show_cflags=0 show_libs=0 @@ -29,14 +36,14 @@ do esac shift done -if [ "@V_RPATH_OPT@" != "" ] +if [ "$V_RPATH_OPT" != "" ] then # # If libdir isn't /usr/lib, add it to the run-time linker path. # - if [ "@libdir@" != "/usr/lib" ] + if [ "$libdir" != "/usr/lib" ] then - RPATH=@V_RPATH_OPT@@libdir@ + RPATH=$V_RPATH_OPT$libdir fi fi if [ "$static" = 1 ] @@ -47,19 +54,19 @@ then # if [ "$show_cflags" = 1 -a "$show_libs" = 1 ] then - echo "-I@includedir@ -L@libdir@ -lpcap @LIBS@" + echo "-I$includedir -L$libdir -lpcap $LIBS" elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ] then - echo "-I@includedir@ -L@libdir@ @LIBS@" + echo "-I$includedir -L$libdir $LIBS" elif [ "$show_cflags" = 1 ] then - echo "-I@includedir@" + echo "-I$includedir" elif [ "$show_libs" = 1 ] then - echo "-L@libdir@ -lpcap @LIBS@" + echo "-L$libdir -lpcap $LIBS" elif [ "$show_additional_libs" = 1 ] then - echo "@LIBS@" + echo "$LIBS" fi else # @@ -68,15 +75,15 @@ else # if [ "$show_cflags" = 1 -a "$show_libs" = 1 ] then - echo "-I@includedir@ -L@libdir@ $RPATH -lpcap" + echo "-I$includedir -L$libdir $RPATH -lpcap" elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ] then - echo "-I@includedir@" + echo "-I$includedir" elif [ "$show_cflags" = 1 ] then - echo "-I@includedir@" + echo "-I$includedir" elif [ "$show_libs" = 1 ] then - echo "-L@libdir@ $RPATH -lpcap" + echo "-L$libdir $RPATH -lpcap" fi fi diff --git a/libpcap/pcap-dag.c b/libpcap/pcap-dag.c index 938ec26dce..b5de0691b9 100644 --- a/libpcap/pcap-dag.c +++ b/libpcap/pcap-dag.c @@ -879,8 +879,8 @@ dag_platform_finddevs(pcap_if_t **devlistp, char *errbuf) int dagstream; int dagfd; - /* Try all the DAGs 0-9 */ - for (c = 0; c < 9; c++) { + /* Try all the DAGs 0-31 */ + for (c = 0; c < 32; c++) { snprintf(name, 12, "dag%d", c); if (-1 == dag_parse_name(name, dagname, DAGNAME_BUFSIZE, &dagstream)) { @@ -897,7 +897,7 @@ dag_platform_finddevs(pcap_if_t **devlistp, char *errbuf) { int stream, rxstreams; rxstreams = dag_rx_get_stream_count(dagfd); - for(stream=0;stream<16;stream+=2) { + for(stream=0;streamfd = open(dname, O_RDWR)) < 0) { if (errno != ENOENT) { - if (errno == EACCES) + if (errno == EPERM || errno == EACCES) status = PCAP_ERROR_PERM_DENIED; snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s", dname, pcap_strerror(errno)); @@ -486,7 +485,7 @@ pcap_activate_dlpi(pcap_t *p) snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: No DLPI device found", p->opt.source); } else { - if (errno == EACCES) + if (errno == EPERM || errno == EACCES) status = PCAP_ERROR_PERM_DENIED; snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s", dname2, pcap_strerror(errno)); @@ -610,9 +609,12 @@ pcap_activate_dlpi(pcap_t *p) /* ** Enable promiscuous (not necessary on send FD) */ - if (dlpromisconreq(p->fd, DL_PROMISC_PHYS, p->errbuf) < 0 || - dlokack(p->fd, "promisc_phys", (char *)buf, p->errbuf) < 0) + status = dlpromiscon(p, DL_PROMISC_PHYS); + if (status < 0) { + if (status == PCAP_ERROR_PERM_DENIED) + status = PCAP_ERROR_PROMISC_PERM_DENIED; goto bad; + } /* ** Try to enable multicast (you would have thought @@ -620,8 +622,8 @@ pcap_activate_dlpi(pcap_t *p) ** HP-UX or SINIX) (Not necessary on send FD) */ #if !defined(__hpux) && !defined(sinix) - if (dlpromisconreq(p->fd, DL_PROMISC_MULTI, p->errbuf) < 0 || - dlokack(p->fd, "promisc_multi", (char *)buf, p->errbuf) < 0) + status = dlpromiscon(p, DL_PROMISC_MULTI); + if (status < 0) status = PCAP_WARNING; #endif } @@ -631,20 +633,27 @@ pcap_activate_dlpi(pcap_t *p) ** under SINIX) (Not necessary on send FD) */ #ifndef sinix - if ( -#ifdef __hpux - !p->opt.promisc && -#endif -#ifdef HAVE_SOLARIS - !isatm && +#if defined(__hpux) + /* HP-UX - only do this when not in promiscuous mode */ + if (!p->opt.promisc) { +#elif defined(HAVE_SOLARIS) + /* Solaris - don't do this on SunATM devices */ + if (!isatm) { +#else + /* Everything else (except for SINIX) - always do this */ + { #endif - (dlpromisconreq(p->fd, DL_PROMISC_SAP, p->errbuf) < 0 || - dlokack(p->fd, "promisc_sap", (char *)buf, p->errbuf) < 0)) { - /* Not fatal if promisc since the DL_PROMISC_PHYS worked */ - if (p->opt.promisc) - status = PCAP_WARNING; - else - goto bad; + 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) + status = PCAP_WARNING; + else + goto bad; + } } #endif /* sinix */ @@ -815,11 +824,15 @@ split_dname(char *device, int *unitp, char *ebuf) static int dl_doattach(int fd, int ppa, char *ebuf) { + dl_attach_req_t req; bpf_u_int32 buf[MAXDLBUF]; int err; - if (dlattachreq(fd, ppa, ebuf) < 0) + req.dl_primitive = DL_ATTACH_REQ; + req.dl_ppa = ppa; + if (send_request(fd, (char *)&req, sizeof(req), "attach", ebuf) < 0) return (PCAP_ERROR); + err = dlokack(fd, "attach", (char *)buf, ebuf); if (err < 0) return (err); @@ -877,6 +890,27 @@ dl_dohpuxbind(int fd, char *ebuf) } #endif +#define STRINGIFY(n) #n + +static int +dlpromiscon(pcap_t *p, bpf_u_int32 level) +{ + dl_promiscon_req_t req; + bpf_u_int32 buf[MAXDLBUF]; + int err; + + req.dl_primitive = DL_PROMISCON_REQ; + req.dl_level = level; + if (send_request(p->fd, (char *)&req, sizeof(req), "promiscon", + p->errbuf) < 0) + return (PCAP_ERROR); + err = dlokack(p->fd, "promiscon" STRINGIFY(level), (char *)buf, + p->errbuf); + if (err < 0) + return (err); + return (0); +} + int pcap_platform_finddevs(pcap_if_t **alldevsp, char *errbuf) { @@ -986,7 +1020,8 @@ recv_ack(int fd, int size, const char *what, char *bufp, char *ebuf, int *uerror snprintf(ebuf, PCAP_ERRBUF_SIZE, "recv_ack: %s: UNIX error - %s", what, pcap_strerror(dlp->error_ack.dl_unix_errno)); - if (dlp->error_ack.dl_unix_errno == EACCES) + if (dlp->error_ack.dl_unix_errno == EPERM || + dlp->error_ack.dl_unix_errno == EACCES) return (PCAP_ERROR_PERM_DENIED); break; @@ -1221,17 +1256,6 @@ dlprim(bpf_u_int32 prim) } } -static int -dlattachreq(int fd, bpf_u_int32 ppa, char *ebuf) -{ - dl_attach_req_t req; - - req.dl_primitive = DL_ATTACH_REQ; - req.dl_ppa = ppa; - - return (send_request(fd, (char *)&req, sizeof(req), "attach", ebuf)); -} - static int dlbindreq(int fd, bpf_u_int32 sap, char *ebuf) { @@ -1259,17 +1283,6 @@ dlbindack(int fd, char *bufp, char *ebuf, int *uerror) return (recv_ack(fd, DL_BIND_ACK_SIZE, "bind", bufp, ebuf, uerror)); } -static int -dlpromisconreq(int fd, bpf_u_int32 level, char *ebuf) -{ - dl_promiscon_req_t req; - - req.dl_primitive = DL_PROMISCON_REQ; - req.dl_level = level; - - return (send_request(fd, (char *)&req, sizeof(req), "promiscon", ebuf)); -} - static int dlokack(int fd, const char *what, char *bufp, char *ebuf) { diff --git a/libpcap/pcap-filter.manmisc.in b/libpcap/pcap-filter.manmisc.in index 6b826e3cc4..d7b4b0a5f0 100644 --- a/libpcap/pcap-filter.manmisc.in +++ b/libpcap/pcap-filter.manmisc.in @@ -65,6 +65,8 @@ Possible directions are .BR dst , .BR "src or dst" , .BR "src and dst" , +.BR ra , +.BR ta , .BR addr1 , .BR addr2 , .BR addr3 , @@ -76,6 +78,8 @@ there is no dir qualifier, .B "src or dst" is assumed. The +.BR ra , +.BR ta , .BR addr1 , .BR addr2 , .BR addr3 , @@ -472,6 +476,15 @@ and .B scrub (applies only to packets logged by OpenBSD's or FreeBSD's .BR pf (4)). +.IP "\fBwlan ra \fIehost\fR" +True if the IEEE 802.11 RA is +.IR ehost . +The RA field is used in all frames except for management frames. +.IP "\fBwlan ta \fIehost\fR" +True if the IEEE 802.11 TA is +.IR ehost . +The TA field is used in all frames except for management frames and +CTS (Clear To Send) and ACK (Acknowledgment) control frames. .IP "\fBwlan addr1 \fIehost\fR" True if the first IEEE 802.11 address is .IR ehost . @@ -490,7 +503,7 @@ True if the fourth IEEE 802.11 address, if present, is .IR ehost . The fourth address field is only used for WDS (Wireless Distribution System) frames. -.IP "\fBip\fR, \fBip6\fR, \fBarp\fR, \fBrarp\fR, \fBatalk\fR, \fBaarp\fR, \fBdecnet\fR, \fBiso\fR, \fBstp\fR, \fBipx\fR, \fInetbeui\fP" +.IP "\fBip\fR, \fBip6\fR, \fBarp\fR, \fBrarp\fR, \fBatalk\fR, \fBaarp\fR, \fBdecnet\fR, \fBiso\fR, \fBstp\fR, \fBipx\fR, \fBnetbeui\fP" Abbreviations for: .in +.5i .nf diff --git a/libpcap/pcap-int.h b/libpcap/pcap-int.h index c3afbade52..8444e62cee 100644 --- a/libpcap/pcap-int.h +++ b/libpcap/pcap-int.h @@ -209,6 +209,7 @@ struct pcap_opt { char *source; int promisc; int rfmon; + int tstamp_type; }; /* @@ -331,6 +332,8 @@ struct pcap { char errbuf[PCAP_ERRBUF_SIZE + 1]; int dlt_count; u_int *dlt_list; + int tstamp_type_count; + u_int *tstamp_type_list; struct pcap_pkthdr pcap_header; /* This is needed for the pcap_next_ex() to work */ }; diff --git a/libpcap/pcap-libdlpi.c b/libpcap/pcap-libdlpi.c index 87cd08b7d9..8d6a0386e0 100644 --- a/libpcap/pcap-libdlpi.c +++ b/libpcap/pcap-libdlpi.c @@ -49,6 +49,7 @@ static const char rcsid[] _U_ = #include "dlpisubs.h" /* Forwards. */ +static int dlpromiscon(pcap_t *, bpf_u_int32); static int pcap_read_libdlpi(pcap_t *, int, pcap_handler, u_char *); static int pcap_inject_libdlpi(pcap_t *, const void *, size_t); static void pcap_close_libdlpi(pcap_t *); @@ -114,7 +115,8 @@ pcap_activate_libdlpi(pcap_t *p) if (retv != DLPI_SUCCESS) { if (retv == DLPI_ELINKNAMEINVAL || retv == DLPI_ENOLINK) err = PCAP_ERROR_NO_SUCH_DEVICE; - else if (retv == DL_SYSERR && errno == EACCES) + else if (retv == DL_SYSERR && + (errno == EPERM || errno == EACCES)) err = PCAP_ERROR_PERM_DENIED; pcap_libdlpi_err(p->opt.source, "dlpi_open", retv, p->errbuf); @@ -139,34 +141,43 @@ pcap_activate_libdlpi(pcap_t *p) /* Enable promiscuous mode. */ if (p->opt.promisc) { - retv = dlpi_promiscon(p->dlpi_hd, DL_PROMISC_PHYS); - if (retv != DLPI_SUCCESS) { - pcap_libdlpi_err(p->opt.source, - "dlpi_promisc(PHYSICAL)", retv, p->errbuf); + err = dlpromiscon(p, DL_PROMISC_PHYS); + if (err < 0) { + /* + * "You don't have permission to capture on + * this device" and "you don't have permission + * to capture in promiscuous mode on this + * device" are different; let the user know, + * so if they can't get permission to + * capture in promiscuous mode, they can at + * least try to capture in non-promiscuous + * mode. + * + * 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; goto bad; } } else { /* Try to enable multicast. */ - retv = dlpi_promiscon(p->dlpi_hd, DL_PROMISC_MULTI); - if (retv != DLPI_SUCCESS) { - pcap_libdlpi_err(p->opt.source, "dlpi_promisc(MULTI)", - retv, p->errbuf); + err = dlpromiscon(p, DL_PROMISC_MULTI); + if (err < 0) goto bad; - } } /* Try to enable SAP promiscuity. */ - retv = dlpi_promiscon(p->dlpi_hd, DL_PROMISC_SAP); - if (retv != DLPI_SUCCESS) { - if (p->opt.promisc) { - pcap_libdlpi_err(p->opt.source, "dlpi_promisc(SAP)", - retv, p->errbuf); + err = dlpromiscon(p, DL_PROMISC_SAP); + if (err < 0) { + /* + * Not fatal, since the DL_PROMISC_PHYS mode worked. + * Report it as a warning, however. + */ + if (p->opt.promisc) + err = PCAP_WARNING; + else goto bad; - } - - /* Not fatal, since the DL_PROMISC_PHYS mode worked. */ - fprintf(stderr, "WARNING: dlpi_promisc(SAP) failed on" - " %s:(%s)\n", p->opt.source, dlpi_strerror(retv)); } /* Determine link type. */ @@ -219,6 +230,27 @@ pcap_activate_libdlpi(pcap_t *p) return (err); } +#define STRINGIFY(n) #n + +static int +dlpromiscon(pcap_t *p, bpf_u_int32 level) +{ + int err; + + retv = dlpi_promiscon(p->hd, level); + if (retv != DLPI_SUCCESS) { + if (retv == DL_SYSERR && + (errno == EPERM || errno == EACCES)) + err = PCAP_ERROR_PERM_DENIED; + else + err = PCAP_ERROR; + pcap_libdlpi_err(p->opt.source, "dlpi_promiscon" STRINGIFY(level), + retv, p->errbuf); + return (err); + } + return (0); +} + /* * In Solaris, the "standard" mechanism" i.e SIOCGLIFCONF will only find * network links that are plumbed and are up. dlpi_walk(3DLPI) will find diff --git a/libpcap/pcap-linktype.manmisc.in b/libpcap/pcap-linktype.manmisc.in index fa156120ff..890438728a 100644 --- a/libpcap/pcap-linktype.manmisc.in +++ b/libpcap/pcap-linktype.manmisc.in @@ -44,241 +44,7 @@ by The names for those values begin with .BR LINKTYPE_ . .PP -The link-layer header types supported by libpcap are listed here. The -value corresponding to -.B LINKTYPE_ -names are given; the value corresponding to -.B DLT_ -values are, in some cases, platform dependent, and are not given; -applications should check for particular -.B DLT_ -values by name. -.RS 5 -.TP 5 -.BR DLT_NULL "; " LINKTYPE_NULL = 0 -BSD loopback encapsulation; the link-layer header is a 4-byte field, in -.I host -byte order, containing a PF_ value from -.B socket.h -for the network-layer protocol of the packet. -.IP -Note that ``host byte order'' is the byte order of the machine on which -the packets are captured, and the PF_ values are for the OS of the -machine on which the packets are captured; if a live capture is being -done, ``host byte order'' is the byte order of the machine capturing the -packets, and the PF_ values are those of the OS of the machine capturing -the packets, but if a ``savefile'' is being read, the byte order and PF_ -values are -.I not -necessarily those of the machine reading the capture file. -.TP 5 -.BR DLT_EN10MB "; " LINKTYPE_ETHERNET = 1 -Ethernet (10Mb, 100Mb, 1000Mb, and up); the -.B 10MB -in the -.B DLT_ -name is historical. -.TP 5 -.BR DLT_IEEE802 "; " LINKTYPE_TOKEN_RING = 6 -IEEE 802.5 Token Ring; the -.B IEEE802 -in the -.B DLT_ -name is historical. -.TP 5 -.BR DLT_ARCNET "; " LINKTYPE_ARCNET = 7 -ARCNET -.TP 5 -.BR DLT_SLIP "; " LINKTYPE_SLIP = 8 -SLIP; the link-layer header contains, in order: -.RS 10 -.LP -a 1-byte flag, which is 0 for packets received by the machine and 1 for -packets sent by the machine; -.LP -a 1-byte field, the upper 4 bits of which indicate the type of packet, -as per RFC 1144: -.RS 5 -.TP 5 -0x40 -an unmodified IP datagram (TYPE_IP); -.TP 5 -0x70 -an uncompressed-TCP IP datagram (UNCOMPRESSED_TCP), with that byte being -the first byte of the raw IP header on the wire, containing the -connection number in the protocol field; -.TP 5 -0x80 -a compressed-TCP IP datagram (COMPRESSED_TCP), with that byte being the -first byte of the compressed TCP/IP datagram header; -.RE -.LP -for UNCOMPRESSED_TCP, the rest of the modified IP header, and for -COMPRESSED_TCP, the compressed TCP/IP datagram header; -.RE -.RS 5 -.LP -for a total of 16 bytes; the uncompressed IP datagram follows the header. -.RE -.TP 5 -.BR DLT_PPP "; " LINKTYPE_PPP = 9 -PPP; if the first 2 bytes are 0xff and 0x03, it's PPP in HDLC-like -framing, with the PPP header following those two bytes, otherwise it's -PPP without framing, and the packet begins with the PPP header. -.TP 5 -.BR DLT_FDDI "; " LINKTYPE_FDDI = 10 -FDDI -.TP 5 -.BR DLT_ATM_RFC1483 "; " LINKTYPE_ATM_RFC1483 = 100 -RFC 1483 LLC/SNAP-encapsulated ATM; the packet begins with an IEEE 802.2 -LLC header. -.TP 5 -.BR DLT_RAW "; " LINKTYPE_RAW = 101 -raw IP; the packet begins with an IP header. -.TP 5 -.BR DLT_PPP_SERIAL "; " LINKTYPE_PPP_HDLC = 50 -PPP in HDLC-like framing, as per RFC 1662, or Cisco PPP with HDLC -framing, as per section 4.3.1 of RFC 1547; the first byte will be 0xFF -for PPP in HDLC-like framing, and will be 0x0F or 0x8F for Cisco PPP -with HDLC framing. -.TP 5 -.BR DLT_PPP_ETHER "; " LINKTYPE_PPP_ETHER = 51 -PPPoE; the packet begins with a PPPoE header, as per RFC 2516. -.TP 5 -.BR DLT_C_HDLC "; " LINKTYPE_C_HDLC = 104 -Cisco PPP with HDLC framing, as per section 4.3.1 of RFC 1547. -.TP 5 -.BR DLT_IEEE802_11 "; " LINKTYPE_IEEE802_11 = 105 -IEEE 802.11 wireless LAN -.TP 5 -.BR DLT_FRELAY "; " LINKTYPE_FRELAY = 107 -Frame Relay -.TP 5 -.BR DLT_LOOP "; " LINKTYPE_LOOP = 108 -OpenBSD loopback encapsulation; the link-layer header is a 4-byte field, in -.I network -byte order, containing a PF_ value from OpenBSD's -.B socket.h -for the network-layer protocol of the packet. -.IP -Note that, if a ``savefile'' is being read, those PF_ values are -.I not -necessarily those of the machine reading the capture file. -.TP 5 -.BR DLT_LINUX_SLL "; " LINKTYPE_LINUX_SLL = 113 -Linux "cooked" capture encapsulation; the link-layer header contains, in -order: -.RS 10 -.LP -a 2-byte "packet type", in network byte order, which is one of: -.RS 5 -.TP 5 -0 -packet was sent to us by somebody else -.TP 5 -1 -packet was broadcast by somebody else -.TP 5 -2 -packet was multicast, but not broadcast, by somebody else -.TP 5 -3 -packet was sent by somebody else to somebody else -.TP 5 -4 -packet was sent by us -.RE -.LP -a 2-byte field, in network byte order, containing a Linux ARPHRD_ value -for the link-layer device type; -.LP -a 2-byte field, in network byte order, containing the length of the -link-layer address of the sender of the packet (which could be 0); -.LP -an 8-byte field containing that number of bytes of the link-layer -address of the sender (if there are more than 8 bytes, only the first -8 are present, and if there are fewer than 8 bytes, there are padding -bytes after the address to pad the field to 8 bytes); -.LP -a 2-byte field containing an Ethernet protocol type, in network byte -order, or containing 1 for Novell 802.3 frames without an 802.2 LLC -header or 4 for frames beginning with an 802.2 LLC header. -.RE -.TP 5 -.BR DLT_LTALK "; " LINKTYPE_LTALK = 104 -Apple LocalTalk; the packet begins with an AppleTalk LLAP header. -.TP 5 -.BR DLT_PFLOG "; " LINKTYPE_PFLOG = 117 -OpenBSD pflog; the link-layer header contains a -.B "struct pfloghdr" -structure, as defined by the host on which the file was saved. (This -differs from operating system to operating system and release to -release; there is nothing in the file to indicate what the layout of -that structure is.) -.TP 5 -.BR DLT_PRISM_HEADER "; " LINKTYPE_PRISM_HEADER = 119 -Prism monitor mode information followed by an 802.11 header. -.TP 5 -.BR DLT_IP_OVER_FC "; " LINKTYPE_IP_OVER_FC = 122 -RFC 2625 IP-over-Fibre Channel, with the link-layer header being the -Network_Header as described in that RFC. -.TP 5 -.BR DLT_SUNATM "; " LINKTYPE_SUNATM = 123 -SunATM devices; the link-layer header contains, in order: -.RS 10 -.LP -a 1-byte flag field, containing a direction flag in the uppermost bit, -which is set for packets transmitted by the machine and clear for -packets received by the machine, and a 4-byte traffic type in the -low-order 4 bits, which is one of: -.RS 5 -.TP 5 -0 -raw traffic -.TP 5 -1 -LANE traffic -.TP 5 -2 -LLC-encapsulated traffic -.TP 5 -3 -MARS traffic -.TP 5 -4 -IFMP traffic -.TP 5 -5 -ILMI traffic -.TP 5 -6 -Q.2931 traffic -.RE -.LP -a 1-byte VPI value; -.LP -a 2-byte VCI field, in network byte order. -.RE -.TP 5 -.BR DLT_IEEE802_11_RADIO "; " LINKTYPE_IEEE802_11_RADIO = 127 -link-layer information followed by an 802.11 header - see -http://www.shaftnet.org/~pizza/software/capturefrm.txt for a description -of the link-layer information. -.TP 5 -.BR DLT_ARCNET_LINUX "; " LINKTYPE_ARCNET_LINUX = 129 -ARCNET, with no exception frames, reassembled packets rather than raw -frames, and an extra 16-bit offset field between the destination host -and type bytes. -.TP 5 -.BR DLT_LINUX_IRDA "; " LINKTYPE_LINUX_IRDA = 144 -Linux-IrDA packets, with a -.B DLT_LINUX_SLL -header followed by the IrLAP header. -.TP 5 -.BR DLT_LINUX_LAPD "; " LINKTYPE_LINUX_LAPD = 177 -LAPD (Q.921) frames, with a -.B DLT_LINUX_SLL -header captured via vISDN. -.RE +The link-layer header types supported by libpcap are described at +http://www.tcpdump.org/linktypes.html. .SH SEE ALSO pcap_datalink(3PCAP) diff --git a/libpcap/pcap-linux.c b/libpcap/pcap-linux.c index ca06fab99b..97092ac35c 100644 --- a/libpcap/pcap-linux.c +++ b/libpcap/pcap-linux.c @@ -138,26 +138,6 @@ static const char rcsid[] _U_ = #include #include -/* - * Got Wireless Extensions? - */ -#ifdef HAVE_LINUX_WIRELESS_H -#include -#endif /* HAVE_LINUX_WIRELESS_H */ - -/* - * Got libnl? - */ -#ifdef HAVE_LIBNL -#include - -#include -#include -#include -#include -#include -#endif /* HAVE_LIBNL */ - #include "pcap-int.h" #include "pcap/sll.h" #include "pcap/vlan.h" @@ -186,6 +166,10 @@ static const char rcsid[] _U_ = #include "pcap-can-linux.h" #endif +#ifdef PCAP_SUPPORT_NETFILTER +#include "pcap-netfilter-linux.h" +#endif + /* * If PF_PACKET is defined, we can use {SOCK_RAW,SOCK_DGRAM}/PF_PACKET * sockets rather than SOCK_PACKET sockets. @@ -232,10 +216,10 @@ static const char rcsid[] _U_ = # endif /* PACKET_HOST */ + /* 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 - /* 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 TPACKET2_HDRLEN @@ -252,6 +236,46 @@ static const char rcsid[] _U_ = #include #endif +/* + * We need linux/sockios.h if we have linux/net_tstamp.h (for time stamp + * specification) or linux/ethtool.h (for ethtool ioctls to get offloading + * information). + */ +#if defined(HAVE_LINUX_NET_TSTAMP_H) || defined(HAVE_LINUX_ETHTOOL_H) +#include +#endif + +#ifdef HAVE_LINUX_NET_TSTAMP_H +#include +#endif + +/* + * Got Wireless Extensions? + */ +#ifdef HAVE_LINUX_WIRELESS_H +#include +#endif /* HAVE_LINUX_WIRELESS_H */ + +/* + * Got libnl? + */ +#ifdef HAVE_LIBNL +#include + +#include +#include +#include +#include +#include +#endif /* HAVE_LIBNL */ + +/* + * Got ethtool support? + */ +#ifdef HAVE_LINUX_ETHTOOL_H +#include +#endif + #ifndef HAVE_SOCKLEN_T typedef int socklen_t; #endif @@ -297,7 +321,7 @@ static short int map_packet_type_to_sll_type(short int); static int pcap_activate_linux(pcap_t *); static int activate_old(pcap_t *); static int activate_new(pcap_t *); -static int activate_mmap(pcap_t *); +static int activate_mmap(pcap_t *, int *); static int pcap_can_set_rfmon_linux(pcap_t *); static int pcap_read_linux(pcap_t *, int, pcap_handler, u_char *); static int pcap_read_packet(pcap_t *, pcap_handler, u_char *); @@ -317,7 +341,7 @@ union thdr { #define RING_GET_FRAME(h) (((union thdr **)h->buffer)[h->offset]) static void destroy_ring(pcap_t *handle); -static int create_ring(pcap_t *handle); +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(pcap_t *, int, pcap_handler , u_char *); @@ -333,7 +357,7 @@ static void pcap_oneshot_mmap(u_char *user, const struct pcap_pkthdr *h, */ #ifdef HAVE_PF_PACKET_SOCKETS static int iface_get_id(int fd, const char *device, char *ebuf); -#endif +#endif /* HAVE_PF_PACKET_SOCKETS */ static int iface_get_mtu(int fd, const char *device, char *ebuf); static int iface_get_arptype(int fd, const char *device, char *ebuf); #ifdef HAVE_PF_PACKET_SOCKETS @@ -344,6 +368,7 @@ 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 */ +static int iface_get_offload(pcap_t *handle); static int iface_bind_old(int fd, const char *device, char *ebuf); #ifdef SO_ATTACH_FILTER @@ -357,7 +382,7 @@ static struct sock_filter total_insn = BPF_STMT(BPF_RET | BPF_K, 0); static struct sock_fprog total_fcode = { 1, &total_insn }; -#endif +#endif /* SO_ATTACH_FILTER */ pcap_t * pcap_create(const char *device, char *ebuf) @@ -407,58 +432,85 @@ pcap_create(const char *device, char *ebuf) } #endif +#ifdef PCAP_SUPPORT_NETFILTER + if (strncmp(device, "nflog", strlen("nflog")) == 0) { + return nflog_create(device, ebuf); + } +#endif + handle = pcap_create_common(device, ebuf); if (handle == NULL) return NULL; 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. + */ + handle->tstamp_type_count = 3; + handle->tstamp_type_list = malloc(3 * sizeof(u_int)); + if (handle->tstamp_type_list == NULL) { + 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 + return handle; } #ifdef HAVE_LIBNL /* - * - * If interface {if} is a mac80211 driver, the file - * /sys/class/net/{if}/phy80211 is a symlink to - * /sys/class/ieee80211/{phydev}, for some {phydev}. - * - * On Fedora 9, with a 2.6.26.3-29 kernel, my Zydas stick, at - * least, has a "wmaster0" device and a "wlan0" device; the - * latter is the one with the IP address. Both show up in - * "tcpdump -D" output. Capturing on the wmaster0 device - * captures with 802.11 headers. - * - * airmon-ng searches through /sys/class/net for devices named - * monN, starting with mon0; as soon as one *doesn't* exist, - * it chooses that as the monitor device name. If the "iw" - * command exists, it does "iw dev {if} interface add {monif} - * type monitor", where {monif} is the monitor device. It - * then (sigh) sleeps .1 second, and then configures the - * device up. Otherwise, if /sys/class/ieee80211/{phydev}/add_iface - * is a file, it writes {mondev}, without a newline, to that file, - * and again (sigh) sleeps .1 second, and then iwconfig's that - * device into monitor mode and configures it up. Otherwise, - * you can't do monitor mode. - * - * All these devices are "glued" together by having the - * /sys/class/net/{device}/phy80211 links pointing to the same - * place, so, given a wmaster, wlan, or mon device, you can - * find the other devices by looking for devices with - * the same phy80211 link. - * - * To turn monitor mode off, delete the monitor interface, - * either with "iw dev {monif} interface del" or by sending - * {monif}, with no NL, down /sys/class/ieee80211/{phydev}/remove_iface - * - * Note: if you try to create a monitor device named "monN", and - * there's already a "monN" device, it fails, as least with - * the netlink interface (which is what iw uses), with a return - * value of -ENFILE. (Return values are negative errnos.) We - * could probably use that to find an unused device. - * - * Yes, you can have multiple monitor devices for a given - * physical device. + * If interface {if} is a mac80211 driver, the file + * /sys/class/net/{if}/phy80211 is a symlink to + * /sys/class/ieee80211/{phydev}, for some {phydev}. + * + * On Fedora 9, with a 2.6.26.3-29 kernel, my Zydas stick, at + * least, has a "wmaster0" device and a "wlan0" device; the + * latter is the one with the IP address. Both show up in + * "tcpdump -D" output. Capturing on the wmaster0 device + * captures with 802.11 headers. + * + * airmon-ng searches through /sys/class/net for devices named + * monN, starting with mon0; as soon as one *doesn't* exist, + * it chooses that as the monitor device name. If the "iw" + * command exists, it does "iw dev {if} interface add {monif} + * type monitor", where {monif} is the monitor device. It + * then (sigh) sleeps .1 second, and then configures the + * device up. Otherwise, if /sys/class/ieee80211/{phydev}/add_iface + * is a file, it writes {mondev}, without a newline, to that file, + * and again (sigh) sleeps .1 second, and then iwconfig's that + * device into monitor mode and configures it up. Otherwise, + * you can't do monitor mode. + * + * All these devices are "glued" together by having the + * /sys/class/net/{device}/phy80211 links pointing to the same + * place, so, given a wmaster, wlan, or mon device, you can + * find the other devices by looking for devices with + * the same phy80211 link. + * + * To turn monitor mode off, delete the monitor interface, + * either with "iw dev {monif} interface del" or by sending + * {monif}, with no NL, down /sys/class/ieee80211/{phydev}/remove_iface + * + * Note: if you try to create a monitor device named "monN", and + * there's already a "monN" device, it fails, as least with + * the netlink interface (which is what iw uses), with a return + * value of -ENFILE. (Return values are negative errnos.) We + * could probably use that to find an unused device. + * + * Yes, you can have multiple monitor devices for a given + * physical device. */ /* @@ -503,8 +555,41 @@ get_mac80211_phydev(pcap_t *handle, const char *device, char *phydev_path, return 1; } +#ifdef HAVE_LIBNL_2_x +#define get_nl_errmsg nl_geterror +#else +/* libnl 2.x compatibility code */ + +#define nl_sock nl_handle + +static inline struct nl_handle * +nl_socket_alloc(void) +{ + return nl_handle_alloc(); +} + +static inline void +nl_socket_free(struct nl_handle *h) +{ + nl_handle_destroy(h); +} + +#define get_nl_errmsg strerror + +static inline int +__genl_ctrl_alloc_cache(struct nl_handle *h, struct nl_cache **cache) +{ + struct nl_cache *tmp = genl_ctrl_alloc_cache(h); + if (!tmp) + return -ENOMEM; + *cache = tmp; + return 0; +} +#define genl_ctrl_alloc_cache __genl_ctrl_alloc_cache +#endif /* !HAVE_LIBNL_2_x */ + struct nl80211_state { - struct nl_handle *nl_handle; + struct nl_sock *nl_sock; struct nl_cache *nl_cache; struct genl_family *nl80211; }; @@ -512,23 +597,26 @@ struct nl80211_state { static int nl80211_init(pcap_t *handle, struct nl80211_state *state, const char *device) { - state->nl_handle = nl_handle_alloc(); - if (!state->nl_handle) { + int err; + + state->nl_sock = nl_socket_alloc(); + if (!state->nl_sock) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "%s: failed to allocate netlink handle", device); return PCAP_ERROR; } - if (genl_connect(state->nl_handle)) { + if (genl_connect(state->nl_sock)) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "%s: failed to connect to generic netlink", device); goto out_handle_destroy; } - state->nl_cache = genl_ctrl_alloc_cache(state->nl_handle); - if (!state->nl_cache) { + err = genl_ctrl_alloc_cache(state->nl_sock, &state->nl_cache); + if (err < 0) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "%s: failed to allocate generic netlink cache", device); + "%s: failed to allocate generic netlink cache: %s", + device, get_nl_errmsg(-err)); goto out_handle_destroy; } @@ -544,7 +632,7 @@ nl80211_init(pcap_t *handle, struct nl80211_state *state, const char *device) out_cache_free: nl_cache_free(state->nl_cache); out_handle_destroy: - nl_handle_destroy(state->nl_handle); + nl_socket_free(state->nl_sock); return PCAP_ERROR; } @@ -553,7 +641,7 @@ nl80211_cleanup(struct nl80211_state *state) { genl_family_put(state->nl80211); nl_cache_free(state->nl_cache); - nl_handle_destroy(state->nl_handle); + nl_socket_free(state->nl_sock); } static int @@ -581,12 +669,19 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state, NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, mondevice); NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_MONITOR); - err = nl_send_auto_complete(state->nl_handle, msg); + err = nl_send_auto_complete(state->nl_sock, msg); if (err < 0) { +#ifdef HAVE_LIBNL_2_x + if (err == -NLE_FAILURE) { +#else if (err == -ENFILE) { +#endif /* * Device not available; our caller should just - * keep trying. + * keep trying. (libnl 2.x maps ENFILE to + * NLE_FAILURE; it can also map other errors + * to that, but there's not much we can do + * about that.) */ nlmsg_free(msg); return 0; @@ -597,17 +692,24 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state, */ snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "%s: nl_send_auto_complete failed adding %s interface: %s", - device, mondevice, strerror(-err)); + device, mondevice, get_nl_errmsg(-err)); nlmsg_free(msg); return PCAP_ERROR; } } - err = nl_wait_for_ack(state->nl_handle); + err = nl_wait_for_ack(state->nl_sock); if (err < 0) { +#ifdef HAVE_LIBNL_2_x + if (err == -NLE_FAILURE) { +#else if (err == -ENFILE) { +#endif /* * Device not available; our caller should just - * keep trying. + * keep trying. (libnl 2.x maps ENFILE to + * NLE_FAILURE; it can also map other errors + * to that, but there's not much we can do + * about that.) */ nlmsg_free(msg); return 0; @@ -618,7 +720,7 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state, */ snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "%s: nl_wait_for_ack failed adding %s interface: %s", - device, mondevice, strerror(-err)); + device, mondevice, get_nl_errmsg(-err)); nlmsg_free(msg); return PCAP_ERROR; } @@ -661,47 +763,21 @@ del_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state, 0, NL80211_CMD_DEL_INTERFACE, 0); NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex); - err = nl_send_auto_complete(state->nl_handle, msg); + err = nl_send_auto_complete(state->nl_sock, msg); if (err < 0) { - if (err == -ENFILE) { - /* - * Device not available; our caller should just - * keep trying. - */ - nlmsg_free(msg); - return 0; - } else { - /* - * Real failure, not just "that device is not - * available. - */ - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "%s: nl_send_auto_complete failed deleting %s interface: %s", - device, mondevice, strerror(-err)); - nlmsg_free(msg); - return PCAP_ERROR; - } + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "%s: nl_send_auto_complete failed deleting %s interface: %s", + device, mondevice, get_nl_errmsg(-err)); + nlmsg_free(msg); + return PCAP_ERROR; } - err = nl_wait_for_ack(state->nl_handle); + err = nl_wait_for_ack(state->nl_sock); if (err < 0) { - if (err == -ENFILE) { - /* - * Device not available; our caller should just - * keep trying. - */ - nlmsg_free(msg); - return 0; - } else { - /* - * Real failure, not just "that device is not - * available. - */ - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "%s: nl_wait_for_ack failed adding %s interface: %s", - device, mondevice, strerror(-err)); - nlmsg_free(msg); - return PCAP_ERROR; - } + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "%s: nl_wait_for_ack failed adding %s interface: %s", + device, mondevice, get_nl_errmsg(-err)); + nlmsg_free(msg); + return PCAP_ERROR; } /* @@ -787,6 +863,18 @@ enter_rfmon_mode_mac80211(pcap_t *handle, int sock_fd, const char *device) nanosleep(&delay, NULL); #endif + /* + * If we haven't already done so, arrange to have + * "pcap_close_all()" called when we exit. + */ + if (!pcap_do_addexit(handle)) { + /* + * "atexit()" failed; don't put the interface + * in rfmon mode, just give up. + */ + return PCAP_ERROR_RFMON_NOTSUP; + } + /* * Now configure the monitor interface up. */ @@ -996,6 +1084,7 @@ static void pcap_cleanup_linux( pcap_t *handle ) int ret; #endif /* HAVE_LIBNL */ #ifdef IW_MODE_MONITOR + int oldflags; struct iwreq ireq; #endif /* IW_MODE_MONITOR */ @@ -1019,10 +1108,10 @@ static void pcap_cleanup_linux( pcap_t *handle ) sizeof(ifr.ifr_name)); if (ioctl(handle->fd, SIOCGIFFLAGS, &ifr) == -1) { fprintf(stderr, - "Can't restore interface flags (SIOCGIFFLAGS failed: %s).\n" + "Can't restore interface %s flags (SIOCGIFFLAGS failed: %s).\n" "Please adjust manually.\n" "Hint: This can't happen with Linux >= 2.2.0.\n", - strerror(errno)); + handle->md.device, strerror(errno)); } else { if (ifr.ifr_flags & IFF_PROMISC) { /* @@ -1033,9 +1122,10 @@ static void pcap_cleanup_linux( pcap_t *handle ) if (ioctl(handle->fd, SIOCSIFFLAGS, &ifr) == -1) { fprintf(stderr, - "Can't restore interface flags (SIOCSIFFLAGS failed: %s).\n" + "Can't restore interface %s flags (SIOCSIFFLAGS failed: %s).\n" "Please adjust manually.\n" "Hint: This can't happen with Linux >= 2.2.0.\n", + handle->md.device, strerror(errno)); } } @@ -1069,6 +1159,29 @@ static void pcap_cleanup_linux( pcap_t *handle ) * mode, this code cannot know that, so it'll take * it out of rfmon mode. */ + + /* + * First, take the interface down if it's up; + * otherwise, we might get EBUSY. + * If we get errors, just drive on and print + * a warning if we can't restore the mode. + */ + oldflags = 0; + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, handle->md.device, + sizeof(ifr.ifr_name)); + if (ioctl(handle->fd, SIOCGIFFLAGS, &ifr) != -1) { + if (ifr.ifr_flags & IFF_UP) { + oldflags = ifr.ifr_flags; + ifr.ifr_flags &= ~IFF_UP; + if (ioctl(handle->fd, SIOCSIFFLAGS, &ifr) == -1) + oldflags = 0; /* didn't set, don't restore */ + } + } + + /* + * Now restore the mode. + */ strncpy(ireq.ifr_ifrn.ifrn_name, handle->md.device, sizeof ireq.ifr_ifrn.ifrn_name); ireq.ifr_ifrn.ifrn_name[sizeof ireq.ifr_ifrn.ifrn_name - 1] @@ -1079,9 +1192,23 @@ static void pcap_cleanup_linux( pcap_t *handle ) * Scientist, you've failed. */ fprintf(stderr, - "Can't restore interface wireless mode (SIOCSIWMODE failed: %s).\n" + "Can't restore interface %s wireless mode (SIOCSIWMODE failed: %s).\n" "Please adjust manually.\n", - strerror(errno)); + handle->md.device, strerror(errno)); + } + + /* + * Now bring the interface back up if we brought + * it down. + */ + if (oldflags != 0) { + ifr.ifr_flags = oldflags; + if (ioctl(handle->fd, SIOCSIFFLAGS, &ifr) == -1) { + fprintf(stderr, + "Can't bring interface %s back up (SIOCSIFFLAGS failed: %s).\n" + "Please adjust manually.\n", + handle->md.device, strerror(errno)); + } } } #endif /* IW_MODE_MONITOR */ @@ -1169,34 +1296,46 @@ 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. */ - - if ((status = activate_new(handle)) == 1) { + status = activate_new(handle); + if (status < 0) { + /* + * Fatal error with the new way; just fail. + * status has the error return; if it's PCAP_ERROR, + * handle->errbuf has been set appropriately. + */ + goto fail; + } + if (status == 1) { /* * Success. * Try to use memory-mapped access. */ - switch (activate_mmap(handle)) { + switch (activate_mmap(handle, &status)) { case 1: - /* we succeeded; nothing more to do */ - return 0; + /* + * We succeeded. status has been + * set to the status to return, + * which might be 0, or might be + * a PCAP_WARNING_ value. + */ + return status; case 0: /* * Kernel doesn't support it - just continue * with non-memory-mapped access. */ - status = 0; break; case -1: /* - * We failed to set up to use it, or kernel - * supports it, but we failed to enable it; - * return an error. handle->errbuf contains - * an error message. + * 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 + * return and, if it's PCAP_ERROR, handle->errbuf + * contains the error message. */ - status = PCAP_ERROR; goto fail; } } @@ -1210,18 +1349,12 @@ pcap_activate_linux(pcap_t *handle) */ goto fail; } - } else { - /* - * Fatal error with the new way; just fail. - * status has the error return; if it's PCAP_ERROR, - * handle->errbuf has been set appropriately. - */ - goto fail; } /* * 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. @@ -1816,8 +1949,20 @@ scan_sys_class_net(pcap_if_t **devlistp, char *errbuf) int ret = 1; sys_class_net_d = opendir("/sys/class/net"); - if (sys_class_net_d == NULL && errno == ENOENT) - return (0); + if (sys_class_net_d == NULL) { + /* + * Don't fail if it doesn't exist at all. + */ + if (errno == ENOENT) + return (0); + + /* + * Fail if we got some other error. + */ + (void)snprintf(errbuf, PCAP_ERRBUF_SIZE, + "Can't open /sys/class/net: %s", pcap_strerror(errno)); + return (-1); + } /* * Create a socket from which to fetch interface information. @@ -1826,6 +1971,7 @@ scan_sys_class_net(pcap_if_t **devlistp, char *errbuf) if (fd < 0) { (void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); + (void)closedir(sys_class_net_d); return (-1); } @@ -1885,7 +2031,7 @@ scan_sys_class_net(pcap_if_t **devlistp, char *errbuf) */ strncpy(ifrflags.ifr_name, name, sizeof(ifrflags.ifr_name)); if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifrflags) < 0) { - if (errno == ENXIO) + if (errno == ENXIO || errno == ENODEV) continue; (void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "SIOCGIFFLAGS: %.*s: %s", @@ -1949,8 +2095,20 @@ scan_proc_net_dev(pcap_if_t **devlistp, char *errbuf) int ret = 0; proc_net_f = fopen("/proc/net/dev", "r"); - if (proc_net_f == NULL && errno == ENOENT) - return (0); + if (proc_net_f == NULL) { + /* + * Don't fail if it doesn't exist at all. + */ + if (errno == ENOENT) + return (0); + + /* + * Fail if we got some other error. + */ + (void)snprintf(errbuf, PCAP_ERRBUF_SIZE, + "Can't open /proc/net/dev: %s", pcap_strerror(errno)); + return (-1); + } /* * Create a socket from which to fetch interface information. @@ -1959,6 +2117,7 @@ scan_proc_net_dev(pcap_if_t **devlistp, char *errbuf) if (fd < 0) { (void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); + (void)fclose(proc_net_f); return (-1); } @@ -2134,6 +2293,14 @@ pcap_platform_finddevs(pcap_if_t **alldevsp, char *errbuf) return (-1); #endif +#ifdef PCAP_SUPPORT_NETFILTER + /* + * Add netfilter devices. + */ + if (netfilter_platform_finddevs(alldevsp, errbuf) < 0) + return (-1); +#endif + return (0); } @@ -2148,7 +2315,7 @@ pcap_setfilter_linux_common(pcap_t *handle, struct bpf_program *filter, struct sock_fprog fcode; int can_filter_in_kernel; int err = 0; - memset(&fcode, 0, sizeof(struct sock_fprog)); + memset(&fcode, 0, sizeof(struct sock_fprog)); #endif if (!handle) @@ -2230,6 +2397,30 @@ pcap_setfilter_linux_common(pcap_t *handle, struct bpf_program *filter, } } + /* + * NOTE: at this point, we've set both the "len" and "filter" + * fields of "fcode". As of the 2.6.32.4 kernel, at least, + * those are the only members of the "sock_fprog" structure, + * so we initialize every member of that structure. + * + * If there is anything in "fcode" that is not initialized, + * it is either a field added in a later kernel, or it's + * padding. + * + * If a new field is added, this code needs to be updated + * to set it correctly. + * + * If there are no other fields, then: + * + * if the Linux kernel looks at the padding, it's + * buggy; + * + * if the Linux kernel doesn't look at the padding, + * then if some tool complains that we're passing + * uninitialized data to the kernel, then the tool + * is buggy and needs to understand that it's just + * padding. + */ if (can_filter_in_kernel) { if ((err = set_kernel_filter(handle, &fcode)) == 0) { @@ -2305,7 +2496,6 @@ pcap_setdirection_linux(pcap_t *handle, pcap_direction_t d) return -1; } - #ifdef HAVE_PF_PACKET_SOCKETS /* * Map the PACKET_ value to a LINUX_SLL_ value; we @@ -2652,6 +2842,13 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok) handle->linktype = DLT_RAW; break; +#ifndef ARPHRD_IEEE802154 +#define ARPHRD_IEEE802154 804 +#endif + case ARPHRD_IEEE802154: + handle->linktype = DLT_IEEE802_15_4_NOFCS; + break; + default: handle->linktype = -1; break; @@ -2691,10 +2888,29 @@ activate_new(pcap_t *handle) socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); if (sock_fd == -1) { + if (errno == EINVAL || errno == EAFNOSUPPORT) { + /* + * We don't support PF_PACKET/SOCK_whatever + * sockets; try the old mechanism. + */ + return 0; + } + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno) ); - return 0; /* try old mechanism */ - } + if (errno == EPERM || errno == EACCES) { + /* + * You don't have permission to open the + * socket. + */ + return PCAP_ERROR_PERM_DENIED; + } else { + /* + * Other error. + */ + return PCAP_ERROR; + } + } /* It seems the kernel supports the new interface. */ handle->md.sock_packet = 0; @@ -2790,7 +3006,18 @@ activate_new(pcap_t *handle) if (sock_fd == -1) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); - return PCAP_ERROR; + if (errno == EPERM || errno == EACCES) { + /* + * You don't have permission to + * open the socket. + */ + return PCAP_ERROR_PERM_DENIED; + } else { + /* + * Other error. + */ + return PCAP_ERROR; + } } handle->md.cooked = 1; @@ -2953,10 +3180,22 @@ activate_new(pcap_t *handle) #endif } +#ifdef HAVE_PACKET_RING +/* + * Attempt to activate with memory-mapped access. + * + * On success, returns 1, and sets *status to 0 if there are no warnings + * or to a PCAP_WARNING_ code if there is a warning. + * + * On failure due to lack of support for memory-mapped capture, returns + * 0. + * + * 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 -activate_mmap(pcap_t *handle) +activate_mmap(pcap_t *handle, int *status) { -#ifdef HAVE_PACKET_RING int ret; /* @@ -2968,7 +3207,8 @@ activate_mmap(pcap_t *handle) snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "can't allocate oneshot buffer: %s", pcap_strerror(errno)); - return PCAP_ERROR; + *status = PCAP_ERROR; + return -1; } if (handle->opt.buffer_size == 0) { @@ -2976,20 +3216,38 @@ activate_mmap(pcap_t *handle) handle->opt.buffer_size = 2*1024*1024; } ret = prepare_tpacket_socket(handle); - if (ret != 1) { + if (ret == -1) { free(handle->md.oneshot_buffer); + *status = PCAP_ERROR; return ret; } - ret = create_ring(handle); - if (ret != 1) { + ret = create_ring(handle, status); + if (ret == 0) { + /* + * We don't support memory-mapped capture; our caller + * will fall back on reading from the socket. + */ free(handle->md.oneshot_buffer); - return ret; + return 0; + } + if (ret == -1) { + /* + * Error attempting to enable memory-mapped capture; + * fail. create_ring() has set *status. + */ + free(handle->md.oneshot_buffer); + return -1; } - /* override some defaults and inherit the other fields from - * activate_new - * handle->offset is used to get the current position into the rx ring - * handle->cc is used to store the ring size */ + /* + * Success. *status has been set either to 0 if there are no + * warnings or to a PCAP_WARNING_ value if there is a warning. + * + * Override some defaults and inherit the other fields from + * activate_new. + * handle->offset is used to get the current position into the rx ring. + * handle->cc is used to store the ring size. + */ handle->read_op = pcap_read_linux_mmap; handle->cleanup_op = pcap_cleanup_linux_mmap; handle->setfilter_op = pcap_setfilter_linux_mmap; @@ -2998,12 +3256,21 @@ activate_mmap(pcap_t *handle) handle->oneshot_callback = pcap_oneshot_mmap; handle->selectable_fd = handle->fd; return 1; +} #else /* HAVE_PACKET_RING */ +static int +activate_mmap(pcap_t *handle _U_, int *status _U_) +{ return 0; -#endif /* HAVE_PACKET_RING */ } +#endif /* HAVE_PACKET_RING */ #ifdef HAVE_PACKET_RING +/* + * Attempt to set the socket to version 2 of the memory-mapped header. + * Return 1 if we succeed or if we fail because version 2 isn't + * supported; return -1 on any other error, and set handle->errbuf. + */ static int prepare_tpacket_socket(pcap_t *handle) { @@ -3055,20 +3322,140 @@ prepare_tpacket_socket(pcap_t *handle) return 1; } +/* + * Attempt to set up memory-mapped access. + * + * On success, returns 1, and sets *status to 0 if there are no warnings + * or to a PCAP_WARNING_ code if there is a warning. + * + * On failure due to lack of support for memory-mapped capture, returns + * 0. + * + * 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 -create_ring(pcap_t *handle) +create_ring(pcap_t *handle, int *status) { unsigned i, j, frames_per_block; struct tpacket_req req; + socklen_t len; + unsigned int sk_type, tp_reserve, maclen, tp_hdrlen, netoff, macoff; + unsigned int frame_size; - /* Note that with large snapshot (say 64K) only a few frames - * will be available in the ring even with pretty large ring size - * (and a lot of memory will be unused). - * The snap len should be carefully chosen to achive best - * performance */ - req.tp_frame_size = TPACKET_ALIGN(handle->snapshot + - TPACKET_ALIGN(handle->md.tp_hdrlen) + - sizeof(struct sockaddr_ll)); + /* + * Start out assuming no warnings or errors. + */ + *status = 0; + + /* Note that with large snapshot length (say 64K, which is the default + * for recent versions of tcpdump, the value that "-s 0" has given + * for a long time with tcpdump, and the default in Wireshark/TShark), + * if we use the snapshot length to calculate the frame length, + * only a few frames will be available in the ring even with pretty + * large ring size (and a lot of memory will be unused). + * + * Ideally, we should choose a frame length based on the + * minimum of the specified snapshot length and the maximum + * packet size. That's not as easy as it sounds; consider, for + * example, an 802.11 interface in monitor mode, where the + * frame would include a radiotap header, where the maximum + * radiotap header length is device-dependent. + * + * So, for now, we just do this for Ethernet devices, where + * there's no metadata header, and the link-layer header is + * fixed length. We can get the maximum packet size by + * adding 18, the Ethernet header length plus the CRC length + * (just in case we happen to get the CRC in the packet), to + * the MTU of the interface; we fetch the MTU in the hopes + * that it reflects support for jumbo frames. (Even if the + * interface is just being used for passive snooping, the driver + * might set the size of buffers in the receive ring based on + * the MTU, so that the MTU limits the maximum size of packets + * that we can receive.) + * + * We don't do that if segmentation/fragmentation or receive + * offload are enabled, so we don't get rudely surprised by + * "packets" bigger than the MTU. */ + frame_size = handle->snapshot; + if (handle->linktype == DLT_EN10MB) { + int mtu; + int offload; + + offload = iface_get_offload(handle); + if (offload == -1) { + *status = PCAP_ERROR; + return -1; + } + if (!offload) { + mtu = iface_get_mtu(handle->fd, handle->opt.source, + handle->errbuf); + if (mtu == -1) { + *status = PCAP_ERROR; + return -1; + } + if (frame_size > mtu + 18) + frame_size = mtu + 18; + } + } + + /* NOTE: calculus matching those in tpacket_rcv() + * in linux-2.6/net/packet/af_packet.c + */ + len = sizeof(sk_type); + if (getsockopt(handle->fd, SOL_SOCKET, SO_TYPE, &sk_type, &len) < 0) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "getsockopt: %s", pcap_strerror(errno)); + *status = PCAP_ERROR; + return -1; + } +#ifdef PACKET_RESERVE + len = sizeof(tp_reserve); + if (getsockopt(handle->fd, SOL_PACKET, PACKET_RESERVE, &tp_reserve, &len) < 0) { + if (errno != ENOPROTOOPT) { + /* + * ENOPROTOOPT means "kernel doesn't support + * PACKET_RESERVE", in which case we fall back + * as best we can. + */ + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "getsockopt: %s", pcap_strerror(errno)); + *status = PCAP_ERROR; + return -1; + } + tp_reserve = 0; /* older kernel, reserve not supported */ + } +#else + tp_reserve = 0; /* older kernel, reserve not supported */ +#endif + maclen = (sk_type == SOCK_DGRAM) ? 0 : MAX_LINKHEADER_SIZE; + /* XXX: in the kernel maclen is calculated from + * LL_ALLOCATED_SPACE(dev) and vnet_hdr.hdr_len + * in: packet_snd() in linux-2.6/net/packet/af_packet.c + * then packet_alloc_skb() in linux-2.6/net/packet/af_packet.c + * then sock_alloc_send_pskb() in linux-2.6/net/core/sock.c + * but I see no way to get those sizes in userspace, + * like for instance with an ifreq ioctl(); + * the best thing I've found so far is MAX_HEADER in the kernel + * part of linux-2.6/include/linux/netdevice.h + * which goes up to 128+48=176; since pcap-linux.c defines + * a MAX_LINKHEADER_SIZE of 256 which is greater than that, + * let's use it.. maybe is it even large enough to directly + * replace macoff.. + */ + tp_hdrlen = TPACKET_ALIGN(handle->md.tp_hdrlen) + sizeof(struct sockaddr_ll) ; + netoff = TPACKET_ALIGN(tp_hdrlen + (maclen < 16 ? 16 : maclen)) + tp_reserve; + /* NOTE: AFAICS tp_reserve may break the TPACKET_ALIGN of + * netoff, which contradicts + * linux-2.6/Documentation/networking/packet_mmap.txt + * documenting that: + * "- Gap, chosen so that packet data (Start+tp_net) + * aligns to TPACKET_ALIGNMENT=16" + */ + /* NOTE: in linux-2.6/include/linux/skbuff.h: + * "CPUs often take a performance hit + * when accessing unaligned memory locations" + */ + macoff = netoff - maclen; + req.tp_frame_size = TPACKET_ALIGN(macoff + frame_size); req.tp_frame_nr = handle->opt.buffer_size/req.tp_frame_size; /* compute the minumum block size that will handle this frame. @@ -3081,6 +3468,109 @@ create_ring(pcap_t *handle) frames_per_block = req.tp_block_size/req.tp_frame_size; + /* + * PACKET_TIMESTAMP was added after linux/net_tstamp.h was, + * so we check for PACKET_TIMESTAMP. We check for + * linux/net_tstamp.h just in case a system somehow has + * PACKET_TIMESTAMP but not linux/net_tstamp.h; that might + * be unnecessary. + * + * SIOCSHWTSTAMP was introduced in the patch that introduced + * linux/net_tstamp.h, so we don't bother checking whether + * SIOCSHWTSTAMP is defined (if your Linux system has + * linux/net_tstamp.h but doesn't define SIOCSHWTSTAMP, your + * Linux system is badly broken). + */ +#if defined(HAVE_LINUX_NET_TSTAMP_H) && defined(PACKET_TIMESTAMP) + /* + * If we were told to do so, ask the kernel and the driver + * to use hardware timestamps. + * + * Hardware timestamps are only supported with mmapped + * captures. + */ + if (handle->opt.tstamp_type == PCAP_TSTAMP_ADAPTER || + handle->opt.tstamp_type == PCAP_TSTAMP_ADAPTER_UNSYNCED) { + struct hwtstamp_config hwconfig; + struct ifreq ifr; + int timesource; + + /* + * Ask for hardware time stamps on all packets, + * including transmitted packets. + */ + memset(&hwconfig, 0, sizeof(hwconfig)); + hwconfig.tx_type = HWTSTAMP_TX_ON; + hwconfig.rx_filter = HWTSTAMP_FILTER_ALL; + + memset(&ifr, 0, sizeof(ifr)); + strcpy(ifr.ifr_name, handle->opt.source); + ifr.ifr_data = (void *)&hwconfig; + + if (ioctl(handle->fd, SIOCSHWTSTAMP, &ifr) < 0) { + switch (errno) { + + case EPERM: + /* + * Treat this as an error, as the + * user should try to run this + * with the appropriate privileges - + * and, if they can't, shouldn't + * try requesting hardware time stamps. + */ + *status = PCAP_ERROR_PERM_DENIED; + return -1; + + case EOPNOTSUPP: + /* + * Treat this as a warning, as the + * only way to fix the warning is to + * get an adapter that supports hardware + * time stamps. We'll just fall back + * on the standard host time stamps. + */ + *status = PCAP_WARNING_TSTAMP_TYPE_NOTSUP; + break; + + default: + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "SIOCSHWTSTAMP failed: %s", + pcap_strerror(errno)); + *status = PCAP_ERROR; + return -1; + } + } else { + /* + * Well, that worked. Now specify the type of + * hardware time stamp we want for this + * socket. + */ + if (handle->opt.tstamp_type == PCAP_TSTAMP_ADAPTER) { + /* + * Hardware timestamp, synchronized + * with the system clock. + */ + timesource = SOF_TIMESTAMPING_SYS_HARDWARE; + } else { + /* + * PCAP_TSTAMP_ADAPTER_UNSYNCED - hardware + * timestamp, not synchronized with the + * system clock. + */ + timesource = SOF_TIMESTAMPING_RAW_HARDWARE; + } + if (setsockopt(handle->fd, SOL_PACKET, PACKET_TIMESTAMP, + (void *)×ource, sizeof(timesource))) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "can't set PACKET_TIMESTAMP: %s", + pcap_strerror(errno)); + *status = PCAP_ERROR; + return -1; + } + } + } +#endif /* HAVE_LINUX_NET_TSTAMP_H && PACKET_TIMESTAMP */ + /* ask the kernel to create the ring */ retry: req.tp_block_nr = req.tp_frame_nr / frames_per_block; @@ -3115,6 +3605,7 @@ create_ring(pcap_t *handle) snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "can't create rx ring on packet socket: %s", pcap_strerror(errno)); + *status = PCAP_ERROR; return -1; } @@ -3128,6 +3619,7 @@ create_ring(pcap_t *handle) /* clear the allocated ring on error*/ destroy_ring(handle); + *status = PCAP_ERROR; return -1; } @@ -3140,6 +3632,7 @@ create_ring(pcap_t *handle) pcap_strerror(errno)); destroy_ring(handle); + *status = PCAP_ERROR; return -1; } @@ -3816,6 +4309,8 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) monitor_type montype; int i; __u32 cmd; + struct ifreq ifr; + int oldflags; int args[2]; int channel; @@ -3825,6 +4320,13 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) err = has_wext(sock_fd, device, handle->errbuf); if (err <= 0) return err; /* either it doesn't or the device doesn't even exist */ + /* + * Start out assuming we have no private extensions to control + * radio metadata. + */ + montype = MONITOR_WEXT; + cmd = 0; + /* * Try to get all the Wireless Extensions private ioctls * supported by this device. @@ -3848,187 +4350,189 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) device); return PCAP_ERROR; } - if (errno == EOPNOTSUPP) { - /* - * No private ioctls, so we assume that there's only one - * DLT_ for monitor mode. - */ - return 0; - } - if (errno != E2BIG) { + if (errno != EOPNOTSUPP) { /* - * Failed. + * OK, it's not as if there are no private ioctls. */ - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "%s: SIOCGIWPRIV: %s", device, pcap_strerror(errno)); - return PCAP_ERROR; - } - priv = malloc(ireq.u.data.length * sizeof (struct iw_priv_args)); - if (priv == NULL) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "malloc: %s", pcap_strerror(errno)); - return PCAP_ERROR; - } - ireq.u.data.pointer = (void *)priv; - if (ioctl(sock_fd, SIOCGIWPRIV, &ireq) == -1) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "%s: SIOCGIWPRIV: %s", device, pcap_strerror(errno)); - free(priv); - return PCAP_ERROR; - } - - /* - * Look for private ioctls to turn monitor mode on or, if - * monitor mode is on, to set the header type. - */ - montype = MONITOR_WEXT; - cmd = 0; - for (i = 0; i < ireq.u.data.length; i++) { - if (strcmp(priv[i].name, "monitor_type") == 0) { - /* - * Hostap driver, use this one. - * Set monitor mode first. - * You can set it to 0 to get DLT_IEEE80211, - * 1 to get DLT_PRISM, 2 to get - * DLT_IEEE80211_RADIO_AVS, and, with more - * recent versions of the driver, 3 to get - * DLT_IEEE80211_RADIO. - */ - if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) - break; - if (!(priv[i].set_args & IW_PRIV_SIZE_FIXED)) - break; - if ((priv[i].set_args & IW_PRIV_SIZE_MASK) != 1) - break; - montype = MONITOR_HOSTAP; - cmd = priv[i].cmd; - break; - } - if (strcmp(priv[i].name, "set_prismhdr") == 0) { + if (errno != E2BIG) { /* - * Prism54 driver, use this one. - * Set monitor mode first. - * You can set it to 2 to get DLT_IEEE80211 - * or 3 or get DLT_PRISM. + * Failed. */ - if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) - break; - if (!(priv[i].set_args & IW_PRIV_SIZE_FIXED)) - break; - if ((priv[i].set_args & IW_PRIV_SIZE_MASK) != 1) - break; - montype = MONITOR_PRISM54; - cmd = priv[i].cmd; - break; - } - if (strcmp(priv[i].name, "forceprismheader") == 0) { - /* - * RT2570 driver, use this one. - * Do this after turning monitor mode on. - * You can set it to 1 to get DLT_PRISM or 2 - * to get DLT_IEEE80211. - */ - if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) - break; - if (!(priv[i].set_args & IW_PRIV_SIZE_FIXED)) - break; - if ((priv[i].set_args & IW_PRIV_SIZE_MASK) != 1) - break; - montype = MONITOR_RT2570; - cmd = priv[i].cmd; - break; + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "%s: SIOCGIWPRIV: %s", device, + pcap_strerror(errno)); + return PCAP_ERROR; } - if (strcmp(priv[i].name, "forceprism") == 0) { - /* - * RT73 driver, use this one. - * Do this after turning monitor mode on. - * Its argument is a *string*; you can - * set it to "1" to get DLT_PRISM or "2" - * to get DLT_IEEE80211. - */ - if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_CHAR) - break; - if (priv[i].set_args & IW_PRIV_SIZE_FIXED) - break; - montype = MONITOR_RT73; - cmd = priv[i].cmd; - break; + + /* + * OK, try to get the list of private ioctls. + */ + priv = malloc(ireq.u.data.length * sizeof (struct iw_priv_args)); + if (priv == NULL) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "malloc: %s", pcap_strerror(errno)); + return PCAP_ERROR; } - if (strcmp(priv[i].name, "prismhdr") == 0) { - /* - * One of the RTL8xxx drivers, use this one. - * It can only be done after monitor mode - * has been turned on. You can set it to 1 - * to get DLT_PRISM or 0 to get DLT_IEEE80211. - */ - if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) - break; - if (!(priv[i].set_args & IW_PRIV_SIZE_FIXED)) - break; - if ((priv[i].set_args & IW_PRIV_SIZE_MASK) != 1) - break; - montype = MONITOR_RTL8XXX; - cmd = priv[i].cmd; - break; + ireq.u.data.pointer = (void *)priv; + if (ioctl(sock_fd, SIOCGIWPRIV, &ireq) == -1) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "%s: SIOCGIWPRIV: %s", device, + pcap_strerror(errno)); + free(priv); + return PCAP_ERROR; } - if (strcmp(priv[i].name, "rfmontx") == 0) { - /* - * RT2500 or RT61 driver, use this one. - * It has one one-byte parameter; set - * u.data.length to 1 and u.data.pointer to - * point to the parameter. - * It doesn't itself turn monitor mode on. - * You can set it to 1 to allow transmitting - * in monitor mode(?) and get DLT_IEEE80211, - * or set it to 0 to disallow transmitting in - * monitor mode(?) and get DLT_PRISM. - */ - if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) - break; - if ((priv[i].set_args & IW_PRIV_SIZE_MASK) != 2) + + /* + * Look for private ioctls to turn monitor mode on or, if + * monitor mode is on, to set the header type. + */ + for (i = 0; i < ireq.u.data.length; i++) { + if (strcmp(priv[i].name, "monitor_type") == 0) { + /* + * Hostap driver, use this one. + * Set monitor mode first. + * You can set it to 0 to get DLT_IEEE80211, + * 1 to get DLT_PRISM, 2 to get + * DLT_IEEE80211_RADIO_AVS, and, with more + * recent versions of the driver, 3 to get + * DLT_IEEE80211_RADIO. + */ + if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) + break; + if (!(priv[i].set_args & IW_PRIV_SIZE_FIXED)) + break; + if ((priv[i].set_args & IW_PRIV_SIZE_MASK) != 1) + break; + montype = MONITOR_HOSTAP; + cmd = priv[i].cmd; break; - montype = MONITOR_RT2500; - cmd = priv[i].cmd; - break; - } - if (strcmp(priv[i].name, "monitor") == 0) { - /* - * Either ACX100 or hostap, use this one. - * It turns monitor mode on. - * If it takes two arguments, it's ACX100; - * the first argument is 1 for DLT_PRISM - * or 2 for DLT_IEEE80211, and the second - * argument is the channel on which to - * run. If it takes one argument, it's - * HostAP, and the argument is 2 for - * DLT_IEEE80211 and 3 for DLT_PRISM. - * - * If we see this, we don't quit, as this - * might be a version of the hostap driver - * that also supports "monitor_type". - */ - if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) + } + if (strcmp(priv[i].name, "set_prismhdr") == 0) { + /* + * Prism54 driver, use this one. + * Set monitor mode first. + * You can set it to 2 to get DLT_IEEE80211 + * or 3 or get DLT_PRISM. + */ + if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) + break; + if (!(priv[i].set_args & IW_PRIV_SIZE_FIXED)) + break; + if ((priv[i].set_args & IW_PRIV_SIZE_MASK) != 1) + break; + montype = MONITOR_PRISM54; + cmd = priv[i].cmd; break; - if (!(priv[i].set_args & IW_PRIV_SIZE_FIXED)) + } + if (strcmp(priv[i].name, "forceprismheader") == 0) { + /* + * RT2570 driver, use this one. + * Do this after turning monitor mode on. + * You can set it to 1 to get DLT_PRISM or 2 + * to get DLT_IEEE80211. + */ + if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) + break; + if (!(priv[i].set_args & IW_PRIV_SIZE_FIXED)) + break; + if ((priv[i].set_args & IW_PRIV_SIZE_MASK) != 1) + break; + montype = MONITOR_RT2570; + cmd = priv[i].cmd; break; - switch (priv[i].set_args & IW_PRIV_SIZE_MASK) { - - case 1: - montype = MONITOR_PRISM; + } + if (strcmp(priv[i].name, "forceprism") == 0) { + /* + * RT73 driver, use this one. + * Do this after turning monitor mode on. + * Its argument is a *string*; you can + * set it to "1" to get DLT_PRISM or "2" + * to get DLT_IEEE80211. + */ + if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_CHAR) + break; + if (priv[i].set_args & IW_PRIV_SIZE_FIXED) + break; + montype = MONITOR_RT73; cmd = priv[i].cmd; break; - - case 2: - montype = MONITOR_ACX100; + } + if (strcmp(priv[i].name, "prismhdr") == 0) { + /* + * One of the RTL8xxx drivers, use this one. + * It can only be done after monitor mode + * has been turned on. You can set it to 1 + * to get DLT_PRISM or 0 to get DLT_IEEE80211. + */ + if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) + break; + if (!(priv[i].set_args & IW_PRIV_SIZE_FIXED)) + break; + if ((priv[i].set_args & IW_PRIV_SIZE_MASK) != 1) + break; + montype = MONITOR_RTL8XXX; cmd = priv[i].cmd; break; - - default: + } + if (strcmp(priv[i].name, "rfmontx") == 0) { + /* + * RT2500 or RT61 driver, use this one. + * It has one one-byte parameter; set + * u.data.length to 1 and u.data.pointer to + * point to the parameter. + * It doesn't itself turn monitor mode on. + * You can set it to 1 to allow transmitting + * in monitor mode(?) and get DLT_IEEE80211, + * or set it to 0 to disallow transmitting in + * monitor mode(?) and get DLT_PRISM. + */ + if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) + break; + if ((priv[i].set_args & IW_PRIV_SIZE_MASK) != 2) + break; + montype = MONITOR_RT2500; + cmd = priv[i].cmd; break; } + if (strcmp(priv[i].name, "monitor") == 0) { + /* + * Either ACX100 or hostap, use this one. + * It turns monitor mode on. + * If it takes two arguments, it's ACX100; + * the first argument is 1 for DLT_PRISM + * or 2 for DLT_IEEE80211, and the second + * argument is the channel on which to + * run. If it takes one argument, it's + * HostAP, and the argument is 2 for + * DLT_IEEE80211 and 3 for DLT_PRISM. + * + * If we see this, we don't quit, as this + * might be a version of the hostap driver + * that also supports "monitor_type". + */ + if ((priv[i].set_args & IW_PRIV_TYPE_MASK) != IW_PRIV_TYPE_INT) + break; + if (!(priv[i].set_args & IW_PRIV_SIZE_FIXED)) + break; + switch (priv[i].set_args & IW_PRIV_SIZE_MASK) { + + case 1: + montype = MONITOR_PRISM; + cmd = priv[i].cmd; + break; + + case 2: + montype = MONITOR_ACX100; + cmd = priv[i].cmd; + break; + + default: + break; + } + } } + free(priv); } - free(priv); /* * XXX - ipw3945? islism? @@ -4123,7 +4627,29 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) } /* - * First, turn monitor mode on. + * First, take the interface down if it's up; otherwise, we + * might get EBUSY. + */ + memset(&ifr, 0, sizeof(ifr)); + strncpy(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)); + return PCAP_ERROR; + } + oldflags = 0; + if (ifr.ifr_flags & IFF_UP) { + oldflags = ifr.ifr_flags; + ifr.ifr_flags &= ~IFF_UP; + if (ioctl(sock_fd, SIOCSIFFLAGS, &ifr) == -1) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "%s: Can't set flags: %s", device, strerror(errno)); + return PCAP_ERROR; + } + } + + /* + * Then turn monitor mode on. */ strncpy(ireq.ifr_ifrn.ifrn_name, device, sizeof ireq.ifr_ifrn.ifrn_name); @@ -4132,7 +4658,14 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) if (ioctl(sock_fd, SIOCSIWMODE, &ireq) == -1) { /* * Scientist, you've failed. + * Bring the interface back up if we shut it down. */ + ifr.ifr_flags = oldflags; + if (ioctl(sock_fd, SIOCSIFFLAGS, &ifr) == -1) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "%s: Can't set flags: %s", device, strerror(errno)); + return PCAP_ERROR; + } return PCAP_ERROR_RFMON_NOTSUP; } @@ -4294,6 +4827,32 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device) break; } + /* + * Now bring the interface back up if we brought it down. + */ + if (oldflags != 0) { + ifr.ifr_flags = oldflags; + if (ioctl(sock_fd, SIOCSIFFLAGS, &ifr) == -1) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "%s: Can't set flags: %s", device, strerror(errno)); + + /* + * At least try to restore the old mode on the + * interface. + */ + if (ioctl(handle->fd, SIOCSIWMODE, &ireq) == -1) { + /* + * Scientist, you've failed. + */ + fprintf(stderr, + "Can't restore interface wireless mode (SIOCSIWMODE failed: %s).\n" + "Please adjust manually.\n", + strerror(errno)); + } + return PCAP_ERROR; + } + } + /* * Note that we have to put the old mode back when we * close the device. @@ -4343,6 +4902,112 @@ enter_rfmon_mode(pcap_t *handle, int sock_fd, const char *device) return 0; } +/* + * Find out if we have any form of fragmentation/reassembly offloading. + * + * We do so using SIOCETHTOOL checking for various types of offloading; + * if SIOCETHTOOL isn't defined, or we don't have any #defines for any + * of the types of offloading, there's nothing we can do to check, so + * we just say "no, we don't". + */ +#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) +{ + struct ifreq ifr; + struct ethtool_value eval; + + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name)); + eval.cmd = cmd; + ifr.ifr_data = (caddr_t)&eval; + if (ioctl(handle->fd, SIOCETHTOOL, &ifr) == -1) { + if (errno == EOPNOTSUPP) { + /* + * OK, let's just return 0, which, in our + * case, either means "no, what we're asking + * about is not enabled" or "all the flags + * are clear (i.e., nothing is enabled)". + */ + return 0; + } + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "%s: SIOETHTOOL(%s) ioctl failed: %s", handle->opt.source, + cmdname, strerror(errno)); + return -1; + } + return eval.data; +} + +static int +iface_get_offload(pcap_t *handle) +{ + int ret; + +#ifdef ETHTOOL_GTSO + ret = iface_ethtool_ioctl(handle, ETHTOOL_GTSO, "ETHTOOL_GTSO"); + if (ret == -1) + return -1; + if (ret) + return 1; /* TCP segmentation offloading on */ +#endif + +#ifdef ETHTOOL_GUFO + ret = iface_ethtool_ioctl(handle, ETHTOOL_GUFO, "ETHTOOL_GUFO"); + if (ret == -1) + return -1; + if (ret) + return 1; /* UDP fragmentation offloading on */ +#endif + +#ifdef ETHTOOL_GGSO + /* + * XXX - will this cause large unsegmented packets to be + * handed to PF_PACKET sockets on transmission? If not, + * this need not be checked. + */ + ret = iface_ethtool_ioctl(handle, ETHTOOL_GGSO, "ETHTOOL_GGSO"); + if (ret == -1) + return -1; + if (ret) + return 1; /* generic segmentation offloading on */ +#endif + +#ifdef ETHTOOL_GFLAGS + ret = iface_ethtool_ioctl(handle, ETHTOOL_GFLAGS, "ETHTOOL_GFLAGS"); + if (ret == -1) + return -1; + if (ret & ETH_FLAG_LRO) + return 1; /* large receive offloading on */ +#endif + +#ifdef ETHTOOL_GGRO + /* + * XXX - will this cause large reassembled packets to be + * handed to PF_PACKET sockets on receipt? If not, + * this need not be checked. + */ + ret = iface_ethtool_ioctl(handle, ETHTOOL_GGRO, "ETHTOOL_GGRO"); + if (ret == -1) + return -1; + if (ret) + return 1; /* generic (large) receive offloading on */ +#endif + + return 0; +} +#else /* SIOCETHTOOL */ +static int +iface_get_offload(pcap_t *handle _U_) +{ + /* + * XXX - do we need to get this information if we don't + * have the ethtool ioctls? If so, how do we do that? + */ + return 0; +} +#endif /* SIOCETHTOOL */ + #endif /* HAVE_PF_PACKET_SOCKETS */ /* ===== Functions to interface to the older kernels ================== */ @@ -4366,7 +5031,18 @@ activate_old(pcap_t *handle) if (handle->fd == -1) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); - return PCAP_ERROR_PERM_DENIED; + if (errno == EPERM || errno == EACCES) { + /* + * You don't have permission to open the + * socket. + */ + return PCAP_ERROR_PERM_DENIED; + } else { + /* + * Other error. + */ + return PCAP_ERROR; + } } /* It worked - we are using the old interface */ diff --git a/libpcap/pcap-netfilter-linux.c b/libpcap/pcap-netfilter-linux.c new file mode 100644 index 0000000000..225e49f904 --- /dev/null +++ b/libpcap/pcap-netfilter-linux.c @@ -0,0 +1,468 @@ +/* + * Copyright (c) 2011 Jakub Zawadzki + * 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 "pcap-int.h" + +#ifdef NEED_STRERROR_H +#include "strerror.h" +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "pcap-netfilter-linux.h" + +#define HDR_LENGTH (NLMSG_LENGTH(NLMSG_ALIGN(sizeof(struct nfgenmsg)))) + +#define NFLOG_IFACE "nflog" + +static int +nflog_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *user) +{ + const unsigned char *buf; + int count = 0; + int len; + + /* ignore interrupt system call error */ + do { + len = recv(handle->fd, handle->buffer, handle->bufsize, 0); + if (handle->break_loop) { + handle->break_loop = 0; + return -2; + } + } while ((len == -1) && (errno == EINTR)); + + if (len < 0) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't receive packet %d:%s", errno, pcap_strerror(errno)); + return -1; + } + + buf = handle->buffer; + while (len >= NLMSG_SPACE(0)) { + const struct nlmsghdr *nlh = (const struct nlmsghdr *) buf; + u_int32_t msg_len; + + if (nlh->nlmsg_len < sizeof(struct nlmsghdr) || len < nlh->nlmsg_len) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Message truncated: (got: %d) (nlmsg_len: %u)", len, nlh->nlmsg_len); + return -1; + } + + if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_ULOG && + NFNL_MSG_TYPE(nlh->nlmsg_type) == NFULNL_MSG_PACKET) + { + const unsigned char *payload = NULL; + struct pcap_pkthdr pkth; + + if (handle->linktype != DLT_NFLOG) { + const struct nfattr *payload_attr = NULL; + + if (nlh->nlmsg_len < HDR_LENGTH) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Malformed message: (nlmsg_len: %u)", nlh->nlmsg_len); + return -1; + } + + if (nlh->nlmsg_len > HDR_LENGTH) { + struct nfattr *attr = NFM_NFA(NLMSG_DATA(nlh)); + int attr_len = nlh->nlmsg_len - NLMSG_ALIGN(HDR_LENGTH); + + while (NFA_OK(attr, attr_len)) { + switch (NFA_TYPE(attr)) { + case NFULA_PAYLOAD: + payload_attr = attr; + break; + } + attr = NFA_NEXT(attr, attr_len); + } + } + + if (payload_attr) { + payload = NFA_DATA(payload_attr); + pkth.len = pkth.caplen = NFA_PAYLOAD(payload_attr); + } + + } else { + payload = NLMSG_DATA(nlh); + pkth.caplen = pkth.len = nlh->nlmsg_len-NLMSG_ALIGN(sizeof(struct nlmsghdr)); + } + + if (payload) { + /* pkth.caplen = min (payload_len, handle->snapshot); */ + + gettimeofday(&pkth.ts, NULL); + if (handle->fcode.bf_insns == NULL || + bpf_filter(handle->fcode.bf_insns, payload, pkth.len, pkth.caplen)) + { + handle->md.packets_read++; + callback(user, &pkth, payload); + count++; + } + } + } + + msg_len = NLMSG_ALIGN(nlh->nlmsg_len); + if (msg_len > len) + msg_len = len; + + len -= msg_len; + buf += msg_len; + } + return count; +} + +static int +netfilter_set_datalink(pcap_t *handle, int dlt) +{ + handle->linktype = dlt; + return 0; +} + +static int +netfilter_stats_linux(pcap_t *handle, struct pcap_stat *stats) +{ + stats->ps_recv = handle->md.packets_read; + stats->ps_drop = 0; + stats->ps_ifdrop = 0; + return 0; +} + +static int +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; + u_int16_t nfa_type; + void *data; +}; + +static int +nflog_send_config_msg(const pcap_t *handle, u_int8_t family, u_int16_t res_id, const struct my_nfattr *mynfa) +{ + char buf[1024] __attribute__ ((aligned)); + + struct nlmsghdr *nlh = (struct nlmsghdr *) buf; + struct nfgenmsg *nfg = (struct nfgenmsg *) (buf + sizeof(struct nlmsghdr)); + + struct sockaddr_nl snl; + static unsigned int seq_id; + + if (!seq_id) + seq_id = time(NULL); + ++seq_id; + + nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nfgenmsg)); + nlh->nlmsg_type = (NFNL_SUBSYS_ULOG << 8) | NFULNL_MSG_CONFIG; + nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; + nlh->nlmsg_pid = 0; /* to kernel */ + nlh->nlmsg_seq = seq_id; + + nfg->nfgen_family = family; + nfg->version = NFNETLINK_V0; + nfg->res_id = htons(res_id); + + if (mynfa) { + struct nfattr *nfa = (struct nfattr *) (buf + NLMSG_ALIGN(nlh->nlmsg_len)); + + nfa->nfa_type = mynfa->nfa_type; + nfa->nfa_len = NFA_LENGTH(mynfa->nfa_len); + memcpy(NFA_DATA(nfa), mynfa->data, mynfa->nfa_len); + nlh->nlmsg_len = NLMSG_ALIGN(nlh->nlmsg_len) + NFA_ALIGN(nfa->nfa_len); + } + + memset(&snl, 0, sizeof(snl)); + snl.nl_family = AF_NETLINK; + + if (sendto(handle->fd, nlh, nlh->nlmsg_len, 0, (struct sockaddr *) &snl, sizeof(snl)) == -1) + return -1; + + /* waiting for reply loop */ + do { + socklen_t addrlen = sizeof(snl); + int len; + + /* ignore interrupt system call error */ + do { + len = recvfrom(handle->fd, buf, sizeof(buf), 0, (struct sockaddr *) &snl, &addrlen); + } while ((len == -1) && (errno == EINTR)); + + if (len <= 0) + return len; + + if (addrlen != sizeof(snl) || snl.nl_family != AF_NETLINK) { + errno = EINVAL; + return -1; + } + + nlh = (struct nlmsghdr *) buf; + if (snl.nl_pid != 0 || seq_id != nlh->nlmsg_seq) /* if not from kernel or wrong sequence skip */ + continue; + + while (len >= NLMSG_SPACE(0) && NLMSG_OK(nlh, len)) { + if (nlh->nlmsg_type == NLMSG_ERROR || (nlh->nlmsg_type == NLMSG_DONE && nlh->nlmsg_flags & NLM_F_MULTI)) { + if (nlh->nlmsg_len < NLMSG_ALIGN(sizeof(struct nlmsgerr))) { + errno = EBADMSG; + return -1; + } + errno = -(*((int *)NLMSG_DATA(nlh))); + return (errno == 0) ? 0 : -1; + } + nlh = NLMSG_NEXT(nlh, len); + } + } while (1); + + return -1; /* never here */ +} + +static int +nflog_send_config_cmd(const pcap_t *handle, u_int16_t group_id, u_int8_t cmd, u_int8_t family) +{ + struct nfulnl_msg_config_cmd msg; + struct my_nfattr nfa; + + msg.command = cmd; + + nfa.data = &msg; + nfa.nfa_type = NFULA_CFG_CMD; + nfa.nfa_len = sizeof(msg); + + return nflog_send_config_msg(handle, family, group_id, &nfa); +} + +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; + struct my_nfattr nfa; + + msg.copy_range = htonl(copy_range); + msg.copy_mode = copy_mode; + + nfa.data = &msg; + nfa.nfa_type = NFULA_CFG_MODE; + nfa.nfa_len = sizeof(msg); + + return nflog_send_config_msg(handle, AF_UNSPEC, group_id, &nfa); +} + +static int +nflog_activate(pcap_t* handle) +{ + const char *dev = handle->opt.source; + unsigned short groups[32]; + int group_count = 0; + int i; + + if (strncmp(dev, NFLOG_IFACE, strlen(NFLOG_IFACE)) == 0) { + dev += strlen(NFLOG_IFACE); + + /* nflog:30,33,42 looks nice, allow it */ + if (*dev == ':') + dev++; + + while (*dev) { + long int group_id; + char *end_dev; + + if (group_count == 32) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Maximum 32 netfilter groups! dev: %s", + handle->opt.source); + return PCAP_ERROR; + } + + group_id = strtol(dev, &end_dev, 0); + if (end_dev != dev) { + if (group_id < 0 || group_id > 65535) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Netfilter group range from 0 to 65535 (got %ld)", + group_id); + return PCAP_ERROR; + } + + groups[group_count++] = (unsigned short) group_id; + dev = end_dev; + } + if (*dev != ',') + break; + dev++; + } + } + + if (*dev) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Can't get netfilter group(s) index from %s", + handle->opt.source); + return PCAP_ERROR; + } + + /* if no groups, add default: 0 */ + if (!group_count) { + groups[0] = 0; + group_count = 1; + } + + /* Initialize some components of the pcap structure. */ + handle->bufsize = 128 + handle->snapshot; + handle->offset = 0; + handle->linktype = DLT_NFLOG; + handle->read_op = nflog_read_linux; + handle->inject_op = netfilter_inject_linux; + handle->setfilter_op = install_bpf_program; /* no kernel filtering */ + handle->setdirection_op = NULL; + handle->set_datalink_op = NULL; + handle->set_datalink_op = netfilter_set_datalink; + handle->getnonblock_op = pcap_getnonblock_fd; + handle->setnonblock_op = pcap_setnonblock_fd; + handle->stats_op = netfilter_stats_linux; + + /* Create netlink socket */ + handle->fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER); + if (handle->fd < 0) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't create raw socket %d:%s", errno, pcap_strerror(errno)); + return PCAP_ERROR; + } + + handle->dlt_list = (u_int *) malloc(sizeof(u_int) * 2); + if (handle->dlt_list != NULL) { + handle->dlt_list[0] = DLT_NFLOG; + handle->dlt_list[1] = DLT_IPV4; + handle->dlt_count = 2; + } + + 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; + } + + if (nflog_send_config_cmd(handle, 0, NFULNL_CFG_CMD_PF_UNBIND, AF_INET) < 0) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "NFULNL_CFG_CMD_PF_UNBIND: %s", pcap_strerror(errno)); + goto close_fail; + } + + if (nflog_send_config_cmd(handle, 0, NFULNL_CFG_CMD_PF_BIND, AF_INET) < 0) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "NFULNL_CFG_CMD_PF_BIND: %s", pcap_strerror(errno)); + goto close_fail; + } + + /* Bind socket to the nflog groups */ + for (i = 0; i < group_count; i++) { + if (nflog_send_config_cmd(handle, groups[i], NFULNL_CFG_CMD_BIND, AF_UNSPEC) < 0) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't listen on group group index: %s", pcap_strerror(errno)); + goto close_fail; + } + + if (nflog_send_config_mode(handle, groups[i], NFULNL_COPY_PACKET, handle->snapshot) < 0) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "NFULNL_COPY_PACKET: %s", pcap_strerror(errno)); + goto close_fail; + } + } + + if (handle->opt.rfmon) { + /* + * Monitor mode doesn't apply to netfilter devices. + */ + pcap_cleanup_live_common(handle); + return PCAP_ERROR_RFMON_NOTSUP; + } + + if (handle->opt.buffer_size != 0) { + /* + * Set the socket buffer size to the specified value. + */ + if (setsockopt(handle->fd, SOL_SOCKET, SO_RCVBUF, &handle->opt.buffer_size, sizeof(handle->opt.buffer_size)) == -1) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "SO_RCVBUF: %s", pcap_strerror(errno)); + goto close_fail; + } + } + + handle->selectable_fd = handle->fd; + return 0; + +close_fail: + pcap_cleanup_live_common(handle); + return PCAP_ERROR; +} + +pcap_t * +nflog_create(const char *device, char *ebuf) +{ + pcap_t *p; + + p = pcap_create_common(device, ebuf); + if (p == NULL) + return (NULL); + + p->activate_op = nflog_activate; + return (p); +} + +int +netfilter_platform_finddevs(pcap_if_t **alldevsp, char *err_str) +{ + pcap_if_t *found_dev = *alldevsp; + int sock; + + sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER); + if (sock < 0) { + /* if netlink is not supported this this is not fatal */ + if (errno == EAFNOSUPPORT) + return 0; + snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't open netlink socket %d:%s", + errno, pcap_strerror(errno)); + return -1; + } + close(sock); + + if (pcap_add_if(&found_dev, NFLOG_IFACE, 0, "Linux netfilter log (NFLOG) interface", err_str) < 0) + return -1; + return 0; +} + diff --git a/libpcap/pcap-netfilter-linux.h b/libpcap/pcap-netfilter-linux.h new file mode 100644 index 0000000000..dd76b8a435 --- /dev/null +++ b/libpcap/pcap-netfilter-linux.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2011 Jakub Zawadzki + * 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. + */ + +/* + * Prototypes for netlink-related functions + */ +int netfilter_platform_finddevs(pcap_if_t **alldevsp, char *err_str); +pcap_t *nflog_create(const char *device, char *ebuf); diff --git a/libpcap/pcap-stdinc.h b/libpcap/pcap-stdinc.h index f025013ce3..f1c736e50e 100644 --- a/libpcap/pcap-stdinc.h +++ b/libpcap/pcap-stdinc.h @@ -33,13 +33,6 @@ #ifndef pcap_stdinc_h #define pcap_stdinc_h -#define SIZEOF_CHAR 1 -#define SIZEOF_SHORT 2 -#define SIZEOF_INT 4 -#ifndef _MSC_EXTENSIONS -#define SIZEOF_LONG_LONG 8 -#endif - /* * Avoids a compiler warning in case this was already defined * (someone defined _WINSOCKAPI_ when including 'windows.h', in order diff --git a/libpcap/pcap-tstamp.manmisc.in b/libpcap/pcap-tstamp.manmisc.in new file mode 100644 index 0000000000..2cd32c6213 --- /dev/null +++ b/libpcap/pcap-tstamp.manmisc.in @@ -0,0 +1,132 @@ +.\" +.\" 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. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that: (1) source code distributions +.\" retain the above copyright notice and this paragraph in its entirety, (2) +.\" distributions including binary code include the above copyright notice and +.\" this paragraph in its entirety in the documentation or other materials +.\" provided with the distribution, and (3) all advertising materials mentioning +.\" features or use of this software display the following acknowledgement: +.\" ``This product includes software developed by the University of California, +.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of +.\" the University nor the names of its contributors may be used to endorse +.\" or promote products derived from this software without specific prior +.\" written permission. +.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" +.TH PCAP-TSTAMP @MAN_MISC_INFO@ "22 August 2010" +.SH NAME +pcap-tstamp \- packet time stamps in libpcap +.SH DESCRIPTION +When capturing traffic, each packet is given a time stamp representing, +for incoming packets, the arrival time of the packet and, for outgoing +packets, the transmission time of the packet. This time is an +approximation of the arrival or transmission time. If it is supplied by +the operating system running on the host on which the capture is being +done, there are several reasons why it might not precisely represent the +arrival or transmission time: +.IP +if the time stamp is applied to the packet when the networking stack +receives the packet, the networking stack might not see the packet until +an interrupt is delivered for the packet or a timer event causes the +networking device driver to poll for packets, and the time stamp might +not be applied until the packet has had some processing done by other +code in the networking stack, so there might be a significant delay +between the time when the last bit of the packet is received by the +capture device and when the networking stack time-stamps the packet; +.IP +the timer used to generate the time stamps might have low resolution, +for example, it might be a timer updated once per host operating system +timer tick, with the host operating system timer ticking once every few +milliseconds; +.IP +a high-resolution timer might use a counter that runs at a rate +dependent on the processor clock speed, and that clock speed might be +adjusted upwards or downwards over time and the timer might not be able +to compensate for all those adjustments; +.IP +the host operating system's clock might be adjusted over time to match a +time standard to which the host is being synchronized, which might be +done by temporarily slowing down or speeding up the clock or by making a +single adjustment; +.IP +different CPU cores on a multi-core or multi-processor system might be +running at different speeds, or might not have time counters all +synchronized, so packets time-stamped by different cores might not have +consistent time stamps. +.LP +In addition, packets time-stamped by different cores might be +time-stamped in one order and added to the queue of packets for libpcap +to read in another order, so time stamps might not be monotonically +increasing. +.LP +Some capture devices on some platforms can provide time stamps for +packets; those time stamps are usually high-resolution time stamps, and +are usually applied to the packet when the first or last bit of the +packet arrives, and are thus more accurate than time stamps provided by +the host operating system. Those time stamps might not, however, be +synchronized with the host operating system's clock, so that, for +example, the time stamp of a packet might not correspond to the time +stamp of an event on the host triggered by the arrival of that packet. +.LP +Depending on the capture device and the software on the host, libpcap +might allow different types of time stamp to be used. The +.BR pcap_list_tstamp_types (3PCAP) +routine provides, for a packet capture handle created by +.BR pcap_create (3PCAP) +but not yet activated by +.BR pcap_activate (3PCAP), +a list of time stamp types supported by the capture device for that +handle. +The list might be empty, in which case no choice of time stamp type is +offered for that capture device. If the list is not empty, the +.BR pcap_set_tstamp_type (3PCAP) +routine can be used after a +.B pcap_create() +call and before a +.B pcap_activate() +call to specify the type of time stamp to be used on the device. +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() . +.RS 5 +.TP 5 +.BR PCAP_TSTAMP_HOST " - " host +Time stamp provided by the host on which the capture is being done. The +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. +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. +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 +.BR PCAP_TSTAMP_HOST_LOWPREC . +.TP 5 +.BR PCAP_TSTAMP_ADAPTER " - " adapter +Time stamp provided by the network adapter on which the capture is being +done. This is a high-precision time stamp, synchronized with the host +operating system's clock. +.TP 5 +.BR PCAP_TSTAMP_ADAPTER_UNSYNCED " - " adapter_unsynced +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 +.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) diff --git a/libpcap/pcap-win32.c b/libpcap/pcap-win32.c index 0e2201e36f..d8ed453510 100644 --- a/libpcap/pcap-win32.c +++ b/libpcap/pcap-win32.c @@ -39,7 +39,12 @@ static const char rcsid[] _U_ = #include #include #ifdef __MINGW32__ +#ifdef __MINGW64__ +#include +#else /*__MINGW64__*/ +#include #include +#endif /*__MINGW64__*/ #else /*__MINGW32__*/ #include #endif /*__MINGW32__*/ @@ -232,7 +237,7 @@ pcap_read_win32_npf(pcap_t *p, int cnt, pcap_handler callback, u_char *user) * XXX A bpf_hdr matches a pcap_pkthdr. */ (*callback)(user, (struct pcap_pkthdr*)bp, bp + hdrlen); - bp += BPF_WORDALIGN(caplen + hdrlen); + bp += Packet_WORDALIGN(caplen + hdrlen); if (++n >= cnt && cnt > 0) { p->bp = bp; p->cc = ep - bp; diff --git a/libpcap/pcap.3pcap.in b/libpcap/pcap.3pcap.in index c2f912663b..6f99cc519d 100644 --- a/libpcap/pcap.3pcap.in +++ b/libpcap/pcap.3pcap.in @@ -37,22 +37,51 @@ on the network, even those destined for other hosts, are accessible through this mechanism. It also supports saving captured packets to a ``savefile'', and reading packets from a ``savefile''. -.PP -To open a handle for a live capture, call -.BR pcap_create() , +.SS Opening a capture handle for reading +To open a handle for a live capture, given the name of the network or +other interface on which the capture should be done, call +.BR pcap_create (), set the appropriate options on the handle, and then activate it with -.BR pcap_activate() . -To open a handle for a ``savefile'' with captured packets, call -.BR pcap_open_offline() . -Both -.B pcap_create() +.BR pcap_activate (). +.PP +To obtain a list of devices that can be opened for a live capture, call +.BR pcap_findalldevs (); +to free the list returned by +.BR pcap_findalldevs (), +call +.BR pcap_freealldevs (). +.BR pcap_lookupdev () +will return the first device on that list that is not a ``loopback`` +network interface. +.PP +To open a handle for a ``savefile'' from which to read packets, given the +pathname of the ``savefile'', call +.BR pcap_open_offline (); +to set up a handle for a ``savefile'', given a +.B "FILE\ *" +referring to a file already opened for reading, call +.BR pcap_fopen_offline (). +.PP +In order to get a ``fake'' +.B pcap_t +for use in routines that require a +.B pcap_t +as an argument, such as routines to open a ``savefile'' for writing and +to compile a filter expression, call +.BR pcap_open_dead (). +.PP +.BR pcap_create (), +.BR pcap_open_offline (), +.BR pcap_fopen_offline (), and -.B pcap_open_offline() +.BR pcap_open_dead () return a pointer to a .BR pcap_t , which is the handle used for reading packets from the capture stream or the ``savefile'', and for finding out information about the capture stream or ``savefile''. +To close a handle, use +.BR pcap_close (). .PP The options that can be set on a capture handle include .IP "snapshot length" @@ -75,7 +104,7 @@ A snapshot length of 65535 should be sufficient, on most if not all networks, to capture all the data available from the packet. .IP The snapshot length is set with -.BR pcap_set_snaplen() . +.BR pcap_set_snaplen (). .IP "promiscuous mode" On broadcast LANs such as Ethernet, if the network isn't switched, or if the adapter is connected to a "mirror port" on a switch to which all @@ -97,7 +126,7 @@ For now, this doesn't work on the "any" device; if an argument of "any" or NULL is supplied, the setting of promiscuous mode is ignored. .IP Promiscuous mode is set with -.BR pcap_set_promisc() . +.BR pcap_set_promisc (). .IP "monitor mode" On IEEE 802.11 wireless LANs, even if an adapter is in promiscuous mode, it will supply to the host only frames for the network with which it's @@ -118,9 +147,9 @@ if you are capturing in monitor mode and are not connected to another network with another adapter. .IP Monitor mode is set with -.BR pcap_set_rfmon() , +.BR pcap_set_rfmon (), and -.B pcap_can_set_rfmon() +.BR pcap_can_set_rfmon () can be used to determine whether an adapter can be put into monitor mode. .IP "read timeout" @@ -162,7 +191,7 @@ guarantee that a call reading packets will return after the timeout expires even if no packets have arrived. .IP The read timeout is set with -.BR pcap_set_timeout() . +.BR pcap_set_timeout (). .IP "buffer size" Packets that arrive for a capture are stored in a buffer, so that they do not have to be read by the application as soon as they arrive. On @@ -175,7 +204,17 @@ non-pageable operating system memory than is necessary to prevent packets from being dropped. .IP The buffer size is set with -.BR pcap_set_buffer_size() . +.BR pcap_set_buffer_size (). +.IP "timestamp type" +On some platforms, the time stamp given to packets on live captures can +come from different sources that can have different resolutions or that +can have different relationships to the time values for the current time +supplied by routines on the native operating system. See +.BR pcap-tstamp (@MAN_MISC_INFO@) +for a list of time stamp types. +.IP +The time stamp type is set with +.BR pcap_set_tstamp_type (). .PP Reading packets from a network interface may require that you have special privileges: @@ -260,26 +299,193 @@ have to find some other way to make that happen at boot time. .PP Reading a saved packet file doesn't require special privileges. .PP -To open a ``savefile`` to which to write packets, call -.BR pcap_dump_open() . -It returns a pointer to a -.BR pcap_dumper_t , -which is the handle used for writing packets to the ``savefile''. +The packets read from the handle may include a ``pseudo-header'' +containing various forms of packet meta-data, and probably includes a +link-layer header whose contents can differ for different network +interfaces. To determine the format of the packets supplied by the +handle, call +.BR pcap_datalink (); +.I http://www.tcpdump.org/linktypes.html +lists the values it returns and describes the packet formats that +correspond to those values. .PP +To obtain the +.B "FILE\ *" +corresponding to a +.B pcap_t +opened for a ``savefile'', call +.BR pcap_file (). +.TP +.B Routines +.RS +.TP +.BR pcap_create (3PCAP) +get a +.B pcap_t +for live capture +.TP +.BR pcap_activate (3PCAP) +activate a +.B pcap_t +for live capture +.TP +.BR pcap_findalldevs (3PCAP) +get a list of devices that can be opened for a live capture +.TP +.BR pcap_freealldevs (3PCAP) +free list of devices +.TP +.BR pcap_lookupdev (3PCAP) +get first non-loopback device on that list +.TP +.BR pcap_open_offline (3PCAP) +open a +.B pcap_t +for a ``savefile'', given a pathname +.TP +.BR pcap_fopen_offline (3PCAP) +open a +.B pcap_t +for a ``savefile'', given a +.B "FILE\ *" +.TP +.BR pcap_open_dead (3PCAP) +create a ``fake'' +.B pcap_t +.TP +.BR pcap_close (3PCAP) +close a +.B pcap_t +.TP +.BR pcap_set_snaplen (3PCAP) +set the snapshot length for a not-yet-activated +.B pcap_t +for live capture +.TP +.BR pcap_snapshot (3PCAP) +get the snapshot length for a +.B pcap_t +.TP +.BR pcap_set_promisc (3PCAP) +set promiscuous mode for a not-yet-activated +.B pcap_t +for live capture +.TP +.BR pcap_set_rfmon (3PCAP) +set monitor mode for a not-yet-activated +.B pcap_t +for live capture +.TP +.BR pcap_can_set_rfmon (3PCAP) +determine whether monitor mode can be set for a +.B pcap_t +for live capture +.TP +.BR pcap_set_timeout (3PCAP) +set read timeout for a not-yet-activated +.B pcap_t +for live capture +.TP +.BR pcap_set_buffer_size (3PCAP) +set buffer size for a not-yet-activated +.B pcap_t +for live capture +.TP +.BR pcap_set_tstamp_type (3PCAP) +set time stamp type for a not-yet-activated +.B pcap_t +for live capture +.TP +.BR pcap_list_tstamp_types (3PCAP) +get list of available time stamp types for a not-yet-activated +.B pcap_t +for live capture +.TP +.BR pcap_free_tstamp_types (3PCAP) +free list of available time stamp types +.TP +.BR pcap_tstamp_type_val_to_name (3PCAP) +get name for a time stamp type +.TP +.BR pcap_tstamp_type_val_to_description (3PCAP) +get description for a time stamp type +.TP +.BR pcap_tstamp_name_to_val (3PCAP) +get time stamp type corresponding to a name +.TP +.BR pcap_datalink (3PCAP) +get link-layer header type for a +.B pcap_t +.TP +.BR pcap_file (3PCAP) +get the +.B "FILE\ *" +for a +.B pcap_t +opened for a ``savefile'' +.TP +.BR pcap_is_swapped (3PCAP) +determine whether a ``savefile'' being read came from a machine with the +opposite byte order +.TP +.BR pcap_major_version (3PCAP) +.PD 0 +.TP +.BR pcap_minor_version (3PCAP) +get the major and minor version of the file format version for a +``savefile'' +.PD +.RE +.SS Selecting a link-layer header type for a live capture +Some devices may provide more than one link-layer header type. To +obtain a list of all link-layer header types provided by a device, call +.BR pcap_list_datalinks () +on an activated +.B pcap_t +for the device. +To free a list of link-layer header types, call +.BR pcap_free_datalinks (). +To set the link-layer header type for a device, call +.BR pcap_set_datalink (). +This should be done after the device has been activated but before any +packets are read and before any filters are compiled or installed. +.TP +.B Routines +.RS +.TP +.BR pcap_list_datalinks (3PCAP) +get a list of link-layer header types for a device +.TP +.BR pcap_free_datalinks (3PCAP) +free list of link-layer header types +.TP +.BR pcap_set_datalink (3PCAP) +set link-layer header type for a device +.TP +.BR pcap_datalink_val_to_name (3PCAP) +get name for a link-layer header type +.TP +.BR pcap_datalink_val_to_description (3PCAP) +get description for a link-layer header type +.TP +.BR pcap_datalink_name_to_val (3PCAP) +get link-layer header type corresponding to a name +.RE +.SS Reading packets Packets are read with -.B pcap_dispatch() +.BR pcap_dispatch () or -.BR pcap_loop() , +.BR pcap_loop (), which process one or more packets, calling a callback routine for each packet, or with -.B pcap_next() +.BR pcap_next () or -.BR pcap_next_ex() , +.BR pcap_next_ex (), which return the next packet. The callback for -.B pcap_dispatch() +.BR pcap_dispatch () and -.BR pcap_loop() +.BR pcap_loop () is supplied a pointer to a .IR "struct pcap_pkthdr" , which includes the following members: @@ -304,9 +510,9 @@ number of bytes available from the capture, if the length of the packet is larger than the maximum number of bytes to capture). .RE .PP -.B pcap_next_ex() +.BR pcap_next_ex () supplies that pointer through a pointer argument. -.B pcap_next() +.BR pcap_next () is passed an argument that points to a .I struct pcap_pkthdr structure, and fills it in. @@ -323,15 +529,306 @@ packet; to capture the entire packet, you will have to provide a value for .I snaplen in your call to -.B pcap_open_live() +.BR pcap_set_snaplen () that is sufficiently large to get all of the packet's data - a value of 65535 should be sufficient on most if not all networks). When reading from a ``savefile'', the snapshot length specified when the capture was performed will limit the amount of packet data available. -.B pcap_next() +.BR pcap_next () returns that pointer; -.B pcap_next_ex() +.BR pcap_next_ex () supplies that pointer through a pointer argument. +.PP +To force the loop in +.BR pcap_dispatch () +or +.BR pcap_loop () +to terminate, call +.BR pcap_breakloop (). +.PP +By default, when reading packets from an interface opened for a live +capture, +.BR pcap_dispatch (), +.BR pcap_next (), +and +.BR pcap_next_ex () +will, if no packets are currently available to be read, block waiting +for packets to become available. On some, but +.I not +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. +.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 +available to read. Call +.BR pcap_setnonblock () +to put a handle into non-blocking mode or to take it out of non-blocking +mode; call +.BR pcap_getnonblock () +to determine whether a handle is in non-blocking mode. Note that +non-blocking mode does not work correctly in Mac OS X 10.6. +.PP +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 +that can be used in those routines, call +.BR pcap_get_selectable_fd (). +Not all handles have such a descriptor available; +.BR pcap_get_selectable_fd () +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. +.TP +.B Routines +.RS +.TP +.BR pcap_dispatch (3PCAP) +read a bufferful of packets from a +.B pcap_t +open for a live capture or the full set of packets from a +.B pcap_t +open for a ``savefile'' +.TP +.BR pcap_loop (3PCAP) +read packets from a +.B pcap_t +until an interrupt or error occurs +.TP +.BR pcap_next (3PCAP) +read the next packet from a +.B pcap_t +without an indication whether an error occurred +.TP +.BR pcap_next_ex (3PCAP) +read the next packet from a +.B pcap_t +with an error indication on an error +.TP +.BR pcap_breakloop (3PCAP) +prematurely terminate the loop in +.BR pcap_dispatch () +or +.BR pcap_loop () +.TP +.BR pcap_setnonblock (3PCAP) +set or clear non-blocking mode on a +.B pcap_t +.TP +.BR pcap_getnonblock (3PCAP) +get the state of non-blocking mode for a +.B pcap_t +.TP +.BR pcap_get_selectable_fd (3PCAP) +attempt to get a descriptor for a +.B pcap_t +that can be used in calls such as +.BR select (2) +and +.BR poll (2) +.RE +.SS Filters +In order to cause only certain packets to be returned when reading +packets, a filter can be set on a handle. For a live capture, the +filtering will be performed in kernel mode, if possible, to avoid +copying ``uninteresting'' packets from the kernel to user mode. +.PP +A filter can be specified as a text string; the syntax and semantics of +the string are as described by +.BR pcap-filter (@MAN_MISC_INFO@). +A filter string is compiled into a program in a pseudo-machine-language +by +.BR pcap_compile () +and the resulting program can be made a filter for a handle with +.BR pcap_setfilter (). +The result of +.BR pcap_compile () +can be freed with a call to +.BR pcap_freecode (). +.BR pcap_compile () +may require a network mask for certain expressions in the filter string; +.BR pcap_lookupnet () +can be used to find the network address and network mask for a given +capture device. +.PP +A compiled filter can also be applied directly to a packet that has been +read using +.BR pcap_offline_filter (). +.TP +.B Routines +.RS +.TP +.BR pcap_compile (3PCAP) +compile filter expression to a pseudo-machine-language code program +.TP +.BR pcap_freecode (3PCAP) +free a filter program +.TP +.BR pcap_setfilter (3PCAP) +set filter for a +.B pcap_t +.TP +.BR pcap_lookupnet (3PCAP) +get network address and network mask for a capture device +.TP +.BR pcap_offline_filter (3PCAP) +apply a filter program to a packet +.RE +.SS Incoming and outgoing packets +By default, libpcap will attempt to capture both packets sent by the +machine and packets received by the machine. To limit it to capturing +only packets received by the machine or, if possible, only packets sent +by the machine, call +.BR pcap_setdirection (). +.TP +.BR Routines +.RS +.TP +.BR pcap_setdirection (3PCAP) +specify whether to capture incoming packets, outgoing packets, or both +.RE +.SS Capture statistics +To get statistics about packets received and dropped in a live capture, +call +.BR pcap_stats (). +.TP +.B Routines +.RS +.TP +.BR pcap_stats (3PCAP) +get capture statistics +.RE +.SS Opening a handle for writing captured packets +To open a ``savefile`` to which to write packets, given the pathname the +``savefile'' should have, call +.BR pcap_dump_open (). +To open a ``savefile`` to which to write packets, given the pathname the +``savefile'' should have, call +.BR pcap_dump_open (); +to set up a handle for a ``savefile'', given a +.B "FILE\ *" +referring to a file already opened for writing, call +.BR pcap_dump_fopen (). +They each return pointers to a +.BR pcap_dumper_t , +which is the handle used for writing packets to the ``savefile''. If it +succeeds, it will have created the file if it doesn't exist and +truncated the file if it does exist. +To close a +.BR pcap_dumper_t , +call +.BR pcap_dump_close (). +.TP +.B Routines +.RS +.TP +.BR pcap_dump_open (3PCAP) +open a +.B pcap_dumper_t +for a ``savefile``, given a pathname +.TP +.BR pcap_dump_fopen (3PCAP) +open a +.B pcap_dumper_t +for a ``savefile``, given a +.B "FILE\ *" +.TP +.BR pcap_dump_close (3PCAP) +close a +.B pcap_dumper_t +.TP +.BR pcap_dump_file (3PCAP) +get the +.B "FILE\ *" +for a +.B pcap_dumper_t +opened for a ``savefile'' +.RE +.SS Writing packets +To write a packet to a +.BR pcap_dumper_t , +call +.BR pcap_dump (). +Packets written with +.BR pcap_dump () +may be buffered, rather than being immediately written to the +``savefile''. Closing the +.B pcap_dumper_t +will cause all buffered-but-not-yet-written packets to be written to the +``savefile''. +To force all packets written to the +.BR pcap_dumper_t , +and not yet written to the ``savefile'' because they're buffered by the +.BR pcap_dumper_t , +to be written to the ``savefile'', without closing the +.BR pcap_dumper_t , +call +.BR pcap_dump_flush (). +.TP +.B Routines +.RS +.TP +.BR pcap_dump (3PCAP) +write packet to a +.B pcap_dumper_t +.TP +.BR pcap_dump_flush (3PCAP) +flush buffered packets written to a +.B pcap_dumper_t +to the ``savefile'' +.TP +.BR pcap_dump_ftell (3PCAP) +get current file position for a +.B pcap_dumper_t +.RE +.SS Injecting packets +If you have the required privileges, you can inject packets onto a +network with a +.B pcap_t +for a live capture, using +.BR pcap_inject () +or +.BR pcap_sendpacket (). +(The two routines exist for compatibility with both OpenBSD and WinPcap; +they perform the same function, but have different return values.) +.TP +.B Routines +.RS +.TP +.BR pcap_inject (3PCAP) +.PD 0 +.TP +.BR pcap_sendpacket (3PCAP) +transmit a packet +.PD +.RE +.SS Reporting errors +Some routines return error or warning status codes; to convert them to a +string, use +.BR pcap_statustostr (). +.TP +.B Routines +.RS +.TP +.BR pcap_statustostr (3PCAP) +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 (). +.TP +.B Routines +.RS +.TP +.BR pcap_library_version (3PCAP) +get library version string +.RE .SH BACKWARDS COMPATIBILITY .PP In versions of libpcap prior to 1.0, the @@ -346,18 +843,18 @@ which will include for you, rather than including .BR . .PP -.B pcap_create() +.BR pcap_create () and -.B pcap_activate() +.BR pcap_activate () were not available in versions of libpcap prior to 1.0; if you are writing an application that must work on versions of libpcap prior to 1.0, either use -.B pcap_open_live() +.BR pcap_open_live () to get a handle for a live capture or, if you want to be able to use the additional capabilities offered by using -.B pcap_create() +.BR pcap_create () and -.BR pcap_activate() , +.BR pcap_activate (), use an .BR autoconf (1) script or some other configuration script to check whether the libpcap diff --git a/libpcap/pcap.c b/libpcap/pcap.c index 8c5959fee8..b0146a7bd9 100644 --- a/libpcap/pcap.c +++ b/libpcap/pcap.c @@ -57,7 +57,7 @@ static const char rcsid[] _U_ = #include #include #include -#if !defined(_MSC_VER) && !defined(__BORLANDC__) +#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__MINGW32__) #include #endif #include @@ -82,7 +82,7 @@ int pcap_not_initialized(pcap_t *pcap) { /* this means 'not initialized' */ - return PCAP_ERROR_NOT_ACTIVATED; + return (PCAP_ERROR_NOT_ACTIVATED); } /* @@ -104,6 +104,56 @@ pcap_cant_set_rfmon(pcap_t *p _U_) return (0); } +/* + * Sets *tstamp_typesp to point to an array 1 or more supported time stamp + * types; the return value is the number of supported time stamp types. + * The list should be freed by a call to pcap_free_tstamp_types() when + * you're done with it. + * + * A return value of 0 means "you don't get a choice of time stamp type", + * in which case *tstamp_typesp is set to null. + * + * PCAP_ERROR is returned on error. + */ +int +pcap_list_tstamp_types(pcap_t *p, int **tstamp_typesp) +{ + if (p->tstamp_type_count == 0) { + /* + * We don't support multiple time stamp types. + */ + *tstamp_typesp = NULL; + } else { + *tstamp_typesp = (int*)calloc(sizeof(**tstamp_typesp), + p->tstamp_type_count); + if (*tstamp_typesp == NULL) { + (void)snprintf(p->errbuf, sizeof(p->errbuf), + "malloc: %s", pcap_strerror(errno)); + return (PCAP_ERROR); + } + (void)memcpy(*tstamp_typesp, p->tstamp_type_list, + sizeof(**tstamp_typesp) * p->tstamp_type_count); + } + return (p->tstamp_type_count); +} + +/* + * In Windows, you might have a library built with one version of the + * C runtime library and an application built with another version of + * the C runtime library, which means that the library might use one + * version of malloc() and free() and the application might use another + * version of malloc() and free(). If so, that means something + * allocated by the library cannot be freed by the application, so we + * need to have a pcap_free_tstamp_types() routine to free up the list + * allocated by pcap_list_tstamp_types(), even though it's just a wrapper + * around free(). + */ +void +pcap_free_tstamp_types(int *tstamp_type_list) +{ + free(tstamp_type_list); +} + /* * Default one-shot callback; overridden for capture types where the * packet data cannot be guaranteed to be available after the callback @@ -149,7 +199,8 @@ pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header, int status; /* We are on an offline capture */ - status = pcap_offline_read(p, 1, pcap_oneshot, (u_char *)&s); + status = pcap_offline_read(p, 1, p->oneshot_callback, + (u_char *)&s); /* * Return codes for pcap_offline_read() are: @@ -178,7 +229,7 @@ pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header, * The first one ('0') conflicts with the return code of 0 from * pcap_offline_read() meaning "end of file". */ - return (p->read_op(p, 1, pcap_oneshot, (u_char *)&s)); + return (p->read_op(p, 1, p->oneshot_callback, (u_char *)&s)); } static void @@ -258,6 +309,7 @@ pcap_create_common(const char *source, char *ebuf) pcap_set_snaplen(p, 65535); /* max packet size */ p->opt.promisc = 0; p->opt.buffer_size = 0; + p->opt.tstamp_type = -1; /* default to not setting time stamp type */ return (p); } @@ -267,54 +319,89 @@ pcap_check_activated(pcap_t *p) if (p->activated) { snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "can't perform " " operation on activated capture"); - return -1; + return (-1); } - return 0; + return (0); } int pcap_set_snaplen(pcap_t *p, int snaplen) { if (pcap_check_activated(p)) - return PCAP_ERROR_ACTIVATED; + return (PCAP_ERROR_ACTIVATED); p->snapshot = snaplen; - return 0; + return (0); } int pcap_set_promisc(pcap_t *p, int promisc) { if (pcap_check_activated(p)) - return PCAP_ERROR_ACTIVATED; + return (PCAP_ERROR_ACTIVATED); p->opt.promisc = promisc; - return 0; + return (0); } int pcap_set_rfmon(pcap_t *p, int rfmon) { if (pcap_check_activated(p)) - return PCAP_ERROR_ACTIVATED; + return (PCAP_ERROR_ACTIVATED); p->opt.rfmon = rfmon; - return 0; + return (0); } int pcap_set_timeout(pcap_t *p, int timeout_ms) { if (pcap_check_activated(p)) - return PCAP_ERROR_ACTIVATED; + return (PCAP_ERROR_ACTIVATED); p->md.timeout = timeout_ms; - return 0; + return (0); +} + +int +pcap_set_tstamp_type(pcap_t *p, int tstamp_type) +{ + int i; + + if (pcap_check_activated(p)) + return (PCAP_ERROR_ACTIVATED); + + /* + * If p->tstamp_type_count is 0, we don't support setting + * the time stamp type at all. + */ + if (p->tstamp_type_count == 0) + return (PCAP_ERROR_CANTSET_TSTAMP_TYPE); + + /* + * Check whether we claim to support this type of time stamp. + */ + for (i = 0; i < p->tstamp_type_count; i++) { + if (p->tstamp_type_list[i] == tstamp_type) { + /* + * Yes. + */ + p->opt.tstamp_type = tstamp_type; + return (0); + } + } + + /* + * No. We support setting the time stamp type, but not to this + * particular value. + */ + return (PCAP_WARNING_TSTAMP_TYPE_NOTSUP); } int pcap_set_buffer_size(pcap_t *p, int buffer_size) { if (pcap_check_activated(p)) - return PCAP_ERROR_ACTIVATED; + return (PCAP_ERROR_ACTIVATED); p->opt.buffer_size = buffer_size; - return 0; + return (0); } int @@ -322,6 +409,15 @@ pcap_activate(pcap_t *p) { int status; + /* + * Catch attempts to re-activate an already-activated + * pcap_t; this should, for example, catch code that + * calls pcap_open_live() followed by pcap_activate(), + * as some code that showed up in a Stack Exchange + * question did. + */ + if (pcap_check_activated(p)) + return (PCAP_ERROR_ACTIVATED); status = p->activate_op(p); if (status >= 0) p->activated = 1; @@ -384,7 +480,8 @@ pcap_open_live(const char *source, int snaplen, int promisc, int to_ms, char *er snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", source, p->errbuf); else if (status == PCAP_ERROR_NO_SUCH_DEVICE || - status == PCAP_ERROR_PERM_DENIED) + status == PCAP_ERROR_PERM_DENIED || + status == PCAP_ERROR_PROMISC_PERM_DENIED) snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s (%s)", source, pcap_statustostr(status), p->errbuf); else @@ -397,7 +494,7 @@ pcap_open_live(const char *source, int snaplen, int promisc, int to_ms, char *er int pcap_dispatch(pcap_t *p, int cnt, pcap_handler callback, u_char *user) { - return p->read_op(p, cnt, callback, user); + return (p->read_op(p, cnt, callback, user)); } /* @@ -407,7 +504,7 @@ int pcap_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) { - return p->read_op(p, cnt, callback, user); + return (p->read_op(p, cnt, callback, user)); } int @@ -571,6 +668,91 @@ pcap_set_datalink(pcap_t *p, int dlt) return (-1); } +/* + * This array is designed for mapping upper and lower case letter + * together for a case independent comparison. The mappings are + * based upon ascii character sequences. + */ +static const u_char charmap[] = { + (u_char)'\000', (u_char)'\001', (u_char)'\002', (u_char)'\003', + (u_char)'\004', (u_char)'\005', (u_char)'\006', (u_char)'\007', + (u_char)'\010', (u_char)'\011', (u_char)'\012', (u_char)'\013', + (u_char)'\014', (u_char)'\015', (u_char)'\016', (u_char)'\017', + (u_char)'\020', (u_char)'\021', (u_char)'\022', (u_char)'\023', + (u_char)'\024', (u_char)'\025', (u_char)'\026', (u_char)'\027', + (u_char)'\030', (u_char)'\031', (u_char)'\032', (u_char)'\033', + (u_char)'\034', (u_char)'\035', (u_char)'\036', (u_char)'\037', + (u_char)'\040', (u_char)'\041', (u_char)'\042', (u_char)'\043', + (u_char)'\044', (u_char)'\045', (u_char)'\046', (u_char)'\047', + (u_char)'\050', (u_char)'\051', (u_char)'\052', (u_char)'\053', + (u_char)'\054', (u_char)'\055', (u_char)'\056', (u_char)'\057', + (u_char)'\060', (u_char)'\061', (u_char)'\062', (u_char)'\063', + (u_char)'\064', (u_char)'\065', (u_char)'\066', (u_char)'\067', + (u_char)'\070', (u_char)'\071', (u_char)'\072', (u_char)'\073', + (u_char)'\074', (u_char)'\075', (u_char)'\076', (u_char)'\077', + (u_char)'\100', (u_char)'\141', (u_char)'\142', (u_char)'\143', + (u_char)'\144', (u_char)'\145', (u_char)'\146', (u_char)'\147', + (u_char)'\150', (u_char)'\151', (u_char)'\152', (u_char)'\153', + (u_char)'\154', (u_char)'\155', (u_char)'\156', (u_char)'\157', + (u_char)'\160', (u_char)'\161', (u_char)'\162', (u_char)'\163', + (u_char)'\164', (u_char)'\165', (u_char)'\166', (u_char)'\167', + (u_char)'\170', (u_char)'\171', (u_char)'\172', (u_char)'\133', + (u_char)'\134', (u_char)'\135', (u_char)'\136', (u_char)'\137', + (u_char)'\140', (u_char)'\141', (u_char)'\142', (u_char)'\143', + (u_char)'\144', (u_char)'\145', (u_char)'\146', (u_char)'\147', + (u_char)'\150', (u_char)'\151', (u_char)'\152', (u_char)'\153', + (u_char)'\154', (u_char)'\155', (u_char)'\156', (u_char)'\157', + (u_char)'\160', (u_char)'\161', (u_char)'\162', (u_char)'\163', + (u_char)'\164', (u_char)'\165', (u_char)'\166', (u_char)'\167', + (u_char)'\170', (u_char)'\171', (u_char)'\172', (u_char)'\173', + (u_char)'\174', (u_char)'\175', (u_char)'\176', (u_char)'\177', + (u_char)'\200', (u_char)'\201', (u_char)'\202', (u_char)'\203', + (u_char)'\204', (u_char)'\205', (u_char)'\206', (u_char)'\207', + (u_char)'\210', (u_char)'\211', (u_char)'\212', (u_char)'\213', + (u_char)'\214', (u_char)'\215', (u_char)'\216', (u_char)'\217', + (u_char)'\220', (u_char)'\221', (u_char)'\222', (u_char)'\223', + (u_char)'\224', (u_char)'\225', (u_char)'\226', (u_char)'\227', + (u_char)'\230', (u_char)'\231', (u_char)'\232', (u_char)'\233', + (u_char)'\234', (u_char)'\235', (u_char)'\236', (u_char)'\237', + (u_char)'\240', (u_char)'\241', (u_char)'\242', (u_char)'\243', + (u_char)'\244', (u_char)'\245', (u_char)'\246', (u_char)'\247', + (u_char)'\250', (u_char)'\251', (u_char)'\252', (u_char)'\253', + (u_char)'\254', (u_char)'\255', (u_char)'\256', (u_char)'\257', + (u_char)'\260', (u_char)'\261', (u_char)'\262', (u_char)'\263', + (u_char)'\264', (u_char)'\265', (u_char)'\266', (u_char)'\267', + (u_char)'\270', (u_char)'\271', (u_char)'\272', (u_char)'\273', + (u_char)'\274', (u_char)'\275', (u_char)'\276', (u_char)'\277', + (u_char)'\300', (u_char)'\341', (u_char)'\342', (u_char)'\343', + (u_char)'\344', (u_char)'\345', (u_char)'\346', (u_char)'\347', + (u_char)'\350', (u_char)'\351', (u_char)'\352', (u_char)'\353', + (u_char)'\354', (u_char)'\355', (u_char)'\356', (u_char)'\357', + (u_char)'\360', (u_char)'\361', (u_char)'\362', (u_char)'\363', + (u_char)'\364', (u_char)'\365', (u_char)'\366', (u_char)'\367', + (u_char)'\370', (u_char)'\371', (u_char)'\372', (u_char)'\333', + (u_char)'\334', (u_char)'\335', (u_char)'\336', (u_char)'\337', + (u_char)'\340', (u_char)'\341', (u_char)'\342', (u_char)'\343', + (u_char)'\344', (u_char)'\345', (u_char)'\346', (u_char)'\347', + (u_char)'\350', (u_char)'\351', (u_char)'\352', (u_char)'\353', + (u_char)'\354', (u_char)'\355', (u_char)'\356', (u_char)'\357', + (u_char)'\360', (u_char)'\361', (u_char)'\362', (u_char)'\363', + (u_char)'\364', (u_char)'\365', (u_char)'\366', (u_char)'\367', + (u_char)'\370', (u_char)'\371', (u_char)'\372', (u_char)'\373', + (u_char)'\374', (u_char)'\375', (u_char)'\376', (u_char)'\377', +}; + +int +pcap_strcasecmp(const char *s1, const char *s2) +{ + register const u_char *cm = charmap, + *us1 = (const u_char *)s1, + *us2 = (const u_char *)s2; + + while (cm[*us1] == cm[*us2++]) + if (*us1++ == '\0') + return(0); + return (cm[*us1] - cm[*--us2]); +} + struct dlt_choice { const char *name; const char *description; @@ -653,7 +835,7 @@ static struct dlt_choice dlt_choices[] = { DLT_CHOICE(DLT_PPI, "Per-Packet Information"), DLT_CHOICE(DLT_IEEE802_16_MAC_CPS_RADIO, "IEEE 802.16 MAC Common Part Sublayer plus radiotap header"), DLT_CHOICE(DLT_JUNIPER_ISM, "Juniper Integrated Service Module"), - DLT_CHOICE(DLT_IEEE802_15_4, "IEEE 802.15.4"), + DLT_CHOICE(DLT_IEEE802_15_4, "IEEE 802.15.4 with FCS"), DLT_CHOICE(DLT_SITA, "SITA pseudo-header"), DLT_CHOICE(DLT_ERF, "Endace ERF header"), DLT_CHOICE(DLT_RAIF1, "Ethernet with u10 Networks pseudo-header"), @@ -673,94 +855,19 @@ static struct dlt_choice dlt_choices[] = { DLT_CHOICE(DLT_CAN_SOCKETCAN, "CAN-bus with SocketCAN headers"), 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_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_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_SENTINEL }; -/* - * This array is designed for mapping upper and lower case letter - * together for a case independent comparison. The mappings are - * based upon ascii character sequences. - */ -static const u_char charmap[] = { - (u_char)'\000', (u_char)'\001', (u_char)'\002', (u_char)'\003', - (u_char)'\004', (u_char)'\005', (u_char)'\006', (u_char)'\007', - (u_char)'\010', (u_char)'\011', (u_char)'\012', (u_char)'\013', - (u_char)'\014', (u_char)'\015', (u_char)'\016', (u_char)'\017', - (u_char)'\020', (u_char)'\021', (u_char)'\022', (u_char)'\023', - (u_char)'\024', (u_char)'\025', (u_char)'\026', (u_char)'\027', - (u_char)'\030', (u_char)'\031', (u_char)'\032', (u_char)'\033', - (u_char)'\034', (u_char)'\035', (u_char)'\036', (u_char)'\037', - (u_char)'\040', (u_char)'\041', (u_char)'\042', (u_char)'\043', - (u_char)'\044', (u_char)'\045', (u_char)'\046', (u_char)'\047', - (u_char)'\050', (u_char)'\051', (u_char)'\052', (u_char)'\053', - (u_char)'\054', (u_char)'\055', (u_char)'\056', (u_char)'\057', - (u_char)'\060', (u_char)'\061', (u_char)'\062', (u_char)'\063', - (u_char)'\064', (u_char)'\065', (u_char)'\066', (u_char)'\067', - (u_char)'\070', (u_char)'\071', (u_char)'\072', (u_char)'\073', - (u_char)'\074', (u_char)'\075', (u_char)'\076', (u_char)'\077', - (u_char)'\100', (u_char)'\141', (u_char)'\142', (u_char)'\143', - (u_char)'\144', (u_char)'\145', (u_char)'\146', (u_char)'\147', - (u_char)'\150', (u_char)'\151', (u_char)'\152', (u_char)'\153', - (u_char)'\154', (u_char)'\155', (u_char)'\156', (u_char)'\157', - (u_char)'\160', (u_char)'\161', (u_char)'\162', (u_char)'\163', - (u_char)'\164', (u_char)'\165', (u_char)'\166', (u_char)'\167', - (u_char)'\170', (u_char)'\171', (u_char)'\172', (u_char)'\133', - (u_char)'\134', (u_char)'\135', (u_char)'\136', (u_char)'\137', - (u_char)'\140', (u_char)'\141', (u_char)'\142', (u_char)'\143', - (u_char)'\144', (u_char)'\145', (u_char)'\146', (u_char)'\147', - (u_char)'\150', (u_char)'\151', (u_char)'\152', (u_char)'\153', - (u_char)'\154', (u_char)'\155', (u_char)'\156', (u_char)'\157', - (u_char)'\160', (u_char)'\161', (u_char)'\162', (u_char)'\163', - (u_char)'\164', (u_char)'\165', (u_char)'\166', (u_char)'\167', - (u_char)'\170', (u_char)'\171', (u_char)'\172', (u_char)'\173', - (u_char)'\174', (u_char)'\175', (u_char)'\176', (u_char)'\177', - (u_char)'\200', (u_char)'\201', (u_char)'\202', (u_char)'\203', - (u_char)'\204', (u_char)'\205', (u_char)'\206', (u_char)'\207', - (u_char)'\210', (u_char)'\211', (u_char)'\212', (u_char)'\213', - (u_char)'\214', (u_char)'\215', (u_char)'\216', (u_char)'\217', - (u_char)'\220', (u_char)'\221', (u_char)'\222', (u_char)'\223', - (u_char)'\224', (u_char)'\225', (u_char)'\226', (u_char)'\227', - (u_char)'\230', (u_char)'\231', (u_char)'\232', (u_char)'\233', - (u_char)'\234', (u_char)'\235', (u_char)'\236', (u_char)'\237', - (u_char)'\240', (u_char)'\241', (u_char)'\242', (u_char)'\243', - (u_char)'\244', (u_char)'\245', (u_char)'\246', (u_char)'\247', - (u_char)'\250', (u_char)'\251', (u_char)'\252', (u_char)'\253', - (u_char)'\254', (u_char)'\255', (u_char)'\256', (u_char)'\257', - (u_char)'\260', (u_char)'\261', (u_char)'\262', (u_char)'\263', - (u_char)'\264', (u_char)'\265', (u_char)'\266', (u_char)'\267', - (u_char)'\270', (u_char)'\271', (u_char)'\272', (u_char)'\273', - (u_char)'\274', (u_char)'\275', (u_char)'\276', (u_char)'\277', - (u_char)'\300', (u_char)'\341', (u_char)'\342', (u_char)'\343', - (u_char)'\344', (u_char)'\345', (u_char)'\346', (u_char)'\347', - (u_char)'\350', (u_char)'\351', (u_char)'\352', (u_char)'\353', - (u_char)'\354', (u_char)'\355', (u_char)'\356', (u_char)'\357', - (u_char)'\360', (u_char)'\361', (u_char)'\362', (u_char)'\363', - (u_char)'\364', (u_char)'\365', (u_char)'\366', (u_char)'\367', - (u_char)'\370', (u_char)'\371', (u_char)'\372', (u_char)'\333', - (u_char)'\334', (u_char)'\335', (u_char)'\336', (u_char)'\337', - (u_char)'\340', (u_char)'\341', (u_char)'\342', (u_char)'\343', - (u_char)'\344', (u_char)'\345', (u_char)'\346', (u_char)'\347', - (u_char)'\350', (u_char)'\351', (u_char)'\352', (u_char)'\353', - (u_char)'\354', (u_char)'\355', (u_char)'\356', (u_char)'\357', - (u_char)'\360', (u_char)'\361', (u_char)'\362', (u_char)'\363', - (u_char)'\364', (u_char)'\365', (u_char)'\366', (u_char)'\367', - (u_char)'\370', (u_char)'\371', (u_char)'\372', (u_char)'\373', - (u_char)'\374', (u_char)'\375', (u_char)'\376', (u_char)'\377', -}; - -int -pcap_strcasecmp(const char *s1, const char *s2) -{ - register const u_char *cm = charmap, - *us1 = (const u_char *)s1, - *us2 = (const u_char *)s2; - - while (cm[*us1] == cm[*us2++]) - if (*us1++ == '\0') - return(0); - return (cm[*us1] - cm[*--us2]); -} - int pcap_datalink_name_to_val(const char *name) { @@ -798,6 +905,57 @@ pcap_datalink_val_to_description(int dlt) return (NULL); } +struct tstamp_type_choice { + const char *name; + const char *description; + int type; +}; + +static struct tstamp_type_choice tstamp_type_choices[] = { + { "host", "Host", PCAP_TSTAMP_HOST }, + { "host_lowprec", "Host, low precision", PCAP_TSTAMP_HOST_LOWPREC }, + { "host_hiprec", "Host, high precision", PCAP_TSTAMP_HOST_HIPREC }, + { "adapter", "Adapter", PCAP_TSTAMP_ADAPTER }, + { "adapter_unsynced", "Adapter, not synced with system time", PCAP_TSTAMP_ADAPTER_UNSYNCED }, + { NULL, NULL, 0 } +}; + +int +pcap_tstamp_type_name_to_val(const char *name) +{ + int i; + + for (i = 0; tstamp_type_choices[i].name != NULL; i++) { + if (pcap_strcasecmp(tstamp_type_choices[i].name, name) == 0) + return (tstamp_type_choices[i].type); + } + return (PCAP_ERROR); +} + +const char * +pcap_tstamp_type_val_to_name(int tstamp_type) +{ + int i; + + for (i = 0; tstamp_type_choices[i].name != NULL; i++) { + if (tstamp_type_choices[i].type == tstamp_type) + return (tstamp_type_choices[i].name); + } + return (NULL); +} + +const char * +pcap_tstamp_type_val_to_description(int tstamp_type) +{ + int i; + + for (i = 0; tstamp_type_choices[i].name != NULL; i++) { + if (tstamp_type_choices[i].type == tstamp_type) + return (tstamp_type_choices[i].description); + } + return (NULL); +} + int pcap_snapshot(pcap_t *p) { @@ -864,7 +1022,7 @@ pcap_geterr(pcap_t *p) int pcap_getnonblock(pcap_t *p, char *errbuf) { - return p->getnonblock_op(p, errbuf); + return (p->getnonblock_op(p, errbuf)); } /* @@ -896,7 +1054,7 @@ pcap_getnonblock_fd(pcap_t *p, char *errbuf) int pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf) { - return p->setnonblock_op(p, nonblock, errbuf); + return (p->setnonblock_op(p, nonblock, errbuf)); } #if !defined(WIN32) && !defined(MSDOS) @@ -976,6 +1134,9 @@ pcap_statustostr(int errnum) case PCAP_WARNING: return("Generic warning"); + case PCAP_WARNING_TSTAMP_TYPE_NOTSUP: + return ("That type of time stamp is not supported by that device"); + case PCAP_WARNING_PROMISC_NOTSUP: return ("That device doesn't support promiscuous mode"); @@ -1005,6 +1166,12 @@ pcap_statustostr(int errnum) case PCAP_ERROR_IFACE_NOT_UP: return ("That device is not up"); + + case PCAP_ERROR_CANTSET_TSTAMP_TYPE: + return ("That device doesn't support setting the time stamp type"); + + case PCAP_ERROR_PROMISC_PERM_DENIED: + return ("You don't have permission to capture in promiscuous mode on that device"); } (void)snprintf(ebuf, sizeof ebuf, "Unknown error: %d", errnum); return(ebuf); @@ -1033,7 +1200,7 @@ pcap_strerror(int errnum) int pcap_setfilter(pcap_t *p, struct bpf_program *fp) { - return p->setfilter_op(p, fp); + return (p->setfilter_op(p, fp)); } /* @@ -1048,15 +1215,15 @@ pcap_setdirection(pcap_t *p, pcap_direction_t d) if (p->setdirection_op == NULL) { snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Setting direction is not implemented on this platform"); - return -1; + return (-1); } else - return p->setdirection_op(p, d); + return (p->setdirection_op(p, d)); } int pcap_stats(pcap_t *p, struct pcap_stat *ps) { - return p->stats_op(p, ps); + return (p->stats_op(p, ps)); } static int @@ -1071,7 +1238,7 @@ pcap_stats_dead(pcap_t *p, struct pcap_stat *ps _U_) int pcap_setbuff(pcap_t *p, int dim) { - return p->setbuff_op(p, dim); + return (p->setbuff_op(p, dim)); } static int @@ -1085,7 +1252,7 @@ pcap_setbuff_dead(pcap_t *p, int dim) int pcap_setmode(pcap_t *p, int mode) { - return p->setmode_op(p, mode); + return (p->setmode_op(p, mode)); } static int @@ -1099,7 +1266,7 @@ pcap_setmode_dead(pcap_t *p, int mode) int pcap_setmintocopy(pcap_t *p, int size) { - return p->setmintocopy_op(p, size); + return (p->setmintocopy_op(p, size)); } static int @@ -1212,6 +1379,11 @@ pcap_cleanup_live_common(pcap_t *p) p->dlt_list = NULL; p->dlt_count = 0; } + if (p->tstamp_type_list != NULL) { + free(p->tstamp_type_list); + p->tstamp_type_list = NULL; + p->tstamp_type_count = 0; + } pcap_freecode(&p->fcode); #if !defined(WIN32) && !defined(MSDOS) if (p->fd >= 0) { @@ -1248,7 +1420,7 @@ pcap_open_dead(int linktype, int snaplen) #endif p->cleanup_op = pcap_cleanup_dead; p->activated = 1; - return p; + return (p); } /* diff --git a/libpcap/pcap/bpf.h b/libpcap/pcap/bpf.h index eff892c42c..17d533cb47 100644 --- a/libpcap/pcap/bpf.h +++ b/libpcap/pcap/bpf.h @@ -48,10 +48,30 @@ * "pcap-bpf.c" will include the native OS version, as it deals with * the OS's BPF implementation. * - * XXX - should this all just be moved to "pcap.h"? + * At least two programs found by Google Code Search explicitly includes + * (even though / includes it for you), + * so moving that stuff to would break the build for some + * programs. */ -#ifndef BPF_MAJOR_VERSION +/* + * If we've already included , don't re-define this stuff. + * We assume BSD-style multiple-include protection in , + * which is true of all but the oldest versions of FreeBSD and NetBSD, + * 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). + * + * We do not check for BPF_MAJOR_VERSION, as that's defined by + * , which is directly or indirectly included in some + * programs that also include pcap.h, and doesn't + * define stuff we need. + * + * This also provides our own multiple-include protection. + */ +#if !defined(_NET_BPF_H_) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h) +#define lib_pcap_bpf_h #ifdef __cplusplus extern "C" { @@ -70,7 +90,9 @@ typedef u_int bpf_u_int32; /* * Alignment macros. BPF_WORDALIGN rounds up to the next - * even multiple of BPF_ALIGNMENT. + * even multiple of BPF_ALIGNMENT. + * + * Tcpdump's print-pflog.c uses this, so we define it here. */ #ifndef __NetBSD__ #define BPF_ALIGNMENT sizeof(bpf_int32) @@ -79,9 +101,6 @@ typedef u_int bpf_u_int32; #endif #define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) -#define BPF_MAXBUFSIZE 0x8000 -#define BPF_MINBUFSIZE 32 - /* * Structure for "pcap_compile()", "pcap_setfilter()", etc.. */ @@ -91,26 +110,7 @@ struct bpf_program { }; /* - * Struct return by BIOCVERSION. This represents the version number of - * the filter language described by the instruction encodings below. - * bpf understands a program iff kernel_major == filter_major && - * kernel_minor >= filter_minor, that is, if the value returned by the - * running kernel has the same major number and a minor number equal - * equal to or less than the filter being downloaded. Otherwise, the - * results are undefined, meaning an error may be returned or packets - * may be accepted haphazardly. - * It has nothing to do with the source code version. - */ -struct bpf_version { - u_short bv_major; - u_short bv_minor; -}; -/* Current version number of filter architecture. */ -#define BPF_MAJOR_VERSION 1 -#define BPF_MINOR_VERSION 1 - -/* - * Data-link level type codes. + * Link-layer header type codes. * * Do *NOT* add new values to this list without asking * "tcpdump-workers@lists.tcpdump.org" for a value. Otherwise, you run @@ -119,6 +119,12 @@ struct bpf_version { * being able to handle captures with your new DLT_ value, with no hope * that they will ever be changed to do so (as that would destroy their * ability to read captures using that value for that other purpose). + * + * See + * + * http://www.tcpdump.org/linktypes.html + * + * for detailed descriptions of some of these link-layer header types. */ /* @@ -203,9 +209,22 @@ struct bpf_version { /* * Values between 100 and 103 are used in capture file headers as - * link-layer types corresponding to DLT_ types that differ - * between platforms; don't use those values for new DLT_ new types. + * link-layer header type LINKTYPE_ values corresponding to DLT_ types + * that differ between platforms; don't use those values for new DLT_ + * new types. + */ + +/* + * Values starting with 104 are used for newly-assigned link-layer + * header type values; for those link-layer header types, the DLT_ + * value returned by pcap_datalink() and passed to pcap_open_dead(), + * and the LINKTYPE_ value that appears in capture files, are the + * same. + * + * DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is + * the highest such value. */ +#define DLT_MATCHING_MIN 104 /* * This value was defined by libpcap 0.5; platforms that have defined @@ -697,6 +716,8 @@ struct bpf_version { /* * IEEE 802.15.4, exactly as it appears in the spec (no padding, no * nothing); requested by Mikko Saarnivala . + * For this one, we expect the FCS to be present at the end of the frame; + * if the frame has no FCS, DLT_IEEE802_15_4_NOFCS should be used. */ #define DLT_IEEE802_15_4 195 @@ -942,7 +963,7 @@ struct bpf_version { * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates * which of those it is. */ -#define DLT_IPNET 226 +#define DLT_IPNET 226 /* * CAN (Controller Area Network) frames, with a pseudo-header as supplied @@ -951,14 +972,116 @@ struct bpf_version { * * Requested by Felix Obenhuber . */ -#define DLT_CAN_SOCKETCAN 227 +#define DLT_CAN_SOCKETCAN 227 /* * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies * whether it's v4 or v6. Requested by Darren Reed . */ -#define DLT_IPV4 228 -#define DLT_IPV6 229 +#define DLT_IPV4 228 +#define DLT_IPV6 229 + +/* + * IEEE 802.15.4, exactly as it appears in the spec (no padding, no + * nothing), and with no FCS at the end of the frame; requested by + * Jon Smirl . + */ +#define DLT_IEEE802_15_4_NOFCS 230 + +/* + * Raw D-Bus: + * + * http://www.freedesktop.org/wiki/Software/dbus + * + * messages: + * + * http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages + * + * starting with the endianness flag, followed by the message type, etc., + * but without the authentication handshake before the message sequence: + * + * http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol + * + * Requested by Martin Vidner . + */ +#define DLT_DBUS 231 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + */ +#define DLT_JUNIPER_VS 232 +#define DLT_JUNIPER_SRX_E2E 233 +#define DLT_JUNIPER_FIBRECHANNEL 234 + +/* + * DVB-CI (DVB Common Interface for communication between a PC Card + * module and a DVB receiver). See + * + * http://www.kaiser.cx/pcap-dvbci.html + * + * for the specification. + * + * Requested by Martin Kaiser . + */ +#define DLT_DVB_CI 235 + +/* + * Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but + * *not* the same as, 27.010). Requested by Hans-Christoph Schemmel + * . + */ +#define DLT_MUX27010 236 + +/* + * STANAG 5066 D_PDUs. Requested by M. Baris Demiray + * . + */ +#define DLT_STANAG_5066_D_PDU 237 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + */ +#define DLT_JUNIPER_ATM_CEMIC 238 + +/* + * NetFilter LOG messages + * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets) + * + * Requested by Jakub Zawadzki + */ +#define DLT_NFLOG 239 + +/* + * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type + * for Ethernet packets with a 4-byte pseudo-header and always + * with the payload including the FCS, as supplied by their + * netANALYZER hardware and software. + * + * Requested by Holger P. Frommer + */ +#define DLT_NETANALYZER 240 + +/* + * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type + * for Ethernet packets with a 4-byte pseudo-header and FCS and + * with the Ethernet header preceded by 7 bytes of preamble and + * 1 byte of SFD, as supplied by their netANALYZER hardware and + * software. + * + * Requested by Holger P. Frommer + */ +#define DLT_NETANALYZER_TRANSPARENT 241 + +/* + * IP-over-Infiniband, as specified by RFC 4391. + * + * Requested by Petr Sumbera . + */ +#define DLT_IPOIB 242 + +#define DLT_MATCHING_MAX 242 /* highest value in the "matching" range */ /* * DLT and savefile link type values are split into a class and @@ -1069,4 +1192,4 @@ extern u_int bpf_filter(); } #endif -#endif +#endif /* !defined(_NET_BPF_H_) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h) */ diff --git a/libpcap/pcap/pcap.h b/libpcap/pcap/pcap.h index 05ba31f35b..a02b359961 100644 --- a/libpcap/pcap/pcap.h +++ b/libpcap/pcap/pcap.h @@ -251,6 +251,8 @@ typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *, #define PCAP_ERROR_NOT_RFMON -7 /* operation supported only in monitor mode */ #define PCAP_ERROR_PERM_DENIED -8 /* no permission to open the device */ #define PCAP_ERROR_IFACE_NOT_UP -9 /* interface isn't up */ +#define PCAP_ERROR_CANTSET_TSTAMP_TYPE -10 /* this device doesn't support setting the time stamp type */ +#define PCAP_ERROR_PROMISC_PERM_DENIED -11 /* you don't have permission to capture in promiscuous mode */ /* * Warning codes for the pcap API. @@ -259,6 +261,7 @@ typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *, */ #define PCAP_WARNING 1 /* generic warning code */ #define PCAP_WARNING_PROMISC_NOTSUP 2 /* this device doesn't support promiscuous mode */ +#define PCAP_WARNING_TSTAMP_TYPE_NOTSUP 3 /* the requested time stamp type is not supported */ /* * Value to pass to pcap_compile() as the netmask if you don't know what @@ -275,9 +278,60 @@ int pcap_set_promisc(pcap_t *, int); int pcap_can_set_rfmon(pcap_t *); int pcap_set_rfmon(pcap_t *, int); int pcap_set_timeout(pcap_t *, int); +int pcap_set_tstamp_type(pcap_t *, int); int pcap_set_buffer_size(pcap_t *, int); int pcap_activate(pcap_t *); +int pcap_list_tstamp_types(pcap_t *, int **); +void pcap_free_tstamp_types(int *); +int pcap_tstamp_type_name_to_val(const char *); +const char *pcap_tstamp_type_val_to_name(int); +const char *pcap_tstamp_type_val_to_description(int); + +/* + * Time stamp types. + * Not all systems and interfaces will necessarily support all of these. + * + * A system that supports PCAP_TSTAMP_HOST is offering time stamps + * provided by the host machine, rather than by the capture device, + * but not committing to any characteristics of the time stamp; + * it will not offer any of the PCAP_TSTAMP_HOST_ subtypes. + * + * PCAP_TSTAMP_HOST_LOWPREC is a time stamp, provided by the host machine, + * that's low-precision but relatively cheap to fetch; it's normally done + * using the system clock, so it's normally synchronized with times you'd + * fetch from system calls. + * + * PCAP_TSTAMP_HOST_HIPREC is a time stamp, provided by the host machine, + * that's high-precision; it might be more expensive to fetch. It might + * or might not be synchronized with the system clock, and might have + * problems with time stamps for packets received on different CPUs, + * depending on the platform. + * + * PCAP_TSTAMP_ADAPTER is a high-precision time stamp supplied by the + * capture device; it's synchronized with the system clock. + * + * PCAP_TSTAMP_ADAPTER_UNSYNCED is a high-precision time stamp supplied by + * the capture device; it's not synchronized with the system clock. + * + * Note that time stamps synchronized with the system clock can go + * backwards, as the system clock can go backwards. If a clock is + * not in sync with the system clock, that could be because the + * system clock isn't keeping accurate time, because the other + * clock isn't keeping accurate time, or both. + * + * Note that host-provided time stamps generally correspond to the + * time when the time-stamping code sees the packet; this could + * be some unknown amount of time after the first or last bit of + * the packet is received by the network adapter, due to batching + * of interrupts for packet arrival, queueing delays, etc.. + */ +#define PCAP_TSTAMP_HOST 0 /* host-provided, unknown characteristics */ +#define PCAP_TSTAMP_HOST_LOWPREC 1 /* host-provided, low precision */ +#define PCAP_TSTAMP_HOST_HIPREC 2 /* host-provided, high precision */ +#define PCAP_TSTAMP_ADAPTER 3 /* device-provided, synced with the system clock */ +#define PCAP_TSTAMP_ADAPTER_UNSYNCED 4 /* device-provided, not synced with the system clock */ + pcap_t *pcap_open_live(const char *, int, int, int, char *); pcap_t *pcap_open_dead(int, int); pcap_t *pcap_open_offline(const char *, char *); @@ -348,8 +402,16 @@ void pcap_freealldevs(pcap_if_t *); const char *pcap_lib_version(void); -/* XXX this guy lives in the bpf tree */ +/* + * On at least some versions of NetBSD, 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__ 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); char *bpf_image(const struct bpf_insn *, int); void bpf_dump(const struct bpf_program *, int); @@ -397,4 +459,4 @@ int pcap_get_selectable_fd(pcap_t *); } #endif -#endif +#endif /* lib_pcap_pcap_h */ diff --git a/libpcap/pcap_activate.3pcap b/libpcap/pcap_activate.3pcap index b33fa530fd..f963d35e51 100644 --- a/libpcap/pcap_activate.3pcap +++ b/libpcap/pcap_activate.3pcap @@ -43,6 +43,11 @@ returns 0 on success without warnings, .B PCAP_WARNING_PROMISC_NOTSUP on success on a device that doesn't support promiscuous mode if promiscuous mode was requested, +.B PCAP_WARNING_TSTAMP_TYPE_NOTSUP +on success if the time stamp type specified in a previous +.B pcap_set_tstamp_type() +call isn't supported by the capture source (the time stamp type is +left as the default), .B PCAP_WARNING on success with any other warning, .B PCAP_ERROR_ACTIVATED @@ -52,6 +57,9 @@ if the capture source specified when the handle was created doesn't exist, .B PCAP_ERROR_PERM_DENIED if the process doesn't have permission to open the capture source, +.B PCAP_ERROR_PROMISC_PERM_DENIED +if the process has permission to open the capture source but doesn't +have permission to put it into promiscuous mode, .B PCAP_ERROR_RFMON_NOTSUP if monitor mode was specified but the capture source doesn't support monitor mode, diff --git a/libpcap/pcap_can_set_rfmon.3pcap b/libpcap/pcap_can_set_rfmon.3pcap index 4c85e238ba..00b92a4034 100644 --- a/libpcap/pcap_can_set_rfmon.3pcap +++ b/libpcap/pcap_can_set_rfmon.3pcap @@ -19,7 +19,7 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.TH PCAP_CAN_SET_RFMON 3PCAP "5 April 2008" +.TH PCAP_CAN_SET_RFMON 3PCAP "18 May 2010" .SH NAME pcap_can_set_rfmon \- check whether monitor mode can be set for a not-yet-activated capture handle @@ -37,11 +37,15 @@ int pcap_can_set_rfmon(pcap_t *p); checks whether monitor mode could be set on a capture handle when the handle is activated. .SH RETURN VALUE -.B pcap_set_rfmon() +.B pcap_can_set_rfmon() returns 0 if monitor mode could not be set, 1 if monitor mode could be set, .B PCAP_ERROR_NO_SUCH_DEVICE -if the device specified when the handle was created doesn't exist, +if the capture source specified when the handle was created doesn't +exist, +.B PCAP_ERROR_PERM_DENIED +if the process doesn't have permission to check whether monitor mode +could be supported, .B PCAP_ERROR_ACTIVATED if called on a capture handle that has been activated, or .B PCAP_ERROR diff --git a/libpcap/pcap_compile.3pcap.in b/libpcap/pcap_compile.3pcap.in index e557fdb43e..7dbdad5a1c 100644 --- a/libpcap/pcap_compile.3pcap.in +++ b/libpcap/pcap_compile.3pcap.in @@ -55,7 +55,7 @@ the filter program. If the netmask of the network on which packets are being captured isn't known to the program, or if packets are being captured on the Linux "any" pseudo-interface that can capture on more than one network, a value of PCAP_NETMASK_UNKNOWN can be supplied; tests -for IPv4 broadcast addreses will fail to compile, but all other tests in +for IPv4 broadcast addresses will fail to compile, but all other tests in the filter program will be OK. .SH RETURN VALUE .B pcap_compile() diff --git a/libpcap/pcap_datalink.3pcap.in b/libpcap/pcap_datalink.3pcap.in index cdc7c24563..3d4ace1d79 100644 --- a/libpcap/pcap_datalink.3pcap.in +++ b/libpcap/pcap_datalink.3pcap.in @@ -19,7 +19,7 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.TH PCAP_DATALINK 3PCAP "5 April 2008" +.TH PCAP_DATALINK 3PCAP "22 August 2010" .SH NAME pcap_datalink \- get the link-layer header type .SH SYNOPSIS @@ -34,7 +34,7 @@ int pcap_datalink(pcap_t *p); .fi .SH DESCRIPTION .B pcap_datalink() -returns the link layer type for the live capture or ``savefile'' +returns the link-layer header type for the live capture or ``savefile'' specified by .IR p . .SH SEE ALSO diff --git a/libpcap/pcap_datalink_name_to_val.3pcap b/libpcap/pcap_datalink_name_to_val.3pcap index 93daafdfb1..9c8e18a3c4 100644 --- a/libpcap/pcap_datalink_name_to_val.3pcap +++ b/libpcap/pcap_datalink_name_to_val.3pcap @@ -19,7 +19,7 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.TH PCAP_DATALINK_NAME_TO_VAL 3PCAP "5 April 2008" +.TH PCAP_DATALINK_NAME_TO_VAL 3PCAP "22 August 2010" .SH NAME pcap_datalink_name_to_val \- get the link-layer header type value corresponding to a header type name @@ -35,12 +35,12 @@ int pcap_datalink_name_to_val(const char *name); .fi .SH DESCRIPTION .B pcap_datalink_name_to_val() -translates a data link type name, which is a +translates a link-layer header type name, which is a .B DLT_ name with the .B DLT_ -removed, to the corresponding data link type value. The translation -is case-insensitive. +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. diff --git a/libpcap/pcap_datalink_val_to_name.3pcap b/libpcap/pcap_datalink_val_to_name.3pcap index 5e4f6bceda..26397faf91 100644 --- a/libpcap/pcap_datalink_val_to_name.3pcap +++ b/libpcap/pcap_datalink_val_to_name.3pcap @@ -19,7 +19,7 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.TH PCAP_DATALINK_VAL_TO_NAME 3PCAP "24 December 2008" +.TH PCAP_DATALINK_VAL_TO_NAME 3PCAP "22 August 2010" .SH NAME pcap_datalink_val_to_name, pcap_datalink_val_to_description \- get a name or description for a link-layer header type value @@ -36,9 +36,9 @@ const char *pcap_datalink_val_to_description(int dlt); .fi .SH DESCRIPTION .B pcap_datalink_val_to_name() -translates a data link type value to the corresponding data link type -name. NULL is returned on failure. +translates a link-layer header type value to the corresponding +link-layer header type name. NULL is returned on failure. .PP .B pcap_datalink_val_to_description() -translates a data link type value to a short description of that data -link type. NULL is returned on failure. +translates a link-layer header type value to a short description of that +link-layer header type. NULL is returned on failure. diff --git a/libpcap/pcap_fileno.3pcap b/libpcap/pcap_fileno.3pcap index 02d24b532f..723733e73d 100644 --- a/libpcap/pcap_fileno.3pcap +++ b/libpcap/pcap_fileno.3pcap @@ -47,7 +47,7 @@ returns the file descriptor from which captured packets are read. .LP If .I p -refers to a ``savefile'' that was opened using fuctions such as +refers to a ``savefile'' that was opened using functions such as .BR pcap_open_offline() or .BR pcap_fopen_offline() , diff --git a/libpcap/pcap_findalldevs.3pcap b/libpcap/pcap_findalldevs.3pcap index 3bf152059e..2e56d09165 100644 --- a/libpcap/pcap_findalldevs.3pcap +++ b/libpcap/pcap_findalldevs.3pcap @@ -19,9 +19,10 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.TH PCAP_FINDALLDEVS 3PCAP "5 April 2008" +.TH PCAP_FINDALLDEVS 3PCAP "22 August 2010" .SH NAME -pcap_findalldevs \- get a list of capture devices +pcap_findalldevs, pcap_freealldevs \- get a list of capture devices, and +free that list .SH SYNOPSIS .nf .ft B @@ -35,6 +36,7 @@ char errbuf[PCAP_ERRBUF_SIZE]; .LP .ft B int pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf); +void pcap_freealldevs(pcap_if_t *alldevs); .ft .fi .SH DESCRIPTION @@ -48,12 +50,17 @@ or with (Note that there may be network devices that cannot be opened by the process calling .BR pcap_findalldevs() , -because, for example, that process might not have sufficient privileges +because, for example, that process does not have sufficient privileges to open them for capturing; if so, those devices will not appear on the list.) +If +.B pcap_findalldevs() +succeeds, the pointer pointed to by .I alldevsp -is set to point to the first element of the list; each element of the -list is of type +is set to point to the first element of the list, or to +.B NULL +if no devices were found (this is considered success). +Each element of the list is of type .BR pcap_if_t , and has the following members: .RS @@ -75,14 +82,18 @@ if not a pointer to a string giving a human-readable description of the device .TP .B addresses -a pointer to the first element of a list of addresses for the interface +a pointer to the first element of a list of network addresses for the +device, +or +.B NULL +if the device has no addresses .TP .B flags -interface flags: +device flags: .RS .TP .B PCAP_IF_LOOPBACK -set if the interface is a loopback interface +set if the device is a loopback interface .RE .RE .PP @@ -119,7 +130,7 @@ a pointer to a that contains the broadcast address corresponding to the address pointed to by .BR addr ; -may be null if the interface doesn't support broadcasts +may be null if the device doesn't support broadcasts .TP .B dstaddr if not @@ -129,21 +140,40 @@ a pointer to a that contains the destination address corresponding to the address pointed to by .BR addr ; -may be null if the interface isn't a point-to-point interface +may be null if the device isn't a point-to-point interface .RE .PP -Note that not all the addresses in the list of addresses are -necessarily IPv4 or IPv6 addresses - you must check the +Note that the addresses in the list of addresses might be IPv4 +addresses, IPv6 addresses, or some other type of addresses, so you must +check the .B sa_family member of the .B "struct sockaddr" -before interpreting the contents of the address. +before interpreting the contents of the address; do not assume that the +addresses are all IPv4 addresses, or even all IPv4 or IPv6 addresses. +IPv4 addresses have the value +.BR AF_INET , +IPv6 addresses have the value +.B AF_INET6 +(which older operating systems that don't support IPv6 might not +define), and other addresses have other values. Whether other addresses +are returned, and what types they might have is platform-dependent. +For IPv4 addresses, the +.B "struct sockaddr" +pointer can be interpreted as if it pointed to a +.BR "struct sockaddr_in" ; +for IPv6 addresses, it can be interpreted as if it pointed to a +.BR "struct sockaddr_in6". .PP The list of devices must be freed with -.BR pcap_freealldevs() . +.BR pcap_freealldevs() , +whch frees the list pointed to by +.IR alldevs . .SH RETURN VALUE .B pcap_findalldevs() -returns 0 on success and \-1 on failure. +returns 0 on success and \-1 on failure; as indicated, finding no +devices is considered success, rather than failure, so 0 will be +returned in that case. If \-1 is returned, .I errbuf is filled in with an appropriate error message. @@ -153,4 +183,4 @@ is assumed to be able to hold at least chars. .SH SEE ALSO pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP), -pcap_open_live(3PCAP), pcap_freealldevs(3PCAP) +pcap_open_live(3PCAP) diff --git a/libpcap/pcap_get_selectable_fd.3pcap b/libpcap/pcap_get_selectable_fd.3pcap index 61be3d32e8..ae33dbb2e4 100644 --- a/libpcap/pcap_get_selectable_fd.3pcap +++ b/libpcap/pcap_get_selectable_fd.3pcap @@ -56,19 +56,29 @@ 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 on most versions of most BSDs (including Mac OS X) +Note that in: +.IP +FreeBSD prior to FreeBSD 4.6; +.IP +NetBSD prior to NetBSD 3.0; +.IP +OpenBSD prior to OpenBSD 2.4; +.IP +Mac OS X prior to Mac OS X 10.7; +.PP .B select() and .B poll() do not work correctly on BPF devices; .B pcap_get_selectable_fd() will return a file descriptor on most of those versions (the exceptions -being FreeBSD 4.3 and 4.4), a simple +being FreeBSD 4.3 and 4.4), but a simple .B select() or .B poll() -will not return even after the read timeout expires. To work around -this, an application that uses +will not indicate that the descriptor is readable until a full buffer's +worth of packets is received, even if the read timeout expires before +then. To work around this, an application that uses .B select() or .B poll() diff --git a/libpcap/pcap_list_datalinks.3pcap.in b/libpcap/pcap_list_datalinks.3pcap.in index 490e8dde79..632757642b 100644 --- a/libpcap/pcap_list_datalinks.3pcap.in +++ b/libpcap/pcap_list_datalinks.3pcap.in @@ -19,10 +19,10 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.TH PCAP_LIST_DATALINKS 3PCAP "5 April 2008" +.TH PCAP_LIST_DATALINKS 3PCAP "22 August 2010" .SH NAME -pcap_list_datalinks \- get a list of link-layer header types supported -by a capture device +pcap_list_datalinks, pcap_free_datalinks \- get a list of link-layer header +types supported by a capture device, and free that list .SH SYNOPSIS .nf .ft B @@ -31,21 +31,26 @@ by a capture device .LP .ft B int pcap_list_datalinks(pcap_t *p, int **dlt_buf); +void pcap_free_datalinks(int *dlt_list); .ft .fi .SH DESCRIPTION .B pcap_list_datalinks() -is used to get a list of the supported data link types of the interface -associated with the pcap descriptor. +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 -.BR pcap_free_datalinks (3PCAP). +.BR pcap_free_datalinks() , +which frees the list of link-layer header types pointed to by +.IR dlt_list . .SH RETURN VALUE .B pcap_list_datalinks() -returns the number of data link types in the array on success and \-1 -on failure. +returns the number of link-layer header types in the array on success +and \-1 on failure. If \-1 is returned, .B pcap_geterr() or @@ -54,5 +59,6 @@ may be called with .I p as an argument to fetch or display the error text. .SH SEE ALSO -pcap(3PCAP), pcap_geterr(3PCAP), pcap_free_datalinks(3PCAP), +pcap(3PCAP), pcap_geterr(3PCAP), +pcap_datalink_val_to_name(3PCAP), pcap-linktype(@MAN_MISC_INFO@) diff --git a/libpcap/pcap_list_tstamp_types.3pcap.in b/libpcap/pcap_list_tstamp_types.3pcap.in new file mode 100644 index 0000000000..66d3d66793 --- /dev/null +++ b/libpcap/pcap_list_tstamp_types.3pcap.in @@ -0,0 +1,70 @@ +.\" +.\" Copyright (c) 1994, 1996, 1997 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that: (1) source code distributions +.\" retain the above copyright notice and this paragraph in its entirety, (2) +.\" distributions including binary code include the above copyright notice and +.\" this paragraph in its entirety in the documentation or other materials +.\" provided with the distribution, and (3) all advertising materials mentioning +.\" features or use of this software display the following acknowledgement: +.\" ``This product includes software developed by the University of California, +.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of +.\" the University nor the names of its contributors may be used to endorse +.\" or promote products derived from this software without specific prior +.\" written permission. +.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" +.TH PCAP_LIST_TSTAMP_TYPES 3PCAP "21 August 2010" +.SH NAME +pcap_list_tstamp_types, pcap_free_tstamp_types \- get a list of time +stamp types supported by a capture device, and free that list +.SH SYNOPSIS +.nf +.ft B +#include +.ft +.LP +.ft B +int pcap_list_tstamp_types(pcap_t *p, int **tstamp_typesp); +void pcap_free_tstamp_types(int *tstamp_types); +.ft +.fi +.SH DESCRIPTION +.B pcap_list_tstamp_types() +is used to get a list of the supported time stamp types of the interface +associated with the pcap descriptor. +.B pcap_list_tstamp_types() +allocates an array to hold the list and sets +.I *tstamp_typesp +to point to the array. +See +.BR pcap-tstamp (@MAN_MISC_INFO@) +for a list of all the time stamp types. +.PP +The caller is responsible for freeing the array with +.BR pcap_free_tstamp_types() , +which frees the list pointed to by +.IR tstamp_types . +.SH RETURN VALUE +.B pcap_list_tstamp_types() +returns the number of time stamp types in the array on success and +.B PCAP_ERROR +on failure. +A return value of zero means that you cannot specify a time stamp type; +you are limited to the capture device's default time stamp type. +If +.B PCAP_ERROR +is returned, +.B pcap_geterr() +or +.B pcap_perror() +may be called with +.I p +as an argument to fetch or display the error text. +.SH SEE ALSO +pcap(3PCAP), pcap_geterr(3PCAP), pcap_tstamp_type_val_to_name(3PCAP), +pcap-tstamp(@MAN_MISC_INFO@) diff --git a/libpcap/pcap_loop.3pcap b/libpcap/pcap_loop.3pcap index 70cfaa0293..da3069310a 100644 --- a/libpcap/pcap_loop.3pcap +++ b/libpcap/pcap_loop.3pcap @@ -109,7 +109,12 @@ pointer to the first (as given in the .I struct pcap_pkthdr a pointer to which is passed to the callback routine) -bytes of data from the packet. +bytes of data from the packet. The +.I struct pcap_pkthdr +and the packet data are not to be freed by the callback routine, and are +not guaranteed to be valid after the callback routine returns; if the +code needs them to be valid after the callback, it must make a copy of +them. .SH RETURN VALUE .B pcap_loop() returns 0 if diff --git a/libpcap/pcap_major_version.3pcap b/libpcap/pcap_major_version.3pcap index 6f9c8ae705..31903dcfd0 100644 --- a/libpcap/pcap_major_version.3pcap +++ b/libpcap/pcap_major_version.3pcap @@ -36,12 +36,14 @@ int pcap_minor_version(pcap_t *p); .SH DESCRIPTION If .I p -refers to a savefile, +refers to a ``savefile'', .B pcap_major_version() -returns the major number of the file format of the savefile and +returns the major number of the file format of the ``savefile'' and .B pcap_minor_version() -returns the minor number of the file format of the savefile. The -version number is stored in the header of the savefile. +returns the minor number of the file format of the ``savefile''. The +version number is stored in the ``savefile''; note that the meaning of +its values depends on the type of ``savefile'' (for example, pcap or +pcap-NG). .PP If .I p diff --git a/libpcap/pcap_next_ex.3pcap b/libpcap/pcap_next_ex.3pcap index 50ad198aa4..737383604b 100644 --- a/libpcap/pcap_next_ex.3pcap +++ b/libpcap/pcap_next_ex.3pcap @@ -45,7 +45,16 @@ argument is set to point to the struct for the packet, and the pointer pointed to by the .I pkt_data -argument is set to point to the data in the packet. +argument is set to point to the data in the packet. The +.I struct pcap_pkthdr +and the packet data are not to be freed by the caller, and are not +guaranteed to be valid after the next call to +.BR pcap_next_ex() , +.BR pcap_next() , +.BR pcap_loop() , +or +.BR pcap_dispatch() ; +if the code needs them to remain valid, it must make a copy of them. .PP .B pcap_next() reads the next packet (by calling @@ -54,7 +63,15 @@ with a .I cnt of 1) and returns a .I u_char -pointer to the data in that packet. +pointer to the data in that packet. The +packet data is not to be freed by the caller, and is not +guaranteed to be valid after the next call to +.BR pcap_next_ex() , +.BR pcap_next() , +.BR pcap_loop() , +or +.BR pcap_dispatch() ; +if the code needs it to remain valid, it must make a copy of it. The .I pcap_pkthdr structure pointed to by @@ -78,13 +95,13 @@ as an argument to fetch or display the error text. .B pcap_next() returns a pointer to the packet data on success, and returns .B NULL -if an error occured, or if no packets were read from a live +if an error occurred, or if no packets were read from a live capture (if, for example, they were discarded because they didn't pass the packet filter, or if, on platforms that support a read timeout that starts before any packets arrive, the timeout expires before any packets arrive, or if the file descriptor for the capture device is in non-blocking mode and no packets were available to be read), or if no more packets are available in a ``savefile.'' Unfortunately, there is -no way to determine whether an error occured or not. +no way to determine whether an error occurred or not. .SH SEE ALSO pcap(3PCAP), pcap_geterr(3PCAP), pcap_dispatch(3PCAP) diff --git a/libpcap/pcap_open_live.3pcap b/libpcap/pcap_open_live.3pcap index 623f0986ed..0889a2a258 100644 --- a/libpcap/pcap_open_live.3pcap +++ b/libpcap/pcap_open_live.3pcap @@ -74,7 +74,7 @@ is filled in with an appropriate error message. .I errbuf may also be set to warning text when .B pcap_open_live() -succeds; to detect this case the caller should store a zero-length string in +succeeds; to detect this case the caller should store a zero-length string in .I errbuf before calling .B pcap_open_live() diff --git a/libpcap/pcap_set_datalink.3pcap b/libpcap/pcap_set_datalink.3pcap index bad39e4c83..9af32d0696 100644 --- a/libpcap/pcap_set_datalink.3pcap +++ b/libpcap/pcap_set_datalink.3pcap @@ -19,7 +19,7 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.TH PCAP_SET_DATALINK 3PCAP "5 April 2008" +.TH PCAP_SET_DATALINK 3PCAP "22 August 2010" .SH NAME pcap_set_datalink \- set the link-layer header type to be used by a capture device @@ -35,7 +35,7 @@ int pcap_set_datalink(pcap_t *p, int dlt); .fi .SH DESCRIPTION .B pcap_set_datalink() -is used to set the current data link type of the pcap descriptor +is used to set the current link-layer header type of the pcap descriptor to the type specified by .IR dlt . .SH RETURN VALUE @@ -49,4 +49,5 @@ may be called with .I p as an argument to fetch or display the error text. .SH SEE ALSO -pcap(3PCAP), pcap_geterr(3PCAP) +pcap(3PCAP), pcap_geterr(3PCAP), +pcap_datalink_name_to_val(3PCAP) diff --git a/libpcap/pcap_set_tstamp_type.3pcap.in b/libpcap/pcap_set_tstamp_type.3pcap.in new file mode 100644 index 0000000000..261c315200 --- /dev/null +++ b/libpcap/pcap_set_tstamp_type.3pcap.in @@ -0,0 +1,65 @@ +.\" +.\" Copyright (c) 1994, 1996, 1997 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that: (1) source code distributions +.\" retain the above copyright notice and this paragraph in its entirety, (2) +.\" distributions including binary code include the above copyright notice and +.\" this paragraph in its entirety in the documentation or other materials +.\" provided with the distribution, and (3) all advertising materials mentioning +.\" features or use of this software display the following acknowledgement: +.\" ``This product includes software developed by the University of California, +.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of +.\" the University nor the names of its contributors may be used to endorse +.\" or promote products derived from this software without specific prior +.\" written permission. +.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" +.TH PCAP_SET_TSTAMP_TYPE 3PCAP "21 August 2010" +.SH NAME +pcap_set_tstamp_type \- set the time stamp type to be used by a +capture device +.SH SYNOPSIS +.nf +.ft B +#include +.ft +.LP +.ft B +int pcap_set_tstamp_type(pcap_t *p, int tstamp_type); +.ft +.fi +.SH DESCRIPTION +.B pcap_set_tstamp_type() +sets the the type of time stamp desired for packets captured on the pcap +descriptor to the type specified by +.IR tstamp_type . +It must be called on a pcap descriptor created by +.B pcap_create() +that has not yet been activated by +.BR pcap_activate() . +.B pcap_list_tstamp_types() +will give a list of the time stamp types supported by a given capture +device. +See +.BR pcap-tstamp (@MAN_MISC_INFO@) +for a list of all the time stamp types. +.SH RETURN VALUE +.B pcap_set_tstamp_type() +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 +capture device, +.B PCAP_ERROR_ACTIVATED +if called on a capture handle that has been activated, and +.B PCAP_ERROR_CANTSET_TSTAMP_TYPE +if the capture device doesn't support setting the time stamp type. +.SH SEE ALSO +pcap(3PCAP), +pcap_list_tstamp_types(3PCAP), +pcap_tstamp_type_name_to_val(3PCAP), +pcap-tstamp(@MAN_MISC_INFO@) diff --git a/libpcap/pcap_free_datalinks.3pcap b/libpcap/pcap_tstamp_type_name_to_val.3pcap similarity index 71% rename from libpcap/pcap_free_datalinks.3pcap rename to libpcap/pcap_tstamp_type_name_to_val.3pcap index b7355bdf81..8fcc4d75c0 100644 --- a/libpcap/pcap_free_datalinks.3pcap +++ b/libpcap/pcap_tstamp_type_name_to_val.3pcap @@ -1,4 +1,3 @@ -.\" @(#) $Header: /tcpdump/master/libpcap/pcap_free_datalinks.3pcap,v 1.1 2008-05-26 19:58:06 guy Exp $ .\" .\" Copyright (c) 1994, 1996, 1997 .\" The Regents of the University of California. All rights reserved. @@ -19,10 +18,10 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.TH PCAP_FREE_DATALINKS 3PCAP "26 May 2008" +.TH PCAP_TSTAMP_TYPE_NAME_TO_VAL 3PCAP "21 August 2010" .SH NAME -pcap_free_datalinks \- free a list of link-layer header types from -pcap_get_datalinks() +pcap_tstamp_type_name_to_val \- get the time stamp type value +corresponding to a time stamp type name .SH SYNOPSIS .nf .ft B @@ -30,12 +29,17 @@ pcap_get_datalinks() .ft .LP .ft B -void pcap_free_datalinks(int *dlt_list); +int pcap_tstamp_type_name_to_val(const char *name); .ft .fi .SH DESCRIPTION -.B pcap_free_datalinks() -is used to free a list of supported data link types returned by -.BR pcap_list_datalinks() . +.B pcap_tstamp_type_name_to_val() +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 +.B PCAP_ERROR +on failure. .SH SEE ALSO -pcap(3PCAP), pcap_list_datalinks(3PCAP) +pcap(3PCAP), pcap_tstamp_type_val_to_name(3PCAP) diff --git a/libpcap/pcap_freealldevs.3pcap b/libpcap/pcap_tstamp_type_val_to_name.3pcap similarity index 65% rename from libpcap/pcap_freealldevs.3pcap rename to libpcap/pcap_tstamp_type_val_to_name.3pcap index d3f234fc6f..5d8d75405c 100644 --- a/libpcap/pcap_freealldevs.3pcap +++ b/libpcap/pcap_tstamp_type_val_to_name.3pcap @@ -1,4 +1,3 @@ -.\" @(#) $Header: /tcpdump/master/libpcap/pcap_freealldevs.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,22 +18,28 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.TH PCAP_FREEALLDEVS 3PCAP "5 April 2008" +.TH PCAP_TSTAMP_TYPE_VAL_TO_NAME 3PCAP "21 August 2010" .SH NAME -pcap_freealldevs \- free a list of capture devices +pcap_tstamp_type_val_to_name, pcap_tstamp_type_val_to_description \- get +a name or description for a time stamp type value .SH SYNOPSIS .nf .ft B -#include +#include .ft .LP .ft B -void pcap_freealldevs(pcap_if_t *alldevs); +const char *pcap_tstamp_type_val_to_name(int tstamp_type); +const char *pcap_tstamp_type_val_to_description(int tstamp_type); .ft .fi .SH DESCRIPTION -.B pcap_freealldevs() -is used to free a list allocated by -.BR pcap_findalldevs() . +.B pcap_tstamp_type_val_to_name() +translates a time stamp type value to the corresponding time stamp type +name. NULL is returned on failure. +.PP +.B pcap_tstamp_type_val_to_description() +translates a time stamp type value to a short description of that time +stamp type. NULL is returned on failure. .SH SEE ALSO -pcap(3PCAP), pcap_findalldevs(3PCAP) +pcap(3PCAP), pcap_tstamp_type_name_to_val(3PCAP) diff --git a/libpcap/savefile.c b/libpcap/savefile.c index 56e571937d..8115749b13 100644 --- a/libpcap/savefile.c +++ b/libpcap/savefile.c @@ -94,10 +94,16 @@ static int sf_setnonblock(pcap_t *p, int nonblock, char *errbuf) { /* - * This is a savefile, not a live capture file, so ignore - * requests to put it in non-blocking mode. + * This is a savefile, not a live capture file, so reject + * requests to put it in non-blocking mode. (If it's a + * pipe, it could be put in non-blocking mode, but that + * would significantly complicate the code to read packets, + * as it would have to handle reading partial packets and + * keeping the state of the read.) */ - return (0); + snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + "Savefiles cannot be put into non-blocking mode"); + return (-1); } static int @@ -161,6 +167,7 @@ sf_cleanup(pcap_t *p) (void)fclose(p->sf.rfile); if (p->buffer != NULL) free(p->buffer); + pcap_freecode(&p->fcode); } pcap_t * @@ -376,7 +383,7 @@ pcap_offline_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) } if ((fcode = p->fcode.bf_insns) == NULL || - bpf_filter(fcode, p->buffer, h.len, h.caplen)) { + bpf_filter(fcode, data, h.len, h.caplen)) { (*callback)(user, &h, data); if (++n >= cnt && cnt > 0) break; diff --git a/libpcap/scanner.c b/libpcap/scanner.c index 9bff6fa4e6..d87543f16f 100644 --- a/libpcap/scanner.c +++ b/libpcap/scanner.c @@ -1,13 +1,6 @@ #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 11 "scanner.c" +#line 4 "scanner.c" #define YY_INT_ALIGNED short int @@ -395,8 +388,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 144 -#define YY_END_OF_BUFFER 145 +#define YY_NUM_RULES 147 +#define YY_END_OF_BUFFER 148 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -404,166 +397,166 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[1434] = +static yyconst flex_int16_t yy_accept[1438] = { 0, - 0, 0, 145, 142, 102, 102, 102, 103, 142, 103, - 103, 103, 143, 112, 112, 103, 103, 103, 103, 140, - 140, 142, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 103, 142, 106, 110, 64, 0, 140, 112, - 0, 140, 140, 140, 0, 114, 108, 105, 107, 104, - 109, 140, 141, 141, 140, 140, 140, 19, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 7, 140, 33, 34, 140, 140, - - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 88, 140, 65, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 82, 140, 140, 140, - 140, 140, 140, 140, 4, 140, 140, 140, 140, 140, - 140, 140, 65, 110, 140, 113, 113, 140, 112, 140, - 0, 114, 112, 114, 114, 114, 140, 140, 140, 64, - 5, 140, 77, 140, 140, 140, 140, 140, 140, 54, - 100, 1, 0, 140, 20, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 35, 140, 140, 17, 42, - 0, 140, 28, 140, 24, 67, 140, 140, 75, 36, - - 140, 96, 140, 140, 140, 140, 97, 140, 45, 66, - 78, 99, 140, 14, 140, 3, 140, 140, 140, 140, - 140, 90, 140, 140, 25, 140, 98, 140, 101, 37, - 2, 140, 41, 140, 9, 140, 10, 85, 140, 84, - 140, 140, 0, 140, 140, 113, 140, 140, 140, 140, - 112, 0, 140, 0, 115, 114, 114, 0, 114, 0, - 114, 0, 114, 0, 22, 140, 140, 140, 140, 61, - 40, 140, 38, 140, 140, 140, 29, 140, 94, 140, - 140, 44, 11, 140, 12, 13, 140, 140, 140, 31, - 74, 140, 59, 3, 95, 46, 140, 140, 140, 71, - - 140, 140, 140, 140, 47, 140, 140, 39, 140, 6, - 140, 89, 140, 8, 91, 140, 140, 0, 140, 52, - 70, 15, 140, 113, 113, 140, 113, 113, 113, 140, - 112, 140, 0, 114, 140, 0, 0, 114, 0, 114, - 115, 114, 0, 0, 0, 0, 114, 114, 114, 114, - 114, 0, 140, 55, 56, 57, 58, 140, 21, 140, - 140, 140, 140, 30, 140, 140, 0, 18, 140, 140, - 140, 83, 140, 32, 140, 76, 27, 26, 140, 140, - 79, 140, 140, 140, 49, 16, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 0, 140, - - 140, 113, 140, 140, 140, 140, 113, 113, 140, 112, - 140, 0, 0, 114, 114, 114, 0, 0, 115, 114, - 114, 115, 114, 0, 0, 114, 114, 114, 114, 114, - 0, 0, 0, 0, 114, 114, 0, 114, 0, 114, - 0, 93, 140, 140, 140, 23, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 67, 140, 140, 140, 140, 140, 140, 140, 72, 73, - 140, 92, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 113, 113, 140, 113, 113, 113, - 113, 140, 112, 140, 0, 114, 114, 0, 114, 0, - - 0, 114, 0, 114, 115, 114, 0, 0, 0, 114, - 114, 0, 114, 115, 114, 0, 0, 0, 0, 0, - 0, 0, 114, 114, 114, 114, 114, 0, 140, 140, - 140, 140, 51, 60, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 68, 140, 140, 43, - 80, 81, 140, 140, 140, 140, 53, 138, 134, 140, - 136, 135, 139, 140, 0, 140, 140, 113, 140, 140, - 140, 113, 140, 112, 140, 0, 0, 114, 114, 114, - 114, 114, 114, 0, 0, 115, 114, 114, 114, 0, - 0, 114, 114, 114, 114, 114, 0, 0, 0, 0, - - 0, 0, 0, 114, 114, 114, 114, 114, 0, 0, - 0, 0, 0, 114, 114, 0, 114, 0, 114, 0, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 117, 116, 140, 140, 69, 140, 140, - 140, 137, 133, 140, 140, 113, 113, 113, 113, 140, - 112, 140, 0, 114, 114, 0, 114, 114, 0, 114, - 0, 0, 114, 0, 114, 115, 114, 0, 0, 0, - 114, 114, 0, 114, 115, 114, 0, 0, 0, 0, - 0, 114, 114, 0, 114, 115, 114, 0, 114, 114, - 0, 0, 0, 0, 0, 0, 0, 114, 114, 114, - - 114, 114, 0, 62, 140, 54, 122, 129, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 63, 48, 140, - 140, 0, 140, 140, 140, 140, 140, 112, 140, 0, - 0, 114, 114, 114, 114, 114, 114, 114, 114, 114, - 0, 0, 115, 114, 114, 114, 0, 0, 114, 114, - 114, 114, 114, 0, 0, 0, 0, 0, 0, 0, - 114, 114, 114, 114, 114, 0, 114, 114, 0, 0, - 0, 0, 0, 0, 0, 114, 114, 114, 114, 114, - 0, 0, 0, 0, 0, 0, 114, 114, 0, 114, - 0, 114, 0, 86, 140, 140, 140, 140, 140, 140, - - 140, 140, 140, 140, 140, 50, 111, 111, 113, 113, - 140, 112, 140, 0, 114, 114, 0, 114, 114, 0, - 114, 114, 0, 114, 0, 111, 114, 0, 114, 115, - 114, 0, 0, 0, 114, 114, 0, 114, 115, 114, - 0, 0, 0, 0, 0, 114, 114, 0, 114, 115, - 114, 0, 0, 0, 0, 0, 0, 114, 114, 0, - 114, 115, 114, 0, 114, 114, 114, 0, 0, 0, - 0, 0, 0, 0, 114, 114, 114, 114, 114, 0, - 140, 140, 140, 140, 140, 140, 140, 140, 127, 140, - 87, 111, 111, 113, 140, 111, 111, 0, 0, 114, - - 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, - 114, 0, 111, 115, 114, 114, 114, 0, 0, 114, - 114, 114, 114, 114, 0, 0, 0, 0, 0, 0, - 0, 114, 114, 114, 114, 114, 0, 114, 114, 0, - 0, 0, 0, 0, 0, 0, 114, 114, 114, 114, - 114, 0, 114, 114, 114, 0, 0, 0, 0, 0, - 0, 0, 114, 114, 114, 114, 114, 0, 0, 0, - 0, 0, 0, 114, 114, 0, 114, 0, 114, 0, - 140, 140, 140, 131, 140, 140, 140, 140, 140, 140, - 140, 119, 113, 140, 112, 0, 114, 114, 0, 114, - - 114, 0, 114, 114, 0, 114, 114, 0, 114, 0, - 0, 0, 114, 0, 0, 114, 115, 114, 0, 0, - 0, 114, 114, 0, 114, 115, 114, 0, 0, 0, - 0, 0, 114, 114, 0, 114, 115, 114, 0, 0, - 0, 0, 0, 0, 114, 114, 0, 114, 115, 114, - 0, 0, 0, 0, 0, 0, 114, 114, 0, 114, - 115, 114, 0, 114, 114, 114, 0, 0, 0, 0, - 0, 0, 0, 114, 114, 114, 114, 114, 0, 140, - 140, 140, 140, 121, 140, 140, 140, 125, 140, 111, - 0, 0, 114, 114, 114, 114, 114, 114, 114, 114, - - 114, 114, 114, 114, 114, 114, 114, 0, 0, 0, - 115, 0, 0, 114, 0, 0, 114, 114, 114, 0, - 0, 0, 0, 0, 0, 0, 114, 114, 114, 0, - 114, 114, 0, 0, 0, 0, 0, 0, 0, 114, - 114, 114, 0, 114, 114, 114, 0, 0, 0, 0, - 0, 0, 0, 114, 114, 114, 0, 114, 114, 114, - 0, 0, 0, 0, 0, 0, 0, 114, 114, 114, - 0, 0, 0, 0, 0, 0, 114, 114, 0, 114, - 0, 114, 0, 118, 130, 132, 126, 140, 140, 140, - 140, 0, 0, 114, 0, 114, 0, 114, 114, 0, - - 114, 114, 0, 114, 114, 0, 114, 114, 0, 114, - 0, 0, 0, 0, 114, 114, 0, 114, 0, 0, - 114, 114, 114, 0, 0, 0, 0, 114, 114, 114, - 0, 0, 0, 0, 0, 114, 114, 114, 0, 0, - 0, 0, 0, 114, 114, 114, 0, 0, 0, 0, - 0, 114, 114, 114, 114, 114, 114, 0, 0, 0, - 0, 0, 0, 0, 114, 114, 114, 0, 140, 140, - 140, 140, 0, 0, 0, 114, 114, 114, 114, 114, - 114, 0, 0, 0, 0, 114, 114, 0, 0, 0, - 0, 114, 114, 114, 0, 0, 0, 0, 0, 114, - - 114, 114, 114, 0, 0, 0, 0, 0, 114, 114, - 114, 114, 0, 0, 0, 0, 0, 114, 114, 114, - 114, 0, 0, 0, 0, 0, 114, 0, 0, 0, - 0, 0, 114, 114, 114, 140, 140, 140, 128, 114, - 114, 114, 114, 114, 114, 114, 114, 0, 0, 0, - 0, 114, 114, 0, 0, 114, 0, 0, 0, 114, - 0, 0, 0, 114, 0, 0, 0, 114, 0, 0, - 0, 114, 114, 114, 114, 0, 0, 0, 0, 0, - 114, 123, 140, 120, 114, 0, 0, 114, 114, 0, - 114, 114, 114, 0, 114, 114, 114, 0, 114, 114, - - 114, 0, 114, 114, 114, 0, 0, 0, 0, 114, - 124, 114, 114, 0, 0, 0, 0, 0, 0, 114, - 114, 114, 0, 0, 114, 114, 114, 114, 114, 0, - 114, 114, 0 + 0, 0, 148, 145, 105, 105, 105, 106, 145, 106, + 106, 106, 146, 115, 115, 106, 106, 106, 106, 143, + 143, 145, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 106, 145, 109, 113, 67, 0, 143, 115, + 0, 143, 143, 143, 0, 117, 111, 108, 110, 107, + 112, 143, 144, 144, 143, 143, 143, 20, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 7, 143, 34, 35, 143, + + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 91, 143, 68, 143, 143, 143, 143, + 143, 143, 60, 143, 143, 143, 143, 85, 143, 143, + 143, 143, 143, 143, 61, 143, 4, 143, 143, 143, + 143, 143, 143, 143, 68, 113, 143, 116, 116, 143, + 115, 143, 0, 117, 115, 117, 117, 117, 143, 143, + 143, 67, 5, 143, 80, 143, 143, 143, 143, 143, + 143, 143, 55, 103, 1, 0, 143, 21, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 36, 143, + 143, 18, 43, 0, 143, 29, 143, 25, 70, 143, + + 143, 78, 37, 143, 99, 143, 143, 143, 143, 100, + 143, 46, 69, 81, 102, 143, 14, 143, 3, 143, + 143, 143, 143, 143, 93, 143, 143, 26, 143, 101, + 143, 104, 38, 2, 143, 42, 143, 9, 143, 10, + 88, 143, 87, 143, 143, 0, 143, 143, 116, 143, + 143, 143, 143, 115, 0, 143, 0, 118, 117, 117, + 0, 117, 0, 117, 0, 117, 0, 23, 143, 143, + 143, 143, 64, 16, 41, 143, 39, 143, 143, 143, + 30, 143, 97, 143, 143, 45, 11, 143, 12, 13, + 143, 143, 143, 32, 77, 143, 62, 3, 98, 47, + + 143, 143, 143, 74, 143, 143, 143, 143, 48, 143, + 143, 40, 143, 6, 143, 92, 143, 8, 94, 143, + 143, 0, 143, 53, 73, 15, 143, 116, 116, 143, + 116, 116, 116, 143, 115, 143, 0, 117, 143, 0, + 0, 117, 0, 117, 118, 117, 0, 0, 0, 0, + 117, 117, 117, 117, 117, 0, 143, 56, 57, 58, + 59, 143, 22, 143, 143, 143, 143, 31, 143, 143, + 0, 19, 143, 143, 143, 86, 143, 33, 143, 79, + 28, 27, 143, 143, 82, 143, 143, 143, 50, 17, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + + 143, 143, 0, 143, 143, 116, 143, 143, 143, 143, + 116, 116, 143, 115, 143, 0, 0, 117, 117, 117, + 0, 0, 118, 117, 117, 118, 117, 0, 0, 117, + 117, 117, 117, 117, 0, 0, 0, 0, 117, 117, + 0, 117, 0, 117, 0, 96, 143, 143, 143, 24, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 70, 143, 143, 143, 143, 143, + 143, 143, 75, 76, 143, 95, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 116, 116, + 143, 116, 116, 116, 116, 143, 115, 143, 0, 117, + + 117, 0, 117, 0, 0, 117, 0, 117, 118, 117, + 0, 0, 0, 117, 117, 0, 117, 118, 117, 0, + 0, 0, 0, 0, 0, 0, 117, 117, 117, 117, + 117, 0, 143, 143, 143, 143, 52, 63, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 71, 143, 143, 44, 83, 84, 143, 143, 143, 143, + 54, 141, 137, 143, 139, 138, 142, 143, 0, 143, + 143, 116, 143, 143, 143, 116, 143, 115, 143, 0, + 0, 117, 117, 117, 117, 117, 117, 0, 0, 118, + 117, 117, 117, 0, 0, 117, 117, 117, 117, 117, + + 0, 0, 0, 0, 0, 0, 0, 117, 117, 117, + 117, 117, 0, 0, 0, 0, 0, 117, 117, 0, + 117, 0, 117, 0, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 120, 119, 143, + 143, 72, 143, 143, 143, 140, 136, 143, 143, 116, + 116, 116, 116, 143, 115, 143, 0, 117, 117, 0, + 117, 117, 0, 117, 0, 0, 117, 0, 117, 118, + 117, 0, 0, 0, 117, 117, 0, 117, 118, 117, + 0, 0, 0, 0, 0, 117, 117, 0, 117, 118, + 117, 0, 117, 117, 0, 0, 0, 0, 0, 0, + + 0, 117, 117, 117, 117, 117, 0, 65, 143, 55, + 125, 132, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 66, 49, 143, 143, 0, 143, 143, 143, 143, + 143, 115, 143, 0, 0, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 0, 0, 118, 117, 117, 117, + 0, 0, 117, 117, 117, 117, 117, 0, 0, 0, + 0, 0, 0, 0, 117, 117, 117, 117, 117, 0, + 117, 117, 0, 0, 0, 0, 0, 0, 0, 117, + 117, 117, 117, 117, 0, 0, 0, 0, 0, 0, + 117, 117, 0, 117, 0, 117, 0, 89, 143, 143, + + 143, 143, 143, 143, 143, 143, 143, 143, 143, 51, + 114, 114, 116, 116, 143, 115, 143, 0, 117, 117, + 0, 117, 117, 0, 117, 117, 0, 117, 0, 114, + 117, 0, 117, 118, 117, 0, 0, 0, 117, 117, + 0, 117, 118, 117, 0, 0, 0, 0, 0, 117, + 117, 0, 117, 118, 117, 0, 0, 0, 0, 0, + 0, 117, 117, 0, 117, 118, 117, 0, 117, 117, + 117, 0, 0, 0, 0, 0, 0, 0, 117, 117, + 117, 117, 117, 0, 143, 143, 143, 143, 143, 143, + 143, 143, 130, 143, 90, 114, 114, 116, 143, 114, + + 114, 0, 0, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 0, 114, 118, 117, 117, + 117, 0, 0, 117, 117, 117, 117, 117, 0, 0, + 0, 0, 0, 0, 0, 117, 117, 117, 117, 117, + 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, + 117, 117, 117, 117, 117, 0, 117, 117, 117, 0, + 0, 0, 0, 0, 0, 0, 117, 117, 117, 117, + 117, 0, 0, 0, 0, 0, 0, 117, 117, 0, + 117, 0, 117, 0, 143, 143, 143, 134, 143, 143, + 143, 143, 143, 143, 143, 122, 116, 143, 115, 0, + + 117, 117, 0, 117, 117, 0, 117, 117, 0, 117, + 117, 0, 117, 0, 0, 0, 117, 0, 0, 117, + 118, 117, 0, 0, 0, 117, 117, 0, 117, 118, + 117, 0, 0, 0, 0, 0, 117, 117, 0, 117, + 118, 117, 0, 0, 0, 0, 0, 0, 117, 117, + 0, 117, 118, 117, 0, 0, 0, 0, 0, 0, + 117, 117, 0, 117, 118, 117, 0, 117, 117, 117, + 0, 0, 0, 0, 0, 0, 0, 117, 117, 117, + 117, 117, 0, 143, 143, 143, 143, 124, 143, 143, + 143, 128, 143, 114, 0, 0, 117, 117, 117, 117, + + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 0, 0, 0, 118, 0, 0, 117, 0, 0, + 117, 117, 117, 0, 0, 0, 0, 0, 0, 0, + 117, 117, 117, 0, 117, 117, 0, 0, 0, 0, + 0, 0, 0, 117, 117, 117, 0, 117, 117, 117, + 0, 0, 0, 0, 0, 0, 0, 117, 117, 117, + 0, 117, 117, 117, 0, 0, 0, 0, 0, 0, + 0, 117, 117, 117, 0, 0, 0, 0, 0, 0, + 117, 117, 0, 117, 0, 117, 0, 121, 133, 135, + 129, 143, 143, 143, 143, 0, 0, 117, 0, 117, + + 0, 117, 117, 0, 117, 117, 0, 117, 117, 0, + 117, 117, 0, 117, 0, 0, 0, 0, 117, 117, + 0, 117, 0, 0, 117, 117, 117, 0, 0, 0, + 0, 117, 117, 117, 0, 0, 0, 0, 0, 117, + 117, 117, 0, 0, 0, 0, 0, 117, 117, 117, + 0, 0, 0, 0, 0, 117, 117, 117, 117, 117, + 117, 0, 0, 0, 0, 0, 0, 0, 117, 117, + 117, 0, 143, 143, 143, 143, 0, 0, 0, 117, + 117, 117, 117, 117, 117, 0, 0, 0, 0, 117, + 117, 0, 0, 0, 0, 117, 117, 117, 0, 0, + + 0, 0, 0, 117, 117, 117, 117, 0, 0, 0, + 0, 0, 117, 117, 117, 117, 0, 0, 0, 0, + 0, 117, 117, 117, 117, 0, 0, 0, 0, 0, + 117, 0, 0, 0, 0, 0, 117, 117, 117, 143, + 143, 143, 131, 117, 117, 117, 117, 117, 117, 117, + 117, 0, 0, 0, 0, 117, 117, 0, 0, 117, + 0, 0, 0, 117, 0, 0, 0, 117, 0, 0, + 0, 117, 0, 0, 0, 117, 117, 117, 117, 0, + 0, 0, 0, 0, 117, 126, 143, 123, 117, 0, + 0, 117, 117, 0, 117, 117, 117, 0, 117, 117, + + 117, 0, 117, 117, 117, 0, 117, 117, 117, 0, + 0, 0, 0, 117, 127, 117, 117, 0, 0, 0, + 0, 0, 0, 117, 117, 117, 0, 0, 117, 117, + 117, 117, 117, 0, 117, 117, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -608,240 +601,240 @@ static yyconst flex_int32_t yy_meta[54] = 9, 4, 3 } ; -static yyconst flex_int16_t yy_base[1894] = +static yyconst flex_int16_t yy_base[1898] = { 0, - 0, 0, 3838, 53, 7401, 7401, 54, 3816, 60, 3829, - 7401, 82, 7401, 100, 31, 152, 47, 3813, 49, 169, - 211, 169, 61, 44, 61, 122, 30, 62, 75, 3791, - 215, 218, 160, 32, 166, 155, 230, 236, 53, 3800, - 173, 3778, 3763, 281, 7401, 0, 7401, 297, 320, 344, - 3796, 368, 0, 375, 0, 409, 7401, 7401, 7401, 7401, - 7401, 279, 297, 0, 3769, 3766, 3779, 0, 3778, 3766, - 3764, 3761, 3749, 3743, 3748, 3746, 3745, 3754, 3725, 3738, - 3721, 117, 3731, 3734, 3718, 3716, 3729, 3700, 3705, 3703, - 81, 3707, 3702, 3709, 139, 223, 0, 0, 122, 121, - - 3697, 3692, 167, 3676, 3674, 3677, 3680, 3669, 3677, 3668, - 3652, 3658, 0, 3666, 0, 3649, 3654, 3647, 3633, 3633, - 3633, 132, 3644, 3627, 3637, 3630, 170, 3626, 202, 3609, - 54, 3608, 3620, 3606, 0, 3604, 3602, 3592, 3599, 3590, - 3581, 3596, 7401, 7401, 434, 458, 211, 499, 523, 547, - 3604, 554, 3611, 578, 228, 3602, 3562, 3567, 3558, 0, - 0, 3563, 0, 3571, 3566, 3555, 3541, 3538, 3539, 3546, - 0, 0, 3541, 3530, 0, 3542, 3537, 3525, 3518, 3521, - 3501, 3504, 3516, 3501, 3500, 0, 3505, 3485, 0, 0, - 3489, 3479, 0, 3491, 0, 3486, 3474, 3481, 0, 0, - - 3470, 0, 3470, 3458, 254, 3440, 0, 3438, 3453, 0, - 3447, 0, 3450, 0, 3432, 3436, 3415, 3418, 3423, 3416, - 3411, 0, 3409, 3422, 0, 3411, 0, 3396, 0, 0, - 0, 3393, 0, 127, 270, 3403, 0, 0, 3393, 0, - 3390, 3390, 618, 3405, 641, 665, 3403, 672, 481, 226, - 696, 3394, 720, 3393, 3390, 728, 293, 3389, 3388, 488, - 769, 792, 3372, 0, 0, 3348, 332, 3351, 3354, 0, - 0, 3340, 0, 3337, 3329, 3313, 0, 3305, 0, 3299, - 3300, 0, 595, 3287, 0, 0, 3295, 3277, 3278, 0, - 0, 3276, 0, 0, 0, 0, 3290, 3267, 3264, 0, - - 3256, 3253, 3269, 3242, 3217, 3228, 3218, 0, 3217, 0, - 3216, 0, 228, 0, 0, 3207, 3202, 720, 3204, 0, - 0, 0, 817, 841, 315, 882, 3210, 3209, 386, 905, - 929, 953, 3200, 960, 602, 3195, 3194, 983, 757, 1007, - 1030, 3178, 0, 3176, 405, 408, 1054, 3175, 1078, 317, - 3174, 3179, 3137, 0, 0, 0, 0, 3127, 0, 3141, - 3140, 3107, 3105, 0, 3120, 3104, 1097, 0, 3091, 3080, - 3098, 0, 3067, 0, 3060, 3050, 0, 0, 3060, 3042, - 256, 3041, 3057, 159, 3054, 0, 3043, 3035, 3049, 3033, - 3027, 3035, 3018, 2985, 2986, 2979, 2984, 2998, 1134, 3016, - - 1157, 1181, 3014, 1188, 864, 310, 1212, 344, 1252, 1275, - 1299, 2981, 2980, 1307, 345, 2979, 2978, 2976, 2975, 1348, - 369, 2974, 2958, 496, 612, 1389, 2957, 1413, 378, 2956, - 2962, 2952, 871, 0, 306, 2951, 1101, 1454, 1477, 2950, - 0, 0, 2922, 2924, 2905, 0, 2911, 2895, 2901, 2914, - 2885, 2900, 2898, 330, 2881, 408, 2881, 2857, 2845, 2855, - 0, 2844, 2854, 2845, 2850, 2834, 2823, 2822, 0, 0, - 2826, 0, 2821, 2812, 2825, 2824, 2803, 2799, 2793, 2791, - 2796, 2800, 2799, 1502, 1526, 409, 1567, 2822, 2807, 614, - 1591, 1615, 1622, 1646, 2798, 1653, 1677, 1700, 2797, 2796, - - 2795, 1723, 1108, 1747, 1770, 2793, 0, 1235, 0, 442, - 2792, 1242, 1794, 1817, 2791, 0, 739, 766, 2783, 466, - 786, 817, 1841, 2774, 1865, 433, 2773, 2780, 386, 2744, - 2748, 2745, 0, 0, 2750, 2738, 2724, 2724, 2736, 2719, - 2717, 2724, 2716, 2702, 2713, 2712, 0, 2703, 2697, 0, - 0, 0, 2709, 2705, 2710, 2683, 0, 0, 0, 2687, - 0, 0, 0, 2676, 1905, 2711, 1928, 1952, 2709, 1959, - 467, 1983, 2007, 2014, 2038, 2699, 2698, 2046, 457, 2697, - 2087, 493, 2681, 2680, 2679, 2678, 2128, 494, 2677, 879, - 899, 2169, 2674, 2193, 498, 2673, 2666, 1128, 1130, 2665, - - 2664, 1251, 1317, 2234, 2655, 2258, 499, 2654, 2660, 1331, - 0, 1338, 0, 532, 2651, 1371, 2299, 2322, 2650, 0, - 2345, 479, 225, 370, 531, 622, 241, 129, 2606, 260, - 272, 433, 591, 2605, 2604, 1129, 2603, 2601, 1247, 854, - 532, 2599, 2583, 2383, 2420, 2456, 2492, 523, 2516, 593, - 2524, 2548, 2610, 2555, 2579, 2602, 2609, 2626, 2649, 2608, - 2607, 2605, 2672, 1378, 2696, 2719, 2604, 0, 1436, 0, - 587, 2603, 1443, 2743, 2766, 2587, 0, 1549, 0, 1556, - 0, 680, 2586, 1888, 2790, 2813, 2585, 0, 551, 1895, - 2592, 1386, 1451, 2590, 2589, 1471, 1502, 2837, 2580, 2861, - - 641, 2564, 2571, 571, 633, 572, 617, 768, 1251, 2056, - 1388, 687, 690, 808, 2083, 688, 810, 618, 766, 2081, - 2085, 2903, 833, 2926, 834, 2949, 2114, 2973, 2997, 2562, - 2561, 3005, 642, 2560, 3046, 671, 2558, 3087, 742, 2557, - 2556, 2555, 2533, 3128, 878, 2532, 1564, 1694, 3169, 2531, - 3193, 881, 2530, 2537, 1904, 2056, 2535, 2534, 2057, 2063, - 3234, 2525, 3258, 882, 2524, 2509, 900, 2151, 2508, 2123, - 2124, 2507, 2506, 2125, 2145, 3299, 2497, 3323, 902, 2495, - 2502, 0, 2216, 0, 2223, 0, 737, 2493, 2281, 3364, - 3387, 2492, 0, 898, 921, 975, 976, 1904, 977, 1453, - - 1001, 1022, 2276, 1023, 1566, 1046, 3412, 3435, 3459, 930, - 3499, 3523, 3547, 2445, 3554, 3578, 3601, 2444, 3625, 3648, - 2443, 3672, 3695, 2429, 2428, 2427, 3718, 2368, 3742, 3765, - 2426, 0, 2406, 0, 937, 2375, 2443, 3789, 3812, 2348, - 0, 2463, 0, 2470, 0, 969, 2347, 2477, 3836, 3859, - 2346, 0, 0, 2484, 0, 2884, 0, 1016, 2345, 2891, - 3883, 3906, 2331, 0, 0, 1006, 3028, 2338, 2166, 2231, - 2337, 2333, 2295, 2296, 3930, 2324, 3954, 1027, 2323, 2316, - 2298, 2359, 2360, 2127, 1048, 2233, 2361, 1071, 2362, 1070, - 1072, 1126, 1128, 3996, 4020, 4029, 1149, 2306, 2305, 4047, - - 1077, 2286, 4088, 1080, 2283, 4129, 1107, 2282, 4170, 1110, - 2281, 2265, 2261, 4210, 4234, 1157, 2259, 2414, 2415, 4275, - 2241, 4299, 1158, 2240, 2247, 2596, 2643, 2244, 2243, 2899, - 2900, 4340, 2202, 4364, 1159, 2201, 2208, 1182, 3035, 2204, - 2903, 3043, 2203, 2202, 3056, 3062, 4405, 2176, 4429, 1187, - 2175, 2182, 0, 1188, 3110, 2179, 3063, 3084, 2167, 2162, - 3104, 3123, 4470, 2135, 4494, 1189, 2105, 2083, 0, 3151, - 0, 3216, 0, 1284, 2073, 3223, 4535, 4558, 2071, 0, - 3268, 3269, 3333, 1150, 2399, 2105, 1407, 2400, 2275, 1469, - 1493, 1206, 4583, 4607, 4616, 2070, 4633, 4657, 4680, 2068, - - 4704, 4727, 2067, 4751, 4774, 2066, 4798, 4821, 2064, 2054, - 4845, 1246, 2053, 2051, 3286, 4886, 2023, 2022, 0, 3350, - 0, 1316, 2021, 3482, 4910, 2020, 2019, 0, 3489, 0, - 3977, 0, 1535, 2017, 3984, 4934, 2016, 2015, 0, 0, - 4036, 0, 4070, 0, 1576, 2014, 4077, 4958, 1991, 1990, - 0, 0, 4111, 0, 4118, 0, 1599, 1989, 4152, 4982, - 1988, 1985, 0, 0, 1248, 4159, 1976, 3125, 3145, 1972, - 1970, 3164, 3166, 5006, 1911, 5030, 1249, 1872, 1876, 1495, - 1669, 1670, 1520, 1347, 1671, 4168, 1583, 1715, 2401, 5072, - 1867, 5089, 5113, 1389, 1824, 5154, 1390, 1802, 5195, 1453, - - 1800, 5236, 1561, 1779, 5277, 1566, 1777, 1756, 4196, 5318, - 1752, 1729, 0, 1728, 3231, 3269, 5342, 1708, 1705, 1633, - 3294, 3333, 1632, 1608, 3360, 3381, 5366, 1573, 1569, 1541, - 1621, 4257, 1534, 3412, 3498, 1518, 1517, 3595, 3642, 5390, - 1505, 1480, 1469, 0, 1622, 4264, 1464, 3689, 4180, 1463, - 1423, 4181, 4205, 5414, 1394, 1391, 1398, 0, 1623, 4322, - 1365, 4209, 4272, 1363, 1361, 4316, 4335, 5438, 1351, 1350, - 1323, 0, 4387, 0, 4394, 0, 1630, 1314, 4452, 5462, - 0, 1312, 0, 1716, 1739, 1740, 1741, 1762, 1974, 4488, - 4504, 5486, 1650, 0, 1310, 5527, 0, 1282, 5551, 0, - - 1259, 5575, 0, 1258, 5599, 0, 1253, 5623, 0, 1217, - 4337, 4402, 5647, 1213, 1212, 1196, 1174, 1114, 4459, 0, - 1631, 1108, 1056, 4521, 0, 4623, 0, 1803, 1009, 988, - 0, 4868, 0, 4875, 0, 1826, 965, 963, 0, 5053, - 0, 5060, 0, 1850, 960, 938, 0, 5079, 0, 5136, - 0, 1874, 890, 883, 0, 1652, 5143, 858, 4467, 4531, - 67, 111, 4552, 4632, 5671, 200, 0, 224, 2363, 1763, - 1787, 1764, 5695, 249, 320, 0, 0, 0, 0, 0, - 0, 5177, 0, 1914, 322, 345, 0, 4674, 4721, 360, - 403, 0, 1653, 5184, 420, 4768, 4815, 424, 444, 0, - - 0, 1677, 5218, 475, 4883, 5088, 509, 516, 0, 0, - 1814, 5225, 610, 5233, 5246, 611, 633, 0, 0, 1816, - 5260, 683, 5274, 5287, 712, 713, 0, 0, 5301, 0, - 5509, 0, 1937, 733, 0, 3083, 2964, 2161, 1810, 0, - 7401, 0, 0, 0, 0, 0, 0, 5315, 5503, 744, - 778, 0, 7401, 5517, 0, 7401, 0, 5718, 0, 7401, - 0, 5725, 0, 7401, 0, 5732, 0, 7401, 0, 5739, - 0, 7401, 0, 1817, 5746, 784, 5754, 5755, 801, 1967, - 0, 1834, 3341, 1921, 0, 5755, 0, 1838, 5769, 803, - 0, 1841, 5776, 805, 0, 1899, 5783, 808, 0, 1901, - - 5795, 849, 0, 1902, 5802, 852, 0, 5809, 0, 7401, - 1975, 1929, 5816, 854, 0, 0, 0, 0, 0, 0, - 1954, 5823, 856, 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, 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, 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, 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, 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, 7334, 7337, 7340, 7344, 7348, - 7352, 7356, 7360, 7363, 7366, 7370, 7373, 7376, 7379, 7382, - 7385, 7389, 7392 + 0, 0, 3858, 53, 7396, 7396, 54, 3836, 60, 3849, + 7396, 82, 7396, 100, 31, 152, 47, 3834, 49, 169, + 211, 169, 61, 44, 126, 61, 30, 63, 76, 3811, + 215, 218, 160, 32, 166, 117, 171, 228, 145, 3820, + 229, 3812, 3782, 276, 7396, 0, 7396, 292, 315, 339, + 3815, 363, 0, 370, 0, 404, 7396, 7396, 7396, 7396, + 7396, 274, 292, 0, 3788, 3785, 3799, 0, 3797, 3785, + 3798, 3781, 3769, 3763, 3764, 3767, 3765, 3764, 3773, 3743, + 3756, 3739, 324, 3749, 3752, 3736, 3734, 3747, 3719, 3724, + 3722, 82, 3726, 3721, 3729, 148, 229, 0, 0, 37, + + 123, 3717, 3726, 167, 3695, 3693, 3696, 3699, 3689, 3695, + 3686, 3671, 3677, 0, 3685, 0, 3668, 3674, 3667, 3668, + 3668, 3653, 160, 3664, 3647, 3658, 3650, 56, 3645, 216, + 3628, 126, 3627, 3639, 0, 3625, 0, 3624, 3622, 3627, + 3634, 3610, 3601, 3616, 7396, 7396, 429, 453, 212, 494, + 518, 542, 3625, 549, 3631, 573, 269, 3621, 3581, 3586, + 3577, 0, 0, 3582, 0, 3591, 3585, 3574, 3573, 3559, + 3556, 3557, 3564, 0, 0, 3558, 3548, 0, 3560, 3540, + 3528, 3542, 3545, 3526, 3528, 3541, 3526, 3525, 0, 3509, + 3503, 0, 0, 3506, 3496, 0, 3507, 0, 3504, 3492, + + 3499, 0, 0, 3474, 0, 3483, 3491, 203, 3473, 0, + 3469, 3485, 0, 3480, 0, 3483, 0, 3456, 3440, 3434, + 3437, 3441, 3433, 3429, 0, 3427, 3440, 0, 3414, 0, + 3413, 0, 0, 0, 3410, 0, 171, 167, 3421, 0, + 0, 3411, 0, 3408, 3409, 613, 3439, 636, 660, 3423, + 667, 476, 267, 691, 3414, 715, 3412, 3410, 723, 288, + 3409, 3407, 483, 764, 787, 3391, 0, 0, 3367, 327, + 3370, 3375, 0, 0, 0, 3371, 0, 3370, 3371, 3340, + 0, 3340, 0, 3334, 3334, 0, 590, 3328, 0, 0, + 3334, 3307, 3308, 0, 0, 3298, 0, 0, 0, 0, + + 3313, 3303, 3291, 0, 3284, 3287, 3303, 3276, 3271, 3268, + 3248, 0, 3246, 0, 3239, 0, 192, 0, 0, 3232, + 3227, 715, 3218, 0, 0, 0, 812, 836, 312, 877, + 3245, 3244, 381, 900, 924, 948, 3235, 955, 597, 3234, + 3231, 978, 752, 1002, 1025, 3230, 0, 3219, 400, 403, + 1049, 3197, 1073, 339, 3196, 3203, 3168, 0, 0, 0, + 0, 3162, 0, 3161, 3159, 3142, 3141, 0, 3156, 3140, + 1092, 0, 3126, 3115, 3133, 0, 3108, 0, 3111, 3102, + 0, 0, 3101, 3080, 237, 3079, 3097, 268, 3072, 0, + 3050, 3039, 3053, 3046, 3041, 3050, 3043, 3031, 3032, 3025, + + 3022, 3036, 1129, 3051, 1152, 1176, 3039, 1183, 859, 305, + 1207, 340, 1247, 1270, 1294, 3009, 3008, 1302, 364, 3007, + 3005, 3003, 3002, 1343, 373, 3001, 2976, 491, 607, 1384, + 2975, 1408, 404, 2974, 2981, 2971, 866, 0, 347, 2970, + 1096, 1449, 1472, 2969, 0, 0, 2926, 2942, 2923, 0, + 2931, 2914, 2920, 2933, 2918, 2919, 2918, 407, 2901, 411, + 2901, 2909, 2897, 2893, 0, 2883, 2893, 2881, 2886, 2853, + 2842, 2841, 0, 0, 2844, 0, 2838, 2830, 2843, 2827, + 2821, 2817, 2811, 2809, 2813, 2818, 2817, 1497, 1521, 405, + 1562, 2825, 2824, 609, 1586, 1610, 1617, 1641, 2815, 1648, + + 1672, 1695, 2814, 2813, 2811, 1718, 1103, 1742, 1765, 2810, + 0, 1230, 0, 461, 2809, 1237, 1789, 1812, 2794, 0, + 734, 761, 2801, 462, 781, 812, 1836, 2792, 1860, 428, + 2791, 2798, 381, 2761, 2766, 2763, 0, 0, 2753, 2755, + 2741, 2741, 2753, 2735, 2734, 2741, 2719, 2720, 2731, 2730, + 0, 2721, 2714, 0, 0, 0, 2727, 2723, 2713, 2700, + 0, 0, 0, 2704, 0, 0, 0, 2693, 1900, 2728, + 1923, 1947, 2725, 1954, 324, 1978, 2002, 2009, 2033, 2716, + 2715, 2041, 452, 2700, 2082, 488, 2699, 2698, 2697, 2696, + 2123, 489, 2694, 874, 894, 2164, 2693, 2188, 493, 2692, + + 2684, 1123, 1125, 2683, 2682, 1246, 1312, 2229, 2673, 2253, + 494, 2672, 2677, 1326, 0, 1333, 0, 527, 2668, 1366, + 2294, 2317, 2653, 0, 2340, 428, 79, 255, 237, 617, + 546, 586, 2624, 362, 522, 547, 379, 2623, 2622, 1124, + 2621, 2619, 1242, 849, 473, 2618, 2617, 2378, 2415, 2451, + 2487, 546, 2511, 588, 2519, 2543, 2629, 2550, 2574, 2597, + 2628, 2621, 2644, 2627, 2626, 2624, 2667, 1373, 2691, 2714, + 2622, 0, 1431, 0, 675, 2606, 1438, 2738, 2761, 2605, + 0, 1544, 0, 1551, 0, 676, 2604, 1883, 2785, 2808, + 2603, 0, 637, 1890, 2610, 1381, 1446, 2608, 2607, 1466, + + 1497, 2832, 2598, 2856, 638, 2582, 2589, 567, 682, 591, + 612, 763, 1246, 2051, 1383, 628, 803, 805, 2078, 683, + 829, 761, 828, 2076, 2080, 2898, 830, 2921, 892, 2944, + 2109, 2968, 2992, 2580, 2579, 3000, 737, 2577, 3041, 873, + 2576, 3082, 876, 2575, 2559, 2558, 2557, 3123, 897, 2556, + 1559, 1689, 3164, 2555, 3188, 901, 2553, 2560, 1899, 2051, + 2559, 2558, 2052, 2058, 3229, 2528, 3253, 924, 2527, 2534, + 925, 2146, 2533, 2118, 2119, 2532, 2530, 2120, 2140, 3294, + 2521, 3318, 926, 2520, 2527, 0, 2211, 0, 2218, 0, + 732, 2496, 2276, 3359, 3382, 2495, 0, 918, 970, 971, + + 972, 1899, 996, 1448, 1017, 1018, 2271, 1042, 1561, 1043, + 3407, 3430, 3454, 998, 3494, 3518, 3542, 2494, 3549, 3573, + 3596, 2493, 3620, 3643, 2492, 3667, 3690, 2490, 2489, 2488, + 3713, 2363, 3737, 3760, 2487, 0, 2401, 0, 1011, 2440, + 2438, 3784, 3807, 2439, 0, 2458, 0, 2465, 0, 1058, + 2438, 2472, 3831, 3854, 2424, 0, 0, 2479, 0, 2879, + 0, 1082, 2423, 2886, 3878, 3901, 2422, 0, 0, 1049, + 3023, 2429, 2161, 2226, 2378, 2351, 2290, 2291, 3925, 2342, + 3949, 1072, 2341, 2348, 2293, 2354, 2355, 2122, 1123, 2228, + 2356, 1066, 2357, 1198, 1121, 1145, 1199, 3991, 4015, 4024, + + 1200, 2326, 2325, 4042, 1102, 2324, 4083, 1105, 2320, 4124, + 1152, 2319, 4165, 1153, 2318, 2303, 2301, 4205, 4229, 1154, + 2300, 2409, 2410, 4270, 2281, 4294, 1182, 2278, 2285, 2591, + 2638, 2284, 2268, 2894, 2895, 4335, 2256, 4359, 1241, 2254, + 2244, 1243, 3030, 2243, 2898, 3038, 2242, 2239, 3051, 3057, + 4400, 2230, 4424, 1244, 2197, 2204, 0, 1247, 3105, 2203, + 3058, 3079, 2199, 2198, 3099, 3118, 4465, 2170, 4489, 1271, + 2169, 2174, 0, 3146, 0, 3211, 0, 1161, 2154, 3218, + 4530, 4553, 2149, 0, 3263, 3264, 3328, 1201, 2394, 2100, + 1402, 2395, 2270, 1464, 1488, 1342, 4578, 4602, 4611, 2130, + + 4628, 4652, 4675, 2100, 4699, 4722, 2070, 4746, 4769, 2068, + 4793, 4816, 2065, 2063, 4840, 1384, 2062, 2061, 3281, 4881, + 2059, 2049, 0, 3345, 0, 1530, 2046, 3477, 4905, 2018, + 2016, 0, 3484, 0, 3972, 0, 1571, 2015, 3979, 4929, + 2014, 2011, 0, 0, 4031, 0, 4065, 0, 1594, 1981, + 4072, 4953, 1980, 1906, 0, 0, 4106, 0, 4113, 0, + 1595, 1863, 4147, 4977, 1844, 1819, 0, 0, 1385, 4154, + 1822, 3120, 3140, 1806, 1802, 3159, 3161, 5001, 1771, 5025, + 1448, 1770, 1756, 1490, 1664, 1665, 1515, 1666, 1736, 4163, + 1687, 1711, 2396, 5067, 1747, 5084, 5108, 1556, 1725, 5149, + + 1561, 1724, 5190, 1586, 1723, 5231, 1616, 1719, 5272, 1617, + 1704, 1700, 4191, 5313, 1626, 1620, 0, 1619, 3226, 3264, + 5337, 1617, 1569, 1576, 3289, 3328, 1572, 1536, 3355, 3376, + 5361, 1521, 1505, 1512, 1618, 4252, 1508, 3407, 3493, 1483, + 1464, 3590, 3637, 5385, 1451, 1450, 1418, 0, 1619, 4259, + 1397, 3684, 4175, 1394, 1393, 4176, 4200, 5409, 1352, 1350, + 1356, 0, 1647, 4317, 1354, 4204, 4267, 1353, 1319, 4311, + 4330, 5433, 1310, 1309, 1315, 0, 4382, 0, 4389, 0, + 1751, 1305, 4447, 5457, 0, 1271, 0, 1735, 1758, 1759, + 1781, 1782, 1969, 4483, 4499, 5481, 1648, 0, 1254, 5522, + + 0, 1248, 5546, 0, 1216, 5570, 0, 1212, 5594, 0, + 1183, 5618, 0, 1109, 4332, 4397, 5642, 1107, 1103, 1076, + 1064, 1028, 4454, 0, 1821, 1007, 983, 4516, 0, 4618, + 0, 1845, 964, 960, 0, 4863, 0, 4870, 0, 1869, + 955, 925, 0, 5048, 0, 5055, 0, 1909, 924, 902, + 0, 5074, 0, 5131, 0, 1932, 885, 80, 0, 1671, + 5138, 180, 4462, 4526, 187, 225, 4547, 4627, 5666, 280, + 0, 301, 2358, 1783, 1806, 1829, 5690, 299, 340, 0, + 0, 0, 0, 0, 0, 5172, 0, 1962, 431, 496, + 0, 4669, 4716, 511, 532, 0, 1811, 5179, 559, 4763, + + 4810, 563, 605, 0, 0, 1833, 5213, 606, 4878, 5083, + 628, 630, 0, 0, 1835, 5220, 680, 5228, 5241, 702, + 704, 0, 0, 1836, 5255, 705, 5269, 5282, 707, 708, + 0, 0, 5296, 0, 5504, 0, 1963, 728, 0, 3078, + 2959, 2156, 1916, 0, 7396, 0, 0, 0, 0, 0, + 0, 5310, 5498, 739, 773, 0, 7396, 5512, 0, 7396, + 0, 5713, 0, 7396, 0, 5720, 0, 7396, 0, 5727, + 0, 7396, 0, 5734, 0, 7396, 0, 1894, 5741, 779, + 5749, 5750, 796, 2017, 0, 1970, 3336, 2057, 0, 5750, + 0, 1896, 5764, 798, 0, 1897, 5771, 800, 0, 1924, + + 5778, 803, 0, 1951, 5790, 844, 0, 1953, 5797, 851, + 0, 5804, 0, 7396, 2180, 1978, 5811, 853, 0, 0, + 0, 0, 0, 0, 1980, 5818, 886, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 7396, 5836, 5844, 5848, + 5851, 5854, 5857, 5860, 5863, 5866, 5869, 5872, 5875, 5878, + 5881, 5884, 5887, 5890, 5893, 5896, 5900, 5904, 5907, 5910, + 5913, 5916, 5919, 5922, 5925, 5928, 5932, 5936, 5939, 5942, + 5946, 5948, 5951, 5954, 5957, 5960, 5963, 5966, 5969, 5972, + 5976, 5978, 5981, 5985, 5990, 5994, 5997, 6001, 6004, 6007, + 6010, 6013, 6016, 6019, 6022, 6026, 6030, 6033, 6037, 6041, + + 6046, 6050, 6052, 6056, 6059, 6063, 6066, 6069, 6073, 6075, + 6078, 6081, 6084, 6087, 6090, 6093, 6096, 6099, 6102, 6106, + 6108, 6111, 6114, 6117, 6121, 6123, 6126, 6129, 6134, 6138, + 6143, 6147, 6149, 6153, 6156, 6160, 6165, 6169, 6172, 6175, + 6178, 6181, 6184, 6187, 6190, 6194, 6198, 6201, 6205, 6209, + 6214, 6218, 6220, 6224, 6227, 6231, 6234, 6239, 6243, 6248, + 6252, 6254, 6258, 6261, 6265, 6268, 6271, 6274, 6278, 6280, + 6283, 6288, 6292, 6295, 6298, 6301, 6304, 6307, 6310, 6313, + 6316, 6320, 6322, 6325, 6328, 6331, 6335, 6337, 6340, 6343, + 6346, 6349, 6353, 6355, 6358, 6361, 6364, 6369, 6373, 6378, + + 6382, 6384, 6388, 6391, 6395, 6400, 6404, 6407, 6410, 6413, + 6416, 6419, 6422, 6425, 6429, 6433, 6436, 6440, 6444, 6449, + 6453, 6455, 6459, 6462, 6466, 6469, 6474, 6478, 6483, 6487, + 6489, 6493, 6496, 6500, 6503, 6506, 6511, 6515, 6520, 6524, + 6526, 6530, 6533, 6537, 6540, 6543, 6546, 6550, 6552, 6555, + 6560, 6564, 6567, 6570, 6573, 6576, 6579, 6582, 6585, 6588, + 6591, 6594, 6597, 6601, 6603, 6606, 6609, 6612, 6615, 6619, + 6621, 6624, 6627, 6630, 6633, 6636, 6640, 6642, 6645, 6648, + 6651, 6654, 6657, 6661, 6663, 6666, 6669, 6672, 6675, 6680, + 6684, 6689, 6693, 6695, 6699, 6702, 6706, 6711, 6715, 6718, + + 6721, 6724, 6727, 6730, 6733, 6736, 6739, 6742, 6746, 6750, + 6753, 6757, 6761, 6766, 6770, 6772, 6776, 6779, 6783, 6786, + 6791, 6795, 6800, 6804, 6806, 6810, 6813, 6817, 6820, 6823, + 6828, 6832, 6837, 6841, 6843, 6847, 6850, 6854, 6857, 6860, + 6865, 6869, 6874, 6878, 6880, 6884, 6887, 6891, 6894, 6897, + 6900, 6904, 6906, 6909, 6912, 6917, 6921, 6924, 6927, 6930, + 6933, 6936, 6939, 6942, 6945, 6948, 6951, 6954, 6958, 6962, + 6965, 6968, 6972, 6975, 6978, 6982, 6984, 6987, 6990, 6994, + 6996, 6999, 7002, 7005, 7009, 7011, 7014, 7017, 7020, 7024, + 7026, 7029, 7032, 7035, 7039, 7041, 7044, 7047, 7052, 7056, + + 7061, 7065, 7067, 7071, 7074, 7078, 7083, 7087, 7090, 7093, + 7096, 7099, 7102, 7105, 7108, 7111, 7115, 7117, 7120, 7124, + 7129, 7133, 7134, 7137, 7142, 7146, 7151, 7155, 7156, 7159, + 7162, 7167, 7171, 7176, 7180, 7181, 7184, 7187, 7192, 7196, + 7201, 7205, 7206, 7209, 7212, 7217, 7221, 7226, 7230, 7231, + 7234, 7237, 7240, 7244, 7246, 7251, 7255, 7258, 7261, 7264, + 7267, 7270, 7273, 7277, 7282, 7286, 7287, 7290, 7293, 7296, + 7299, 7302, 7305, 7308, 7311, 7314, 7317, 7322, 7326, 7329, + 7332, 7335, 7339, 7343, 7347, 7351, 7355, 7358, 7361, 7365, + 7368, 7371, 7374, 7377, 7380, 7384, 7387 } ; -static yyconst flex_int16_t yy_def[1894] = +static yyconst flex_int16_t yy_def[1898] = { 0, - 1433, 1, 1433, 1433, 1433, 1433, 1433, 1433, 1434, 1433, - 1433, 1433, 1433, 1433, 14, 1433, 1433, 1433, 1433, 14, - 20, 1435, 20, 20, 20, 20, 20, 20, 21, 21, + 1437, 1, 1437, 1437, 1437, 1437, 1437, 1437, 1438, 1437, + 1437, 1437, 1437, 1437, 14, 1437, 1437, 1437, 1437, 14, + 20, 1439, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 1433, 1433, 1433, 1436, 1433, 21, 21, 20, - 1437, 50, 21, 21, 21, 1433, 1433, 1433, 1433, 1433, - 1433, 49, 1435, 1435, 52, 52, 52, 21, 21, 21, - 21, 52, 21, 21, 21, 21, 21, 52, 21, 21, - 21, 21, 21, 52, 21, 21, 21, 21, 21, 21, + 21, 21, 1437, 1437, 1437, 1440, 1437, 21, 21, 20, + 1441, 50, 21, 21, 21, 1437, 1437, 1437, 1437, 1437, + 1437, 49, 1439, 1439, 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, 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, 1433, 1433, 21, 21, 146, 21, 21, 149, - 1438, 1433, 54, 1433, 154, 1439, 21, 21, 150, 21, - 21, 21, 150, 21, 21, 21, 21, 21, 150, 21, - 21, 21, 21, 21, 21, 21, 150, 21, 21, 21, + 21, 21, 21, 21, 1437, 1437, 21, 21, 148, 21, + 21, 151, 1442, 1437, 54, 1437, 156, 1443, 21, 21, + 152, 21, 21, 21, 152, 21, 21, 21, 21, 21, + 21, 152, 21, 21, 21, 21, 21, 21, 21, 152, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, @@ -849,192 +842,192 @@ static yyconst flex_int16_t yy_def[1894] = 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, 245, 246, - 150, 1440, 251, 1441, 1442, 1433, 256, 1443, 1444, 1433, - 1433, 1433, 1445, 1446, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 248, 249, 152, 1444, 254, 1445, 1446, 1437, 259, + 1447, 1448, 1437, 1437, 1437, 1449, 1450, 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, 324, 21, 246, 248, 246, 248, - 248, 331, 1447, 1433, 330, 1448, 1449, 1433, 1433, 1433, - 1433, 1450, 1451, 1452, 1453, 1453, 1433, 1454, 1433, 349, - 1455, 1446, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 328, 21, + 249, 251, 249, 251, 251, 335, 1451, 1437, 334, 1452, + 1453, 1437, 1437, 1437, 1437, 1454, 1455, 1456, 1457, 1457, + 1437, 1458, 1437, 353, 1459, 1450, 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, 401, 402, 402, 407, 401, 331, - 410, 1456, 1457, 1433, 414, 1458, 1433, 1459, 1460, 1433, - 420, 1461, 1462, 1463, 1463, 1433, 1464, 1433, 428, 1465, - 1451, 1433, 1433, 1466, 1467, 1433, 1433, 1433, 1433, 1468, - 1469, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 405, 406, + 406, 411, 405, 335, 414, 1460, 1461, 1437, 418, 1462, + 1437, 1463, 1464, 1437, 424, 1465, 1466, 1467, 1467, 1437, + 1468, 1437, 432, 1469, 1455, 1437, 1437, 1470, 1471, 1437, + 1437, 1437, 1437, 1472, 1473, 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, 485, 21, 402, 404, 402, - 402, 491, 410, 493, 1470, 1433, 1433, 1433, 1471, 1472, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 489, + 21, 406, 408, 406, 406, 495, 414, 497, 1474, 1437, - 1473, 1433, 1433, 1433, 1433, 1474, 1475, 1433, 1476, 1477, - 1433, 1433, 1433, 1433, 1478, 1479, 1480, 1480, 1466, 1467, - 1481, 1481, 1433, 1482, 1433, 525, 1483, 1484, 21, 21, + 1437, 1437, 1475, 1476, 1477, 1437, 1437, 1437, 1437, 1478, + 1479, 1437, 1480, 1481, 1437, 1437, 1437, 1437, 1482, 1483, + 1484, 1484, 1470, 1471, 1485, 1485, 1437, 1486, 1437, 529, + 1487, 1488, 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, - 568, 568, 572, 493, 574, 1485, 1486, 1433, 578, 1487, - 1433, 581, 1488, 1433, 1489, 1490, 1433, 587, 1491, 1492, - 1492, 1433, 1493, 1433, 594, 1494, 1495, 1496, 1496, 1497, - - 1498, 1499, 1499, 1433, 1500, 1433, 606, 1501, 1502, 1433, - 1503, 1433, 1504, 1505, 1433, 1433, 1433, 1433, 1506, 1507, - 575, 621, 621, 621, 621, 621, 621, 621, 621, 621, - 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, - 621, 621, 621, 621, 621, 621, 646, 646, 646, 621, - 646, 651, 1508, 1433, 1433, 1433, 1509, 1433, 1433, 1510, - 1511, 1512, 1433, 1433, 1433, 1433, 1513, 1514, 1433, 1515, - 1516, 1433, 1433, 1433, 1433, 1517, 1518, 1433, 1519, 1433, - 1520, 1521, 1433, 1433, 1433, 1433, 1522, 1523, 1524, 1433, - 1525, 1526, 1526, 1527, 1528, 1529, 1529, 1433, 1530, 1433, - - 700, 1531, 1532, 1533, 1533, 1533, 1533, 1533, 1533, 1533, - 1533, 1533, 1533, 1533, 1533, 1533, 1533, 1533, 1533, 1533, - 1533, 1533, 1533, 722, 1533, 722, 726, 726, 728, 1534, - 1535, 1433, 732, 1536, 1433, 735, 1537, 1433, 738, 1538, - 1433, 1539, 1540, 1433, 744, 1541, 1542, 1542, 1433, 1543, - 1433, 751, 1544, 1545, 1546, 1546, 1547, 1548, 1549, 1549, - 1433, 1550, 1433, 763, 1551, 1552, 1553, 1433, 1554, 1555, - 1555, 1556, 1557, 1558, 1558, 1433, 1559, 1433, 778, 1560, - 1561, 1562, 1433, 1563, 1433, 1564, 1565, 1433, 1433, 1433, - 1433, 1566, 1567, 1568, 1568, 1568, 1568, 1568, 1568, 1568, - - 1568, 1568, 1568, 1568, 1568, 1568, 1568, 807, 807, 809, - 807, 807, 812, 1569, 1433, 1433, 1433, 1570, 1433, 1433, - 1571, 1433, 1433, 1572, 1573, 1574, 1433, 1433, 1433, 1433, - 1575, 1576, 1433, 1577, 1578, 1433, 1433, 1433, 1433, 1579, - 1580, 1433, 1581, 1433, 1582, 1583, 1433, 1433, 1433, 1433, - 1584, 1585, 1586, 1433, 1587, 1433, 1588, 1589, 1433, 1433, - 1433, 1433, 1590, 1591, 1592, 1593, 1433, 1594, 1595, 1595, - 1596, 1597, 1598, 1598, 1433, 1599, 1433, 877, 1600, 1601, - 1602, 1602, 1602, 1602, 1602, 1602, 1602, 1602, 1602, 1602, - 1602, 1602, 1602, 1602, 894, 1602, 1602, 1603, 1604, 1433, - - 900, 1605, 1433, 903, 1606, 1433, 906, 1607, 1433, 909, - 1608, 1433, 1609, 1433, 1433, 915, 1610, 1611, 1611, 1433, - 1612, 1433, 922, 1613, 1614, 1615, 1615, 1616, 1617, 1618, - 1618, 1433, 1619, 1433, 934, 1620, 1621, 1622, 1433, 1623, - 1624, 1624, 1625, 1626, 1627, 1627, 1433, 1628, 1433, 949, - 1629, 1630, 1631, 1632, 1433, 1633, 1634, 1634, 1635, 1636, - 1637, 1637, 1433, 1638, 1433, 965, 1639, 1640, 1641, 1433, - 1642, 1433, 1643, 1644, 1433, 1433, 1433, 1433, 1645, 1646, - 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, - 1647, 1647, 1647, 993, 1647, 1648, 1433, 1433, 1433, 1649, - - 1433, 1433, 1650, 1433, 1433, 1651, 1433, 1433, 1652, 1653, - 1433, 1011, 1654, 1655, 1433, 1433, 1656, 1657, 1658, 1433, - 1659, 1660, 1433, 1433, 1433, 1661, 1662, 1663, 1433, 1664, - 1433, 1665, 1666, 1433, 1433, 1433, 1667, 1668, 1669, 1670, - 1433, 1671, 1433, 1672, 1673, 1433, 1433, 1433, 1674, 1675, - 1676, 1677, 1433, 1678, 1433, 1679, 1680, 1433, 1433, 1433, - 1681, 1682, 1683, 1684, 1685, 1433, 1686, 1687, 1687, 1688, - 1689, 1690, 1690, 1433, 1691, 1433, 1076, 1692, 1693, 1694, - 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, - 1695, 1433, 1433, 1093, 1696, 1433, 1096, 1697, 1433, 1099, - - 1698, 1433, 1102, 1699, 1433, 1105, 1700, 1433, 1433, 1433, - 1701, 1702, 1703, 1704, 1705, 1705, 1433, 1706, 1707, 1708, - 1709, 1709, 1710, 1711, 1712, 1712, 1433, 1713, 1714, 1715, - 1716, 1433, 1717, 1718, 1718, 1719, 1720, 1721, 1721, 1433, - 1722, 1723, 1724, 1725, 1726, 1433, 1727, 1728, 1728, 1729, - 1730, 1731, 1731, 1433, 1732, 1733, 1734, 1735, 1736, 1433, - 1737, 1738, 1738, 1739, 1740, 1741, 1741, 1433, 1742, 1743, - 1744, 1745, 1433, 1746, 1433, 1747, 1748, 1433, 1433, 1433, - 1749, 1750, 1751, 1752, 1752, 1752, 1752, 1752, 1752, 1752, - 1752, 1433, 1192, 1753, 1754, 1433, 1755, 1756, 1433, 1757, - - 1758, 1433, 1759, 1760, 1433, 1761, 1762, 1433, 1763, 1764, - 1765, 1765, 1433, 1766, 1767, 1768, 1769, 1770, 1433, 1771, - 1772, 1433, 1773, 1433, 1774, 1433, 1775, 1776, 1433, 1777, - 1778, 1433, 1779, 1433, 1780, 1781, 1433, 1782, 1783, 1433, - 1784, 1433, 1785, 1786, 1433, 1787, 1788, 1433, 1789, 1433, - 1790, 1791, 1433, 1792, 1793, 1794, 1433, 1795, 1796, 1796, - 1797, 1798, 1799, 1799, 1433, 1800, 1801, 1802, 1803, 1803, - 1803, 1803, 1433, 1804, 1805, 1806, 1807, 1808, 1809, 1810, - 1811, 1433, 1812, 1813, 1433, 1814, 1815, 1816, 1816, 1817, - 1818, 1819, 1820, 1433, 1821, 1822, 1822, 1823, 1824, 1825, - - 1826, 1827, 1433, 1828, 1829, 1829, 1830, 1831, 1832, 1833, - 1834, 1433, 1835, 1836, 1836, 1837, 1838, 1839, 1840, 1841, - 1433, 1842, 1843, 1843, 1844, 1845, 1846, 1847, 1433, 1848, - 1433, 1849, 1850, 1433, 1851, 1852, 1852, 1852, 1852, 1853, - 1433, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1860, 1861, - 1862, 1863, 1433, 1433, 1864, 1433, 1865, 1433, 1866, 1433, - 1867, 1433, 1868, 1433, 1869, 1433, 1870, 1433, 1871, 1433, - 1872, 1433, 1847, 1873, 1433, 1848, 1874, 1874, 1849, 1850, - 1875, 1852, 1852, 1852, 1876, 1433, 1877, 1878, 1433, 1864, - 1865, 1879, 1433, 1866, 1867, 1880, 1433, 1868, 1869, 1881, - - 1433, 1870, 1871, 1882, 1433, 1872, 1883, 1433, 1884, 1433, - 1852, 1885, 1433, 1877, 1886, 1887, 1888, 1889, 1890, 1883, - 1891, 1433, 1884, 1892, 1886, 1887, 1888, 1889, 1890, 1893, - 1892, 1893, 0, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433 + 21, 21, 21, 21, 572, 572, 576, 497, 578, 1489, + 1490, 1437, 582, 1491, 1437, 585, 1492, 1437, 1493, 1494, + 1437, 591, 1495, 1496, 1496, 1437, 1497, 1437, 598, 1498, + + 1499, 1500, 1500, 1501, 1502, 1503, 1503, 1437, 1504, 1437, + 610, 1505, 1506, 1437, 1507, 1437, 1508, 1509, 1437, 1437, + 1437, 1437, 1510, 1511, 579, 625, 625, 625, 625, 625, + 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, + 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, + 650, 650, 650, 625, 650, 655, 1512, 1437, 1437, 1437, + 1513, 1437, 1437, 1514, 1515, 1516, 1437, 1437, 1437, 1437, + 1517, 1518, 1437, 1519, 1520, 1437, 1437, 1437, 1437, 1521, + 1522, 1437, 1523, 1437, 1524, 1525, 1437, 1437, 1437, 1437, + 1526, 1527, 1528, 1437, 1529, 1530, 1530, 1531, 1532, 1533, + + 1533, 1437, 1534, 1437, 704, 1535, 1536, 1537, 1537, 1537, + 1537, 1537, 1537, 1537, 1537, 1537, 1537, 1537, 1537, 1537, + 1537, 1537, 1537, 1537, 1537, 1537, 1537, 726, 1537, 726, + 730, 730, 732, 1538, 1539, 1437, 736, 1540, 1437, 739, + 1541, 1437, 742, 1542, 1437, 1543, 1544, 1437, 748, 1545, + 1546, 1546, 1437, 1547, 1437, 755, 1548, 1549, 1550, 1550, + 1551, 1552, 1553, 1553, 1437, 1554, 1437, 767, 1555, 1556, + 1557, 1437, 1558, 1559, 1559, 1560, 1561, 1562, 1562, 1437, + 1563, 1437, 782, 1564, 1565, 1566, 1437, 1567, 1437, 1568, + 1569, 1437, 1437, 1437, 1437, 1570, 1571, 1572, 1572, 1572, + + 1572, 1572, 1572, 1572, 1572, 1572, 1572, 1572, 1572, 1572, + 1572, 811, 811, 813, 811, 811, 816, 1573, 1437, 1437, + 1437, 1574, 1437, 1437, 1575, 1437, 1437, 1576, 1577, 1578, + 1437, 1437, 1437, 1437, 1579, 1580, 1437, 1581, 1582, 1437, + 1437, 1437, 1437, 1583, 1584, 1437, 1585, 1437, 1586, 1587, + 1437, 1437, 1437, 1437, 1588, 1589, 1590, 1437, 1591, 1437, + 1592, 1593, 1437, 1437, 1437, 1437, 1594, 1595, 1596, 1597, + 1437, 1598, 1599, 1599, 1600, 1601, 1602, 1602, 1437, 1603, + 1437, 881, 1604, 1605, 1606, 1606, 1606, 1606, 1606, 1606, + 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 898, 1606, + + 1606, 1607, 1608, 1437, 904, 1609, 1437, 907, 1610, 1437, + 910, 1611, 1437, 913, 1612, 1437, 1613, 1437, 1437, 919, + 1614, 1615, 1615, 1437, 1616, 1437, 926, 1617, 1618, 1619, + 1619, 1620, 1621, 1622, 1622, 1437, 1623, 1437, 938, 1624, + 1625, 1626, 1437, 1627, 1628, 1628, 1629, 1630, 1631, 1631, + 1437, 1632, 1437, 953, 1633, 1634, 1635, 1636, 1437, 1637, + 1638, 1638, 1639, 1640, 1641, 1641, 1437, 1642, 1437, 969, + 1643, 1644, 1645, 1437, 1646, 1437, 1647, 1648, 1437, 1437, + 1437, 1437, 1649, 1650, 1651, 1651, 1651, 1651, 1651, 1651, + 1651, 1651, 1651, 1651, 1651, 1651, 1651, 997, 1651, 1652, + + 1437, 1437, 1437, 1653, 1437, 1437, 1654, 1437, 1437, 1655, + 1437, 1437, 1656, 1657, 1437, 1015, 1658, 1659, 1437, 1437, + 1660, 1661, 1662, 1437, 1663, 1664, 1437, 1437, 1437, 1665, + 1666, 1667, 1437, 1668, 1437, 1669, 1670, 1437, 1437, 1437, + 1671, 1672, 1673, 1674, 1437, 1675, 1437, 1676, 1677, 1437, + 1437, 1437, 1678, 1679, 1680, 1681, 1437, 1682, 1437, 1683, + 1684, 1437, 1437, 1437, 1685, 1686, 1687, 1688, 1689, 1437, + 1690, 1691, 1691, 1692, 1693, 1694, 1694, 1437, 1695, 1437, + 1080, 1696, 1697, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + 1698, 1698, 1698, 1698, 1699, 1437, 1437, 1097, 1700, 1437, + + 1100, 1701, 1437, 1103, 1702, 1437, 1106, 1703, 1437, 1109, + 1704, 1437, 1437, 1437, 1705, 1706, 1707, 1708, 1709, 1709, + 1437, 1710, 1711, 1712, 1713, 1713, 1714, 1715, 1716, 1716, + 1437, 1717, 1718, 1719, 1720, 1437, 1721, 1722, 1722, 1723, + 1724, 1725, 1725, 1437, 1726, 1727, 1728, 1729, 1730, 1437, + 1731, 1732, 1732, 1733, 1734, 1735, 1735, 1437, 1736, 1737, + 1738, 1739, 1740, 1437, 1741, 1742, 1742, 1743, 1744, 1745, + 1745, 1437, 1746, 1747, 1748, 1749, 1437, 1750, 1437, 1751, + 1752, 1437, 1437, 1437, 1753, 1754, 1755, 1756, 1756, 1756, + 1756, 1756, 1756, 1756, 1756, 1437, 1196, 1757, 1758, 1437, + + 1759, 1760, 1437, 1761, 1762, 1437, 1763, 1764, 1437, 1765, + 1766, 1437, 1767, 1768, 1769, 1769, 1437, 1770, 1771, 1772, + 1773, 1774, 1437, 1775, 1776, 1437, 1777, 1437, 1778, 1437, + 1779, 1780, 1437, 1781, 1782, 1437, 1783, 1437, 1784, 1785, + 1437, 1786, 1787, 1437, 1788, 1437, 1789, 1790, 1437, 1791, + 1792, 1437, 1793, 1437, 1794, 1795, 1437, 1796, 1797, 1798, + 1437, 1799, 1800, 1800, 1801, 1802, 1803, 1803, 1437, 1804, + 1805, 1806, 1807, 1807, 1807, 1807, 1437, 1808, 1809, 1810, + 1811, 1812, 1813, 1814, 1815, 1437, 1816, 1817, 1437, 1818, + 1819, 1820, 1820, 1821, 1822, 1823, 1824, 1437, 1825, 1826, + + 1826, 1827, 1828, 1829, 1830, 1831, 1437, 1832, 1833, 1833, + 1834, 1835, 1836, 1837, 1838, 1437, 1839, 1840, 1840, 1841, + 1842, 1843, 1844, 1845, 1437, 1846, 1847, 1847, 1848, 1849, + 1850, 1851, 1437, 1852, 1437, 1853, 1854, 1437, 1855, 1856, + 1856, 1856, 1856, 1857, 1437, 1858, 1859, 1860, 1861, 1862, + 1863, 1864, 1864, 1865, 1866, 1867, 1437, 1437, 1868, 1437, + 1869, 1437, 1870, 1437, 1871, 1437, 1872, 1437, 1873, 1437, + 1874, 1437, 1875, 1437, 1876, 1437, 1851, 1877, 1437, 1852, + 1878, 1878, 1853, 1854, 1879, 1856, 1856, 1856, 1880, 1437, + 1881, 1882, 1437, 1868, 1869, 1883, 1437, 1870, 1871, 1884, + + 1437, 1872, 1873, 1885, 1437, 1874, 1875, 1886, 1437, 1876, + 1887, 1437, 1888, 1437, 1856, 1889, 1437, 1881, 1890, 1891, + 1892, 1893, 1894, 1887, 1895, 1437, 1888, 1896, 1890, 1891, + 1892, 1893, 1894, 1897, 1896, 1897, 0, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437 } ; -static yyconst flex_int16_t yy_nxt[7455] = +static yyconst flex_int16_t yy_nxt[7450] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 11, 13, 14, 15, 15, 15, 15, 15, 15, 16, 17, @@ -1042,823 +1035,822 @@ static yyconst flex_int16_t yy_nxt[7455] = 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, 110, 44, 57, 58, 44, 60, - 61, 44, 44, 111, 72, 82, 83, 1175, 44, 44, - 44, 53, 44, 134, 231, 44, 44, 44, 73, 65, - 44, 66, 67, 84, 232, 74, 68, 135, 85, 75, - - 44, 69, 76, 86, 136, 70, 77, 71, 44, 48, - 49, 50, 50, 50, 50, 50, 50, 50, 51, 87, - 184, 976, 52, 53, 54, 185, 173, 55, 52, 52, + 44, 44, 44, 44, 111, 44, 57, 58, 44, 60, + 61, 44, 44, 112, 72, 83, 84, 197, 44, 44, + 44, 53, 44, 198, 228, 44, 44, 44, 73, 65, + 44, 66, 67, 79, 85, 74, 68, 80, 426, 86, + + 44, 69, 229, 81, 87, 70, 82, 71, 44, 48, + 49, 50, 50, 50, 50, 50, 50, 50, 51, 710, + 88, 187, 52, 53, 54, 53, 188, 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, 174, 78, 44, 189, 44, 79, 175, - 44, 196, 194, 219, 80, 711, 197, 81, 195, 63, - 56, 316, 63, 317, 63, 53, 220, 63, 44, 62, - 52, 52, 52, 52, 52, 52, 52, 63, 104, 190, - 469, 117, 105, 53, 112, 63, 118, 119, 225, 120, - - 121, 106, 107, 138, 470, 108, 113, 109, 114, 200, - 115, 139, 201, 116, 202, 140, 226, 141, 1181, 53, - 55, 53, 53, 53, 53, 53, 53, 53, 53, 1433, - 97, 98, 191, 53, 1179, 53, 53, 329, 228, 53, - 53, 53, 53, 53, 53, 89, 99, 229, 90, 91, - 100, 92, 1433, 93, 101, 94, 102, 95, 122, 192, - 96, 53, 123, 103, 193, 706, 127, 1341, 388, 710, - 124, 53, 128, 389, 129, 125, 130, 126, 1433, 318, - 131, 44, 132, 133, 44, 298, 44, 53, 465, 44, - 148, 148, 148, 148, 148, 148, 148, 63, 299, 44, - - 63, 466, 63, 319, 713, 63, 53, 44, 145, 145, - 145, 145, 145, 145, 145, 63, 260, 1433, 53, 145, - 53, 490, 714, 63, 262, 145, 145, 145, 145, 145, - 145, 146, 147, 147, 147, 147, 147, 147, 1274, 53, - 1274, 1433, 148, 1433, 354, 355, 356, 357, 148, 148, - 148, 148, 148, 148, 49, 149, 149, 149, 149, 149, - 149, 149, 539, 422, 358, 53, 150, 1433, 53, 1433, - 1219, 540, 150, 150, 150, 150, 150, 150, 62, 150, - 150, 150, 150, 150, 150, 150, 153, 153, 153, 153, - 153, 153, 153, 1433, 53, 1433, 406, 153, 354, 355, - - 356, 357, 1433, 153, 153, 153, 153, 153, 153, 44, - 248, 707, 44, 1015, 44, 433, 53, 44, 433, 1433, - 154, 155, 155, 155, 155, 155, 155, 44, 1433, 434, - 1224, 156, 1433, 53, 1226, 44, 248, 156, 156, 156, - 156, 156, 156, 243, 542, 244, 244, 244, 244, 244, - 244, 244, 339, 543, 1024, 434, 244, 1433, 1433, 53, - 498, 715, 244, 244, 244, 244, 244, 244, 245, 246, - 246, 246, 246, 246, 246, 246, 260, 53, 648, 53, - 247, 1433, 248, 1433, 1433, 1232, 247, 247, 247, 247, - 247, 247, 326, 326, 326, 326, 326, 326, 326, 345, - - 346, 346, 346, 346, 346, 346, 508, 1433, 248, 249, - 247, 247, 247, 247, 247, 247, 247, 1433, 1433, 1234, - 509, 247, 1433, 1433, 705, 53, 1035, 247, 247, 247, - 247, 247, 247, 250, 251, 251, 251, 251, 251, 251, - 251, 252, 437, 1433, 1433, 253, 509, 570, 1433, 1433, - 439, 253, 253, 253, 253, 253, 253, 53, 253, 253, - 253, 253, 253, 253, 253, 256, 257, 257, 257, 257, - 257, 257, 258, 570, 708, 782, 259, 53, 53, 721, - 55, 55, 259, 259, 259, 259, 259, 259, 260, 261, - 261, 261, 261, 261, 261, 261, 262, 503, 55, 55, - - 263, 782, 264, 727, 367, 656, 263, 263, 263, 263, - 263, 263, 368, 409, 409, 409, 409, 409, 409, 409, - 1240, 1242, 508, 716, 571, 369, 55, 55, 264, 323, - 323, 323, 323, 323, 323, 323, 1433, 53, 404, 53, - 323, 370, 55, 1047, 55, 55, 323, 323, 323, 323, - 323, 323, 324, 325, 325, 325, 325, 325, 325, 709, - 55, 795, 1433, 326, 404, 1433, 1433, 794, 53, 326, - 326, 326, 326, 326, 326, 245, 327, 327, 327, 327, - 327, 327, 327, 328, 328, 328, 328, 328, 328, 328, - 512, 1433, 1433, 1248, 328, 1433, 55, 55, 659, 55, - - 328, 328, 328, 328, 328, 328, 330, 331, 331, 331, - 331, 331, 331, 331, 55, 55, 804, 55, 332, 800, - 801, 1433, 1250, 1059, 332, 332, 332, 332, 332, 332, - 335, 332, 332, 332, 332, 332, 332, 332, 339, 340, - 340, 340, 340, 340, 340, 340, 341, 616, 392, 610, - 342, 1181, 343, 393, 1282, 618, 342, 342, 342, 342, - 342, 342, 394, 611, 395, 396, 1433, 397, 424, 425, - 425, 425, 425, 425, 425, 55, 610, 55, 343, 260, - 347, 347, 347, 347, 347, 347, 347, 262, 1109, 611, - 1433, 348, 1433, 55, 1329, 55, 612, 348, 348, 348, - - 348, 348, 348, 349, 350, 350, 350, 350, 350, 350, - 613, 1331, 796, 1354, 351, 1358, 1433, 55, 1362, 55, - 351, 351, 351, 351, 351, 351, 399, 612, 400, 400, - 400, 400, 400, 400, 400, 55, 613, 55, 802, 400, - 805, 1433, 722, 55, 724, 400, 400, 400, 400, 400, - 400, 401, 402, 402, 402, 402, 402, 402, 402, 1366, - 55, 55, 1370, 403, 1386, 404, 1408, 1433, 1173, 403, - 403, 403, 403, 403, 403, 487, 487, 487, 487, 487, - 487, 487, 517, 518, 518, 518, 518, 518, 518, 669, - 720, 404, 405, 403, 403, 403, 403, 403, 403, 403, - - 53, 422, 1433, 670, 403, 1433, 1433, 55, 1209, 669, - 403, 403, 403, 403, 403, 403, 407, 408, 408, 408, - 408, 408, 408, 1433, 853, 55, 1433, 409, 1433, 670, - 55, 1433, 1433, 409, 409, 409, 409, 409, 409, 250, - 410, 410, 410, 410, 410, 410, 410, 664, 55, 1433, - 853, 411, 1433, 881, 53, 817, 422, 411, 411, 411, - 411, 411, 411, 53, 411, 411, 411, 411, 411, 411, - 411, 414, 415, 415, 415, 415, 415, 415, 1206, 673, - 53, 422, 416, 1203, 55, 55, 55, 820, 416, 416, - 416, 416, 416, 416, 420, 421, 421, 421, 421, 421, - - 421, 422, 55, 55, 55, 423, 422, 882, 883, 885, - 55, 423, 423, 423, 423, 423, 423, 339, 426, 426, - 426, 426, 426, 426, 426, 341, 684, 1200, 55, 427, - 969, 55, 55, 887, 823, 427, 427, 427, 427, 427, - 427, 428, 429, 429, 429, 429, 429, 429, 422, 55, - 55, 1433, 430, 890, 888, 55, 969, 55, 430, 430, - 430, 430, 430, 430, 260, 435, 435, 435, 435, 435, - 435, 435, 262, 55, 422, 55, 436, 1433, 986, 55, - 55, 55, 436, 436, 436, 436, 436, 436, 437, 438, - 438, 438, 438, 438, 438, 438, 439, 55, 55, 55, - - 440, 1433, 441, 990, 1433, 992, 440, 440, 440, 440, - 440, 440, 521, 522, 522, 522, 522, 522, 522, 590, - 591, 591, 591, 591, 591, 591, 1197, 1433, 441, 450, - 1433, 1433, 422, 451, 1433, 55, 452, 55, 678, 453, - 678, 454, 455, 456, 457, 484, 484, 484, 484, 484, - 484, 484, 679, 55, 1433, 55, 484, 1433, 55, 55, - 1433, 717, 484, 484, 484, 484, 484, 484, 485, 486, - 486, 486, 486, 486, 486, 53, 55, 55, 679, 487, - 1433, 1433, 1433, 1433, 1109, 487, 487, 487, 487, 487, - 487, 401, 488, 488, 488, 488, 488, 488, 488, 489, - - 489, 489, 489, 489, 489, 489, 1040, 1433, 1433, 1433, - 489, 1433, 1052, 1433, 422, 55, 489, 489, 489, 489, - 489, 489, 406, 491, 491, 491, 491, 491, 491, 491, - 422, 1274, 1040, 55, 492, 1209, 248, 1433, 1052, 1433, - 492, 492, 492, 492, 492, 492, 598, 599, 599, 599, - 599, 599, 599, 602, 603, 603, 603, 603, 603, 603, - 55, 680, 248, 492, 492, 492, 492, 492, 492, 492, - 1433, 1206, 1172, 1433, 492, 681, 1203, 1200, 55, 719, - 492, 492, 492, 492, 492, 492, 493, 493, 493, 493, - 493, 493, 493, 53, 789, 797, 1433, 494, 1172, 1433, - - 1197, 681, 791, 494, 494, 494, 494, 494, 494, 53, - 494, 494, 494, 494, 494, 494, 494, 339, 497, 497, - 497, 497, 497, 497, 497, 498, 828, 680, 1274, 499, - 1181, 343, 978, 1059, 999, 499, 499, 499, 499, 499, - 499, 1433, 689, 690, 690, 690, 690, 690, 690, 692, - 693, 693, 693, 693, 693, 693, 55, 343, 503, 504, - 504, 504, 504, 504, 504, 504, 505, 1433, 422, 1209, - 506, 860, 507, 1055, 55, 1053, 506, 506, 506, 506, - 506, 506, 696, 697, 697, 697, 697, 697, 697, 747, - 748, 748, 748, 748, 748, 748, 783, 55, 507, 339, - - 510, 510, 510, 510, 510, 510, 510, 498, 1047, 422, - 784, 511, 1206, 1433, 1433, 55, 55, 511, 511, 511, - 511, 511, 511, 512, 513, 513, 513, 513, 513, 513, - 513, 514, 799, 848, 55, 515, 784, 516, 1085, 1433, - 1433, 515, 515, 515, 515, 515, 515, 755, 756, 756, - 756, 756, 756, 756, 759, 760, 760, 760, 760, 760, - 760, 783, 55, 516, 437, 523, 523, 523, 523, 523, - 523, 523, 439, 1043, 1041, 1433, 524, 1433, 55, 1035, - 55, 785, 524, 524, 524, 524, 524, 524, 525, 526, - 526, 526, 526, 526, 526, 786, 55, 886, 422, 527, - - 1088, 1433, 55, 1433, 55, 527, 527, 527, 527, 527, - 527, 565, 785, 566, 566, 566, 566, 566, 566, 566, - 55, 786, 55, 1203, 566, 1089, 1433, 837, 1031, 55, - 566, 566, 566, 566, 566, 566, 567, 568, 568, 568, - 568, 568, 568, 568, 1029, 837, 1184, 55, 569, 1187, - 570, 1024, 1433, 1002, 569, 569, 569, 569, 569, 569, - 767, 768, 768, 768, 768, 768, 768, 770, 771, 771, - 771, 771, 771, 771, 833, 55, 570, 567, 569, 569, - 569, 569, 569, 569, 569, 1433, 848, 422, 834, 569, - 1433, 1200, 55, 55, 1005, 569, 569, 569, 569, 569, - - 569, 406, 572, 572, 572, 572, 572, 572, 572, 860, - 55, 1433, 891, 573, 834, 1190, 1433, 1008, 828, 573, - 573, 573, 573, 573, 573, 53, 573, 573, 573, 573, - 573, 573, 573, 574, 574, 574, 574, 574, 574, 574, - 976, 1015, 1020, 1015, 575, 1231, 1239, 1247, 978, 1197, - 575, 575, 575, 575, 575, 575, 53, 575, 575, 575, - 575, 575, 575, 575, 578, 579, 579, 579, 579, 579, - 579, 1231, 1239, 1247, 1433, 580, 1328, 1357, 55, 55, - 55, 580, 580, 580, 580, 580, 580, 339, 426, 426, - 426, 426, 426, 426, 426, 498, 55, 55, 55, 427, - - 1433, 1361, 1328, 1357, 833, 427, 427, 427, 427, 427, - 427, 581, 582, 582, 582, 582, 582, 582, 1433, 1188, - 1185, 1186, 583, 422, 55, 55, 1197, 1361, 583, 583, - 583, 583, 583, 583, 587, 588, 588, 588, 588, 588, - 588, 422, 55, 55, 1433, 589, 422, 1111, 55, 55, - 55, 589, 589, 589, 589, 589, 589, 503, 592, 592, - 592, 592, 592, 592, 592, 505, 55, 55, 55, 593, - 1216, 55, 55, 55, 1092, 593, 593, 593, 593, 593, - 593, 594, 595, 595, 595, 595, 595, 595, 422, 55, - 55, 55, 596, 1337, 1269, 1209, 55, 1206, 596, 596, - - 596, 596, 596, 596, 512, 604, 604, 604, 604, 604, - 604, 604, 514, 1024, 55, 1339, 605, 1338, 1203, 55, - 1200, 1200, 605, 605, 605, 605, 605, 605, 606, 607, - 607, 607, 607, 607, 607, 422, 1035, 55, 1365, 608, - 1369, 1407, 1197, 55, 1203, 608, 608, 608, 608, 608, - 608, 437, 614, 614, 614, 614, 614, 614, 614, 439, - 1047, 55, 1415, 615, 1365, 1416, 1369, 1407, 1206, 615, - 615, 615, 615, 615, 615, 616, 617, 617, 617, 617, - 617, 617, 617, 618, 1059, 1092, 976, 619, 1415, 620, - 1181, 1416, 1209, 619, 619, 619, 619, 619, 619, 774, - - 775, 775, 775, 775, 775, 775, 690, 690, 690, 690, - 690, 690, 690, 55, 842, 620, 644, 644, 644, 644, - 644, 644, 644, 1417, 1109, 1418, 1419, 644, 843, 978, - 55, 55, 1274, 644, 644, 644, 644, 644, 644, 645, - 645, 645, 645, 645, 645, 645, 884, 1179, 55, 1417, - 645, 1418, 1419, 1424, 843, 1181, 645, 645, 645, 645, - 645, 645, 567, 646, 646, 646, 646, 646, 646, 646, - 647, 647, 647, 647, 647, 647, 647, 1179, 1430, 1424, - 789, 647, 972, 55, 55, 1433, 970, 647, 647, 647, - 647, 647, 647, 406, 649, 649, 649, 649, 649, 649, - - 649, 55, 55, 1061, 1430, 650, 422, 1008, 1049, 422, - 1270, 650, 650, 650, 650, 650, 650, 53, 650, 650, + 54, 53, 44, 118, 75, 44, 234, 44, 119, 120, + 44, 121, 122, 199, 76, 192, 235, 77, 200, 63, + 56, 78, 63, 135, 63, 136, 322, 63, 44, 62, + 52, 52, 52, 52, 52, 52, 52, 63, 105, 137, + 1177, 222, 106, 53, 113, 63, 138, 1179, 193, 123, + + 323, 107, 108, 124, 223, 109, 114, 110, 115, 203, + 116, 125, 204, 117, 205, 320, 126, 321, 127, 53, + 55, 53, 53, 53, 53, 53, 53, 53, 53, 1437, + 98, 99, 392, 53, 302, 980, 53, 393, 194, 53, + 53, 53, 53, 53, 53, 90, 100, 303, 91, 92, + 101, 93, 231, 94, 102, 95, 103, 96, 128, 140, + 97, 232, 53, 104, 129, 195, 130, 141, 131, 469, + 196, 142, 132, 143, 133, 134, 44, 53, 333, 44, + 712, 44, 470, 53, 44, 150, 150, 150, 150, 150, + 150, 150, 63, 1437, 44, 63, 711, 63, 1185, 473, + + 63, 53, 44, 147, 147, 147, 147, 147, 147, 147, + 63, 1183, 1437, 474, 147, 53, 494, 1345, 63, 1437, + 147, 147, 147, 147, 147, 147, 148, 149, 149, 149, + 149, 149, 149, 176, 53, 652, 53, 150, 1437, 358, + 359, 360, 361, 150, 150, 150, 150, 150, 150, 49, + 151, 151, 151, 151, 151, 151, 151, 263, 1278, 362, + 177, 152, 53, 1437, 53, 265, 178, 152, 152, 152, + 152, 152, 152, 62, 152, 152, 152, 152, 152, 152, + 152, 155, 155, 155, 155, 155, 155, 155, 1437, 1437, + 53, 410, 155, 358, 359, 360, 361, 1437, 155, 155, + + 155, 155, 155, 155, 44, 251, 717, 44, 53, 44, + 437, 720, 44, 437, 1437, 156, 157, 157, 157, 157, + 157, 157, 44, 1437, 438, 53, 158, 1437, 1437, 53, + 44, 251, 158, 158, 158, 158, 158, 158, 246, 543, + 247, 247, 247, 247, 247, 247, 247, 546, 544, 1278, + 438, 247, 1437, 1437, 1437, 53, 547, 247, 247, 247, + 247, 247, 247, 248, 249, 249, 249, 249, 249, 249, + 249, 343, 263, 709, 53, 250, 1437, 251, 1437, 502, + 1437, 250, 250, 250, 250, 250, 250, 330, 330, 330, + 330, 330, 330, 330, 349, 350, 350, 350, 350, 350, + + 350, 512, 1437, 251, 252, 250, 250, 250, 250, 250, + 250, 250, 1437, 1437, 426, 513, 250, 1437, 1437, 53, + 725, 1223, 250, 250, 250, 250, 250, 250, 253, 254, + 254, 254, 254, 254, 254, 254, 255, 441, 1437, 1437, + 256, 513, 1019, 1437, 1437, 443, 256, 256, 256, 256, + 256, 256, 53, 256, 256, 256, 256, 256, 256, 256, + 259, 260, 260, 260, 260, 260, 260, 261, 53, 1228, + 574, 262, 718, 1230, 714, 719, 55, 262, 262, 262, + 262, 262, 262, 263, 264, 264, 264, 264, 264, 264, + 264, 265, 53, 53, 55, 266, 574, 267, 731, 371, + + 55, 266, 266, 266, 266, 266, 266, 372, 413, 413, + 413, 413, 413, 413, 413, 1028, 1236, 512, 55, 575, + 373, 55, 715, 267, 327, 327, 327, 327, 327, 327, + 327, 1437, 53, 408, 53, 327, 374, 55, 1238, 55, + 1039, 327, 327, 327, 327, 327, 327, 328, 329, 329, + 329, 329, 329, 329, 713, 55, 799, 1437, 330, 408, + 804, 786, 1437, 53, 330, 330, 330, 330, 330, 330, + 248, 331, 331, 331, 331, 331, 331, 331, 332, 332, + 332, 332, 332, 332, 332, 507, 516, 786, 1437, 332, + 1244, 55, 55, 660, 663, 332, 332, 332, 332, 332, + + 332, 334, 335, 335, 335, 335, 335, 335, 335, 55, + 55, 808, 1246, 336, 1051, 1252, 798, 1254, 1063, 336, + 336, 336, 336, 336, 336, 339, 336, 336, 336, 336, + 336, 336, 336, 343, 344, 344, 344, 344, 344, 344, + 344, 345, 620, 396, 614, 346, 1185, 347, 397, 1286, + 622, 346, 346, 346, 346, 346, 346, 398, 615, 399, + 400, 1437, 401, 428, 429, 429, 429, 429, 429, 429, + 55, 614, 55, 347, 263, 351, 351, 351, 351, 351, + 351, 351, 265, 1113, 615, 1437, 352, 1437, 55, 1333, + 55, 616, 352, 352, 352, 352, 352, 352, 353, 354, + + 354, 354, 354, 354, 354, 617, 1335, 800, 1358, 355, + 1362, 1437, 55, 1366, 55, 355, 355, 355, 355, 355, + 355, 403, 616, 404, 404, 404, 404, 404, 404, 404, + 55, 617, 55, 805, 404, 806, 1437, 55, 55, 726, + 404, 404, 404, 404, 404, 404, 405, 406, 406, 406, + 406, 406, 406, 406, 1370, 55, 55, 55, 407, 809, + 408, 1374, 1437, 1390, 407, 407, 407, 407, 407, 407, + 491, 491, 491, 491, 491, 491, 491, 521, 522, 522, + 522, 522, 522, 522, 673, 724, 408, 409, 407, 407, + 407, 407, 407, 407, 407, 53, 1412, 1437, 674, 407, + + 1437, 55, 728, 1213, 673, 407, 407, 407, 407, 407, + 407, 411, 412, 412, 412, 412, 412, 412, 1437, 55, + 426, 1437, 413, 1437, 674, 1437, 1437, 55, 413, 413, + 413, 413, 413, 413, 253, 414, 414, 414, 414, 414, + 414, 414, 1210, 426, 1437, 55, 415, 1437, 1437, 857, + 1437, 1437, 415, 415, 415, 415, 415, 415, 53, 415, + 415, 415, 415, 415, 415, 415, 418, 419, 419, 419, + 419, 419, 419, 1207, 1437, 857, 1437, 420, 426, 55, + 55, 55, 1204, 420, 420, 420, 420, 420, 420, 424, + 425, 425, 425, 425, 425, 425, 426, 55, 55, 55, + + 427, 426, 885, 886, 887, 55, 427, 427, 427, 427, + 427, 427, 343, 430, 430, 430, 430, 430, 430, 430, + 345, 668, 53, 55, 431, 1201, 55, 55, 889, 821, + 431, 431, 431, 431, 431, 431, 432, 433, 433, 433, + 433, 433, 433, 426, 55, 55, 426, 434, 53, 891, + 892, 55, 55, 434, 434, 434, 434, 434, 434, 263, + 439, 439, 439, 439, 439, 439, 439, 265, 677, 55, + 55, 440, 894, 973, 1113, 55, 824, 440, 440, 440, + 440, 440, 440, 441, 442, 442, 442, 442, 442, 442, + 442, 443, 688, 55, 426, 444, 1437, 445, 994, 973, + + 827, 444, 444, 444, 444, 444, 444, 525, 526, 526, + 526, 526, 526, 526, 594, 595, 595, 595, 595, 595, + 595, 426, 1437, 445, 454, 1278, 1437, 1213, 455, 1437, + 55, 456, 55, 682, 457, 682, 458, 459, 460, 461, + 488, 488, 488, 488, 488, 488, 488, 683, 55, 1437, + 55, 488, 1437, 990, 55, 1437, 721, 488, 488, 488, + 488, 488, 488, 489, 490, 490, 490, 490, 490, 490, + 53, 793, 55, 683, 491, 1437, 1437, 1437, 1437, 795, + 491, 491, 491, 491, 491, 491, 405, 492, 492, 492, + 492, 492, 492, 492, 493, 493, 493, 493, 493, 493, + + 493, 1210, 1437, 1437, 1437, 493, 1437, 55, 55, 55, + 55, 493, 493, 493, 493, 493, 493, 410, 495, 495, + 495, 495, 495, 495, 495, 55, 55, 55, 55, 496, + 1207, 251, 1437, 996, 1204, 496, 496, 496, 496, 496, + 496, 602, 603, 603, 603, 603, 603, 603, 606, 607, + 607, 607, 607, 607, 607, 55, 684, 251, 496, 496, + 496, 496, 496, 496, 496, 1437, 1201, 1044, 1437, 496, + 685, 1056, 1278, 55, 723, 496, 496, 496, 496, 496, + 496, 497, 497, 497, 497, 497, 497, 497, 53, 1185, + 801, 1437, 498, 1044, 1437, 1437, 685, 1056, 498, 498, + + 498, 498, 498, 498, 53, 498, 498, 498, 498, 498, + 498, 498, 343, 501, 501, 501, 501, 501, 501, 501, + 502, 1437, 684, 982, 503, 1063, 347, 426, 1213, 864, + 503, 503, 503, 503, 503, 503, 1437, 693, 694, 694, + 694, 694, 694, 694, 696, 697, 697, 697, 697, 697, + 697, 55, 347, 507, 508, 508, 508, 508, 508, 508, + 508, 509, 1437, 1059, 1057, 510, 1051, 511, 426, 55, + 1210, 510, 510, 510, 510, 510, 510, 700, 701, 701, + 701, 701, 701, 701, 751, 752, 752, 752, 752, 752, + 752, 787, 55, 511, 343, 514, 514, 514, 514, 514, + + 514, 514, 502, 852, 1047, 788, 515, 1045, 1437, 1176, + 55, 55, 515, 515, 515, 515, 515, 515, 516, 517, + 517, 517, 517, 517, 517, 517, 518, 803, 1039, 55, + 519, 788, 520, 1089, 1437, 1176, 519, 519, 519, 519, + 519, 519, 759, 760, 760, 760, 760, 760, 760, 763, + 764, 764, 764, 764, 764, 764, 787, 55, 520, 441, + 527, 527, 527, 527, 527, 527, 527, 443, 426, 1207, + 1437, 528, 1437, 55, 841, 55, 789, 528, 528, 528, + 528, 528, 528, 529, 530, 530, 530, 530, 530, 530, + 790, 55, 890, 1035, 531, 1092, 1437, 55, 1437, 55, + + 531, 531, 531, 531, 531, 531, 569, 789, 570, 570, + 570, 570, 570, 570, 570, 55, 790, 55, 1033, 570, + 1093, 1437, 1028, 426, 55, 570, 570, 570, 570, 570, + 570, 571, 572, 572, 572, 572, 572, 572, 572, 1204, + 832, 1188, 55, 573, 1191, 574, 832, 1437, 1003, 573, + 573, 573, 573, 573, 573, 771, 772, 772, 772, 772, + 772, 772, 774, 775, 775, 775, 775, 775, 775, 837, + 55, 574, 571, 573, 573, 573, 573, 573, 573, 573, + 1437, 841, 1024, 838, 573, 1437, 1019, 426, 55, 1006, + 573, 573, 573, 573, 573, 573, 410, 576, 576, 576, + + 576, 576, 576, 576, 852, 864, 1437, 895, 577, 838, + 1437, 1437, 1009, 1012, 577, 577, 577, 577, 577, 577, + 53, 577, 577, 577, 577, 577, 577, 577, 578, 578, + 578, 578, 578, 578, 578, 1201, 1437, 426, 1115, 579, + 1437, 1437, 1235, 1243, 1220, 579, 579, 579, 579, 579, + 579, 53, 579, 579, 579, 579, 579, 579, 579, 582, + 583, 583, 583, 583, 583, 583, 1437, 1437, 1235, 1243, + 584, 1251, 1437, 55, 55, 55, 584, 584, 584, 584, + 584, 584, 343, 430, 430, 430, 430, 430, 430, 430, + 502, 55, 55, 55, 431, 1332, 55, 1251, 1437, 837, + + 431, 431, 431, 431, 431, 431, 585, 586, 586, 586, + 586, 586, 586, 1437, 55, 1189, 1190, 587, 1096, 1194, + 55, 1332, 1213, 587, 587, 587, 587, 587, 587, 591, + 592, 592, 592, 592, 592, 592, 426, 1210, 55, 1437, + 593, 1207, 1204, 1201, 55, 55, 593, 593, 593, 593, + 593, 593, 507, 596, 596, 596, 596, 596, 596, 596, + 509, 980, 55, 55, 597, 1096, 980, 55, 55, 982, + 597, 597, 597, 597, 597, 597, 598, 599, 599, 599, + 599, 599, 599, 426, 1192, 55, 55, 600, 1185, 982, + 55, 55, 55, 600, 600, 600, 600, 600, 600, 516, + + 608, 608, 608, 608, 608, 608, 608, 518, 55, 55, + 55, 609, 793, 1341, 1273, 55, 976, 609, 609, 609, + 609, 609, 609, 610, 611, 611, 611, 611, 611, 611, + 426, 1019, 974, 55, 612, 1361, 1342, 1065, 55, 1201, + 612, 612, 612, 612, 612, 612, 441, 618, 618, 618, + 618, 618, 618, 618, 443, 1028, 55, 1365, 619, 1369, + 1373, 1361, 426, 1204, 619, 619, 619, 619, 619, 619, + 620, 621, 621, 621, 621, 621, 621, 621, 622, 1039, + 1343, 1012, 623, 1365, 624, 1369, 1373, 1207, 623, 623, + 623, 623, 623, 623, 778, 779, 779, 779, 779, 779, + + 779, 694, 694, 694, 694, 694, 694, 694, 55, 846, + 624, 648, 648, 648, 648, 648, 648, 648, 1411, 1051, + 1419, 1420, 648, 847, 1053, 55, 55, 1210, 648, 648, + 648, 648, 648, 648, 649, 649, 649, 649, 649, 649, + 649, 888, 1063, 55, 1411, 649, 1419, 1420, 1421, 847, + 1213, 649, 649, 649, 649, 649, 649, 571, 650, 650, 650, 650, 650, 650, 650, 651, 651, 651, 651, 651, - 651, 651, 1005, 1037, 422, 1002, 652, 1026, 422, 999, - 1017, 422, 652, 652, 652, 652, 652, 652, 53, 652, - 652, 652, 652, 652, 652, 652, 503, 655, 655, 655, - 655, 655, 655, 655, 656, 55, 842, 844, 657, 1111, - 507, 422, 1092, 844, 657, 657, 657, 657, 657, 657, - 1433, 845, 1008, 55, 1005, 1002, 999, 1433, 1092, 978, - 55, 791, 55, 860, 55, 798, 507, 512, 658, 658, - - 658, 658, 658, 658, 658, 659, 1433, 845, 55, 660, - 55, 516, 55, 1433, 55, 660, 660, 660, 660, 660, - 660, 806, 803, 1061, 315, 811, 811, 811, 811, 811, - 811, 811, 55, 854, 854, 856, 55, 516, 664, 665, - 665, 665, 665, 665, 665, 665, 666, 855, 1433, 857, - 667, 1084, 668, 1008, 55, 856, 667, 667, 667, 667, - 667, 667, 768, 768, 768, 768, 768, 768, 768, 1433, - 55, 985, 684, 855, 1433, 857, 970, 856, 668, 503, - 671, 671, 671, 671, 671, 671, 671, 656, 55, 854, - 971, 672, 848, 1049, 1005, 1433, 1384, 672, 672, 672, - - 672, 672, 672, 673, 674, 674, 674, 674, 674, 674, - 674, 675, 673, 844, 842, 676, 971, 677, 837, 1037, - 1002, 676, 676, 676, 676, 676, 676, 866, 867, 867, - 867, 867, 867, 867, 869, 870, 870, 870, 870, 870, - 870, 970, 55, 677, 512, 682, 682, 682, 682, 682, - 682, 682, 659, 664, 833, 1433, 683, 828, 1026, 999, - 55, 987, 683, 683, 683, 683, 683, 683, 684, 685, - 685, 685, 685, 685, 685, 685, 686, 1017, 988, 914, - 687, 1433, 688, 899, 55, 55, 687, 687, 687, 687, - 687, 687, 873, 874, 874, 874, 874, 874, 874, 1008, - - 1005, 1002, 55, 55, 999, 972, 972, 55, 688, 616, - 698, 698, 698, 698, 698, 698, 698, 618, 889, 973, - 1433, 699, 1087, 997, 899, 55, 789, 699, 699, 699, - 699, 699, 699, 700, 701, 701, 701, 701, 701, 701, - 981, 978, 791, 616, 702, 973, 1433, 785, 783, 862, - 702, 702, 702, 702, 702, 702, 53, 53, 53, 53, - 53, 53, 53, 823, 850, 820, 839, 53, 55, 55, - 55, 55, 55, 53, 53, 53, 53, 53, 53, 918, - 919, 919, 919, 919, 919, 919, 55, 55, 55, 55, - 55, 704, 722, 817, 723, 723, 723, 723, 723, 723, - - 723, 982, 983, 984, 989, 723, 991, 1336, 55, 55, - 55, 723, 723, 723, 723, 723, 723, 926, 927, 927, - 927, 927, 927, 927, 1020, 1020, 55, 55, 55, 53, - 724, 725, 725, 725, 725, 725, 725, 725, 1021, 1433, - 1083, 1086, 725, 1191, 830, 914, 899, 823, 725, 725, - 725, 725, 725, 725, 930, 931, 931, 931, 931, 931, - 931, 820, 817, 899, 1021, 1433, 53, 646, 646, 646, - 646, 646, 646, 646, 938, 939, 939, 939, 939, 939, - 939, 941, 942, 942, 942, 942, 942, 942, 945, 946, - 946, 946, 946, 946, 946, 954, 955, 955, 955, 955, - - 955, 955, 53, 647, 647, 647, 647, 647, 647, 647, - 791, 618, 684, 862, 647, 823, 512, 680, 678, 673, - 647, 647, 647, 647, 647, 647, 726, 327, 327, 327, - 327, 327, 327, 327, 250, 728, 728, 728, 728, 728, - 728, 728, 850, 820, 503, 669, 729, 664, 839, 817, - 830, 827, 729, 729, 729, 729, 729, 729, 53, 729, - 729, 729, 729, 729, 729, 729, 732, 733, 733, 733, - 733, 733, 733, 743, 731, 823, 820, 734, 817, 815, - 731, 616, 791, 734, 734, 734, 734, 734, 734, 503, - 592, 592, 592, 592, 592, 592, 592, 656, 618, 437, - - 612, 593, 610, 686, 659, 675, 1029, 593, 593, 593, - 593, 593, 593, 735, 736, 736, 736, 736, 736, 736, - 1030, 656, 666, 743, 737, 731, 659, 656, 731, 53, - 737, 737, 737, 737, 737, 737, 512, 604, 604, 604, - 604, 604, 604, 604, 659, 53, 1030, 53, 605, 718, - 53, 53, 712, 1029, 605, 605, 605, 605, 605, 605, - 738, 739, 739, 739, 739, 739, 739, 1433, 618, 439, - 512, 740, 686, 659, 339, 508, 503, 740, 740, 740, - 740, 740, 740, 744, 745, 745, 745, 745, 745, 745, - 422, 675, 656, 1433, 746, 666, 663, 586, 577, 659, - - 746, 746, 746, 746, 746, 746, 664, 749, 749, 749, - 749, 749, 749, 749, 666, 656, 654, 577, 750, 567, - 565, 643, 642, 641, 750, 750, 750, 750, 750, 750, - 751, 752, 752, 752, 752, 752, 752, 422, 640, 639, - 638, 753, 637, 636, 635, 634, 633, 753, 753, 753, - 753, 753, 753, 673, 761, 761, 761, 761, 761, 761, - 761, 675, 632, 631, 630, 762, 629, 628, 627, 626, - 625, 762, 762, 762, 762, 762, 762, 763, 764, 764, - 764, 764, 764, 764, 422, 624, 623, 622, 765, 621, - 437, 618, 439, 433, 765, 765, 765, 765, 765, 765, - - 684, 776, 776, 776, 776, 776, 776, 776, 686, 514, - 498, 505, 777, 586, 577, 498, 577, 571, 777, 777, - 777, 777, 777, 777, 778, 779, 779, 779, 779, 779, - 779, 422, 571, 564, 563, 780, 562, 561, 560, 559, - 558, 780, 780, 780, 780, 780, 780, 616, 787, 787, - 787, 787, 787, 787, 787, 618, 557, 556, 312, 788, - 222, 555, 554, 553, 552, 788, 788, 788, 788, 788, - 788, 789, 790, 790, 790, 790, 790, 790, 790, 791, - 551, 550, 549, 792, 548, 793, 547, 546, 545, 792, - 792, 792, 792, 792, 792, 957, 958, 958, 958, 958, - - 958, 958, 961, 962, 962, 962, 962, 962, 962, 1031, - 1031, 793, 55, 1041, 807, 807, 807, 807, 807, 807, - 807, 544, 541, 1032, 1433, 807, 538, 1042, 537, 536, - 55, 807, 807, 807, 807, 807, 807, 808, 808, 808, - 808, 808, 808, 808, 535, 534, 533, 532, 808, 1032, - 1433, 531, 530, 1042, 808, 808, 808, 808, 808, 808, - 809, 810, 810, 810, 810, 810, 810, 529, 439, 262, - 422, 811, 339, 55, 514, 498, 505, 811, 811, 811, - 811, 811, 811, 250, 812, 812, 812, 812, 812, 812, - 812, 55, 422, 502, 419, 813, 413, 498, 496, 413, - - 1383, 813, 813, 813, 813, 813, 813, 53, 813, 813, - 813, 813, 813, 813, 813, 664, 816, 816, 816, 816, - 816, 816, 816, 817, 405, 399, 483, 818, 482, 668, - 481, 480, 479, 818, 818, 818, 818, 818, 818, 867, - 867, 867, 867, 867, 867, 867, 939, 939, 939, 939, - 939, 939, 939, 1041, 478, 668, 673, 819, 819, 819, - 819, 819, 819, 819, 820, 477, 1043, 1433, 821, 476, - 677, 475, 1043, 1053, 821, 821, 821, 821, 821, 821, - 1044, 474, 473, 472, 471, 468, 1433, 1054, 467, 464, - 463, 462, 55, 1433, 1053, 461, 677, 684, 822, 822, - - 822, 822, 822, 822, 822, 823, 1044, 460, 1433, 824, - 55, 688, 1433, 1054, 1055, 824, 824, 824, 824, 824, - 824, 955, 955, 955, 955, 955, 955, 955, 1056, 1382, - 113, 459, 458, 1055, 1433, 1173, 449, 688, 828, 829, - 829, 829, 829, 829, 829, 829, 830, 1433, 448, 1174, - 831, 447, 832, 446, 1056, 1173, 831, 831, 831, 831, - 831, 831, 1065, 1066, 1066, 1066, 1066, 1066, 1066, 1433, - 445, 444, 443, 1433, 1175, 1174, 1175, 442, 832, 664, - 835, 835, 835, 835, 835, 835, 835, 817, 1176, 260, - 1433, 836, 439, 262, 422, 1433, 341, 836, 836, 836, - - 836, 836, 836, 837, 838, 838, 838, 838, 838, 838, - 838, 839, 419, 413, 1176, 840, 1433, 841, 413, 406, - 406, 840, 840, 840, 840, 840, 840, 1068, 1069, 1069, - 1069, 1069, 1069, 1069, 1072, 1073, 1073, 1073, 1073, 1073, - 1073, 1219, 398, 841, 673, 846, 846, 846, 846, 846, - 846, 846, 820, 391, 390, 1220, 847, 387, 386, 385, - 384, 383, 847, 847, 847, 847, 847, 847, 848, 849, - 849, 849, 849, 849, 849, 849, 850, 55, 55, 1219, - 851, 1220, 852, 382, 381, 380, 851, 851, 851, 851, - 851, 851, 379, 1433, 378, 55, 55, 1115, 1116, 1116, - - 1116, 1116, 1116, 1116, 1224, 377, 1080, 1081, 852, 684, - 858, 858, 858, 858, 858, 858, 858, 823, 1225, 1433, - 376, 859, 375, 374, 373, 372, 371, 859, 859, 859, - 859, 859, 859, 860, 861, 861, 861, 861, 861, 861, - 861, 862, 55, 1224, 1225, 863, 366, 864, 365, 294, - 55, 863, 863, 863, 863, 863, 863, 1433, 364, 363, - 55, 1121, 1122, 1122, 1122, 1122, 1122, 1122, 55, 362, - 1226, 1082, 361, 864, 789, 875, 875, 875, 875, 875, - 875, 875, 791, 1433, 1227, 360, 876, 1411, 359, 353, - 262, 1226, 876, 876, 876, 876, 876, 876, 877, 878, - - 878, 878, 878, 878, 878, 1433, 341, 258, 338, 879, - 1227, 255, 334, 249, 243, 879, 879, 879, 879, 879, - 879, 55, 1232, 892, 892, 892, 892, 892, 892, 892, - 135, 1433, 322, 321, 892, 320, 1233, 315, 294, 55, - 892, 892, 892, 892, 892, 892, 893, 893, 893, 893, - 893, 893, 893, 314, 313, 312, 311, 893, 310, 309, - 308, 307, 1233, 893, 893, 893, 893, 893, 893, 571, - 894, 894, 894, 894, 894, 894, 894, 306, 305, 304, - 303, 895, 302, 404, 301, 300, 297, 895, 895, 895, - 895, 895, 895, 1125, 1126, 1126, 1126, 1126, 1126, 1126, - - 1131, 1132, 1132, 1132, 1132, 1132, 1132, 296, 1232, 404, - 895, 895, 895, 895, 895, 895, 895, 295, 294, 293, - 292, 895, 1433, 291, 290, 289, 288, 895, 895, 895, - 895, 895, 895, 250, 896, 896, 896, 896, 896, 896, - 896, 287, 286, 285, 284, 897, 283, 282, 1433, 281, - 280, 897, 897, 897, 897, 897, 897, 53, 897, 897, - 897, 897, 897, 897, 897, 900, 901, 901, 901, 901, - 901, 901, 279, 135, 278, 277, 902, 276, 275, 274, - 273, 272, 902, 902, 902, 902, 902, 902, 664, 749, - 749, 749, 749, 749, 749, 749, 817, 271, 270, 269, - - 750, 268, 267, 266, 265, 1234, 750, 750, 750, 750, - 750, 750, 903, 904, 904, 904, 904, 904, 904, 1235, - 262, 250, 255, 905, 242, 241, 240, 239, 238, 905, - 905, 905, 905, 905, 905, 673, 761, 761, 761, 761, - 761, 761, 761, 820, 237, 1235, 236, 762, 235, 234, - 233, 230, 1234, 762, 762, 762, 762, 762, 762, 906, - 907, 907, 907, 907, 907, 907, 1433, 227, 224, 223, - 908, 222, 221, 218, 217, 216, 908, 908, 908, 908, - 908, 908, 684, 776, 776, 776, 776, 776, 776, 776, - 823, 215, 1433, 214, 777, 213, 212, 211, 210, 1240, - - 777, 777, 777, 777, 777, 777, 909, 910, 910, 910, - 910, 910, 910, 1241, 209, 208, 207, 911, 206, 205, - 204, 203, 199, 911, 911, 911, 911, 911, 911, 915, - 916, 916, 916, 916, 916, 916, 422, 198, 188, 1241, - 917, 187, 186, 183, 182, 181, 917, 917, 917, 917, - 917, 917, 828, 920, 920, 920, 920, 920, 920, 920, - 830, 180, 179, 178, 921, 177, 176, 172, 171, 170, - 921, 921, 921, 921, 921, 921, 922, 923, 923, 923, - 923, 923, 923, 422, 169, 168, 167, 924, 166, 165, - 164, 163, 162, 924, 924, 924, 924, 924, 924, 837, - - 932, 932, 932, 932, 932, 932, 932, 839, 161, 160, - 159, 933, 158, 157, 152, 143, 142, 933, 933, 933, - 933, 933, 933, 934, 935, 935, 935, 935, 935, 935, - 422, 137, 88, 59, 936, 47, 45, 1433, 1433, 1433, - 936, 936, 936, 936, 936, 936, 848, 947, 947, 947, - 947, 947, 947, 947, 850, 1433, 1433, 1433, 948, 1433, - 1433, 1433, 1433, 1433, 948, 948, 948, 948, 948, 948, - 949, 950, 950, 950, 950, 950, 950, 422, 1433, 1433, - 1433, 951, 1433, 1433, 1433, 1433, 1433, 951, 951, 951, - 951, 951, 951, 860, 963, 963, 963, 963, 963, 963, - - 963, 862, 1433, 1433, 1433, 964, 1433, 1433, 1433, 1433, - 1433, 964, 964, 964, 964, 964, 964, 965, 966, 966, - 966, 966, 966, 966, 422, 1433, 1433, 1433, 967, 1433, - 1433, 1433, 1433, 1433, 967, 967, 967, 967, 967, 967, - 789, 974, 974, 974, 974, 974, 974, 974, 791, 1433, - 1433, 1433, 975, 1433, 1433, 1433, 1433, 1433, 975, 975, - 975, 975, 975, 975, 976, 977, 977, 977, 977, 977, - 977, 977, 978, 1433, 1433, 1433, 979, 1433, 980, 1433, - 1433, 1433, 979, 979, 979, 979, 979, 979, 1134, 1135, - 1135, 1135, 1135, 1135, 1135, 1138, 1139, 1139, 1139, 1139, - - 1139, 1139, 1433, 1433, 980, 55, 571, 993, 993, 993, - 993, 993, 993, 993, 1433, 1433, 1433, 1433, 994, 1433, - 1433, 1433, 1433, 55, 994, 994, 994, 994, 994, 994, - 53, 994, 994, 994, 994, 994, 994, 994, 55, 250, - 995, 995, 995, 995, 995, 995, 995, 1145, 1146, 1146, - 1146, 1146, 1146, 1146, 1433, 1433, 55, 828, 998, 998, - 998, 998, 998, 998, 998, 999, 1433, 1433, 1433, 1000, - 1433, 832, 1433, 1433, 1433, 1000, 1000, 1000, 1000, 1000, - 1000, 1148, 1149, 1149, 1149, 1149, 1149, 1149, 1152, 1153, - 1153, 1153, 1153, 1153, 1153, 1433, 1433, 832, 837, 1001, - - 1001, 1001, 1001, 1001, 1001, 1001, 1002, 1433, 1433, 1433, - 1003, 1433, 841, 1433, 1433, 1433, 1003, 1003, 1003, 1003, - 1003, 1003, 1159, 1160, 1160, 1160, 1160, 1160, 1160, 1162, - 1163, 1163, 1163, 1163, 1163, 1163, 1433, 1433, 841, 848, - 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1005, 1433, 1433, - 1433, 1006, 1433, 852, 1433, 1433, 1433, 1006, 1006, 1006, - 1006, 1006, 1006, 1166, 1167, 1167, 1167, 1167, 1167, 1167, - 1066, 1066, 1066, 1066, 1066, 1066, 1066, 55, 1433, 852, - 860, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1008, 1433, - 1240, 1242, 1009, 1433, 864, 55, 1433, 1433, 1009, 1009, - - 1009, 1009, 1009, 1009, 1433, 1243, 1189, 1211, 1212, 1212, - 1212, 1212, 1212, 1212, 1433, 1242, 1433, 1433, 1433, 1248, - 864, 1011, 1012, 1012, 1012, 1012, 1012, 1012, 1013, 1433, - 1433, 1243, 1014, 1249, 1433, 1433, 1433, 1433, 1014, 1014, - 1014, 1014, 1014, 1014, 1015, 1016, 1016, 1016, 1016, 1016, - 1016, 1016, 1017, 1433, 1433, 1433, 1018, 1433, 1019, 1249, - 1433, 1433, 1018, 1018, 1018, 1018, 1018, 1018, 1132, 1132, - 1132, 1132, 1132, 1132, 1132, 1146, 1146, 1146, 1146, 1146, - 1146, 1146, 1248, 1433, 1019, 828, 1022, 1022, 1022, 1022, - 1022, 1022, 1022, 999, 1433, 1433, 1433, 1023, 1433, 1433, - - 1433, 1433, 1433, 1023, 1023, 1023, 1023, 1023, 1023, 1024, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1026, 1433, 1433, - 1433, 1027, 1433, 1028, 1433, 1433, 1250, 1027, 1027, 1027, - 1027, 1027, 1027, 1160, 1160, 1160, 1160, 1160, 1160, 1160, - 1251, 1433, 1433, 1433, 1433, 1250, 1433, 1282, 1433, 1028, - 837, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1002, 1433, - 1433, 1283, 1034, 1433, 1433, 1433, 1251, 1433, 1034, 1034, - 1034, 1034, 1034, 1034, 1035, 1036, 1036, 1036, 1036, 1036, - 1036, 1036, 1037, 1433, 1433, 1433, 1038, 1283, 1039, 1433, - 1433, 1433, 1038, 1038, 1038, 1038, 1038, 1038, 1256, 1257, - - 1257, 1257, 1257, 1257, 1257, 1259, 1260, 1260, 1260, 1260, - 1260, 1260, 1282, 1433, 1039, 848, 1045, 1045, 1045, 1045, - 1045, 1045, 1045, 1005, 1433, 1433, 1433, 1046, 1433, 1433, - 1433, 1433, 1433, 1046, 1046, 1046, 1046, 1046, 1046, 1047, - 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1049, 1433, 1433, - 1433, 1050, 1433, 1051, 1433, 1433, 1433, 1050, 1050, 1050, - 1050, 1050, 1050, 1263, 1264, 1264, 1264, 1264, 1264, 1264, - 1288, 1289, 1289, 1289, 1289, 1289, 1289, 1329, 1433, 1051, - 860, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1008, 1433, - 1433, 1330, 1058, 1433, 1433, 1433, 1433, 55, 1058, 1058, - - 1058, 1058, 1058, 1058, 1059, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1061, 55, 1433, 55, 1062, 1330, 1063, 1433, - 1433, 1433, 1062, 1062, 1062, 1062, 1062, 1062, 1271, 1433, - 1433, 55, 1293, 1294, 1294, 1294, 1294, 1294, 1294, 1433, - 1433, 1329, 1272, 1433, 1063, 976, 1074, 1074, 1074, 1074, - 1074, 1074, 1074, 978, 1433, 1433, 1433, 1075, 1433, 1433, - 1433, 1433, 1331, 1075, 1075, 1075, 1075, 1075, 1075, 1076, - 1077, 1077, 1077, 1077, 1077, 1077, 1332, 1433, 1433, 1433, - 1078, 1433, 1433, 1433, 1433, 1433, 1078, 1078, 1078, 1078, - 1078, 1078, 55, 571, 1090, 1090, 1090, 1090, 1090, 1090, - - 1090, 1433, 1332, 1433, 1433, 897, 1433, 1433, 1433, 1433, - 55, 897, 897, 897, 897, 897, 897, 53, 897, 897, - 897, 897, 897, 897, 897, 55, 250, 995, 995, 995, - 995, 995, 995, 995, 1296, 1297, 1297, 1297, 1297, 1297, - 1297, 1433, 1331, 55, 1093, 1094, 1094, 1094, 1094, 1094, - 1094, 1433, 1433, 1433, 1433, 1095, 1433, 1433, 1433, 1433, - 1433, 1095, 1095, 1095, 1095, 1095, 1095, 828, 920, 920, - 920, 920, 920, 920, 920, 999, 1433, 1433, 1433, 921, - 1433, 1433, 1433, 1433, 1354, 921, 921, 921, 921, 921, - 921, 1096, 1097, 1097, 1097, 1097, 1097, 1097, 1355, 1433, - - 1433, 1433, 1098, 1433, 1433, 1433, 1433, 1433, 1098, 1098, - 1098, 1098, 1098, 1098, 837, 932, 932, 932, 932, 932, - 932, 932, 1002, 1433, 1355, 1433, 933, 1433, 1433, 1433, - 1433, 1354, 933, 933, 933, 933, 933, 933, 1099, 1100, - 1100, 1100, 1100, 1100, 1100, 1433, 1433, 1433, 1433, 1101, - 1433, 1433, 1433, 1433, 1433, 1101, 1101, 1101, 1101, 1101, - 1101, 848, 947, 947, 947, 947, 947, 947, 947, 1005, - 1433, 1433, 1433, 948, 1433, 1433, 1433, 1433, 1358, 948, - 948, 948, 948, 948, 948, 1102, 1103, 1103, 1103, 1103, - 1103, 1103, 1359, 1433, 1433, 1433, 1104, 1433, 1433, 1433, - - 1433, 1433, 1104, 1104, 1104, 1104, 1104, 1104, 860, 963, - 963, 963, 963, 963, 963, 963, 1008, 1433, 1359, 1433, - 964, 1433, 1433, 1433, 1433, 1358, 964, 964, 964, 964, - 964, 964, 1105, 1106, 1106, 1106, 1106, 1106, 1106, 1433, - 1433, 1433, 1433, 1107, 1433, 1433, 1433, 1433, 1433, 1107, - 1107, 1107, 1107, 1107, 1107, 1109, 1110, 1110, 1110, 1110, - 1110, 1110, 1110, 1111, 1433, 1433, 1433, 1112, 1433, 1113, - 1433, 1433, 1433, 1112, 1112, 1112, 1112, 1112, 1112, 1302, - 1303, 1303, 1303, 1303, 1303, 1303, 1305, 1306, 1306, 1306, - 1306, 1306, 1306, 1362, 1433, 1113, 1015, 1117, 1117, 1117, - - 1117, 1117, 1117, 1117, 1017, 1433, 1433, 1363, 1118, 1433, - 1433, 1433, 1433, 1433, 1118, 1118, 1118, 1118, 1118, 1118, - 1024, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1026, 1433, - 1433, 1433, 1128, 1363, 1433, 1433, 1433, 1433, 1128, 1128, - 1128, 1128, 1128, 1128, 1035, 1140, 1140, 1140, 1140, 1140, - 1140, 1140, 1037, 1433, 1433, 1433, 1141, 1433, 1433, 1433, - 1433, 1433, 1141, 1141, 1141, 1141, 1141, 1141, 1047, 1154, - 1154, 1154, 1154, 1154, 1154, 1154, 1049, 1433, 1433, 1433, - 1155, 1433, 1433, 1433, 1433, 1433, 1155, 1155, 1155, 1155, - 1155, 1155, 1059, 1168, 1168, 1168, 1168, 1168, 1168, 1168, - - 1061, 1433, 1433, 1433, 1169, 1433, 1433, 1433, 1433, 1433, - 1169, 1169, 1169, 1169, 1169, 1169, 976, 1177, 1177, 1177, - 1177, 1177, 1177, 1177, 978, 1433, 1433, 1433, 1178, 1433, - 1433, 1433, 1433, 1433, 1178, 1178, 1178, 1178, 1178, 1178, - 1179, 1180, 1180, 1180, 1180, 1180, 1180, 1180, 1181, 1433, - 1433, 1433, 1182, 1433, 1183, 1433, 1433, 1433, 1182, 1182, - 1182, 1182, 1182, 1182, 1311, 1312, 1312, 1312, 1312, 1312, - 1312, 1314, 1315, 1315, 1315, 1315, 1315, 1315, 1433, 1433, - 1183, 55, 571, 488, 488, 488, 488, 488, 488, 488, - 1320, 1321, 1321, 1321, 1321, 1321, 1321, 1433, 1362, 55, - - 1192, 1193, 1193, 1193, 1193, 1193, 1193, 1194, 1433, 1433, - 1433, 1195, 1433, 1433, 1433, 1433, 1433, 1195, 1195, 1195, - 1195, 1195, 1195, 1015, 1196, 1196, 1196, 1196, 1196, 1196, - 1196, 1197, 1433, 1433, 1433, 1198, 1433, 1019, 1433, 1433, - 1433, 1198, 1198, 1198, 1198, 1198, 1198, 1323, 1324, 1324, - 1324, 1324, 1324, 1324, 1257, 1257, 1257, 1257, 1257, 1257, - 1257, 1433, 1433, 1019, 1024, 1199, 1199, 1199, 1199, 1199, - 1199, 1199, 1200, 1433, 1433, 1433, 1201, 1433, 1028, 1433, - 1433, 1433, 1201, 1201, 1201, 1201, 1201, 1201, 1348, 1349, - 1349, 1349, 1349, 1349, 1349, 1294, 1294, 1294, 1294, 1294, - - 1294, 1294, 1433, 1433, 1028, 1035, 1202, 1202, 1202, 1202, - 1202, 1202, 1202, 1203, 1433, 1433, 1433, 1204, 1433, 1039, - 1433, 1433, 1433, 1204, 1204, 1204, 1204, 1204, 1204, 1303, - 1303, 1303, 1303, 1303, 1303, 1303, 1312, 1312, 1312, 1312, - 1312, 1312, 1312, 1366, 1433, 1039, 1047, 1205, 1205, 1205, - 1205, 1205, 1205, 1205, 1206, 1433, 1366, 1367, 1207, 1433, - 1051, 1433, 1433, 1433, 1207, 1207, 1207, 1207, 1207, 1207, - 1433, 1321, 1321, 1321, 1321, 1321, 1321, 1321, 1433, 1433, - 1433, 1433, 1433, 1367, 1370, 1433, 1051, 1059, 1208, 1208, - 1208, 1208, 1208, 1208, 1208, 1209, 1433, 1370, 1371, 1210, - - 1433, 1063, 1433, 1433, 1433, 1210, 1210, 1210, 1210, 1210, - 1210, 1433, 1374, 1375, 1375, 1375, 1375, 1375, 1375, 1433, - 1433, 1433, 1433, 1433, 1371, 1386, 1433, 1063, 1109, 1213, - 1213, 1213, 1213, 1213, 1213, 1213, 1111, 1433, 1433, 1387, - 1214, 1433, 1433, 1433, 1433, 1433, 1214, 1214, 1214, 1214, - 1214, 1214, 1015, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - 1197, 1433, 1433, 1433, 1222, 1387, 1433, 1433, 1433, 1433, - 1222, 1222, 1222, 1222, 1222, 1222, 1024, 1228, 1228, 1228, - 1228, 1228, 1228, 1228, 1200, 1433, 1433, 1433, 1229, 1433, - 1433, 1433, 1433, 1433, 1229, 1229, 1229, 1229, 1229, 1229, - - 1035, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1203, 1433, - 1433, 1433, 1237, 1433, 1433, 1433, 1433, 1433, 1237, 1237, - 1237, 1237, 1237, 1237, 1047, 1244, 1244, 1244, 1244, 1244, - 1244, 1244, 1206, 1433, 1433, 1433, 1245, 1433, 1433, 1433, - 1433, 1433, 1245, 1245, 1245, 1245, 1245, 1245, 1059, 1252, - 1252, 1252, 1252, 1252, 1252, 1252, 1209, 1433, 1433, 1433, - 1253, 1433, 1433, 1433, 1433, 1433, 1253, 1253, 1253, 1253, - 1253, 1253, 1179, 1265, 1265, 1265, 1265, 1265, 1265, 1265, - 1181, 1433, 1433, 1433, 1266, 1433, 1433, 1433, 1433, 1433, - 1266, 1266, 1266, 1266, 1266, 1266, 1109, 1273, 1273, 1273, - - 1273, 1273, 1273, 1273, 1274, 1433, 1433, 1433, 1275, 1433, - 1113, 1433, 1433, 1386, 1275, 1275, 1275, 1275, 1275, 1275, - 1377, 1378, 1378, 1378, 1378, 1378, 1378, 1433, 1388, 1389, - 1389, 1389, 1389, 1389, 1389, 1433, 1113, 1015, 1117, 1117, - 1117, 1117, 1117, 1117, 1117, 1197, 1433, 1433, 1433, 1118, - 1433, 1433, 1433, 1433, 1433, 1118, 1118, 1118, 1118, 1118, - 1118, 1024, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1200, - 1433, 1433, 1433, 1128, 1433, 1433, 1433, 1433, 1433, 1128, - 1128, 1128, 1128, 1128, 1128, 1035, 1140, 1140, 1140, 1140, - 1140, 1140, 1140, 1203, 1433, 1433, 1433, 1141, 1433, 1433, - - 1433, 1433, 1433, 1141, 1141, 1141, 1141, 1141, 1141, 1047, - 1154, 1154, 1154, 1154, 1154, 1154, 1154, 1206, 1433, 1433, - 1433, 1155, 1433, 1433, 1433, 1433, 1433, 1155, 1155, 1155, - 1155, 1155, 1155, 1059, 1168, 1168, 1168, 1168, 1168, 1168, - 1168, 1209, 1433, 1433, 1433, 1169, 1433, 1433, 1433, 1433, - 1433, 1169, 1169, 1169, 1169, 1169, 1169, 1109, 1284, 1284, - 1284, 1284, 1284, 1284, 1284, 1274, 1433, 1433, 1433, 1285, - 1433, 1433, 1433, 1433, 1433, 1285, 1285, 1285, 1285, 1285, - 1285, 1179, 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1181, - 1433, 1433, 1433, 1334, 1433, 1433, 1433, 1433, 1433, 1334, - - 1334, 1334, 1334, 1334, 1334, 1109, 1213, 1213, 1213, 1213, - 1213, 1213, 1213, 1274, 1433, 1433, 1433, 1214, 1433, 1433, - 1433, 1433, 1433, 1214, 1214, 1214, 1214, 1214, 1214, 1392, - 1393, 1393, 1393, 1393, 1393, 1393, 1396, 1397, 1397, 1397, - 1397, 1397, 1397, 1400, 1401, 1401, 1401, 1401, 1401, 1401, - 1404, 1405, 1405, 1405, 1405, 1405, 1405, 1375, 1375, 1375, - 1375, 1375, 1375, 1375, 1408, 1408, 1412, 1413, 1413, 1413, - 1413, 1413, 1413, 1433, 1433, 1433, 1433, 1433, 1409, 1433, - 1389, 1389, 1389, 1389, 1389, 1389, 1389, 1393, 1393, 1393, - 1393, 1393, 1393, 1393, 1397, 1397, 1397, 1397, 1397, 1397, - - 1397, 1433, 1433, 1433, 1409, 1433, 1401, 1401, 1401, 1401, - 1401, 1401, 1401, 1405, 1405, 1405, 1405, 1405, 1405, 1405, - 1421, 1422, 1422, 1422, 1422, 1422, 1422, 1413, 1413, 1413, - 1413, 1413, 1413, 1413, 1422, 1422, 1422, 1422, 1422, 1422, - 1422, 46, 1433, 1433, 1433, 1433, 46, 46, 46, 64, - 1433, 64, 64, 64, 64, 64, 64, 64, 144, 1433, - 144, 151, 151, 151, 254, 254, 254, 263, 263, 263, - 333, 333, 333, 336, 336, 336, 337, 337, 337, 344, - 344, 344, 342, 342, 342, 348, 348, 348, 352, 1433, - 352, 412, 412, 412, 417, 417, 417, 418, 418, 418, - - 427, 427, 427, 431, 1433, 431, 432, 432, 432, 346, - 346, 1433, 1433, 346, 436, 436, 436, 440, 440, 440, - 336, 336, 336, 495, 495, 495, 499, 499, 499, 500, - 500, 500, 501, 501, 501, 344, 344, 344, 506, 506, - 506, 425, 425, 1433, 1433, 425, 511, 511, 511, 515, - 515, 515, 519, 1433, 519, 520, 520, 520, 524, 524, - 524, 528, 1433, 528, 576, 576, 576, 427, 427, 427, - 584, 584, 584, 585, 585, 585, 593, 593, 593, 597, - 1433, 597, 600, 1433, 600, 601, 601, 601, 605, 605, - 605, 609, 1433, 609, 518, 518, 1433, 1433, 518, 522, - - 522, 1433, 1433, 522, 615, 615, 615, 619, 619, 619, - 528, 528, 1433, 528, 500, 500, 500, 653, 653, 653, - 657, 657, 657, 660, 660, 660, 661, 661, 661, 662, - 662, 662, 667, 667, 667, 591, 591, 1433, 1433, 591, - 672, 672, 672, 676, 676, 676, 597, 597, 1433, 597, - 599, 599, 1433, 1433, 599, 600, 600, 1433, 600, 601, - 601, 603, 603, 1433, 1433, 603, 683, 683, 683, 687, - 687, 687, 609, 609, 1433, 609, 691, 1433, 691, 694, - 1433, 694, 695, 695, 695, 699, 699, 699, 703, 1433, - 703, 730, 730, 730, 593, 593, 593, 605, 605, 605, - - 741, 741, 741, 742, 742, 742, 750, 750, 750, 754, - 1433, 754, 757, 1433, 757, 758, 758, 758, 762, 762, - 762, 766, 1433, 766, 769, 1433, 769, 772, 1433, 772, - 773, 773, 773, 777, 777, 777, 781, 1433, 781, 690, - 1433, 1433, 690, 691, 691, 1433, 691, 693, 693, 1433, - 1433, 693, 694, 694, 1433, 694, 695, 695, 697, 697, - 1433, 1433, 697, 788, 788, 788, 792, 792, 792, 703, - 703, 1433, 703, 53, 53, 53, 1433, 53, 53, 661, - 661, 661, 814, 814, 814, 818, 818, 818, 821, 821, - 821, 824, 824, 824, 825, 825, 825, 826, 826, 826, - - 831, 831, 831, 748, 748, 1433, 1433, 748, 836, 836, - 836, 840, 840, 840, 754, 754, 1433, 754, 756, 756, - 1433, 1433, 756, 757, 757, 1433, 757, 758, 758, 760, - 760, 1433, 1433, 760, 847, 847, 847, 851, 851, 851, - 766, 766, 1433, 766, 768, 1433, 1433, 768, 769, 769, - 1433, 769, 771, 771, 1433, 1433, 771, 772, 772, 1433, - 772, 773, 773, 775, 775, 1433, 1433, 775, 859, 859, - 859, 863, 863, 863, 781, 781, 1433, 781, 865, 1433, - 865, 868, 1433, 868, 871, 1433, 871, 872, 872, 872, - 876, 876, 876, 880, 1433, 880, 53, 53, 53, 1433, - - 53, 53, 898, 898, 898, 750, 750, 750, 762, 762, - 762, 777, 777, 777, 912, 912, 912, 913, 913, 913, - 921, 921, 921, 925, 1433, 925, 928, 1433, 928, 929, - 929, 929, 933, 933, 933, 937, 1433, 937, 940, 1433, - 940, 943, 1433, 943, 944, 944, 944, 948, 948, 948, - 952, 1433, 952, 953, 1433, 953, 956, 1433, 956, 959, - 1433, 959, 960, 960, 960, 964, 964, 964, 968, 1433, - 968, 865, 1433, 865, 867, 1433, 1433, 867, 868, 868, - 1433, 868, 870, 870, 1433, 1433, 870, 871, 871, 1433, - 871, 872, 872, 874, 874, 1433, 1433, 874, 975, 975, - - 975, 979, 979, 979, 880, 880, 1433, 880, 53, 53, - 53, 1433, 53, 53, 825, 825, 825, 996, 996, 996, - 1000, 1000, 1000, 1003, 1003, 1003, 1006, 1006, 1006, 1009, - 1009, 1009, 1010, 1010, 1010, 1018, 1018, 1018, 919, 919, - 1433, 1433, 919, 1023, 1023, 1023, 1027, 1027, 1027, 925, - 925, 1433, 925, 927, 927, 1433, 1433, 927, 928, 928, - 1433, 928, 929, 929, 931, 931, 1433, 1433, 931, 1034, - 1034, 1034, 1038, 1038, 1038, 937, 937, 1433, 937, 939, - 1433, 1433, 939, 940, 940, 1433, 940, 942, 942, 1433, - 1433, 942, 943, 943, 1433, 943, 944, 944, 946, 946, - - 1433, 1433, 946, 1046, 1046, 1046, 1050, 1050, 1050, 952, - 952, 1433, 952, 953, 1433, 953, 955, 1433, 1433, 955, - 956, 956, 1433, 956, 958, 958, 1433, 1433, 958, 959, - 959, 1433, 959, 960, 960, 962, 962, 1433, 1433, 962, - 1058, 1058, 1058, 1062, 1062, 1062, 968, 968, 1433, 968, - 1064, 1433, 1064, 1067, 1433, 1067, 1070, 1433, 1070, 1071, - 1071, 1071, 1075, 1075, 1075, 1079, 1433, 1079, 53, 53, - 53, 1433, 53, 53, 1091, 1091, 1091, 921, 921, 921, - 933, 933, 933, 948, 948, 948, 964, 964, 964, 1108, - 1108, 1108, 1114, 1114, 1114, 1112, 1112, 1112, 1119, 1119, - - 1119, 1118, 1118, 1118, 1120, 1433, 1120, 1123, 1433, 1123, - 1124, 1124, 1124, 1129, 1129, 1129, 1128, 1128, 1128, 1130, - 1433, 1130, 1133, 1433, 1133, 1136, 1433, 1136, 1137, 1137, - 1137, 1142, 1142, 1142, 1141, 1141, 1141, 1143, 1433, 1143, - 1144, 1433, 1144, 1147, 1433, 1147, 1150, 1433, 1150, 1151, - 1151, 1151, 1156, 1156, 1156, 1155, 1155, 1155, 1157, 1433, - 1157, 1158, 1433, 1158, 1161, 1433, 1161, 1164, 1433, 1164, - 1165, 1165, 1165, 1170, 1170, 1170, 1169, 1169, 1169, 1171, - 1433, 1171, 1064, 1433, 1064, 1066, 1433, 1433, 1066, 1067, - 1067, 1433, 1067, 1069, 1069, 1433, 1433, 1069, 1070, 1070, - - 1433, 1070, 1071, 1071, 1073, 1073, 1433, 1433, 1073, 1178, - 1178, 1178, 1182, 1182, 1182, 1079, 1079, 1433, 1079, 53, - 53, 53, 1433, 53, 53, 1010, 1010, 1010, 1198, 1198, - 1198, 1201, 1201, 1201, 1204, 1204, 1204, 1207, 1207, 1207, - 1210, 1210, 1210, 1215, 1215, 1215, 1214, 1214, 1214, 1217, - 1433, 1217, 1218, 1218, 1218, 1116, 1116, 1433, 1433, 1116, - 1222, 1222, 1222, 1223, 1223, 1223, 1120, 1120, 1433, 1120, - 1122, 1122, 1433, 1433, 1122, 1123, 1123, 1433, 1123, 1124, - 1124, 1126, 1126, 1433, 1433, 1126, 1229, 1229, 1229, 1230, - 1230, 1230, 1130, 1130, 1433, 1130, 1132, 1433, 1433, 1132, - - 1133, 1133, 1433, 1133, 1135, 1135, 1433, 1433, 1135, 1136, - 1136, 1433, 1136, 1137, 1137, 1139, 1139, 1433, 1433, 1139, - 1237, 1237, 1237, 1238, 1238, 1238, 1143, 1143, 1433, 1143, - 1144, 1433, 1144, 1146, 1433, 1433, 1146, 1147, 1147, 1433, - 1147, 1149, 1149, 1433, 1433, 1149, 1150, 1150, 1433, 1150, - 1151, 1151, 1153, 1153, 1433, 1433, 1153, 1245, 1245, 1245, - 1246, 1246, 1246, 1157, 1157, 1433, 1157, 1158, 1433, 1158, - 1160, 1433, 1433, 1160, 1161, 1161, 1433, 1161, 1163, 1163, - 1433, 1433, 1163, 1164, 1164, 1433, 1164, 1165, 1165, 1167, - 1167, 1433, 1433, 1167, 1253, 1253, 1253, 1254, 1254, 1254, - - 1171, 1171, 1433, 1171, 1255, 1433, 1255, 1258, 1433, 1258, - 1261, 1433, 1261, 1262, 1262, 1262, 1267, 1433, 1267, 1266, - 1266, 1266, 1268, 1433, 1268, 53, 53, 53, 1433, 53, - 53, 1276, 1433, 1276, 1275, 1275, 1275, 1277, 1433, 1277, - 1118, 1118, 1118, 1278, 1433, 1278, 1128, 1128, 1128, 1279, - 1433, 1279, 1141, 1141, 1141, 1280, 1433, 1280, 1155, 1155, - 1155, 1281, 1433, 1281, 1169, 1169, 1169, 1212, 1212, 1433, - 1433, 1212, 1285, 1285, 1285, 1286, 1286, 1286, 344, 344, - 344, 1217, 1217, 1433, 1217, 1287, 1287, 1287, 1290, 1433, - 1290, 1291, 1291, 1291, 1292, 1292, 1292, 1295, 1433, 1295, - - 1298, 1433, 1298, 1299, 1299, 1299, 1300, 1300, 1300, 1301, - 1433, 1301, 1304, 1433, 1304, 1307, 1433, 1307, 1308, 1308, - 1308, 1309, 1309, 1309, 1310, 1433, 1310, 1313, 1433, 1313, - 1316, 1433, 1316, 1317, 1317, 1317, 1318, 1318, 1318, 1319, - 1433, 1319, 1322, 1433, 1322, 1325, 1433, 1325, 1326, 1326, - 1326, 1327, 1327, 1327, 1255, 1433, 1255, 1257, 1433, 1433, - 1257, 1258, 1258, 1433, 1258, 1260, 1260, 1433, 1433, 1260, - 1261, 1261, 1433, 1261, 1262, 1262, 1264, 1264, 1433, 1433, - 1264, 1334, 1334, 1334, 1335, 1433, 1335, 1268, 1268, 1433, - 1268, 53, 53, 53, 1433, 53, 53, 1340, 1340, 1340, - - 1214, 1214, 1214, 1342, 1433, 1342, 1343, 1433, 1343, 1344, - 1433, 1344, 1345, 1433, 1345, 1346, 1433, 1346, 1347, 1433, - 1347, 1350, 1433, 1350, 1351, 1351, 1351, 1352, 1352, 1352, - 1353, 1433, 1353, 1289, 1289, 1433, 1433, 1289, 1290, 1290, - 1433, 1290, 1291, 1291, 1356, 1433, 1356, 1294, 1433, 1433, - 1294, 1295, 1295, 1433, 1295, 1297, 1297, 1433, 1433, 1297, - 1298, 1298, 1433, 1298, 1299, 1299, 1360, 1433, 1360, 1301, - 1433, 1301, 1303, 1433, 1433, 1303, 1304, 1304, 1433, 1304, - 1306, 1306, 1433, 1433, 1306, 1307, 1307, 1433, 1307, 1308, - 1308, 1364, 1433, 1364, 1310, 1433, 1310, 1312, 1433, 1433, - - 1312, 1313, 1313, 1433, 1313, 1315, 1315, 1433, 1433, 1315, - 1316, 1316, 1433, 1316, 1317, 1317, 1368, 1433, 1368, 1319, - 1433, 1319, 1321, 1433, 1433, 1321, 1322, 1322, 1433, 1322, - 1324, 1324, 1433, 1433, 1324, 1325, 1325, 1433, 1325, 1326, - 1326, 1372, 1433, 1372, 1373, 1433, 1373, 1376, 1433, 1376, - 1379, 1433, 1379, 1380, 1380, 1380, 1381, 1433, 1381, 53, - 53, 53, 1433, 53, 53, 1385, 1433, 1385, 1287, 1433, - 1287, 1292, 1433, 1292, 1300, 1433, 1300, 1309, 1433, 1309, - 1318, 1433, 1318, 1327, 1433, 1327, 1349, 1349, 1433, 1433, - 1349, 1350, 1350, 1433, 1350, 1351, 1351, 1341, 1433, 1341, - - 1390, 1433, 1390, 1391, 1433, 1391, 1394, 1433, 1394, 1395, - 1433, 1395, 1398, 1433, 1398, 1399, 1433, 1399, 1402, 1433, - 1402, 1403, 1433, 1403, 1406, 1433, 1406, 1375, 1433, 1433, - 1375, 1378, 1378, 1433, 1433, 1378, 1410, 1433, 1410, 1352, - 1433, 1352, 1414, 1433, 1414, 1389, 1433, 1433, 1389, 1393, - 1433, 1433, 1393, 1397, 1433, 1433, 1397, 1401, 1433, 1433, - 1401, 1405, 1433, 1433, 1405, 1420, 1433, 1420, 1423, 1433, - 1423, 1413, 1433, 1433, 1413, 1425, 1433, 1425, 1426, 1433, - 1426, 1427, 1433, 1427, 1428, 1433, 1428, 1429, 1433, 1429, - 1422, 1433, 1433, 1422, 1431, 1433, 1431, 1432, 1433, 1432, - - 3, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433 + 651, 651, 1113, 1183, 1421, 1422, 651, 1423, 55, 55, + 1278, 1185, 651, 651, 651, 651, 651, 651, 410, 653, + 653, 653, 653, 653, 653, 653, 55, 55, 426, 1009, + + 654, 1422, 1428, 1423, 1434, 1274, 654, 654, 654, 654, + 654, 654, 53, 654, 654, 654, 654, 654, 654, 654, + 655, 655, 655, 655, 655, 655, 655, 1183, 1428, 1041, + 1434, 656, 426, 1006, 1030, 1437, 426, 656, 656, 656, + 656, 656, 656, 53, 656, 656, 656, 656, 656, 656, + 656, 507, 659, 659, 659, 659, 659, 659, 659, 660, + 55, 846, 848, 661, 1003, 511, 55, 1021, 848, 661, + 661, 661, 661, 661, 661, 1437, 849, 426, 55, 1115, + 426, 1096, 1437, 1012, 55, 55, 1009, 55, 1006, 55, + 802, 511, 516, 662, 662, 662, 662, 662, 662, 662, + + 663, 1437, 849, 55, 664, 55, 520, 55, 1437, 55, + 664, 664, 664, 664, 664, 664, 810, 807, 1003, 319, + 815, 815, 815, 815, 815, 815, 815, 55, 858, 858, + 860, 55, 520, 668, 669, 669, 669, 669, 669, 669, + 669, 670, 859, 1437, 861, 671, 1088, 672, 1096, 55, + 860, 671, 671, 671, 671, 671, 671, 772, 772, 772, + 772, 772, 772, 772, 1437, 55, 989, 982, 859, 1437, + 861, 974, 795, 672, 507, 675, 675, 675, 675, 675, + 675, 675, 660, 55, 864, 975, 676, 1065, 1012, 55, + 1437, 1388, 676, 676, 676, 676, 676, 676, 677, 678, + + 678, 678, 678, 678, 678, 678, 679, 55, 688, 860, + 680, 975, 681, 858, 852, 1053, 680, 680, 680, 680, + 680, 680, 870, 871, 871, 871, 871, 871, 871, 873, + 874, 874, 874, 874, 874, 874, 974, 55, 681, 516, + 686, 686, 686, 686, 686, 686, 686, 663, 1009, 677, + 1437, 687, 848, 846, 841, 55, 991, 687, 687, 687, + 687, 687, 687, 688, 689, 689, 689, 689, 689, 689, + 689, 690, 1041, 992, 1006, 691, 1437, 692, 668, 55, + 55, 691, 691, 691, 691, 691, 691, 877, 878, 878, + 878, 878, 878, 878, 837, 832, 1030, 55, 55, 1003, + + 976, 976, 55, 692, 620, 702, 702, 702, 702, 702, + 702, 702, 622, 893, 977, 1437, 703, 1091, 1021, 918, + 55, 903, 703, 703, 703, 703, 703, 703, 704, 705, + 705, 705, 705, 705, 705, 985, 1012, 1009, 1006, 706, + 977, 1437, 1003, 1001, 903, 706, 706, 706, 706, 706, + 706, 53, 53, 53, 53, 53, 53, 53, 793, 982, + 795, 620, 53, 55, 55, 55, 55, 55, 53, 53, + 53, 53, 53, 53, 922, 923, 923, 923, 923, 923, + 923, 55, 55, 55, 55, 55, 708, 726, 789, 727, + 727, 727, 727, 727, 727, 727, 986, 987, 988, 993, + + 727, 995, 1340, 55, 55, 55, 727, 727, 727, 727, + 727, 727, 930, 931, 931, 931, 931, 931, 931, 1024, + 1024, 55, 55, 55, 53, 728, 729, 729, 729, 729, + 729, 729, 729, 1025, 1437, 1087, 1090, 729, 1195, 787, + 866, 827, 854, 729, 729, 729, 729, 729, 729, 934, + 935, 935, 935, 935, 935, 935, 824, 843, 821, 1025, + 1437, 53, 650, 650, 650, 650, 650, 650, 650, 942, + 943, 943, 943, 943, 943, 943, 945, 946, 946, 946, + 946, 946, 946, 949, 950, 950, 950, 950, 950, 950, + 958, 959, 959, 959, 959, 959, 959, 53, 651, 651, + + 651, 651, 651, 651, 651, 834, 918, 903, 827, 651, + 824, 821, 903, 795, 622, 651, 651, 651, 651, 651, + 651, 730, 331, 331, 331, 331, 331, 331, 331, 253, + 732, 732, 732, 732, 732, 732, 732, 688, 866, 827, + 516, 733, 684, 682, 677, 854, 824, 733, 733, 733, + 733, 733, 733, 53, 733, 733, 733, 733, 733, 733, + 733, 736, 737, 737, 737, 737, 737, 737, 507, 673, + 668, 843, 738, 821, 834, 831, 747, 735, 738, 738, + 738, 738, 738, 738, 507, 596, 596, 596, 596, 596, + 596, 596, 660, 827, 824, 821, 597, 819, 735, 620, + + 795, 1033, 597, 597, 597, 597, 597, 597, 739, 740, + 740, 740, 740, 740, 740, 1034, 622, 441, 616, 741, + 614, 690, 663, 679, 660, 741, 741, 741, 741, 741, + 741, 516, 608, 608, 608, 608, 608, 608, 608, 663, + 670, 1034, 747, 609, 735, 663, 660, 735, 1033, 609, + 609, 609, 609, 609, 609, 742, 743, 743, 743, 743, + 743, 743, 1437, 53, 53, 53, 744, 722, 53, 53, + 716, 622, 744, 744, 744, 744, 744, 744, 748, 749, + 749, 749, 749, 749, 749, 426, 443, 516, 1437, 750, + 690, 663, 343, 512, 507, 750, 750, 750, 750, 750, + + 750, 668, 753, 753, 753, 753, 753, 753, 753, 670, + 679, 660, 670, 754, 667, 590, 581, 663, 660, 754, + 754, 754, 754, 754, 754, 755, 756, 756, 756, 756, + 756, 756, 426, 658, 581, 571, 757, 569, 647, 646, + 645, 644, 757, 757, 757, 757, 757, 757, 677, 765, + 765, 765, 765, 765, 765, 765, 679, 643, 642, 641, + 766, 640, 639, 638, 637, 636, 766, 766, 766, 766, + 766, 766, 767, 768, 768, 768, 768, 768, 768, 426, + 635, 634, 633, 769, 632, 631, 630, 629, 628, 769, + 769, 769, 769, 769, 769, 688, 780, 780, 780, 780, + + 780, 780, 780, 690, 627, 626, 625, 781, 441, 622, + 443, 437, 518, 781, 781, 781, 781, 781, 781, 782, + 783, 783, 783, 783, 783, 783, 426, 502, 509, 590, + 784, 581, 502, 581, 575, 575, 784, 784, 784, 784, + 784, 784, 620, 791, 791, 791, 791, 791, 791, 791, + 622, 568, 567, 566, 792, 565, 564, 563, 562, 561, + 792, 792, 792, 792, 792, 792, 793, 794, 794, 794, + 794, 794, 794, 794, 795, 560, 316, 225, 796, 559, + 797, 558, 557, 556, 796, 796, 796, 796, 796, 796, + 961, 962, 962, 962, 962, 962, 962, 965, 966, 966, + + 966, 966, 966, 966, 1035, 1035, 797, 55, 1045, 811, + 811, 811, 811, 811, 811, 811, 555, 554, 1036, 1437, + 811, 553, 1046, 552, 551, 55, 811, 811, 811, 811, + 811, 811, 812, 812, 812, 812, 812, 812, 812, 550, + 549, 548, 545, 812, 1036, 1437, 542, 541, 1046, 812, + 812, 812, 812, 812, 812, 813, 814, 814, 814, 814, + 814, 814, 540, 539, 538, 537, 815, 536, 55, 535, + 534, 533, 815, 815, 815, 815, 815, 815, 253, 816, + 816, 816, 816, 816, 816, 816, 55, 443, 265, 426, + 817, 343, 518, 502, 509, 1387, 817, 817, 817, 817, + + 817, 817, 53, 817, 817, 817, 817, 817, 817, 817, + 668, 820, 820, 820, 820, 820, 820, 820, 821, 426, + 506, 423, 822, 417, 672, 502, 500, 417, 822, 822, + 822, 822, 822, 822, 871, 871, 871, 871, 871, 871, + 871, 943, 943, 943, 943, 943, 943, 943, 1045, 409, + 672, 677, 823, 823, 823, 823, 823, 823, 823, 824, + 403, 1047, 1437, 825, 487, 681, 486, 1047, 1057, 825, + 825, 825, 825, 825, 825, 1048, 485, 484, 483, 482, + 481, 1437, 1058, 480, 479, 478, 477, 55, 1437, 1057, + 476, 681, 688, 826, 826, 826, 826, 826, 826, 826, + + 827, 1048, 475, 1437, 828, 55, 692, 1437, 1058, 1059, + 828, 828, 828, 828, 828, 828, 959, 959, 959, 959, + 959, 959, 959, 1060, 1386, 472, 471, 468, 1059, 1437, + 1177, 467, 692, 832, 833, 833, 833, 833, 833, 833, + 833, 834, 1437, 466, 1178, 835, 465, 836, 464, 1060, + 1177, 835, 835, 835, 835, 835, 835, 1069, 1070, 1070, + 1070, 1070, 1070, 1070, 1437, 114, 463, 462, 1437, 1179, + 1178, 1179, 453, 836, 668, 839, 839, 839, 839, 839, + 839, 839, 821, 1180, 452, 1437, 840, 451, 450, 449, + 1437, 448, 840, 840, 840, 840, 840, 840, 841, 842, + + 842, 842, 842, 842, 842, 842, 843, 447, 446, 1180, + 844, 1437, 845, 263, 443, 265, 844, 844, 844, 844, + 844, 844, 1072, 1073, 1073, 1073, 1073, 1073, 1073, 1076, + 1077, 1077, 1077, 1077, 1077, 1077, 1223, 426, 845, 677, + 850, 850, 850, 850, 850, 850, 850, 824, 345, 423, + 1224, 851, 417, 417, 410, 410, 402, 851, 851, 851, + 851, 851, 851, 852, 853, 853, 853, 853, 853, 853, + 853, 854, 55, 55, 1223, 855, 1224, 856, 395, 394, + 391, 855, 855, 855, 855, 855, 855, 390, 1437, 389, + 55, 55, 1119, 1120, 1120, 1120, 1120, 1120, 1120, 1228, + + 388, 1084, 1085, 856, 688, 862, 862, 862, 862, 862, + 862, 862, 827, 1229, 1437, 387, 863, 386, 385, 384, + 383, 382, 863, 863, 863, 863, 863, 863, 864, 865, + 865, 865, 865, 865, 865, 865, 866, 55, 1228, 1229, + 867, 381, 868, 380, 379, 55, 867, 867, 867, 867, + 867, 867, 1437, 378, 377, 55, 1125, 1126, 1126, 1126, + 1126, 1126, 1126, 55, 376, 1230, 1086, 375, 868, 793, + 879, 879, 879, 879, 879, 879, 879, 795, 1437, 1231, + 370, 880, 1415, 369, 298, 368, 1230, 880, 880, 880, + 880, 880, 880, 881, 882, 882, 882, 882, 882, 882, + + 1437, 367, 366, 365, 883, 1231, 364, 363, 357, 265, + 883, 883, 883, 883, 883, 883, 55, 1236, 896, 896, + 896, 896, 896, 896, 896, 345, 1437, 261, 342, 896, + 258, 1237, 338, 252, 55, 896, 896, 896, 896, 896, + 896, 897, 897, 897, 897, 897, 897, 897, 246, 137, + 326, 325, 897, 324, 319, 298, 318, 1237, 897, 897, + 897, 897, 897, 897, 575, 898, 898, 898, 898, 898, + 898, 898, 317, 316, 315, 314, 899, 313, 408, 312, + 311, 310, 899, 899, 899, 899, 899, 899, 1129, 1130, + 1130, 1130, 1130, 1130, 1130, 1135, 1136, 1136, 1136, 1136, + + 1136, 1136, 309, 1236, 408, 899, 899, 899, 899, 899, + 899, 899, 308, 307, 306, 305, 899, 1437, 304, 301, + 300, 299, 899, 899, 899, 899, 899, 899, 253, 900, + 900, 900, 900, 900, 900, 900, 298, 297, 296, 295, + 901, 294, 293, 1437, 292, 291, 901, 901, 901, 901, + 901, 901, 53, 901, 901, 901, 901, 901, 901, 901, + 904, 905, 905, 905, 905, 905, 905, 290, 289, 288, + 287, 906, 286, 285, 284, 283, 137, 906, 906, 906, + 906, 906, 906, 668, 753, 753, 753, 753, 753, 753, + 753, 821, 282, 281, 280, 754, 279, 278, 277, 276, + + 1238, 754, 754, 754, 754, 754, 754, 907, 908, 908, + 908, 908, 908, 908, 1239, 275, 274, 273, 909, 272, + 271, 270, 269, 268, 909, 909, 909, 909, 909, 909, + 677, 765, 765, 765, 765, 765, 765, 765, 824, 265, + 1239, 253, 766, 258, 245, 244, 243, 1238, 766, 766, + 766, 766, 766, 766, 910, 911, 911, 911, 911, 911, + 911, 1437, 242, 241, 240, 912, 239, 238, 237, 236, + 233, 912, 912, 912, 912, 912, 912, 688, 780, 780, + 780, 780, 780, 780, 780, 827, 230, 1437, 227, 781, + 226, 225, 224, 221, 1244, 781, 781, 781, 781, 781, + + 781, 913, 914, 914, 914, 914, 914, 914, 1245, 220, + 219, 218, 915, 217, 216, 215, 214, 213, 915, 915, + 915, 915, 915, 915, 919, 920, 920, 920, 920, 920, + 920, 426, 212, 211, 1245, 921, 210, 209, 208, 207, + 206, 921, 921, 921, 921, 921, 921, 832, 924, 924, + 924, 924, 924, 924, 924, 834, 202, 201, 191, 925, + 190, 189, 186, 185, 184, 925, 925, 925, 925, 925, + 925, 926, 927, 927, 927, 927, 927, 927, 426, 183, + 182, 181, 928, 180, 179, 175, 174, 173, 928, 928, + 928, 928, 928, 928, 841, 936, 936, 936, 936, 936, + + 936, 936, 843, 172, 171, 170, 937, 169, 168, 167, + 166, 165, 937, 937, 937, 937, 937, 937, 938, 939, + 939, 939, 939, 939, 939, 426, 164, 163, 162, 940, + 161, 160, 159, 154, 145, 940, 940, 940, 940, 940, + 940, 852, 951, 951, 951, 951, 951, 951, 951, 854, + 144, 139, 89, 952, 59, 47, 45, 1437, 1437, 952, + 952, 952, 952, 952, 952, 953, 954, 954, 954, 954, + 954, 954, 426, 1437, 1437, 1437, 955, 1437, 1437, 1437, + 1437, 1437, 955, 955, 955, 955, 955, 955, 864, 967, + 967, 967, 967, 967, 967, 967, 866, 1437, 1437, 1437, + + 968, 1437, 1437, 1437, 1437, 1437, 968, 968, 968, 968, + 968, 968, 969, 970, 970, 970, 970, 970, 970, 426, + 1437, 1437, 1437, 971, 1437, 1437, 1437, 1437, 1437, 971, + 971, 971, 971, 971, 971, 793, 978, 978, 978, 978, + 978, 978, 978, 795, 1437, 1437, 1437, 979, 1437, 1437, + 1437, 1437, 1437, 979, 979, 979, 979, 979, 979, 980, + 981, 981, 981, 981, 981, 981, 981, 982, 1437, 1437, + 1437, 983, 1437, 984, 1437, 1437, 1437, 983, 983, 983, + 983, 983, 983, 1138, 1139, 1139, 1139, 1139, 1139, 1139, + 1142, 1143, 1143, 1143, 1143, 1143, 1143, 1437, 1437, 984, + + 55, 575, 997, 997, 997, 997, 997, 997, 997, 1437, + 1437, 1437, 1437, 998, 1437, 1437, 1437, 1437, 55, 998, + 998, 998, 998, 998, 998, 53, 998, 998, 998, 998, + 998, 998, 998, 55, 253, 999, 999, 999, 999, 999, + 999, 999, 1149, 1150, 1150, 1150, 1150, 1150, 1150, 1437, + 1437, 55, 832, 1002, 1002, 1002, 1002, 1002, 1002, 1002, + 1003, 1437, 1437, 1437, 1004, 1437, 836, 1437, 1437, 1437, + 1004, 1004, 1004, 1004, 1004, 1004, 1152, 1153, 1153, 1153, + 1153, 1153, 1153, 1156, 1157, 1157, 1157, 1157, 1157, 1157, + 1437, 1437, 836, 841, 1005, 1005, 1005, 1005, 1005, 1005, + + 1005, 1006, 1437, 1437, 1437, 1007, 1437, 845, 1437, 1437, + 1437, 1007, 1007, 1007, 1007, 1007, 1007, 1163, 1164, 1164, + 1164, 1164, 1164, 1164, 1166, 1167, 1167, 1167, 1167, 1167, + 1167, 1437, 1437, 845, 852, 1008, 1008, 1008, 1008, 1008, + 1008, 1008, 1009, 1437, 1437, 1437, 1010, 1437, 856, 1437, + 1437, 1437, 1010, 1010, 1010, 1010, 1010, 1010, 1170, 1171, + 1171, 1171, 1171, 1171, 1171, 1070, 1070, 1070, 1070, 1070, + 1070, 1070, 55, 1437, 856, 864, 1011, 1011, 1011, 1011, + 1011, 1011, 1011, 1012, 1437, 1244, 1246, 1013, 1437, 868, + 55, 1437, 1437, 1013, 1013, 1013, 1013, 1013, 1013, 1437, + + 1247, 1193, 1215, 1216, 1216, 1216, 1216, 1216, 1216, 1437, + 1246, 1437, 1437, 1437, 1252, 868, 1015, 1016, 1016, 1016, + 1016, 1016, 1016, 1017, 1437, 1437, 1247, 1018, 1253, 1437, + 1437, 1437, 1437, 1018, 1018, 1018, 1018, 1018, 1018, 1019, + 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1021, 1437, 1437, + 1437, 1022, 1437, 1023, 1253, 1437, 1437, 1022, 1022, 1022, + 1022, 1022, 1022, 1136, 1136, 1136, 1136, 1136, 1136, 1136, + 1150, 1150, 1150, 1150, 1150, 1150, 1150, 1252, 1437, 1023, + 832, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1003, 1437, + 1437, 1437, 1027, 1437, 1437, 1437, 1437, 1437, 1027, 1027, + + 1027, 1027, 1027, 1027, 1028, 1029, 1029, 1029, 1029, 1029, + 1029, 1029, 1030, 1437, 1437, 1437, 1031, 1437, 1032, 1437, + 1437, 1254, 1031, 1031, 1031, 1031, 1031, 1031, 1164, 1164, + 1164, 1164, 1164, 1164, 1164, 1255, 1437, 1437, 1437, 1437, + 1254, 1437, 1286, 1437, 1032, 841, 1037, 1037, 1037, 1037, + 1037, 1037, 1037, 1006, 1437, 1437, 1287, 1038, 1437, 1437, + 1437, 1255, 1437, 1038, 1038, 1038, 1038, 1038, 1038, 1039, + 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1041, 1437, 1437, + 1437, 1042, 1287, 1043, 1437, 1437, 1437, 1042, 1042, 1042, + 1042, 1042, 1042, 1260, 1261, 1261, 1261, 1261, 1261, 1261, + + 1263, 1264, 1264, 1264, 1264, 1264, 1264, 1286, 1437, 1043, + 852, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1009, 1437, + 1437, 1437, 1050, 1437, 1437, 1437, 1437, 1437, 1050, 1050, + 1050, 1050, 1050, 1050, 1051, 1052, 1052, 1052, 1052, 1052, + 1052, 1052, 1053, 1437, 1437, 1437, 1054, 1437, 1055, 1437, + 1437, 1437, 1054, 1054, 1054, 1054, 1054, 1054, 1267, 1268, + 1268, 1268, 1268, 1268, 1268, 1292, 1293, 1293, 1293, 1293, + 1293, 1293, 1333, 1437, 1055, 864, 1061, 1061, 1061, 1061, + 1061, 1061, 1061, 1012, 1437, 1437, 1334, 1062, 1437, 1437, + 1437, 1437, 55, 1062, 1062, 1062, 1062, 1062, 1062, 1063, + + 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1065, 55, 1437, + 55, 1066, 1334, 1067, 1437, 1437, 1437, 1066, 1066, 1066, + 1066, 1066, 1066, 1275, 1437, 1437, 55, 1297, 1298, 1298, + 1298, 1298, 1298, 1298, 1437, 1437, 1333, 1276, 1437, 1067, + 980, 1078, 1078, 1078, 1078, 1078, 1078, 1078, 982, 1437, + 1437, 1437, 1079, 1437, 1437, 1437, 1437, 1335, 1079, 1079, + 1079, 1079, 1079, 1079, 1080, 1081, 1081, 1081, 1081, 1081, + 1081, 1336, 1437, 1437, 1437, 1082, 1437, 1437, 1437, 1437, + 1437, 1082, 1082, 1082, 1082, 1082, 1082, 55, 575, 1094, + 1094, 1094, 1094, 1094, 1094, 1094, 1437, 1336, 1437, 1437, + + 901, 1437, 1437, 1437, 1437, 55, 901, 901, 901, 901, + 901, 901, 53, 901, 901, 901, 901, 901, 901, 901, + 55, 253, 999, 999, 999, 999, 999, 999, 999, 1300, + 1301, 1301, 1301, 1301, 1301, 1301, 1437, 1335, 55, 1097, + 1098, 1098, 1098, 1098, 1098, 1098, 1437, 1437, 1437, 1437, + 1099, 1437, 1437, 1437, 1437, 1437, 1099, 1099, 1099, 1099, + 1099, 1099, 832, 924, 924, 924, 924, 924, 924, 924, + 1003, 1437, 1437, 1437, 925, 1437, 1437, 1437, 1437, 1358, + 925, 925, 925, 925, 925, 925, 1100, 1101, 1101, 1101, + 1101, 1101, 1101, 1359, 1437, 1437, 1437, 1102, 1437, 1437, + + 1437, 1437, 1437, 1102, 1102, 1102, 1102, 1102, 1102, 841, + 936, 936, 936, 936, 936, 936, 936, 1006, 1437, 1359, + 1437, 937, 1437, 1437, 1437, 1437, 1358, 937, 937, 937, + 937, 937, 937, 1103, 1104, 1104, 1104, 1104, 1104, 1104, + 1437, 1437, 1437, 1437, 1105, 1437, 1437, 1437, 1437, 1437, + 1105, 1105, 1105, 1105, 1105, 1105, 852, 951, 951, 951, + 951, 951, 951, 951, 1009, 1437, 1437, 1437, 952, 1437, + 1437, 1437, 1437, 1362, 952, 952, 952, 952, 952, 952, + 1106, 1107, 1107, 1107, 1107, 1107, 1107, 1363, 1437, 1437, + 1437, 1108, 1437, 1437, 1437, 1437, 1437, 1108, 1108, 1108, + + 1108, 1108, 1108, 864, 967, 967, 967, 967, 967, 967, + 967, 1012, 1437, 1363, 1437, 968, 1437, 1437, 1437, 1437, + 1362, 968, 968, 968, 968, 968, 968, 1109, 1110, 1110, + 1110, 1110, 1110, 1110, 1437, 1437, 1437, 1437, 1111, 1437, + 1437, 1437, 1437, 1437, 1111, 1111, 1111, 1111, 1111, 1111, + 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1115, 1437, + 1437, 1437, 1116, 1437, 1117, 1437, 1437, 1437, 1116, 1116, + 1116, 1116, 1116, 1116, 1306, 1307, 1307, 1307, 1307, 1307, + 1307, 1309, 1310, 1310, 1310, 1310, 1310, 1310, 1366, 1437, + 1117, 1019, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1021, + + 1437, 1437, 1367, 1122, 1437, 1437, 1437, 1437, 1437, 1122, + 1122, 1122, 1122, 1122, 1122, 1028, 1131, 1131, 1131, 1131, + 1131, 1131, 1131, 1030, 1437, 1437, 1437, 1132, 1367, 1437, + 1437, 1437, 1437, 1132, 1132, 1132, 1132, 1132, 1132, 1039, + 1144, 1144, 1144, 1144, 1144, 1144, 1144, 1041, 1437, 1437, + 1437, 1145, 1437, 1437, 1437, 1437, 1437, 1145, 1145, 1145, + 1145, 1145, 1145, 1051, 1158, 1158, 1158, 1158, 1158, 1158, + 1158, 1053, 1437, 1437, 1437, 1159, 1437, 1437, 1437, 1437, + 1437, 1159, 1159, 1159, 1159, 1159, 1159, 1063, 1172, 1172, + 1172, 1172, 1172, 1172, 1172, 1065, 1437, 1437, 1437, 1173, + + 1437, 1437, 1437, 1437, 1437, 1173, 1173, 1173, 1173, 1173, + 1173, 980, 1181, 1181, 1181, 1181, 1181, 1181, 1181, 982, + 1437, 1437, 1437, 1182, 1437, 1437, 1437, 1437, 1437, 1182, + 1182, 1182, 1182, 1182, 1182, 1183, 1184, 1184, 1184, 1184, + 1184, 1184, 1184, 1185, 1437, 1437, 1437, 1186, 1437, 1187, + 1437, 1437, 1437, 1186, 1186, 1186, 1186, 1186, 1186, 1315, + 1316, 1316, 1316, 1316, 1316, 1316, 1318, 1319, 1319, 1319, + 1319, 1319, 1319, 1437, 1437, 1187, 55, 575, 492, 492, + 492, 492, 492, 492, 492, 1324, 1325, 1325, 1325, 1325, + 1325, 1325, 1437, 1366, 55, 1196, 1197, 1197, 1197, 1197, + + 1197, 1197, 1198, 1437, 1437, 1437, 1199, 1437, 1437, 1437, + 1437, 1437, 1199, 1199, 1199, 1199, 1199, 1199, 1019, 1200, + 1200, 1200, 1200, 1200, 1200, 1200, 1201, 1437, 1437, 1437, + 1202, 1437, 1023, 1437, 1437, 1437, 1202, 1202, 1202, 1202, + 1202, 1202, 1327, 1328, 1328, 1328, 1328, 1328, 1328, 1261, + 1261, 1261, 1261, 1261, 1261, 1261, 1437, 1437, 1023, 1028, + 1203, 1203, 1203, 1203, 1203, 1203, 1203, 1204, 1437, 1437, + 1437, 1205, 1437, 1032, 1437, 1437, 1437, 1205, 1205, 1205, + 1205, 1205, 1205, 1352, 1353, 1353, 1353, 1353, 1353, 1353, + 1298, 1298, 1298, 1298, 1298, 1298, 1298, 1437, 1437, 1032, + + 1039, 1206, 1206, 1206, 1206, 1206, 1206, 1206, 1207, 1437, + 1437, 1437, 1208, 1437, 1043, 1437, 1437, 1437, 1208, 1208, + 1208, 1208, 1208, 1208, 1307, 1307, 1307, 1307, 1307, 1307, + 1307, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1370, 1437, + 1043, 1051, 1209, 1209, 1209, 1209, 1209, 1209, 1209, 1210, + 1437, 1370, 1371, 1211, 1437, 1055, 1437, 1437, 1437, 1211, + 1211, 1211, 1211, 1211, 1211, 1437, 1325, 1325, 1325, 1325, + 1325, 1325, 1325, 1437, 1437, 1437, 1437, 1437, 1371, 1374, + 1437, 1055, 1063, 1212, 1212, 1212, 1212, 1212, 1212, 1212, + 1213, 1437, 1374, 1375, 1214, 1437, 1067, 1437, 1437, 1437, + + 1214, 1214, 1214, 1214, 1214, 1214, 1437, 1378, 1379, 1379, + 1379, 1379, 1379, 1379, 1437, 1437, 1437, 1437, 1437, 1375, + 1390, 1437, 1067, 1113, 1217, 1217, 1217, 1217, 1217, 1217, + 1217, 1115, 1437, 1437, 1391, 1218, 1437, 1437, 1437, 1437, + 1437, 1218, 1218, 1218, 1218, 1218, 1218, 1019, 1225, 1225, + 1225, 1225, 1225, 1225, 1225, 1201, 1437, 1437, 1437, 1226, + 1391, 1437, 1437, 1437, 1437, 1226, 1226, 1226, 1226, 1226, + 1226, 1028, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1204, + 1437, 1437, 1437, 1233, 1437, 1437, 1437, 1437, 1437, 1233, + 1233, 1233, 1233, 1233, 1233, 1039, 1240, 1240, 1240, 1240, + + 1240, 1240, 1240, 1207, 1437, 1437, 1437, 1241, 1437, 1437, + 1437, 1437, 1437, 1241, 1241, 1241, 1241, 1241, 1241, 1051, + 1248, 1248, 1248, 1248, 1248, 1248, 1248, 1210, 1437, 1437, + 1437, 1249, 1437, 1437, 1437, 1437, 1437, 1249, 1249, 1249, + 1249, 1249, 1249, 1063, 1256, 1256, 1256, 1256, 1256, 1256, + 1256, 1213, 1437, 1437, 1437, 1257, 1437, 1437, 1437, 1437, + 1437, 1257, 1257, 1257, 1257, 1257, 1257, 1183, 1269, 1269, + 1269, 1269, 1269, 1269, 1269, 1185, 1437, 1437, 1437, 1270, + 1437, 1437, 1437, 1437, 1437, 1270, 1270, 1270, 1270, 1270, + 1270, 1113, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1278, + + 1437, 1437, 1437, 1279, 1437, 1117, 1437, 1437, 1390, 1279, + 1279, 1279, 1279, 1279, 1279, 1381, 1382, 1382, 1382, 1382, + 1382, 1382, 1437, 1392, 1393, 1393, 1393, 1393, 1393, 1393, + 1437, 1117, 1019, 1121, 1121, 1121, 1121, 1121, 1121, 1121, + 1201, 1437, 1437, 1437, 1122, 1437, 1437, 1437, 1437, 1437, + 1122, 1122, 1122, 1122, 1122, 1122, 1028, 1131, 1131, 1131, + 1131, 1131, 1131, 1131, 1204, 1437, 1437, 1437, 1132, 1437, + 1437, 1437, 1437, 1437, 1132, 1132, 1132, 1132, 1132, 1132, + 1039, 1144, 1144, 1144, 1144, 1144, 1144, 1144, 1207, 1437, + 1437, 1437, 1145, 1437, 1437, 1437, 1437, 1437, 1145, 1145, + + 1145, 1145, 1145, 1145, 1051, 1158, 1158, 1158, 1158, 1158, + 1158, 1158, 1210, 1437, 1437, 1437, 1159, 1437, 1437, 1437, + 1437, 1437, 1159, 1159, 1159, 1159, 1159, 1159, 1063, 1172, + 1172, 1172, 1172, 1172, 1172, 1172, 1213, 1437, 1437, 1437, + 1173, 1437, 1437, 1437, 1437, 1437, 1173, 1173, 1173, 1173, + 1173, 1173, 1113, 1288, 1288, 1288, 1288, 1288, 1288, 1288, + 1278, 1437, 1437, 1437, 1289, 1437, 1437, 1437, 1437, 1437, + 1289, 1289, 1289, 1289, 1289, 1289, 1183, 1337, 1337, 1337, + 1337, 1337, 1337, 1337, 1185, 1437, 1437, 1437, 1338, 1437, + 1437, 1437, 1437, 1437, 1338, 1338, 1338, 1338, 1338, 1338, + + 1113, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1278, 1437, + 1437, 1437, 1218, 1437, 1437, 1437, 1437, 1437, 1218, 1218, + 1218, 1218, 1218, 1218, 1396, 1397, 1397, 1397, 1397, 1397, + 1397, 1400, 1401, 1401, 1401, 1401, 1401, 1401, 1404, 1405, + 1405, 1405, 1405, 1405, 1405, 1408, 1409, 1409, 1409, 1409, + 1409, 1409, 1379, 1379, 1379, 1379, 1379, 1379, 1379, 1412, + 1412, 1416, 1417, 1417, 1417, 1417, 1417, 1417, 1437, 1437, + 1437, 1437, 1437, 1413, 1437, 1393, 1393, 1393, 1393, 1393, + 1393, 1393, 1397, 1397, 1397, 1397, 1397, 1397, 1397, 1401, + 1401, 1401, 1401, 1401, 1401, 1401, 1437, 1437, 1437, 1413, + + 1437, 1405, 1405, 1405, 1405, 1405, 1405, 1405, 1409, 1409, + 1409, 1409, 1409, 1409, 1409, 1425, 1426, 1426, 1426, 1426, + 1426, 1426, 1417, 1417, 1417, 1417, 1417, 1417, 1417, 1426, + 1426, 1426, 1426, 1426, 1426, 1426, 46, 1437, 1437, 1437, + 1437, 46, 46, 46, 64, 1437, 64, 64, 64, 64, + 64, 64, 64, 146, 1437, 146, 153, 153, 153, 257, + 257, 257, 266, 266, 266, 337, 337, 337, 340, 340, + 340, 341, 341, 341, 348, 348, 348, 346, 346, 346, + 352, 352, 352, 356, 1437, 356, 416, 416, 416, 421, + 421, 421, 422, 422, 422, 431, 431, 431, 435, 1437, + + 435, 436, 436, 436, 350, 350, 1437, 1437, 350, 440, + 440, 440, 444, 444, 444, 340, 340, 340, 499, 499, + 499, 503, 503, 503, 504, 504, 504, 505, 505, 505, + 348, 348, 348, 510, 510, 510, 429, 429, 1437, 1437, + 429, 515, 515, 515, 519, 519, 519, 523, 1437, 523, + 524, 524, 524, 528, 528, 528, 532, 1437, 532, 580, + 580, 580, 431, 431, 431, 588, 588, 588, 589, 589, + 589, 597, 597, 597, 601, 1437, 601, 604, 1437, 604, + 605, 605, 605, 609, 609, 609, 613, 1437, 613, 522, + 522, 1437, 1437, 522, 526, 526, 1437, 1437, 526, 619, + + 619, 619, 623, 623, 623, 532, 532, 1437, 532, 504, + 504, 504, 657, 657, 657, 661, 661, 661, 664, 664, + 664, 665, 665, 665, 666, 666, 666, 671, 671, 671, + 595, 595, 1437, 1437, 595, 676, 676, 676, 680, 680, + 680, 601, 601, 1437, 601, 603, 603, 1437, 1437, 603, + 604, 604, 1437, 604, 605, 605, 607, 607, 1437, 1437, + 607, 687, 687, 687, 691, 691, 691, 613, 613, 1437, + 613, 695, 1437, 695, 698, 1437, 698, 699, 699, 699, + 703, 703, 703, 707, 1437, 707, 734, 734, 734, 597, + 597, 597, 609, 609, 609, 745, 745, 745, 746, 746, + + 746, 754, 754, 754, 758, 1437, 758, 761, 1437, 761, + 762, 762, 762, 766, 766, 766, 770, 1437, 770, 773, + 1437, 773, 776, 1437, 776, 777, 777, 777, 781, 781, + 781, 785, 1437, 785, 694, 1437, 1437, 694, 695, 695, + 1437, 695, 697, 697, 1437, 1437, 697, 698, 698, 1437, + 698, 699, 699, 701, 701, 1437, 1437, 701, 792, 792, + 792, 796, 796, 796, 707, 707, 1437, 707, 53, 53, + 53, 1437, 53, 53, 665, 665, 665, 818, 818, 818, + 822, 822, 822, 825, 825, 825, 828, 828, 828, 829, + 829, 829, 830, 830, 830, 835, 835, 835, 752, 752, + + 1437, 1437, 752, 840, 840, 840, 844, 844, 844, 758, + 758, 1437, 758, 760, 760, 1437, 1437, 760, 761, 761, + 1437, 761, 762, 762, 764, 764, 1437, 1437, 764, 851, + 851, 851, 855, 855, 855, 770, 770, 1437, 770, 772, + 1437, 1437, 772, 773, 773, 1437, 773, 775, 775, 1437, + 1437, 775, 776, 776, 1437, 776, 777, 777, 779, 779, + 1437, 1437, 779, 863, 863, 863, 867, 867, 867, 785, + 785, 1437, 785, 869, 1437, 869, 872, 1437, 872, 875, + 1437, 875, 876, 876, 876, 880, 880, 880, 884, 1437, + 884, 53, 53, 53, 1437, 53, 53, 902, 902, 902, + + 754, 754, 754, 766, 766, 766, 781, 781, 781, 916, + 916, 916, 917, 917, 917, 925, 925, 925, 929, 1437, + 929, 932, 1437, 932, 933, 933, 933, 937, 937, 937, + 941, 1437, 941, 944, 1437, 944, 947, 1437, 947, 948, + 948, 948, 952, 952, 952, 956, 1437, 956, 957, 1437, + 957, 960, 1437, 960, 963, 1437, 963, 964, 964, 964, + 968, 968, 968, 972, 1437, 972, 869, 1437, 869, 871, + 1437, 1437, 871, 872, 872, 1437, 872, 874, 874, 1437, + 1437, 874, 875, 875, 1437, 875, 876, 876, 878, 878, + 1437, 1437, 878, 979, 979, 979, 983, 983, 983, 884, + + 884, 1437, 884, 53, 53, 53, 1437, 53, 53, 829, + 829, 829, 1000, 1000, 1000, 1004, 1004, 1004, 1007, 1007, + 1007, 1010, 1010, 1010, 1013, 1013, 1013, 1014, 1014, 1014, + 1022, 1022, 1022, 923, 923, 1437, 1437, 923, 1027, 1027, + 1027, 1031, 1031, 1031, 929, 929, 1437, 929, 931, 931, + 1437, 1437, 931, 932, 932, 1437, 932, 933, 933, 935, + 935, 1437, 1437, 935, 1038, 1038, 1038, 1042, 1042, 1042, + 941, 941, 1437, 941, 943, 1437, 1437, 943, 944, 944, + 1437, 944, 946, 946, 1437, 1437, 946, 947, 947, 1437, + 947, 948, 948, 950, 950, 1437, 1437, 950, 1050, 1050, + + 1050, 1054, 1054, 1054, 956, 956, 1437, 956, 957, 1437, + 957, 959, 1437, 1437, 959, 960, 960, 1437, 960, 962, + 962, 1437, 1437, 962, 963, 963, 1437, 963, 964, 964, + 966, 966, 1437, 1437, 966, 1062, 1062, 1062, 1066, 1066, + 1066, 972, 972, 1437, 972, 1068, 1437, 1068, 1071, 1437, + 1071, 1074, 1437, 1074, 1075, 1075, 1075, 1079, 1079, 1079, + 1083, 1437, 1083, 53, 53, 53, 1437, 53, 53, 1095, + 1095, 1095, 925, 925, 925, 937, 937, 937, 952, 952, + 952, 968, 968, 968, 1112, 1112, 1112, 1118, 1118, 1118, + 1116, 1116, 1116, 1123, 1123, 1123, 1122, 1122, 1122, 1124, + + 1437, 1124, 1127, 1437, 1127, 1128, 1128, 1128, 1133, 1133, + 1133, 1132, 1132, 1132, 1134, 1437, 1134, 1137, 1437, 1137, + 1140, 1437, 1140, 1141, 1141, 1141, 1146, 1146, 1146, 1145, + 1145, 1145, 1147, 1437, 1147, 1148, 1437, 1148, 1151, 1437, + 1151, 1154, 1437, 1154, 1155, 1155, 1155, 1160, 1160, 1160, + 1159, 1159, 1159, 1161, 1437, 1161, 1162, 1437, 1162, 1165, + 1437, 1165, 1168, 1437, 1168, 1169, 1169, 1169, 1174, 1174, + 1174, 1173, 1173, 1173, 1175, 1437, 1175, 1068, 1437, 1068, + 1070, 1437, 1437, 1070, 1071, 1071, 1437, 1071, 1073, 1073, + 1437, 1437, 1073, 1074, 1074, 1437, 1074, 1075, 1075, 1077, + + 1077, 1437, 1437, 1077, 1182, 1182, 1182, 1186, 1186, 1186, + 1083, 1083, 1437, 1083, 53, 53, 53, 1437, 53, 53, + 1014, 1014, 1014, 1202, 1202, 1202, 1205, 1205, 1205, 1208, + 1208, 1208, 1211, 1211, 1211, 1214, 1214, 1214, 1219, 1219, + 1219, 1218, 1218, 1218, 1221, 1437, 1221, 1222, 1222, 1222, + 1120, 1120, 1437, 1437, 1120, 1226, 1226, 1226, 1227, 1227, + 1227, 1124, 1124, 1437, 1124, 1126, 1126, 1437, 1437, 1126, + 1127, 1127, 1437, 1127, 1128, 1128, 1130, 1130, 1437, 1437, + 1130, 1233, 1233, 1233, 1234, 1234, 1234, 1134, 1134, 1437, + 1134, 1136, 1437, 1437, 1136, 1137, 1137, 1437, 1137, 1139, + + 1139, 1437, 1437, 1139, 1140, 1140, 1437, 1140, 1141, 1141, + 1143, 1143, 1437, 1437, 1143, 1241, 1241, 1241, 1242, 1242, + 1242, 1147, 1147, 1437, 1147, 1148, 1437, 1148, 1150, 1437, + 1437, 1150, 1151, 1151, 1437, 1151, 1153, 1153, 1437, 1437, + 1153, 1154, 1154, 1437, 1154, 1155, 1155, 1157, 1157, 1437, + 1437, 1157, 1249, 1249, 1249, 1250, 1250, 1250, 1161, 1161, + 1437, 1161, 1162, 1437, 1162, 1164, 1437, 1437, 1164, 1165, + 1165, 1437, 1165, 1167, 1167, 1437, 1437, 1167, 1168, 1168, + 1437, 1168, 1169, 1169, 1171, 1171, 1437, 1437, 1171, 1257, + 1257, 1257, 1258, 1258, 1258, 1175, 1175, 1437, 1175, 1259, + + 1437, 1259, 1262, 1437, 1262, 1265, 1437, 1265, 1266, 1266, + 1266, 1271, 1437, 1271, 1270, 1270, 1270, 1272, 1437, 1272, + 53, 53, 53, 1437, 53, 53, 1280, 1437, 1280, 1279, + 1279, 1279, 1281, 1437, 1281, 1122, 1122, 1122, 1282, 1437, + 1282, 1132, 1132, 1132, 1283, 1437, 1283, 1145, 1145, 1145, + 1284, 1437, 1284, 1159, 1159, 1159, 1285, 1437, 1285, 1173, + 1173, 1173, 1216, 1216, 1437, 1437, 1216, 1289, 1289, 1289, + 1290, 1290, 1290, 348, 348, 348, 1221, 1221, 1437, 1221, + 1291, 1291, 1291, 1294, 1437, 1294, 1295, 1295, 1295, 1296, + 1296, 1296, 1299, 1437, 1299, 1302, 1437, 1302, 1303, 1303, + + 1303, 1304, 1304, 1304, 1305, 1437, 1305, 1308, 1437, 1308, + 1311, 1437, 1311, 1312, 1312, 1312, 1313, 1313, 1313, 1314, + 1437, 1314, 1317, 1437, 1317, 1320, 1437, 1320, 1321, 1321, + 1321, 1322, 1322, 1322, 1323, 1437, 1323, 1326, 1437, 1326, + 1329, 1437, 1329, 1330, 1330, 1330, 1331, 1331, 1331, 1259, + 1437, 1259, 1261, 1437, 1437, 1261, 1262, 1262, 1437, 1262, + 1264, 1264, 1437, 1437, 1264, 1265, 1265, 1437, 1265, 1266, + 1266, 1268, 1268, 1437, 1437, 1268, 1338, 1338, 1338, 1339, + 1437, 1339, 1272, 1272, 1437, 1272, 53, 53, 53, 1437, + 53, 53, 1344, 1344, 1344, 1218, 1218, 1218, 1346, 1437, + + 1346, 1347, 1437, 1347, 1348, 1437, 1348, 1349, 1437, 1349, + 1350, 1437, 1350, 1351, 1437, 1351, 1354, 1437, 1354, 1355, + 1355, 1355, 1356, 1356, 1356, 1357, 1437, 1357, 1293, 1293, + 1437, 1437, 1293, 1294, 1294, 1437, 1294, 1295, 1295, 1360, + 1437, 1360, 1298, 1437, 1437, 1298, 1299, 1299, 1437, 1299, + 1301, 1301, 1437, 1437, 1301, 1302, 1302, 1437, 1302, 1303, + 1303, 1364, 1437, 1364, 1305, 1437, 1305, 1307, 1437, 1437, + 1307, 1308, 1308, 1437, 1308, 1310, 1310, 1437, 1437, 1310, + 1311, 1311, 1437, 1311, 1312, 1312, 1368, 1437, 1368, 1314, + 1437, 1314, 1316, 1437, 1437, 1316, 1317, 1317, 1437, 1317, + + 1319, 1319, 1437, 1437, 1319, 1320, 1320, 1437, 1320, 1321, + 1321, 1372, 1437, 1372, 1323, 1437, 1323, 1325, 1437, 1437, + 1325, 1326, 1326, 1437, 1326, 1328, 1328, 1437, 1437, 1328, + 1329, 1329, 1437, 1329, 1330, 1330, 1376, 1437, 1376, 1377, + 1437, 1377, 1380, 1437, 1380, 1383, 1437, 1383, 1384, 1384, + 1384, 1385, 1437, 1385, 53, 53, 53, 1437, 53, 53, + 1389, 1437, 1389, 1291, 1437, 1291, 1296, 1437, 1296, 1304, + 1437, 1304, 1313, 1437, 1313, 1322, 1437, 1322, 1331, 1437, + 1331, 1353, 1353, 1437, 1437, 1353, 1354, 1354, 1437, 1354, + 1355, 1355, 1345, 1437, 1345, 1394, 1437, 1394, 1395, 1437, + + 1395, 1398, 1437, 1398, 1399, 1437, 1399, 1402, 1437, 1402, + 1403, 1437, 1403, 1406, 1437, 1406, 1407, 1437, 1407, 1410, + 1437, 1410, 1379, 1437, 1437, 1379, 1382, 1382, 1437, 1437, + 1382, 1414, 1437, 1414, 1356, 1437, 1356, 1418, 1437, 1418, + 1393, 1437, 1437, 1393, 1397, 1437, 1437, 1397, 1401, 1437, + 1437, 1401, 1405, 1437, 1437, 1405, 1409, 1437, 1437, 1409, + 1424, 1437, 1424, 1427, 1437, 1427, 1417, 1437, 1437, 1417, + 1429, 1437, 1429, 1430, 1437, 1430, 1431, 1437, 1431, 1432, + 1437, 1432, 1433, 1437, 1433, 1426, 1437, 1437, 1426, 1435, + 1437, 1435, 1436, 1437, 1436, 3, 1437, 1437, 1437, 1437, + + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437 } ; -static yyconst flex_int16_t yy_chk[7455] = +static yyconst flex_int16_t yy_chk[7450] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1867,819 +1859,818 @@ static yyconst flex_int16_t yy_chk[7455] = 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, 1261, 9, 4, - 7, 15, 12, 39, 131, 12, 9, 12, 24, 23, - 12, 23, 23, 28, 131, 24, 23, 39, 28, 25, + 19, 4, 7, 34, 24, 27, 27, 100, 9, 4, + 7, 15, 12, 100, 128, 12, 9, 12, 24, 23, + 12, 23, 23, 26, 28, 24, 23, 26, 1258, 28, - 12, 23, 25, 29, 39, 23, 25, 23, 12, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 29, - 91, 1262, 14, 14, 14, 91, 82, 14, 14, 14, + 12, 23, 128, 26, 29, 23, 26, 23, 12, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 627, + 29, 92, 14, 14, 14, 627, 92, 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, 82, 26, 16, 95, 16, 26, 82, - 16, 100, 99, 122, 26, 628, 100, 26, 99, 22, - 16, 234, 22, 234, 22, 628, 122, 22, 16, 20, - 20, 20, 20, 20, 20, 20, 20, 22, 33, 95, - 384, 36, 33, 20, 35, 22, 36, 36, 127, 36, - - 36, 33, 33, 41, 384, 33, 35, 33, 35, 103, - 35, 41, 103, 35, 103, 41, 127, 41, 1266, 20, + 14, 14, 16, 36, 25, 16, 132, 16, 36, 36, + 16, 36, 36, 101, 25, 96, 132, 25, 101, 22, + 16, 25, 22, 39, 22, 39, 238, 22, 16, 20, + 20, 20, 20, 20, 20, 20, 20, 22, 33, 39, + 1262, 123, 33, 20, 35, 22, 39, 1265, 96, 37, + + 238, 33, 33, 37, 123, 33, 35, 33, 35, 104, + 35, 37, 104, 35, 104, 237, 37, 237, 37, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 32, 32, 96, 21, 1268, 147, 250, 250, 129, 21, - 21, 21, 21, 21, 21, 31, 32, 129, 31, 31, - 32, 31, 155, 31, 32, 31, 32, 31, 37, 96, - 31, 147, 37, 32, 96, 623, 38, 1274, 313, 627, - 37, 623, 38, 313, 38, 37, 38, 37, 155, 235, - 38, 44, 38, 38, 44, 205, 44, 627, 381, 44, - 62, 62, 62, 62, 62, 62, 62, 63, 205, 44, - - 63, 381, 63, 235, 630, 63, 630, 44, 48, 48, - 48, 48, 48, 48, 48, 63, 435, 257, 631, 48, - 406, 406, 631, 63, 435, 48, 48, 48, 48, 48, - 48, 49, 49, 49, 49, 49, 49, 49, 1275, 325, - 1285, 350, 49, 257, 267, 267, 267, 267, 49, 49, - 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, - 50, 50, 454, 1286, 267, 325, 50, 350, 408, 415, - 1290, 454, 50, 50, 50, 50, 50, 50, 52, 52, - 52, 52, 52, 52, 52, 52, 54, 54, 54, 54, - 54, 54, 54, 421, 408, 415, 329, 54, 529, 529, - - 529, 529, 429, 54, 54, 54, 54, 54, 54, 56, - 329, 624, 56, 1291, 56, 345, 624, 56, 346, 421, - 56, 56, 56, 56, 56, 56, 56, 56, 429, 345, - 1295, 56, 346, 486, 1298, 56, 329, 56, 56, 56, - 56, 56, 56, 145, 456, 145, 145, 145, 145, 145, - 145, 145, 510, 456, 1299, 345, 145, 526, 346, 486, - 510, 632, 145, 145, 145, 145, 145, 145, 146, 146, - 146, 146, 146, 146, 146, 146, 520, 571, 571, 632, - 146, 579, 146, 526, 520, 1304, 146, 146, 146, 146, - 146, 146, 249, 249, 249, 249, 249, 249, 249, 260, - - 260, 260, 260, 260, 260, 260, 424, 579, 146, 148, - 148, 148, 148, 148, 148, 148, 148, 582, 588, 1307, - 424, 148, 595, 607, 622, 622, 1308, 148, 148, 148, - 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 614, 582, 588, 149, 424, 648, 595, 607, - 614, 149, 149, 149, 149, 149, 149, 150, 150, 150, - 150, 150, 150, 150, 150, 152, 152, 152, 152, 152, - 152, 152, 152, 648, 625, 689, 152, 625, 641, 641, - 704, 706, 152, 152, 152, 152, 152, 152, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 671, 704, 706, - - 154, 689, 154, 650, 283, 671, 154, 154, 154, 154, - 154, 154, 283, 335, 335, 335, 335, 335, 335, 335, - 1313, 1316, 425, 633, 490, 283, 707, 718, 154, 243, - 243, 243, 243, 243, 243, 243, 425, 633, 490, 650, - 243, 283, 705, 1317, 707, 718, 243, 243, 243, 243, - 243, 243, 245, 245, 245, 245, 245, 245, 245, 626, - 705, 707, 425, 245, 490, 701, 733, 705, 626, 245, - 245, 245, 245, 245, 245, 246, 246, 246, 246, 246, - 246, 246, 246, 248, 248, 248, 248, 248, 248, 248, - 682, 701, 733, 1322, 248, 736, 712, 716, 682, 713, - - 248, 248, 248, 248, 248, 248, 251, 251, 251, 251, - 251, 251, 251, 251, 712, 716, 716, 713, 251, 712, - 713, 736, 1325, 1326, 251, 251, 251, 251, 251, 251, - 253, 253, 253, 253, 253, 253, 253, 253, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 787, 318, 517, - 256, 1334, 256, 318, 1350, 787, 256, 256, 256, 256, - 256, 256, 318, 517, 318, 318, 739, 318, 339, 339, - 339, 339, 339, 339, 339, 719, 518, 708, 256, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 1351, 517, - 518, 261, 739, 719, 1376, 708, 521, 261, 261, 261, - - 261, 261, 261, 262, 262, 262, 262, 262, 262, 262, - 521, 1379, 708, 1390, 262, 1394, 518, 714, 1398, 717, - 262, 262, 262, 262, 262, 262, 323, 522, 323, 323, - 323, 323, 323, 323, 323, 714, 521, 717, 714, 323, - 717, 522, 723, 725, 725, 323, 323, 323, 323, 323, - 323, 324, 324, 324, 324, 324, 324, 324, 324, 1402, - 723, 725, 1406, 324, 1414, 324, 1423, 522, 1258, 324, - 324, 324, 324, 324, 324, 405, 405, 405, 405, 405, - 405, 405, 433, 433, 433, 433, 433, 433, 433, 590, - 640, 324, 326, 326, 326, 326, 326, 326, 326, 326, - - 640, 1254, 745, 590, 326, 752, 764, 794, 1253, 591, - 326, 326, 326, 326, 326, 326, 330, 330, 330, 330, - 330, 330, 330, 591, 767, 794, 779, 330, 745, 590, - 795, 752, 764, 330, 330, 330, 330, 330, 330, 331, - 331, 331, 331, 331, 331, 331, 331, 835, 795, 591, - 767, 331, 779, 795, 810, 835, 1246, 331, 331, 331, - 331, 331, 331, 332, 332, 332, 332, 332, 332, 332, - 332, 334, 334, 334, 334, 334, 334, 334, 1245, 846, - 810, 1238, 334, 1237, 796, 797, 799, 846, 334, 334, - 334, 334, 334, 334, 338, 338, 338, 338, 338, 338, - - 338, 338, 796, 797, 799, 338, 1230, 796, 797, 799, - 801, 338, 338, 338, 338, 338, 338, 340, 340, 340, - 340, 340, 340, 340, 340, 340, 858, 1229, 801, 340, - 866, 802, 804, 801, 858, 340, 340, 340, 340, 340, - 340, 341, 341, 341, 341, 341, 341, 341, 341, 802, - 804, 878, 341, 804, 802, 806, 866, 885, 341, 341, - 341, 341, 341, 341, 347, 347, 347, 347, 347, 347, - 347, 347, 347, 806, 1223, 885, 347, 878, 885, 890, - 888, 891, 347, 347, 347, 347, 347, 347, 349, 349, - 349, 349, 349, 349, 349, 349, 349, 890, 888, 891, - - 349, 901, 349, 888, 904, 890, 349, 349, 349, 349, - 349, 349, 437, 437, 437, 437, 437, 437, 437, 503, - 503, 503, 503, 503, 503, 503, 1222, 901, 349, 367, - 904, 907, 1218, 367, 910, 892, 367, 893, 598, 367, - 599, 367, 367, 367, 367, 399, 399, 399, 399, 399, - 399, 399, 598, 892, 599, 893, 399, 907, 897, 984, - 910, 636, 399, 399, 399, 399, 399, 399, 401, 401, - 401, 401, 401, 401, 401, 636, 897, 984, 598, 401, - 599, 916, 923, 935, 1217, 401, 401, 401, 401, 401, - 401, 402, 402, 402, 402, 402, 402, 402, 402, 404, - - 404, 404, 404, 404, 404, 404, 938, 916, 923, 935, - 404, 950, 954, 966, 1216, 992, 404, 404, 404, 404, - 404, 404, 407, 407, 407, 407, 407, 407, 407, 407, - 1215, 1214, 938, 992, 407, 1210, 407, 950, 954, 966, - 407, 407, 407, 407, 407, 407, 508, 508, 508, 508, - 508, 508, 508, 512, 512, 512, 512, 512, 512, 512, - 709, 602, 407, 409, 409, 409, 409, 409, 409, 409, - 1012, 1207, 1065, 1077, 409, 602, 1204, 1201, 709, 639, - 409, 409, 409, 409, 409, 409, 410, 410, 410, 410, - 410, 410, 410, 639, 974, 709, 1012, 410, 1065, 1077, - - 1198, 602, 974, 410, 410, 410, 410, 410, 410, 411, - 411, 411, 411, 411, 411, 411, 411, 414, 414, 414, - 414, 414, 414, 414, 414, 414, 1022, 603, 1195, 414, - 1182, 414, 1178, 1171, 1022, 414, 414, 414, 414, 414, - 414, 603, 610, 610, 610, 610, 610, 610, 610, 612, - 612, 612, 612, 612, 612, 612, 1084, 414, 420, 420, - 420, 420, 420, 420, 420, 420, 420, 603, 1170, 1169, - 420, 1165, 420, 1164, 1084, 1161, 420, 420, 420, 420, - 420, 420, 616, 616, 616, 616, 616, 616, 616, 664, - 664, 664, 664, 664, 664, 664, 692, 711, 420, 426, - - 426, 426, 426, 426, 426, 426, 426, 426, 1157, 1156, - 692, 426, 1155, 1094, 1097, 711, 987, 426, 426, 426, - 426, 426, 426, 428, 428, 428, 428, 428, 428, 428, - 428, 428, 711, 1151, 987, 428, 692, 428, 987, 1094, - 1097, 428, 428, 428, 428, 428, 428, 669, 669, 669, - 669, 669, 669, 669, 673, 673, 673, 673, 673, 673, - 673, 693, 800, 428, 438, 438, 438, 438, 438, 438, - 438, 438, 438, 1150, 1147, 693, 438, 1100, 990, 1143, - 800, 696, 438, 438, 438, 438, 438, 438, 439, 439, - 439, 439, 439, 439, 439, 696, 990, 800, 1142, 439, - - 990, 693, 991, 1100, 1080, 439, 439, 439, 439, 439, - 439, 484, 697, 484, 484, 484, 484, 484, 484, 484, - 991, 696, 1080, 1141, 484, 991, 697, 1137, 1136, 1083, - 484, 484, 484, 484, 484, 484, 485, 485, 485, 485, - 485, 485, 485, 485, 1133, 1033, 1080, 1083, 485, 1083, - 485, 1130, 697, 1033, 485, 485, 485, 485, 485, 485, - 678, 678, 678, 678, 678, 678, 678, 680, 680, 680, - 680, 680, 680, 680, 747, 805, 485, 487, 487, 487, - 487, 487, 487, 487, 487, 1103, 1045, 1129, 747, 487, - 1106, 1128, 1087, 805, 1045, 487, 487, 487, 487, 487, - - 487, 491, 491, 491, 491, 491, 491, 491, 491, 1057, - 1087, 1103, 805, 491, 747, 1087, 1106, 1057, 1124, 491, - 491, 491, 491, 491, 491, 492, 492, 492, 492, 492, - 492, 492, 492, 493, 493, 493, 493, 493, 493, 493, - 1177, 1221, 1123, 1120, 493, 1131, 1145, 1159, 1177, 1221, - 493, 493, 493, 493, 493, 493, 494, 494, 494, 494, - 494, 494, 494, 494, 496, 496, 496, 496, 496, 496, - 496, 1131, 1145, 1159, 1193, 496, 1256, 1293, 1081, 1082, - 1085, 496, 496, 496, 496, 496, 496, 497, 497, 497, - 497, 497, 497, 497, 497, 497, 1081, 1082, 1085, 497, - - 1193, 1302, 1256, 1293, 748, 497, 497, 497, 497, 497, - 497, 498, 498, 498, 498, 498, 498, 498, 748, 1085, - 1081, 1082, 498, 1119, 1088, 1184, 1118, 1302, 498, 498, - 498, 498, 498, 498, 502, 502, 502, 502, 502, 502, - 502, 502, 1088, 1184, 748, 502, 1114, 1112, 1185, 1186, - 1187, 502, 502, 502, 502, 502, 502, 504, 504, 504, - 504, 504, 504, 504, 504, 504, 1185, 1186, 1187, 504, - 1111, 1188, 1270, 1272, 1108, 504, 504, 504, 504, 504, - 504, 505, 505, 505, 505, 505, 505, 505, 505, 1188, - 1270, 1272, 505, 1270, 1188, 1107, 1271, 1104, 505, 505, - - 505, 505, 505, 505, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 1228, 1271, 1272, 513, 1271, 1101, 1339, - 1098, 1228, 513, 513, 513, 513, 513, 513, 514, 514, - 514, 514, 514, 514, 514, 514, 1236, 1339, 1311, 514, - 1320, 1374, 1095, 1382, 1236, 514, 514, 514, 514, 514, - 514, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 1244, 1382, 1388, 523, 1311, 1392, 1320, 1374, 1244, 523, - 523, 523, 523, 523, 523, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 1252, 1091, 1079, 525, 1388, 525, - 1078, 1392, 1252, 525, 525, 525, 525, 525, 525, 684, - - 684, 684, 684, 684, 684, 684, 690, 690, 690, 690, - 690, 690, 690, 798, 755, 525, 565, 565, 565, 565, - 565, 565, 565, 1396, 1284, 1400, 1404, 565, 755, 1075, - 1384, 798, 1284, 565, 565, 565, 565, 565, 565, 567, - 567, 567, 567, 567, 567, 567, 798, 1333, 1384, 1396, - 567, 1400, 1404, 1412, 755, 1333, 567, 567, 567, 567, - 567, 567, 568, 568, 568, 568, 568, 568, 568, 568, - 570, 570, 570, 570, 570, 570, 570, 1380, 1421, 1412, - 1071, 570, 1070, 1189, 1411, 1380, 1067, 570, 570, 570, - 570, 570, 570, 572, 572, 572, 572, 572, 572, 572, - - 572, 1189, 1411, 1062, 1421, 572, 1061, 1058, 1050, 1049, - 1189, 572, 572, 572, 572, 572, 572, 573, 573, 573, - 573, 573, 573, 573, 573, 574, 574, 574, 574, 574, - 574, 574, 1046, 1038, 1037, 1034, 574, 1027, 1026, 1023, - 1018, 1017, 574, 574, 574, 574, 574, 574, 575, 575, - 575, 575, 575, 575, 575, 575, 578, 578, 578, 578, - 578, 578, 578, 578, 578, 710, 756, 759, 578, 1014, - 578, 1013, 1010, 760, 578, 578, 578, 578, 578, 578, - 756, 759, 1009, 710, 1006, 1003, 1000, 760, 996, 979, - 720, 975, 715, 968, 721, 710, 578, 581, 581, 581, - - 581, 581, 581, 581, 581, 581, 756, 759, 720, 581, - 715, 581, 721, 760, 986, 581, 581, 581, 581, 581, - 581, 720, 715, 967, 721, 727, 727, 727, 727, 727, - 727, 727, 986, 770, 771, 774, 884, 581, 587, 587, - 587, 587, 587, 587, 587, 587, 587, 770, 771, 774, - 587, 986, 587, 964, 884, 775, 587, 587, 587, 587, - 587, 587, 768, 768, 768, 768, 768, 768, 768, 775, - 1338, 884, 960, 770, 771, 774, 869, 959, 587, 592, - 592, 592, 592, 592, 592, 592, 592, 592, 1338, 956, - 869, 592, 952, 951, 948, 775, 1338, 592, 592, 592, - - 592, 592, 592, 594, 594, 594, 594, 594, 594, 594, - 594, 594, 944, 943, 940, 594, 869, 594, 937, 936, - 933, 594, 594, 594, 594, 594, 594, 783, 783, 783, - 783, 783, 783, 783, 785, 785, 785, 785, 785, 785, - 785, 870, 886, 594, 604, 604, 604, 604, 604, 604, - 604, 604, 604, 929, 928, 870, 604, 925, 924, 921, - 886, 886, 604, 604, 604, 604, 604, 604, 606, 606, - 606, 606, 606, 606, 606, 606, 606, 917, 886, 913, - 606, 870, 606, 912, 989, 803, 606, 606, 606, 606, - 606, 606, 789, 789, 789, 789, 789, 789, 789, 911, - - 908, 905, 989, 803, 902, 873, 874, 881, 606, 617, - 617, 617, 617, 617, 617, 617, 617, 617, 803, 873, - 874, 617, 989, 899, 898, 881, 880, 617, 617, 617, - 617, 617, 617, 618, 618, 618, 618, 618, 618, 618, - 881, 879, 876, 872, 618, 873, 874, 871, 868, 863, - 618, 618, 618, 618, 618, 618, 621, 621, 621, 621, - 621, 621, 621, 859, 851, 847, 840, 621, 882, 883, - 887, 889, 1269, 621, 621, 621, 621, 621, 621, 828, - 828, 828, 828, 828, 828, 828, 882, 883, 887, 889, - 1269, 621, 644, 836, 644, 644, 644, 644, 644, 644, - - 644, 882, 883, 883, 887, 644, 889, 1269, 985, 988, - 1089, 644, 644, 644, 644, 644, 644, 833, 833, 833, - 833, 833, 833, 833, 918, 919, 985, 988, 1089, 644, - 645, 645, 645, 645, 645, 645, 645, 645, 918, 919, - 985, 988, 645, 1089, 831, 826, 825, 824, 645, 645, - 645, 645, 645, 645, 837, 837, 837, 837, 837, 837, - 837, 821, 818, 814, 918, 919, 645, 646, 646, 646, - 646, 646, 646, 646, 842, 842, 842, 842, 842, 842, - 842, 844, 844, 844, 844, 844, 844, 844, 848, 848, - 848, 848, 848, 848, 848, 854, 854, 854, 854, 854, - - 854, 854, 646, 647, 647, 647, 647, 647, 647, 647, - 792, 788, 781, 780, 647, 777, 773, 772, 769, 766, - 647, 647, 647, 647, 647, 647, 649, 649, 649, 649, - 649, 649, 649, 649, 651, 651, 651, 651, 651, 651, - 651, 651, 765, 762, 758, 757, 651, 754, 753, 750, - 746, 743, 651, 651, 651, 651, 651, 651, 652, 652, - 652, 652, 652, 652, 652, 652, 654, 654, 654, 654, - 654, 654, 654, 742, 741, 740, 737, 654, 734, 731, - 730, 703, 702, 654, 654, 654, 654, 654, 654, 655, - 655, 655, 655, 655, 655, 655, 655, 655, 699, 695, - - 694, 655, 691, 687, 683, 676, 926, 655, 655, 655, + 32, 32, 317, 21, 208, 1266, 149, 317, 97, 21, + 21, 21, 21, 21, 21, 31, 32, 208, 31, 31, + 32, 31, 130, 31, 32, 31, 32, 31, 38, 41, + 31, 130, 149, 32, 38, 97, 38, 41, 38, 385, + 97, 41, 38, 41, 38, 38, 44, 253, 253, 44, + 629, 44, 385, 629, 44, 62, 62, 62, 62, 62, + 62, 62, 63, 157, 44, 63, 628, 63, 1270, 388, + + 63, 628, 44, 48, 48, 48, 48, 48, 48, 48, + 63, 1272, 260, 388, 48, 410, 410, 1278, 63, 157, + 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, + 49, 49, 49, 83, 575, 575, 329, 49, 260, 270, + 270, 270, 270, 49, 49, 49, 49, 49, 49, 50, + 50, 50, 50, 50, 50, 50, 50, 439, 1279, 270, + 83, 50, 329, 354, 412, 439, 83, 50, 50, 50, + 50, 50, 50, 52, 52, 52, 52, 52, 52, 52, + 52, 54, 54, 54, 54, 54, 54, 54, 419, 354, + 412, 333, 54, 533, 533, 533, 533, 425, 54, 54, + + 54, 54, 54, 54, 56, 333, 634, 56, 634, 56, + 349, 637, 56, 350, 419, 56, 56, 56, 56, 56, + 56, 56, 56, 425, 349, 637, 56, 350, 433, 490, + 56, 333, 56, 56, 56, 56, 56, 56, 147, 458, + 147, 147, 147, 147, 147, 147, 147, 460, 458, 1289, + 349, 147, 530, 350, 433, 490, 460, 147, 147, 147, + 147, 147, 147, 148, 148, 148, 148, 148, 148, 148, + 148, 514, 524, 626, 626, 148, 583, 148, 530, 514, + 524, 148, 148, 148, 148, 148, 148, 252, 252, 252, + 252, 252, 252, 252, 263, 263, 263, 263, 263, 263, + + 263, 428, 583, 148, 150, 150, 150, 150, 150, 150, + 150, 150, 586, 592, 1290, 428, 150, 599, 611, 645, + 645, 1294, 150, 150, 150, 150, 150, 150, 151, 151, + 151, 151, 151, 151, 151, 151, 151, 618, 586, 592, + 151, 428, 1295, 599, 611, 618, 151, 151, 151, 151, + 151, 151, 152, 152, 152, 152, 152, 152, 152, 152, + 154, 154, 154, 154, 154, 154, 154, 154, 635, 1299, + 652, 154, 635, 1302, 631, 636, 708, 154, 154, 154, + 154, 154, 154, 156, 156, 156, 156, 156, 156, 156, + 156, 156, 631, 636, 708, 156, 652, 156, 654, 287, + + 710, 156, 156, 156, 156, 156, 156, 287, 339, 339, + 339, 339, 339, 339, 339, 1303, 1308, 429, 710, 494, + 287, 711, 632, 156, 246, 246, 246, 246, 246, 246, + 246, 429, 632, 494, 654, 246, 287, 716, 1311, 711, + 1312, 246, 246, 246, 246, 246, 246, 248, 248, 248, + 248, 248, 248, 248, 630, 716, 711, 429, 248, 494, + 716, 693, 705, 630, 248, 248, 248, 248, 248, 248, + 249, 249, 249, 249, 249, 249, 249, 249, 251, 251, + 251, 251, 251, 251, 251, 675, 686, 693, 705, 251, + 1317, 709, 720, 675, 686, 251, 251, 251, 251, 251, + + 251, 254, 254, 254, 254, 254, 254, 254, 254, 709, + 720, 720, 1320, 254, 1321, 1326, 709, 1329, 1330, 254, + 254, 254, 254, 254, 254, 256, 256, 256, 256, 256, + 256, 256, 256, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 791, 322, 521, 259, 1338, 259, 322, 1354, + 791, 259, 259, 259, 259, 259, 259, 322, 521, 322, + 322, 737, 322, 343, 343, 343, 343, 343, 343, 343, + 722, 522, 712, 259, 264, 264, 264, 264, 264, 264, + 264, 264, 264, 1355, 521, 522, 264, 737, 722, 1380, + 712, 525, 264, 264, 264, 264, 264, 264, 265, 265, + + 265, 265, 265, 265, 265, 525, 1383, 712, 1394, 265, + 1398, 522, 717, 1402, 718, 265, 265, 265, 265, 265, + 265, 327, 526, 327, 327, 327, 327, 327, 327, 327, + 717, 525, 718, 717, 327, 718, 526, 723, 721, 727, + 327, 327, 327, 327, 327, 327, 328, 328, 328, 328, + 328, 328, 328, 328, 1406, 723, 721, 727, 328, 721, + 328, 1410, 526, 1418, 328, 328, 328, 328, 328, 328, + 409, 409, 409, 409, 409, 409, 409, 437, 437, 437, + 437, 437, 437, 437, 594, 644, 328, 330, 330, 330, + 330, 330, 330, 330, 330, 644, 1427, 740, 594, 330, + + 743, 729, 729, 1257, 595, 330, 330, 330, 330, 330, + 330, 334, 334, 334, 334, 334, 334, 334, 595, 729, + 1250, 749, 334, 740, 594, 756, 743, 798, 334, 334, + 334, 334, 334, 334, 335, 335, 335, 335, 335, 335, + 335, 335, 1249, 1242, 595, 798, 335, 749, 768, 771, + 783, 756, 335, 335, 335, 335, 335, 335, 336, 336, + 336, 336, 336, 336, 336, 336, 338, 338, 338, 338, + 338, 338, 338, 1241, 768, 771, 783, 338, 1234, 799, + 800, 801, 1233, 338, 338, 338, 338, 338, 338, 342, + 342, 342, 342, 342, 342, 342, 342, 799, 800, 801, + + 342, 1227, 799, 800, 801, 803, 342, 342, 342, 342, + 342, 342, 344, 344, 344, 344, 344, 344, 344, 344, + 344, 839, 814, 803, 344, 1226, 805, 806, 803, 839, + 344, 344, 344, 344, 344, 344, 345, 345, 345, 345, + 345, 345, 345, 345, 805, 806, 1222, 345, 814, 805, + 806, 808, 810, 345, 345, 345, 345, 345, 345, 351, + 351, 351, 351, 351, 351, 351, 351, 351, 850, 808, + 810, 351, 808, 870, 1221, 892, 850, 351, 351, 351, + 351, 351, 351, 353, 353, 353, 353, 353, 353, 353, + 353, 353, 862, 892, 1220, 353, 882, 353, 892, 870, + + 862, 353, 353, 353, 353, 353, 353, 441, 441, 441, + 441, 441, 441, 441, 507, 507, 507, 507, 507, 507, + 507, 1219, 882, 353, 371, 1218, 905, 1214, 371, 908, + 895, 371, 889, 602, 371, 603, 371, 371, 371, 371, + 403, 403, 403, 403, 403, 403, 403, 602, 895, 603, + 889, 403, 905, 889, 896, 908, 640, 403, 403, 403, + 403, 403, 403, 405, 405, 405, 405, 405, 405, 405, + 640, 978, 896, 602, 405, 603, 911, 914, 920, 978, + 405, 405, 405, 405, 405, 405, 406, 406, 406, 406, + 406, 406, 406, 406, 408, 408, 408, 408, 408, 408, + + 408, 1211, 911, 914, 920, 408, 927, 894, 897, 901, + 988, 408, 408, 408, 408, 408, 408, 411, 411, 411, + 411, 411, 411, 411, 411, 894, 897, 901, 988, 411, + 1208, 411, 927, 894, 1205, 411, 411, 411, 411, 411, + 411, 512, 512, 512, 512, 512, 512, 512, 516, 516, + 516, 516, 516, 516, 516, 713, 606, 411, 413, 413, + 413, 413, 413, 413, 413, 939, 1202, 942, 954, 413, + 606, 958, 1199, 713, 643, 413, 413, 413, 413, 413, + 413, 414, 414, 414, 414, 414, 414, 414, 643, 1186, + 713, 939, 414, 942, 954, 970, 606, 958, 414, 414, + + 414, 414, 414, 414, 415, 415, 415, 415, 415, 415, + 415, 415, 418, 418, 418, 418, 418, 418, 418, 418, + 418, 970, 607, 1182, 418, 1175, 418, 1174, 1173, 1169, + 418, 418, 418, 418, 418, 418, 607, 614, 614, 614, + 614, 614, 614, 614, 616, 616, 616, 616, 616, 616, + 616, 996, 418, 424, 424, 424, 424, 424, 424, 424, + 424, 424, 607, 1168, 1165, 424, 1161, 424, 1160, 996, + 1159, 424, 424, 424, 424, 424, 424, 620, 620, 620, + 620, 620, 620, 620, 668, 668, 668, 668, 668, 668, + 668, 696, 715, 424, 430, 430, 430, 430, 430, 430, + + 430, 430, 430, 1155, 1154, 696, 430, 1151, 1016, 1069, + 715, 991, 430, 430, 430, 430, 430, 430, 432, 432, + 432, 432, 432, 432, 432, 432, 432, 715, 1147, 991, + 432, 696, 432, 991, 1016, 1069, 432, 432, 432, 432, + 432, 432, 673, 673, 673, 673, 673, 673, 673, 677, + 677, 677, 677, 677, 677, 677, 697, 804, 432, 442, + 442, 442, 442, 442, 442, 442, 442, 442, 1146, 1145, + 697, 442, 1081, 994, 1141, 804, 700, 442, 442, 442, + 442, 442, 442, 443, 443, 443, 443, 443, 443, 443, + 700, 994, 804, 1140, 443, 994, 697, 995, 1081, 1084, + + 443, 443, 443, 443, 443, 443, 488, 701, 488, 488, + 488, 488, 488, 488, 488, 995, 700, 1084, 1137, 488, + 995, 701, 1134, 1133, 1087, 488, 488, 488, 488, 488, + 488, 489, 489, 489, 489, 489, 489, 489, 489, 1132, + 1026, 1084, 1087, 489, 1087, 489, 1128, 701, 1026, 489, + 489, 489, 489, 489, 489, 682, 682, 682, 682, 682, + 682, 682, 684, 684, 684, 684, 684, 684, 684, 751, + 809, 489, 491, 491, 491, 491, 491, 491, 491, 491, + 1098, 1037, 1127, 751, 491, 1101, 1124, 1123, 809, 1037, + 491, 491, 491, 491, 491, 491, 495, 495, 495, 495, + + 495, 495, 495, 495, 1049, 1061, 1098, 809, 495, 751, + 1104, 1101, 1049, 1061, 495, 495, 495, 495, 495, 495, + 496, 496, 496, 496, 496, 496, 496, 496, 497, 497, + 497, 497, 497, 497, 497, 1122, 1104, 1118, 1116, 497, + 1107, 1110, 1135, 1149, 1115, 497, 497, 497, 497, 497, + 497, 498, 498, 498, 498, 498, 498, 498, 498, 500, + 500, 500, 500, 500, 500, 500, 1107, 1110, 1135, 1149, + 500, 1163, 1197, 1085, 1086, 1088, 500, 500, 500, 500, + 500, 500, 501, 501, 501, 501, 501, 501, 501, 501, + 501, 1085, 1086, 1088, 501, 1260, 1091, 1163, 1197, 752, + + 501, 501, 501, 501, 501, 501, 502, 502, 502, 502, + 502, 502, 502, 752, 1091, 1085, 1086, 502, 1112, 1091, + 1092, 1260, 1111, 502, 502, 502, 502, 502, 502, 506, + 506, 506, 506, 506, 506, 506, 506, 1108, 1092, 752, + 506, 1105, 1102, 1099, 1188, 1089, 506, 506, 506, 506, + 506, 506, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 1181, 1188, 1089, 508, 1095, 1083, 1189, 1190, 1181, + 508, 508, 508, 508, 508, 508, 509, 509, 509, 509, + 509, 509, 509, 509, 1089, 1189, 1190, 509, 1082, 1079, + 1191, 1192, 1274, 509, 509, 509, 509, 509, 509, 517, + + 517, 517, 517, 517, 517, 517, 517, 517, 1191, 1192, + 1274, 517, 1075, 1274, 1192, 1275, 1074, 517, 517, 517, + 517, 517, 517, 518, 518, 518, 518, 518, 518, 518, + 518, 1225, 1071, 1275, 518, 1297, 1275, 1066, 1276, 1225, + 518, 518, 518, 518, 518, 518, 527, 527, 527, 527, + 527, 527, 527, 527, 527, 1232, 1276, 1306, 527, 1315, + 1324, 1297, 1065, 1232, 527, 527, 527, 527, 527, 527, + 529, 529, 529, 529, 529, 529, 529, 529, 529, 1240, + 1276, 1062, 529, 1306, 529, 1315, 1324, 1240, 529, 529, + 529, 529, 529, 529, 688, 688, 688, 688, 688, 688, + + 688, 694, 694, 694, 694, 694, 694, 694, 802, 759, + 529, 569, 569, 569, 569, 569, 569, 569, 1378, 1248, + 1392, 1396, 569, 759, 1054, 1343, 802, 1248, 569, 569, + 569, 569, 569, 569, 571, 571, 571, 571, 571, 571, + 571, 802, 1256, 1343, 1378, 571, 1392, 1396, 1400, 759, + 1256, 571, 571, 571, 571, 571, 571, 572, 572, 572, + 572, 572, 572, 572, 572, 574, 574, 574, 574, 574, + 574, 574, 1288, 1337, 1400, 1404, 574, 1408, 1193, 1386, + 1288, 1337, 574, 574, 574, 574, 574, 574, 576, 576, + 576, 576, 576, 576, 576, 576, 1193, 1386, 1053, 1050, + + 576, 1404, 1416, 1408, 1425, 1193, 576, 576, 576, 576, + 576, 576, 577, 577, 577, 577, 577, 577, 577, 577, + 578, 578, 578, 578, 578, 578, 578, 1384, 1416, 1042, + 1425, 578, 1041, 1038, 1031, 1384, 1030, 578, 578, 578, + 578, 578, 578, 579, 579, 579, 579, 579, 579, 579, + 579, 582, 582, 582, 582, 582, 582, 582, 582, 582, + 714, 760, 763, 582, 1027, 582, 1388, 1022, 764, 582, + 582, 582, 582, 582, 582, 760, 763, 1021, 714, 1018, + 1017, 1014, 764, 1013, 1388, 724, 1010, 719, 1007, 725, + 714, 582, 585, 585, 585, 585, 585, 585, 585, 585, + + 585, 760, 763, 724, 585, 719, 585, 725, 764, 990, + 585, 585, 585, 585, 585, 585, 724, 719, 1004, 725, + 731, 731, 731, 731, 731, 731, 731, 990, 774, 775, + 778, 888, 585, 591, 591, 591, 591, 591, 591, 591, + 591, 591, 774, 775, 778, 591, 990, 591, 1000, 888, + 779, 591, 591, 591, 591, 591, 591, 772, 772, 772, + 772, 772, 772, 772, 779, 1342, 888, 983, 774, 775, + 778, 873, 979, 591, 596, 596, 596, 596, 596, 596, + 596, 596, 596, 1342, 972, 873, 596, 971, 968, 1415, + 779, 1342, 596, 596, 596, 596, 596, 596, 598, 598, + + 598, 598, 598, 598, 598, 598, 598, 1415, 964, 963, + 598, 873, 598, 960, 956, 955, 598, 598, 598, 598, + 598, 598, 787, 787, 787, 787, 787, 787, 787, 789, + 789, 789, 789, 789, 789, 789, 874, 890, 598, 608, + 608, 608, 608, 608, 608, 608, 608, 608, 952, 948, + 874, 608, 947, 944, 941, 890, 890, 608, 608, 608, + 608, 608, 608, 610, 610, 610, 610, 610, 610, 610, + 610, 610, 940, 890, 937, 610, 874, 610, 933, 993, + 807, 610, 610, 610, 610, 610, 610, 793, 793, 793, + 793, 793, 793, 793, 932, 929, 928, 993, 807, 925, + + 877, 878, 885, 610, 621, 621, 621, 621, 621, 621, + 621, 621, 621, 807, 877, 878, 621, 993, 921, 917, + 885, 916, 621, 621, 621, 621, 621, 621, 622, 622, + 622, 622, 622, 622, 622, 885, 915, 912, 909, 622, + 877, 878, 906, 903, 902, 622, 622, 622, 622, 622, + 622, 625, 625, 625, 625, 625, 625, 625, 884, 883, + 880, 876, 625, 886, 887, 891, 893, 1273, 625, 625, + 625, 625, 625, 625, 832, 832, 832, 832, 832, 832, + 832, 886, 887, 891, 893, 1273, 625, 648, 875, 648, + 648, 648, 648, 648, 648, 648, 886, 887, 887, 891, + + 648, 893, 1273, 989, 992, 1093, 648, 648, 648, 648, + 648, 648, 837, 837, 837, 837, 837, 837, 837, 922, + 923, 989, 992, 1093, 648, 649, 649, 649, 649, 649, + 649, 649, 649, 922, 923, 989, 992, 649, 1093, 872, + 867, 863, 855, 649, 649, 649, 649, 649, 649, 841, + 841, 841, 841, 841, 841, 841, 851, 844, 840, 922, + 923, 649, 650, 650, 650, 650, 650, 650, 650, 846, + 846, 846, 846, 846, 846, 846, 848, 848, 848, 848, + 848, 848, 848, 852, 852, 852, 852, 852, 852, 852, + 858, 858, 858, 858, 858, 858, 858, 650, 651, 651, + + 651, 651, 651, 651, 651, 835, 830, 829, 828, 651, + 825, 822, 818, 796, 792, 651, 651, 651, 651, 651, + 651, 653, 653, 653, 653, 653, 653, 653, 653, 655, + 655, 655, 655, 655, 655, 655, 655, 785, 784, 781, + 777, 655, 776, 773, 770, 769, 766, 655, 655, 655, 655, 655, 655, 656, 656, 656, 656, 656, 656, 656, - 926, 672, 667, 662, 656, 661, 660, 657, 653, 643, - 656, 656, 656, 656, 656, 656, 658, 658, 658, 658, - 658, 658, 658, 658, 658, 642, 926, 638, 658, 637, - 635, 634, 629, 927, 658, 658, 658, 658, 658, 658, - 659, 659, 659, 659, 659, 659, 659, 927, 619, 615, - 609, 659, 608, 605, 601, 600, 597, 659, 659, 659, - 659, 659, 659, 663, 663, 663, 663, 663, 663, 663, - 663, 596, 593, 927, 663, 589, 586, 585, 584, 583, - - 663, 663, 663, 663, 663, 663, 665, 665, 665, 665, - 665, 665, 665, 665, 665, 580, 577, 576, 665, 569, - 566, 564, 560, 556, 665, 665, 665, 665, 665, 665, - 666, 666, 666, 666, 666, 666, 666, 666, 555, 554, - 553, 666, 549, 548, 546, 545, 544, 666, 666, 666, - 666, 666, 666, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 543, 542, 541, 674, 540, 539, 538, 537, - 536, 674, 674, 674, 674, 674, 674, 675, 675, 675, - 675, 675, 675, 675, 675, 535, 532, 531, 675, 530, - 528, 527, 524, 519, 675, 675, 675, 675, 675, 675, - - 685, 685, 685, 685, 685, 685, 685, 685, 685, 515, - 511, 506, 685, 501, 500, 499, 495, 489, 685, 685, - 685, 685, 685, 685, 686, 686, 686, 686, 686, 686, - 686, 686, 488, 483, 482, 686, 481, 480, 479, 478, - 477, 686, 686, 686, 686, 686, 686, 698, 698, 698, - 698, 698, 698, 698, 698, 698, 476, 475, 474, 698, - 473, 471, 468, 467, 466, 698, 698, 698, 698, 698, - 698, 700, 700, 700, 700, 700, 700, 700, 700, 700, - 465, 464, 463, 700, 462, 700, 460, 459, 458, 700, - 700, 700, 700, 700, 700, 856, 856, 856, 856, 856, - - 856, 856, 860, 860, 860, 860, 860, 860, 860, 930, - 931, 700, 722, 941, 722, 722, 722, 722, 722, 722, - 722, 457, 455, 930, 931, 722, 453, 941, 452, 451, - 722, 722, 722, 722, 722, 722, 722, 724, 724, 724, - 724, 724, 724, 724, 450, 449, 448, 447, 724, 930, - 931, 445, 444, 941, 724, 724, 724, 724, 724, 724, - 726, 726, 726, 726, 726, 726, 726, 443, 440, 436, - 432, 726, 431, 1337, 430, 427, 423, 726, 726, 726, - 726, 726, 726, 728, 728, 728, 728, 728, 728, 728, - 728, 1337, 422, 419, 418, 728, 417, 416, 413, 412, - - 1337, 728, 728, 728, 728, 728, 728, 729, 729, 729, - 729, 729, 729, 729, 729, 732, 732, 732, 732, 732, - 732, 732, 732, 732, 403, 400, 398, 732, 397, 732, - 396, 395, 394, 732, 732, 732, 732, 732, 732, 867, - 867, 867, 867, 867, 867, 867, 939, 939, 939, 939, - 939, 939, 939, 942, 393, 732, 735, 735, 735, 735, - 735, 735, 735, 735, 735, 392, 945, 942, 735, 391, - 735, 390, 946, 957, 735, 735, 735, 735, 735, 735, - 945, 389, 388, 387, 385, 383, 946, 957, 382, 380, - 379, 376, 1336, 942, 958, 375, 735, 738, 738, 738, - - 738, 738, 738, 738, 738, 738, 945, 373, 958, 738, - 1336, 738, 946, 957, 961, 738, 738, 738, 738, 738, - 738, 955, 955, 955, 955, 955, 955, 955, 961, 1336, - 371, 370, 369, 962, 958, 1068, 366, 738, 744, 744, - 744, 744, 744, 744, 744, 744, 744, 962, 365, 1068, - 744, 363, 744, 362, 961, 1069, 744, 744, 744, 744, - 744, 744, 970, 970, 970, 970, 970, 970, 970, 1069, - 361, 360, 358, 962, 1072, 1068, 1073, 353, 744, 749, - 749, 749, 749, 749, 749, 749, 749, 749, 1072, 352, - 1073, 749, 351, 348, 344, 1069, 342, 749, 749, 749, - - 749, 749, 749, 751, 751, 751, 751, 751, 751, 751, - 751, 751, 337, 336, 1072, 751, 1073, 751, 333, 328, - 327, 751, 751, 751, 751, 751, 751, 972, 972, 972, - 972, 972, 972, 972, 976, 976, 976, 976, 976, 976, - 976, 1115, 319, 751, 761, 761, 761, 761, 761, 761, - 761, 761, 761, 317, 316, 1115, 761, 311, 309, 307, - 306, 305, 761, 761, 761, 761, 761, 761, 763, 763, - 763, 763, 763, 763, 763, 763, 763, 981, 982, 1116, - 763, 1115, 763, 304, 303, 302, 763, 763, 763, 763, - 763, 763, 301, 1116, 299, 981, 982, 1015, 1015, 1015, - - 1015, 1015, 1015, 1015, 1121, 298, 981, 982, 763, 776, - 776, 776, 776, 776, 776, 776, 776, 776, 1121, 1116, - 297, 776, 292, 289, 288, 287, 284, 776, 776, 776, - 776, 776, 776, 778, 778, 778, 778, 778, 778, 778, - 778, 778, 983, 1122, 1121, 778, 281, 778, 280, 278, - 1383, 778, 778, 778, 778, 778, 778, 1122, 276, 275, - 983, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1383, 274, - 1125, 983, 272, 778, 790, 790, 790, 790, 790, 790, - 790, 790, 790, 1122, 1125, 269, 790, 1383, 268, 266, - 263, 1126, 790, 790, 790, 790, 790, 790, 791, 791, - - 791, 791, 791, 791, 791, 1126, 259, 258, 255, 791, - 1125, 254, 252, 247, 244, 791, 791, 791, 791, 791, - 791, 807, 1134, 807, 807, 807, 807, 807, 807, 807, - 242, 1126, 241, 239, 807, 236, 1134, 232, 228, 807, - 807, 807, 807, 807, 807, 807, 808, 808, 808, 808, - 808, 808, 808, 226, 224, 223, 221, 808, 220, 219, - 218, 217, 1134, 808, 808, 808, 808, 808, 808, 809, - 809, 809, 809, 809, 809, 809, 809, 216, 215, 213, - 211, 809, 209, 809, 208, 206, 204, 809, 809, 809, - 809, 809, 809, 1024, 1024, 1024, 1024, 1024, 1024, 1024, - - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 203, 1135, 809, - 811, 811, 811, 811, 811, 811, 811, 201, 198, 197, - 196, 811, 1135, 194, 192, 191, 188, 811, 811, 811, - 811, 811, 811, 812, 812, 812, 812, 812, 812, 812, - 812, 187, 185, 184, 183, 812, 182, 181, 1135, 180, - 179, 812, 812, 812, 812, 812, 812, 813, 813, 813, - 813, 813, 813, 813, 813, 815, 815, 815, 815, 815, - 815, 815, 178, 177, 176, 174, 815, 173, 170, 169, - 168, 167, 815, 815, 815, 815, 815, 815, 816, 816, - 816, 816, 816, 816, 816, 816, 816, 166, 165, 164, - - 816, 162, 159, 158, 157, 1138, 816, 816, 816, 816, - 816, 816, 817, 817, 817, 817, 817, 817, 817, 1138, - 156, 153, 151, 817, 142, 141, 140, 139, 138, 817, - 817, 817, 817, 817, 817, 819, 819, 819, 819, 819, - 819, 819, 819, 819, 137, 1138, 136, 819, 134, 133, - 132, 130, 1139, 819, 819, 819, 819, 819, 819, 820, - 820, 820, 820, 820, 820, 820, 1139, 128, 126, 125, - 820, 124, 123, 121, 120, 119, 820, 820, 820, 820, - 820, 820, 822, 822, 822, 822, 822, 822, 822, 822, - 822, 118, 1139, 117, 822, 116, 114, 112, 111, 1148, - - 822, 822, 822, 822, 822, 822, 823, 823, 823, 823, - 823, 823, 823, 1148, 110, 109, 108, 823, 107, 106, - 105, 104, 102, 823, 823, 823, 823, 823, 823, 827, - 827, 827, 827, 827, 827, 827, 827, 101, 94, 1148, - 827, 93, 92, 90, 89, 88, 827, 827, 827, 827, - 827, 827, 829, 829, 829, 829, 829, 829, 829, 829, - 829, 87, 86, 85, 829, 84, 83, 81, 80, 79, - 829, 829, 829, 829, 829, 829, 830, 830, 830, 830, - 830, 830, 830, 830, 78, 77, 76, 830, 75, 74, - 73, 72, 71, 830, 830, 830, 830, 830, 830, 838, - - 838, 838, 838, 838, 838, 838, 838, 838, 70, 69, - 67, 838, 66, 65, 51, 43, 42, 838, 838, 838, - 838, 838, 838, 839, 839, 839, 839, 839, 839, 839, - 839, 40, 30, 18, 839, 10, 8, 3, 0, 0, - 839, 839, 839, 839, 839, 839, 849, 849, 849, 849, - 849, 849, 849, 849, 849, 0, 0, 0, 849, 0, - 0, 0, 0, 0, 849, 849, 849, 849, 849, 849, - 850, 850, 850, 850, 850, 850, 850, 850, 0, 0, - 0, 850, 0, 0, 0, 0, 0, 850, 850, 850, - 850, 850, 850, 861, 861, 861, 861, 861, 861, 861, - - 861, 861, 0, 0, 0, 861, 0, 0, 0, 0, - 0, 861, 861, 861, 861, 861, 861, 862, 862, 862, - 862, 862, 862, 862, 862, 0, 0, 0, 862, 0, - 0, 0, 0, 0, 862, 862, 862, 862, 862, 862, - 875, 875, 875, 875, 875, 875, 875, 875, 875, 0, - 0, 0, 875, 0, 0, 0, 0, 0, 875, 875, - 875, 875, 875, 875, 877, 877, 877, 877, 877, 877, - 877, 877, 877, 0, 0, 0, 877, 0, 877, 0, - 0, 0, 877, 877, 877, 877, 877, 877, 1031, 1031, - 1031, 1031, 1031, 1031, 1031, 1035, 1035, 1035, 1035, 1035, - - 1035, 1035, 0, 0, 877, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 0, 0, 0, 0, 894, 0, - 0, 0, 0, 894, 894, 894, 894, 894, 894, 894, - 895, 895, 895, 895, 895, 895, 895, 895, 896, 896, - 896, 896, 896, 896, 896, 896, 896, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 0, 0, 896, 900, 900, 900, - 900, 900, 900, 900, 900, 900, 0, 0, 0, 900, - 0, 900, 0, 0, 0, 900, 900, 900, 900, 900, - 900, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1047, 1047, - 1047, 1047, 1047, 1047, 1047, 0, 0, 900, 903, 903, - - 903, 903, 903, 903, 903, 903, 903, 0, 0, 0, - 903, 0, 903, 0, 0, 0, 903, 903, 903, 903, - 903, 903, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1055, - 1055, 1055, 1055, 1055, 1055, 1055, 0, 0, 903, 906, - 906, 906, 906, 906, 906, 906, 906, 906, 0, 0, - 0, 906, 0, 906, 0, 0, 0, 906, 906, 906, - 906, 906, 906, 1059, 1059, 1059, 1059, 1059, 1059, 1059, - 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1086, 0, 906, - 909, 909, 909, 909, 909, 909, 909, 909, 909, 0, - 1149, 1152, 909, 0, 909, 1086, 0, 0, 909, 909, - - 909, 909, 909, 909, 1149, 1152, 1086, 1109, 1109, 1109, - 1109, 1109, 1109, 1109, 0, 1153, 0, 0, 0, 1162, - 909, 914, 914, 914, 914, 914, 914, 914, 914, 1153, - 1149, 1152, 914, 1162, 0, 0, 0, 0, 914, 914, - 914, 914, 914, 914, 915, 915, 915, 915, 915, 915, - 915, 915, 915, 0, 0, 1153, 915, 0, 915, 1162, - 0, 0, 915, 915, 915, 915, 915, 915, 1132, 1132, - 1132, 1132, 1132, 1132, 1132, 1146, 1146, 1146, 1146, 1146, - 1146, 1146, 1163, 0, 915, 920, 920, 920, 920, 920, - 920, 920, 920, 920, 0, 0, 1163, 920, 0, 0, - - 0, 0, 0, 920, 920, 920, 920, 920, 920, 922, - 922, 922, 922, 922, 922, 922, 922, 922, 0, 0, - 0, 922, 1163, 922, 0, 0, 1166, 922, 922, 922, - 922, 922, 922, 1160, 1160, 1160, 1160, 1160, 1160, 1160, - 1166, 0, 0, 0, 0, 1167, 0, 1211, 0, 922, - 932, 932, 932, 932, 932, 932, 932, 932, 932, 1167, - 0, 1211, 932, 0, 0, 0, 1166, 0, 932, 932, - 932, 932, 932, 932, 934, 934, 934, 934, 934, 934, - 934, 934, 934, 0, 0, 1167, 934, 1211, 934, 0, - 0, 0, 934, 934, 934, 934, 934, 934, 1173, 1173, - - 1173, 1173, 1173, 1173, 1173, 1175, 1175, 1175, 1175, 1175, - 1175, 1175, 1212, 0, 934, 947, 947, 947, 947, 947, - 947, 947, 947, 947, 0, 0, 1212, 947, 0, 0, - 0, 0, 0, 947, 947, 947, 947, 947, 947, 949, - 949, 949, 949, 949, 949, 949, 949, 949, 0, 0, - 0, 949, 1212, 949, 0, 0, 0, 949, 949, 949, - 949, 949, 949, 1179, 1179, 1179, 1179, 1179, 1179, 1179, - 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1259, 0, 949, - 963, 963, 963, 963, 963, 963, 963, 963, 963, 0, - 0, 1259, 963, 0, 0, 0, 0, 1190, 963, 963, - - 963, 963, 963, 963, 965, 965, 965, 965, 965, 965, - 965, 965, 965, 1191, 0, 1190, 965, 1259, 965, 0, - 0, 0, 965, 965, 965, 965, 965, 965, 1190, 0, - 0, 1191, 1224, 1224, 1224, 1224, 1224, 1224, 1224, 0, - 0, 1260, 1191, 0, 965, 977, 977, 977, 977, 977, - 977, 977, 977, 977, 0, 1260, 0, 977, 0, 0, - 0, 0, 1263, 977, 977, 977, 977, 977, 977, 978, - 978, 978, 978, 978, 978, 978, 1263, 0, 0, 0, - 978, 1260, 0, 0, 0, 0, 978, 978, 978, 978, - 978, 978, 993, 993, 993, 993, 993, 993, 993, 993, - - 993, 0, 1263, 0, 0, 993, 0, 0, 0, 0, - 993, 993, 993, 993, 993, 993, 993, 994, 994, 994, - 994, 994, 994, 994, 994, 995, 995, 995, 995, 995, - 995, 995, 995, 995, 1226, 1226, 1226, 1226, 1226, 1226, - 1226, 0, 1264, 995, 997, 997, 997, 997, 997, 997, - 997, 0, 0, 0, 0, 997, 1264, 0, 0, 0, - 0, 997, 997, 997, 997, 997, 997, 998, 998, 998, - 998, 998, 998, 998, 998, 998, 0, 0, 0, 998, - 0, 0, 1264, 0, 1288, 998, 998, 998, 998, 998, - 998, 999, 999, 999, 999, 999, 999, 999, 1288, 0, - - 0, 0, 999, 0, 0, 0, 0, 0, 999, 999, - 999, 999, 999, 999, 1001, 1001, 1001, 1001, 1001, 1001, - 1001, 1001, 1001, 0, 1288, 0, 1001, 0, 0, 0, - 0, 1289, 1001, 1001, 1001, 1001, 1001, 1001, 1002, 1002, - 1002, 1002, 1002, 1002, 1002, 1289, 0, 0, 0, 1002, - 0, 0, 0, 0, 0, 1002, 1002, 1002, 1002, 1002, - 1002, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1004, - 0, 1289, 0, 1004, 0, 0, 0, 0, 1296, 1004, - 1004, 1004, 1004, 1004, 1004, 1005, 1005, 1005, 1005, 1005, - 1005, 1005, 1296, 0, 0, 0, 1005, 0, 0, 0, - - 0, 0, 1005, 1005, 1005, 1005, 1005, 1005, 1007, 1007, - 1007, 1007, 1007, 1007, 1007, 1007, 1007, 0, 1296, 0, - 1007, 0, 0, 0, 0, 1297, 1007, 1007, 1007, 1007, - 1007, 1007, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1297, - 0, 0, 0, 1008, 0, 0, 0, 0, 0, 1008, - 1008, 1008, 1008, 1008, 1008, 1011, 1011, 1011, 1011, 1011, - 1011, 1011, 1011, 1011, 0, 1297, 0, 1011, 0, 1011, - 0, 0, 0, 1011, 1011, 1011, 1011, 1011, 1011, 1232, - 1232, 1232, 1232, 1232, 1232, 1232, 1234, 1234, 1234, 1234, - 1234, 1234, 1234, 1305, 0, 1011, 1016, 1016, 1016, 1016, - - 1016, 1016, 1016, 1016, 1016, 0, 0, 1305, 1016, 0, - 0, 0, 0, 0, 1016, 1016, 1016, 1016, 1016, 1016, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 0, - 0, 0, 1025, 1305, 0, 0, 0, 0, 1025, 1025, - 1025, 1025, 1025, 1025, 1036, 1036, 1036, 1036, 1036, 1036, - 1036, 1036, 1036, 0, 0, 0, 1036, 0, 0, 0, - 0, 0, 1036, 1036, 1036, 1036, 1036, 1036, 1048, 1048, - 1048, 1048, 1048, 1048, 1048, 1048, 1048, 0, 0, 0, - 1048, 0, 0, 0, 0, 0, 1048, 1048, 1048, 1048, - 1048, 1048, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - - 1060, 0, 0, 0, 1060, 0, 0, 0, 0, 0, - 1060, 1060, 1060, 1060, 1060, 1060, 1074, 1074, 1074, 1074, - 1074, 1074, 1074, 1074, 1074, 0, 0, 0, 1074, 0, - 0, 0, 0, 0, 1074, 1074, 1074, 1074, 1074, 1074, - 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 0, - 0, 0, 1076, 0, 1076, 0, 0, 0, 1076, 1076, - 1076, 1076, 1076, 1076, 1240, 1240, 1240, 1240, 1240, 1240, - 1240, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 0, 0, - 1076, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, 1090, - 1248, 1248, 1248, 1248, 1248, 1248, 1248, 0, 1306, 1090, - - 1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092, 0, 0, - 0, 1092, 1306, 0, 0, 0, 0, 1092, 1092, 1092, - 1092, 1092, 1092, 1093, 1093, 1093, 1093, 1093, 1093, 1093, - 1093, 1093, 0, 0, 0, 1093, 0, 1093, 1306, 0, - 0, 1093, 1093, 1093, 1093, 1093, 1093, 1250, 1250, 1250, - 1250, 1250, 1250, 1250, 1257, 1257, 1257, 1257, 1257, 1257, - 1257, 0, 0, 1093, 1096, 1096, 1096, 1096, 1096, 1096, - 1096, 1096, 1096, 0, 0, 0, 1096, 0, 1096, 0, - 0, 0, 1096, 1096, 1096, 1096, 1096, 1096, 1282, 1282, - 1282, 1282, 1282, 1282, 1282, 1294, 1294, 1294, 1294, 1294, - - 1294, 1294, 0, 0, 1096, 1099, 1099, 1099, 1099, 1099, - 1099, 1099, 1099, 1099, 0, 0, 0, 1099, 0, 1099, - 0, 0, 0, 1099, 1099, 1099, 1099, 1099, 1099, 1303, - 1303, 1303, 1303, 1303, 1303, 1303, 1312, 1312, 1312, 1312, - 1312, 1312, 1312, 1314, 0, 1099, 1102, 1102, 1102, 1102, - 1102, 1102, 1102, 1102, 1102, 0, 1315, 1314, 1102, 0, - 1102, 0, 0, 0, 1102, 1102, 1102, 1102, 1102, 1102, - 1315, 1321, 1321, 1321, 1321, 1321, 1321, 1321, 0, 0, - 0, 0, 0, 1314, 1323, 0, 1102, 1105, 1105, 1105, - 1105, 1105, 1105, 1105, 1105, 1105, 1315, 1324, 1323, 1105, - - 0, 1105, 0, 0, 0, 1105, 1105, 1105, 1105, 1105, - 1105, 1324, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 0, - 0, 0, 0, 0, 1323, 1348, 0, 1105, 1110, 1110, - 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1324, 0, 1348, - 1110, 0, 0, 0, 0, 0, 1110, 1110, 1110, 1110, - 1110, 1110, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, - 1117, 0, 0, 0, 1117, 1348, 0, 0, 0, 0, - 1117, 1117, 1117, 1117, 1117, 1117, 1127, 1127, 1127, 1127, - 1127, 1127, 1127, 1127, 1127, 0, 0, 0, 1127, 0, - 0, 0, 0, 0, 1127, 1127, 1127, 1127, 1127, 1127, - - 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 0, - 0, 0, 1140, 0, 0, 0, 0, 0, 1140, 1140, - 1140, 1140, 1140, 1140, 1154, 1154, 1154, 1154, 1154, 1154, - 1154, 1154, 1154, 0, 0, 0, 1154, 0, 0, 0, - 0, 0, 1154, 1154, 1154, 1154, 1154, 1154, 1168, 1168, - 1168, 1168, 1168, 1168, 1168, 1168, 1168, 0, 0, 0, - 1168, 0, 0, 0, 0, 0, 1168, 1168, 1168, 1168, - 1168, 1168, 1180, 1180, 1180, 1180, 1180, 1180, 1180, 1180, - 1180, 0, 0, 0, 1180, 0, 0, 0, 0, 0, - 1180, 1180, 1180, 1180, 1180, 1180, 1192, 1192, 1192, 1192, - - 1192, 1192, 1192, 1192, 1192, 0, 0, 0, 1192, 0, - 1192, 0, 0, 1349, 1192, 1192, 1192, 1192, 1192, 1192, - 1331, 1331, 1331, 1331, 1331, 1331, 1331, 1349, 1354, 1354, - 1354, 1354, 1354, 1354, 1354, 0, 1192, 1196, 1196, 1196, - 1196, 1196, 1196, 1196, 1196, 1196, 0, 0, 0, 1196, - 0, 0, 0, 1349, 0, 1196, 1196, 1196, 1196, 1196, - 1196, 1199, 1199, 1199, 1199, 1199, 1199, 1199, 1199, 1199, - 0, 0, 0, 1199, 0, 0, 0, 0, 0, 1199, - 1199, 1199, 1199, 1199, 1199, 1202, 1202, 1202, 1202, 1202, - 1202, 1202, 1202, 1202, 0, 0, 0, 1202, 0, 0, - - 0, 0, 0, 1202, 1202, 1202, 1202, 1202, 1202, 1205, - 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 0, 0, - 0, 1205, 0, 0, 0, 0, 0, 1205, 1205, 1205, - 1205, 1205, 1205, 1208, 1208, 1208, 1208, 1208, 1208, 1208, - 1208, 1208, 0, 0, 0, 1208, 0, 0, 0, 0, - 0, 1208, 1208, 1208, 1208, 1208, 1208, 1213, 1213, 1213, - 1213, 1213, 1213, 1213, 1213, 1213, 0, 0, 0, 1213, - 0, 0, 0, 0, 0, 1213, 1213, 1213, 1213, 1213, - 1213, 1265, 1265, 1265, 1265, 1265, 1265, 1265, 1265, 1265, - 0, 0, 0, 1265, 0, 0, 0, 0, 0, 1265, - - 1265, 1265, 1265, 1265, 1265, 1273, 1273, 1273, 1273, 1273, - 1273, 1273, 1273, 1273, 0, 0, 0, 1273, 0, 0, - 0, 0, 0, 1273, 1273, 1273, 1273, 1273, 1273, 1358, - 1358, 1358, 1358, 1358, 1358, 1358, 1362, 1362, 1362, 1362, - 1362, 1362, 1362, 1366, 1366, 1366, 1366, 1366, 1366, 1366, - 1370, 1370, 1370, 1370, 1370, 1370, 1370, 1375, 1375, 1375, - 1375, 1375, 1375, 1375, 1377, 1378, 1386, 1386, 1386, 1386, - 1386, 1386, 1386, 0, 0, 0, 0, 0, 1377, 1378, - 1389, 1389, 1389, 1389, 1389, 1389, 1389, 1393, 1393, 1393, - 1393, 1393, 1393, 1393, 1397, 1397, 1397, 1397, 1397, 1397, - - 1397, 0, 0, 0, 1377, 1378, 1401, 1401, 1401, 1401, - 1401, 1401, 1401, 1405, 1405, 1405, 1405, 1405, 1405, 1405, - 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1413, 1413, 1413, - 1413, 1413, 1413, 1413, 1422, 1422, 1422, 1422, 1422, 1422, - 1422, 1434, 0, 0, 0, 0, 1434, 1434, 1434, 1435, - 0, 1435, 1435, 1435, 1435, 1435, 1435, 1435, 1436, 0, - 1436, 1437, 1437, 1437, 1438, 1438, 1438, 1439, 1439, 1439, - 1440, 1440, 1440, 1441, 1441, 1441, 1442, 1442, 1442, 1443, - 1443, 1443, 1444, 1444, 1444, 1445, 1445, 1445, 1446, 0, - 1446, 1447, 1447, 1447, 1448, 1448, 1448, 1449, 1449, 1449, - - 1450, 1450, 1450, 1451, 0, 1451, 1452, 1452, 1452, 1453, - 1453, 0, 0, 1453, 1454, 1454, 1454, 1455, 1455, 1455, - 1456, 1456, 1456, 1457, 1457, 1457, 1458, 1458, 1458, 1459, - 1459, 1459, 1460, 1460, 1460, 1461, 1461, 1461, 1462, 1462, - 1462, 1463, 1463, 0, 0, 1463, 1464, 1464, 1464, 1465, - 1465, 1465, 1466, 0, 1466, 1467, 1467, 1467, 1468, 1468, - 1468, 1469, 0, 1469, 1470, 1470, 1470, 1471, 1471, 1471, - 1472, 1472, 1472, 1473, 1473, 1473, 1474, 1474, 1474, 1475, - 0, 1475, 1476, 0, 1476, 1477, 1477, 1477, 1478, 1478, - 1478, 1479, 0, 1479, 1480, 1480, 0, 0, 1480, 1481, - - 1481, 0, 0, 1481, 1482, 1482, 1482, 1483, 1483, 1483, - 1484, 1484, 0, 1484, 1485, 1485, 1485, 1486, 1486, 1486, - 1487, 1487, 1487, 1488, 1488, 1488, 1489, 1489, 1489, 1490, - 1490, 1490, 1491, 1491, 1491, 1492, 1492, 0, 0, 1492, - 1493, 1493, 1493, 1494, 1494, 1494, 1495, 1495, 0, 1495, - 1496, 1496, 0, 0, 1496, 1497, 1497, 0, 1497, 1498, - 1498, 1499, 1499, 0, 0, 1499, 1500, 1500, 1500, 1501, - 1501, 1501, 1502, 1502, 0, 1502, 1503, 0, 1503, 1504, - 0, 1504, 1505, 1505, 1505, 1506, 1506, 1506, 1507, 0, - 1507, 1508, 1508, 1508, 1509, 1509, 1509, 1510, 1510, 1510, - - 1511, 1511, 1511, 1512, 1512, 1512, 1513, 1513, 1513, 1514, - 0, 1514, 1515, 0, 1515, 1516, 1516, 1516, 1517, 1517, - 1517, 1518, 0, 1518, 1519, 0, 1519, 1520, 0, 1520, - 1521, 1521, 1521, 1522, 1522, 1522, 1523, 0, 1523, 1524, - 0, 0, 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, 1533, 1533, 0, 1533, 1533, 1534, - 1534, 1534, 1535, 1535, 1535, 1536, 1536, 1536, 1537, 1537, - 1537, 1538, 1538, 1538, 1539, 1539, 1539, 1540, 1540, 1540, - - 1541, 1541, 1541, 1542, 1542, 0, 0, 1542, 1543, 1543, - 1543, 1544, 1544, 1544, 1545, 1545, 0, 1545, 1546, 1546, - 0, 0, 1546, 1547, 1547, 0, 1547, 1548, 1548, 1549, - 1549, 0, 0, 1549, 1550, 1550, 1550, 1551, 1551, 1551, - 1552, 1552, 0, 1552, 1553, 0, 0, 1553, 1554, 1554, - 0, 1554, 1555, 1555, 0, 0, 1555, 1556, 1556, 0, - 1556, 1557, 1557, 1558, 1558, 0, 0, 1558, 1559, 1559, - 1559, 1560, 1560, 1560, 1561, 1561, 0, 1561, 1562, 0, - 1562, 1563, 0, 1563, 1564, 0, 1564, 1565, 1565, 1565, - 1566, 1566, 1566, 1567, 0, 1567, 1568, 1568, 1568, 0, - - 1568, 1568, 1569, 1569, 1569, 1570, 1570, 1570, 1571, 1571, - 1571, 1572, 1572, 1572, 1573, 1573, 1573, 1574, 1574, 1574, - 1575, 1575, 1575, 1576, 0, 1576, 1577, 0, 1577, 1578, - 1578, 1578, 1579, 1579, 1579, 1580, 0, 1580, 1581, 0, - 1581, 1582, 0, 1582, 1583, 1583, 1583, 1584, 1584, 1584, - 1585, 0, 1585, 1586, 0, 1586, 1587, 0, 1587, 1588, - 0, 1588, 1589, 1589, 1589, 1590, 1590, 1590, 1591, 0, - 1591, 1592, 0, 1592, 1593, 0, 0, 1593, 1594, 1594, - 0, 1594, 1595, 1595, 0, 0, 1595, 1596, 1596, 0, - 1596, 1597, 1597, 1598, 1598, 0, 0, 1598, 1599, 1599, - - 1599, 1600, 1600, 1600, 1601, 1601, 0, 1601, 1602, 1602, - 1602, 0, 1602, 1602, 1603, 1603, 1603, 1604, 1604, 1604, - 1605, 1605, 1605, 1606, 1606, 1606, 1607, 1607, 1607, 1608, - 1608, 1608, 1609, 1609, 1609, 1610, 1610, 1610, 1611, 1611, - 0, 0, 1611, 1612, 1612, 1612, 1613, 1613, 1613, 1614, - 1614, 0, 1614, 1615, 1615, 0, 0, 1615, 1616, 1616, - 0, 1616, 1617, 1617, 1618, 1618, 0, 0, 1618, 1619, - 1619, 1619, 1620, 1620, 1620, 1621, 1621, 0, 1621, 1622, - 0, 0, 1622, 1623, 1623, 0, 1623, 1624, 1624, 0, - 0, 1624, 1625, 1625, 0, 1625, 1626, 1626, 1627, 1627, - - 0, 0, 1627, 1628, 1628, 1628, 1629, 1629, 1629, 1630, - 1630, 0, 1630, 1631, 0, 1631, 1632, 0, 0, 1632, - 1633, 1633, 0, 1633, 1634, 1634, 0, 0, 1634, 1635, - 1635, 0, 1635, 1636, 1636, 1637, 1637, 0, 0, 1637, - 1638, 1638, 1638, 1639, 1639, 1639, 1640, 1640, 0, 1640, - 1641, 0, 1641, 1642, 0, 1642, 1643, 0, 1643, 1644, - 1644, 1644, 1645, 1645, 1645, 1646, 0, 1646, 1647, 1647, - 1647, 0, 1647, 1647, 1648, 1648, 1648, 1649, 1649, 1649, - 1650, 1650, 1650, 1651, 1651, 1651, 1652, 1652, 1652, 1653, - 1653, 1653, 1654, 1654, 1654, 1655, 1655, 1655, 1656, 1656, - - 1656, 1657, 1657, 1657, 1658, 0, 1658, 1659, 0, 1659, - 1660, 1660, 1660, 1661, 1661, 1661, 1662, 1662, 1662, 1663, - 0, 1663, 1664, 0, 1664, 1665, 0, 1665, 1666, 1666, - 1666, 1667, 1667, 1667, 1668, 1668, 1668, 1669, 0, 1669, - 1670, 0, 1670, 1671, 0, 1671, 1672, 0, 1672, 1673, - 1673, 1673, 1674, 1674, 1674, 1675, 1675, 1675, 1676, 0, - 1676, 1677, 0, 1677, 1678, 0, 1678, 1679, 0, 1679, - 1680, 1680, 1680, 1681, 1681, 1681, 1682, 1682, 1682, 1683, - 0, 1683, 1684, 0, 1684, 1685, 0, 0, 1685, 1686, - 1686, 0, 1686, 1687, 1687, 0, 0, 1687, 1688, 1688, - - 0, 1688, 1689, 1689, 1690, 1690, 0, 0, 1690, 1691, - 1691, 1691, 1692, 1692, 1692, 1693, 1693, 0, 1693, 1694, - 1694, 1694, 0, 1694, 1694, 1695, 1695, 1695, 1696, 1696, - 1696, 1697, 1697, 1697, 1698, 1698, 1698, 1699, 1699, 1699, - 1700, 1700, 1700, 1701, 1701, 1701, 1702, 1702, 1702, 1703, - 0, 1703, 1704, 1704, 1704, 1705, 1705, 0, 0, 1705, - 1706, 1706, 1706, 1707, 1707, 1707, 1708, 1708, 0, 1708, - 1709, 1709, 0, 0, 1709, 1710, 1710, 0, 1710, 1711, - 1711, 1712, 1712, 0, 0, 1712, 1713, 1713, 1713, 1714, - 1714, 1714, 1715, 1715, 0, 1715, 1716, 0, 0, 1716, - - 1717, 1717, 0, 1717, 1718, 1718, 0, 0, 1718, 1719, - 1719, 0, 1719, 1720, 1720, 1721, 1721, 0, 0, 1721, - 1722, 1722, 1722, 1723, 1723, 1723, 1724, 1724, 0, 1724, - 1725, 0, 1725, 1726, 0, 0, 1726, 1727, 1727, 0, - 1727, 1728, 1728, 0, 0, 1728, 1729, 1729, 0, 1729, - 1730, 1730, 1731, 1731, 0, 0, 1731, 1732, 1732, 1732, - 1733, 1733, 1733, 1734, 1734, 0, 1734, 1735, 0, 1735, - 1736, 0, 0, 1736, 1737, 1737, 0, 1737, 1738, 1738, - 0, 0, 1738, 1739, 1739, 0, 1739, 1740, 1740, 1741, - 1741, 0, 0, 1741, 1742, 1742, 1742, 1743, 1743, 1743, - - 1744, 1744, 0, 1744, 1745, 0, 1745, 1746, 0, 1746, - 1747, 0, 1747, 1748, 1748, 1748, 1749, 0, 1749, 1750, - 1750, 1750, 1751, 0, 1751, 1752, 1752, 1752, 0, 1752, + 656, 658, 658, 658, 658, 658, 658, 658, 762, 761, + 758, 757, 658, 754, 750, 747, 746, 745, 658, 658, + 658, 658, 658, 658, 659, 659, 659, 659, 659, 659, + 659, 659, 659, 744, 741, 738, 659, 735, 734, 707, + + 706, 930, 659, 659, 659, 659, 659, 659, 660, 660, + 660, 660, 660, 660, 660, 930, 703, 699, 698, 660, + 695, 691, 687, 680, 676, 660, 660, 660, 660, 660, + 660, 662, 662, 662, 662, 662, 662, 662, 662, 662, + 671, 930, 666, 662, 665, 664, 661, 657, 931, 662, + 662, 662, 662, 662, 662, 663, 663, 663, 663, 663, + 663, 663, 931, 647, 646, 642, 663, 641, 639, 638, + 633, 623, 663, 663, 663, 663, 663, 663, 667, 667, + 667, 667, 667, 667, 667, 667, 619, 613, 931, 667, + 612, 609, 605, 604, 601, 667, 667, 667, 667, 667, + + 667, 669, 669, 669, 669, 669, 669, 669, 669, 669, + 600, 597, 593, 669, 590, 589, 588, 587, 584, 669, + 669, 669, 669, 669, 669, 670, 670, 670, 670, 670, + 670, 670, 670, 581, 580, 573, 670, 570, 568, 564, + 560, 559, 670, 670, 670, 670, 670, 670, 678, 678, + 678, 678, 678, 678, 678, 678, 678, 558, 557, 553, + 678, 552, 550, 549, 548, 547, 678, 678, 678, 678, + 678, 678, 679, 679, 679, 679, 679, 679, 679, 679, + 546, 545, 544, 679, 543, 542, 541, 540, 539, 679, + 679, 679, 679, 679, 679, 689, 689, 689, 689, 689, + + 689, 689, 689, 689, 536, 535, 534, 689, 532, 531, + 528, 523, 519, 689, 689, 689, 689, 689, 689, 690, + 690, 690, 690, 690, 690, 690, 690, 515, 510, 505, + 690, 504, 503, 499, 493, 492, 690, 690, 690, 690, + 690, 690, 702, 702, 702, 702, 702, 702, 702, 702, + 702, 487, 486, 485, 702, 484, 483, 482, 481, 480, + 702, 702, 702, 702, 702, 702, 704, 704, 704, 704, + 704, 704, 704, 704, 704, 479, 478, 477, 704, 475, + 704, 472, 471, 470, 704, 704, 704, 704, 704, 704, + 860, 860, 860, 860, 860, 860, 860, 864, 864, 864, + + 864, 864, 864, 864, 934, 935, 704, 726, 945, 726, + 726, 726, 726, 726, 726, 726, 469, 468, 934, 935, + 726, 467, 945, 466, 464, 726, 726, 726, 726, 726, + 726, 726, 728, 728, 728, 728, 728, 728, 728, 463, + 462, 461, 459, 728, 934, 935, 457, 456, 945, 728, + 728, 728, 728, 728, 728, 730, 730, 730, 730, 730, + 730, 730, 455, 454, 453, 452, 730, 451, 1341, 449, + 448, 447, 730, 730, 730, 730, 730, 730, 732, 732, + 732, 732, 732, 732, 732, 732, 1341, 444, 440, 436, + 732, 435, 434, 431, 427, 1341, 732, 732, 732, 732, + + 732, 732, 733, 733, 733, 733, 733, 733, 733, 733, + 736, 736, 736, 736, 736, 736, 736, 736, 736, 426, + 423, 422, 736, 421, 736, 420, 417, 416, 736, 736, + 736, 736, 736, 736, 871, 871, 871, 871, 871, 871, + 871, 943, 943, 943, 943, 943, 943, 943, 946, 407, + 736, 739, 739, 739, 739, 739, 739, 739, 739, 739, + 404, 949, 946, 739, 402, 739, 401, 950, 961, 739, + 739, 739, 739, 739, 739, 949, 400, 399, 398, 397, + 396, 950, 961, 395, 394, 393, 392, 1340, 946, 962, + 391, 739, 742, 742, 742, 742, 742, 742, 742, 742, + + 742, 949, 389, 962, 742, 1340, 742, 950, 961, 965, + 742, 742, 742, 742, 742, 742, 959, 959, 959, 959, + 959, 959, 959, 965, 1340, 387, 386, 384, 966, 962, + 1072, 383, 742, 748, 748, 748, 748, 748, 748, 748, + 748, 748, 966, 380, 1072, 748, 379, 748, 377, 965, + 1073, 748, 748, 748, 748, 748, 748, 974, 974, 974, + 974, 974, 974, 974, 1073, 375, 374, 373, 966, 1076, + 1072, 1077, 370, 748, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 1076, 369, 1077, 753, 367, 366, 365, + 1073, 364, 753, 753, 753, 753, 753, 753, 755, 755, + + 755, 755, 755, 755, 755, 755, 755, 362, 357, 1076, + 755, 1077, 755, 356, 355, 352, 755, 755, 755, 755, + 755, 755, 976, 976, 976, 976, 976, 976, 976, 980, + 980, 980, 980, 980, 980, 980, 1119, 348, 755, 765, + 765, 765, 765, 765, 765, 765, 765, 765, 346, 341, + 1119, 765, 340, 337, 332, 331, 323, 765, 765, 765, + 765, 765, 765, 767, 767, 767, 767, 767, 767, 767, + 767, 767, 985, 986, 1120, 767, 1119, 767, 321, 320, + 315, 767, 767, 767, 767, 767, 767, 313, 1120, 311, + 985, 986, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1125, + + 310, 985, 986, 767, 780, 780, 780, 780, 780, 780, + 780, 780, 780, 1125, 1120, 309, 780, 308, 307, 306, + 305, 303, 780, 780, 780, 780, 780, 780, 782, 782, + 782, 782, 782, 782, 782, 782, 782, 987, 1126, 1125, + 782, 302, 782, 301, 296, 1387, 782, 782, 782, 782, + 782, 782, 1126, 293, 292, 987, 1024, 1024, 1024, 1024, + 1024, 1024, 1024, 1387, 291, 1129, 987, 288, 782, 794, + 794, 794, 794, 794, 794, 794, 794, 794, 1126, 1129, + 285, 794, 1387, 284, 282, 280, 1130, 794, 794, 794, + 794, 794, 794, 795, 795, 795, 795, 795, 795, 795, + + 1130, 279, 278, 276, 795, 1129, 272, 271, 269, 266, + 795, 795, 795, 795, 795, 795, 811, 1138, 811, 811, + 811, 811, 811, 811, 811, 262, 1130, 261, 258, 811, + 257, 1138, 255, 250, 811, 811, 811, 811, 811, 811, + 811, 812, 812, 812, 812, 812, 812, 812, 247, 245, + 244, 242, 812, 239, 235, 231, 229, 1138, 812, 812, + 812, 812, 812, 812, 813, 813, 813, 813, 813, 813, + 813, 813, 227, 226, 224, 223, 813, 222, 813, 221, + 220, 219, 813, 813, 813, 813, 813, 813, 1028, 1028, + 1028, 1028, 1028, 1028, 1028, 1033, 1033, 1033, 1033, 1033, + + 1033, 1033, 218, 1139, 813, 815, 815, 815, 815, 815, + 815, 815, 216, 214, 212, 211, 815, 1139, 209, 207, + 206, 204, 815, 815, 815, 815, 815, 815, 816, 816, + 816, 816, 816, 816, 816, 816, 201, 200, 199, 197, + 816, 195, 194, 1139, 191, 190, 816, 816, 816, 816, + 816, 816, 817, 817, 817, 817, 817, 817, 817, 817, + 819, 819, 819, 819, 819, 819, 819, 188, 187, 186, + 185, 819, 184, 183, 182, 181, 180, 819, 819, 819, + 819, 819, 819, 820, 820, 820, 820, 820, 820, 820, + 820, 820, 179, 177, 176, 820, 173, 172, 171, 170, + + 1142, 820, 820, 820, 820, 820, 820, 821, 821, 821, + 821, 821, 821, 821, 1142, 169, 168, 167, 821, 166, + 164, 161, 160, 159, 821, 821, 821, 821, 821, 821, + 823, 823, 823, 823, 823, 823, 823, 823, 823, 158, + 1142, 155, 823, 153, 144, 143, 142, 1143, 823, 823, + 823, 823, 823, 823, 824, 824, 824, 824, 824, 824, + 824, 1143, 141, 140, 139, 824, 138, 136, 134, 133, + 131, 824, 824, 824, 824, 824, 824, 826, 826, 826, + 826, 826, 826, 826, 826, 826, 129, 1143, 127, 826, + 126, 125, 124, 122, 1152, 826, 826, 826, 826, 826, + + 826, 827, 827, 827, 827, 827, 827, 827, 1152, 121, + 120, 119, 827, 118, 117, 115, 113, 112, 827, 827, + 827, 827, 827, 827, 831, 831, 831, 831, 831, 831, + 831, 831, 111, 110, 1152, 831, 109, 108, 107, 106, + 105, 831, 831, 831, 831, 831, 831, 833, 833, 833, + 833, 833, 833, 833, 833, 833, 103, 102, 95, 833, + 94, 93, 91, 90, 89, 833, 833, 833, 833, 833, + 833, 834, 834, 834, 834, 834, 834, 834, 834, 88, + 87, 86, 834, 85, 84, 82, 81, 80, 834, 834, + 834, 834, 834, 834, 842, 842, 842, 842, 842, 842, + + 842, 842, 842, 79, 78, 77, 842, 76, 75, 74, + 73, 72, 842, 842, 842, 842, 842, 842, 843, 843, + 843, 843, 843, 843, 843, 843, 71, 70, 69, 843, + 67, 66, 65, 51, 43, 843, 843, 843, 843, 843, + 843, 853, 853, 853, 853, 853, 853, 853, 853, 853, + 42, 40, 30, 853, 18, 10, 8, 3, 0, 853, + 853, 853, 853, 853, 853, 854, 854, 854, 854, 854, + 854, 854, 854, 0, 0, 0, 854, 0, 0, 0, + 0, 0, 854, 854, 854, 854, 854, 854, 865, 865, + 865, 865, 865, 865, 865, 865, 865, 0, 0, 0, + + 865, 0, 0, 0, 0, 0, 865, 865, 865, 865, + 865, 865, 866, 866, 866, 866, 866, 866, 866, 866, + 0, 0, 0, 866, 0, 0, 0, 0, 0, 866, + 866, 866, 866, 866, 866, 879, 879, 879, 879, 879, + 879, 879, 879, 879, 0, 0, 0, 879, 0, 0, + 0, 0, 0, 879, 879, 879, 879, 879, 879, 881, + 881, 881, 881, 881, 881, 881, 881, 881, 0, 0, + 0, 881, 0, 881, 0, 0, 0, 881, 881, 881, + 881, 881, 881, 1035, 1035, 1035, 1035, 1035, 1035, 1035, + 1039, 1039, 1039, 1039, 1039, 1039, 1039, 0, 0, 881, + + 898, 898, 898, 898, 898, 898, 898, 898, 898, 0, + 0, 0, 0, 898, 0, 0, 0, 0, 898, 898, + 898, 898, 898, 898, 898, 899, 899, 899, 899, 899, + 899, 899, 899, 900, 900, 900, 900, 900, 900, 900, + 900, 900, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 0, + 0, 900, 904, 904, 904, 904, 904, 904, 904, 904, + 904, 0, 0, 0, 904, 0, 904, 0, 0, 0, + 904, 904, 904, 904, 904, 904, 1047, 1047, 1047, 1047, + 1047, 1047, 1047, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + 0, 0, 904, 907, 907, 907, 907, 907, 907, 907, + + 907, 907, 0, 0, 0, 907, 0, 907, 0, 0, + 0, 907, 907, 907, 907, 907, 907, 1057, 1057, 1057, + 1057, 1057, 1057, 1057, 1059, 1059, 1059, 1059, 1059, 1059, + 1059, 0, 0, 907, 910, 910, 910, 910, 910, 910, + 910, 910, 910, 0, 0, 0, 910, 0, 910, 0, + 0, 0, 910, 910, 910, 910, 910, 910, 1063, 1063, + 1063, 1063, 1063, 1063, 1063, 1070, 1070, 1070, 1070, 1070, + 1070, 1070, 1090, 0, 910, 913, 913, 913, 913, 913, + 913, 913, 913, 913, 0, 1153, 1156, 913, 0, 913, + 1090, 0, 0, 913, 913, 913, 913, 913, 913, 1153, + + 1156, 1090, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 0, + 1157, 0, 0, 0, 1166, 913, 918, 918, 918, 918, + 918, 918, 918, 918, 1157, 1153, 1156, 918, 1166, 0, + 0, 0, 0, 918, 918, 918, 918, 918, 918, 919, + 919, 919, 919, 919, 919, 919, 919, 919, 0, 0, + 1157, 919, 0, 919, 1166, 0, 0, 919, 919, 919, + 919, 919, 919, 1136, 1136, 1136, 1136, 1136, 1136, 1136, + 1150, 1150, 1150, 1150, 1150, 1150, 1150, 1167, 0, 919, + 924, 924, 924, 924, 924, 924, 924, 924, 924, 0, + 0, 1167, 924, 0, 0, 0, 0, 0, 924, 924, + + 924, 924, 924, 924, 926, 926, 926, 926, 926, 926, + 926, 926, 926, 0, 0, 0, 926, 1167, 926, 0, + 0, 1170, 926, 926, 926, 926, 926, 926, 1164, 1164, + 1164, 1164, 1164, 1164, 1164, 1170, 0, 0, 0, 0, + 1171, 0, 1215, 0, 926, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 1171, 0, 1215, 936, 0, 0, + 0, 1170, 0, 936, 936, 936, 936, 936, 936, 938, + 938, 938, 938, 938, 938, 938, 938, 938, 0, 0, + 1171, 938, 1215, 938, 0, 0, 0, 938, 938, 938, + 938, 938, 938, 1177, 1177, 1177, 1177, 1177, 1177, 1177, + + 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1216, 0, 938, + 951, 951, 951, 951, 951, 951, 951, 951, 951, 0, + 0, 1216, 951, 0, 0, 0, 0, 0, 951, 951, + 951, 951, 951, 951, 953, 953, 953, 953, 953, 953, + 953, 953, 953, 0, 0, 0, 953, 1216, 953, 0, + 0, 0, 953, 953, 953, 953, 953, 953, 1183, 1183, + 1183, 1183, 1183, 1183, 1183, 1223, 1223, 1223, 1223, 1223, + 1223, 1223, 1263, 0, 953, 967, 967, 967, 967, 967, + 967, 967, 967, 967, 0, 0, 1263, 967, 0, 0, + 0, 0, 1194, 967, 967, 967, 967, 967, 967, 969, + + 969, 969, 969, 969, 969, 969, 969, 969, 1195, 0, + 1194, 969, 1263, 969, 0, 0, 0, 969, 969, 969, + 969, 969, 969, 1194, 0, 0, 1195, 1228, 1228, 1228, + 1228, 1228, 1228, 1228, 0, 0, 1264, 1195, 0, 969, + 981, 981, 981, 981, 981, 981, 981, 981, 981, 0, + 1264, 0, 981, 0, 0, 0, 0, 1267, 981, 981, + 981, 981, 981, 981, 982, 982, 982, 982, 982, 982, + 982, 1267, 0, 0, 0, 982, 1264, 0, 0, 0, + 0, 982, 982, 982, 982, 982, 982, 997, 997, 997, + 997, 997, 997, 997, 997, 997, 0, 1267, 0, 0, + + 997, 0, 0, 0, 0, 997, 997, 997, 997, 997, + 997, 997, 998, 998, 998, 998, 998, 998, 998, 998, + 999, 999, 999, 999, 999, 999, 999, 999, 999, 1230, + 1230, 1230, 1230, 1230, 1230, 1230, 0, 1268, 999, 1001, + 1001, 1001, 1001, 1001, 1001, 1001, 0, 0, 0, 0, + 1001, 1268, 0, 0, 0, 0, 1001, 1001, 1001, 1001, + 1001, 1001, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, + 1002, 0, 0, 0, 1002, 0, 0, 1268, 0, 1292, + 1002, 1002, 1002, 1002, 1002, 1002, 1003, 1003, 1003, 1003, + 1003, 1003, 1003, 1292, 0, 0, 0, 1003, 0, 0, + + 0, 0, 0, 1003, 1003, 1003, 1003, 1003, 1003, 1005, + 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 0, 1292, + 0, 1005, 0, 0, 0, 0, 1293, 1005, 1005, 1005, + 1005, 1005, 1005, 1006, 1006, 1006, 1006, 1006, 1006, 1006, + 1293, 0, 0, 0, 1006, 0, 0, 0, 0, 0, + 1006, 1006, 1006, 1006, 1006, 1006, 1008, 1008, 1008, 1008, + 1008, 1008, 1008, 1008, 1008, 0, 1293, 0, 1008, 0, + 0, 0, 0, 1300, 1008, 1008, 1008, 1008, 1008, 1008, + 1009, 1009, 1009, 1009, 1009, 1009, 1009, 1300, 0, 0, + 0, 1009, 0, 0, 0, 0, 0, 1009, 1009, 1009, + + 1009, 1009, 1009, 1011, 1011, 1011, 1011, 1011, 1011, 1011, + 1011, 1011, 0, 1300, 0, 1011, 0, 0, 0, 0, + 1301, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1301, 0, 0, 0, 1012, 0, + 0, 0, 0, 0, 1012, 1012, 1012, 1012, 1012, 1012, + 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 0, + 1301, 0, 1015, 0, 1015, 0, 0, 0, 1015, 1015, + 1015, 1015, 1015, 1015, 1236, 1236, 1236, 1236, 1236, 1236, + 1236, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1309, 0, + 1015, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, + + 0, 0, 1309, 1020, 0, 0, 0, 0, 0, 1020, + 1020, 1020, 1020, 1020, 1020, 1029, 1029, 1029, 1029, 1029, + 1029, 1029, 1029, 1029, 0, 0, 0, 1029, 1309, 0, + 0, 0, 0, 1029, 1029, 1029, 1029, 1029, 1029, 1040, + 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1040, 0, 0, + 0, 1040, 0, 0, 0, 0, 0, 1040, 1040, 1040, + 1040, 1040, 1040, 1052, 1052, 1052, 1052, 1052, 1052, 1052, + 1052, 1052, 0, 0, 0, 1052, 0, 0, 0, 0, + 0, 1052, 1052, 1052, 1052, 1052, 1052, 1064, 1064, 1064, + 1064, 1064, 1064, 1064, 1064, 1064, 0, 0, 0, 1064, + + 0, 0, 0, 0, 0, 1064, 1064, 1064, 1064, 1064, + 1064, 1078, 1078, 1078, 1078, 1078, 1078, 1078, 1078, 1078, + 0, 0, 0, 1078, 0, 0, 0, 0, 0, 1078, + 1078, 1078, 1078, 1078, 1078, 1080, 1080, 1080, 1080, 1080, + 1080, 1080, 1080, 1080, 0, 0, 0, 1080, 0, 1080, + 0, 0, 0, 1080, 1080, 1080, 1080, 1080, 1080, 1244, + 1244, 1244, 1244, 1244, 1244, 1244, 1246, 1246, 1246, 1246, + 1246, 1246, 1246, 0, 0, 1080, 1094, 1094, 1094, 1094, + 1094, 1094, 1094, 1094, 1094, 1252, 1252, 1252, 1252, 1252, + 1252, 1252, 0, 1310, 1094, 1096, 1096, 1096, 1096, 1096, + + 1096, 1096, 1096, 0, 0, 0, 1096, 1310, 0, 0, + 0, 0, 1096, 1096, 1096, 1096, 1096, 1096, 1097, 1097, + 1097, 1097, 1097, 1097, 1097, 1097, 1097, 0, 0, 0, + 1097, 0, 1097, 1310, 0, 0, 1097, 1097, 1097, 1097, + 1097, 1097, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1261, + 1261, 1261, 1261, 1261, 1261, 1261, 0, 0, 1097, 1100, + 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 0, 0, + 0, 1100, 0, 1100, 0, 0, 0, 1100, 1100, 1100, + 1100, 1100, 1100, 1286, 1286, 1286, 1286, 1286, 1286, 1286, + 1298, 1298, 1298, 1298, 1298, 1298, 1298, 0, 0, 1100, + + 1103, 1103, 1103, 1103, 1103, 1103, 1103, 1103, 1103, 0, + 0, 0, 1103, 0, 1103, 0, 0, 0, 1103, 1103, + 1103, 1103, 1103, 1103, 1307, 1307, 1307, 1307, 1307, 1307, + 1307, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1318, 0, + 1103, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, + 0, 1319, 1318, 1106, 0, 1106, 0, 0, 0, 1106, + 1106, 1106, 1106, 1106, 1106, 1319, 1325, 1325, 1325, 1325, + 1325, 1325, 1325, 0, 0, 0, 0, 0, 1318, 1327, + 0, 1106, 1109, 1109, 1109, 1109, 1109, 1109, 1109, 1109, + 1109, 1319, 1328, 1327, 1109, 0, 1109, 0, 0, 0, + + 1109, 1109, 1109, 1109, 1109, 1109, 1328, 1333, 1333, 1333, + 1333, 1333, 1333, 1333, 0, 0, 0, 0, 0, 1327, + 1352, 0, 1109, 1114, 1114, 1114, 1114, 1114, 1114, 1114, + 1114, 1114, 1328, 0, 1352, 1114, 0, 0, 0, 0, + 0, 1114, 1114, 1114, 1114, 1114, 1114, 1121, 1121, 1121, + 1121, 1121, 1121, 1121, 1121, 1121, 0, 0, 0, 1121, + 1352, 0, 0, 0, 0, 1121, 1121, 1121, 1121, 1121, + 1121, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, + 0, 0, 0, 1131, 0, 0, 0, 0, 0, 1131, + 1131, 1131, 1131, 1131, 1131, 1144, 1144, 1144, 1144, 1144, + + 1144, 1144, 1144, 1144, 0, 0, 0, 1144, 0, 0, + 0, 0, 0, 1144, 1144, 1144, 1144, 1144, 1144, 1158, + 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 0, 0, + 0, 1158, 0, 0, 0, 0, 0, 1158, 1158, 1158, + 1158, 1158, 1158, 1172, 1172, 1172, 1172, 1172, 1172, 1172, + 1172, 1172, 0, 0, 0, 1172, 0, 0, 0, 0, + 0, 1172, 1172, 1172, 1172, 1172, 1172, 1184, 1184, 1184, + 1184, 1184, 1184, 1184, 1184, 1184, 0, 0, 0, 1184, + 0, 0, 0, 0, 0, 1184, 1184, 1184, 1184, 1184, + 1184, 1196, 1196, 1196, 1196, 1196, 1196, 1196, 1196, 1196, + + 0, 0, 0, 1196, 0, 1196, 0, 0, 1353, 1196, + 1196, 1196, 1196, 1196, 1196, 1335, 1335, 1335, 1335, 1335, + 1335, 1335, 1353, 1358, 1358, 1358, 1358, 1358, 1358, 1358, + 0, 1196, 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200, + 1200, 0, 0, 0, 1200, 0, 0, 0, 1353, 0, + 1200, 1200, 1200, 1200, 1200, 1200, 1203, 1203, 1203, 1203, + 1203, 1203, 1203, 1203, 1203, 0, 0, 0, 1203, 0, + 0, 0, 0, 0, 1203, 1203, 1203, 1203, 1203, 1203, + 1206, 1206, 1206, 1206, 1206, 1206, 1206, 1206, 1206, 0, + 0, 0, 1206, 0, 0, 0, 0, 0, 1206, 1206, + + 1206, 1206, 1206, 1206, 1209, 1209, 1209, 1209, 1209, 1209, + 1209, 1209, 1209, 0, 0, 0, 1209, 0, 0, 0, + 0, 0, 1209, 1209, 1209, 1209, 1209, 1209, 1212, 1212, + 1212, 1212, 1212, 1212, 1212, 1212, 1212, 0, 0, 0, + 1212, 0, 0, 0, 0, 0, 1212, 1212, 1212, 1212, + 1212, 1212, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + 1217, 0, 0, 0, 1217, 0, 0, 0, 0, 0, + 1217, 1217, 1217, 1217, 1217, 1217, 1269, 1269, 1269, 1269, + 1269, 1269, 1269, 1269, 1269, 0, 0, 0, 1269, 0, + 0, 0, 0, 0, 1269, 1269, 1269, 1269, 1269, 1269, + + 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 0, + 0, 0, 1277, 0, 0, 0, 0, 0, 1277, 1277, + 1277, 1277, 1277, 1277, 1362, 1362, 1362, 1362, 1362, 1362, + 1362, 1366, 1366, 1366, 1366, 1366, 1366, 1366, 1370, 1370, + 1370, 1370, 1370, 1370, 1370, 1374, 1374, 1374, 1374, 1374, + 1374, 1374, 1379, 1379, 1379, 1379, 1379, 1379, 1379, 1381, + 1382, 1390, 1390, 1390, 1390, 1390, 1390, 1390, 0, 0, + 0, 0, 0, 1381, 1382, 1393, 1393, 1393, 1393, 1393, + 1393, 1393, 1397, 1397, 1397, 1397, 1397, 1397, 1397, 1401, + 1401, 1401, 1401, 1401, 1401, 1401, 0, 0, 0, 1381, + + 1382, 1405, 1405, 1405, 1405, 1405, 1405, 1405, 1409, 1409, + 1409, 1409, 1409, 1409, 1409, 1412, 1412, 1412, 1412, 1412, + 1412, 1412, 1417, 1417, 1417, 1417, 1417, 1417, 1417, 1426, + 1426, 1426, 1426, 1426, 1426, 1426, 1438, 0, 0, 0, + 0, 1438, 1438, 1438, 1439, 0, 1439, 1439, 1439, 1439, + 1439, 1439, 1439, 1440, 0, 1440, 1441, 1441, 1441, 1442, + 1442, 1442, 1443, 1443, 1443, 1444, 1444, 1444, 1445, 1445, + 1445, 1446, 1446, 1446, 1447, 1447, 1447, 1448, 1448, 1448, + 1449, 1449, 1449, 1450, 0, 1450, 1451, 1451, 1451, 1452, + 1452, 1452, 1453, 1453, 1453, 1454, 1454, 1454, 1455, 0, + + 1455, 1456, 1456, 1456, 1457, 1457, 0, 0, 1457, 1458, + 1458, 1458, 1459, 1459, 1459, 1460, 1460, 1460, 1461, 1461, + 1461, 1462, 1462, 1462, 1463, 1463, 1463, 1464, 1464, 1464, + 1465, 1465, 1465, 1466, 1466, 1466, 1467, 1467, 0, 0, + 1467, 1468, 1468, 1468, 1469, 1469, 1469, 1470, 0, 1470, + 1471, 1471, 1471, 1472, 1472, 1472, 1473, 0, 1473, 1474, + 1474, 1474, 1475, 1475, 1475, 1476, 1476, 1476, 1477, 1477, + 1477, 1478, 1478, 1478, 1479, 0, 1479, 1480, 0, 1480, + 1481, 1481, 1481, 1482, 1482, 1482, 1483, 0, 1483, 1484, + 1484, 0, 0, 1484, 1485, 1485, 0, 0, 1485, 1486, + + 1486, 1486, 1487, 1487, 1487, 1488, 1488, 0, 1488, 1489, + 1489, 1489, 1490, 1490, 1490, 1491, 1491, 1491, 1492, 1492, + 1492, 1493, 1493, 1493, 1494, 1494, 1494, 1495, 1495, 1495, + 1496, 1496, 0, 0, 1496, 1497, 1497, 1497, 1498, 1498, + 1498, 1499, 1499, 0, 1499, 1500, 1500, 0, 0, 1500, + 1501, 1501, 0, 1501, 1502, 1502, 1503, 1503, 0, 0, + 1503, 1504, 1504, 1504, 1505, 1505, 1505, 1506, 1506, 0, + 1506, 1507, 0, 1507, 1508, 0, 1508, 1509, 1509, 1509, + 1510, 1510, 1510, 1511, 0, 1511, 1512, 1512, 1512, 1513, + 1513, 1513, 1514, 1514, 1514, 1515, 1515, 1515, 1516, 1516, + + 1516, 1517, 1517, 1517, 1518, 0, 1518, 1519, 0, 1519, + 1520, 1520, 1520, 1521, 1521, 1521, 1522, 0, 1522, 1523, + 0, 1523, 1524, 0, 1524, 1525, 1525, 1525, 1526, 1526, + 1526, 1527, 0, 1527, 1528, 0, 0, 1528, 1529, 1529, + 0, 1529, 1530, 1530, 0, 0, 1530, 1531, 1531, 0, + 1531, 1532, 1532, 1533, 1533, 0, 0, 1533, 1534, 1534, + 1534, 1535, 1535, 1535, 1536, 1536, 0, 1536, 1537, 1537, + 1537, 0, 1537, 1537, 1538, 1538, 1538, 1539, 1539, 1539, + 1540, 1540, 1540, 1541, 1541, 1541, 1542, 1542, 1542, 1543, + 1543, 1543, 1544, 1544, 1544, 1545, 1545, 1545, 1546, 1546, + + 0, 0, 1546, 1547, 1547, 1547, 1548, 1548, 1548, 1549, + 1549, 0, 1549, 1550, 1550, 0, 0, 1550, 1551, 1551, + 0, 1551, 1552, 1552, 1553, 1553, 0, 0, 1553, 1554, + 1554, 1554, 1555, 1555, 1555, 1556, 1556, 0, 1556, 1557, + 0, 0, 1557, 1558, 1558, 0, 1558, 1559, 1559, 0, + 0, 1559, 1560, 1560, 0, 1560, 1561, 1561, 1562, 1562, + 0, 0, 1562, 1563, 1563, 1563, 1564, 1564, 1564, 1565, + 1565, 0, 1565, 1566, 0, 1566, 1567, 0, 1567, 1568, + 0, 1568, 1569, 1569, 1569, 1570, 1570, 1570, 1571, 0, + 1571, 1572, 1572, 1572, 0, 1572, 1572, 1573, 1573, 1573, + + 1574, 1574, 1574, 1575, 1575, 1575, 1576, 1576, 1576, 1577, + 1577, 1577, 1578, 1578, 1578, 1579, 1579, 1579, 1580, 0, + 1580, 1581, 0, 1581, 1582, 1582, 1582, 1583, 1583, 1583, + 1584, 0, 1584, 1585, 0, 1585, 1586, 0, 1586, 1587, + 1587, 1587, 1588, 1588, 1588, 1589, 0, 1589, 1590, 0, + 1590, 1591, 0, 1591, 1592, 0, 1592, 1593, 1593, 1593, + 1594, 1594, 1594, 1595, 0, 1595, 1596, 0, 1596, 1597, + 0, 0, 1597, 1598, 1598, 0, 1598, 1599, 1599, 0, + 0, 1599, 1600, 1600, 0, 1600, 1601, 1601, 1602, 1602, + 0, 0, 1602, 1603, 1603, 1603, 1604, 1604, 1604, 1605, + + 1605, 0, 1605, 1606, 1606, 1606, 0, 1606, 1606, 1607, + 1607, 1607, 1608, 1608, 1608, 1609, 1609, 1609, 1610, 1610, + 1610, 1611, 1611, 1611, 1612, 1612, 1612, 1613, 1613, 1613, + 1614, 1614, 1614, 1615, 1615, 0, 0, 1615, 1616, 1616, + 1616, 1617, 1617, 1617, 1618, 1618, 0, 1618, 1619, 1619, + 0, 0, 1619, 1620, 1620, 0, 1620, 1621, 1621, 1622, + 1622, 0, 0, 1622, 1623, 1623, 1623, 1624, 1624, 1624, + 1625, 1625, 0, 1625, 1626, 0, 0, 1626, 1627, 1627, + 0, 1627, 1628, 1628, 0, 0, 1628, 1629, 1629, 0, + 1629, 1630, 1630, 1631, 1631, 0, 0, 1631, 1632, 1632, + + 1632, 1633, 1633, 1633, 1634, 1634, 0, 1634, 1635, 0, + 1635, 1636, 0, 0, 1636, 1637, 1637, 0, 1637, 1638, + 1638, 0, 0, 1638, 1639, 1639, 0, 1639, 1640, 1640, + 1641, 1641, 0, 0, 1641, 1642, 1642, 1642, 1643, 1643, + 1643, 1644, 1644, 0, 1644, 1645, 0, 1645, 1646, 0, + 1646, 1647, 0, 1647, 1648, 1648, 1648, 1649, 1649, 1649, + 1650, 0, 1650, 1651, 1651, 1651, 0, 1651, 1651, 1652, + 1652, 1652, 1653, 1653, 1653, 1654, 1654, 1654, 1655, 1655, + 1655, 1656, 1656, 1656, 1657, 1657, 1657, 1658, 1658, 1658, + 1659, 1659, 1659, 1660, 1660, 1660, 1661, 1661, 1661, 1662, + + 0, 1662, 1663, 0, 1663, 1664, 1664, 1664, 1665, 1665, + 1665, 1666, 1666, 1666, 1667, 0, 1667, 1668, 0, 1668, + 1669, 0, 1669, 1670, 1670, 1670, 1671, 1671, 1671, 1672, + 1672, 1672, 1673, 0, 1673, 1674, 0, 1674, 1675, 0, + 1675, 1676, 0, 1676, 1677, 1677, 1677, 1678, 1678, 1678, + 1679, 1679, 1679, 1680, 0, 1680, 1681, 0, 1681, 1682, + 0, 1682, 1683, 0, 1683, 1684, 1684, 1684, 1685, 1685, + 1685, 1686, 1686, 1686, 1687, 0, 1687, 1688, 0, 1688, + 1689, 0, 0, 1689, 1690, 1690, 0, 1690, 1691, 1691, + 0, 0, 1691, 1692, 1692, 0, 1692, 1693, 1693, 1694, + + 1694, 0, 0, 1694, 1695, 1695, 1695, 1696, 1696, 1696, + 1697, 1697, 0, 1697, 1698, 1698, 1698, 0, 1698, 1698, + 1699, 1699, 1699, 1700, 1700, 1700, 1701, 1701, 1701, 1702, + 1702, 1702, 1703, 1703, 1703, 1704, 1704, 1704, 1705, 1705, + 1705, 1706, 1706, 1706, 1707, 0, 1707, 1708, 1708, 1708, + 1709, 1709, 0, 0, 1709, 1710, 1710, 1710, 1711, 1711, + 1711, 1712, 1712, 0, 1712, 1713, 1713, 0, 0, 1713, + 1714, 1714, 0, 1714, 1715, 1715, 1716, 1716, 0, 0, + 1716, 1717, 1717, 1717, 1718, 1718, 1718, 1719, 1719, 0, + 1719, 1720, 0, 0, 1720, 1721, 1721, 0, 1721, 1722, + + 1722, 0, 0, 1722, 1723, 1723, 0, 1723, 1724, 1724, + 1725, 1725, 0, 0, 1725, 1726, 1726, 1726, 1727, 1727, + 1727, 1728, 1728, 0, 1728, 1729, 0, 1729, 1730, 0, + 0, 1730, 1731, 1731, 0, 1731, 1732, 1732, 0, 0, + 1732, 1733, 1733, 0, 1733, 1734, 1734, 1735, 1735, 0, + 0, 1735, 1736, 1736, 1736, 1737, 1737, 1737, 1738, 1738, + 0, 1738, 1739, 0, 1739, 1740, 0, 0, 1740, 1741, + 1741, 0, 1741, 1742, 1742, 0, 0, 1742, 1743, 1743, + 0, 1743, 1744, 1744, 1745, 1745, 0, 0, 1745, 1746, + 1746, 1746, 1747, 1747, 1747, 1748, 1748, 0, 1748, 1749, + + 0, 1749, 1750, 0, 1750, 1751, 0, 1751, 1752, 1752, 1752, 1753, 0, 1753, 1754, 1754, 1754, 1755, 0, 1755, - 1756, 1756, 1756, 1757, 0, 1757, 1758, 1758, 1758, 1759, - 0, 1759, 1760, 1760, 1760, 1761, 0, 1761, 1762, 1762, - 1762, 1763, 0, 1763, 1764, 1764, 1764, 1765, 1765, 0, - 0, 1765, 1766, 1766, 1766, 1767, 1767, 1767, 1768, 1768, - 1768, 1769, 1769, 0, 1769, 1770, 1770, 1770, 1771, 0, - 1771, 1772, 1772, 1772, 1773, 1773, 1773, 1774, 0, 1774, - - 1775, 0, 1775, 1776, 1776, 1776, 1777, 1777, 1777, 1778, - 0, 1778, 1779, 0, 1779, 1780, 0, 1780, 1781, 1781, - 1781, 1782, 1782, 1782, 1783, 0, 1783, 1784, 0, 1784, - 1785, 0, 1785, 1786, 1786, 1786, 1787, 1787, 1787, 1788, - 0, 1788, 1789, 0, 1789, 1790, 0, 1790, 1791, 1791, - 1791, 1792, 1792, 1792, 1793, 0, 1793, 1794, 0, 0, - 1794, 1795, 1795, 0, 1795, 1796, 1796, 0, 0, 1796, - 1797, 1797, 0, 1797, 1798, 1798, 1799, 1799, 0, 0, - 1799, 1800, 1800, 1800, 1801, 0, 1801, 1802, 1802, 0, - 1802, 1803, 1803, 1803, 0, 1803, 1803, 1804, 1804, 1804, - - 1805, 1805, 1805, 1806, 0, 1806, 1807, 0, 1807, 1808, - 0, 1808, 1809, 0, 1809, 1810, 0, 1810, 1811, 0, - 1811, 1812, 0, 1812, 1813, 1813, 1813, 1814, 1814, 1814, - 1815, 0, 1815, 1816, 1816, 0, 0, 1816, 1817, 1817, - 0, 1817, 1818, 1818, 1819, 0, 1819, 1820, 0, 0, - 1820, 1821, 1821, 0, 1821, 1822, 1822, 0, 0, 1822, - 1823, 1823, 0, 1823, 1824, 1824, 1825, 0, 1825, 1826, - 0, 1826, 1827, 0, 0, 1827, 1828, 1828, 0, 1828, - 1829, 1829, 0, 0, 1829, 1830, 1830, 0, 1830, 1831, - 1831, 1832, 0, 1832, 1833, 0, 1833, 1834, 0, 0, - - 1834, 1835, 1835, 0, 1835, 1836, 1836, 0, 0, 1836, - 1837, 1837, 0, 1837, 1838, 1838, 1839, 0, 1839, 1840, - 0, 1840, 1841, 0, 0, 1841, 1842, 1842, 0, 1842, - 1843, 1843, 0, 0, 1843, 1844, 1844, 0, 1844, 1845, - 1845, 1846, 0, 1846, 1847, 0, 1847, 1848, 0, 1848, - 1849, 0, 1849, 1850, 1850, 1850, 1851, 0, 1851, 1852, - 1852, 1852, 0, 1852, 1852, 1853, 0, 1853, 1854, 0, - 1854, 1855, 0, 1855, 1856, 0, 1856, 1857, 0, 1857, - 1858, 0, 1858, 1859, 0, 1859, 1860, 1860, 0, 0, - 1860, 1861, 1861, 0, 1861, 1862, 1862, 1863, 0, 1863, - - 1864, 0, 1864, 1865, 0, 1865, 1866, 0, 1866, 1867, - 0, 1867, 1868, 0, 1868, 1869, 0, 1869, 1870, 0, - 1870, 1871, 0, 1871, 1872, 0, 1872, 1873, 0, 0, - 1873, 1874, 1874, 0, 0, 1874, 1875, 0, 1875, 1876, - 0, 1876, 1877, 0, 1877, 1878, 0, 0, 1878, 1879, - 0, 0, 1879, 1880, 0, 0, 1880, 1881, 0, 0, - 1881, 1882, 0, 0, 1882, 1883, 0, 1883, 1884, 0, - 1884, 1885, 0, 0, 1885, 1886, 0, 1886, 1887, 0, - 1887, 1888, 0, 1888, 1889, 0, 1889, 1890, 0, 1890, - 1891, 0, 0, 1891, 1892, 0, 1892, 1893, 0, 1893, - - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, - 1433, 1433, 1433, 1433 + 1756, 1756, 1756, 0, 1756, 1756, 1757, 0, 1757, 1758, + 1758, 1758, 1759, 0, 1759, 1760, 1760, 1760, 1761, 0, + 1761, 1762, 1762, 1762, 1763, 0, 1763, 1764, 1764, 1764, + 1765, 0, 1765, 1766, 1766, 1766, 1767, 0, 1767, 1768, + 1768, 1768, 1769, 1769, 0, 0, 1769, 1770, 1770, 1770, + 1771, 1771, 1771, 1772, 1772, 1772, 1773, 1773, 0, 1773, + 1774, 1774, 1774, 1775, 0, 1775, 1776, 1776, 1776, 1777, + 1777, 1777, 1778, 0, 1778, 1779, 0, 1779, 1780, 1780, + + 1780, 1781, 1781, 1781, 1782, 0, 1782, 1783, 0, 1783, + 1784, 0, 1784, 1785, 1785, 1785, 1786, 1786, 1786, 1787, + 0, 1787, 1788, 0, 1788, 1789, 0, 1789, 1790, 1790, + 1790, 1791, 1791, 1791, 1792, 0, 1792, 1793, 0, 1793, + 1794, 0, 1794, 1795, 1795, 1795, 1796, 1796, 1796, 1797, + 0, 1797, 1798, 0, 0, 1798, 1799, 1799, 0, 1799, + 1800, 1800, 0, 0, 1800, 1801, 1801, 0, 1801, 1802, + 1802, 1803, 1803, 0, 0, 1803, 1804, 1804, 1804, 1805, + 0, 1805, 1806, 1806, 0, 1806, 1807, 1807, 1807, 0, + 1807, 1807, 1808, 1808, 1808, 1809, 1809, 1809, 1810, 0, + + 1810, 1811, 0, 1811, 1812, 0, 1812, 1813, 0, 1813, + 1814, 0, 1814, 1815, 0, 1815, 1816, 0, 1816, 1817, + 1817, 1817, 1818, 1818, 1818, 1819, 0, 1819, 1820, 1820, + 0, 0, 1820, 1821, 1821, 0, 1821, 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, 0, 1829, 1830, 0, 1830, 1831, 0, 0, + 1831, 1832, 1832, 0, 1832, 1833, 1833, 0, 0, 1833, + 1834, 1834, 0, 1834, 1835, 1835, 1836, 0, 1836, 1837, + 0, 1837, 1838, 0, 0, 1838, 1839, 1839, 0, 1839, + + 1840, 1840, 0, 0, 1840, 1841, 1841, 0, 1841, 1842, + 1842, 1843, 0, 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, 1852, 1853, 0, 1853, 1854, 1854, + 1854, 1855, 0, 1855, 1856, 1856, 1856, 0, 1856, 1856, + 1857, 0, 1857, 1858, 0, 1858, 1859, 0, 1859, 1860, + 0, 1860, 1861, 0, 1861, 1862, 0, 1862, 1863, 0, + 1863, 1864, 1864, 0, 0, 1864, 1865, 1865, 0, 1865, + 1866, 1866, 1867, 0, 1867, 1868, 0, 1868, 1869, 0, + + 1869, 1870, 0, 1870, 1871, 0, 1871, 1872, 0, 1872, + 1873, 0, 1873, 1874, 0, 1874, 1875, 0, 1875, 1876, + 0, 1876, 1877, 0, 0, 1877, 1878, 1878, 0, 0, + 1878, 1879, 0, 1879, 1880, 0, 1880, 1881, 0, 1881, + 1882, 0, 0, 1882, 1883, 0, 0, 1883, 1884, 0, + 0, 1884, 1885, 0, 0, 1885, 1886, 0, 0, 1886, + 1887, 0, 1887, 1888, 0, 1888, 1889, 0, 0, 1889, + 1890, 0, 1890, 1891, 0, 1891, 1892, 0, 1892, 1893, + 0, 1893, 1894, 0, 1894, 1895, 0, 0, 1895, 1896, + 0, 1896, 1897, 0, 1897, 1437, 1437, 1437, 1437, 1437, + + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437 } ; static yy_state_type yy_last_accepting_state; @@ -2697,8 +2688,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. @@ -2725,6 +2715,10 @@ 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 */ @@ -2750,7 +2744,7 @@ static const char rcsid[] _U_ = #include #ifdef __MINGW32__ -#include "IP6_misc.h" +#include "ip6_misc.h" #endif #else /* WIN32 */ #include /* for "struct sockaddr" in "struct addrinfo" */ @@ -2773,6 +2767,7 @@ static int stoi(char *); static inline int xdtoi(int); #ifdef FLEX_SCANNER +#define YY_NO_INPUT #define YY_NO_UNPUT static YY_BUFFER_STATE in_buffer; #else @@ -2785,7 +2780,7 @@ static const char *in_buffer; #define yylval pcap_lval extern YYSTYPE yylval; -#line 2789 "scanner.c" +#line 2784 "scanner.c" #define INITIAL 0 @@ -2954,9 +2949,9 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 191 "scanner.l" +#line 189 "scanner.l" -#line 2960 "scanner.c" +#line 2955 "scanner.c" if ( !(yy_init) ) { @@ -3009,13 +3004,13 @@ YY_DECL 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 >= 1434 ) + if ( yy_current_state >= 1438 ) 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] != 7396 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -3041,87 +3036,92 @@ YY_DECL case 1: YY_RULE_SETUP -#line 192 "scanner.l" +#line 190 "scanner.l" return DST; YY_BREAK case 2: YY_RULE_SETUP -#line 193 "scanner.l" +#line 191 "scanner.l" return SRC; YY_BREAK case 3: YY_RULE_SETUP -#line 195 "scanner.l" +#line 193 "scanner.l" return LINK; YY_BREAK case 4: YY_RULE_SETUP -#line 196 "scanner.l" +#line 194 "scanner.l" return LINK; YY_BREAK case 5: YY_RULE_SETUP -#line 197 "scanner.l" +#line 195 "scanner.l" return ARP; YY_BREAK case 6: YY_RULE_SETUP -#line 198 "scanner.l" +#line 196 "scanner.l" return RARP; YY_BREAK case 7: YY_RULE_SETUP -#line 199 "scanner.l" +#line 197 "scanner.l" return IP; YY_BREAK case 8: YY_RULE_SETUP -#line 200 "scanner.l" +#line 198 "scanner.l" return SCTP; YY_BREAK case 9: YY_RULE_SETUP -#line 201 "scanner.l" +#line 199 "scanner.l" return TCP; YY_BREAK case 10: YY_RULE_SETUP -#line 202 "scanner.l" +#line 200 "scanner.l" return UDP; YY_BREAK case 11: YY_RULE_SETUP -#line 203 "scanner.l" +#line 201 "scanner.l" return ICMP; YY_BREAK case 12: YY_RULE_SETUP -#line 204 "scanner.l" +#line 202 "scanner.l" return IGMP; YY_BREAK case 13: YY_RULE_SETUP -#line 205 "scanner.l" +#line 203 "scanner.l" return IGRP; YY_BREAK case 14: YY_RULE_SETUP -#line 206 "scanner.l" +#line 204 "scanner.l" return PIM; YY_BREAK case 15: YY_RULE_SETUP -#line 207 "scanner.l" +#line 205 "scanner.l" return VRRP; YY_BREAK case 16: YY_RULE_SETUP -#line 208 "scanner.l" -return RADIO; +#line 206 "scanner.l" +return CARP; YY_BREAK case 17: YY_RULE_SETUP -#line 210 "scanner.l" +#line 207 "scanner.l" +return RADIO; + YY_BREAK +case 18: +YY_RULE_SETUP +#line 209 "scanner.l" { #ifdef INET6 return IPV6; @@ -3130,9 +3130,9 @@ YY_RULE_SETUP #endif } YY_BREAK -case 18: +case 19: YY_RULE_SETUP -#line 217 "scanner.l" +#line 216 "scanner.l" { #ifdef INET6 return ICMPV6; @@ -3141,164 +3141,164 @@ YY_RULE_SETUP #endif } YY_BREAK -case 19: -YY_RULE_SETUP -#line 224 "scanner.l" -return AH; - YY_BREAK case 20: YY_RULE_SETUP -#line 225 "scanner.l" -return ESP; +#line 223 "scanner.l" +return AH; YY_BREAK case 21: YY_RULE_SETUP -#line 227 "scanner.l" -return ATALK; +#line 224 "scanner.l" +return ESP; YY_BREAK case 22: YY_RULE_SETUP -#line 228 "scanner.l" -return AARP; +#line 226 "scanner.l" +return ATALK; YY_BREAK case 23: YY_RULE_SETUP -#line 229 "scanner.l" -return DECNET; +#line 227 "scanner.l" +return AARP; YY_BREAK case 24: YY_RULE_SETUP -#line 230 "scanner.l" -return LAT; +#line 228 "scanner.l" +return DECNET; YY_BREAK case 25: YY_RULE_SETUP -#line 231 "scanner.l" -return SCA; +#line 229 "scanner.l" +return LAT; YY_BREAK case 26: YY_RULE_SETUP -#line 232 "scanner.l" -return MOPRC; +#line 230 "scanner.l" +return SCA; YY_BREAK case 27: YY_RULE_SETUP -#line 233 "scanner.l" -return MOPDL; +#line 231 "scanner.l" +return MOPRC; YY_BREAK case 28: YY_RULE_SETUP -#line 235 "scanner.l" -return ISO; +#line 232 "scanner.l" +return MOPDL; YY_BREAK case 29: YY_RULE_SETUP -#line 236 "scanner.l" -return ESIS; +#line 234 "scanner.l" +return ISO; YY_BREAK case 30: YY_RULE_SETUP -#line 237 "scanner.l" +#line 235 "scanner.l" return ESIS; YY_BREAK case 31: YY_RULE_SETUP -#line 238 "scanner.l" -return ISIS; +#line 236 "scanner.l" +return ESIS; YY_BREAK case 32: YY_RULE_SETUP -#line 239 "scanner.l" +#line 237 "scanner.l" return ISIS; YY_BREAK case 33: YY_RULE_SETUP -#line 240 "scanner.l" -return L1; +#line 238 "scanner.l" +return ISIS; YY_BREAK case 34: YY_RULE_SETUP -#line 241 "scanner.l" -return L2; +#line 239 "scanner.l" +return L1; YY_BREAK case 35: YY_RULE_SETUP -#line 242 "scanner.l" -return IIH; +#line 240 "scanner.l" +return L2; YY_BREAK case 36: YY_RULE_SETUP -#line 243 "scanner.l" -return LSP; +#line 241 "scanner.l" +return IIH; YY_BREAK case 37: YY_RULE_SETUP -#line 244 "scanner.l" -return SNP; +#line 242 "scanner.l" +return LSP; YY_BREAK case 38: YY_RULE_SETUP -#line 245 "scanner.l" -return CSNP; +#line 243 "scanner.l" +return SNP; YY_BREAK case 39: YY_RULE_SETUP -#line 246 "scanner.l" -return PSNP; +#line 244 "scanner.l" +return CSNP; YY_BREAK case 40: YY_RULE_SETUP -#line 248 "scanner.l" -return CLNP; +#line 245 "scanner.l" +return PSNP; YY_BREAK case 41: YY_RULE_SETUP -#line 250 "scanner.l" -return STP; +#line 247 "scanner.l" +return CLNP; YY_BREAK case 42: YY_RULE_SETUP -#line 252 "scanner.l" -return IPX; +#line 249 "scanner.l" +return STP; YY_BREAK case 43: YY_RULE_SETUP -#line 254 "scanner.l" -return NETBEUI; +#line 251 "scanner.l" +return IPX; YY_BREAK case 44: YY_RULE_SETUP -#line 256 "scanner.l" -return HOST; +#line 253 "scanner.l" +return NETBEUI; YY_BREAK case 45: YY_RULE_SETUP -#line 257 "scanner.l" -return NET; +#line 255 "scanner.l" +return HOST; YY_BREAK case 46: YY_RULE_SETUP -#line 258 "scanner.l" -return NETMASK; +#line 256 "scanner.l" +return NET; YY_BREAK case 47: YY_RULE_SETUP -#line 259 "scanner.l" -return PORT; +#line 257 "scanner.l" +return NETMASK; YY_BREAK case 48: YY_RULE_SETUP -#line 260 "scanner.l" -return PORTRANGE; +#line 258 "scanner.l" +return PORT; YY_BREAK case 49: YY_RULE_SETUP -#line 261 "scanner.l" -return PROTO; +#line 259 "scanner.l" +return PORTRANGE; YY_BREAK case 50: YY_RULE_SETUP -#line 262 "scanner.l" +#line 260 "scanner.l" +return PROTO; + YY_BREAK +case 51: +YY_RULE_SETUP +#line 261 "scanner.l" { #ifdef NO_PROTOCHAIN bpf_error("%s not supported", pcap_text); @@ -3307,328 +3307,338 @@ YY_RULE_SETUP #endif } YY_BREAK -case 51: +case 52: YY_RULE_SETUP -#line 270 "scanner.l" +#line 269 "scanner.l" return GATEWAY; YY_BREAK -case 52: +case 53: YY_RULE_SETUP -#line 272 "scanner.l" +#line 271 "scanner.l" return TYPE; YY_BREAK -case 53: +case 54: YY_RULE_SETUP -#line 273 "scanner.l" +#line 272 "scanner.l" return SUBTYPE; YY_BREAK -case 54: +case 55: YY_RULE_SETUP -#line 274 "scanner.l" +#line 273 "scanner.l" return DIR; YY_BREAK -case 55: +case 56: YY_RULE_SETUP -#line 275 "scanner.l" +#line 274 "scanner.l" return ADDR1; YY_BREAK -case 56: +case 57: YY_RULE_SETUP -#line 276 "scanner.l" +#line 275 "scanner.l" return ADDR2; YY_BREAK -case 57: +case 58: YY_RULE_SETUP -#line 277 "scanner.l" +#line 276 "scanner.l" return ADDR3; YY_BREAK -case 58: +case 59: YY_RULE_SETUP -#line 278 "scanner.l" +#line 277 "scanner.l" return ADDR4; YY_BREAK -case 59: +case 60: YY_RULE_SETUP -#line 280 "scanner.l" -return LESS; +#line 278 "scanner.l" +return RA; YY_BREAK -case 60: +case 61: +YY_RULE_SETUP +#line 279 "scanner.l" +return TA; + YY_BREAK +case 62: YY_RULE_SETUP #line 281 "scanner.l" -return GREATER; +return LESS; YY_BREAK -case 61: +case 63: YY_RULE_SETUP #line 282 "scanner.l" -return CBYTE; +return GREATER; YY_BREAK -case 62: +case 64: YY_RULE_SETUP #line 283 "scanner.l" -return TK_BROADCAST; +return CBYTE; YY_BREAK -case 63: +case 65: YY_RULE_SETUP #line 284 "scanner.l" +return TK_BROADCAST; + YY_BREAK +case 66: +YY_RULE_SETUP +#line 285 "scanner.l" return TK_MULTICAST; YY_BREAK -case 64: +case 67: YY_RULE_SETUP -#line 286 "scanner.l" +#line 287 "scanner.l" return AND; YY_BREAK -case 65: +case 68: YY_RULE_SETUP -#line 287 "scanner.l" +#line 288 "scanner.l" return OR; YY_BREAK -case 66: +case 69: YY_RULE_SETUP -#line 288 "scanner.l" +#line 289 "scanner.l" return '!'; YY_BREAK -case 67: +case 70: YY_RULE_SETUP -#line 290 "scanner.l" +#line 291 "scanner.l" return LEN; YY_BREAK -case 68: +case 71: YY_RULE_SETUP -#line 291 "scanner.l" +#line 292 "scanner.l" return INBOUND; YY_BREAK -case 69: +case 72: YY_RULE_SETUP -#line 292 "scanner.l" +#line 293 "scanner.l" return OUTBOUND; YY_BREAK -case 70: +case 73: YY_RULE_SETUP -#line 294 "scanner.l" +#line 295 "scanner.l" return VLAN; YY_BREAK -case 71: +case 74: YY_RULE_SETUP -#line 295 "scanner.l" +#line 296 "scanner.l" return MPLS; YY_BREAK -case 72: +case 75: YY_RULE_SETUP -#line 296 "scanner.l" +#line 297 "scanner.l" return PPPOED; YY_BREAK -case 73: +case 76: YY_RULE_SETUP -#line 297 "scanner.l" +#line 298 "scanner.l" return PPPOES; YY_BREAK -case 74: +case 77: YY_RULE_SETUP -#line 299 "scanner.l" +#line 300 "scanner.l" return LANE; YY_BREAK -case 75: +case 78: YY_RULE_SETUP -#line 300 "scanner.l" +#line 301 "scanner.l" return LLC; YY_BREAK -case 76: +case 79: YY_RULE_SETUP -#line 301 "scanner.l" +#line 302 "scanner.l" return METAC; YY_BREAK -case 77: +case 80: YY_RULE_SETUP -#line 302 "scanner.l" +#line 303 "scanner.l" return BCC; YY_BREAK -case 78: +case 81: YY_RULE_SETUP -#line 303 "scanner.l" +#line 304 "scanner.l" return OAM; YY_BREAK -case 79: +case 82: YY_RULE_SETUP -#line 304 "scanner.l" +#line 305 "scanner.l" return OAMF4; YY_BREAK -case 80: +case 83: YY_RULE_SETUP -#line 305 "scanner.l" +#line 306 "scanner.l" return OAMF4EC; YY_BREAK -case 81: +case 84: YY_RULE_SETUP -#line 306 "scanner.l" +#line 307 "scanner.l" return OAMF4SC; YY_BREAK -case 82: +case 85: YY_RULE_SETUP -#line 307 "scanner.l" +#line 308 "scanner.l" return SC; YY_BREAK -case 83: +case 86: YY_RULE_SETUP -#line 308 "scanner.l" +#line 309 "scanner.l" return ILMIC; YY_BREAK -case 84: +case 87: YY_RULE_SETUP -#line 309 "scanner.l" +#line 310 "scanner.l" return VPI; YY_BREAK -case 85: +case 88: YY_RULE_SETUP -#line 310 "scanner.l" +#line 311 "scanner.l" return VCI; YY_BREAK -case 86: +case 89: YY_RULE_SETUP -#line 311 "scanner.l" +#line 312 "scanner.l" return CONNECTMSG; YY_BREAK -case 87: +case 90: YY_RULE_SETUP -#line 312 "scanner.l" +#line 313 "scanner.l" return METACONNECT; YY_BREAK -case 88: +case 91: YY_RULE_SETUP -#line 314 "scanner.l" +#line 315 "scanner.l" return PF_IFNAME; YY_BREAK -case 89: +case 92: YY_RULE_SETUP -#line 315 "scanner.l" +#line 316 "scanner.l" return PF_RSET; YY_BREAK -case 90: +case 93: YY_RULE_SETUP -#line 316 "scanner.l" +#line 317 "scanner.l" return PF_RNR; YY_BREAK -case 91: +case 94: YY_RULE_SETUP -#line 317 "scanner.l" +#line 318 "scanner.l" return PF_SRNR; YY_BREAK -case 92: +case 95: YY_RULE_SETUP -#line 318 "scanner.l" +#line 319 "scanner.l" return PF_REASON; YY_BREAK -case 93: +case 96: YY_RULE_SETUP -#line 319 "scanner.l" +#line 320 "scanner.l" return PF_ACTION; YY_BREAK -case 94: +case 97: YY_RULE_SETUP -#line 321 "scanner.l" +#line 322 "scanner.l" return FISU; YY_BREAK -case 95: +case 98: YY_RULE_SETUP -#line 322 "scanner.l" +#line 323 "scanner.l" return LSSU; YY_BREAK -case 96: +case 99: YY_RULE_SETUP -#line 323 "scanner.l" +#line 324 "scanner.l" return LSSU; YY_BREAK -case 97: +case 100: YY_RULE_SETUP -#line 324 "scanner.l" +#line 325 "scanner.l" return MSU; YY_BREAK -case 98: +case 101: YY_RULE_SETUP -#line 325 "scanner.l" +#line 326 "scanner.l" return SIO; YY_BREAK -case 99: +case 102: YY_RULE_SETUP -#line 326 "scanner.l" +#line 327 "scanner.l" return OPC; YY_BREAK -case 100: +case 103: YY_RULE_SETUP -#line 327 "scanner.l" +#line 328 "scanner.l" return DPC; YY_BREAK -case 101: +case 104: YY_RULE_SETUP -#line 328 "scanner.l" +#line 329 "scanner.l" return SLS; YY_BREAK -case 102: -/* rule 102 can match eol */ +case 105: +/* rule 105 can match eol */ YY_RULE_SETUP -#line 330 "scanner.l" +#line 331 "scanner.l" ; YY_BREAK -case 103: +case 106: YY_RULE_SETUP -#line 331 "scanner.l" +#line 332 "scanner.l" return pcap_text[0]; YY_BREAK -case 104: +case 107: YY_RULE_SETUP -#line 332 "scanner.l" +#line 333 "scanner.l" return GEQ; YY_BREAK -case 105: +case 108: YY_RULE_SETUP -#line 333 "scanner.l" +#line 334 "scanner.l" return LEQ; YY_BREAK -case 106: +case 109: YY_RULE_SETUP -#line 334 "scanner.l" +#line 335 "scanner.l" return NEQ; YY_BREAK -case 107: +case 110: YY_RULE_SETUP -#line 335 "scanner.l" +#line 336 "scanner.l" return '='; YY_BREAK -case 108: +case 111: YY_RULE_SETUP -#line 336 "scanner.l" +#line 337 "scanner.l" return LSH; YY_BREAK -case 109: +case 112: YY_RULE_SETUP -#line 337 "scanner.l" +#line 338 "scanner.l" return RSH; YY_BREAK -case 110: +case 113: YY_RULE_SETUP -#line 338 "scanner.l" +#line 339 "scanner.l" { yylval.e = pcap_ether_aton(((char *)pcap_text)+1); return AID; } YY_BREAK -case 111: +case 114: YY_RULE_SETUP -#line 340 "scanner.l" +#line 341 "scanner.l" { yylval.e = pcap_ether_aton((char *)pcap_text); return EID; } YY_BREAK -case 112: +case 115: YY_RULE_SETUP -#line 342 "scanner.l" +#line 343 "scanner.l" { yylval.i = stoi((char *)pcap_text); return NUM; } YY_BREAK -case 113: +case 116: YY_RULE_SETUP -#line 343 "scanner.l" +#line 344 "scanner.l" { yylval.s = sdup((char *)pcap_text); return HID; } YY_BREAK -case 114: +case 117: YY_RULE_SETUP -#line 345 "scanner.l" +#line 346 "scanner.l" { #ifdef INET6 struct addrinfo hints, *res; @@ -3646,159 +3656,159 @@ YY_RULE_SETUP #endif /*INET6*/ } YY_BREAK -case 115: +case 118: YY_RULE_SETUP -#line 361 "scanner.l" +#line 362 "scanner.l" { bpf_error("bogus ethernet address %s", pcap_text); } YY_BREAK -case 116: +case 119: YY_RULE_SETUP -#line 362 "scanner.l" +#line 363 "scanner.l" { yylval.i = 0; return NUM; } YY_BREAK -case 117: +case 120: YY_RULE_SETUP -#line 363 "scanner.l" +#line 364 "scanner.l" { yylval.i = 1; return NUM; } YY_BREAK -case 118: +case 121: YY_RULE_SETUP -#line 364 "scanner.l" +#line 365 "scanner.l" { yylval.i = 0; return NUM; } YY_BREAK -case 119: +case 122: YY_RULE_SETUP -#line 365 "scanner.l" +#line 366 "scanner.l" { yylval.i = 3; return NUM; } YY_BREAK -case 120: +case 123: YY_RULE_SETUP -#line 366 "scanner.l" +#line 367 "scanner.l" { yylval.i = 4; return NUM; } YY_BREAK -case 121: +case 124: YY_RULE_SETUP -#line 367 "scanner.l" +#line 368 "scanner.l" { yylval.i = 5; return NUM; } YY_BREAK -case 122: +case 125: YY_RULE_SETUP -#line 368 "scanner.l" +#line 369 "scanner.l" { yylval.i = 8; return NUM; } YY_BREAK -case 123: +case 126: YY_RULE_SETUP -#line 369 "scanner.l" +#line 370 "scanner.l" { yylval.i = 9; return NUM; } YY_BREAK -case 124: +case 127: YY_RULE_SETUP -#line 370 "scanner.l" +#line 371 "scanner.l" { yylval.i = 10; return NUM; } YY_BREAK -case 125: +case 128: YY_RULE_SETUP -#line 371 "scanner.l" +#line 372 "scanner.l" { yylval.i = 11; return NUM; } YY_BREAK -case 126: +case 129: YY_RULE_SETUP -#line 372 "scanner.l" +#line 373 "scanner.l" { yylval.i = 12; return NUM; } YY_BREAK -case 127: +case 130: YY_RULE_SETUP -#line 373 "scanner.l" +#line 374 "scanner.l" { yylval.i = 13; return NUM; } YY_BREAK -case 128: +case 131: YY_RULE_SETUP -#line 374 "scanner.l" +#line 375 "scanner.l" { yylval.i = 14; return NUM; } YY_BREAK -case 129: +case 132: YY_RULE_SETUP -#line 375 "scanner.l" +#line 376 "scanner.l" { yylval.i = 15; return NUM; } YY_BREAK -case 130: +case 133: YY_RULE_SETUP -#line 376 "scanner.l" +#line 377 "scanner.l" { yylval.i = 16; return NUM; } YY_BREAK -case 131: +case 134: YY_RULE_SETUP -#line 377 "scanner.l" +#line 378 "scanner.l" { yylval.i = 17; return NUM; } YY_BREAK -case 132: +case 135: YY_RULE_SETUP -#line 378 "scanner.l" +#line 379 "scanner.l" { yylval.i = 18; return NUM; } YY_BREAK -case 133: +case 136: YY_RULE_SETUP -#line 379 "scanner.l" +#line 380 "scanner.l" { yylval.i = 13; return NUM; } YY_BREAK -case 134: +case 137: YY_RULE_SETUP -#line 380 "scanner.l" +#line 381 "scanner.l" { yylval.i = 0x01; return NUM; } YY_BREAK -case 135: +case 138: YY_RULE_SETUP -#line 381 "scanner.l" +#line 382 "scanner.l" { yylval.i = 0x02; return NUM; } YY_BREAK -case 136: +case 139: YY_RULE_SETUP -#line 382 "scanner.l" +#line 383 "scanner.l" { yylval.i = 0x04; return NUM; } YY_BREAK -case 137: +case 140: YY_RULE_SETUP -#line 383 "scanner.l" +#line 384 "scanner.l" { yylval.i = 0x08; return NUM; } YY_BREAK -case 138: +case 141: YY_RULE_SETUP -#line 384 "scanner.l" +#line 385 "scanner.l" { yylval.i = 0x10; return NUM; } YY_BREAK -case 139: +case 142: YY_RULE_SETUP -#line 385 "scanner.l" +#line 386 "scanner.l" { yylval.i = 0x20; return NUM; } YY_BREAK -case 140: +case 143: YY_RULE_SETUP -#line 386 "scanner.l" +#line 387 "scanner.l" { yylval.s = sdup((char *)pcap_text); return ID; } YY_BREAK -case 141: +case 144: YY_RULE_SETUP -#line 388 "scanner.l" +#line 389 "scanner.l" { yylval.s = sdup((char *)pcap_text + 1); return ID; } YY_BREAK -case 142: +case 145: YY_RULE_SETUP -#line 389 "scanner.l" +#line 390 "scanner.l" { bpf_error("illegal token: %s", pcap_text); } YY_BREAK -case 143: +case 146: YY_RULE_SETUP -#line 391 "scanner.l" +#line 392 "scanner.l" { bpf_error("illegal char '%c'", *pcap_text); } YY_BREAK -case 144: +case 147: YY_RULE_SETUP -#line 392 "scanner.l" +#line 393 "scanner.l" ECHO; YY_BREAK -#line 3802 "scanner.c" +#line 3812 "scanner.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -4090,7 +4100,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 >= 1434 ) + if ( yy_current_state >= 1438 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -4118,11 +4128,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 >= 1434 ) + if ( yy_current_state >= 1438 ) 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 == 1433); + yy_is_jam = (yy_current_state == 1437); return yy_is_jam ? 0 : yy_current_state; } @@ -4695,7 +4705,7 @@ void pcap_free (void * ptr ) #define YYTABLES_NAME "yytables" -#line 392 "scanner.l" +#line 393 "scanner.l" void diff --git a/libpcap/scanner.l b/libpcap/scanner.l index 7f0df76fb0..93d7b97d27 100644 --- a/libpcap/scanner.l +++ b/libpcap/scanner.l @@ -57,7 +57,7 @@ static const char rcsid[] _U_ = #include #ifdef __MINGW32__ -#include "IP6_misc.h" +#include "ip6_misc.h" #endif #else /* WIN32 */ #include /* for "struct sockaddr" in "struct addrinfo" */ @@ -80,6 +80,7 @@ static int stoi(char *); static inline int xdtoi(int); #ifdef FLEX_SCANNER +#define YY_NO_INPUT #define YY_NO_UNPUT static YY_BUFFER_STATE in_buffer; #else @@ -205,6 +206,7 @@ igmp return IGMP; igrp return IGRP; pim return PIM; vrrp return VRRP; +carp return CARP; radio return RADIO; ip6 { @@ -276,6 +278,8 @@ address1|addr1 return ADDR1; address2|addr2 return ADDR2; address3|addr3 return ADDR3; address4|addr4 return ADDR4; +ra return RA; +ta return TA; less return LESS; greater return GREATER; diff --git a/libpcap/sf-pcap-ng.c b/libpcap/sf-pcap-ng.c index 3535777ceb..7eb6db7649 100644 --- a/libpcap/sf-pcap-ng.c +++ b/libpcap/sf-pcap-ng.c @@ -746,7 +746,7 @@ pcap_ng_check_header(pcap_t *p, bpf_u_int32 magic, FILE *fp, char *errbuf) done: p->tzoff = 0; /* XXX - not used in pcap */ p->snapshot = idbp->snaplen; - p->linktype = idbp->linktype; + p->linktype = linktype_to_dlt(idbp->linktype); p->linktype_ext = 0; p->sf.next_packet_op = pcap_ng_next_packet; @@ -772,7 +772,6 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) struct simple_packet_block *spbp; struct packet_block *pbp; bpf_u_int32 interface_id = 0xFFFFFFFF; - size_t pblock_len; struct interface_description_block *idbp; struct section_header_block *shbp; FILE *fp = p->sf.rfile; @@ -823,7 +822,6 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) t = ((u_int64_t)epbp->timestamp_high) << 32 | epbp->timestamp_low; } - pblock_len = sizeof(*epbp); goto found; case BT_SPB: @@ -860,7 +858,6 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) if (hdr->caplen > p->snapshot) hdr->caplen = p->snapshot; t = 0; /* no time stamps */ - pblock_len = sizeof(*spbp); goto found; case BT_PB: @@ -890,7 +887,6 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) t = ((u_int64_t)pbp->timestamp_high) << 32 | pbp->timestamp_low; } - pblock_len = sizeof(*pbp); goto found; case BT_IDB: @@ -1053,7 +1049,7 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) /* * Is the interface ID an interface we know? */ - if (interface_id > p->sf.ifcount) { + if (interface_id >= p->sf.ifcount) { /* * Yes. Fail. */ diff --git a/libpcap/sf-pcap.c b/libpcap/sf-pcap.c index 9d55dae5fb..2b31a2b7a0 100644 --- a/libpcap/sf-pcap.c +++ b/libpcap/sf-pcap.c @@ -271,8 +271,12 @@ pcap_check_header(pcap_t *p, bpf_u_int32 magic, FILE *fp, char *errbuf) * Allocate a buffer for the packet data. */ p->bufsize = p->snapshot; - if (p->bufsize <= 0) - p->bufsize = BPF_MAXBUFSIZE; + if (p->bufsize <= 0) { + /* + * Bogus snapshot length; use 64KiB as a fallback. + */ + p->bufsize = 65536; + } p->buffer = malloc(p->bufsize); if (p->buffer == NULL) { snprintf(errbuf, PCAP_ERRBUF_SIZE, "out of memory"); diff --git a/libpcap/filtertest.c b/libpcap/tests/filtertest.c similarity index 100% rename from libpcap/filtertest.c rename to libpcap/tests/filtertest.c diff --git a/libpcap/findalldevstest.c b/libpcap/tests/findalldevstest.c similarity index 100% rename from libpcap/findalldevstest.c rename to libpcap/tests/findalldevstest.c diff --git a/libpcap/tests/nonblocktest.c b/libpcap/tests/nonblocktest.c new file mode 100644 index 0000000000..70a6bfdaa1 --- /dev/null +++ b/libpcap/tests/nonblocktest.c @@ -0,0 +1,226 @@ +/* + * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef lint +static const char copyright[] = + "@(#) 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"; +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +char *program_name; + +/* Forwards */ +static void countme(u_char *, const struct pcap_pkthdr *, const u_char *); +static void usage(void) __attribute__((noreturn)); +static void error(const char *, ...); +static void warning(const char *, ...); +static char *copy_argv(char **); + +static pcap_t *pd; + +extern int optind; +extern int opterr; +extern char *optarg; + +int +main(int argc, char **argv) +{ + register int op; + bpf_u_int32 localnet, netmask; + register char *cp, *cmdbuf, *device; + struct bpf_program fcode; + char ebuf[PCAP_ERRBUF_SIZE]; + int status; + int packet_count; + + device = NULL; + if ((cp = strrchr(argv[0], '/')) != NULL) + program_name = cp + 1; + else + program_name = argv[0]; + + opterr = 0; + while ((op = getopt(argc, argv, "i:")) != -1) { + switch (op) { + + case 'i': + device = optarg; + break; + + default: + usage(); + /* NOTREACHED */ + } + } + + if (device == NULL) { + device = pcap_lookupdev(ebuf); + if (device == NULL) + error("%s", ebuf); + } + *ebuf = '\0'; + pd = pcap_open_live(device, 65535, 0, 1000, ebuf); + if (pd == NULL) + error("%s", ebuf); + else if (*ebuf) + warning("%s", ebuf); + if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0) { + localnet = 0; + netmask = 0; + warning("%s", ebuf); + } + cmdbuf = copy_argv(&argv[optind]); + + if (pcap_compile(pd, &fcode, cmdbuf, 1, netmask) < 0) + error("%s", pcap_geterr(pd)); + + if (pcap_setfilter(pd, &fcode) < 0) + error("%s", pcap_geterr(pd)); + if (pcap_setnonblock(pd, 1, ebuf) == -1) + error("pcap_setnonblock failed: %s", ebuf); + printf("Listening on %s\n", device); + for (;;) { + packet_count = 0; + status = pcap_dispatch(pd, -1, countme, + (u_char *)&packet_count); + if (status < 0) + break; + if (status != 0) { + printf("%d packets seen, %d packets counted after pcap_dispatch returns\n", + status, packet_count); + } + } + if (status == -2) { + /* + * We got interrupted, so perhaps we didn't + * manage to finish a line we were printing. + * Print an extra newline, just in case. + */ + putchar('\n'); + } + (void)fflush(stdout); + if (status == -1) { + /* + * Error. Report it. + */ + (void)fprintf(stderr, "%s: pcap_loop: %s\n", + program_name, pcap_geterr(pd)); + } + pcap_close(pd); + exit(status == -1 ? 1 : 0); +} + +static void +countme(u_char *user, const struct pcap_pkthdr *h, const u_char *sp) +{ + int *counterp = (int *)user; + + (*counterp)++; +} + +static void +usage(void) +{ + (void)fprintf(stderr, "Usage: %s [ -sptn ] [ -i interface ] [expression]\n", + program_name); + exit(1); +} + +/* VARARGS */ +static void +error(const char *fmt, ...) +{ + va_list ap; + + (void)fprintf(stderr, "%s: ", program_name); + va_start(ap, fmt); + (void)vfprintf(stderr, fmt, ap); + va_end(ap); + if (*fmt) { + fmt += strlen(fmt); + if (fmt[-1] != '\n') + (void)fputc('\n', stderr); + } + exit(1); + /* NOTREACHED */ +} + +/* VARARGS */ +static void +warning(const char *fmt, ...) +{ + va_list ap; + + (void)fprintf(stderr, "%s: WARNING: ", program_name); + va_start(ap, fmt); + (void)vfprintf(stderr, fmt, ap); + va_end(ap); + if (*fmt) { + fmt += strlen(fmt); + if (fmt[-1] != '\n') + (void)fputc('\n', stderr); + } +} + +/* + * Copy arg vector into a new buffer, concatenating arguments with spaces. + */ +static char * +copy_argv(register char **argv) +{ + register char **p; + register u_int len = 0; + char *buf; + char *src, *dst; + + p = argv; + if (*p == 0) + return 0; + + while (*p) + len += strlen(*p++) + 1; + + buf = (char *)malloc(len); + if (buf == NULL) + error("copy_argv: malloc"); + + p = argv; + dst = buf; + while ((src = *p++) != NULL) { + while ((*dst++ = *src++) != '\0') + ; + dst[-1] = ' '; + } + dst[-1] = '\0'; + + return buf; +} diff --git a/libpcap/opentest.c b/libpcap/tests/opentest.c similarity index 100% rename from libpcap/opentest.c rename to libpcap/tests/opentest.c diff --git a/libpcap/tests/reactivatetest.c b/libpcap/tests/reactivatetest.c new file mode 100644 index 0000000000..9031a64a61 --- /dev/null +++ b/libpcap/tests/reactivatetest.c @@ -0,0 +1,84 @@ +/* + * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef lint +static const char copyright[] = + "@(#) 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"; +#endif + +#include +#include +#include +#include +#include + +/* Forwards */ +static void error(const char *, ...); + +int +main(void) +{ + char ebuf[PCAP_ERRBUF_SIZE]; + pcap_t *pd; + int status = 0; + + pd = pcap_open_live("lo0", 65535, 0, 1000, ebuf); + if (pd == NULL) { + pd = pcap_open_live("lo", 65535, 0, 1000, ebuf); + if (pd == NULL) { + error("Neither lo0 nor lo could be opened: %s", + ebuf); + return 2; + } + } + status = pcap_activate(pd); + if (status != PCAP_ERROR_ACTIVATED) { + if (status == 0) + error("pcap_activate() of opened pcap_t succeeded"); + else if (status == PCAP_ERROR) + error("pcap_activate() of opened pcap_t failed with %s, not PCAP_ERROR_ACTIVATED", + pcap_geterr(pd)); + else + error("pcap_activate() of opened pcap_t failed with %s, not PCAP_ERROR_ACTIVATED", + pcap_statustostr(status)); + } + return 0; +} + +/* VARARGS */ +static void +error(const char *fmt, ...) +{ + va_list ap; + + (void)fprintf(stderr, "reactivatetest: "); + va_start(ap, fmt); + (void)vfprintf(stderr, fmt, ap); + va_end(ap); + if (*fmt) { + fmt += strlen(fmt); + if (fmt[-1] != '\n') + (void)fputc('\n', stderr); + } + exit(1); + /* NOTREACHED */ +} diff --git a/libpcap/selpolltest.c b/libpcap/tests/selpolltest.c similarity index 100% rename from libpcap/selpolltest.c rename to libpcap/tests/selpolltest.c diff --git a/libpcap/tokdefs.h b/libpcap/tokdefs.h index 1a60ea6663..317459e227 100644 --- a/libpcap/tokdefs.h +++ b/libpcap/tokdefs.h @@ -1,10 +1,8 @@ +/* A Bison parser, made by GNU Bison 2.5. */ -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C +/* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,90 +61,93 @@ IGRP = 279, PIM = 280, VRRP = 281, - ATALK = 282, - AARP = 283, - DECNET = 284, - LAT = 285, - SCA = 286, - MOPRC = 287, - MOPDL = 288, - TK_BROADCAST = 289, - TK_MULTICAST = 290, - NUM = 291, - INBOUND = 292, - OUTBOUND = 293, - PF_IFNAME = 294, - PF_RSET = 295, - PF_RNR = 296, - PF_SRNR = 297, - PF_REASON = 298, - PF_ACTION = 299, - TYPE = 300, - SUBTYPE = 301, - DIR = 302, - ADDR1 = 303, - ADDR2 = 304, - ADDR3 = 305, - ADDR4 = 306, - LINK = 307, - GEQ = 308, - LEQ = 309, - NEQ = 310, - ID = 311, - EID = 312, - HID = 313, - HID6 = 314, - AID = 315, - LSH = 316, - RSH = 317, - LEN = 318, - IPV6 = 319, - ICMPV6 = 320, - AH = 321, - ESP = 322, - VLAN = 323, - MPLS = 324, - PPPOED = 325, - PPPOES = 326, - ISO = 327, - ESIS = 328, - CLNP = 329, - ISIS = 330, - L1 = 331, - L2 = 332, - IIH = 333, - LSP = 334, - SNP = 335, - CSNP = 336, - PSNP = 337, - STP = 338, - IPX = 339, - NETBEUI = 340, - LANE = 341, - LLC = 342, - METAC = 343, - BCC = 344, - SC = 345, - ILMIC = 346, - OAMF4EC = 347, - OAMF4SC = 348, - OAM = 349, - OAMF4 = 350, - CONNECTMSG = 351, - METACONNECT = 352, - VPI = 353, - VCI = 354, - RADIO = 355, - FISU = 356, - LSSU = 357, - MSU = 358, - SIO = 359, - OPC = 360, - DPC = 361, - SLS = 362, - AND = 363, - OR = 364, - UMINUS = 365 + CARP = 282, + ATALK = 283, + AARP = 284, + DECNET = 285, + LAT = 286, + SCA = 287, + MOPRC = 288, + MOPDL = 289, + TK_BROADCAST = 290, + TK_MULTICAST = 291, + NUM = 292, + INBOUND = 293, + OUTBOUND = 294, + PF_IFNAME = 295, + PF_RSET = 296, + PF_RNR = 297, + PF_SRNR = 298, + PF_REASON = 299, + PF_ACTION = 300, + TYPE = 301, + SUBTYPE = 302, + DIR = 303, + ADDR1 = 304, + ADDR2 = 305, + ADDR3 = 306, + ADDR4 = 307, + RA = 308, + TA = 309, + LINK = 310, + GEQ = 311, + LEQ = 312, + NEQ = 313, + ID = 314, + EID = 315, + HID = 316, + HID6 = 317, + AID = 318, + LSH = 319, + RSH = 320, + LEN = 321, + IPV6 = 322, + ICMPV6 = 323, + AH = 324, + ESP = 325, + VLAN = 326, + MPLS = 327, + PPPOED = 328, + PPPOES = 329, + ISO = 330, + ESIS = 331, + CLNP = 332, + ISIS = 333, + L1 = 334, + L2 = 335, + IIH = 336, + LSP = 337, + SNP = 338, + CSNP = 339, + PSNP = 340, + STP = 341, + IPX = 342, + NETBEUI = 343, + LANE = 344, + LLC = 345, + METAC = 346, + BCC = 347, + SC = 348, + ILMIC = 349, + OAMF4EC = 350, + OAMF4SC = 351, + OAM = 352, + OAMF4 = 353, + CONNECTMSG = 354, + METACONNECT = 355, + VPI = 356, + VCI = 357, + RADIO = 358, + FISU = 359, + LSSU = 360, + MSU = 361, + SIO = 362, + OPC = 363, + DPC = 364, + SLS = 365, + AND = 366, + OR = 367, + UMINUS = 368 }; #endif /* Tokens. */ @@ -174,90 +175,93 @@ #define IGRP 279 #define PIM 280 #define VRRP 281 -#define ATALK 282 -#define AARP 283 -#define DECNET 284 -#define LAT 285 -#define SCA 286 -#define MOPRC 287 -#define MOPDL 288 -#define TK_BROADCAST 289 -#define TK_MULTICAST 290 -#define NUM 291 -#define INBOUND 292 -#define OUTBOUND 293 -#define PF_IFNAME 294 -#define PF_RSET 295 -#define PF_RNR 296 -#define PF_SRNR 297 -#define PF_REASON 298 -#define PF_ACTION 299 -#define TYPE 300 -#define SUBTYPE 301 -#define DIR 302 -#define ADDR1 303 -#define ADDR2 304 -#define ADDR3 305 -#define ADDR4 306 -#define LINK 307 -#define GEQ 308 -#define LEQ 309 -#define NEQ 310 -#define ID 311 -#define EID 312 -#define HID 313 -#define HID6 314 -#define AID 315 -#define LSH 316 -#define RSH 317 -#define LEN 318 -#define IPV6 319 -#define ICMPV6 320 -#define AH 321 -#define ESP 322 -#define VLAN 323 -#define MPLS 324 -#define PPPOED 325 -#define PPPOES 326 -#define ISO 327 -#define ESIS 328 -#define CLNP 329 -#define ISIS 330 -#define L1 331 -#define L2 332 -#define IIH 333 -#define LSP 334 -#define SNP 335 -#define CSNP 336 -#define PSNP 337 -#define STP 338 -#define IPX 339 -#define NETBEUI 340 -#define LANE 341 -#define LLC 342 -#define METAC 343 -#define BCC 344 -#define SC 345 -#define ILMIC 346 -#define OAMF4EC 347 -#define OAMF4SC 348 -#define OAM 349 -#define OAMF4 350 -#define CONNECTMSG 351 -#define METACONNECT 352 -#define VPI 353 -#define VCI 354 -#define RADIO 355 -#define FISU 356 -#define LSSU 357 -#define MSU 358 -#define SIO 359 -#define OPC 360 -#define DPC 361 -#define SLS 362 -#define AND 363 -#define OR 364 -#define UMINUS 365 +#define CARP 282 +#define ATALK 283 +#define AARP 284 +#define DECNET 285 +#define LAT 286 +#define SCA 287 +#define MOPRC 288 +#define MOPDL 289 +#define TK_BROADCAST 290 +#define TK_MULTICAST 291 +#define NUM 292 +#define INBOUND 293 +#define OUTBOUND 294 +#define PF_IFNAME 295 +#define PF_RSET 296 +#define PF_RNR 297 +#define PF_SRNR 298 +#define PF_REASON 299 +#define PF_ACTION 300 +#define TYPE 301 +#define SUBTYPE 302 +#define DIR 303 +#define ADDR1 304 +#define ADDR2 305 +#define ADDR3 306 +#define ADDR4 307 +#define RA 308 +#define TA 309 +#define LINK 310 +#define GEQ 311 +#define LEQ 312 +#define NEQ 313 +#define ID 314 +#define EID 315 +#define HID 316 +#define HID6 317 +#define AID 318 +#define LSH 319 +#define RSH 320 +#define LEN 321 +#define IPV6 322 +#define ICMPV6 323 +#define AH 324 +#define ESP 325 +#define VLAN 326 +#define MPLS 327 +#define PPPOED 328 +#define PPPOES 329 +#define 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 SIO 362 +#define OPC 363 +#define DPC 364 +#define SLS 365 +#define AND 366 +#define OR 367 +#define UMINUS 368 @@ -266,7 +270,7 @@ typedef union YYSTYPE { -/* Line 1676 of yacc.c */ +/* Line 2068 of yacc.c */ #line 242 "grammar.y" int i; @@ -285,8 +289,8 @@ typedef union YYSTYPE -/* Line 1676 of yacc.c */ -#line 290 "y.tab.h" +/* Line 2068 of yacc.c */ +#line 294 "y.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */