This commit was generated by cvs2svn to compensate for changes in r39291,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
Bill Fenner 1998-09-15 19:28:10 +00:00
commit 4e4869f856
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39292
19 changed files with 744 additions and 252 deletions

View File

@ -1,4 +1,81 @@
@(#) $Header: CHANGES,v 1.36 96/11/30 21:01:15 leres Exp $ (LBL)
@(#) $Header: CHANGES,v 1.47 98/07/25 12:40:16 leres 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

View File

@ -5,7 +5,7 @@ Makefile.in
README
SUNOS4
VERSION
acsite.m4
aclocal.m4
bpf/net/bpf.h
bpf/net/bpf_filter.c
bpf_image.c
@ -30,10 +30,10 @@ mkdep
nametoaddr.c
optimize.c
pcap-bpf.c
pcap-linux.c
pcap-dlpi.c
pcap-enet.c
pcap-int.h
pcap-linux.c
pcap-namedb.h
pcap-nit.c
pcap-nit.h
@ -45,5 +45,6 @@ pcap-snoop.c
pcap.3
pcap.c
pcap.h
ppp.h
savefile.c
scanner.l

View File

@ -1,4 +1,4 @@
@(#) $Header: INSTALL,v 1.32 96/12/11 19:16:21 leres Exp $ (LBL)
@(#) $Header: INSTALL,v 1.42 98/03/20 18:49:16 vern Exp $ (LBL)
To build libpcap, first customize any paths in Makefile.in, then run
"./configure" (a shell script). The configure script will determine
@ -21,6 +21,15 @@ 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:
@ -30,9 +39,13 @@ the GNU C compiler, available via anonymous ftp:
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 if it detects if the fixincludes needs to
be run. If the fixincludes test in configure passes, you're probably
ok.
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
@ -48,8 +61,12 @@ 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.
If you use flex and bison, you may also have to use gcc to avoid
undefined references for alloca.
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
@ -93,6 +110,18 @@ 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:
@ -130,13 +159,9 @@ 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. This results in error messages:
WARNING: DL_PROMISC_MULTI failed (recv_ack: promisc_multi: Invalid argument)
WARNING: DL_PROMISC_SAP failed (recv_ack: promisc_sap: Invalid argument)
which may be safely ignored. Finally, testing shows that there can't be
more than one simultaneous dlpi user per network interface.
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
@ -152,14 +177,23 @@ 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.
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.
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 like againt
/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.
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
@ -197,9 +231,6 @@ libpcap 0.0 (and tcpdump 3.0) in:
UnixWare appears to use a hacked version of DLPI.
If you use flex and bison and not gcc but the linker cannot find
alloca(), you need to either use gcc or not use flex and bison.
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
@ -255,7 +286,7 @@ 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
acsite.m4 - autoconf macros
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
@ -292,5 +323,6 @@ 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

View File

@ -17,7 +17,7 @@
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# @(#) $Header: Makefile.in,v 1.68 96/09/26 21:53:37 leres Exp $ (LBL)
# @(#) $Header: Makefile.in,v 1.72 97/06/30 13:56:14 leres Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
@ -70,7 +70,7 @@ YACC = @V_YACC@
PSRC = pcap-@V_PCAP@.c
CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c \
etherent.c savefile.c bpf_filter.c bpf_image.c
GENSRC = scanner.c grammar.c
GENSRC = scanner.c grammar.c version.c
SRC = $(PSRC) $(CSRC) $(GENSRC)
@ -90,6 +90,8 @@ TAGFILES = \
CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
all: libpcap.a
libpcap.a: $(OBJ)
@rm -f $@
ar rc $@ $(OBJ)
@ -111,17 +113,26 @@ grammar.o: grammar.c
@rm -f $@
$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
version.o: version.c
version.c: $(srcdir)/VERSION
@rm -f $@
sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
install: force
$(INSTALL) -m 444 -o bin -g bin libpcap.a $(DESTDIR)$(LIBDEST)
$(INSTALL) -m 444 -o bin -g bin libpcap.a $(DESTDIR)$(LIBDEST)/libpcap.a
$(RANLIB) $(DESTDIR)$(LIBDEST)/libpcap.a
install-incl: force
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.h $(DESTDIR)$(INCLDEST)
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap-namedb.h $(DESTDIR)$(INCLDEST)
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/net/bpf.h $(DESTDIR)$(INCLDEST)/net
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.h \
$(DESTDIR)$(INCLDEST)/pcap.h
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap-namedb.h \
$(DESTDIR)$(INCLDEST)/pcap-namedb.h
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/net/bpf.h \
$(DESTDIR)$(INCLDEST)/net/bpf.h
install-man: force
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.3 $(DESTDIR)$(MANDEST)/man3
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.3 \
$(DESTDIR)$(MANDEST)/man3/pcap.3
clean:
rm -f $(CLEANFILES)

View File

@ -1,6 +1,6 @@
@(#) $Header: README,v 1.17 96/11/29 01:14:24 leres Exp $ (LBL)
@(#) $Header: README,v 1.18 97/06/12 14:23:56 leres Exp $ (LBL)
LIBPCAP 0.3
LIBPCAP 0.4
Lawrence Berkeley National Laboratory
Network Research Group
libpcap@ee.lbl.gov

View File

@ -1 +1 @@
0.3
0.4

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996
* 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,
@ -37,7 +37,7 @@
*
* @(#)bpf.h 7.1 (Berkeley) 5/7/91
*
* @(#) $Header: bpf.h,v 1.35 96/09/26 21:57:37 leres Exp $ (LBL)
* @(#) $Header: bpf.h,v 1.36 97/06/12 14:29:53 leres Exp $ (LBL)
*/
#ifndef BPF_MAJOR_VERSION
@ -170,6 +170,8 @@ struct bpf_hdr {
#define DLT_FDDI 10 /* FDDI */
#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */
#define DLT_RAW 12 /* raw IP */
#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */
#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */
/*
* The instruction encondings.

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996
* 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,
@ -40,7 +40,7 @@
#if !(defined(lint) || defined(KERNEL))
static const char rcsid[] =
"@(#) $Header: bpf_filter.c,v 1.31 96/12/11 20:18:39 leres Exp $ (LBL)";
"@(#) $Header: bpf_filter.c,v 1.33 97/04/26 13:37:18 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -507,7 +507,7 @@ bpf_validate(f, len)
register int from = i + 1;
if (BPF_OP(p->code) == BPF_JA) {
if (from + p->k >= len)
if (from + p->k >= (unsigned)len)
return 0;
}
else if (from + p->jt >= len || from + p->jf >= len)

View File

@ -11,6 +11,14 @@
ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
--without-gcc don't use gcc"
ac_help="$ac_help
--with-pcap=TYPE use packet capture TYPE"
ac_help="$ac_help
--without-flex don't use flex"
ac_help="$ac_help
--without-bison don't use bison"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@ -566,7 +574,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:570: checking host system type" >&5
echo "configure:578: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@ -587,7 +595,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
echo "configure:591: checking target system type" >&5
echo "configure:599: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@ -605,7 +613,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
echo "configure:609: checking build system type" >&5
echo "configure:617: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@ -635,8 +643,20 @@ if test -z "$PWD" ; then
fi
V_CCOPT=-O
# Check whether --with-gcc or --without-gcc was given.
if test "${with_gcc+set}" = set; then
withval="$with_gcc"
:
fi
V_CCOPT="-O"
V_INCLS=""
if test "${srcdir}" != "." ; then
V_INCLS="-I\$\(srcdir\)"
fi
if test "${CFLAGS+set}" = set; then
LBL_CFLAGS="$CFLAGS"
fi
@ -647,7 +667,7 @@ fi
# Extract the first word of "shlicc2", so it can be a program name with args.
set dummy shlicc2; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:651: checking for $ac_word" >&5
echo "configure:671: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_SHLICC2'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -680,10 +700,14 @@ fi
;;
esac
fi
if test -z "$CC" -a "$with_gcc" = no ; then
CC=cc
export CC
fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:687: checking for $ac_word" >&5
echo "configure:711: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -712,7 +736,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:716: checking for $ac_word" >&5
echo "configure:740: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -760,7 +784,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:764: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:788: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -770,11 +794,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
#line 774 "configure"
#line 798 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -794,12 +818,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:798: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:822: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:803: checking whether we are using GNU C" >&5
echo "configure:827: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -808,7 +832,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -823,7 +847,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:827: checking whether ${CC-cc} accepts -g" >&5
echo "configure:851: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -850,86 +874,89 @@ else
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
if test $ac_cv_prog_gcc = yes ; then
if test "$GCC" = yes ; then
if test "$SHLICC2" = yes ; then
ac_cv_gcc_vers=2
V_CCOPT=-O2
ac_cv_lbl_gcc_vers=2
V_CCOPT="-O2"
else
echo $ac_n "checking gcc version""... $ac_c" 1>&6
echo "configure:860: checking gcc version" >&5
if eval "test \"`echo '$''{'ac_cv_gcc_vers'+set}'`\" = set"; then
echo "configure:884: checking gcc version" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_gcc_vers'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_gcc_vers=`$CC -v 2>&1 | \
sed -n -e '$s/.* //' -e '$s/\..*//p'`
ac_cv_lbl_gcc_vers=`$CC -v 2>&1 | \
sed -e '/^gcc version /!d' \
-e 's/^gcc version //' \
-e 's/ .*//' -e 's/^[^0-9]*//' \
-e 's/\..*//'`
fi
echo "$ac_t""$ac_cv_gcc_vers" 1>&6
if test $ac_cv_gcc_vers -gt 1 ; then
V_CCOPT=-O2
echo "$ac_t""$ac_cv_lbl_gcc_vers" 1>&6
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
V_CCOPT="-O2"
fi
fi
else
echo $ac_n "checking that $CC handles ansi prototypes""... $ac_c" 1>&6
echo "configure:875: checking that $CC handles ansi prototypes" >&5
if eval "test \"`echo '$''{'ac_cv_cc_ansi_prototypes'+set}'`\" = set"; then
echo "configure:902: checking that $CC handles ansi prototypes" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_cc_ansi_prototypes'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 880 "configure"
#line 907 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
int frob(int, char *)
; return 0; }
EOF
if { (eval echo configure:887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:914: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cc_ansi_prototypes=yes
ac_cv_lbl_cc_ansi_prototypes=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_cc_ansi_prototypes=no
ac_cv_lbl_cc_ansi_prototypes=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_cc_ansi_prototypes" 1>&6
if test $ac_cv_cc_ansi_prototypes = no ; then
echo "$ac_t""$ac_cv_lbl_cc_ansi_prototypes" 1>&6
if test $ac_cv_lbl_cc_ansi_prototypes = no ; then
case "$target_os" in
hpux*)
echo $ac_n "checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)""... $ac_c" 1>&6
echo "configure:905: checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)" >&5
echo "configure:932: checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)" >&5
savedcflags="$CFLAGS"
CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
if eval "test \"`echo '$''{'ac_cv_cc_hpux_cc_aa'+set}'`\" = set"; then
if eval "test \"`echo '$''{'ac_cv_lbl_cc_hpux_cc_aa'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 912 "configure"
#line 939 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
int frob(int, char *)
; return 0; }
EOF
if { (eval echo configure:919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cc_hpux_cc_aa=yes
ac_cv_lbl_cc_hpux_cc_aa=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_cc_hpux_cc_aa=no
ac_cv_lbl_cc_hpux_cc_aa=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_cc_hpux_cc_aa" 1>&6
if test $ac_cv_cc_hpux_cc_aa = no ; then
{ echo "configure: error: see the INSTALL for more info" 1>&2; exit 1; }
echo "$ac_t""$ac_cv_lbl_cc_hpux_cc_aa" 1>&6
if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then
{ echo "configure: error: see the INSTALL doc for more info" 1>&2; exit 1; }
fi
CFLAGS="$savedcflags"
V_CCOPT="-Aa $V_CCOPT"
@ -940,11 +967,12 @@ EOF
;;
*)
{ echo "configure: error: see the INSTALL for more info" 1>&2; exit 1; }
{ echo "configure: error: see the INSTALL doc for more info" 1>&2; exit 1; }
;;
esac
fi
V_INCLS=-I/usr/local/include
V_INCLS="$V_INCLS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
case "$target_os" in
@ -953,17 +981,17 @@ EOF
;;
osf*)
V_CCOPT="$V_CCOPT -g3"
V_CCOPT="$V_CCOPT -std1 -g3"
;;
ultrix*)
echo $ac_n "checking that Ultrix $CC hacks const in prototypes""... $ac_c" 1>&6
echo "configure:962: checking that Ultrix $CC hacks const in prototypes" >&5
if eval "test \"`echo '$''{'ac_cv_cc_const_proto'+set}'`\" = set"; then
echo "configure:990: checking that Ultrix $CC hacks const in prototypes" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_cc_const_proto'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 967 "configure"
#line 995 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
@ -971,20 +999,20 @@ struct a { int b; };
void c(const struct a *)
; return 0; }
EOF
if { (eval echo configure:975: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cc_const_proto=yes
ac_cv_lbl_cc_const_proto=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_cc_const_proto=no
ac_cv_lbl_cc_const_proto=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_cc_const_proto" 1>&6
if test $ac_cv_cc_const_proto = no ; then
echo "$ac_t""$ac_cv_lbl_cc_const_proto" 1>&6
if test $ac_cv_lbl_cc_const_proto = no ; then
cat >> confdefs.h <<\EOF
#define const
EOF
@ -996,7 +1024,7 @@ EOF
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1000: checking how to run the C preprocessor" >&5
echo "configure:1028: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -1011,13 +1039,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 1015 "configure"
#line 1043 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1049: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@ -1028,13 +1056,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1032 "configure"
#line 1060 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@ -1060,17 +1088,17 @@ for ac_hdr in malloc.h sys/ioccom.h sys/sockio.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1064: checking for $ac_hdr" >&5
echo "configure:1092: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1069 "configure"
#line 1097 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1074: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1102: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1097,14 +1125,14 @@ fi
done
if test $ac_cv_prog_gcc = yes ; then
echo $ac_n "checking if fixincludes is needed""... $ac_c" 1>&6
echo "configure:1103: checking if fixincludes is needed" >&5
if eval "test \"`echo '$''{'ac_cv_gcc_fixincludes'+set}'`\" = set"; then
if test "$GCC" = yes ; then
echo $ac_n "checking for ANSI ioctl definitions""... $ac_c" 1>&6
echo "configure:1131: checking for ANSI ioctl definitions" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_gcc_fixincludes'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1108 "configure"
#line 1136 "configure"
#include "confdefs.h"
/*
* This generates a "duplicate case value" when fixincludes
@ -1123,22 +1151,22 @@ switch (0) {
}
; return 0; }
EOF
if { (eval echo configure:1127: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_gcc_fixincludes=yes
ac_cv_lbl_gcc_fixincludes=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_gcc_fixincludes=no
ac_cv_lbl_gcc_fixincludes=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_gcc_fixincludes" 1>&6
if test $ac_cv_gcc_fixincludes = no ; then
echo "$ac_t""$ac_cv_lbl_gcc_fixincludes" 1>&6
if test $ac_cv_lbl_gcc_fixincludes = no ; then
# Don't cache failure
unset ac_cv_gcc_fixincludes
unset ac_cv_lbl_gcc_fixincludes
{ echo "configure: error: see the INSTALL for more info" 1>&2; exit 1; }
fi
fi
@ -1146,12 +1174,12 @@ fi
for ac_func in ether_hostton strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1150: checking for $ac_func" >&5
echo "configure:1178: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1155 "configure"
#line 1183 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1174,7 +1202,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1199,9 +1227,17 @@ fi
done
# Check whether --with-pcap or --without-pcap was given.
if test "${with_pcap+set}" = set; then
withval="$with_pcap"
:
fi
echo $ac_n "checking packet capture type""... $ac_c" 1>&6
echo "configure:1204: checking packet capture type" >&5
if test -r /dev/bpf0 ; then
echo "configure:1238: checking packet capture type" >&5
if test ! -z "$with_pcap" ; then
V_PCAP="$withval"
elif test -r /dev/bpf0 ; then
V_PCAP=bpf
elif test -r /usr/include/net/pfilt.h ; then
V_PCAP=pf
@ -1230,27 +1266,22 @@ echo "$ac_t""$V_PCAP" 1>&6
case "$V_PCAP" in
null)
echo "configure: warning: cannot determine packet capture interface" 1>&2
echo "configure: warning: (see INSTALL for more info)" 1>&2
;;
dlpi)
for ac_hdr in sys/bufmod.h sys/dlpi_ext.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1244: checking for $ac_hdr" >&5
echo "configure:1275: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1249 "configure"
#line 1280 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1254: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1277,7 +1308,7 @@ fi
done
echo $ac_n "checking for /dev/dlpi device""... $ac_c" 1>&6
echo "configure:1281: checking for /dev/dlpi device" >&5
echo "configure:1312: checking for /dev/dlpi device" >&5
if test -c /dev/dlpi ; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
@ -1288,7 +1319,7 @@ EOF
echo "$ac_t""no" 1>&6
dir="/dev/dlpi"
echo $ac_n "checking for $dir directory""... $ac_c" 1>&6
echo "configure:1292: checking for $dir directory" >&5
echo "configure:1323: checking for $dir directory" >&5
if test -d $dir ; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<EOF
@ -1300,14 +1331,91 @@ EOF
fi
fi
;;
linux)
for ac_hdr in net/if_arp.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1341: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1346 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1351: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
echo $ac_n "checking Linux kernel version""... $ac_c" 1>&6
echo "configure:1378: checking Linux kernel version" >&5
if eval "test \"`echo '$''{'ac_cv_linux_vers'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_linux_vers=`uname -r 2>&1 | \
sed -n -e '$s/.* //' -e '$s/\..*//p'`
fi
echo "$ac_t""$ac_cv_linux_vers" 1>&6
if test $ac_cv_linux_vers -lt 2 ; then
{ echo "configure: error: version 2 or higher required; see the INSTALL doc for more info" 1>&2; exit 1; }
fi
;;
null)
echo "configure: warning: cannot determine packet capture interface" 1>&2
echo "configure: warning: (see the INSTALL doc for more info)" 1>&2
;;
esac
for ac_prog in flex
# Check whether --with-flex or --without-flex was given.
if test "${with_flex+set}" = set; then
withval="$with_flex"
:
fi
# Check whether --with-bison or --without-bison was given.
if test "${with_bison+set}" = set; then
withval="$with_bison"
:
fi
if test "$with_flex" = no ; then
V_LEX=lex
else
for ac_prog in flex
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1311: checking for $ac_word" >&5
echo "configure:1419: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_V_LEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1336,33 +1444,37 @@ test -n "$V_LEX" && break
done
test -n "$V_LEX" || V_LEX="lex"
fi
if test "$V_LEX" = flex ; then
# The -V flag was added in 2.4
echo $ac_n "checking for flex 2.4 or higher""... $ac_c" 1>&6
echo "configure:1343: checking for flex 2.4 or higher" >&5
if eval "test \"`echo '$''{'ac_cv_flex_v24'+set}'`\" = set"; then
echo "configure:1452: checking for flex 2.4 or higher" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_flex_v24'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if flex -V >/dev/null 2>&1; then
ac_cv_flex_v24=yes
ac_cv_lbl_flex_v24=yes
else
ac_cv_flex_v24=no
ac_cv_lbl_flex_v24=no
fi
fi
echo "$ac_t""$ac_cv_flex_v24" 1>&6
if test $ac_cv_flex_v24 = no ; then
echo "$ac_t""$ac_cv_lbl_flex_v24" 1>&6
if test $ac_cv_lbl_flex_v24 = no ; then
s="2.4 or higher required"
echo "configure: warning: ignoring obsolete flex executable ($s)" 1>&2
V_LEX=lex
fi
fi
for ac_prog in bison
if test "$with_bison" = no ; then
V_YACC=yacc
else
for ac_prog in bison
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1366: checking for $ac_word" >&5
echo "configure:1478: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_V_YACC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1391,6 +1503,7 @@ test -n "$V_YACC" && break
done
test -n "$V_YACC" || V_YACC="yacc"
fi
if test "$V_YACC" = bison ; then
V_YACC="$V_YACC -y"
fi
@ -1420,21 +1533,34 @@ EOF
;;
hpux10.0*)
;;
hpux10.1*)
;;
hpux*)
cat >> confdefs.h <<\EOF
#define HAVE_HPUX10_20 1
EOF
;;
sinix*)
echo $ac_n "checking if SINIX compiler defines sinix""... $ac_c" 1>&6
echo "configure:1426: checking if SINIX compiler defines sinix" >&5
echo "configure:1552: checking if SINIX compiler defines sinix" >&5
if eval "test \"`echo '$''{'ac_cv_cc_sinix_defined'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1431 "configure"
#line 1557 "configure"
#include "confdefs.h"
int main() {
int i = sinix;
; return 0; }
EOF
if { (eval echo configure:1438: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1564: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cc_sinix_defined=yes
else
@ -1472,7 +1598,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1476: checking for $ac_word" >&5
echo "configure:1602: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_V_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1506,15 +1632,27 @@ rm -f os-proto.h
if test "${LBL_CFLAGS+set}" = set; then
V_CCOPT="$V_CCOPT ${LBL_CFLAGS}"
fi
if test $ac_cv_prog_gcc = yes -a -f .devel ; then
if test "${LBL_CFLAGS+set}" != set; then
if test "$ac_cv_prog_cc_g" = yes ; then
V_CCOPT="-g $V_CCOPT"
fi
V_CCOPT="$V_CCOPT -Wall"
if test $ac_cv_gcc_vers -gt 1 ; then
V_CCOPT="$V_CCOPT -Wmissing-prototypes -Wstrict-prototypes"
if test -f .devel ; then
if test "$GCC" = yes ; then
if test "${LBL_CFLAGS+set}" != set; then
if test "$ac_cv_prog_cc_g" = yes ; then
V_CCOPT="-g $V_CCOPT"
fi
V_CCOPT="$V_CCOPT -Wall"
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
V_CCOPT="$V_CCOPT -Wmissing-prototypes -Wstrict-prototypes"
fi
fi
else
case "$target_os" in
irix6*)
V_CCOPT="$V_CCOPT -n32"
;;
*)
;;
esac
fi
os=`echo $target_os | sed -e 's/\([0-9][0-9]*\)[^0-9].*$/\1/'`
name="lbl/os-$os.h"
@ -1530,12 +1668,12 @@ EOF
fi
echo $ac_n "checking if sockaddr struct has sa_len member""... $ac_c" 1>&6
echo "configure:1534: checking if sockaddr struct has sa_len member" >&5
if eval "test \"`echo '$''{'ac_cv_sockaddr_has_sa_len'+set}'`\" = set"; then
echo "configure:1672: checking if sockaddr struct has sa_len member" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_sockaddr_has_sa_len'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1539 "configure"
#line 1677 "configure"
#include "confdefs.h"
# include <sys/types.h>
@ -1544,20 +1682,20 @@ int main() {
u_int i = sizeof(((struct sockaddr *)0)->sa_len)
; return 0; }
EOF
if { (eval echo configure:1548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1686: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_sockaddr_has_sa_len=yes
ac_cv_lbl_sockaddr_has_sa_len=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_sockaddr_has_sa_len=no
ac_cv_lbl_sockaddr_has_sa_len=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_sockaddr_has_sa_len" 1>&6
if test $ac_cv_sockaddr_has_sa_len = yes ; then
echo "$ac_t""$ac_cv_lbl_sockaddr_has_sa_len" 1>&6
if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then
cat >> confdefs.h <<\EOF
#define HAVE_SOCKADDR_SA_LEN 1
EOF
@ -1565,14 +1703,14 @@ EOF
fi
echo $ac_n "checking if unaligned accesses fail""... $ac_c" 1>&6
echo "configure:1569: checking if unaligned accesses fail" >&5
if eval "test \"`echo '$''{'ac_cv_unaligned_fail'+set}'`\" = set"; then
echo "configure:1707: checking if unaligned accesses fail" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_unaligned_fail'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
case "$target_cpu" in
alpha|hp*|mips|sparc)
ac_cv_unaligned_fail=yes
ac_cv_lbl_unaligned_fail=yes
;;
*)
@ -1605,13 +1743,13 @@ EOF
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
conftest.c $LIBS >/dev/null 2>&1
if test ! -x conftest ; then
ac_cv_unaligned_fail=yes
ac_cv_lbl_unaligned_fail=yes
else
./conftest >conftest.out
if test ! -s conftest.out ; then
ac_cv_unaligned_fail=yes
ac_cv_lbl_unaligned_fail=yes
else
ac_cv_unaligned_fail=no
ac_cv_lbl_unaligned_fail=no
fi
fi
rm -f conftest* core core.conftest
@ -1619,23 +1757,29 @@ EOF
esac
fi
echo "$ac_t""$ac_cv_unaligned_fail" 1>&6
if test $ac_cv_unaligned_fail = yes ; then
echo "$ac_t""$ac_cv_lbl_unaligned_fail" 1>&6
if test $ac_cv_lbl_unaligned_fail = yes ; then
cat >> confdefs.h <<\EOF
#define LBL_ALIGN 1
EOF
fi
if test -r lbl/gnuc.h ; then
if test "${srcdir}" = "." ; then
srcdirprefix=""
else
srcdirprefix="./"
fi
if test -r ${srcdirprefix}lbl/gnuc.h ; then
rm -f gnuc.h
ln -s lbl/gnuc.h gnuc.h
ln -s ${srcdirprefix}lbl/gnuc.h gnuc.h
fi
rm -f bpf_filter.c
ln -s bpf/net/bpf_filter.c bpf_filter.c
ln -s ${srcdirprefix}bpf/net/bpf_filter.c bpf_filter.c
rm -f net
ln -s bpf/net net
ln -s ${srcdirprefix}bpf/net net
@ -1655,7 +1799,7 @@ ln -s bpf/net net
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:1659: checking for a BSD compatible install" >&5
echo "configure:1803: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6

View File

@ -1,6 +1,6 @@
dnl @(#) $Header: configure.in,v 1.58 96/11/30 20:05:44 leres Exp $ (LBL)
dnl @(#) $Header: configure.in,v 1.67 97/07/27 22:16:17 leres Exp $ (LBL)
dnl
dnl Copyright (c) 1994, 1995, 1996
dnl Copyright (c) 1994, 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved.
dnl
dnl Process this file with autoconf to produce a configure script.
@ -30,8 +30,11 @@ dnl better way of testing since the device might be protected. So we
dnl check in our normal order using -r and then check the for the /dev
dnl guys again using -c.
dnl
AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE])
AC_MSG_CHECKING(packet capture type)
if test -r /dev/bpf0 ; then
if test ! -z "$with_pcap" ; then
V_PCAP="$withval"
elif test -r /dev/bpf0 ; then
V_PCAP=bpf
elif test -r /usr/include/net/pfilt.h ; then
V_PCAP=pf
@ -60,11 +63,6 @@ AC_MSG_RESULT($V_PCAP)
case "$V_PCAP" in
null)
AC_MSG_WARN(cannot determine packet capture interface)
AC_MSG_WARN((see INSTALL for more info))
;;
dlpi)
AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
AC_MSG_CHECKING(for /dev/dlpi device)
@ -83,6 +81,24 @@ dlpi)
fi
fi
;;
linux)
AC_CHECK_HEADERS(net/if_arp.h)
AC_MSG_CHECKING(Linux kernel version)
AC_CACHE_VAL(ac_cv_linux_vers,
ac_cv_linux_vers=`uname -r 2>&1 | \
sed -n -e '$s/.* //' -e '$s/\..*//p'`)
AC_MSG_RESULT($ac_cv_linux_vers)
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
;;
null)
AC_MSG_WARN(cannot determine packet capture interface)
AC_MSG_WARN((see the INSTALL doc for more info))
;;
esac
AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
@ -98,6 +114,17 @@ hpux9*)
AC_DEFINE(HAVE_HPUX9)
;;
hpux10.0*)
;;
hpux10.1*)
;;
hpux*)
dnl HPUX 10.20 and above is similar to HPUX 9...
AC_DEFINE(HAVE_HPUX10_20)
;;
sinix*)
AC_MSG_CHECKING(if SINIX compiler defines sinix)
AC_CACHE_VAL(ac_cv_cc_sinix_defined,
@ -129,15 +156,21 @@ AC_LBL_SOCKADDR_SA_LEN
AC_LBL_UNALIGNED_ACCESS
if test -r lbl/gnuc.h ; then
if test "${srcdir}" = "." ; then
srcdirprefix=""
else
srcdirprefix="./"
fi
if test -r ${srcdirprefix}lbl/gnuc.h ; then
rm -f gnuc.h
ln -s lbl/gnuc.h gnuc.h
ln -s ${srcdirprefix}lbl/gnuc.h gnuc.h
fi
rm -f bpf_filter.c
ln -s bpf/net/bpf_filter.c bpf_filter.c
ln -s ${srcdirprefix}bpf/net/bpf_filter.c bpf_filter.c
rm -f net
ln -s bpf/net net
ln -s ${srcdirprefix}bpf/net net
AC_SUBST(V_CCOPT)
AC_SUBST(V_INCLS)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 1995, 1996
* 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
@ -33,7 +33,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: inet.c,v 1.20 96/10/19 14:58:47 leres Exp $ (LBL)";
"@(#) $Header: inet.c,v 1.22 98/01/30 17:29:34 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -72,7 +72,8 @@ struct rtentry;
#ifdef IFF_LOOPBACK
#define ISLOOPBACK(p) ((p)->ifr_flags & IFF_LOOPBACK)
#else
#define ISLOOPBACK(p) (strcmp((p)->ifr_name, "lo0") == 0)
#define ISLOOPBACK(p) ((p)->ifr_name[0] == 'l' && (p)->ifr_name[1] == 'o' && \
(isdigit((p)->ifr_name[2]) || (p)->ifr_name[2] == '\0'))
#endif
/*
@ -99,6 +100,7 @@ pcap_lookupdev(errbuf)
ifc.ifc_len = sizeof ibuf;
ifc.ifc_buf = (caddr_t)ibuf;
memset((char *)ibuf, 0, sizeof(ibuf));
if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 ||
ifc.ifc_len < sizeof(struct ifreq)) {
(void)sprintf(errbuf, "SIOCGIFCONF: %s", pcap_strerror(errno));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1993, 1994, 1995, 1996
* Copyright (c) 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -18,13 +18,13 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: os-solaris2.h,v 1.17 96/11/29 15:17:49 leres Exp $ (LBL)
* @(#) $Header: os-solaris2.h,v 1.18 97/10/01 01:10:22 leres Exp $ (LBL)
*/
/* Prototypes missing in SunOS 5 */
int daemon(int, int);
int dn_expand(u_char *, u_char *, u_char *, u_char *, int);
int dn_skipname(u_char *, u_char *);
int dn_expand(const u_char *, const u_char *, const u_char *, char *, int);
int dn_skipname(const u_char *, const u_char *);
int flock(int, int);
int getdtablesize(void);
int gethostname(char *, int);
@ -37,7 +37,7 @@ struct utmp;
void login(struct utmp *);
#endif
int logout(const char *);
int res_query(char *, int, int, u_char *, int);
int res_query(const char *, int, int, u_char *, int);
int setenv(const char *, const char *, int);
#if defined(_STDIO_H) && defined(HAVE_SETLINEBUF)
int setlinebuf(FILE *);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1993, 1994, 1995, 1996
* Copyright (c) 1993, 1994, 1995, 1996, 1998
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: pcap-bpf.c,v 1.28 96/12/10 23:14:56 leres Exp $ (LBL)";
"@(#) $Header: pcap-bpf.c,v 1.31 98/07/12 13:14:55 leres Exp $ (LBL)";
#endif
#include <sys/param.h> /* optionally get BSD define */
@ -184,6 +184,14 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
sprintf(ebuf, "kernel bpf filter out of date");
goto bad;
}
v = 32768; /* XXX this should be a user-accessible hook */
/* Ignore the return value - this is because the call fails on
* BPF systems that don't have kernel malloc. And if the call
* fails, it's no big deal, we just continue to use the standard
* buffer size.
*/
(void) ioctl(fd, BIOCSBLEN, (caddr_t)&v);
(void)strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) {
sprintf(ebuf, "%s: %s", device, pcap_strerror(errno));
@ -194,6 +202,19 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
sprintf(ebuf, "BIOCGDLT: %s", pcap_strerror(errno));
goto bad;
}
#if _BSDI_VERSION - 0 >= 199510
/* The SLIP and PPP link layer header changed in BSD/OS 2.1 */
switch (v) {
case DLT_SLIP:
v = DLT_SLIP_BSDOS;
break;
case DLT_PPP:
v = DLT_PPP_BSDOS;
break;
}
#endif
p->linktype = v;
/* set timeout */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1993, 1994, 1995, 1996
* Copyright (c) 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -38,7 +38,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: pcap-dlpi.c,v 1.47 96/12/10 23:15:00 leres Exp $ (LBL)";
"@(#) $Header: pcap-dlpi.c,v 1.52 97/10/03 19:47:47 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
@ -310,9 +310,10 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
dlokack(p->fd, "attach", (char *)buf, ebuf) < 0))
goto bad;
/*
** Bind (defer if using HP-UX 9, totally skip if using SINIX)
** Bind (defer if using HP-UX 9 or HP-UX 10.20, totally skip if
** using SINIX)
*/
#if !defined(HAVE_HPUX9) && !defined(sinix)
#if !defined(HAVE_HPUX9) && !defined(HAVE_HPUX10_20) && !defined(sinix)
if (dlbindreq(p->fd, 0, ebuf) < 0 ||
dlbindack(p->fd, (char *)buf, ebuf) < 0)
goto bad;
@ -328,9 +329,10 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
/*
** Try to enable multicast (you would have thought
** promiscuous would be sufficient). Skip if SINIX.
** promiscuous would be sufficient). (Skip if using
** HP-UX or SINIX)
*/
#ifndef sinix
#if !defined(__hpux) && !defined(sinix)
if (dlpromisconreq(p->fd, DL_PROMISC_MULTI, ebuf) < 0 ||
dlokack(p->fd, "promisc_multi", (char *)buf, ebuf) < 0)
fprintf(stderr,
@ -338,11 +340,16 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
#endif
}
/*
** Always try to enable sap (except if SINIX)
** Try to enable sap (when not in promiscuous mode when using
** using HP-UX and never under SINIX)
*/
#ifndef sinix
if (dlpromisconreq(p->fd, DL_PROMISC_SAP, ebuf) < 0 ||
dlokack(p->fd, "promisc_sap", (char *)buf, ebuf) < 0) {
if (
#ifdef __hpux
!promisc &&
#endif
(dlpromisconreq(p->fd, DL_PROMISC_SAP, ebuf) < 0 ||
dlokack(p->fd, "promisc_sap", (char *)buf, ebuf) < 0)) {
/* Not fatal if promisc since the DL_PROMISC_PHYS worked */
if (promisc)
fprintf(stderr,
@ -353,9 +360,10 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
#endif
/*
** Bind (HP-UX 9 must bind after setting promiscuous options)
** HP-UX 9 and HP-UX 10.20 must bind after setting promiscuous
** options)
*/
#ifdef HAVE_HPUX9
#if defined(HAVE_HPUX9) || defined(HAVE_HPUX10_20)
if (dlbindreq(p->fd, 0, ebuf) < 0 ||
dlbindack(p->fd, (char *)buf, ebuf) < 0)
goto bad;
@ -379,6 +387,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
case DL_FDDI:
p->linktype = DLT_FDDI;
p->offset = 3;
break;
default:
@ -822,7 +831,7 @@ dlpi_kread(register int fd, register off_t addr,
{
register int cc;
if (lseek(fd, addr, L_SET) < 0) {
if (lseek(fd, addr, SEEK_SET) < 0) {
sprintf(ebuf, "lseek: %s", pcap_strerror(errno));
return (-1);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996
* Copyright (c) 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: pcap-linux.c,v 1.4 96/12/10 23:15:00 leres Exp $ (LBL)";
"@(#) $Header: pcap-linux.c,v 1.15 97/10/02 22:39:37 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -29,10 +29,17 @@ static const char rcsid[] =
#include <sys/time.h>
#include <net/if.h>
#ifdef HAVE_NET_IF_ARP_H
#include <net/if_arp.h>
#else
#include <linux/if_arp.h>
#endif
#include <linux/if_ether.h>
#include <netinet/in.h>
#include <errno.h>
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -67,12 +74,12 @@ pcap_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
struct sockaddr from;
int fromlen;
bp = (char *)p->buffer;
bp = p->buffer + p->offset;
bufsize = p->bufsize;
if (p->md.pad > 0) {
memset(bp, 0, p->md.pad);
bp += p->md.pad;
bufsize -= p->md.pad;
memset(p->buffer, 0, p->md.pad);
}
again:
@ -96,7 +103,7 @@ pcap_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
/* If we need have leading zero bytes, adjust count */
cc += p->md.pad;
bp = p->buffer;
bp = p->buffer + p->offset;
/* If we need to step over leading junk, adjust count and pointer */
cc -= p->md.skip;
@ -136,46 +143,131 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
register int fd, broadcast;
register pcap_t *p;
struct ifreq ifr;
struct sockaddr sa;
p = (pcap_t *)malloc(sizeof(*p));
if (p == NULL) {
sprintf(ebuf, "malloc: %s", pcap_strerror(errno));
return (NULL);
}
memset((char *)p, 0, sizeof(*p));
memset(p, 0, sizeof(*p));
fd = -1;
/* XXX hack - map device name to link layer type */
broadcast = 0;
if (strncmp("eth", device, 3) == 0) {
p->linktype = DLT_EN10MB;
++broadcast;
} else if (strncmp("sl", device, 2) == 0) {
p->linktype = DLT_SLIP;
p->md.pad = 16;
} else if (strncmp("ppp", device, 3) == 0) {
p->linktype = DLT_PPP;
p->md.pad = 4;
} else if (strncmp("lo", device, 2) == 0) {
p->linktype = DLT_NULL;
p->md.pad = 2;
p->md.skip = 12;
} else {
sprintf(ebuf, "linux: unknown physical layer type");
goto bad;
}
/* Linux is full of magic numbers */
fd = socket(PF_INET, SOCK_PACKET, htons(0x0003));
fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL));
if (fd < 0) {
sprintf(ebuf, "linux socket: %s", pcap_strerror(errno));
sprintf(ebuf, "socket: %s", pcap_strerror(errno));
goto bad;
}
p->fd = fd;
/* Bind to the interface name */
memset(&sa, 0, sizeof(sa));
sa.sa_family = AF_INET;
(void)strncpy(sa.sa_data, device, sizeof(sa.sa_data));
if (bind(p->fd, &sa, sizeof(sa))) {
sprintf(ebuf, "bind: %s: %s", device, pcap_strerror(errno));
goto bad;
}
p->bufsize = 4096; /* XXX */
p->buffer = (u_char *)malloc(p->bufsize);
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
if (ioctl(p->fd, SIOCGIFHWADDR, &ifr) < 0 ) {
sprintf(ebuf, "SIOCGIFHWADDR: %s", pcap_strerror(errno));
goto bad;
}
broadcast = 0;
switch (ifr.ifr_hwaddr.sa_family) {
case ARPHRD_ETHER:
case ARPHRD_METRICOM:
p->linktype = DLT_EN10MB;
p->offset = 2;
++broadcast;
break;
case ARPHRD_EETHER:
p->linktype = DLT_EN3MB;
++broadcast;
break;
case ARPHRD_AX25:
p->linktype = DLT_AX25;
++broadcast;
break;
case ARPHRD_PRONET:
p->linktype = DLT_PRONET;
break;
case ARPHRD_CHAOS:
p->linktype = DLT_CHAOS;
break;
case ARPHRD_IEEE802:
p->linktype = DLT_IEEE802;
++broadcast;
break;
case ARPHRD_ARCNET:
p->linktype = DLT_ARCNET;
++broadcast;
break;
case ARPHRD_SLIP:
case ARPHRD_CSLIP:
case ARPHRD_SLIP6:
case ARPHRD_CSLIP6:
case ARPHRD_PPP:
p->linktype = DLT_RAW;
break;
case ARPHRD_LOOPBACK:
p->linktype = DLT_NULL;
p->md.pad = 2;
p->md.skip = 12;
break;
#ifdef ARPHRD_FDDI
/* Not all versions of the kernel has this define */
case ARPHRD_FDDI:
p->linktype = DLT_FDDI;
++broadcast;
break;
#endif
#ifdef notdef
case ARPHRD_LOCALTLK:
case ARPHRD_NETROM:
case ARPHRD_APPLETLK:
case ARPHRD_DLCI:
case ARPHRD_RSRVD:
case ARPHRD_ADAPT:
case ARPHRD_TUNNEL:
case ARPHRD_TUNNEL6:
case ARPHRD_FRAD:
case ARPHRD_SKIP:
/* XXX currently do not know what to do with these... */
abort();
#endif
default:
sprintf(ebuf, "unknown physical layer type 0x%x",
ifr.ifr_hwaddr.sa_family);
goto bad;
}
/* Base the buffer size on the interface MTU */
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
if (ioctl(p->fd, SIOCGIFMTU, &ifr) < 0 ) {
sprintf(ebuf, "SIOCGIFMTU: %s", pcap_strerror(errno));
goto bad;
}
/* Leave room for link header (which is never large under linux...) */
p->bufsize = ifr.ifr_mtu + 64;
p->buffer = (u_char *)malloc(p->bufsize + p->offset);
if (p->buffer == NULL) {
sprintf(ebuf, "malloc: %s", pcap_strerror(errno));
goto bad;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1993, 1994, 1995, 1996
* Copyright (c) 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: pcap-snoop.c,v 1.17 96/12/10 23:15:02 leres Exp $ (LBL)";
"@(#) $Header: pcap-snoop.c,v 1.20 97/04/08 21:06:17 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -167,14 +167,25 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
/*
* XXX hack - map device name to link layer type
*/
if (strncmp("et", device, 2) == 0 ||
strncmp("ec", device, 2) == 0) {
if (strncmp("et", device, 2) == 0 || /* Challenge 10 Mbit */
strncmp("ec", device, 2) == 0 || /* Indigo/Indy 10 Mbit,
O2 10/100 */
strncmp("ef", device, 2) == 0 || /* O200/2000 10/100 Mbit */
strncmp("gfe", device, 3) == 0 || /* GIO 100 Mbit */
strncmp("fxp", device, 3) == 0 || /* Challenge VME Enet */
strncmp("ep", device, 2) == 0 || /* Challenge 8x10 Mbit EPLEX */
strncmp("vfe", device, 3) == 0 || /* Challenge VME 100Mbit */
strncmp("fa", device, 2) == 0 ||
strncmp("qaa", device, 3) == 0) {
p->linktype = DLT_EN10MB;
p->offset = RAW_HDRPAD(sizeof(struct ether_header));
} else if (strncmp("ipg", device, 3) == 0 ||
strncmp("rns", device, 3) == 0 || /* O2/200/2000 FDDI */
strncmp("xpi", device, 3) == 0) {
p->linktype = DLT_FDDI;
p->offset = 3; /* XXX yeah? */
} else if (strncmp("ppp", device, 3) == 0) {
p->linktype = DLT_RAW;
} else if (strncmp("lo", device, 2) == 0) {
p->linktype = DLT_NULL;
} else {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1993, 1994, 1995, 1996
* Copyright (c) 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
@ -33,7 +33,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: pcap.c,v 1.27 96/11/27 18:43:25 leres Exp $ (LBL)";
"@(#) $Header: pcap.c,v 1.29 98/07/12 13:15:39 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
@ -53,22 +53,29 @@ static const char rcsid[] =
int
pcap_dispatch(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
{
register int cc;
if (p->sf.rfile != NULL)
return (pcap_offline_read(p, cnt, callback, user));
/* XXX keep reading until we get something (or an error occurs) */
do {
cc = pcap_read(p, cnt, callback, user);
} while (cc == 0);
return (cc);
return (pcap_read(p, cnt, callback, user));
}
int
pcap_loop(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
{
register int n;
for (;;) {
int n = pcap_dispatch(p, cnt, callback, user);
if (p->sf.rfile != NULL)
n = pcap_offline_read(p, cnt, callback, user);
else {
/*
* XXX keep reading until we get something
* (or an error occurs)
*/
do {
n = pcap_read(p, cnt, callback, user);
} while (n == 0);
}
if (n <= 0)
return (n);
if (cnt > 0) {

50
contrib/libpcap/ppp.h Normal file
View File

@ -0,0 +1,50 @@
/* @(#) $Header: ppp.h,v 1.7 95/05/04 17:52:46 mccanne Exp $ (LBL) */
/*
* Point to Point Protocol (PPP) RFC1331
*
* Copyright 1989 by Carnegie Mellon.
*
* Permission to use, copy, modify, and distribute this program for any
* purpose and without fee is hereby granted, provided that this copyright
* and permission notice appear on all copies and supporting documentation,
* the name of Carnegie Mellon not be used in advertising or publicity
* pertaining to distribution of the program without specific prior
* permission, and notice be given in supporting documentation that copying
* and distribution is by permission of Carnegie Mellon and Stanford
* University. Carnegie Mellon makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#define PPP_ADDRESS 0xff /* The address byte value */
#define PPP_CONTROL 0x03 /* The control byte value */
/* Protocol numbers */
#define PPP_IP 0x0021 /* Raw IP */
#define PPP_OSI 0x0023 /* OSI Network Layer */
#define PPP_NS 0x0025 /* Xerox NS IDP */
#define PPP_DECNET 0x0027 /* DECnet Phase IV */
#define PPP_APPLE 0x0029 /* Appletalk */
#define PPP_IPX 0x002b /* Novell IPX */
#define PPP_VJC 0x002d /* Van Jacobson Compressed TCP/IP */
#define PPP_VJNC 0x002f /* Van Jacobson Uncompressed TCP/IP */
#define PPP_BRPDU 0x0031 /* Bridging PDU */
#define PPP_STII 0x0033 /* Stream Protocol (ST-II) */
#define PPP_VINES 0x0035 /* Banyan Vines */
#define PPP_HELLO 0x0201 /* 802.1d Hello Packets */
#define PPP_LUXCOM 0x0231 /* Luxcom */
#define PPP_SNS 0x0233 /* Sigma Network Systems */
#define PPP_IPCP 0x8021 /* IP Control Protocol */
#define PPP_OSICP 0x8023 /* OSI Network Layer Control Protocol */
#define PPP_NSCP 0x8025 /* Xerox NS IDP Control Protocol */
#define PPP_DECNETCP 0x8027 /* DECnet Control Protocol */
#define PPP_APPLECP 0x8029 /* Appletalk Control Protocol */
#define PPP_IPXCP 0x802b /* Novell IPX Control Protocol */
#define PPP_STIICP 0x8033 /* Strean Protocol Control Protocol */
#define PPP_VINESCP 0x8035 /* Banyan Vines Control Protocol */
#define PPP_LCP 0xc021 /* Link Control Protocol */
#define PPP_PAP 0xc023 /* Password Authentication Protocol */
#define PPP_LQM 0xc025 /* Link Quality Monitoring */
#define PPP_CHAP 0xc223 /* Challenge Handshake Authentication Protocol */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1993, 1994, 1995, 1996
* Copyright (c) 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -30,7 +30,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: savefile.c,v 1.36 96/12/10 23:15:02 leres Exp $ (LBL)";
"@(#) $Header: savefile.c,v 1.37 97/10/15 21:58:58 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
@ -103,7 +103,7 @@ swap_hdr(struct pcap_file_header *hp)
}
pcap_t *
pcap_open_offline(char *fname, char *errbuf)
pcap_open_offline(const char *fname, char *errbuf)
{
register pcap_t *p;
register FILE *fp;
@ -322,7 +322,7 @@ pcap_dump(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
* Initialize so that sf_write() will output to the file named 'fname'.
*/
pcap_dumper_t *
pcap_dump_open(pcap_t *p, char *fname)
pcap_dump_open(pcap_t *p, const char *fname)
{
FILE *f;
if (fname[0] == '-' && fname[1] == '\0')