Virgin import of LBL libpcap v0.4

This commit is contained in:
Bill Fenner 1998-09-15 19:28:10 +00:00
parent 3052b2361a
commit a4b5b39fce
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/libpcap/dist/; revision=39291
25 changed files with 1147 additions and 386 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,6 +1,6 @@
dnl @(#) $Header: aclocal.m4,v 1.32 96/07/23 22:55:48 leres Exp $ (LBL)
dnl @(#) $Header: aclocal.m4,v 1.63 98/06/12 03:44:50 leres Exp $ (LBL)
dnl
dnl Copyright (c) 1995, 1996
dnl Copyright (c) 1995, 1996, 1997, 1998
dnl The Regents of the University of California. All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
@ -38,11 +38,24 @@ dnl
dnl $1 (copt set)
dnl $2 (incls set)
dnl CC
dnl ac_cv_gcc_vers
dnl LDFLAGS
dnl ac_cv_lbl_gcc_vers
dnl LBL_CFLAGS
dnl
AC_DEFUN(AC_LBL_C_INIT,
[$1=-O
[AC_PREREQ(2.12)
AC_BEFORE([$0], [AC_PROG_CC])
AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
AC_BEFORE([$0], [AC_LBL_DEVEL])
AC_ARG_WITH(gcc, [ --without-gcc don't use gcc])
$1="-O"
$2=""
if test "${srcdir}" != "." ; then
$2="-I\$\(srcdir\)"
fi
if test "${CFLAGS+set}" = set; then
LBL_CFLAGS="$CFLAGS"
fi
if test -z "$CC" ; then
case "$target_os" in
@ -55,76 +68,66 @@ AC_DEFUN(AC_LBL_C_INIT,
;;
esac
fi
if test -z "$CC" -a "$with_gcc" = no ; then
CC=cc
export CC
fi
AC_PROG_CC
if test $ac_cv_prog_gcc = yes ; then
if test "$GCC" = yes ; then
if test "$SHLICC2" = yes ; then
ac_cv_gcc_vers=2
$1=-O2
ac_cv_lbl_gcc_vers=2
$1="-O2"
else
AC_MSG_CHECKING(gcc version)
AC_CACHE_VAL(ac_cv_gcc_vers,
ac_cv_gcc_vers=`$CC -v 2>&1 | \
sed -n -e '$s/.* //' -e '$s/\..*//p'`)
AC_MSG_RESULT($ac_cv_gcc_vers)
if test $ac_cv_gcc_vers -gt 1 ; then
$1=-O2
AC_CACHE_VAL(ac_cv_lbl_gcc_vers,
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/\..*//'`)
AC_MSG_RESULT($ac_cv_lbl_gcc_vers)
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
$1="-O2"
fi
fi
else
AC_MSG_CHECKING(that $CC handles ansi prototypes)
AC_CACHE_VAL(ac_cv_cc_ansi_prototypes,
AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes,
AC_TRY_COMPILE(
[#include <sys/types.h>],
[int frob(int, char *)],
ac_cv_cc_ansi_prototypes=yes,
ac_cv_cc_ansi_prototypes=no))
AC_MSG_RESULT($ac_cv_cc_ansi_prototypes)
if test $ac_cv_cc_ansi_prototypes = no ; then
ac_cv_lbl_cc_ansi_prototypes=yes,
ac_cv_lbl_cc_ansi_prototypes=no))
AC_MSG_RESULT($ac_cv_lbl_cc_ansi_prototypes)
if test $ac_cv_lbl_cc_ansi_prototypes = no ; then
case "$target_os" in
hpux*)
AC_MSG_CHECKING(for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE))
savedcflags="$CFLAGS"
CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
AC_CACHE_VAL(ac_cv_cc_hpux_cc_aa,
AC_CACHE_VAL(ac_cv_lbl_cc_hpux_cc_aa,
AC_TRY_COMPILE(
[#include <sys/types.h>],
[int frob(int, char *)],
ac_cv_cc_hpux_cc_aa=yes,
ac_cv_cc_hpux_cc_aa=no))
AC_MSG_RESULT($ac_cv_cc_hpux_cc_aa)
if test $ac_cv_cc_hpux_cc_aa = no ; then
AC_MSG_ERROR(see the INSTALL for more info)
ac_cv_lbl_cc_hpux_cc_aa=yes,
ac_cv_lbl_cc_hpux_cc_aa=no))
AC_MSG_RESULT($ac_cv_lbl_cc_hpux_cc_aa)
if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then
AC_MSG_ERROR(see the INSTALL doc for more info)
fi
CFLAGS="$savedcflags"
V_CCOPT="-Aa $V_CCOPT"
AC_DEFINE(_HPUX_SOURCE)
;;
sni*)
AC_MSG_CHECKING(for SINIX ansi compiler ($CC -kansi))
savedcflags="$CFLAGS"
CFLAGS="-kansi"
AC_CACHE_VAL(ac_cv_cc_sinix_kansi,
AC_TRY_COMPILE(
[#include <sys/types.h>],
[int frob(int, char *)],
ac_cv_cc_sinix_kansi=yes,
ac_cv_cc_sinix_kansi=no))
AC_MSG_RESULT($ac_cv_cc_sinix_kansi)
if test $ac_cv_cc_sinix_kansi = no ; then
AC_MSG_ERROR(see the INSTALL for more info)
fi
CFLAGS="$savedcflags"
V_CCOPT="-kansi $V_CCOPT"
;;
*)
AC_MSG_ERROR(see the INSTALL for more info)
AC_MSG_ERROR(see the INSTALL doc for more info)
;;
esac
fi
$2=-I/usr/local/include
$2="$$2 -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
case "$target_os" in
@ -133,20 +136,20 @@ AC_DEFUN(AC_LBL_C_INIT,
;;
osf*)
V_CCOPT="$V_CCOPT -g3"
V_CCOPT="$V_CCOPT -std1 -g3"
;;
ultrix*)
AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes)
AC_CACHE_VAL(ac_cv_cc_const_proto,
AC_CACHE_VAL(ac_cv_lbl_cc_const_proto,
AC_TRY_COMPILE(
[#include <sys/types.h>],
[struct a { int b; };
void c(const struct a *)],
ac_cv_cc_const_proto=yes,
ac_cv_cc_const_proto=no))
AC_MSG_RESULT($ac_cv_cc_const_proto)
if test $ac_cv_cc_const_proto = no ; then
ac_cv_lbl_cc_const_proto=yes,
ac_cv_lbl_cc_const_proto=no))
AC_MSG_RESULT($ac_cv_lbl_cc_const_proto)
if test $ac_cv_lbl_cc_const_proto = no ; then
AC_DEFINE(const,)
fi
;;
@ -169,9 +172,15 @@ dnl
dnl $1 (pcapdep set)
dnl $2 (incls appended)
dnl LIBS
dnl LBL_LIBS
dnl
AC_DEFUN(AC_LBL_LIBPCAP,
[pfopen=/usr/examples/packetfilter/pfopen.c
[AC_REQUIRE([AC_LBL_LIBRARY_NET])
dnl
dnl save a copy before locating libpcap.a
dnl
LBL_LIBS="$LIBS"
pfopen=/usr/examples/packetfilter/pfopen.c
if test -f $pfopen ; then
AC_CHECK_FUNCS(pfopen)
if test $ac_cv_func_pfopen = "no" ; then
@ -181,9 +190,16 @@ AC_DEFUN(AC_LBL_LIBPCAP,
fi
AC_MSG_CHECKING(for local pcap library)
libpcap=FAIL
lastdir=FAIL
places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | \
egrep '/libpcap-[[0-9]]*\.[[0-9]]*(\.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
for dir in ../libpcap $places libpcap ; do
for dir in $places ../libpcap libpcap ; do
basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'`
if test $lastdir = $basedir ; then
dnl skip alphas when an actual release is present
continue;
fi
lastdir=$dir
if test -r $dir/pcap.c ; then
libpcap=$dir/libpcap.a
d=$dir
@ -201,7 +217,18 @@ AC_DEFUN(AC_LBL_LIBPCAP,
$2="-I$d $$2"
AC_MSG_RESULT($libpcap)
fi
LIBS="$libpcap $LIBS"])
LIBS="$libpcap $LIBS"
case "$target_os" in
aix*)
pseexe="/lib/pse.exp"
AC_MSG_CHECKING(for $pseexe)
if test -f $pseexe ; then
AC_MSG_RESULT(yes)
LIBS="$LIBS -I:$pseexe"
fi
;;
esac])
dnl
dnl Define RETSIGTYPE and RETSIGVAL
@ -216,7 +243,8 @@ dnl RETSIGTYPE (defined)
dnl RETSIGVAL (defined)
dnl
AC_DEFUN(AC_LBL_TYPE_SIGNAL,
[AC_TYPE_SIGNAL
[AC_BEFORE([$0], [AC_LBL_LIBPCAP])
AC_TYPE_SIGNAL
if test "$ac_cv_type_signal" = void ; then
AC_DEFINE(RETSIGVAL,)
else
@ -229,24 +257,25 @@ AC_DEFUN(AC_LBL_TYPE_SIGNAL,
;;
*)
dnl prefer sigset() to sigaction()
AC_CHECK_FUNCS(sigset)
if test $ac_cv_func_sigset = yes ; then
AC_DEFINE(signal, sigset)
if test $ac_cv_func_sigset = no ; then
AC_CHECK_FUNCS(sigaction)
fi
;;
esac])
dnl
dnl If using gcc, see if fixincludes should be run
dnl If using gcc, make sure we have ANSI ioctl definitions
dnl
dnl usage:
dnl
dnl AC_LBL_FIXINCLUDES
dnl
AC_DEFUN(AC_LBL_FIXINCLUDES,
[if test $ac_cv_prog_gcc = yes ; then
AC_MSG_CHECKING(if fixincludes is needed)
AC_CACHE_VAL(ac_cv_gcc_fixincludes,
[if test "$GCC" = yes ; then
AC_MSG_CHECKING(for ANSI ioctl definitions)
AC_CACHE_VAL(ac_cv_lbl_gcc_fixincludes,
AC_TRY_COMPILE(
[/*
* This generates a "duplicate case value" when fixincludes
@ -262,12 +291,12 @@ AC_DEFUN(AC_LBL_FIXINCLUDES,
case _IO('A', 1):;
case _IO('B', 1):;
}],
ac_cv_gcc_fixincludes=yes,
ac_cv_gcc_fixincludes=no))
AC_MSG_RESULT($ac_cv_gcc_fixincludes)
if test $ac_cv_gcc_fixincludes = no ; then
ac_cv_lbl_gcc_fixincludes=yes,
ac_cv_lbl_gcc_fixincludes=no))
AC_MSG_RESULT($ac_cv_lbl_gcc_fixincludes)
if test $ac_cv_lbl_gcc_fixincludes = no ; then
# Don't cache failure
unset ac_cv_gcc_fixincludes
unset ac_cv_lbl_gcc_fixincludes
AC_MSG_ERROR(see the INSTALL for more info)
fi
fi])
@ -290,24 +319,34 @@ dnl $2 (yacc appended)
dnl $3 (optional flex and bison -P prefix)
dnl
AC_DEFUN(AC_LBL_LEX_AND_YACC,
[AC_CHECK_PROGS($1, flex, lex)
[AC_ARG_WITH(flex, [ --without-flex don't use flex])
AC_ARG_WITH(bison, [ --without-bison don't use bison])
if test "$with_flex" = no ; then
$1=lex
else
AC_CHECK_PROGS($1, flex, lex)
fi
if test "$$1" = flex ; then
# The -V flag was added in 2.4
AC_MSG_CHECKING(for flex 2.4 or higher)
AC_CACHE_VAL(ac_cv_flex_v24,
AC_CACHE_VAL(ac_cv_lbl_flex_v24,
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)
AC_MSG_RESULT($ac_cv_flex_v24)
if test $ac_cv_flex_v24 = no ; then
AC_MSG_RESULT($ac_cv_lbl_flex_v24)
if test $ac_cv_lbl_flex_v24 = no ; then
s="2.4 or higher required"
AC_MSG_WARN(ignoring obsolete flex executable ($s))
$1=lex
fi
fi
AC_CHECK_PROGS($2, bison, yacc)
if test "$with_bison" = no ; then
$2=yacc
else
AC_CHECK_PROGS($2, bison, yacc)
fi
if test "$$2" = bison ; then
$2="$$2 -y"
fi
@ -334,17 +373,17 @@ dnl DECLWAITSTATUS (defined)
dnl
AC_DEFUN(AC_LBL_UNION_WAIT,
[AC_MSG_CHECKING(if union wait is used)
AC_CACHE_VAL(ac_cv_union_wait,
AC_CACHE_VAL(ac_cv_lbl_union_wait,
AC_TRY_COMPILE([
# include <sys/types.h>
# include <sys/wait.h>],
# include <sys/types.h>
# include <sys/wait.h>],
[int status;
u_int i = WEXITSTATUS(status);
u_int j = waitpid(0, &status, 0);],
ac_cv_union_wait=no,
ac_cv_union_wait=yes))
AC_MSG_RESULT($ac_cv_union_wait)
if test $ac_cv_union_wait = yes ; then
ac_cv_lbl_union_wait=no,
ac_cv_lbl_union_wait=yes))
AC_MSG_RESULT($ac_cv_lbl_union_wait)
if test $ac_cv_lbl_union_wait = yes ; then
AC_DEFINE(DECLWAITSTATUS,union wait)
else
AC_DEFINE(DECLWAITSTATUS,int)
@ -363,15 +402,15 @@ dnl HAVE_SOCKADDR_SA_LEN (defined)
dnl
AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
[AC_MSG_CHECKING(if sockaddr struct has sa_len member)
AC_CACHE_VAL(ac_cv_sockaddr_has_sa_len,
AC_CACHE_VAL(ac_cv_lbl_sockaddr_has_sa_len,
AC_TRY_COMPILE([
# include <sys/types.h>
# include <sys/socket.h>],
[u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
ac_cv_sockaddr_has_sa_len=yes,
ac_cv_sockaddr_has_sa_len=no))
AC_MSG_RESULT($ac_cv_sockaddr_has_sa_len)
if test $ac_cv_sockaddr_has_sa_len = yes ; then
ac_cv_lbl_sockaddr_has_sa_len=yes,
ac_cv_lbl_sockaddr_has_sa_len=no))
AC_MSG_RESULT($ac_cv_lbl_sockaddr_has_sa_len)
if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then
AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
fi])
@ -384,22 +423,52 @@ dnl AC_LBL_HAVE_RUN_PATH
dnl
dnl results:
dnl
dnl ac_cv_have_run_path (yes or no)
dnl ac_cv_lbl_have_run_path (yes or no)
dnl
AC_DEFUN(AC_LBL_HAVE_RUN_PATH,
[AC_MSG_CHECKING(for ${CC-cc} -R)
AC_CACHE_VAL(ac_cv_have_run_path,
AC_CACHE_VAL(ac_cv_lbl_have_run_path,
[echo 'main(){}' > conftest.c
${CC-cc} -o conftest conftest.c -R/a1/b2/c3 >conftest.out 2>&1
if test ! -s conftest.out ; then
ac_cv_have_run_path=yes
ac_cv_lbl_have_run_path=yes
else
ac_cv_have_run_path=no
ac_cv_lbl_have_run_path=no
fi
rm -f conftest*])
AC_MSG_RESULT($ac_cv_have_run_path)
AC_MSG_RESULT($ac_cv_lbl_have_run_path)
])
dnl
dnl Due to the stupid way it's implemented, AC_CHECK_TYPE is nearly useless.
dnl
dnl usage:
dnl
dnl AC_LBL_CHECK_TYPE
dnl
dnl results:
dnl
dnl int32_t (defined)
dnl u_int32_t (defined)
dnl
AC_DEFUN(AC_LBL_CHECK_TYPE,
[AC_MSG_CHECKING(for $1 using $CC)
AC_CACHE_VAL(ac_cv_lbl_have_$1,
AC_TRY_COMPILE([
# include "confdefs.h"
# include <sys/types.h>
# if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
# endif],
[$1 i],
ac_cv_lbl_have_$1=yes,
ac_cv_lbl_have_$1=no))
AC_MSG_RESULT($ac_cv_lbl_have_$1)
if test $ac_cv_lbl_have_$1 = no ; then
AC_DEFINE($1, $2)
fi])
dnl
dnl Checks to see if unaligned memory accesses fail
dnl
@ -413,11 +482,11 @@ dnl LBL_ALIGN (DEFINED)
dnl
AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
[AC_MSG_CHECKING(if unaligned accesses fail)
AC_CACHE_VAL(ac_cv_unaligned_fail,
AC_CACHE_VAL(ac_cv_lbl_unaligned_fail,
[case "$target_cpu" in
alpha|hp*|mips|sparc)
ac_cv_unaligned_fail=yes
ac_cv_lbl_unaligned_fail=yes
;;
*)
@ -442,7 +511,7 @@ AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
exit(!WIFEXITED(status));
}
/* child */
i = *(unsigned int *)&a[1];
i = *(unsigned int *)&a[[1]];
printf("%d\n", i);
exit(0);
}
@ -451,20 +520,20 @@ EOF
conftest.c $LIBS >/dev/null 2>&1
if test ! -x conftest ; then
dnl failed to compile for some reason
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
;;
esac])
AC_MSG_RESULT($ac_cv_unaligned_fail)
if test $ac_cv_unaligned_fail = yes ; then
AC_MSG_RESULT($ac_cv_lbl_unaligned_fail)
if test $ac_cv_lbl_unaligned_fail = yes ; then
AC_DEFINE(LBL_ALIGN)
fi])
@ -486,15 +555,32 @@ dnl os-proto.h (symlinked)
dnl
AC_DEFUN(AC_LBL_DEVEL,
[rm -f os-proto.h
if test $ac_cv_prog_gcc = yes -a -f .devel ; then
if test $ac_cv_prog_gcc_g = yes ; then
$1="-g $$1"
if test "${LBL_CFLAGS+set}" = set; then
$1="$$1 ${LBL_CFLAGS}"
fi
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
$1="-g $$1"
fi
$1="$$1 -Wall"
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
$1="$$1 -Wmissing-prototypes -Wstrict-prototypes"
fi
fi
else
case "$target_os" in
irix6*)
V_CCOPT="$V_CCOPT -n32"
;;
*)
;;
esac
fi
$1="$$1 -Wall"
if test $ac_cv_gcc_vers -gt 1 ; then
$1="$$1 -Wmissing-prototypes -Wstrict-prototypes"
fi
os=`echo $target_os | sed -e 's/\([[0-9]]\)[[0-9.]][[0-9.]]*$/\1/'`
os=`echo $target_os | sed -e 's/\([[0-9]][[0-9]]*\)[[^0-9]].*$/\1/'`
name="lbl/os-$os.h"
if test -f $name ; then
ln -s $name os-proto.h
@ -503,3 +589,118 @@ AC_DEFUN(AC_LBL_DEVEL,
AC_MSG_WARN(can't find $name)
fi
fi])
dnl
dnl Improved version of AC_CHECK_LIB
dnl
dnl Thanks to John Hawkinson (jhawk@mit.edu)
dnl
dnl usage:
dnl
dnl AC_LBL_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
dnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
dnl
dnl results:
dnl
dnl LIBS
dnl
define(AC_LBL_CHECK_LIB,
[AC_MSG_CHECKING([for $2 in -l$1])
dnl Use a cache variable name containing both the library and function name,
dnl because the test really is for library $1 defining function $2, not
dnl just for library $1. Separate tests with the same $1 and different $2's
dnl may have different results.
ac_lib_var=`echo $1['_']$2['_']$5 | sed 'y%./+- %__p__%'`
AC_CACHE_VAL(ac_cv_lbl_lib_$ac_lib_var,
[ac_save_LIBS="$LIBS"
LIBS="-l$1 $5 $LIBS"
AC_TRY_LINK(dnl
ifelse([$2], [main], , dnl Avoid conflicting decl of main.
[/* Override any gcc2 internal prototype to avoid an error. */
]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
extern "C"
#endif
])dnl
[/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $2();
]),
[$2()],
eval "ac_cv_lbl_lib_$ac_lib_var=yes",
eval "ac_cv_lbl_lib_$ac_lib_var=no")
LIBS="$ac_save_LIBS"
])dnl
if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then
AC_MSG_RESULT(yes)
ifelse([$3], ,
[changequote(, )dnl
ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
changequote([, ])dnl
AC_DEFINE_UNQUOTED($ac_tr_lib)
LIBS="-l$1 $LIBS"
], [$3])
else
AC_MSG_RESULT(no)
ifelse([$4], , , [$4
])dnl
fi
])
dnl
dnl AC_LBL_LIBRARY_NET
dnl
dnl This test is for network applications that need socket() and
dnl gethostbyname() -ish functions. Under Solaris, those applications
dnl need to link with "-lsocket -lnsl". Under IRIX, they need to link
dnl with "-lnsl" but should *not* link with "-lsocket" because
dnl libsocket.a breaks a number of things (for instance:
dnl gethostbyname() under IRIX 5.2, and snoop sockets under most
dnl versions of IRIX).
dnl
dnl Unfortunately, many application developers are not aware of this,
dnl and mistakenly write tests that cause -lsocket to be used under
dnl IRIX. It is also easy to write tests that cause -lnsl to be used
dnl under operating systems where neither are necessary (or useful),
dnl such as SunOS 4.1.4, which uses -lnsl for TLI.
dnl
dnl This test exists so that every application developer does not test
dnl this in a different, and subtly broken fashion.
dnl It has been argued that this test should be broken up into two
dnl seperate tests, one for the resolver libraries, and one for the
dnl libraries necessary for using Sockets API. Unfortunately, the two
dnl are carefully intertwined and allowing the autoconf user to use
dnl them independantly potentially results in unfortunate ordering
dnl dependancies -- as such, such component macros would have to
dnl carefully use indirection and be aware if the other components were
dnl executed. Since other autoconf macros do not go to this trouble,
dnl and almost no applications use sockets without the resolver, this
dnl complexity has not been implemented.
dnl
dnl The check for libresolv is in case you are attempting to link
dnl statically and happen to have a libresolv.a lying around (and no
dnl libnsl.a).
dnl
AC_DEFUN(AC_LBL_LIBRARY_NET, [
# Most operating systems have gethostbyname() in the default searched
# libraries (i.e. libc):
AC_CHECK_FUNC(gethostbyname, ,
# Some OSes (eg. Solaris) place it in libnsl:
AC_LBL_CHECK_LIB(nsl, gethostbyname, ,
# Some strange OSes (SINIX) have it in libsocket:
AC_LBL_CHECK_LIB(socket, gethostbyname, ,
# Unfortunately libsocket sometimes depends on libnsl.
# AC_CHECK_LIB's API is essentially broken so the
# following ugliness is necessary:
AC_LBL_CHECK_LIB(socket, gethostbyname,
LIBS="-lsocket -lnsl $LIBS",
AC_CHECK_LIB(resolv, gethostbyname),
-lnsl))))
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
AC_LBL_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", ,
-lnsl)))
# DLPI needs putmsg under HPUX so test for -lstr while we're at it
AC_CHECK_LIB(str, putmsg)
])

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) 1990, 1991, 1992, 1993, 1994, 1995, 1996
* 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
@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: gencode.c,v 1.91 96/12/11 19:10:23 leres Exp $ (LBL)";
"@(#) $Header: gencode.c,v 1.94 98/07/12 13:06:49 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
@ -50,6 +50,7 @@ struct rtentry;
#include "ethertype.h"
#include "gencode.h"
#include "ppp.h"
#include <pcap-namedb.h>
#include "gnuc.h"
@ -473,6 +474,13 @@ init_linktype(type)
off_nl = 16;
return;
case DLT_SLIP_BSDOS:
/* XXX this may be the same as the DLT_PPP_BSDOS case */
off_linktype = -1;
/* XXX end */
off_nl = 24;
return;
case DLT_NULL:
off_linktype = 0;
off_nl = 4;
@ -483,6 +491,11 @@ init_linktype(type)
off_nl = 4;
return;
case DLT_PPP_BSDOS:
off_linktype = 5;
off_nl = 24;
return;
case DLT_FDDI:
/*
* FDDI doesn't really have a link-level type field.
@ -551,8 +564,10 @@ gen_false()
static struct block *
gen_linktype(proto)
int proto;
register int proto;
{
struct block *b0, *b1;
/* If we're not using encapsulation and checking for IP, we're done */
if (off_linktype == -1 && proto == ETHERTYPE_IP)
return gen_true();
@ -564,13 +579,38 @@ gen_linktype(proto)
case DLT_PPP:
if (proto == ETHERTYPE_IP)
proto = 0x0021; /* XXX - need ppp.h defs */
proto = PPP_IP; /* XXX was 0x21 */
break;
case DLT_PPP_BSDOS:
switch (proto) {
case ETHERTYPE_IP:
b0 = gen_cmp(off_linktype, BPF_H, PPP_IP);
b1 = gen_cmp(off_linktype, BPF_H, PPP_VJC);
gen_or(b0, b1);
b0 = gen_cmp(off_linktype, BPF_H, PPP_VJNC);
gen_or(b1, b0);
return b0;
case ETHERTYPE_DN:
proto = PPP_DECNET;
break;
case ETHERTYPE_ATALK:
proto = PPP_APPLE;
break;
case ETHERTYPE_NS:
proto = PPP_NS;
break;
}
break;
case DLT_NULL:
/* XXX */
if (proto == ETHERTYPE_IP)
return (gen_cmp(0, BPF_W, (bpf_int32)AF_INET));
return (gen_cmp(0, BPF_W, (bpf_int32)htonl(AF_INET)));
else
return gen_false();
}
@ -1333,11 +1373,17 @@ gen_mcode(s1, s2, masklen, q)
mlen = __pcap_atoin(s2, &m);
/* Promote short ipaddr */
m <<= 32 - mlen;
if ((n & ~m) != 0)
bpf_error("non-network bits set in \"%s mask %s\"",
s1, s2);
} else {
/* Convert mask len to mask */
if (masklen > 32)
bpf_error("mask length must be <= 32");
m = 0xffffffff << (32 - masklen);
if ((n & ~m) != 0)
bpf_error("non-network bits set in \"%s/%d\"",
s1, masklen);
}
switch (q.addr) {

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) 1990, 1991, 1992, 1993, 1994, 1995, 1996
* 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
@ -24,12 +24,13 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: nametoaddr.c,v 1.45 96/10/17 23:26:53 leres Exp $ (LBL)";
"@(#) $Header: nametoaddr.c,v 1.48 98/07/12 13:15:36 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
#include <sys/types.h> /* concession to AIX */
#include <sys/socket.h>
#include <sys/time.h>
#if __STDC__
struct mbuf;
@ -344,7 +345,7 @@ pcap_ether_hostton(const char *name)
if (ether_hostton((char *)name, (struct ether_addr *)a) == 0) {
ap = (u_char *)malloc(6);
if (ap != NULL)
memcpy(ap, a, 6);
memcpy((char *)ap, (char *)a, 6);
}
return (ap);
}

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,4 +1,4 @@
.\" Copyright (c) 1994, 1996
.\" Copyright (c) 1994, 1996, 1997
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@ -17,7 +17,7 @@
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.TH PCAP 3 "18 August 1996"
.TH PCAP 3 "24 June 1998"
.SH NAME
pcap \- Packet Capture library
.SH SYNOPSIS
@ -37,9 +37,9 @@ pcap_dumper_t *pcap_dump_open(pcap_t *p, char *fname)
.ft B
char errbuf[PCAP_ERRBUF_SIZE];
char *pcap_lookupdev(char *errbuf)
int pcap_lookupnet(char *device, u_long *netp,
int pcap_lookupnet(char *device, bpf_u_int32 *netp,
.ti +8
u_long *maskp, char *errbuf)
bpf_u_int32 *maskp, char *errbuf)
.ft
.LP
.ft B
@ -57,7 +57,7 @@ u_char *sp)
.ft B
int pcap_compile(pcap_t *p, struct bpf_program *fp,
.ti +8
char *str, int optimize, u_long netmask)
char *str, int optimize, bpf_u_int32 netmask)
int pcap_setfilter(pcap_t *p, struct bpf_program *fp)
.ft
.LP
@ -98,6 +98,10 @@ at packets on the network.
is a string that specifies the network device to open.
.I snaplen
specifies the maximum number of bytes to capture.
.I promisc
specifies if the interface is to be put into promiscuous mode.
(Note that even if this parameter is false, the interface
could well be in promiscuous mode for some other reason.)
.I to_ms
specifies the read timeout in milliseconds.
.I ebuf
@ -163,7 +167,7 @@ Both
and
.I maskp
are
.I u_long
.I bpf_u_int32
pointers.
A return of -1 indicates an error in which case
.I errbuf
@ -176,9 +180,10 @@ specifies the maximum number of packets to process before returning. A
.I cnt
of -1 processes all the packets received in one buffer. A
.I cnt
of 0 processes all packets until an error occurs (or
of 0 processes all packets until an error occurs,
.B EOF
is reached).
is reached, or the read times out (when doing live reads and a non-zero
read timeout is specified).
.I callback
specifies a routine to be called with three arguments:
a
@ -188,7 +193,9 @@ pointer which is passed in from
a pointer to the
.I pcap_pkthdr
struct (which precede the actual network headers and data),
and a length. The number of packets read is returned.
and a
.I u_char
pointer to the packet data. The number of packets read is returned.
Zero is returned when
.B EOF
is reached in a ``savefile.'' A return of -1 indicates
@ -219,12 +226,16 @@ controls whether optimization on the resulting code is performed.
specifies the netmask of the local net.
.PP
.B pcap_setfilter()
is used to specify the a filter program.
is used to specify a filter program.
.I fp
is a pointer to an array of
.I bpf_program
struct, usually the result of a call to
.BR pcap_compile() .
.B \-1
is returned on failure;
.B 0
is returned on success.
.PP
.B pcap_loop()
is similar to
@ -232,6 +243,15 @@ is similar to
except it keeps reading packets until
.I cnt
packets are processed or an error occurs.
It does
.B not
return when live read timeouts occur.
Rather, specifying a non-zero read timeout to
.B pcap_open_live()
and then calling
.B pcap_dispatch()
allows the reception and processing of any packets that arrive when the
timeout occurs.
A negative
.I cnt
causes
@ -261,7 +281,7 @@ returns the major number of the version of the pcap used to write the
savefile.
.PP
.B pcap_minor_version()
returns the major number of the version of the pcap used to write the
returns the minor number of the version of the pcap used to write the
savefile.
.PP
.B pcap_file()

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) {

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 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#) $Header: pcap.h,v 1.20 96/07/12 19:24:15 leres Exp $ (LBL)
* @(#) $Header: pcap.h,v 1.21 97/10/15 21:59:13 leres Exp $ (LBL)
*/
#ifndef lib_pcap_h
@ -102,7 +102,7 @@ typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *,
char *pcap_lookupdev(char *);
int pcap_lookupnet(char *, bpf_u_int32 *, bpf_u_int32 *, char *);
pcap_t *pcap_open_live(char *, int, int, int, char *);
pcap_t *pcap_open_offline(char *, char *);
pcap_t *pcap_open_offline(const char *, char *);
void pcap_close(pcap_t *);
int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
@ -127,7 +127,7 @@ int pcap_minor_version(pcap_t *);
FILE *pcap_file(pcap_t *);
int pcap_fileno(pcap_t *);
pcap_dumper_t *pcap_dump_open(pcap_t *, char *);
pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
void pcap_dump_close(pcap_dumper_t *);
void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);

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')

View File

@ -1,6 +1,6 @@
%{
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 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
@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: scanner.l,v 1.55 96/09/27 22:34:45 leres Exp $ (LBL)";
"@(#) $Header: scanner.l,v 1.56 97/07/21 13:31:50 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
@ -133,14 +133,15 @@ outbound return OUTBOUND;
">>" return RSH;
{N} { yylval.i = stoi((char *)yytext); return NUM; }
({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) {
yylval.s = sdup((char *)yytext); return HID;
}
yylval.s = sdup((char *)yytext); return HID; }
{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext);
return EID; }
{B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); }
[A-Za-z][-_.A-Za-z0-9]* { yylval.s = sdup((char *)yytext); return ID; }
[A-Za-z0-9][-_.A-Za-z0-9]*[.A-Za-z0-9] {
yylval.s = sdup((char *)yytext); return ID; }
"\\"[^ !()\n\t]+ { yylval.s = sdup((char *)yytext + 1); return ID; }
[^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+ { bpf_error("illegal token: %s\n", yytext); }
[^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+i {
bpf_error("illegal token: %s\n", yytext); }
. { bpf_error("illegal char '%c'", *yytext); }
%%
void