From fa77efbc3d680dd0ae4de3ae68cd42cad1340ba3 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sun, 24 May 2009 11:38:34 +0000 Subject: Remove left-over libpcap sources --- libpcap/.cvsignore | 3 - libpcap/CHANGES | 267 ---- libpcap/COPYING | 32 - libpcap/FILES | 50 - libpcap/INSTALL | 328 ----- libpcap/Makefile.am | 31 - libpcap/README | 49 - libpcap/VERSION | 1 - libpcap/bpf_filter.c | 532 -------- libpcap/bpf_image.c | 292 ----- libpcap/etherent.c | 163 --- libpcap/ethertype.h | 76 -- libpcap/gencode.c | 1948 ---------------------------- libpcap/gencode.h | 179 --- libpcap/grammar.c | 1113 ---------------- libpcap/grammar.y | 275 ---- libpcap/inet.c | 223 ---- libpcap/lbl/gnuc.h | 43 - libpcap/lbl/os-solaris2.h | 54 - libpcap/lbl/os-sunos4.h | 215 ---- libpcap/lbl/os-ultrix4.h | 39 - libpcap/linux-include/netinet/if_ether.h | 88 -- libpcap/linux-include/netinet/ip_var.h | 178 --- libpcap/nametoaddr.c | 376 ------ libpcap/net/bpf.h | 264 ---- libpcap/optimize.c | 2008 ----------------------------- libpcap/pcap-bpf.c | 267 ---- libpcap/pcap-dlpi.c | 852 ------------- libpcap/pcap-enet.c | 231 ---- libpcap/pcap-int.h | 117 -- libpcap/pcap-linux.c | 335 ----- libpcap/pcap-namedb.h | 76 -- libpcap/pcap-nit.c | 248 ---- libpcap/pcap-nit.h | 19 - libpcap/pcap-null.c | 77 -- libpcap/pcap-pf.c | 355 ------ libpcap/pcap-pf.h | 19 - libpcap/pcap-snit.c | 304 ----- libpcap/pcap-snoop.c | 220 ---- libpcap/pcap.3 | 340 ----- libpcap/pcap.c | 199 --- libpcap/pcap.h | 137 -- libpcap/ppp.h | 50 - libpcap/savefile.c | 356 ------ libpcap/scanner.c | 2048 ------------------------------ libpcap/scanner.l | 204 --- libpcap/tokdefs.h | 57 - 47 files changed, 15338 deletions(-) delete mode 100644 libpcap/.cvsignore delete mode 100644 libpcap/CHANGES delete mode 100644 libpcap/COPYING delete mode 100644 libpcap/FILES delete mode 100644 libpcap/INSTALL delete mode 100644 libpcap/Makefile.am delete mode 100644 libpcap/README delete mode 100644 libpcap/VERSION delete mode 100644 libpcap/bpf_filter.c delete mode 100644 libpcap/bpf_image.c delete mode 100644 libpcap/etherent.c delete mode 100644 libpcap/ethertype.h delete mode 100644 libpcap/gencode.c delete mode 100644 libpcap/gencode.h delete mode 100644 libpcap/grammar.c delete mode 100644 libpcap/grammar.y delete mode 100644 libpcap/inet.c delete mode 100644 libpcap/lbl/gnuc.h delete mode 100644 libpcap/lbl/os-solaris2.h delete mode 100644 libpcap/lbl/os-sunos4.h delete mode 100644 libpcap/lbl/os-ultrix4.h delete mode 100644 libpcap/linux-include/netinet/if_ether.h delete mode 100644 libpcap/linux-include/netinet/ip_var.h delete mode 100644 libpcap/nametoaddr.c delete mode 100644 libpcap/net/bpf.h delete mode 100644 libpcap/optimize.c delete mode 100644 libpcap/pcap-bpf.c delete mode 100644 libpcap/pcap-dlpi.c delete mode 100644 libpcap/pcap-enet.c delete mode 100644 libpcap/pcap-int.h delete mode 100644 libpcap/pcap-linux.c delete mode 100644 libpcap/pcap-namedb.h delete mode 100644 libpcap/pcap-nit.c delete mode 100644 libpcap/pcap-nit.h delete mode 100644 libpcap/pcap-null.c delete mode 100644 libpcap/pcap-pf.c delete mode 100644 libpcap/pcap-pf.h delete mode 100644 libpcap/pcap-snit.c delete mode 100644 libpcap/pcap-snoop.c delete mode 100644 libpcap/pcap.3 delete mode 100644 libpcap/pcap.c delete mode 100644 libpcap/pcap.h delete mode 100644 libpcap/ppp.h delete mode 100644 libpcap/savefile.c delete mode 100644 libpcap/scanner.c delete mode 100644 libpcap/scanner.l delete mode 100644 libpcap/tokdefs.h diff --git a/libpcap/.cvsignore b/libpcap/.cvsignore deleted file mode 100644 index 36a2ee1..0000000 --- a/libpcap/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -Makefile.in -.deps \ No newline at end of file diff --git a/libpcap/CHANGES b/libpcap/CHANGES deleted file mode 100644 index 0dedf6c..0000000 --- a/libpcap/CHANGES +++ /dev/null @@ -1,267 +0,0 @@ -@(#) $Header: /cvsroot/ipacct/ipacct/libpcap/Attic/CHANGES,v 1.1 2001/05/31 13:40:52 gray Exp $ (LBL) - -v0.4 Sat Jul 25 12:40:09 PDT 1998 - -- Fix endian problem with DLT_NULL devices. From FreeBSD via Bill - Fenner (fenner@parc.xerox.com) - -- Fix alignment problem with FDDI under DLPI. This was causing core - dumps under Solaris. - -- Added configure options to disable flex and bison. Resulted from a - bug report by barnett@grymoire.crd.ge.com (Bruce Barnett). Also added - options to disable gcc and to force a particular packet capture type. - -- Added support for Fore ATM interfaces (qaa and fa) under IRIX. Thanks - to John Hawkinson (jhawk@mit.edu) - -- Change Linux PPP and SLIP to use DLT_RAW since the kernel does not - supply any "link layer" data. - -- Change Linux to use SIOCGIFHWADDR ioctl to determine link layer type. - Thanks to Thomas Sailer (sailer@ife.ee.ethz.ch) - -- Change IRIX PPP to use DLT_RAW since the kernel does not supply any - "link layer" data. - -- Modified to support the new BSD/OS 2.1 PPP and SLIP link layer header - formats. - -- Added some new SGI snoop interface types. Thanks to Steve Alexander - (sca@refugee.engr.sgi.com) - -- Fixes for HP-UX 10.20 (which is similar to HP-UX 9). Thanks to - Richard Allen (ra@hp.is) and Steinar Haug (sthaug@nethelp.no) - -- Fddi supports broadcast as reported by Jeff Macdonald - (jeff@iacnet.com). Also correct ieee802 and arcnet. - -- Determine Linux pcap buffer size at run time or else it might not be - big enough for some interface types (e.g. FDDI). Thanks to Jes - Sorensen (Jes.Sorensen@cern.ch) - -- Fix some linux alignment problems. - -- Document promisc argument to pcap_open_live(). Reported by Ian Marsh - (ianm@sics.se) - -- Support Metricom radio packets under Linux. Thanks to Kevin Lai - (laik@gunpowder.stanford.edu) - -- Bind to interface name under Linux to avoid packets from multiple - interfaces on multi-homed hosts. Thanks to Kevin Lai - (laik@gunpowder.stanford.edu) - -- Change L_SET to SEEK_SET for HP-UX. Thanks to Roland Roberts - (rroberts@muller.com) - -- Fixed an uninitialized memory reference found by Kent Vander Velden - (graphix@iastate.edu) - -- Fixed lex pattern for IDs to allow leading digits. As reported by - Theo de Raadt (deraadt@cvs.openbsd.org) - -- Fixed Linux include file problems when using GNU libc. - -- Ifdef ARPHRD_FDDI since not all versions of the Linux kernel have it. - Reported reported by Eric Jacksch (jacksch@tenebris.ca) - -- Fixed bug in pcap_dispatch() that kept it from returning on packet - timeouts. - -- Changed ISLOOPBACK() macro when IFF_LOOPBACK isn't available to check - for "lo" followed by an eos or digit (newer versions of Linux - apparently call the loopback "lo" instead of "lo0"). - -- Fixed Linux networking include files to use ints instead of longs to - avoid problems with 64 bit longs on the alpha. Thanks to Cristian - Gafton (gafton@redhat.com) - -v0.3 Sat Nov 30 20:56:27 PST 1996 - -- Added Linux support. - -- Fixed savefile bugs. - -- Solaris x86 fix from Tim Rylance (t.rylance@elsevier.nl) - -- Add support for bpf kernel port filters. - -- Remove duplicate atalk protocol table entry. Thanks to Christian - Hopps (chopps@water.emich.edu) - -- Fixed pcap_lookupdev() to ignore nonexistent devices. This was - reported to happen under BSD/OS by David Vincenzetti - (vince@cryptonet.it) - -- Avoid solaris compiler warnings. Thanks to Bruce Barnett - (barnett@grymoire.crd.ge.com) - -v0.2.1 Sun Jul 14 03:02:26 PDT 1996 - -- Fixes for HP-UX 10. Thanks in part to to Thomas Wolfram - (wolf@prz.tu-berlin.de) and Rick Jones (raj@hpisrdq.cup.hp.com) - -- Added support for SINIX. Thanks to Andrej Borsenkow - (borsenkow.msk@sni.de) - -- Fixes for AIX (although this system is not yet supported). Thanks to - John Hawkinson (jhawk@mit.edu) - -- Use autoconf's idea of the top level directory in install targets. - Thanks to John Hawkinson. - -- Add missing autoconf packet capture result message. Thanks to Bill - Fenner (fenner@parc.xerox.com) - -- Fixed padding problems in the pf module. - -- Fixed some more alignment problems on the alpha. - -- Added explicit netmask support. Thanks to Steve Nuchia - (steve@research.oknet.com) - -- Fixed to handle raw ip addresses such as 0.0.0.1 without "left - justifing" - -- Add "sca" keyword (for DEC cluster services) as suggested by Terry - Kennedy (terry@spcvxa.spc.edu) - -- Add "atalk" keyword as suggested by John Hawkinson. - -- Add "igrp" keyword. - -- Fixed HID definition in grammar.y to be a string, not a value. - -- Use $CC when checking gcc version. Thanks to Carl Lindberg - (carl_lindberg@blacksmith.com) - -- Removed obsolete reference to pcap_immediate() from the man page. - Michael Stolarchuk (mts@terminator.rs.itd.umich.edu) - -- DLT_NULL has a 4 byte family header. Thanks to Jeffrey Honig - (jch@bsdi.com) - -v0.2 Sun Jun 23 02:28:42 PDT 1996 - -- Add support for HP-UX. Resulted from code contributed by Tom Murray - (tmurray@hpindck.cup.hp.com) and Philippe-Andri Prindeville - (philipp@res.enst.fr) - -- Update INSTALL with a reminder to install include files. Thanks to - Mark Andrews (mandrews@aw.sgi.com) - -- Fix bpf compiler alignment bug on the alpha. - -- Use autoconf to detect architectures that can't handle misaligned - accesses. - -- Added loopback support for snoop. Resulted from report Steve - Alexander (sca@engr.sgi.com) - -v0.1 Fri Apr 28 18:11:03 PDT 1995 - -- Fixed compiler and optimizer bugs. The BPF filter engine uses unsigned - comparison operators, while the code generator and optimizer assumed - signed semantics in several places. Thanks to Charlie Slater - (cslater@imatek.com) for pointing this out. - -- Removed FDDI ifdef's, they aren't really needed. Resulted from report - by Gary Veum (veum@boa.gsfc.nasa.gov). - -- Add pcap-null.c which allows offline use of libpcap on systems that - don't support live package capture. This feature resulting from a - request from Jan van Oorschot (j.p.m.voorschot@et.tudelft.nl). - -- Make bpf_compile() reentrant. Fix thanks to Pascal Hennequin - (Pascal.Hennequin@hugo.int-evry.fr). - -- Port to GNU autoconf. - -- Fix pcap-dlpi.c to work with isdn. Resulted from report by Flemming - Johansen (fsj@csd.cri.dk). - -- Handle multi-digit interface unit numbers (aka ppa's) under dlpi. - Resulted from report by Daniel Ehrlich (ehrlich@cse.psu.edu). - -- Fix pcap-dlpi.c to work in non-promiscuous mode. Resulted from report - by Jeff Murphy (jcmurphy@acsu.buffalo.edu). - -- Add support for "long jumps". Thanks to Jeffrey Mogul - (mogul@pa.dec.com). - -- Fix minor problems when compiling with BDEBUG as noticed by Scott - Bertilson (scott@unet.umn.edu). - -- Declare sys_errlist "const char *const" to avoid problems under - FreeBSD. Resulted from report by jher@eden.com. - -v0.0.6 Fri Apr 28 04:07:13 PDT 1995 - -- Add missing variable declaration missing from 0.0.6 - -v0.0.5 Fri Apr 28 00:22:21 PDT 1995 - -- Workaround for problems when pcap_read() returns 0 due to the timeout - expiring. - -v0.0.4 Thu Apr 20 20:41:48 PDT 1995 - -- Change configuration to not use gcc v2 flags with gcc v1. - -- Fixed a bug in pcap_next(); if pcap_dispatch() returns 0, pcap_next() - should also return 0. Thanks to Richard Stevens (rstevens@noao.edu). - -- Fixed configure to test for snoop before dlpi to avoid problems under - IRIX 5. Thanks to J. Eric Townsend (jet@abulafia.genmagic.com). - -- Hack around deficiency in Ultrix's make. - -- Fix two bugs related to the Solaris pre-5.3.2 bufmod bug; handle - savefiles that have more than snapshot bytes of data in them (so we - can read old savefiles) and avoid writing such files. - -- Added checkioctl which is used with gcc to check that the - "fixincludes" script has been run. - -v0.0.3 Tue Oct 18 18:13:46 PDT 1994 - -- Fixed configure to test for snoop before dlpi to avoid problems under - IRIX 5. Thanks to J. Eric Townsend (jet@abulafia.genmagic.com). - -v0.0.2 Wed Oct 12 20:56:37 PDT 1994 - -- Implement timeout in the dlpi pcap_open_live(). Thanks to Richard - Stevens. - -- Determine pcap link type from dlpi media type. Resulted from report - by Mahesh Jethanandani (mahesh@npix.com). - -v0.0.1 Fri Jun 24 14:50:57 PDT 1994 - -- Fixed bug in nit_setflags() in pcap-snit.c. The streams ioctl timeout - wasn't being initialized sometimes resulting in an "NIOCSFLAGS: - Invalid argument" error under OSF/1. Reported by Matt Day - (mday@artisoft.com) and Danny Mitzel (dmitzel@whitney.hitc.com). - -- Turn on FDDI support by default. - -v0.0 Mon Jun 20 19:20:16 PDT 1994 - -- Initial release. - -- Fixed bug with greater/less keywords, reported by Mark Andrews - (mandrews@alias.com). - -- Fix bug where '|' was defined as BPF_AND instead of BPF_OR, reported - by Elan Amir (elan@leeb.cs.berkeley.edu). - -- Machines with little-endian byte ordering are supported thanks to - Jeff Mogul. - -- Add hack for version 2.3 savefiles which don't have caplen and len - swapped thanks to Vern Paxson. - -- Added "&&" and "||" aliases for "and" and "or" thanks to Vern Paxson. - -- Added length, inbound and outbound keywords. diff --git a/libpcap/COPYING b/libpcap/COPYING deleted file mode 100644 index 2d45ade..0000000 --- a/libpcap/COPYING +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1994, 1995, 1996, 1997, 1998 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Computer Systems - * Engineering Group at Lawrence Berkeley Laboratory. - * 4. Neither the name of the University nor of the Laboratory may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ diff --git a/libpcap/FILES b/libpcap/FILES deleted file mode 100644 index daad279..0000000 --- a/libpcap/FILES +++ /dev/null @@ -1,50 +0,0 @@ -CHANGES -FILES -INSTALL -Makefile.in -README -SUNOS4 -VERSION -aclocal.m4 -bpf/net/bpf.h -bpf/net/bpf_filter.c -bpf_image.c -config.guess -config.sub -configure -configure.in -etherent.c -ethertype.h -gencode.c -gencode.h -grammar.y -inet.c -install-sh -lbl/gnuc.h -lbl/os-solaris2.h -lbl/os-sunos4.h -lbl/os-ultrix4.h -linux-include/netinet/if_ether.h -linux-include/netinet/ip_var.h -mkdep -nametoaddr.c -optimize.c -pcap-bpf.c -pcap-dlpi.c -pcap-enet.c -pcap-int.h -pcap-linux.c -pcap-namedb.h -pcap-nit.c -pcap-nit.h -pcap-null.c -pcap-pf.c -pcap-pf.h -pcap-snit.c -pcap-snoop.c -pcap.3 -pcap.c -pcap.h -ppp.h -savefile.c -scanner.l diff --git a/libpcap/INSTALL b/libpcap/INSTALL deleted file mode 100644 index ba9a32a..0000000 --- a/libpcap/INSTALL +++ /dev/null @@ -1,328 +0,0 @@ -@(#) $Header: /cvsroot/ipacct/ipacct/libpcap/Attic/INSTALL,v 1.1 2001/05/31 13:40:52 gray Exp $ (LBL) - -To build libpcap, first customize any paths in Makefile.in, then run -"./configure" (a shell script). The configure script will determine -your system attributes and generate an appropriate Makefile from -Makefile.in. Next run "make". If everything goes well you can su to -root and run "make install", "make install-incl" and "make -install-man". However, you need not install libpcap if you just want to -build tcpdump; just make sure the tcpdump and libpcap directory trees -have the same parent directory. - -If configure says: - - configure: warning: cannot determine packet capture interface - configure: warning: (see INSTALL for more info) - -then your system either does not support packet capture or your system -does support packet capture but libpcap does not support that -particular type. (If you have HP-UX, see below.) If your system uses a -packet capture not supported by libpcap, please send us patches; don't -forget to include an autoconf fragment suitable for use in -configure.in. - -It is possible to override the default packet capture type, although -the circumstance where this works are limited. For example if you have -installed bpf under SunOS 4 and wish to build a snit libpcap: - - ./configure --with-pcap=snit - -Another example is to force a supported packet capture type in the case -where the configure scripts fails to detect it. - -You will need an ANSI C compiler to build libpcap. The configure script -will abort if your compiler is not ANSI compliant. If this happens, use -the GNU C compiler, available via anonymous ftp: - - ftp://prep.ai.mit.edu/pub/gnu/gcc-*.tar.gz - -Note well: If you use gcc, you may need to run its "fixincludes" -script. Running fixincludes is not required with later versions of gcc -and in some cases (e.g. Solaris 2.5) causes problems when run. The -configure script will abort with: - - checking for ANSI ioctl definitions... yes - configure: error: see the INSTALL for more info - -if it detects if the fixincludes needs to be run. If the fixincludes -test in configure passes, you're probably ok. - -If you use flex, you must use version 2.4.6 or higher. The configure -script automatically detects the version of flex and will not use it -unless it is new enough. You can use "flex -V" to see what version you -have (unless it's really old). The current version of flex is available -via anonymous ftp: - - ftp://ftp.ee.lbl.gov/flex-*.tar.Z - -As of this writing, the current version is 2.5.4. - -If you use bison, you must use flex (and visa versa). The configure -script automatically falls back to lex and yacc if both flex and bison -are not found. - -Sometimes the stock C compiler does not interact well with flex and -bison. The list of problems includes undefined references for alloca. -You can get around this by installing gcc or manually disabling flex -and bison with: - - ./configure --without-flex --without-bison - -If your system only has AT&T lex, this is okay unless your libpcap -program uses other lex/yacc generated code. (Although it's possible to -map the yy* identifiers with a script, we use flex and bison so we -don't feel this is necessary.) - -Some systems support the Berkeley Packet Filter natively; for example -out of the box OSF and BSD/OS have bpf. If your system does not support -bpf, you will need to pick up: - - ftp://ftp.ee.lbl.gov/bpf-*.tar.Z - -Note well: you MUST have kernel source for your operating system in -order to install bpf. An exception is SunOS 4; the bpf distribution -includes replacement kernel objects for some of the standard SunOS 4 -network device drivers. See the bpf INSTALL document for more -information. - -If you use Solaris, there is a bug with bufmod(7) that is fixed in -Solaris 2.3.2 (aka SunOS 5.3.2). Setting a snapshot length with the -broken bufmod(7) results in data be truncated from the FRONT of the -packet instead of the end. The work around is to not set a snapshot -length but this results in performance problems since the entire packet -is copied to user space. If you must run an older version of Solaris, -there is a patch available from Sun; ask for bugid 1149065. After -installing the patch, use "setenv BUFMOD_FIXED" to enable use of -bufmod(7). However, we recommend you run a more current release of -Solaris. - -If you use the SPARCompiler, you must be careful to not use the -/usr/ucb/cc interface. If you do, you will get bogus warnings and -perhaps errors. Either make sure your path has /opt/SUNWspro/bin -before /usr/ucb or else: - - setenv CC /opt/SUNWspro/bin/cc - -before running configure. (You might have to do a "make distclean" -if you already ran configure once). - -Also note that "make depend" won't work; while all of the known -universe uses -M, the SPARCompiler uses -xM to generate makefile -dependencies. - -If you are trying to do packet capture with a FORE ATM card, you may or -may not be able to. They usually only release their driver in object -code so unless their driver supports packet capture, there's not much -libpcap can do. - -If you get an error like: - - tcpdump: recv_ack: bind error 0x??? - -when using DLPI, look for the DL_ERROR_ACK error return values, usually -in /usr/include/sys/dlpi.h, and find the corresponding value. - -Under OSF, packet capture must be enabled before it can be used. For -instructions on how to enable packet filter support, see: - - ftp://ftp.digital.com/pub/Digital/dec-faq/Digital-UNIX - -Once you enable packet filter support, your OSF system will support bpf -natively. - -Under Ultrix, packet capture must be enabled before it can be used. For -instructions on how to enable packet filter support, see: - - ftp://ftp.digital.com/pub/Digital/dec-faq/ultrix - -If you use HP-UX, you must have at least version 9 and either the -version of cc that supports ANSI C (cc -Aa) or else use the GNU C -compiler. You must also buy the optional streams package. If you don't -have: - - /usr/include/sys/dlpi.h - /usr/include/sys/dlpi_ext.h - -then you don't have the streams package. In addition, we believe you -need to install the "9.X LAN and DLPI drivers cumulative" patch -(PHNE_6855) to make the version 9 DLPI work with libpcap. - -It's been reported that the DLPI streams package is standard starting -with HP-UX 10. - -The HP implementation of DLPI is a little bit eccentric. Unlike -Solaris, you must attach /dev/dlpi instead of the specific /dev/* -network pseudo device entry in order to capture packets. The ppa is -based on the ifnet "index" number. Under HP-UX 9, it is necessary to -read /dev/kmem and the kernel symbol file (/hp-ux). Under HP-UX 10, -dlpi can provide information for determining the ppa. It does not seem -to be possible to trace the loopback interface. Unlike other DLPI -implementations, PHYS implies MULTI and SAP and you get an error if you -try to enable more than one promiscous more than one promiscuous mode -at a time. Finally, testing shows that there can't be more than one -simultaneous dlpi user per network interface and you cannot capture -outbound packets. - -If you use Linux, this version of libpcap is known to compile and run -under Red Hat 4.0 with the 2.0.25 kernel. It may work with earlier 2.X -versions but is guaranteed not to work with 1.X kernels. Running more -than one libpcap program at a time can cause problems since promiscuous -mode is implemented by twiddlin the interface flags from the libpcap -application. Also, packet timestamps aren't very good. This appears to -be due to haphazard handling of the timestamp in the kernel. - -Note well: there is rumoured to be a version of tcpdump floating around -called 3.0.3 that includes libpcap and is supposed to support Linux. -You should be advised that the Network Research Group at LBNL never -generated a release with this version number. We note with interest -that a standard cracker trick to get people to install trojans is to -distribute bogus packages that have a version number higher than the -current release. We also note with annoyance that 90% of the Linux -related bug reports we get are due to changes made to unofficial -versions of our page. If you are having trouble but aren't using a -version that came from ftp.ee.lbl.gov, please try that before -submitting a bug report! - -If you use AIX, you may not be able to build libpcap from this release. -Although AIX 4 ships with tcpdump, it is an old version that predates -libpcap. We do not have an AIX system in house so it's impossible for -us to test AIX patches submitted to us. We are told that you must link -against /lib/pse.exp, that you must use AIX cc or a GNU C compiler -newer than 2.7.2 and that you may need to run strload before running a -libpcap application. Also, it may be necessary to run the configure -script as root in order for it to detect that bpf is available. Another -workaround is to use: - - ./configure --with-pcap=bpf - -If you use NeXTSTEP, you will not be able to build libpcap from this -release. We hope to support this operating system in some future -release of libpcap. - -If you use SINIX, you should be able to build libpcap from this -release. It is known to compile and run on SINIX-Y/N 5.42 with the C-DS -V1.0 or V1.1 compiler. But note that in some releases of SINIX, yacc -emits incorrect code; if grammar.y fails to compile, change every -occurence of: - - #ifdef YYDEBUG - -to: - #if YYDEBUG - -Another workaround is to use flex and bison. - -If you use SCO, you might have trouble building libpcap from this -release. We do not have a machine running SCO and have not had reports -of anyone successfully building on it. Since SCO apparently supports -dlpi, it's possible the current version works. Meanwhile, sco provides -a tcpdump binary as part of their "Network/Security Tools" package: - - http://www.sco.com/technology/internet/goodies/#SECURITY - -There is also a README that explains how to enable packet capture. - -If you use UnixWare, you will not be able to build libpcap from this -release. We hope to support this operating system in some future -release of libpcap. Meanwhile, there appears to be an UnixWare port of -libpcap 0.0 (and tcpdump 3.0) in: - - ftp://ftp1.freebird.org/pub/mirror/freebird/internet/systools/ - -UnixWare appears to use a hacked version of DLPI. - -If linking tcpdump fails with "Undefined: _alloca" when using bison on -a Sun4, your version of bison is broken. In any case version 1.16 or -higher is recommended (1.14 is known to cause problems 1.16 is known to -work). Either pick up a current version from: - - ftp://prep.ai.mit.edu/pub/gnu/bison.tar.gz - -or hack around it by inserting the lines: - - #ifdef __GNUC__ - #define alloca __builtin_alloca - #else - #ifdef sparc - #include - #else - char *alloca (); - #endif - #endif - -right after the (100 line!) GNU license comment in bison.simple, remove -grammar.[co] and fire up make again. - -If you use SunOS 4, your kernel must support streams NIT. If you run a -libpcap program and it dies with: - - /dev/nit: No such device - -You must add streams NIT support to your kernel configuration, run -config and boot the new kernel. - -If you are running a version of SunOS earlier than 4.1, you will need -to replace the Sun supplied /sys/sun{3,4,4c}/OBJ/nit_if.o with the -appropriate version from this distribution's SUNOS4 subdirectory and -build a new kernel: - - nit_if.o.sun3-sunos4 (any flavor of sun3) - nit_if.o.sun4c-sunos4.0.3c (SS1, SS1+, IPC, SLC, etc.) - nit_if.o.sun4-sunos4 (Sun4's not covered by - nit_if.o.sun4c-sunos4.0.3c) - -These nit replacements fix a bug that makes nit essentially unusable in -pre-SunOS 4.1. In addition, our sun4c-sunos4.0.3c nit gives you -timestamps to the resolution of the SS-1 clock (1 us) rather than the -lousy 20ms timestamps Sun gives you (tcpdump will print out the full -timestamp resolution if it finds it's running on a SS-1). - -FILES ------ -CHANGES - description of differences between releases -FILES - list of files exported as part of the distribution -INSTALL - this file -Makefile.in - compilation rules (input to the configure script) -README - description of distribution -SUNOS4 - pre-SunOS 4.1 replacement kernel nit modules -VERSION - version of this release -aclocal.m4 - autoconf macros -bpf/net - copies of bpf_filter.c and bpf.h -bpf_filter.c - symlink to bpf/net/bpf_filter.c -bpf_image.c - bpf disassembly routine -config.guess - autoconf support -config.sub - autoconf support -configure - configure script (run this first) -configure.in - configure script source -etherent.c - /etc/ethers support routines -ethertype.h - ethernet protocol types and names definitions -gencode.c - bpf code generation routines -gencode.h - bpf code generation definitions -grammar.y - filter string grammar -inet.c - network routines -install-sh - BSD style install script -lbl/gnuc.h - gcc macros and defines -lbl/os-*.h - os dependent defines and prototypes -linux-include/* - network include files missing on Linux -mkdep - construct Makefile dependency list -nametoaddr.c - hostname to address routines -net - symlink to bpf/net -optimize.c - bpf optimization routines -pcap-bpf.c - BSD Packet Filter support -pcap-dlpi.c - Data Link Provider Interface support -pcap-enet.c - enet support -pcap-int.h - internal libpcap definitions -pcap-namedb.h - public libpcap name database definitions -pcap-nit.c - Network Interface Tap support -pcap-nit.h - Network Interface Tap definitions -pcap-null.c - dummy monitor support (allows offline use of libpcap) -pcap-pf.c - Packet Filter support -pcap-pf.h - Packet Filter definitions -pcap-snit.c - Streams based Network Interface Tap support -pcap-snoop.c - Snoop network monitoring support -pcap.3 - manual entry -pcap.c - pcap utility routines -pcap.h - public libpcap definitions -ppp.h - Point to Point Protocol definitions -savefile.c - offline support -scanner.l - filter string scanner diff --git a/libpcap/Makefile.am b/libpcap/Makefile.am deleted file mode 100644 index e3c60d5..0000000 --- a/libpcap/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -noinst_LIBRARIES=libpcap.a -libpcap_a_SOURCES=pcap.c inet.c gencode.c optimize.c nametoaddr.c \ - etherent.c savefile.c bpf_filter.c bpf_image.c \ - grammar.c scanner.c \ - pcap-@V_PCAP@.c -noinst_HEADERS=pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \ - ethertype.h gencode.h ppp.h tokdefs.h -INCLUDES = -I$(srcdir)/lbl @INCLUDES@ -man_MANS=pcap.3 - -PCAP_SRC= pcap-bpf.c pcap-dlpi.c pcap-enet.c pcap-linux.c \ - pcap-nit.c pcap-null.c pcap-pf.c pcap-snit.c pcap-snoop.c - -BUILT_SOURCES=grammar.c scanner.c -EXTRA_DIST=grammar.y scanner.l $(BUILT_SOURCES) tokdefs.h \ - linux-include CHANGES FILES \ - README VERSION $(PCAP_SRC) lbl net $(man_MANS) \ - COPYING - -YLWRAP=$(SHELL) $(top_srcdir)/ylwrap -CLEANFILES=lex.yy.c y.tab.c y.tab.h - -grammar.c tokdefs.h: $(srcdir)/grammar.y - $(YLWRAP) "$(YACC)" $(srcdir)/grammar.y \ - y.tab.c grammar.c y.tab.h tokdefs.h \ - -- -yy pcap_ -vd - -scanner.c: $(srcdir)/scanner.l - $(YLWRAP) "$(LEX)" $(srcdir)/scanner.l \ - lex.yy.c scanner.c -- -yy pcap_ - diff --git a/libpcap/README b/libpcap/README deleted file mode 100644 index 1d9b503..0000000 --- a/libpcap/README +++ /dev/null @@ -1,49 +0,0 @@ -@(#) $Header: /cvsroot/ipacct/ipacct/libpcap/Attic/README,v 1.1 2001/05/31 13:40:52 gray Exp $ (LBL) - -LIBPCAP 0.4 -Lawrence Berkeley National Laboratory -Network Research Group -libpcap@ee.lbl.gov -ftp://ftp.ee.lbl.gov/libpcap.tar.Z - -This directory contains source code for libpcap, a system-independent -interface for user-level packet capture. libpcap provides a portable -framework for low-level network monitoring. Applications include -network statistics collection, security monitoring, network debugging, -etc. Since almost every system vendor provides a different interface -for packet capture, and since we've developed several tools that -require this functionality, we've created this system-independent API -to ease in porting and to alleviate the need for several -system-dependent packet capture modules in each application. - -Note well: this interface is new and is likely to change. - -The libpcap interface supports a filtering mechanism based on the -architecture in the BSD packet filter. BPF is described in the 1993 -Winter Usenix paper ``The BSD Packet Filter: A New Architecture for -User-level Packet Capture''. A compressed postscript version is in: - - ftp://ftp.ee.lbl.gov/papers/bpf-usenix93.ps.Z. - -Although most packet capture interfaces support in-kernel filtering, -libpcap utilizes in-kernel filtering only for the BPF interface. -On systems that don't have BPF, all packets are read into user-space -and the BPF filters are evaluated in the libpcap library, incurring -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/386, NetBSD, and FreeBSD. DEC OSF/1 -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. - -Problems, bugs, questions, desirable enhancements, source code -contributions, etc., should be sent to the email address -"libpcap@ee.lbl.gov". - - - Steve McCanne - Craig Leres - Van Jacobson diff --git a/libpcap/VERSION b/libpcap/VERSION deleted file mode 100644 index bd73f47..0000000 --- a/libpcap/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.4 diff --git a/libpcap/bpf_filter.c b/libpcap/bpf_filter.c deleted file mode 100644 index ea93b23..0000000 --- a/libpcap/bpf_filter.c +++ /dev/null @@ -1,532 +0,0 @@ -/*- - * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from the Stanford/CMU enet packet filter, - * (net/enet.c) distributed as part of 4.3BSD, and code contributed - * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence - * Berkeley Laboratory. - * - * 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. - * - * @(#)bpf.c 7.5 (Berkeley) 7/15/91 - */ - -#if !(defined(lint) || defined(KERNEL)) -static const char rcsid[] = - "@(#) $Header: /cvsroot/ipacct/ipacct/libpcap/Attic/bpf_filter.c,v 1.1 2001/05/31 13:40:52 gray Exp $ (LBL)"; -#endif - -#include -#include -#include -#include - -#ifndef KERNEL -#include -#endif - -#define int32 bpf_int32 -#define u_int32 bpf_u_int32 - -#ifndef LBL_ALIGN -#if defined(sparc) || defined(mips) || defined(ibm032) || \ - defined(__alpha) || defined(__hpux) -#define LBL_ALIGN -#endif -#endif - -#ifndef LBL_ALIGN -#include - -#define EXTRACT_SHORT(p) ((u_short)ntohs(*(u_short *)p)) -#define EXTRACT_LONG(p) (ntohl(*(u_int32 *)p)) -#else -#define EXTRACT_SHORT(p)\ - ((u_short)\ - ((u_short)*((u_char *)p+0)<<8|\ - (u_short)*((u_char *)p+1)<<0)) -#define EXTRACT_LONG(p)\ - ((u_int32)*((u_char *)p+0)<<24|\ - (u_int32)*((u_char *)p+1)<<16|\ - (u_int32)*((u_char *)p+2)<<8|\ - (u_int32)*((u_char *)p+3)<<0) -#endif - -#ifdef KERNEL -#include -#define MINDEX(len, m, k) \ -{ \ - len = m->m_len; \ - while (k >= len) { \ - k -= len; \ - m = m->m_next; \ - if (m == 0) \ - return 0; \ - len = m->m_len; \ - } \ -} - -static int -m_xword(m, k, err) - register struct mbuf *m; - register int k, *err; -{ - register int len; - register u_char *cp, *np; - register struct mbuf *m0; - - MINDEX(len, m, k); - cp = mtod(m, u_char *) + k; - if (len - k >= 4) { - *err = 0; - return EXTRACT_LONG(cp); - } - m0 = m->m_next; - if (m0 == 0 || m0->m_len + len - k < 4) - goto bad; - *err = 0; - np = mtod(m0, u_char *); - switch (len - k) { - - case 1: - return (cp[0] << 24) | (np[0] << 16) | (np[1] << 8) | np[2]; - - case 2: - return (cp[0] << 24) | (cp[1] << 16) | (np[0] << 8) | np[1]; - - default: - return (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | np[0]; - } - bad: - *err = 1; - return 0; -} - -static int -m_xhalf(m, k, err) - register struct mbuf *m; - register int k, *err; -{ - register int len; - register u_char *cp; - register struct mbuf *m0; - - MINDEX(len, m, k); - cp = mtod(m, u_char *) + k; - if (len - k >= 2) { - *err = 0; - return EXTRACT_SHORT(cp); - } - m0 = m->m_next; - if (m0 == 0) - goto bad; - *err = 0; - return (cp[0] << 8) | mtod(m0, u_char *)[0]; - bad: - *err = 1; - return 0; -} -#endif - -/* - * Execute the filter program starting at pc on the packet p - * wirelen is the length of the original packet - * buflen is the amount of data present - */ -u_int -bpf_filter(pc, p, wirelen, buflen) - register struct bpf_insn *pc; - register u_char *p; - u_int wirelen; - register u_int buflen; -{ - register u_int32 A, X; - register int k; - int32 mem[BPF_MEMWORDS]; - - if (pc == 0) - /* - * No filter means accept all. - */ - return (u_int)-1; - A = 0; - X = 0; - --pc; - while (1) { - ++pc; - switch (pc->code) { - - default: -#ifdef KERNEL - return 0; -#else - abort(); -#endif - case BPF_RET|BPF_K: - return (u_int)pc->k; - - case BPF_RET|BPF_A: - return (u_int)A; - - case BPF_LD|BPF_W|BPF_ABS: - k = pc->k; - if (k + sizeof(int32) > buflen) { -#ifdef KERNEL - int merr; - - if (buflen != 0) - return 0; - A = m_xword((struct mbuf *)p, k, &merr); - if (merr != 0) - return 0; - continue; -#else - return 0; -#endif - } - A = EXTRACT_LONG(&p[k]); - continue; - - case BPF_LD|BPF_H|BPF_ABS: - k = pc->k; - if (k + sizeof(short) > buflen) { -#ifdef KERNEL - int merr; - - if (buflen != 0) - return 0; - A = m_xhalf((struct mbuf *)p, k, &merr); - continue; -#else - return 0; -#endif - } - A = EXTRACT_SHORT(&p[k]); - continue; - - case BPF_LD|BPF_B|BPF_ABS: - k = pc->k; - if (k >= buflen) { -#ifdef KERNEL - register struct mbuf *m; - register int len; - - if (buflen != 0) - return 0; - m = (struct mbuf *)p; - MINDEX(len, m, k); - A = mtod(m, u_char *)[k]; - continue; -#else - return 0; -#endif - } - A = p[k]; - continue; - - case BPF_LD|BPF_W|BPF_LEN: - A = wirelen; - continue; - - case BPF_LDX|BPF_W|BPF_LEN: - X = wirelen; - continue; - - case BPF_LD|BPF_W|BPF_IND: - k = X + pc->k; - if (k + sizeof(int32) > buflen) { -#ifdef KERNEL - int merr; - - if (buflen != 0) - return 0; - A = m_xword((struct mbuf *)p, k, &merr); - if (merr != 0) - return 0; - continue; -#else - return 0; -#endif - } - A = EXTRACT_LONG(&p[k]); - continue; - - case BPF_LD|BPF_H|BPF_IND: - k = X + pc->k; - if (k + sizeof(short) > buflen) { -#ifdef KERNEL - int merr; - - if (buflen != 0) - return 0; - A = m_xhalf((struct mbuf *)p, k, &merr); - if (merr != 0) - return 0; - continue; -#else - return 0; -#endif - } - A = EXTRACT_SHORT(&p[k]); - continue; - - case BPF_LD|BPF_B|BPF_IND: - k = X + pc->k; - if (k >= buflen) { -#ifdef KERNEL - register struct mbuf *m; - register int len; - - if (buflen != 0) - return 0; - m = (struct mbuf *)p; - MINDEX(len, m, k); - A = mtod(m, u_char *)[k]; - continue; -#else - return 0; -#endif - } - A = p[k]; - continue; - - case BPF_LDX|BPF_MSH|BPF_B: - k = pc->k; - if (k >= buflen) { -#ifdef KERNEL - register struct mbuf *m; - register int len; - - if (buflen != 0) - return 0; - m = (struct mbuf *)p; - MINDEX(len, m, k); - X = (mtod(m, char *)[k] & 0xf) << 2; - continue; -#else - return 0; -#endif - } - X = (p[pc->k] & 0xf) << 2; - continue; - - case BPF_LD|BPF_IMM: - A = pc->k; - continue; - - case BPF_LDX|BPF_IMM: - X = pc->k; - continue; - - case BPF_LD|BPF_MEM: - A = mem[pc->k]; - continue; - - case BPF_LDX|BPF_MEM: - X = mem[pc->k]; - continue; - - case BPF_ST: - mem[pc->k] = A; - continue; - - case BPF_STX: - mem[pc->k] = X; - continue; - - case BPF_JMP|BPF_JA: - pc += pc->k; - continue; - - case BPF_JMP|BPF_JGT|BPF_K: - pc += (A > pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGE|BPF_K: - pc += (A >= pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JEQ|BPF_K: - pc += (A == pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JSET|BPF_K: - pc += (A & pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGT|BPF_X: - pc += (A > X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGE|BPF_X: - pc += (A >= X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JEQ|BPF_X: - pc += (A == X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JSET|BPF_X: - pc += (A & X) ? pc->jt : pc->jf; - continue; - - case BPF_ALU|BPF_ADD|BPF_X: - A += X; - continue; - - case BPF_ALU|BPF_SUB|BPF_X: - A -= X; - continue; - - case BPF_ALU|BPF_MUL|BPF_X: - A *= X; - continue; - - case BPF_ALU|BPF_DIV|BPF_X: - if (X == 0) - return 0; - A /= X; - continue; - - case BPF_ALU|BPF_AND|BPF_X: - A &= X; - continue; - - case BPF_ALU|BPF_OR|BPF_X: - A |= X; - continue; - - case BPF_ALU|BPF_LSH|BPF_X: - A <<= X; - continue; - - case BPF_ALU|BPF_RSH|BPF_X: - A >>= X; - continue; - - case BPF_ALU|BPF_ADD|BPF_K: - A += pc->k; - continue; - - case BPF_ALU|BPF_SUB|BPF_K: - A -= pc->k; - continue; - - case BPF_ALU|BPF_MUL|BPF_K: - A *= pc->k; - continue; - - case BPF_ALU|BPF_DIV|BPF_K: - A /= pc->k; - continue; - - case BPF_ALU|BPF_AND|BPF_K: - A &= pc->k; - continue; - - case BPF_ALU|BPF_OR|BPF_K: - A |= pc->k; - continue; - - case BPF_ALU|BPF_LSH|BPF_K: - A <<= pc->k; - continue; - - case BPF_ALU|BPF_RSH|BPF_K: - A >>= pc->k; - continue; - - case BPF_ALU|BPF_NEG: - A = -A; - continue; - - case BPF_MISC|BPF_TAX: - X = A; - continue; - - case BPF_MISC|BPF_TXA: - A = X; - continue; - } - } -} - -#ifdef KERNEL -/* - * Return true if the 'fcode' is a valid filter program. - * The constraints are that each jump be forward and to a valid - * code. The code must terminate with either an accept or reject. - * 'valid' is an array for use by the routine (it must be at least - * 'len' bytes long). - * - * The kernel needs to be able to verify an application's filter code. - * Otherwise, a bogus program could easily crash the system. - */ -int -bpf_validate(f, len) - struct bpf_insn *f; - int len; -{ - register int i; - register struct bpf_insn *p; - - for (i = 0; i < len; ++i) { - /* - * Check that that jumps are forward, and within - * the code block. - */ - p = &f[i]; - if (BPF_CLASS(p->code) == BPF_JMP) { - register int from = i + 1; - - if (BPF_OP(p->code) == BPF_JA) { - if (from + p->k >= (unsigned)len) - return 0; - } - else if (from + p->jt >= len || from + p->jf >= len) - return 0; - } - /* - * Check that memory operations use valid addresses. - */ - if ((BPF_CLASS(p->code) == BPF_ST || - (BPF_CLASS(p->code) == BPF_LD && - (p->code & 0xe0) == BPF_MEM)) && - (p->k >= BPF_MEMWORDS || p->k < 0)) - return 0; - /* - * Check for constant division by 0. - */ - if (p->code == (BPF_ALU|BPF_DIV|BPF_K) && p->k == 0) - return 0; - } - return BPF_CLASS(f[len - 1].code) == BPF_RET; -} -#endif diff --git a/libpcap/bpf_image.c b/libpcap/bpf_image.c deleted file mode 100644 index c3f51ac..0000000 --- a/libpcap/bpf_image.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 1990, 1991, 1992, 1994, 1995, 1996 - * 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 rcsid[] = - "@(#) $Header: /cvsroot/ipacct/ipacct/libpcap/Attic/bpf_image.c,v 1.1 2001/05/31 13:40:52 gray Exp $ (LBL)"; -#endif - -#if defined(HAVE_CONFIG_H) -# include -#endif - -#include -#include - -#include -#include - -#include - -#include -#ifdef HAVE_OS_PROTO_H -#include -#endif - -char * -bpf_image(p, n) - struct bpf_insn *p; - int n; -{ - int v; - char *fmt, *op; - static char image[256]; - char operand[64]; - - v = p->k; - switch (p->code) { - - default: - op = "unimp"; - fmt = "0x%x"; - v = p->code; - break; - - case BPF_RET|BPF_K: - op = "ret"; - fmt = "#%d"; - break; - - case BPF_RET|BPF_A: - op = "ret"; - fmt = ""; - break; - - case BPF_LD|BPF_W|BPF_ABS: - op = "ld"; - fmt = "[%d]"; - break; - - case BPF_LD|BPF_H|BPF_ABS: - op = "ldh"; - fmt = "[%d]"; - break; - - case BPF_LD|BPF_B|BPF_ABS: - op = "ldb"; - fmt = "[%d]"; - break; - - case BPF_LD|BPF_W|BPF_LEN: - op = "ld"; - fmt = "#pktlen"; - break; - - case BPF_LD|BPF_W|BPF_IND: - op = "ld"; - fmt = "[x + %d]"; - break; - - case BPF_LD|BPF_H|BPF_IND: - op = "ldh"; - fmt = "[x + %d]"; - break; - - case BPF_LD|BPF_B|BPF_IND: - op = "ldb"; - fmt = "[x + %d]"; - break; - - case BPF_LD|BPF_IMM: - op = "ld"; - fmt = "#0x%x"; - break; - - case BPF_LDX|BPF_IMM: - op = "ldx"; - fmt = "#0x%x"; - break; - - case BPF_LDX|BPF_MSH|BPF_B: - op = "ldxb"; - fmt = "4*([%d]&0xf)"; - break; - - case BPF_LD|BPF_MEM: - op = "ld"; - fmt = "M[%d]"; - break; - - case BPF_LDX|BPF_MEM: - op = "ldx"; - fmt = "M[%d]"; - break; - - case BPF_ST: - op = "st"; - fmt = "M[%d]"; - break; - - case BPF_STX: - op = "stx"; - fmt = "M[%d]"; - break; - - case BPF_JMP|BPF_JA: - op = "ja"; - fmt = "%d"; - v = n + 1 + p->k; - break; - - case BPF_JMP|BPF_JGT|BPF_K: - op = "jgt"; - fmt = "#0x%x"; - break; - - case BPF_JMP|BPF_JGE|BPF_K: - op = "jge"; - fmt = "#0x%x"; - break; - - case BPF_JMP|BPF_JEQ|BPF_K: - op = "jeq"; - fmt = "#0x%x"; - break; - - case BPF_JMP|BPF_JSET|BPF_K: - op = "jset"; - fmt = "#0x%x"; - break; - - case BPF_JMP|BPF_JGT|BPF_X: - op = "jgt"; - fmt = "x"; - break; - - case BPF_JMP|BPF_JGE|BPF_X: - op = "jge"; - fmt = "x"; - break; - - case BPF_JMP|BPF_JEQ|BPF_X: - op = "jeq"; - fmt = "x"; - break; - - case BPF_JMP|BPF_JSET|BPF_X: - op = "jset"; - fmt = "x"; - break; - - case BPF_ALU|BPF_ADD|BPF_X: - op = "add"; - fmt = "x"; - break; - - case BPF_ALU|BPF_SUB|BPF_X: - op = "sub"; - fmt = "x"; - break; - - case BPF_ALU|BPF_MUL|BPF_X: - op = "mul"; - fmt = "x"; - break; - - case BPF_ALU|BPF_DIV|BPF_X: - op = "div"; - fmt = "x"; - break; - - case BPF_ALU|BPF_AND|BPF_X: - op = "and"; - fmt = "x"; - break; - - case BPF_ALU|BPF_OR|BPF_X: - op = "or"; - fmt = "x"; - break; - - case BPF_ALU|BPF_LSH|BPF_X: - op = "lsh"; - fmt = "x"; - break; - - case BPF_ALU|BPF_RSH|BPF_X: - op = "rsh"; - fmt = "x"; - break; - - case BPF_ALU|BPF_ADD|BPF_K: - op = "add"; - fmt = "#%d"; - break; - - case BPF_ALU|BPF_SUB|BPF_K: - op = "sub"; - fmt = "#%d"; - break; - - case BPF_ALU|BPF_MUL|BPF_K: - op = "mul"; - fmt = "#%d"; - break; - - case BPF_ALU|BPF_DIV|BPF_K: - op = "div"; - fmt = "#%d"; - break; - - case BPF_ALU|BPF_AND|BPF_K: - op = "and"; - fmt = "#0x%x"; - break; - - case BPF_ALU|BPF_OR|BPF_K: - op = "or"; - fmt = "#0x%x"; - break; - - case BPF_ALU|BPF_LSH|BPF_K: - op = "lsh"; - fmt = "#%d"; - break; - - case BPF_ALU|BPF_RSH|BPF_K: - op = "rsh"; - fmt = "#%d"; - break; - - case BPF_ALU|BPF_NEG: - op = "neg"; - fmt = ""; - break; - - case BPF_MISC|BPF_TAX: - op = "tax"; - fmt = ""; - break; - - case BPF_MISC|BPF_TXA: - op = "txa"; - fmt = ""; - break; - } - (void)sprintf(operand, fmt, v); - (void)sprintf(image, - (BPF_CLASS(p->code) == BPF_JMP && - BPF_OP(p->code) != BPF_JA) ? - "(%03d) %-8s %-16s jt %d\tjf %d" - : "(%03d) %-8s %s", - n, op, operand, n + 1 + p->jt, n + 1 + p->jf); - return image; -} diff --git a/libpcap/etherent.c b/libpcap/etherent.c deleted file mode 100644 index 422cb6e..0000000 --- a/libpcap/etherent.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 1990, 1993, 1994, 1995, 1996 - * 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 rcsid[] = - "@(#) $Header: /cvsroot/ipacct/ipacct/libpcap/Attic/etherent.c,v 1.1 2001/05/31 13:40:52 gray Exp $ (LBL)"; -#endif - -#if defined(HAVE_CONFIG_H) -# include -#endif - -#include - -#include -#include -#include -#include - -#include - -#include - -#include -#ifdef HAVE_OS_PROTO_H -#include -#endif - -static inline int xdtoi(int); -static inline int skip_space(FILE *); -static inline int skip_line(FILE *); - -/* Hex digit to integer. */ -static inline int -xdtoi(c) - register int c; -{ - if (isdigit(c)) - return c - '0'; - else if (islower(c)) - return c - 'a' + 10; - else - return c - 'A' + 10; -} - -static inline int -skip_space(f) - FILE *f; -{ - int c; - - do { - c = getc(f); - } while (isspace(c) && c != '\n'); - - return c; -} - -static inline int -skip_line(f) - FILE *f; -{ - int c; - - do - c = getc(f); - while (c != '\n' && c != EOF); - - return c; -} - -struct pcap_etherent * -pcap_next_etherent(FILE *fp) -{ - register int c, d, i; - char *bp; - static struct pcap_etherent e; - - memset((char *)&e, 0, sizeof(e)); - do { - /* Find addr */ - c = skip_space(fp); - if (c == '\n') - continue; - - /* If this is a comment, or first thing on line - cannot be etehrnet address, skip the line. */ - if (!isxdigit(c)) { - c = skip_line(fp); - continue; - } - - /* must be the start of an address */ - for (i = 0; i < 6; i += 1) { - d = xdtoi(c); - c = getc(fp); - if (isxdigit(c)) { - d <<= 4; - d |= xdtoi(c); - c = getc(fp); - } - e.addr[i] = d; - if (c != ':') - break; - c = getc(fp); - } - if (c == EOF) - break; - - /* Must be whitespace */ - if (!isspace(c)) { - c = skip_line(fp); - continue; - } - c = skip_space(fp); - - /* hit end of line... */ - if (c == '\n') - continue; - - if (c == '#') { - c = skip_line(fp); - continue; - } - - /* pick up name */ - bp = e.name; - /* Use 'd' to prevent buffer overflow. */ - d = sizeof(e.name) - 1; - do { - *bp++ = c; - c = getc(fp); - } while (!isspace(c) && c != EOF && --d > 0); - *bp = '\0'; - - /* Eat trailing junk */ - if (c != '\n') - (void)skip_line(fp); - - return &e; - - } while (c != EOF); - - return (NULL); -} diff --git a/libpcap/ethertype.h b/libpcap/ethertype.h deleted file mode 100644 index 785c5fe..0000000 --- a/libpcap/ethertype.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 1993, 1994, 1996 - * 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: /cvsroot/ipacct/ipacct/libpcap/Attic/ethertype.h,v 1.1 2001/05/31 13:40:52 gray Exp $ (LBL) - */ - -/* Types missing from some systems */ - -#ifndef ETHERTYPE_NS -#define ETHERTYPE_NS 0x0600 -#endif -#ifndef ETHERTYPE_SPRITE -#define ETHERTYPE_SPRITE 0x0500 -#endif -#ifndef ETHERTYPE_TRAIL -#define ETHERTYPE_TRAIL 0x1000 -#endif -#ifndef ETHERTYPE_MOPDL -#define ETHERTYPE_MOPDL 0x6001 -#endif -#ifndef ETHERTYPE_MOPRC -#define ETHERTYPE_MOPRC 0x6002 -#endif -#ifndef ETHERTYPE_DN -#define ETHERTYPE_DN 0x6003 -#endif -#ifndef ETHERTYPE_LAT -#define ETHERTYPE_LAT 0x6004 -#endif -#ifndef ETHERTYPE_SCA -#define ETHERTYPE_SCA 0x6007 -#endif -#ifndef ETHERTYPE_REVARP -#define ETHERTYPE_REVARP 0x8035 -#endif -#ifndef ETHERTYPE_LANBRIDGE -#define ETHERTYPE_LANBRIDGE 0x8038 -#endif -#ifndef ETHERTYPE_DECDNS -#define ETHERTYPE_DECDNS 0x803c -#endif -#ifndef ETHERTYPE_DECDTS -#define ETHERTYPE_DECDTS 0x803e -#endif -#ifndef ETHERTYPE_VEXP -#define ETHERTYPE_VEXP 0x805b -#endif -#ifndef ETHERTYPE_VPROD -#define ETHERTYPE_VPROD 0x805c -#endif -#ifndef ETHERTYPE_ATALK -#define ETHERTYPE_ATALK 0x809b -#endif -#ifndef ETHERTYPE_AARP -#define ETHERTYPE_AARP 0x80f3 -#endif -#ifndef ETHERTYPE_LOOPBACK -#define ETHERTYPE_LOOPBACK 0x9000 -#endif diff --git a/libpcap/gencode.c b/libpcap/gencode.c deleted file mode 100644 index 8febdcb..0000000 --- a/libpcap/gencode.c +++ /dev/null @@ -1,1948 +0,0 @@ -/* - * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 - * 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 rcsid[] = - "@(#) $Header: /cvsroot/ipacct/ipacct/libpcap/Attic/gencode.c,v 1.1 2001/05/31 13:40:52 gray Exp $ (LBL)"; -#endif - -#if defined(HAVE_CONFIG_H) -# include -#endif - -#include -#include -#include - -#if __STDC__ -struct mbuf; -struct rtentry; -#endif - -#include - -#include -#include - -#include -#include -#include -#if __STDC__ -#include -#else -#include -#endif - -#include - -#include -#include -#include -#include - -#include -#ifdef HAVE_OS_PROTO_H -#include -#endif - -#define JMP(c) ((c)|BPF_JMP|BPF_K) - -/* Locals */ -static jmp_buf top_ctx; -static pcap_t *bpf_pcap; - -/* XXX */ -#ifdef PCAP_FDDIPAD -int pcap_fddipad = PCAP_FDDIPAD; -#else -int pcap_fddipad; -#endif - -/* VARARGS */ -__dead void -#if __STDC__ -bpf_error(const char *fmt, ...) -#else -bpf_error(fmt, va_alist) - const char *fmt; - va_dcl -#endif -{ - va_list ap; - -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - if (bpf_pcap != NULL) - (void)vsprintf(pcap_geterr(bpf_pcap), fmt, ap); - va_end(ap); - longjmp(top_ctx, 1); - /* NOTREACHED */ -} - -static void init_linktype(int); - -static int alloc_reg(void); -static void free_reg(int); - -static struct block *root; - -/* - * We divy out chunks of memory rather than call malloc each time so - * we don't have to worry about leaking memory. It's probably - * not a big deal if all this memory was wasted but it this ever - * goes into a library that would probably not be a good idea. - */ -#define NCHUNKS 16 -#define CHUNK0SIZE 1024 -struct chunk { - u_int n_left; - void *m; -}; - -static struct chunk chunks[NCHUNKS]; -static int cur_chunk; - -static void *newchunk(u_int); -static void freechunks(void); -static inline struct block *new_block(int); -static inline struct slist *new_stmt(int); -static struct block *gen_retblk(int); -static inline void syntax(void); - -static void backpatch(struct block *, struct block *); -static void merge(struct block *, struct block *); -static struct block *gen_cmp(u_int, u_int, bpf_int32); -static struct block *gen_mcmp(u_int, u_int, bpf_int32, bpf_u_int32); -static struct block *gen_bcmp(u_int, u_int, const u_char *); -static struct block *gen_uncond(int); -static inline struct block *gen_true(void); -static inline struct block *gen_false(void); -static struct block *gen_linktype(int); -static struct block *gen_hostop(bpf_u_int32, bpf_u_int32, int, int, u_int, u_int); -static struct block *gen_ehostop(const u_char *, int); -static struct block *gen_fhostop(const u_char *, int); -static struct block *gen_dnhostop(bpf_u_int32, int, u_int); -static struct block *gen_host(bpf_u_int32, bpf_u_int32, int, int); -static struct block *gen_gateway(const u_char *, bpf_u_int32 **, int, int); -static struct block *gen_ipfrag(void); -static struct block *gen_portatom(int, bpf_int32); -struct block *gen_portop(int, int, int); -static struct block *gen_port(int, int, int); -static int lookup_proto(const char *, int); -static struct block *gen_proto(int, int, int); -static struct slist *xfer_to_x(struct arth *); -static struct slist *xfer_to_a(struct arth *); -static struct block *gen_len(int, int); - -static void * -newchunk(n) - u_int n; -{ - struct chunk *cp; - int k, size; - - /* XXX Round up to nearest long. */ - n = (n + sizeof(long) - 1) & ~(sizeof(long) - 1); - - cp = &chunks[cur_chunk]; - if (n > cp->n_left) { - ++cp, k = ++cur_chunk; - if (k >= NCHUNKS) - bpf_error("out of memory"); - size = CHUNK0SIZE << k; - cp->m = (void *)malloc(size); - memset((char *)cp->m, 0, size); - cp->n_left = size; - if (n > size) - bpf_error("out of memory"); - } - cp->n_left -= n; - return (void *)((char *)cp->m + cp->n_left); -} - -static void -freechunks() -{ - int i; - - cur_chunk = 0; - for (i = 0; i < NCHUNKS; ++i) - if (chunks[i].m != NULL) { - free(chunks[i].m); - chunks[i].m = NULL; - } -} - -/* - * A strdup whose allocations are freed after code generation is over. - */ -char * -sdup(s) - register const char *s; -{ - int n = strlen(s) + 1; - char *cp = newchunk(n); - - strcpy(cp, s); - return (cp); -} - -static inline struct block * -new_block(code) - int code; -{ - struct block *p; - - p = (struct block *)newchunk(sizeof(*p)); - p->s.code = code; - p->head = p; - - return p; -} - -static inline struct slist * -new_stmt(code) - int code; -{ - struct slist *p; - - p = (struct slist *)newchunk(sizeof(*p)); - p->s.code = code; - - return p; -} - -static struct block * -gen_retblk(v) - int v; -{ - struct block *b = new_block(BPF_RET|BPF_K); - - b->s.k = v; - return b; -} - -static inline void -syntax() -{ - bpf_error("syntax error in filter expression"); -} - -static bpf_u_int32 netmask; -static int snaplen; - -int -pcap_compile(pcap_t *p, struct bpf_program *program, - char *buf, int optimize, bpf_u_int32 mask) -{ - extern int n_errors; - int len; - - n_errors = 0; - root = NULL; - bpf_pcap = p; - if (setjmp(top_ctx)) { - freechunks(); - return (-1); - } - - netmask = mask; - snaplen = pcap_snapshot(p); - - lex_init(buf ? buf : ""); - init_linktype(pcap_datalink(p)); - (void)pcap_parse(); - - if (n_errors) - syntax(); - - if (root == NULL) - root = gen_retblk(snaple