Virgin import of LBL tcpdump v3.4
This commit is contained in:
parent
4de76e3137
commit
4644f044b2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/tcpdump/dist/; revision=39297
@ -1,4 +1,75 @@
|
||||
@(#) $Header: CHANGES,v 1.45 96/12/07 20:38:04 leres Exp $ (LBL)
|
||||
@(#) $Header: CHANGES,v 1.54 98/07/25 12:41:06 leres Exp $ (LBL)
|
||||
|
||||
v3.4 Sat Jul 25 12:40:55 PDT 1998
|
||||
|
||||
- Hardwire Linux slip support since it's too hard to detect.
|
||||
|
||||
- Redo configuration of "network" libraries (-lsocket and -lnsl) to
|
||||
deal with IRIX. Thanks to John Hawkinson (jhawk@mit.edu)
|
||||
|
||||
- Added -a which tries to translate network and broadcast addresses to
|
||||
names. Suggested by Rob van Nieuwkerk (robn@verdi.et.tudelft.nl)
|
||||
|
||||
- Added a configure option to disable gcc.
|
||||
|
||||
- Added a "raw" packet printer.
|
||||
|
||||
- Not having an interface address is no longer fatal. Requested by John
|
||||
Hawkinson.
|
||||
|
||||
- Rework signal setup to accommodate Linux.
|
||||
|
||||
- OSPF truncation check fix. Also display the type of OSPF packets
|
||||
using MD5 authentication. Thanks to Brian Wellington
|
||||
(bwelling@tis.com)
|
||||
|
||||
- Fix truncation check bugs in the Kerberos printer. Reported by Ezra
|
||||
Peisach (epeisach@mit.edu)
|
||||
|
||||
- Don't catch SIGHUP when invoked with nohup(1). Thanks to Dave Plonka
|
||||
(plonka@mfa.com)
|
||||
|
||||
- Specify full install target as a way of detecting if install
|
||||
directory does not exist. Thanks to Dave Plonka.
|
||||
|
||||
- Bit-swap FDDI addresses for BSD/OS too. Thanks to Paul Vixie
|
||||
(paul@vix.com)
|
||||
|
||||
- Fix off-by-one bug when testing size of ethernet packets. Thanks to
|
||||
Marty Leisner (leisner@sdsp.mc.xerox.com)
|
||||
|
||||
- Add a local autoconf macro to check for routines in libraries; the
|
||||
autoconf version is broken (it only puts the library name in the
|
||||
cache variable name). Thanks to John Hawkinson.
|
||||
|
||||
- Add a local autoconf macro to check for types; the autoconf version
|
||||
is broken (it uses grep instead of actually compiling a code fragment).
|
||||
|
||||
- Modified to support the new BSD/OS 2.1 PPP and SLIP link layer header
|
||||
formats.
|
||||
|
||||
- Extend OSF ip header workaround to versions 1 and 2.
|
||||
|
||||
- Fix some signed problems in the nfs printer. As reported by David
|
||||
Sacerdote (davids@silence.secnet.com)
|
||||
|
||||
- Detect group wheel and use it as the default since BSD/OS' install
|
||||
can't hack numeric groups. Reported by David Sacerdote.
|
||||
|
||||
- AIX needs special loader options. Thanks to Jonathan I. Kamens
|
||||
(jik@cam.ov.com)
|
||||
|
||||
- Fixed the nfs printer to print port numbers in decimal. Thanks to
|
||||
Kent Vander Velden (graphix@iastate.edu)
|
||||
|
||||
- Find installed libpcap in /usr/local/lib when not using gcc.
|
||||
|
||||
- Disallow network masks with non-network bits set.
|
||||
|
||||
- Attempt to detect "egcs" versions of gcc.
|
||||
|
||||
- Add missing closing double quotes when displaying bootp strings.
|
||||
Reported by Viet-Trung Luu (vluu@picard.math.uwaterloo.ca)
|
||||
|
||||
v3.3 Sat Nov 30 20:56:27 PST 1996
|
||||
|
||||
|
@ -4,7 +4,7 @@ INSTALL
|
||||
Makefile.in
|
||||
README
|
||||
VERSION
|
||||
acsite.m4
|
||||
aclocal.m4
|
||||
addrtoname.c
|
||||
addrtoname.h
|
||||
appletalk.h
|
||||
@ -19,6 +19,8 @@ decnet.h
|
||||
ethertype.h
|
||||
extract.h
|
||||
fddi.h
|
||||
gmt2local.c
|
||||
gmt2local.h
|
||||
igrp.h
|
||||
install-sh
|
||||
interface.h
|
||||
@ -39,6 +41,7 @@ linux-include/netinet/tcp_var.h
|
||||
linux-include/netinet/tcpip.h
|
||||
linux-include/netinet/udp.h
|
||||
linux-include/netinet/udp_var.h
|
||||
linux-include/sys/mbuf.h
|
||||
llc.h
|
||||
machdep.c
|
||||
machdep.h
|
||||
@ -52,6 +55,7 @@ ntp.h
|
||||
ospf.h
|
||||
packetdat.awk
|
||||
parsenfsfh.c
|
||||
ppp.h
|
||||
print-arp.c
|
||||
print-atalk.c
|
||||
print-atm.c
|
||||
@ -77,6 +81,7 @@ print-null.c
|
||||
print-ospf.c
|
||||
print-pim.c
|
||||
print-ppp.c
|
||||
print-raw.c
|
||||
print-rip.c
|
||||
print-sl.c
|
||||
print-snmp.c
|
||||
@ -85,7 +90,11 @@ print-tcp.c
|
||||
print-tftp.c
|
||||
print-udp.c
|
||||
print-wb.c
|
||||
savestr.c
|
||||
savestr.h
|
||||
send-ack.awk
|
||||
setsignal.c
|
||||
setsignal.h
|
||||
stime.awk
|
||||
strcasecmp.c
|
||||
tcpdump.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
@(#) $Header: INSTALL,v 1.28 96/12/11 20:15:42 leres Exp $ (LBL)
|
||||
@(#) $Header: INSTALL,v 1.36 98/07/12 13:12:26 leres Exp $ (LBL)
|
||||
|
||||
If you have not built libpcap, do so first. See the README
|
||||
file in this directory for the ftp location.
|
||||
@ -28,6 +28,10 @@ Note that tcpdump is shipped with some systems, for example, DEC/OSF
|
||||
and BSD/386. Remember to remove or rename the installed binary
|
||||
when upgrading.
|
||||
|
||||
If you use Linux, this version of libpcap is known to compile and run
|
||||
under Red Hat 4.0 with the 2.0.25 kernel. It may work with earlier 2.X
|
||||
versions but is guaranteed not to work with 1.X kernels.
|
||||
|
||||
If you use OSF 4, note that that there appears to be some serious bugs
|
||||
with the stock C compiler. The configure code fragments that detect if
|
||||
the ether_header and ether_arp structs use the ether_addr struct
|
||||
@ -57,11 +61,12 @@ INSTALL - this file
|
||||
Makefile.in - compilation rules (input to the configure script)
|
||||
README - description of distribution
|
||||
VERSION - version of this release
|
||||
acsite.m4 - autoconf macros
|
||||
aclocal.m4 - autoconf macros
|
||||
addrtoname.c - address to hostname routines
|
||||
addrtoname.h - address to hostname definitions
|
||||
appletalk.h - AppleTalk definitions
|
||||
atime.awk - TCP ack awk script
|
||||
bcopy.c - missing routine
|
||||
bootp.h - BOOTP definitions
|
||||
bpf_dump.c - bpf instruction pretty-printer routine
|
||||
config.guess - autoconf support
|
||||
@ -72,6 +77,8 @@ decnet.h - DECnet definitions
|
||||
ethertype.h - ethernet definitions
|
||||
extract.h - alignment definitions
|
||||
fddi.h - Fiber Distributed Data Interface definitions
|
||||
gmt2local.c - time conversion routines
|
||||
gmt2local.h - time conversion prototypes
|
||||
igrp.h - Interior Gateway Routing Protocol definitions
|
||||
install-sh - BSD style install script
|
||||
interface.h - globals, prototypes and definitions
|
||||
@ -92,6 +99,7 @@ ntp.h - Network Time Protocol definitions
|
||||
ospf.h - Open Shortest Path First definitions
|
||||
packetdat.awk - TCP chunk summary awk script
|
||||
parsenfsfh.c - Network File System file parser routines
|
||||
ppp.h - Point to Point Protocol definitions
|
||||
print-arp.c - Address Resolution Protocol printer routines
|
||||
print-atalk.c - AppleTalk printer routines
|
||||
print-atm.c - atm printer routines
|
||||
@ -116,6 +124,7 @@ print-null.c - null printer routines
|
||||
print-ospf.c - Open Shortest Path First printer routines
|
||||
print-pim.c - Protocol Independent Multicast printer routines
|
||||
print-ppp.c - Point to Point Protocol printer routines
|
||||
print-raw.c - raw printer routines
|
||||
print-rip.c - Routing Information Protocol printer routines
|
||||
print-sl.c - Compressed Serial Line Internet Protocol printer routines
|
||||
print-snmp.c - Simple Network Management Protocol printer routines
|
||||
@ -124,8 +133,13 @@ print-tcp.c - TCP printer routines
|
||||
print-tftp.c - Trivial File Transfer Protocol printer routines
|
||||
print-udp.c - UDP printer routines
|
||||
print-wb.c - white board printer routines
|
||||
savestr.c - savestr prototypes
|
||||
savestr.h - strdup() replacement
|
||||
send-ack.awk - unidirectional tcp send/ack awk script
|
||||
setsignal.c - os independent signal routines
|
||||
setsignal.h - os independent signal prototypes
|
||||
stime.awk - TCP send awk script
|
||||
strcasecmp.c - missing routine
|
||||
tcpdump.1 - manual entry
|
||||
tcpdump.c - main program
|
||||
util.c - utility routines
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 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
|
||||
@ -17,7 +17,7 @@
|
||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# @(#) $Header: Makefile.in,v 1.198 96/12/05 22:12:11 leres Exp $ (LBL)
|
||||
# @(#) $Header: Makefile.in,v 1.207 97/08/17 13:53:29 leres Exp $ (LBL)
|
||||
|
||||
#
|
||||
# Various configurable paths (remember to edit Makefile.in, not Makefile)
|
||||
@ -40,13 +40,17 @@ VPATH = @srcdir@
|
||||
#
|
||||
|
||||
CC = @CC@
|
||||
PROG = tcpdump
|
||||
CCOPT = @V_CCOPT@
|
||||
INCLS = -I. @V_INCLS@
|
||||
DEFS = @DEFS@ -DPPP -DHAVE_FDDI
|
||||
DEFS = @DEFS@ -DHAVE_FDDI
|
||||
|
||||
# Standard CFLAGS
|
||||
CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
|
||||
|
||||
# Standard LDFLAGS
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
# Standard LIBS
|
||||
LIBS = @LIBS@
|
||||
|
||||
@ -65,9 +69,10 @@ CSRC = tcpdump.c \
|
||||
print-ether.c print-fddi.c print-gre.c print-icmp.c \
|
||||
print-igrp.c print-ip.c print-ipx.c print-isoclns.c print-krb.c \
|
||||
print-llc.c print-nfs.c print-ntp.c print-null.c print-ospf.c \
|
||||
print-pim.c print-ppp.c print-rip.c print-sl.c print-snmp.c \
|
||||
print-sunrpc.c print-tcp.c print-tftp.c print-udp.c print-wb.c \
|
||||
addrtoname.c bpf_dump.c machdep.c parsenfsfh.c util.c
|
||||
print-pim.c print-ppp.c print-raw.c print-rip.c print-sl.c \
|
||||
print-snmp.c print-sunrpc.c print-tcp.c print-tftp.c print-udp.c \
|
||||
print-wb.c addrtoname.c bpf_dump.c gmt2local.c machdep.c \
|
||||
parsenfsfh.c util.c savestr.c setsignal.c
|
||||
LOCALSRC =
|
||||
GENSRC = version.c
|
||||
|
||||
@ -77,8 +82,9 @@ SRC = $(CSRC) $(GENSRC) $(LOCALSRC)
|
||||
# hack the extra indirection
|
||||
OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) $(LOCALSRC:.c=.o) @LIBOBJS@
|
||||
HDR = addrtoname.h appletalk.h bootp.h decnet.h \
|
||||
ethertype.h extract.h fddi.h interface.h igrp.h ipx.h \
|
||||
llc.h machdep.h mib.h nfsfh.h nfsv2.h ntp.h ospf.h
|
||||
ethertype.h extract.h fddi.h gmt2local.h interface.h igrp.h \
|
||||
ipx.h llc.h machdep.h mib.h nfsfh.h nfsv2.h ntp.h ospf.h \
|
||||
savestr.c setsignal.h
|
||||
|
||||
TAGHDR = \
|
||||
/usr/include/arpa/tftp.h \
|
||||
@ -93,11 +99,13 @@ TAGHDR = \
|
||||
|
||||
TAGFILES = $(SRC) $(HDR) $(TAGHDR)
|
||||
|
||||
CLEANFILES = $(OBJ) tcpdump $(GENSRC)
|
||||
CLEANFILES = $(PROG) $(OBJ) $(GENSRC)
|
||||
|
||||
tcpdump: $(OBJ) @V_PCAPDEP@
|
||||
all: $(PROG)
|
||||
|
||||
$(PROG): $(OBJ) @V_PCAPDEP@
|
||||
@rm -f $@
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJ) $(LIBS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
|
||||
|
||||
version.o: version.c
|
||||
version.c: $(srcdir)/VERSION
|
||||
@ -105,13 +113,14 @@ version.c: $(srcdir)/VERSION
|
||||
sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@
|
||||
|
||||
install: force
|
||||
$(INSTALL) -m 550 -o bin -g @V_GROUP@ tcpdump $(DESTDIR)$(BINDEST)
|
||||
$(INSTALL) -m 550 -o bin -g @V_GROUP@ $(PROG) \
|
||||
$(DESTDIR)$(BINDEST)/$(PROG)
|
||||
|
||||
install-man: force
|
||||
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/tcpdump.1 \
|
||||
$(DESTDIR)$(MANDEST)/man1
|
||||
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/$(PROG).1 \
|
||||
$(DESTDIR)$(MANDEST)/man1/$(PROG).1
|
||||
|
||||
lint: $(GENSRC) force
|
||||
lint: $(GENSRC) force
|
||||
lint -hbxn $(SRC) | \
|
||||
grep -v 'struct/union .* never defined' | \
|
||||
grep -v 'possible pointer alignment problem'
|
||||
@ -123,11 +132,11 @@ distclean:
|
||||
rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
|
||||
gnuc.h os-proto.h
|
||||
|
||||
tags: $(TAGFILES)
|
||||
tags: $(TAGFILES)
|
||||
ctags -wtd $(TAGFILES)
|
||||
|
||||
tar: force
|
||||
@cwd=`pwd` ; dir=`basename $$cwd` ; name=tcpdump-`cat VERSION` ; \
|
||||
tar: force
|
||||
@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
|
||||
list="" ; tar="tar chFFf" ; \
|
||||
for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
|
||||
echo \
|
||||
@ -140,6 +149,6 @@ tar: force
|
||||
"rm -f ../$$name" ; \
|
||||
rm -f ../$$name
|
||||
|
||||
force: /tmp
|
||||
depend: $(GENSRC) force
|
||||
force: /tmp
|
||||
depend: $(GENSRC) force
|
||||
./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
|
||||
|
@ -1,6 +1,6 @@
|
||||
@(#) $Header: README,v 1.50 96/08/20 14:36:28 leres Exp $ (LBL)
|
||||
@(#) $Header: README,v 1.54 98/01/27 21:36:20 vern Exp $ (LBL)
|
||||
|
||||
TCPDUMP 3.3
|
||||
TCPDUMP 3.4
|
||||
Lawrence Berkeley National Laboratory
|
||||
Network Research Group
|
||||
tcpdump@ee.lbl.gov
|
||||
@ -10,7 +10,7 @@ This directory contains source code for tcpdump, a tool for network
|
||||
monitoring and data acquisition. The original distribution is
|
||||
available via anonymous ftp to ftp.ee.lbl.gov, in tcpdump.tar.Z.
|
||||
|
||||
Tcpdump now uses libcap, a system-independent interface for user-level
|
||||
Tcpdump now uses libpcap, a system-independent interface for user-level
|
||||
packet capture. Before building tcpdump, you must first retrieve and
|
||||
build libpcap, also from LBL, in:
|
||||
|
||||
@ -20,30 +20,35 @@ Once libpcap is built (either install it or make sure it's in
|
||||
../libpcap), you can build tcpdump using the procedure in the INSTALL
|
||||
file.
|
||||
|
||||
The program is loosely based on SMI's "etherfind" although none
|
||||
of the etherfind code remains. It was originally written by Van
|
||||
Jacobson as part of an ongoing research project to investigate and
|
||||
improve tcp and internet gateway performance. The parts of the
|
||||
program originally taken from Sun's etherfind were later re-written
|
||||
by Steven McCanne of LBL. To insure that there would be no vestige
|
||||
of proprietary code in tcpdump, Steve wrote these pieces from the
|
||||
specification given by the manual entry, with no access to the
|
||||
source of tcpdump or etherfind.
|
||||
The program is loosely based on SMI's "etherfind" although none of the
|
||||
etherfind code remains. It was originally written by Van Jacobson as
|
||||
part of an ongoing research project to investigate and improve tcp and
|
||||
internet gateway performance. The parts of the program originally
|
||||
taken from Sun's etherfind were later re-written by Steven McCanne of
|
||||
LBL. To insure that there would be no vestige of proprietary code in
|
||||
tcpdump, Steve wrote these pieces from the specification given by the
|
||||
manual entry, with no access to the source of tcpdump or etherfind.
|
||||
|
||||
Over the past few years, tcpdump has been steadily improved
|
||||
by the excellent contributions from the Internet community
|
||||
(just browse through the CHANGES file). We are grateful for
|
||||
all the input.
|
||||
Over the past few years, tcpdump has been steadily improved by the
|
||||
excellent contributions from the Internet community (just browse
|
||||
through the CHANGES file). We are grateful for all the input.
|
||||
|
||||
Richard Stevens gives an excellent treatment of the Internet
|
||||
protocols in his book ``TCP/IP Illustrated, Volume 1''.
|
||||
If you want to learn more about tcpdump and how to interpret
|
||||
its output, pick up this book.
|
||||
Richard Stevens gives an excellent treatment of the Internet protocols
|
||||
in his book ``TCP/IP Illustrated, Volume 1''. If you want to learn more
|
||||
about tcpdump and how to interpret its output, pick up this book.
|
||||
|
||||
Some tools for viewing and analyzing tcpdump trace files are available
|
||||
from the Internet Traffic Archive:
|
||||
|
||||
http://town.hall.org/Archives/pub/ITA/
|
||||
http://www.acm.org/sigcomm/ITA/
|
||||
|
||||
Another tool that tcpdump users might find useful is tcpslice:
|
||||
|
||||
ftp://ftp.ee.lbl.gov/tcpslice.tar.Z
|
||||
|
||||
It is a program that can be used to extract portions of tcpdump binary
|
||||
trace files. See the above distribution for further details and
|
||||
documentation.
|
||||
|
||||
Problems, bugs, questions, desirable enhancements, source code
|
||||
contributions, etc., should be sent to the email address
|
||||
|
@ -1 +1 @@
|
||||
3.3
|
||||
3.4
|
||||
|
411
contrib/tcpdump/aclocal.m4
vendored
411
contrib/tcpdump/aclocal.m4
vendored
@ -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)
|
||||
])
|
||||
|
@ -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.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: addrtoname.c,v 1.54 96/12/05 22:10:19 leres Exp $ (LBL)";
|
||||
"@(#) $Header: addrtoname.c,v 1.61 97/06/15 13:20:18 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -45,6 +45,12 @@ struct rtentry;
|
||||
#include <netdb.h>
|
||||
#include <pcap.h>
|
||||
#include <pcap-namedb.h>
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -54,6 +60,8 @@ struct rtentry;
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "llc.h"
|
||||
#include "savestr.h"
|
||||
#include "setsignal.h"
|
||||
|
||||
/* Forwards */
|
||||
static RETSIGTYPE nohostname(int);
|
||||
@ -208,16 +216,18 @@ getname(const u_char *ap)
|
||||
/*
|
||||
* Only print names when:
|
||||
* (1) -n was not given.
|
||||
* (2) Address is foreign and -f was given. If -f was not
|
||||
* present, f_netmask and f_local are 0 and the second
|
||||
* test will succeed.
|
||||
* (3) The host portion is not 0 (i.e., a network address).
|
||||
* (4) The host portion is not broadcast.
|
||||
* (2) Address is foreign and -f was given. (If -f was not
|
||||
* give, f_netmask and f_local are 0 and the test
|
||||
* evaluates to true)
|
||||
* (3) -a was given or the host portion is not all ones
|
||||
* nor all zeros (i.e. not a network or broadcast address)
|
||||
*/
|
||||
if (!nflag && (addr & f_netmask) == f_localnet
|
||||
&& (addr &~ netmask) != 0 && (addr | netmask) != 0xffffffff) {
|
||||
if (!nflag &&
|
||||
(addr & f_netmask) == f_localnet &&
|
||||
(aflag ||
|
||||
!((addr & ~netmask) == 0 || (addr | netmask) == 0xffffffff))) {
|
||||
if (!setjmp(getname_env)) {
|
||||
(void)signal(SIGALRM, nohostname);
|
||||
(void)setsignal(SIGALRM, nohostname);
|
||||
(void)alarm(20);
|
||||
hp = gethostbyaddr((char *)&addr, 4, AF_INET);
|
||||
(void)alarm(0);
|
||||
@ -307,7 +317,7 @@ lookup_nsap(register const u_char *nsap)
|
||||
tp->e_nsap = (u_char *)malloc(nlen + 1);
|
||||
if (tp->e_nsap == NULL)
|
||||
error("lookup_nsap: malloc");
|
||||
memcpy(tp->e_nsap, nsap, nlen + 1);
|
||||
memcpy((char *)tp->e_nsap, (char *)nsap, nlen + 1);
|
||||
tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp));
|
||||
if (tp->e_nxt == NULL)
|
||||
error("lookup_nsap: calloc");
|
||||
@ -696,7 +706,7 @@ init_llcsaparray(void)
|
||||
* of the local network. mask is its subnet mask.
|
||||
*/
|
||||
void
|
||||
init_addrtoname(int fflag, u_int32_t localnet, u_int32_t mask)
|
||||
init_addrtoname(u_int32_t localnet, u_int32_t mask)
|
||||
{
|
||||
netmask = mask;
|
||||
if (fflag) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1992, 1993, 1994, 1995
|
||||
* Copyright (c) 1990, 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
|
||||
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: addrtoname.h,v 1.13 95/05/04 17:52:44 mccanne Exp $ (LBL)
|
||||
* @(#) $Header: addrtoname.h,v 1.15 97/01/01 21:01:16 leres Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* Name to address translation routines. */
|
||||
@ -30,7 +30,7 @@ extern char *udpport_string(u_short);
|
||||
extern char *getname(const u_char *);
|
||||
extern char *intoa(u_int32_t);
|
||||
|
||||
extern void init_addrtoname(int, u_int32_t, u_int32_t);
|
||||
extern void init_addrtoname(u_int32_t, u_int32_t);
|
||||
extern struct hnamemem *newhnamemem(void);
|
||||
|
||||
#define ipaddr_string(p) getname((const u_char *)(p))
|
||||
|
1621
contrib/tcpdump/configure
vendored
1621
contrib/tcpdump/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
dnl @(#) $Header: configure.in,v 1.58 96/11/29 15:37:31 leres Exp $ (LBL)
|
||||
dnl @(#) $Header: configure.in,v 1.71 97/07/27 22:17:59 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.
|
||||
@ -18,39 +18,45 @@ fi
|
||||
|
||||
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
|
||||
|
||||
AC_CHECK_HEADERS(fcntl.h net/slip.h rpc/rpcent.h)
|
||||
AC_CHECK_HEADERS(fcntl.h malloc.h memory.h rpc/rpcent.h)
|
||||
AC_HEADER_TIME
|
||||
|
||||
case "$target_os" in
|
||||
|
||||
linux*)
|
||||
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
|
||||
AC_DEFINE(HAVE_NET_SLIP_H)
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_CHECK_HEADERS(net/slip.h)
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_REPLACE_FUNCS(vfprintf strcasecmp)
|
||||
AC_CHECK_FUNCS(ether_ntoa setlinebuf)
|
||||
|
||||
dnl The following generates a warning...
|
||||
dnl The following generates a warning from autoconf...
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
AC_CHECK_LIB(dnet, main)
|
||||
AC_CHECK_LIB(rpc, main)
|
||||
AC_CHECK_LIB(nsl, main)
|
||||
AC_CHECK_LIB(str, main)
|
||||
|
||||
dnl -lsocket is broken for snoop under IRIX 5.2 and earlier
|
||||
case "$target_os" in
|
||||
irix5.0*)
|
||||
;;
|
||||
|
||||
irix5.1*)
|
||||
;;
|
||||
|
||||
irix5.2*)
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_CHECK_LIB(socket, main)
|
||||
;;
|
||||
esac
|
||||
AC_LBL_TYPE_SIGNAL
|
||||
|
||||
AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
|
||||
|
||||
V_GROUP=0
|
||||
if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
|
||||
V_GROUP=wheel
|
||||
fi
|
||||
case "$target_os" in
|
||||
|
||||
aix*)
|
||||
@ -62,42 +68,30 @@ irix*)
|
||||
V_GROUP=sys
|
||||
;;
|
||||
|
||||
linux*)
|
||||
V_INCLS="$V_INCLS -Ilinux-include"
|
||||
;;
|
||||
|
||||
osf*)
|
||||
V_GROUP=system
|
||||
case "$target_os" in
|
||||
|
||||
osf1*)
|
||||
;;
|
||||
|
||||
osf2*)
|
||||
;;
|
||||
|
||||
*)
|
||||
dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
|
||||
AC_DEFINE(__STDC__,2)
|
||||
;;
|
||||
esac
|
||||
dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
|
||||
AC_DEFINE(__STDC__,2)
|
||||
;;
|
||||
|
||||
solaris*)
|
||||
V_GROUP=sys
|
||||
;;
|
||||
|
||||
linux*)
|
||||
V_INCLS="$V_INCLS -Ilinux-include"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -f /dev/bpf0 ; then
|
||||
V_GROUP=bpf
|
||||
fi
|
||||
|
||||
AC_CHECK_TYPE(int32_t, int)
|
||||
AC_CHECK_TYPE(u_int32_t, u_int)
|
||||
AC_LBL_CHECK_TYPE(int32_t, int)
|
||||
AC_LBL_CHECK_TYPE(u_int32_t, u_int)
|
||||
|
||||
AC_LBL_DEVEL(V_CCOPT)
|
||||
|
||||
AC_LBL_TYPE_SIGNAL
|
||||
AC_LBL_SOCKADDR_SA_LEN
|
||||
|
||||
AC_MSG_CHECKING(if ether_header uses ether_addr structs)
|
||||
@ -176,9 +170,15 @@ fi
|
||||
|
||||
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
|
||||
|
||||
AC_SUBST(V_CCOPT)
|
||||
|
72
contrib/tcpdump/gmt2local.c
Normal file
72
contrib/tcpdump/gmt2local.c
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: gmt2local.c,v 1.2 97/01/23 22:31:25 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include "gnuc.h"
|
||||
#ifdef HAVE_OS_PROTO_H
|
||||
#include "os-proto.h"
|
||||
#endif
|
||||
|
||||
#include "gmt2local.h"
|
||||
|
||||
/*
|
||||
* Returns the difference between gmt and local time in seconds.
|
||||
* Use gmtime() and localtime() to keep things simple.
|
||||
*/
|
||||
int32_t
|
||||
gmt2local(time_t t)
|
||||
{
|
||||
register int dt, dir;
|
||||
register struct tm *gmt, *loc;
|
||||
struct tm sgmt;
|
||||
|
||||
if (t == 0)
|
||||
t = time(NULL);
|
||||
gmt = &sgmt;
|
||||
*gmt = *gmtime(&t);
|
||||
loc = localtime(&t);
|
||||
dt = (loc->tm_hour - gmt->tm_hour) * 60 * 60 +
|
||||
(loc->tm_min - gmt->tm_min) * 60;
|
||||
|
||||
/*
|
||||
* If the year or julian day is different, we span 00:00 GMT
|
||||
* and must add or subtract a day. Check the year first to
|
||||
* avoid problems when the julian day wraps.
|
||||
*/
|
||||
dir = loc->tm_year - gmt->tm_year;
|
||||
if (dir == 0)
|
||||
dir = loc->tm_yday - gmt->tm_yday;
|
||||
dt += dir * 24 * 60 * 60;
|
||||
|
||||
return (dt);
|
||||
}
|
27
contrib/tcpdump/gmt2local.h
Normal file
27
contrib/tcpdump/gmt2local.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: gmt2local.h,v 1.2 97/01/23 22:31:40 leres Exp $ (LBL)
|
||||
*/
|
||||
#ifndef gmt2local_h
|
||||
#define gmt2local_h
|
||||
|
||||
int32_t gmt2local(time_t);
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: interface.h,v 1.100 96/12/10 22:55:04 leres Exp $ (LBL)
|
||||
* @(#) $Header: interface.h,v 1.105 97/04/26 13:39:58 leres Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_interface_h
|
||||
@ -34,8 +34,10 @@ struct tok {
|
||||
char *s; /* string */
|
||||
};
|
||||
|
||||
extern int aflag; /* translate network and broadcast addresses */
|
||||
extern int dflag; /* print filter code */
|
||||
extern int eflag; /* print ethernet header */
|
||||
extern int fflag; /* don't translate "foreign" IP address */
|
||||
extern int nflag; /* leave addresses as numbers */
|
||||
extern int Nflag; /* remove domains from printed host names */
|
||||
extern int qflag; /* quick (shorter) output */
|
||||
@ -130,13 +132,11 @@ struct timeval;
|
||||
#endif
|
||||
|
||||
extern void ts_print(const struct timeval *);
|
||||
extern int32_t gmt2local(void);
|
||||
|
||||
extern int fn_print(const u_char *, const u_char *);
|
||||
extern int fn_printn(const u_char *, u_int, const u_char *);
|
||||
extern const char *tok2str(const struct tok *, const char *, int);
|
||||
extern char *dnaddr_string(u_short);
|
||||
extern char *savestr(const char *);
|
||||
|
||||
extern void wrapup(int);
|
||||
|
||||
@ -193,8 +193,13 @@ extern void null_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void ospf_print(const u_char *, u_int, const u_char *);
|
||||
extern void pim_print(const u_char *, u_int);
|
||||
extern void ppp_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void ppp_bsdos_if_print(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
extern void raw_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void rip_print(const u_char *, u_int);
|
||||
extern void sl_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void sl_bsdos_if_print(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
extern void snmp_print(const u_char *, u_int);
|
||||
extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
|
||||
extern void tcp_print(const u_char *, u_int, const u_char *);
|
||||
|
@ -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 *);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1993, 1994
|
||||
* Copyright (c) 1993, 1994, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: llc.h,v 1.4 94/06/14 20:11:46 leres Exp $ (LBL)
|
||||
* @(#) $Header: llc.h,v 1.6 97/06/13 02:06:07 leres Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -79,8 +79,8 @@ struct llc {
|
||||
#define LLC_RNR 0x0500
|
||||
#define LLC_REJ 0x0900
|
||||
|
||||
#define LLC_IS_NR(is) (((is) >> 9) & 0x7f)
|
||||
#define LLC_I_NS(is) (((is) >> 1) & 0x7f)
|
||||
#define LLC_IS_NR(is) (((is) >> 1) & 0x7f)
|
||||
#define LLC_I_NS(is) (((is) >> 9) & 0x7f)
|
||||
|
||||
#ifndef LLCSAP_NULL
|
||||
#define LLCSAP_NULL 0x00
|
||||
|
@ -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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: machdep.c,v 1.3 96/12/10 23:24:28 leres Exp $ (LBL)";
|
||||
"@(#) $Header: machdep.c,v 1.4 97/09/30 15:03:53 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -30,8 +30,6 @@ static const char rcsid[] =
|
||||
#include <sys/proc.h>
|
||||
#endif
|
||||
|
||||
#include <pcap.h>
|
||||
|
||||
#include "machdep.h"
|
||||
|
||||
int
|
||||
@ -41,7 +39,7 @@ abort_on_misalignment(char *ebuf)
|
||||
static int buf[2] = { SSIN_UACPROC, UAC_SIGBUS };
|
||||
|
||||
if (setsysinfo(SSI_NVPAIRS, (caddr_t)buf, 1, 0, 0) < 0) {
|
||||
(void)sprintf(ebuf, "setsysinfo: %s", pcap_strerror(errno));
|
||||
(void)sprintf(ebuf, "setsysinfo: errno %d", errno);
|
||||
return (-1);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Header: nfsfh.h,v 1.5 96/08/20 14:33:23 leres Exp $
|
||||
* $Header: nfsfh.h,v 1.6 96/12/16 03:40:31 leres Exp $
|
||||
*
|
||||
* nfsfh.h - NFS file handle definitions (for portable use)
|
||||
*
|
||||
@ -29,6 +29,6 @@ typedef struct {
|
||||
} my_fsid;
|
||||
|
||||
#define fsid_eq(a,b) ((a.fsid_code == b.fsid_code) &&\
|
||||
dev_eq(a.fsid_dev, b.fsid_dev))
|
||||
dev_eq(a.Fsid_dev, b.Fsid_dev))
|
||||
|
||||
extern void Parse_fh(caddr_t *, my_fsid *, ino_t *, char **, char **, int);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1991, 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
|
||||
@ -36,6 +36,9 @@
|
||||
/* ospf_authtype */
|
||||
#define OSPF_AUTH_NONE 0 /* No auth-data */
|
||||
#define OSPF_AUTH_SIMPLE 1 /* Simple password */
|
||||
#define OSPF_AUTH_MD5 2 /* MD5 authentication */
|
||||
#define OSPF_AUTH_MD5_LEN 16 /* length of MD5 authentication */
|
||||
|
||||
|
||||
/* db_flags */
|
||||
#define OSPF_DB_INIT 0x04 /* */
|
||||
|
@ -9,14 +9,16 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: parsenfsfh.c,v 1.12 96/12/10 23:25:50 leres Exp $ (LBL)";
|
||||
"@(#) $Header: parsenfsfh.c,v 1.14 97/06/15 13:20:27 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -312,13 +314,14 @@ int ourself; /* true if file handle was generated on this host */
|
||||
if (sizeof(*fsidp) >= 14) {
|
||||
if (sizeof(*fsidp) > 14)
|
||||
memset((char *)fsidp, 0, sizeof(*fsidp));
|
||||
memcpy((char *)fsidp, fh, 14); /* just use the whole thing */
|
||||
/* just use the whole thing */
|
||||
memcpy((char *)fsidp, (char *)fh, 14);
|
||||
}
|
||||
else {
|
||||
u_int32_t tempa[4]; /* at least 16 bytes, maybe more */
|
||||
|
||||
memset((char *)tempa, 0, sizeof(tempa));
|
||||
memcpy((char *)tempa, fh, 14); /* ensure alignment */
|
||||
memcpy((char *)tempa, (char *)fh, 14); /* ensure alignment */
|
||||
fsidp->Fsid_dev.Minor = tempa[0] + (tempa[1]<<1);
|
||||
fsidp->Fsid_dev.Major = tempa[2] + (tempa[3]<<1);
|
||||
fsidp->fsid_code = 0;
|
||||
|
50
contrib/tcpdump/ppp.h
Normal file
50
contrib/tcpdump/ppp.h
Normal 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 */
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-arp.c,v 1.41 96/10/27 14:54:50 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-arp.c,v 1.43 97/06/15 13:20:27 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -37,6 +37,9 @@ struct rtentry;
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-atalk.c,v 1.45 96/12/10 23:24:07 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-atalk.c,v 1.48 97/05/28 12:50:58 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -55,6 +55,7 @@ struct rtentry;
|
||||
#include "ethertype.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
#include "appletalk.h"
|
||||
#include "savestr.h"
|
||||
|
||||
static struct tok type2str[] = {
|
||||
{ ddpRTMP, "rtmp" },
|
||||
@ -405,11 +406,11 @@ print_cstring(register const char *cp, register const u_char *ep)
|
||||
length = *cp++;
|
||||
|
||||
/* Spec says string can be at most 32 bytes long */
|
||||
if (length < 0 || length > 32) {
|
||||
(void)printf("[len=%d]", length);
|
||||
if (length > 32) {
|
||||
(void)printf("[len=%u]", length);
|
||||
return (0);
|
||||
}
|
||||
while (--length >= 0) {
|
||||
while ((int)--length >= 0) {
|
||||
if (cp >= (char *)ep) {
|
||||
fputs(tstr, stdout);
|
||||
return (0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996
|
||||
* Copyright (c) 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: print-atm.c,v 1.8 96/09/26 23:36:41 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-atm.c,v 1.9 97/05/28 12:52:40 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -46,9 +46,9 @@ struct rtentry;
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
#include "interface.h"
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' is the points
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1990, 1991, 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: print-bootp.c,v 1.43 96/09/26 23:36:42 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-bootp.c,v 1.46 98/07/18 13:33:58 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -39,6 +39,9 @@ struct rtentry;
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -145,6 +148,7 @@ bootp_print(register const u_char *cp, u_int length,
|
||||
fputs(tstr + 1, stdout);
|
||||
return;
|
||||
}
|
||||
putchar('"');
|
||||
}
|
||||
TCHECK2(bp->bp_sname[0], 1); /* check first char only */
|
||||
if (*bp->bp_file) {
|
||||
@ -154,6 +158,7 @@ bootp_print(register const u_char *cp, u_int length,
|
||||
fputs(tstr + 1, stdout);
|
||||
return;
|
||||
}
|
||||
putchar('"');
|
||||
}
|
||||
|
||||
/* Decode the vendor buffer */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-decnet.c,v 1.24 96/11/05 13:30:38 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-decnet.c,v 1.26 97/05/28 12:51:29 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -39,6 +39,9 @@ struct rtentry;
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-domain.c,v 1.37 96/12/10 23:21:06 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-domain.c,v 1.39 97/06/13 12:56:28 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -44,8 +44,12 @@ struct rtentry;
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
|
||||
#ifdef NOERROR
|
||||
#undef NOERROR /* Solaris sucks */
|
||||
#endif
|
||||
#ifdef NOERROR
|
||||
#undef T_UNSPEC /* SINIX does too */
|
||||
#endif
|
||||
#include <arpa/nameser.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -216,8 +220,17 @@ static struct tok type2str[] = {
|
||||
{ T_GPOS, "GPOS" },
|
||||
{ T_AAAA, "AAAA" },
|
||||
{ T_LOC , "LOC " },
|
||||
#ifndef T_UINFO
|
||||
#define T_UINFO 100
|
||||
#endif
|
||||
{ T_UINFO, "UINFO" },
|
||||
#ifndef T_UID
|
||||
#define T_UID 101
|
||||
#endif
|
||||
{ T_UID, "UID" },
|
||||
#ifndef T_GID
|
||||
#define T_GID 102
|
||||
#endif
|
||||
{ T_GID, "GID" },
|
||||
{ T_UNSPEC, "UNSPEC" },
|
||||
{ T_UNSPECA, "UNSPECA" },
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-ether.c,v 1.43 96/09/26 23:36:43 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-ether.c,v 1.44 97/05/26 17:18:13 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -116,7 +116,7 @@ ether_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
* Is it (gag) an 802.3 encapsulation?
|
||||
*/
|
||||
extracted_ethertype = 0;
|
||||
if (ether_type < ETHERMTU) {
|
||||
if (ether_type <= ETHERMTU) {
|
||||
/* Try to print the LLC-layer header & higher layers */
|
||||
if (llc_print(p, length, caplen, ESRC(ep), EDST(ep)) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-fddi.c,v 1.33 96/12/10 23:20:49 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-fddi.c,v 1.36 97/05/26 17:13:35 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FDDI
|
||||
@ -45,7 +45,6 @@ struct rtentry;
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <pcap.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -58,7 +57,7 @@ struct rtentry;
|
||||
/*
|
||||
* Some FDDI interfaces use bit-swapped addresses.
|
||||
*/
|
||||
#if defined(ultrix) || defined(__alpha)
|
||||
#if defined(ultrix) || defined(__alpha) || defined(__bsdi)
|
||||
int fddi_bitswap = 0;
|
||||
#else
|
||||
int fddi_bitswap = 1;
|
||||
|
@ -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
|
||||
@ -23,10 +23,11 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-igrp.c,v 1.6 96/12/10 23:27:35 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-igrp.c,v 1.8 97/05/28 12:52:47 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h> /* concession to AIX */
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
@ -39,8 +40,8 @@ static const char rcsid[] =
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "addrtoname.h"
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "igrp.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-ip.c,v 1.62 96/12/10 23:20:31 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-ip.c,v 1.66 97/05/28 12:51:43 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -37,6 +37,9 @@ static const char rcsid[] =
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -431,18 +434,15 @@ ip_print(register const u_char *bp, register u_int length)
|
||||
igmp_print(cp, len, (const u_char *)ip);
|
||||
break;
|
||||
|
||||
#ifndef IPPROTO_ENCAP
|
||||
#define IPPROTO_ENCAP 4
|
||||
#endif
|
||||
case IPPROTO_ENCAP:
|
||||
/* ip-in-ip encapsulation */
|
||||
case 4:
|
||||
/* DVMRP multicast tunnel (ip-in-ip encapsulation) */
|
||||
if (vflag)
|
||||
(void)printf("%s > %s: ",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
ipaddr_string(&ip->ip_dst));
|
||||
ip_print(cp, len);
|
||||
if (! vflag) {
|
||||
printf(" (encap)");
|
||||
printf(" (ipip)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-isoclns.c,v 1.14 96/12/10 23:26:56 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-isoclns.c,v 1.15 96/12/31 21:27:41 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -160,7 +160,7 @@ esis_print(const u_char *p, u_int length)
|
||||
printf(" bad pkt!");
|
||||
else {
|
||||
printf(" too short for esis header %d:", li);
|
||||
while (--length >= 0)
|
||||
while (--length != 0)
|
||||
printf("%02X", *p++);
|
||||
}
|
||||
return;
|
||||
@ -293,7 +293,7 @@ osi_cksum(register const u_char *p, register u_int len,
|
||||
return 0;
|
||||
|
||||
off[0] = off[1] = 0;
|
||||
while (--len >= 0) {
|
||||
while ((int)--len >= 0) {
|
||||
c0 += *p++;
|
||||
c1 += c0;
|
||||
c0 %= 255;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 1996
|
||||
* Copyright (c) 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-krb.c,v 1.8 96/12/10 23:17:39 leres Exp $";
|
||||
"@(#) $Header: print-krb.c,v 1.9 97/04/26 14:01:45 leres Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -73,38 +73,38 @@ void krb_print(const u_char *, u_int);
|
||||
#define KERB_ERR_NULL_KEY 10
|
||||
|
||||
struct krb {
|
||||
u_char pvno; /* Protocol Version */
|
||||
u_char type; /* Type+B */
|
||||
u_char pvno; /* Protocol Version */
|
||||
u_char type; /* Type+B */
|
||||
};
|
||||
|
||||
static char tstr[] = " [|kerberos]";
|
||||
|
||||
static struct tok type2str[] = {
|
||||
{ AUTH_MSG_KDC_REQUEST, "KDC_REQUEST" },
|
||||
{ AUTH_MSG_KDC_REPLY, "KDC_REPLY" },
|
||||
{ AUTH_MSG_APPL_REQUEST, "APPL_REQUEST" },
|
||||
{ AUTH_MSG_APPL_REQUEST_MUTUAL, "APPL_REQUEST_MUTUAL" },
|
||||
{ AUTH_MSG_ERR_REPLY, "ERR_REPLY" },
|
||||
{ AUTH_MSG_PRIVATE, "PRIVATE" },
|
||||
{ AUTH_MSG_SAFE, "SAFE" },
|
||||
{ AUTH_MSG_APPL_ERR, "APPL_ERR" },
|
||||
{ AUTH_MSG_DIE, "DIE" },
|
||||
{ 0, NULL }
|
||||
{ AUTH_MSG_KDC_REQUEST, "KDC_REQUEST" },
|
||||
{ AUTH_MSG_KDC_REPLY, "KDC_REPLY" },
|
||||
{ AUTH_MSG_APPL_REQUEST, "APPL_REQUEST" },
|
||||
{ AUTH_MSG_APPL_REQUEST_MUTUAL, "APPL_REQUEST_MUTUAL" },
|
||||
{ AUTH_MSG_ERR_REPLY, "ERR_REPLY" },
|
||||
{ AUTH_MSG_PRIVATE, "PRIVATE" },
|
||||
{ AUTH_MSG_SAFE, "SAFE" },
|
||||
{ AUTH_MSG_APPL_ERR, "APPL_ERR" },
|
||||
{ AUTH_MSG_DIE, "DIE" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static struct tok kerr2str[] = {
|
||||
{ KERB_ERR_OK, "OK" },
|
||||
{ KERB_ERR_NAME_EXP, "NAME_EXP" },
|
||||
{ KERB_ERR_SERVICE_EXP, "SERVICE_EXP" },
|
||||
{ KERB_ERR_AUTH_EXP, "AUTH_EXP" },
|
||||
{ KERB_ERR_PKT_VER, "PKT_VER" },
|
||||
{ KERB_ERR_NAME_MAST_KEY_VER, "NAME_MAST_KEY_VER" },
|
||||
{ KERB_ERR_SERV_MAST_KEY_VER, "SERV_MAST_KEY_VER" },
|
||||
{ KERB_ERR_BYTE_ORDER, "BYTE_ORDER" },
|
||||
{ KERB_ERR_PRINCIPAL_UNKNOWN, "PRINCIPAL_UNKNOWN" },
|
||||
{ KERB_ERR_PRINCIPAL_NOT_UNIQUE, "PRINCIPAL_NOT_UNIQUE" },
|
||||
{ KERB_ERR_NULL_KEY, "NULL_KEY"},
|
||||
{ 0, NULL}
|
||||
{ KERB_ERR_OK, "OK" },
|
||||
{ KERB_ERR_NAME_EXP, "NAME_EXP" },
|
||||
{ KERB_ERR_SERVICE_EXP, "SERVICE_EXP" },
|
||||
{ KERB_ERR_AUTH_EXP, "AUTH_EXP" },
|
||||
{ KERB_ERR_PKT_VER, "PKT_VER" },
|
||||
{ KERB_ERR_NAME_MAST_KEY_VER, "NAME_MAST_KEY_VER" },
|
||||
{ KERB_ERR_SERV_MAST_KEY_VER, "SERV_MAST_KEY_VER" },
|
||||
{ KERB_ERR_BYTE_ORDER, "BYTE_ORDER" },
|
||||
{ KERB_ERR_PRINCIPAL_UNKNOWN, "PRINCIPAL_UNKNOWN" },
|
||||
{ KERB_ERR_PRINCIPAL_NOT_UNIQUE,"PRINCIPAL_NOT_UNIQUE" },
|
||||
{ KERB_ERR_NULL_KEY, "NULL_KEY"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ c_print(register const u_char *s, register const u_char *ep)
|
||||
register int flag;
|
||||
|
||||
flag = 1;
|
||||
while (ep == NULL || s < ep) {
|
||||
while (s < ep) {
|
||||
c = *s++;
|
||||
if (c == '\0') {
|
||||
flag = 0;
|
||||
@ -152,27 +152,26 @@ c_print(register const u_char *s, register const u_char *ep)
|
||||
}
|
||||
if (flag)
|
||||
return NULL;
|
||||
return(s);
|
||||
return (s);
|
||||
}
|
||||
|
||||
const u_char *
|
||||
krb4_print_hdr(const u_char *cp)
|
||||
{
|
||||
cp+=2;
|
||||
cp += 2;
|
||||
|
||||
#define PRINT if ((cp=c_print(cp, snapend))==NULL) goto trunc
|
||||
#define PRINT if ((cp = c_print(cp, snapend)) == NULL) goto trunc
|
||||
|
||||
TCHECK2(cp, 0);
|
||||
PRINT;
|
||||
TCHECK2(cp, 0);
|
||||
putchar('.'); PRINT;
|
||||
TCHECK2(cp, 0);
|
||||
putchar('@'); PRINT;
|
||||
return(cp);
|
||||
putchar('.');
|
||||
PRINT;
|
||||
putchar('@');
|
||||
PRINT;
|
||||
return (cp);
|
||||
|
||||
trunc:
|
||||
fputs(tstr, stdout);
|
||||
return(NULL);
|
||||
return (NULL);
|
||||
|
||||
#undef PRINT
|
||||
}
|
||||
@ -184,7 +183,7 @@ krb4_print(const u_char *cp)
|
||||
u_char type;
|
||||
u_short len;
|
||||
|
||||
#define PRINT if ((cp=c_print(cp, snapend))==NULL) goto trunc
|
||||
#define PRINT if ((cp = c_print(cp, snapend)) == NULL) goto trunc
|
||||
/* True if struct krb is little endian */
|
||||
#define IS_LENDIAN(kp) (((kp)->type & 0x01) != 0)
|
||||
#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? vtohsp(cp) : ntohsp(cp))
|
||||
@ -206,46 +205,41 @@ krb4_print(const u_char *cp)
|
||||
case AUTH_MSG_KDC_REQUEST:
|
||||
if ((cp = krb4_print_hdr(cp)) == NULL)
|
||||
return;
|
||||
cp += 4; /* ctime */
|
||||
TCHECK2(cp, 0);
|
||||
printf(" %dmin ", *cp++ * 5);
|
||||
TCHECK2(cp, 0);
|
||||
PRINT;
|
||||
TCHECK2(cp, 0);
|
||||
putchar('.'); PRINT;
|
||||
break;
|
||||
cp += 4; /* ctime */
|
||||
TCHECK(*cp);
|
||||
printf(" %dmin ", *cp++ * 5);
|
||||
PRINT;
|
||||
putchar('.');
|
||||
PRINT;
|
||||
break;
|
||||
|
||||
case AUTH_MSG_APPL_REQUEST:
|
||||
cp += 2;
|
||||
TCHECK2(cp, 0);
|
||||
TCHECK(*cp);
|
||||
printf("v%d ", *cp++);
|
||||
TCHECK2(cp, 0);
|
||||
PRINT;
|
||||
TCHECK2(cp, 0);
|
||||
TCHECK(*cp);
|
||||
printf(" (%d)", *cp++);
|
||||
TCHECK2(cp, 0);
|
||||
TCHECK(*cp);
|
||||
printf(" (%d)", *cp);
|
||||
TCHECK2(cp, 0);
|
||||
break;
|
||||
|
||||
case AUTH_MSG_KDC_REPLY:
|
||||
if ((cp = krb4_print_hdr(cp)) == NULL)
|
||||
return;
|
||||
cp += 10; /* timestamp + n + exp + kvno */
|
||||
TCHECK2(cp, 0);
|
||||
TCHECK2(*cp, sizeof(short));
|
||||
len = KTOHSP(kp, cp);
|
||||
printf(" (%d)", len);
|
||||
TCHECK2(cp, 0);
|
||||
break;
|
||||
|
||||
case AUTH_MSG_ERR_REPLY:
|
||||
if ((cp = krb4_print_hdr(cp)) == NULL)
|
||||
return;
|
||||
cp += 4; /* timestamp */
|
||||
TCHECK2(cp, 0);
|
||||
TCHECK2(*cp, sizeof(short));
|
||||
printf(" %s ", tok2str(kerr2str, NULL, KTOHSP(kp, cp)));
|
||||
cp += 4;
|
||||
TCHECK2(cp, 0);
|
||||
PRINT;
|
||||
break;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 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
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-llc.c,v 1.22 96/12/10 23:23:37 leres Exp $";
|
||||
"@(#) $Header: print-llc.c,v 1.24 97/01/01 20:56:48 leres Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -34,7 +34,6 @@ static const char rcsid[] =
|
||||
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-nfs.c,v 1.63 96/12/10 23:18:07 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-nfs.c,v 1.65 97/08/17 13:24:22 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -55,7 +55,8 @@ struct rtentry;
|
||||
|
||||
static void nfs_printfh(const u_int32_t *);
|
||||
static void xid_map_enter(const struct rpc_msg *, const struct ip *);
|
||||
static int32_t xid_map_find(const struct rpc_msg *, const struct ip *);
|
||||
static u_int32_t xid_map_find(const struct rpc_msg *, const struct ip *,
|
||||
u_int32_t *);
|
||||
static void interp_reply(const struct rpc_msg *, u_int32_t, u_int);
|
||||
|
||||
static int nfserr; /* true if we error rather than trunc */
|
||||
@ -66,14 +67,14 @@ nfsreply_print(register const u_char *bp, u_int length,
|
||||
{
|
||||
register const struct rpc_msg *rp;
|
||||
register const struct ip *ip;
|
||||
int32_t proc;
|
||||
u_int32_t proc;
|
||||
|
||||
nfserr = 0; /* assume no error */
|
||||
rp = (const struct rpc_msg *)bp;
|
||||
ip = (const struct ip *)bp2;
|
||||
|
||||
if (!nflag)
|
||||
(void)printf("%s.nfs > %s.%x: reply %s %d",
|
||||
(void)printf("%s.nfs > %s.%u: reply %s %d",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
(u_int32_t)ntohl(rp->rm_xid),
|
||||
@ -81,7 +82,7 @@ nfsreply_print(register const u_char *bp, u_int length,
|
||||
"ok":"ERR",
|
||||
length);
|
||||
else
|
||||
(void)printf("%s.%x > %s.%x: reply %s %d",
|
||||
(void)printf("%s.%u > %s.%u: reply %s %d",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
NFS_PORT,
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
@ -90,9 +91,8 @@ nfsreply_print(register const u_char *bp, u_int length,
|
||||
"ok":"ERR",
|
||||
length);
|
||||
|
||||
proc = xid_map_find(rp, ip);
|
||||
if (proc >= 0)
|
||||
interp_reply(rp, (u_int32_t)proc, length);
|
||||
if (xid_map_find(rp, ip, &proc))
|
||||
interp_reply(rp, proc, length);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -197,13 +197,13 @@ nfsreq_print(register const u_char *bp, u_int length,
|
||||
rp = (const struct rpc_msg *)bp;
|
||||
ip = (const struct ip *)bp2;
|
||||
if (!nflag)
|
||||
(void)printf("%s.%x > %s.nfs: %d",
|
||||
(void)printf("%s.%u > %s.nfs: %d",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
(u_int32_t)ntohl(rp->rm_xid),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
length);
|
||||
else
|
||||
(void)printf("%s.%x > %s.%x: %d",
|
||||
(void)printf("%s.%u > %s.%u: %d",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
(u_int32_t)ntohl(rp->rm_xid),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
@ -457,9 +457,9 @@ xid_map_enter(const struct rpc_msg *rp, const struct ip *ip)
|
||||
xmep->proc = ntohl(rp->rm_call.cb_proc);
|
||||
}
|
||||
|
||||
/* Returns NFSPROC_xxx or -1 on failure */
|
||||
static int32_t
|
||||
xid_map_find(const struct rpc_msg *rp, const struct ip *ip)
|
||||
/* Returns true and sets proc success or false on failure */
|
||||
static u_int32_t
|
||||
xid_map_find(const struct rpc_msg *rp, const struct ip *ip, u_int32_t *proc)
|
||||
{
|
||||
int i;
|
||||
struct xid_map_entry *xmep;
|
||||
@ -475,14 +475,15 @@ xid_map_find(const struct rpc_msg *rp, const struct ip *ip)
|
||||
xmep->server.s_addr == sip) {
|
||||
/* match */
|
||||
xid_map_hint = i;
|
||||
return ((int32_t)xmep->proc);
|
||||
*proc = xmep->proc;
|
||||
return (1);
|
||||
}
|
||||
if (++i >= XIDMAPSIZE)
|
||||
i = 0;
|
||||
} while (i != xid_map_hint);
|
||||
|
||||
/* search failed */
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-ntp.c,v 1.25 96/11/05 13:30:37 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-ntp.c,v 1.26 97/06/13 12:56:37 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -47,7 +47,9 @@ struct rtentry;
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#ifdef MODEMASK
|
||||
#undef MODEMASK /* Solaris sucks */
|
||||
#endif
|
||||
#include "ntp.h"
|
||||
|
||||
static void p_sfix(const struct s_fixedpt *);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1991, 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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-null.c,v 1.22 96/12/10 23:18:58 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-null.c,v 1.24 97/05/28 12:52:47 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -50,15 +50,19 @@ struct rtentry;
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "addrtoname.h"
|
||||
#include "interface.h"
|
||||
|
||||
#define NULL_HDRLEN 4
|
||||
#include "addrtoname.h"
|
||||
|
||||
#ifndef AF_NS
|
||||
#define AF_NS 6 /* XEROX NS protocols */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The DLT_NULL packet header is 4 bytes long. It contains a network
|
||||
* order 32 bit integer that specifies the family, e.g. AF_INET
|
||||
*/
|
||||
#define NULL_HDRLEN 4
|
||||
|
||||
static void
|
||||
null_print(const u_char *p, const struct ip *ip, u_int length)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-ospf.c,v 1.23 96/12/10 23:15:46 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-ospf.c,v 1.24 97/04/26 13:31:46 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -215,11 +215,7 @@ ospf_print_lsa(register const struct lsa *lsap)
|
||||
TCHECK(lsap->lsa_un.un_rla.rla_link);
|
||||
rlp = lsap->lsa_un.un_rla.rla_link;
|
||||
while (j--) {
|
||||
register struct rlalink *rln =
|
||||
(struct rlalink *)((u_char *)(rlp + 1) +
|
||||
((rlp->link_toscount) * sizeof(*tosp)));
|
||||
|
||||
TCHECK(*rln);
|
||||
TCHECK(*rlp);
|
||||
printf(" {"); /* } (ctags) */
|
||||
switch (rlp->link_type) {
|
||||
|
||||
@ -262,7 +258,8 @@ ospf_print_lsa(register const struct lsa *lsap)
|
||||
}
|
||||
/* { (ctags) */
|
||||
printf(" }");
|
||||
rlp = rln;
|
||||
rlp = (struct rlalink *)((u_char *)(rlp + 1) +
|
||||
((rlp->link_toscount) * sizeof(*tosp)));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -514,6 +511,13 @@ ospf_print(register const u_char *bp, register u_int length,
|
||||
ipaddr_string(&ip->ip_src),
|
||||
ipaddr_string(&ip->ip_dst));
|
||||
|
||||
/* XXX Before we do anything else, strip off the MD5 trailer */
|
||||
TCHECK(op->ospf_authtype);
|
||||
if (ntohs(op->ospf_authtype) == OSPF_AUTH_MD5) {
|
||||
length -= OSPF_AUTH_MD5_LEN;
|
||||
snapend -= OSPF_AUTH_MD5_LEN;
|
||||
}
|
||||
|
||||
/* If the type is valid translate it, or just print the type */
|
||||
/* value. If it's not valid, say so and return */
|
||||
TCHECK(op->ospf_type);
|
||||
@ -555,6 +559,10 @@ ospf_print(register const u_char *bp, register u_int length,
|
||||
printf("\"");
|
||||
break;
|
||||
|
||||
case OSPF_AUTH_MD5:
|
||||
printf(" auth MD5");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" ??authtype-%d??", ntohs(op->ospf_authtype));
|
||||
return;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1990, 1991, 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
|
||||
@ -21,10 +21,9 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-ppp.c,v 1.24 96/12/10 23:23:12 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-ppp.c,v 1.26 97/06/12 14:21:29 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef PPP
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
@ -44,15 +43,16 @@ struct rtentry;
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <pcap.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ppp.h"
|
||||
|
||||
/* XXX This goes somewhere else. */
|
||||
#define PPP_HDRLEN 4
|
||||
|
||||
/* Standard PPP printer */
|
||||
void
|
||||
ppp_if_print(u_char *user, const struct pcap_pkthdr *h,
|
||||
register const u_char *p)
|
||||
@ -89,17 +89,80 @@ ppp_if_print(u_char *user, const struct pcap_pkthdr *h,
|
||||
out:
|
||||
putchar('\n');
|
||||
}
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <stdio.h>
|
||||
/* proto type to string mapping */
|
||||
static struct tok ptype2str[] = {
|
||||
{ PPP_VJC, "VJC" },
|
||||
{ PPP_VJNC, "VJNC" },
|
||||
{ PPP_OSI, "OSI" },
|
||||
{ PPP_LCP, "LCP" },
|
||||
{ PPP_IPCP, "IPCP" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#include "interface.h"
|
||||
#define PPP_BSDI_HDRLEN 24
|
||||
|
||||
/* BSD/OS specific PPP printer */
|
||||
void
|
||||
ppp_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
ppp_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h,
|
||||
register const u_char *p)
|
||||
{
|
||||
error("not configured for ppp");
|
||||
/* NOTREACHED */
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
register int hdrlength;
|
||||
u_short ptype;
|
||||
|
||||
ts_print(&h->ts);
|
||||
|
||||
if (caplen < PPP_BSDI_HDRLEN) {
|
||||
printf("[|ppp]");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Some printers want to get back at the link level addresses,
|
||||
* and/or check that they're not walking off the end of the packet.
|
||||
* Rather than pass them all the way down, we set these globals.
|
||||
*/
|
||||
packetp = p;
|
||||
snapend = p + caplen;
|
||||
hdrlength = 0;
|
||||
|
||||
if (p[0] == PPP_ADDRESS && p[1] == PPP_CONTROL) {
|
||||
if (eflag)
|
||||
printf("%02x %02x ", p[0], p[1]);
|
||||
p += 2;
|
||||
hdrlength = 2;
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
printf("%d ", length);
|
||||
/* Retrieve the protocol type */
|
||||
if (*p & 01) {
|
||||
/* Compressed protocol field */
|
||||
ptype = *p;
|
||||
if (eflag)
|
||||
printf("%02x ", ptype);
|
||||
p++;
|
||||
hdrlength += 1;
|
||||
} else {
|
||||
/* Un-compressed protocol field */
|
||||
ptype = ntohs(*(u_short *)p);
|
||||
if (eflag)
|
||||
printf("%04x ", ptype);
|
||||
p += 2;
|
||||
hdrlength += 2;
|
||||
}
|
||||
|
||||
length -= hdrlength;
|
||||
|
||||
if (ptype == PPP_IP)
|
||||
ip_print(p, length);
|
||||
else
|
||||
printf("%s ", tok2str(ptype2str, "proto-#%d", ptype));
|
||||
|
||||
if (xflag)
|
||||
default_print((const u_char *)p, caplen - hdrlength);
|
||||
out:
|
||||
putchar('\n');
|
||||
}
|
||||
#endif
|
||||
|
88
contrib/tcpdump/print-raw.c
Normal file
88
contrib/tcpdump/print-raw.c
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-raw.c,v 1.22 96/12/10 23:18:58 leres Locked $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
|
||||
#include <pcap.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "addrtoname.h"
|
||||
#include "interface.h"
|
||||
|
||||
#ifndef AF_NS
|
||||
#define AF_NS 6 /* XEROX NS protocols */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The DLT_RAW packet has no header. It contains a raw IP packet.
|
||||
*/
|
||||
|
||||
void
|
||||
raw_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
u_int length = h->len;
|
||||
u_int caplen = h->caplen;
|
||||
|
||||
ts_print(&h->ts);
|
||||
|
||||
/*
|
||||
* Some printers want to get back at the link level addresses,
|
||||
* and/or check that they're not walking off the end of the packet.
|
||||
* Rather than pass them all the way down, we set these globals.
|
||||
*/
|
||||
packetp = p;
|
||||
snapend = p + caplen;
|
||||
|
||||
if (eflag)
|
||||
printf("ip: ");
|
||||
|
||||
ip_print(p, length);
|
||||
|
||||
if (xflag)
|
||||
default_print(p, caplen);
|
||||
putchar('\n');
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1989, 1990, 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1989, 1990, 1991, 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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-sl.c,v 1.41 96/12/10 23:19:42 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-sl.c,v 1.42 97/06/12 14:21:35 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NET_SLIP_H
|
||||
@ -54,7 +54,6 @@ struct rtentry;
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <pcap.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
@ -75,6 +74,8 @@ static void compressed_sl_print(const u_char *, const struct ip *, u_int, int);
|
||||
#define CHDR_LEN (SLC_BPFHDR - SLC_BPFHDRLEN)
|
||||
#endif
|
||||
|
||||
/* XXX needs more hacking to work right */
|
||||
|
||||
void
|
||||
sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
@ -111,6 +112,45 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
register u_int caplen = h->caplen;
|
||||
register u_int length = h->len;
|
||||
register const struct ip *ip;
|
||||
|
||||
ts_print(&h->ts);
|
||||
|
||||
if (caplen < SLIP_HDRLEN) {
|
||||
printf("[|slip]");
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Some printers want to get back at the link level addresses,
|
||||
* and/or check that they're not walking off the end of the packet.
|
||||
* Rather than pass them all the way down, we set these globals.
|
||||
*/
|
||||
packetp = p;
|
||||
snapend = p + caplen;
|
||||
|
||||
length -= SLIP_HDRLEN;
|
||||
|
||||
ip = (struct ip *)(p + SLIP_HDRLEN);
|
||||
|
||||
#ifdef notdef
|
||||
if (eflag)
|
||||
sliplink_print(p, ip, length);
|
||||
#endif
|
||||
|
||||
ip_print((u_char *)ip, length);
|
||||
|
||||
if (xflag)
|
||||
default_print((u_char *)ip, caplen - SLIP_HDRLEN);
|
||||
out:
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
static void
|
||||
sliplink_print(register const u_char *p, register const struct ip *ip,
|
||||
register u_int length)
|
||||
@ -247,6 +287,7 @@ compressed_sl_print(const u_char *chdr, const struct ip *ip,
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
void
|
||||
sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
@ -254,4 +295,12 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
error("not configured for slip");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
void
|
||||
sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
|
||||
error("not configured for slip");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -26,7 +26,7 @@
|
||||
*
|
||||
# Los Alamos National Laboratory
|
||||
#
|
||||
# Copyright, 1990. The Regents of the University of California.
|
||||
# Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
|
||||
# This software was produced under a U.S. Government contract
|
||||
# (W-7405-ENG-36) by Los Alamos National Laboratory, which is
|
||||
# operated by the University of California for the U.S. Department
|
||||
@ -42,14 +42,17 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-snmp.c,v 1.31 96/12/10 23:22:55 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-snmp.c,v 1.33 97/06/15 13:20:28 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-sunrpc.c,v 1.25 96/09/26 23:36:49 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-sunrpc.c,v 1.26 96/12/31 21:27:43 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -119,7 +119,7 @@ progstr(prog)
|
||||
{
|
||||
register struct rpcent *rp;
|
||||
static char buf[32];
|
||||
static lastprog = 0;
|
||||
static int lastprog = 0;
|
||||
|
||||
if (lastprog != 0 && prog == lastprog)
|
||||
return (buf);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-tcp.c,v 1.52 96/12/03 10:59:55 vern Exp $ (LBL)";
|
||||
"@(#) $Header: print-tcp.c,v 1.55 97/06/15 13:20:28 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -34,6 +34,9 @@ static const char rcsid[] =
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1990, 1991, 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-tftp.c,v 1.28 96/09/26 23:36:50 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-tftp.c,v 1.30 97/06/13 12:57:12 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -31,6 +31,9 @@ static const char rcsid[] =
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifdef SEGSIZE
|
||||
#undef SEGSIZE /* SINIX sucks */
|
||||
#endif
|
||||
#include <arpa/tftp.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-udp.c,v 1.58 96/12/10 23:22:07 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-udp.c,v 1.60 97/07/27 21:58:48 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -35,9 +35,16 @@ static const char rcsid[] =
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
|
||||
#ifdef NOERROR
|
||||
#undef NOERROR /* Solaris sucks */
|
||||
#endif
|
||||
#ifdef T_UNSPEC
|
||||
#undef T_UNSPEC /* SINIX does too */
|
||||
#endif
|
||||
#include <arpa/nameser.h>
|
||||
#ifdef SEGSIZE
|
||||
#undef SEGSIZE
|
||||
#endif
|
||||
#include <arpa/tftp.h>
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-wb.c,v 1.23 96/12/10 23:21:43 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-wb.c,v 1.24 96/12/31 21:27:44 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -182,9 +182,9 @@ wb_id(const struct pkt_id *id, u_int len)
|
||||
int nid;
|
||||
|
||||
printf(" wb-id:");
|
||||
len -= sizeof(*id);
|
||||
if (len < 0 || (u_char *)(id + 1) > snapend)
|
||||
if (len < sizeof(*id) || (u_char *)(id + 1) > snapend)
|
||||
return (-1);
|
||||
len -= sizeof(*id);
|
||||
|
||||
printf(" %u/%s:%u (max %u/%s:%u) ",
|
||||
(u_int32_t)ntohl(id->pi_ps.slot),
|
||||
@ -338,9 +338,9 @@ wb_rrep(const struct pkt_rrep *rrep, u_int len)
|
||||
const struct pkt_dop *dop = &rrep->pr_dop;
|
||||
|
||||
printf(" wb-rrep:");
|
||||
len -= sizeof(*rrep);
|
||||
if (len < 0 || (u_char *)(rrep + 1) > snapend)
|
||||
if (len < sizeof(*rrep) || (u_char *)(rrep + 1) > snapend)
|
||||
return (-1);
|
||||
len -= sizeof(*rrep);
|
||||
|
||||
printf(" for %s %s:%u<%u:%u>",
|
||||
ipaddr_string(&rrep->pr_id),
|
||||
@ -359,9 +359,9 @@ static int
|
||||
wb_drawop(const struct pkt_dop *dop, u_int len)
|
||||
{
|
||||
printf(" wb-dop:");
|
||||
len -= sizeof(*dop);
|
||||
if (len < 0 || (u_char *)(dop + 1) > snapend)
|
||||
if (len < sizeof(*dop) || (u_char *)(dop + 1) > snapend)
|
||||
return (-1);
|
||||
len -= sizeof(*dop);
|
||||
|
||||
printf(" %s:%u<%u:%u>",
|
||||
ipaddr_string(&dop->pd_page.p_sid),
|
||||
@ -384,50 +384,52 @@ wb_print(register const void *hdr, register u_int len)
|
||||
register const struct pkt_hdr *ph;
|
||||
|
||||
ph = (const struct pkt_hdr *)hdr;
|
||||
len -= sizeof(*ph);
|
||||
if (len < 0 || (u_char *)(ph + 1) <= snapend) {
|
||||
if (ph->ph_flags)
|
||||
printf("*");
|
||||
switch (ph->ph_type) {
|
||||
|
||||
case PT_KILL:
|
||||
printf(" wb-kill");
|
||||
return;
|
||||
|
||||
case PT_ID:
|
||||
if (wb_id((struct pkt_id *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
case PT_RREQ:
|
||||
if (wb_rreq((struct pkt_rreq *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
case PT_RREP:
|
||||
if (wb_rrep((struct pkt_rrep *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
case PT_DRAWOP:
|
||||
if (wb_drawop((struct pkt_dop *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
case PT_PREQ:
|
||||
if (wb_preq((struct pkt_preq *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
case PT_PREP:
|
||||
if (wb_prep((struct pkt_prep *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" wb-%d!", ph->ph_type);
|
||||
return;
|
||||
}
|
||||
if (len < sizeof(*ph) || (u_char *)(ph + 1) > snapend) {
|
||||
printf("[|wb]");
|
||||
return;
|
||||
}
|
||||
len -= sizeof(*ph);
|
||||
|
||||
if (ph->ph_flags)
|
||||
printf("*");
|
||||
switch (ph->ph_type) {
|
||||
|
||||
case PT_KILL:
|
||||
printf(" wb-kill");
|
||||
return;
|
||||
|
||||
case PT_ID:
|
||||
if (wb_id((struct pkt_id *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
case PT_RREQ:
|
||||
if (wb_rreq((struct pkt_rreq *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
case PT_RREP:
|
||||
if (wb_rrep((struct pkt_rrep *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
case PT_DRAWOP:
|
||||
if (wb_drawop((struct pkt_dop *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
case PT_PREQ:
|
||||
if (wb_preq((struct pkt_preq *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
case PT_PREP:
|
||||
if (wb_prep((struct pkt_prep *)(ph + 1), len) >= 0)
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" wb-%d!", ph->ph_type);
|
||||
return;
|
||||
}
|
||||
printf("[|wb]");
|
||||
}
|
||||
|
67
contrib/tcpdump/savestr.c
Normal file
67
contrib/tcpdump/savestr.c
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: savestr.c,v 1.2 97/05/09 14:52:31 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "gnuc.h"
|
||||
#ifdef HAVE_OS_PROTO_H
|
||||
#include "os-proto.h"
|
||||
#endif
|
||||
|
||||
#include "savestr.h"
|
||||
|
||||
/* A replacement for strdup() that cuts down on malloc() overhead */
|
||||
char *
|
||||
savestr(register const char *str)
|
||||
{
|
||||
register u_int size;
|
||||
register char *p;
|
||||
static char *strptr = NULL;
|
||||
static u_int strsize = 0;
|
||||
|
||||
size = strlen(str) + 1;
|
||||
if (size > strsize) {
|
||||
strsize = 1024;
|
||||
if (strsize < size)
|
||||
strsize = size;
|
||||
strptr = (char *)malloc(strsize);
|
||||
if (strptr == NULL) {
|
||||
fprintf(stderr, "savestr: malloc\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
(void)strcpy(strptr, str);
|
||||
p = strptr;
|
||||
strptr += size;
|
||||
strsize -= size;
|
||||
return (p);
|
||||
}
|
24
contrib/tcpdump/savestr.h
Normal file
24
contrib/tcpdump/savestr.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: savestr.h,v 1.1 97/04/22 13:30:21 leres Exp $ (LBL)
|
||||
*/
|
||||
|
||||
extern char *savestr(const char *);
|
78
contrib/tcpdump/setsignal.c
Normal file
78
contrib/tcpdump/setsignal.c
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: setsignal.c,v 1.4 97/06/15 13:20:29 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#ifdef HAVE_SIGACTION
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "gnuc.h"
|
||||
#ifdef HAVE_OS_PROTO_H
|
||||
#include "os-proto.h"
|
||||
#endif
|
||||
|
||||
#include "setsignal.h"
|
||||
|
||||
/*
|
||||
* An os independent signal() with BSD semantics, e.g. the signal
|
||||
* catcher is restored following service of the signal.
|
||||
*
|
||||
* When sigset() is available, signal() has SYSV semantics and sigset()
|
||||
* has BSD semantics and call interface. Unfortunately, Linux does not
|
||||
* have sigset() so we use the more complicated sigaction() interface
|
||||
* there.
|
||||
*
|
||||
* Did I mention that signals suck?
|
||||
*/
|
||||
RETSIGTYPE
|
||||
(*setsignal (int sig, RETSIGTYPE (*func)(int)))(int)
|
||||
{
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction old, new;
|
||||
|
||||
memset(&new, 0, sizeof(new));
|
||||
new.sa_handler = func;
|
||||
#ifdef SA_RESTART
|
||||
new.sa_flags |= SA_RESTART;
|
||||
#endif
|
||||
if (sigaction(sig, &new, &old) < 0)
|
||||
return (SIG_ERR);
|
||||
return (old.sa_handler);
|
||||
|
||||
#else
|
||||
#ifdef HAVE_SIGSET
|
||||
return (sigset(sig, func));
|
||||
#else
|
||||
return (signal(sig, func));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
27
contrib/tcpdump/setsignal.h
Normal file
27
contrib/tcpdump/setsignal.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: setsignal.h,v 1.2 97/06/13 13:10:44 leres Exp $ (LBL)
|
||||
*/
|
||||
#ifndef setsignal_h
|
||||
#define setsignal_h
|
||||
|
||||
RETSIGTYPE (*setsignal(int, RETSIGTYPE (*)(int)))(int);
|
||||
#endif
|
@ -1,6 +1,6 @@
|
||||
.\" @(#) $Header: tcpdump.1,v 1.65 96/11/29 01:03:01 leres Exp $ (LBL)
|
||||
.\" @(#) $Header: tcpdump.1,v 1.67 97/06/30 16:31:50 leres Exp $ (LBL)
|
||||
.\"
|
||||
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996
|
||||
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
@ -20,14 +20,14 @@
|
||||
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.\"
|
||||
.TH TCPDUMP 1 "29 November 1996"
|
||||
.TH TCPDUMP 1 "30 June 1997"
|
||||
.SH NAME
|
||||
tcpdump \- dump traffic on a network
|
||||
.SH SYNOPSIS
|
||||
.na
|
||||
.B tcpdump
|
||||
[
|
||||
.B \-deflnNOpqStvx
|
||||
.B \-adeflnNOpqStvx
|
||||
] [
|
||||
.B \-c
|
||||
.I count
|
||||
@ -72,7 +72,7 @@ that match the boolean \fIexpression\fP.
|
||||
To run
|
||||
.I tcpdump
|
||||
you must have read access to
|
||||
.I /dev/net
|
||||
.I /dev/nit
|
||||
or
|
||||
.IR /dev/bpf* .
|
||||
.B Under Solaris with dlpi:
|
||||
@ -94,6 +94,9 @@ You must have read access to
|
||||
.IR /dev/bpf* .
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-a
|
||||
Attempt to convert network and broadcast addresses to names.
|
||||
.TP
|
||||
.B \-c
|
||||
Exit after receiving \fIcount\fP packets.
|
||||
.TP
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -21,10 +21,10 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char copyright[] =
|
||||
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996\n\
|
||||
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: tcpdump.c,v 1.118 96/12/10 23:22:27 leres Exp $ (LBL)";
|
||||
"@(#) $Header: tcpdump.c,v 1.129 97/06/13 13:10:11 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -50,21 +50,25 @@ static const char rcsid[] =
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "machdep.h"
|
||||
#include "setsignal.h"
|
||||
#include "gmt2local.h"
|
||||
|
||||
int aflag; /* translate network and broadcast addresses */
|
||||
int dflag; /* print filter code */
|
||||
int eflag; /* print ethernet header */
|
||||
int fflag; /* don't translate "foreign" IP address */
|
||||
int nflag; /* leave addresses as numbers */
|
||||
int Nflag; /* remove domains from printed host names */
|
||||
int Oflag = 1; /* run filter code optimizer */
|
||||
int pflag; /* don't go promiscuous */
|
||||
int qflag; /* quick (shorter) output */
|
||||
int Sflag; /* print raw TCP sequence numbers */
|
||||
int tflag = 1; /* print packet arrival time */
|
||||
int eflag; /* print ethernet header */
|
||||
int vflag; /* verbose */
|
||||
int xflag; /* print packet in hex */
|
||||
int Oflag = 1; /* run filter code optimizer */
|
||||
int Sflag; /* print raw TCP sequence numbers */
|
||||
|
||||
int packettype;
|
||||
|
||||
int dflag; /* print filter code */
|
||||
|
||||
char *program_name;
|
||||
|
||||
@ -85,18 +89,16 @@ struct printer {
|
||||
int type;
|
||||
};
|
||||
|
||||
/* XXX needed if using old bpf.h */
|
||||
#ifndef DLT_ATM_RFC1483
|
||||
#define DLT_ATM_RFC1483 11
|
||||
#endif
|
||||
|
||||
static struct printer printers[] = {
|
||||
{ ether_if_print, DLT_EN10MB },
|
||||
{ ether_if_print, DLT_IEEE802 },
|
||||
{ sl_if_print, DLT_SLIP },
|
||||
{ sl_bsdos_if_print, DLT_SLIP_BSDOS },
|
||||
{ ppp_if_print, DLT_PPP },
|
||||
{ ppp_bsdos_if_print, DLT_PPP_BSDOS },
|
||||
{ fddi_if_print, DLT_FDDI },
|
||||
{ null_if_print, DLT_NULL },
|
||||
{ raw_if_print, DLT_RAW },
|
||||
{ atm_if_print, DLT_ATM_RFC1483 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
@ -128,6 +130,7 @@ main(int argc, char **argv)
|
||||
register char *cp, *infile, *cmdbuf, *device, *RFileName, *WFileName;
|
||||
pcap_handler printer;
|
||||
struct bpf_program fcode;
|
||||
RETSIGTYPE (*oldhandler)(int);
|
||||
u_char *pcap_userdata;
|
||||
char ebuf[PCAP_ERRBUF_SIZE];
|
||||
|
||||
@ -145,8 +148,14 @@ main(int argc, char **argv)
|
||||
error("%s", ebuf);
|
||||
|
||||
opterr = 0;
|
||||
while ((op = getopt(argc, argv, "c:defF:i:lnNOpqr:s:StT:vw:xY")) != EOF)
|
||||
while (
|
||||
(op = getopt(argc, argv, "ac:defF:i:lnNOpqr:s:StT:vw:xY")) != EOF)
|
||||
switch (op) {
|
||||
|
||||
case 'a':
|
||||
++aflag;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
cnt = atoi(optarg);
|
||||
if (cnt <= 0)
|
||||
@ -259,8 +268,11 @@ main(int argc, char **argv)
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
if (aflag && nflag)
|
||||
error("-a and -n options are incompatible");
|
||||
|
||||
if (tflag > 0)
|
||||
thiszone = gmt2local();
|
||||
thiszone = gmt2local(0);
|
||||
|
||||
if (RFileName != NULL) {
|
||||
/*
|
||||
@ -291,8 +303,11 @@ main(int argc, char **argv)
|
||||
warning("snaplen raised from %d to %d", snaplen, i);
|
||||
snaplen = i;
|
||||
}
|
||||
if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0)
|
||||
error("%s", ebuf);
|
||||
if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0) {
|
||||
localnet = 0;
|
||||
netmask = 0;
|
||||
warning("%s", ebuf);
|
||||
}
|
||||
/*
|
||||
* Let user own process after socket has been opened.
|
||||
*/
|
||||
@ -309,11 +324,13 @@ main(int argc, char **argv)
|
||||
bpf_dump(&fcode, dflag);
|
||||
exit(0);
|
||||
}
|
||||
init_addrtoname(fflag, localnet, netmask);
|
||||
init_addrtoname(localnet, netmask);
|
||||
|
||||
(void)signal(SIGTERM, cleanup);
|
||||
(void)signal(SIGINT, cleanup);
|
||||
(void)signal(SIGHUP, cleanup);
|
||||
(void)setsignal(SIGTERM, cleanup);
|
||||
(void)setsignal(SIGINT, cleanup);
|
||||
/* Cooperate with nohup(1) */
|
||||
if ((oldhandler = setsignal(SIGHUP, cleanup)) != SIG_DFL)
|
||||
(void)setsignal(SIGHUP, oldhandler);
|
||||
|
||||
if (pcap_setfilter(pd, &fcode) < 0)
|
||||
error("%s", pcap_geterr(pd));
|
||||
@ -386,6 +403,11 @@ default_print_unaligned(register const u_char *cp, register u_int length)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* By default, print the packet out in hex.
|
||||
*
|
||||
* (BTW, please don't send us patches to print the packet out in ascii)
|
||||
*/
|
||||
void
|
||||
default_print(register const u_char *bp, register u_int length)
|
||||
{
|
||||
@ -416,10 +438,12 @@ __dead void
|
||||
usage(void)
|
||||
{
|
||||
extern char version[];
|
||||
extern char pcap_version[];
|
||||
|
||||
(void)fprintf(stderr, "Version %s\n", version);
|
||||
(void)fprintf(stderr, "%s version %s\n", program_name, version);
|
||||
(void)fprintf(stderr, "libpcap version %s\n", pcap_version);
|
||||
(void)fprintf(stderr,
|
||||
"Usage: tcpdump [-deflnNOpqStvx] [-c count] [ -F file ]\n");
|
||||
"Usage: %s [-adeflnNOpqStvx] [-c count] [ -F file ]\n", program_name);
|
||||
(void)fprintf(stderr,
|
||||
"\t\t[ -i interface ] [ -r file ] [ -s snaplen ]\n");
|
||||
(void)fprintf(stderr,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1990, 1991, 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
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: util.c,v 1.55 96/09/26 23:36:51 leres Exp $ (LBL)";
|
||||
"@(#) $Header: util.c,v 1.58 97/05/09 14:52:17 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -34,6 +34,9 @@ static const char rcsid[] =
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <pcap.h>
|
||||
#include <stdio.h>
|
||||
#if __STDC__
|
||||
@ -246,31 +249,6 @@ copy_argv(register char **argv)
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* A replacement for strdup() that cuts down on malloc() overhead */
|
||||
char *
|
||||
savestr(register const char *str)
|
||||
{
|
||||
register u_int size;
|
||||
register char *p;
|
||||
static char *strptr = NULL;
|
||||
static u_int strsize = 0;
|
||||
|
||||
size = strlen(str) + 1;
|
||||
if (size > strsize) {
|
||||
strsize = 1024;
|
||||
if (strsize < size)
|
||||
strsize = size;
|
||||
strptr = (char *)malloc(strsize);
|
||||
if (strptr == NULL)
|
||||
error("savestr: malloc");
|
||||
}
|
||||
(void)strcpy(strptr, str);
|
||||
p = strptr;
|
||||
strptr += size;
|
||||
strsize -= size;
|
||||
return (p);
|
||||
}
|
||||
|
||||
char *
|
||||
read_infile(char *fname)
|
||||
{
|
||||
@ -295,35 +273,3 @@ read_infile(char *fname)
|
||||
|
||||
return (cp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the difference between gmt and local time in seconds.
|
||||
* Use gmtime() and localtime() to keep things simple.
|
||||
*/
|
||||
int32_t
|
||||
gmt2local(void)
|
||||
{
|
||||
register int dt, dir;
|
||||
register struct tm *gmt, *loc;
|
||||
time_t t;
|
||||
struct tm sgmt;
|
||||
|
||||
t = time(NULL);
|
||||
gmt = &sgmt;
|
||||
*gmt = *gmtime(&t);
|
||||
loc = localtime(&t);
|
||||
dt = (loc->tm_hour - gmt->tm_hour) * 60 * 60 +
|
||||
(loc->tm_min - gmt->tm_min) * 60;
|
||||
|
||||
/*
|
||||
* If the year or julian day is different, we span 00:00 GMT
|
||||
* and must add or subtract a day. Check the year first to
|
||||
* avoid problems when the julian day wraps.
|
||||
*/
|
||||
dir = loc->tm_year - gmt->tm_year;
|
||||
if (dir == 0)
|
||||
dir = loc->tm_yday - gmt->tm_yday;
|
||||
dt += dir * 24 * 60 * 60;
|
||||
|
||||
return (dt);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user