This commit was generated by cvs2svn to compensate for changes in r39297,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
90dc276c84
@ -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,11 +113,12 @@ 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 -hbxn $(SRC) | \
|
||||
@ -127,7 +136,7 @@ tags: $(TAGFILES)
|
||||
ctags -wtd $(TAGFILES)
|
||||
|
||||
tar: force
|
||||
@cwd=`pwd` ; dir=`basename $$cwd` ; name=tcpdump-`cat VERSION` ; \
|
||||
@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 \
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
1617
contrib/tcpdump/configure
vendored
1617
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
|
||||
;;
|
||||
|
||||
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 @@
|
||||
/*
|
||||
* 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 /* */
|
||||
|
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) 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) 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) 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>
|
||||
@ -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;
|
||||
@ -162,12 +162,11 @@ krb4_print_hdr(const u_char *cp)
|
||||
|
||||
#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;
|
||||
putchar('.');
|
||||
PRINT;
|
||||
putchar('@');
|
||||
PRINT;
|
||||
return (cp);
|
||||
|
||||
trunc:
|
||||
@ -207,45 +206,40 @@ krb4_print(const u_char *cp)
|
||||
if ((cp = krb4_print_hdr(cp)) == NULL)
|
||||
return;
|
||||
cp += 4; /* ctime */
|
||||
TCHECK2(cp, 0);
|
||||
TCHECK(*cp);
|
||||
printf(" %dmin ", *cp++ * 5);
|
||||
TCHECK2(cp, 0);
|
||||
PRINT;
|
||||
TCHECK2(cp, 0);
|
||||
putchar('.'); 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
|
||||
@ -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;
|
||||
|
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) 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"
|
||||
|
@ -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>
|
||||
|
@ -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,8 +384,12 @@ wb_print(register const void *hdr, register u_int len)
|
||||
register const struct pkt_hdr *ph;
|
||||
|
||||
ph = (const struct pkt_hdr *)hdr;
|
||||
if (len < sizeof(*ph) || (u_char *)(ph + 1) > snapend) {
|
||||
printf("[|wb]");
|
||||
return;
|
||||
}
|
||||
len -= sizeof(*ph);
|
||||
if (len < 0 || (u_char *)(ph + 1) <= snapend) {
|
||||
|
||||
if (ph->ph_flags)
|
||||
printf("*");
|
||||
switch (ph->ph_type) {
|
||||
@ -429,5 +433,3 @@ wb_print(register const void *hdr, register u_int len)
|
||||
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,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