From cfc42b58f229425374e675f86614cf26ffa356e4 Mon Sep 17 00:00:00 2001 From: fenner Date: Tue, 15 Sep 1998 19:36:32 +0000 Subject: Virgin import of LBL tcpdump v3.4 --- contrib/tcpdump/CHANGES | 73 ++- contrib/tcpdump/FILES | 11 +- contrib/tcpdump/INSTALL | 18 +- contrib/tcpdump/Makefile.in | 49 +- contrib/tcpdump/README | 51 +- contrib/tcpdump/VERSION | 2 +- contrib/tcpdump/aclocal.m4 | 411 +++++++++--- contrib/tcpdump/addrtoname.c | 34 +- contrib/tcpdump/addrtoname.h | 6 +- contrib/tcpdump/configure | 1307 +++++++++++++++++++++++-------------- contrib/tcpdump/configure.in | 86 +-- contrib/tcpdump/gmt2local.c | 72 ++ contrib/tcpdump/gmt2local.h | 27 + contrib/tcpdump/interface.h | 13 +- contrib/tcpdump/lbl/os-solaris2.h | 10 +- contrib/tcpdump/llc.h | 8 +- contrib/tcpdump/machdep.c | 8 +- contrib/tcpdump/nfsfh.h | 4 +- contrib/tcpdump/ospf.h | 5 +- contrib/tcpdump/parsenfsfh.c | 9 +- contrib/tcpdump/ppp.h | 50 ++ contrib/tcpdump/print-arp.c | 7 +- contrib/tcpdump/print-atalk.c | 11 +- contrib/tcpdump/print-atm.c | 6 +- contrib/tcpdump/print-bootp.c | 9 +- contrib/tcpdump/print-decnet.c | 7 +- contrib/tcpdump/print-domain.c | 17 +- contrib/tcpdump/print-ether.c | 6 +- contrib/tcpdump/print-fddi.c | 7 +- contrib/tcpdump/print-igrp.c | 7 +- contrib/tcpdump/print-ip.c | 16 +- contrib/tcpdump/print-isoclns.c | 6 +- contrib/tcpdump/print-krb.c | 104 ++- contrib/tcpdump/print-llc.c | 5 +- contrib/tcpdump/print-nfs.c | 33 +- contrib/tcpdump/print-ntp.c | 6 +- contrib/tcpdump/print-null.c | 14 +- contrib/tcpdump/print-ospf.c | 24 +- contrib/tcpdump/print-ppp.c | 89 ++- contrib/tcpdump/print-raw.c | 88 +++ contrib/tcpdump/print-sl.c | 55 +- contrib/tcpdump/print-snmp.c | 11 +- contrib/tcpdump/print-sunrpc.c | 4 +- contrib/tcpdump/print-tcp.c | 7 +- contrib/tcpdump/print-tftp.c | 7 +- contrib/tcpdump/print-udp.c | 11 +- contrib/tcpdump/print-wb.c | 86 +-- contrib/tcpdump/savestr.c | 67 ++ contrib/tcpdump/savestr.h | 24 + contrib/tcpdump/setsignal.c | 78 +++ contrib/tcpdump/setsignal.h | 27 + contrib/tcpdump/tcpdump.1 | 13 +- contrib/tcpdump/tcpdump.c | 68 +- contrib/tcpdump/util.c | 64 +- 54 files changed, 2242 insertions(+), 996 deletions(-) create mode 100644 contrib/tcpdump/gmt2local.c create mode 100644 contrib/tcpdump/gmt2local.h create mode 100644 contrib/tcpdump/ppp.h create mode 100644 contrib/tcpdump/print-raw.c create mode 100644 contrib/tcpdump/savestr.c create mode 100644 contrib/tcpdump/savestr.h create mode 100644 contrib/tcpdump/setsignal.c create mode 100644 contrib/tcpdump/setsignal.h (limited to 'contrib/tcpdump') diff --git a/contrib/tcpdump/CHANGES b/contrib/tcpdump/CHANGES index b887300..9639d41 100644 --- a/contrib/tcpdump/CHANGES +++ b/contrib/tcpdump/CHANGES @@ -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 diff --git a/contrib/tcpdump/FILES b/contrib/tcpdump/FILES index 549cee3..47ffa71 100644 --- a/contrib/tcpdump/FILES +++ b/contrib/tcpdump/FILES @@ -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 diff --git a/contrib/tcpdump/INSTALL b/contrib/tcpdump/INSTALL index 9d6b9e1..edb4b1b 100644 --- a/contrib/tcpdump/INSTALL +++ b/contrib/tcpdump/INSTALL @@ -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 diff --git a/contrib/tcpdump/Makefile.in b/contrib/tcpdump/Makefile.in index 03aa51a..2ad1b24 100644 --- a/contrib/tcpdump/Makefile.in +++ b/contrib/tcpdump/Makefile.in @@ -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) + +all: $(PROG) -tcpdump: $(OBJ) @V_PCAPDEP@ +$(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) diff --git a/contrib/tcpdump/README b/contrib/tcpdump/README index db670f7..b607c4f 100644 --- a/contrib/tcpdump/README +++ b/contrib/tcpdump/README @@ -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. - -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. +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. + +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 diff --git a/contrib/tcpdump/VERSION b/contrib/tcpdump/VERSION index eb39e53..2f4b607 100644 --- a/contrib/tcpdump/VERSION +++ b/contrib/tcpdump/VERSION @@ -1 +1 @@ -3.3 +3.4 diff --git a/contrib/tcpdump/aclocal.m4 b/contrib/tcpdump/aclocal.m4 index 2c017f6..d8227a9 100644 --- a/contrib/tcpdump/aclocal.m4 +++ b/contrib/tcpdump/aclocal.m4 @@ -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 ], [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 ], [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 ], - [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 ], [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 - # include ], +# include +# include ], [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 # include ], [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,23 +423,53 @@ 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 +# if STDC_HEADERS +# include +# include +# 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 dnl usage: @@ -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" - fi - $1="$$1 -Wall" - if test $ac_cv_gcc_vers -gt 1 ; then - $1="$$1 -Wmissing-prototypes -Wstrict-prototypes" + 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 - 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) + ]) diff --git a/contrib/tcpdump/addrtoname.c b/contrib/tcpdump/addrtoname.c index fbeb2c1..6996b5c 100644 --- a/contrib/tcpdump/addrtoname.c +++ b/contrib/tcpdump/addrtoname.c @@ -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 @@ -45,6 +45,12 @@ struct rtentry; #include #include #include +#ifdef HAVE_MALLOC_H +#include +#endif +#ifdef HAVE_MEMORY_H +#include +#endif #include #include #include @@ -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) { diff --git a/contrib/tcpdump/addrtoname.h b/contrib/tcpdump/addrtoname.h index 1754ee0..9c43cb8 100644 --- a/contrib/tcpdump/addrtoname.h +++ b/contrib/tcpdump/addrtoname.h @@ -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)) diff --git a/contrib/tcpdump/configure b/contrib/tcpdump/configure index ca84512..3afbf90 100755 --- a/contrib/tcpdump/configure +++ b/contrib/tcpdump/configure @@ -11,6 +11,8 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: +ac_help="$ac_help + --without-gcc don't use gcc" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -566,7 +568,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:570: checking host system type" >&5 +echo "configure:572: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -587,7 +589,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:591: checking target system type" >&5 +echo "configure:593: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -605,7 +607,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:609: checking build system type" >&5 +echo "configure:611: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -635,8 +637,20 @@ if test -z "$PWD" ; then fi - V_CCOPT=-O + + + + # Check whether --with-gcc or --without-gcc was given. +if test "${with_gcc+set}" = set; then + withval="$with_gcc" + : +fi + + V_CCOPT="-O" V_INCLS="" + if test "${srcdir}" != "." ; then + V_INCLS="-I\$\(srcdir\)" + fi if test "${CFLAGS+set}" = set; then LBL_CFLAGS="$CFLAGS" fi @@ -647,7 +661,7 @@ fi # Extract the first word of "shlicc2", so it can be a program name with args. set dummy shlicc2; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:651: checking for $ac_word" >&5 +echo "configure:665: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_SHLICC2'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -680,10 +694,14 @@ fi ;; esac fi + if test -z "$CC" -a "$with_gcc" = no ; then + CC=cc + export CC + fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:687: checking for $ac_word" >&5 +echo "configure:705: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -712,7 +730,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:716: checking for $ac_word" >&5 +echo "configure:734: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -760,7 +778,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:764: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:782: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -770,11 +788,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -794,12 +812,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:798: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:816: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:803: checking whether we are using GNU C" >&5 +echo "configure:821: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -808,7 +826,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -823,7 +841,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:827: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:845: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -850,86 +868,89 @@ else test "${CFLAGS+set}" = set || CFLAGS="-g" fi - if test $ac_cv_prog_gcc = yes ; then + if test "$GCC" = yes ; then if test "$SHLICC2" = yes ; then - ac_cv_gcc_vers=2 - V_CCOPT=-O2 + ac_cv_lbl_gcc_vers=2 + V_CCOPT="-O2" else echo $ac_n "checking gcc version""... $ac_c" 1>&6 -echo "configure:860: checking gcc version" >&5 - if eval "test \"`echo '$''{'ac_cv_gcc_vers'+set}'`\" = set"; then +echo "configure:878: checking gcc version" >&5 + if eval "test \"`echo '$''{'ac_cv_lbl_gcc_vers'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_cv_gcc_vers=`$CC -v 2>&1 | \ - sed -n -e '$s/.* //' -e '$s/\..*//p'` + ac_cv_lbl_gcc_vers=`$CC -v 2>&1 | \ + sed -e '/^gcc version /!d' \ + -e 's/^gcc version //' \ + -e 's/ .*//' -e 's/^[^0-9]*//' \ + -e 's/\..*//'` fi - echo "$ac_t""$ac_cv_gcc_vers" 1>&6 - if test $ac_cv_gcc_vers -gt 1 ; then - V_CCOPT=-O2 + echo "$ac_t""$ac_cv_lbl_gcc_vers" 1>&6 + if test $ac_cv_lbl_gcc_vers -gt 1 ; then + V_CCOPT="-O2" fi fi else echo $ac_n "checking that $CC handles ansi prototypes""... $ac_c" 1>&6 -echo "configure:875: checking that $CC handles ansi prototypes" >&5 - if eval "test \"`echo '$''{'ac_cv_cc_ansi_prototypes'+set}'`\" = set"; then +echo "configure:896: checking that $CC handles ansi prototypes" >&5 + if eval "test \"`echo '$''{'ac_cv_lbl_cc_ansi_prototypes'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { int frob(int, char *) ; return 0; } EOF -if { (eval echo configure:887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - ac_cv_cc_ansi_prototypes=yes + ac_cv_lbl_cc_ansi_prototypes=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_cc_ansi_prototypes=no + ac_cv_lbl_cc_ansi_prototypes=no fi rm -f conftest* fi - echo "$ac_t""$ac_cv_cc_ansi_prototypes" 1>&6 - if test $ac_cv_cc_ansi_prototypes = no ; then + echo "$ac_t""$ac_cv_lbl_cc_ansi_prototypes" 1>&6 + if test $ac_cv_lbl_cc_ansi_prototypes = no ; then case "$target_os" in hpux*) echo $ac_n "checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)""... $ac_c" 1>&6 -echo "configure:905: checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)" >&5 +echo "configure:926: checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)" >&5 savedcflags="$CFLAGS" CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS" - if eval "test \"`echo '$''{'ac_cv_cc_hpux_cc_aa'+set}'`\" = set"; then + if eval "test \"`echo '$''{'ac_cv_lbl_cc_hpux_cc_aa'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { int frob(int, char *) ; return 0; } EOF -if { (eval echo configure:919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - ac_cv_cc_hpux_cc_aa=yes + ac_cv_lbl_cc_hpux_cc_aa=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_cc_hpux_cc_aa=no + ac_cv_lbl_cc_hpux_cc_aa=no fi rm -f conftest* fi - echo "$ac_t""$ac_cv_cc_hpux_cc_aa" 1>&6 - if test $ac_cv_cc_hpux_cc_aa = no ; then - { echo "configure: error: see the INSTALL for more info" 1>&2; exit 1; } + echo "$ac_t""$ac_cv_lbl_cc_hpux_cc_aa" 1>&6 + if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then + { echo "configure: error: see the INSTALL doc for more info" 1>&2; exit 1; } fi CFLAGS="$savedcflags" V_CCOPT="-Aa $V_CCOPT" @@ -940,11 +961,12 @@ EOF ;; *) - { echo "configure: error: see the INSTALL for more info" 1>&2; exit 1; } + { echo "configure: error: see the INSTALL doc for more info" 1>&2; exit 1; } ;; esac fi - V_INCLS=-I/usr/local/include + V_INCLS="$V_INCLS -I/usr/local/include" + LDFLAGS="$LDFLAGS -L/usr/local/lib" case "$target_os" in @@ -953,17 +975,17 @@ EOF ;; osf*) - V_CCOPT="$V_CCOPT -g3" + V_CCOPT="$V_CCOPT -std1 -g3" ;; ultrix*) echo $ac_n "checking that Ultrix $CC hacks const in prototypes""... $ac_c" 1>&6 -echo "configure:962: checking that Ultrix $CC hacks const in prototypes" >&5 - if eval "test \"`echo '$''{'ac_cv_cc_const_proto'+set}'`\" = set"; then +echo "configure:984: checking that Ultrix $CC hacks const in prototypes" >&5 + if eval "test \"`echo '$''{'ac_cv_lbl_cc_const_proto'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -971,20 +993,20 @@ struct a { int b; }; void c(const struct a *) ; return 0; } EOF -if { (eval echo configure:975: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:997: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - ac_cv_cc_const_proto=yes + ac_cv_lbl_cc_const_proto=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_cc_const_proto=no + ac_cv_lbl_cc_const_proto=no fi rm -f conftest* fi - echo "$ac_t""$ac_cv_cc_const_proto" 1>&6 - if test $ac_cv_cc_const_proto = no ; then + echo "$ac_t""$ac_cv_lbl_cc_const_proto" 1>&6 + if test $ac_cv_lbl_cc_const_proto = no ; then cat >> confdefs.h <<\EOF #define const EOF @@ -996,7 +1018,7 @@ EOF echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1000: checking how to run the C preprocessor" >&5 +echo "configure:1022: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1011,13 +1033,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1028,13 +1050,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1060: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1056,21 +1078,21 @@ else fi echo "$ac_t""$CPP" 1>&6 -for ac_hdr in fcntl.h net/slip.h rpc/rpcent.h +for ac_hdr in fcntl.h malloc.h memory.h rpc/rpcent.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1064: checking for $ac_hdr" >&5 +echo "configure:1086: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1074: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1096: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1097,12 +1119,12 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1101: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1123: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1111,7 +1133,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1137: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1132,15 +1154,81 @@ EOF fi +case "$target_os" in + +linux*) + echo $ac_n "checking Linux kernel version""... $ac_c" 1>&6 +echo "configure:1162: checking Linux kernel version" >&5 + if eval "test \"`echo '$''{'ac_cv_linux_vers'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_linux_vers=`uname -r 2>&1 | \ + sed -n -e '$s/.* //' -e '$s/\..*//p'` +fi + + echo "$ac_t""$ac_cv_linux_vers" 1>&6 + if test $ac_cv_linux_vers -lt 2 ; then + { echo "configure: error: version 2 or higher required; see the INSTALL doc for more info" 1>&2; exit 1; } + fi + cat >> confdefs.h <<\EOF +#define HAVE_NET_SLIP_H 1 +EOF + + ;; + +*) + for ac_hdr in net/slip.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1185: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1195: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + ;; +esac + for ac_func in vfprintf strcasecmp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1139: checking for $ac_func" >&5 +echo "configure:1227: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1192,12 +1280,12 @@ done for ac_func in ether_ntoa setlinebuf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1196: checking for $ac_func" >&5 +echo "configure:1284: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1246,14 +1334,14 @@ done echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:1250: checking whether byte ordering is bigendian" >&5 +echo "configure:1338: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -1264,11 +1352,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1268: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -1279,7 +1367,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -1299,7 +1387,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -1337,7 +1425,7 @@ fi echo $ac_n "checking for main in -ldnet""... $ac_c" 1>&6 -echo "configure:1341: checking for main in -ldnet" >&5 +echo "configure:1429: checking for main in -ldnet" >&5 ac_lib_var=`echo dnet'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1345,14 +1433,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1380,7 +1468,7 @@ else fi echo $ac_n "checking for main in -lrpc""... $ac_c" 1>&6 -echo "configure:1384: checking for main in -lrpc" >&5 +echo "configure:1472: checking for main in -lrpc" >&5 ac_lib_var=`echo rpc'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1388,14 +1476,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lrpc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1422,161 +1510,135 @@ else echo "$ac_t""no" 1>&6 fi -echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6 -echo "configure:1427: checking for main in -lnsl" >&5 -ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lnsl $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi -echo $ac_n "checking for main in -lstr""... $ac_c" 1>&6 -echo "configure:1470: checking for main in -lstr" >&5 -ac_lib_var=`echo str'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:1517: checking return type of signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-lstr $LIBS" -cat > conftest.$ac_ext < conftest.$ac_ext < +#include +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif int main() { -main() +int i; ; return 0; } EOF -if { (eval echo configure:1485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + ac_cv_type_signal=void else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + ac_cv_type_signal=int fi rm -f conftest* -LIBS="$ac_save_LIBS" - fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo str | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 +cat >> confdefs.h <&6 -fi + if test "$ac_cv_type_signal" = void ; then + cat >> confdefs.h <<\EOF +#define RETSIGVAL +EOF + else + cat >> confdefs.h <<\EOF +#define RETSIGVAL (0) +EOF -case "$target_os" in -irix5.0*) - ;; + fi + case "$target_os" in -irix5.1*) - ;; + irix*) + cat >> confdefs.h <<\EOF +#define _BSD_SIGNALS 1 +EOF -irix5.2*) - ;; + ;; -*) - echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6 -echo "configure:1525: checking for main in -lsocket" >&5 -ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + *) + for ac_func in sigset +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1581: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-lsocket $LIBS" -cat > conftest.$ac_ext < conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); int main() { -main() + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + ; return 0; } EOF -if { (eval echo configure:1540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + eval "ac_cv_func_$ac_func=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" - fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi +done - ;; -esac - -pfopen=/usr/examples/packetfilter/pfopen.c - if test -f $pfopen ; then - for ac_func in pfopen + if test $ac_cv_func_sigset = no ; then + for ac_func in sigaction do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1575: checking for $ac_func" >&5 +echo "configure:1637: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1623,391 +1685,444 @@ else fi done - if test $ac_cv_func_pfopen = "no" ; then - echo "$ac_t""Using $pfopen" 1>&6 - LIBS="$LIBS $pfopen" - fi - fi - echo $ac_n "checking for local pcap library""... $ac_c" 1>&6 -echo "configure:1633: checking for local pcap library" >&5 - 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 $places ../libpcap libpcap ; do - basedir=`echo $dir | sed -e 's/[ab][0-9]*$//'` - if test $lastdir = $basedir ; then - continue; fi - lastdir=$dir - if test -r $dir/pcap.c ; then - libpcap=$dir/libpcap.a - d=$dir - fi - done - if test $libpcap = FAIL ; then - echo "$ac_t""not found" 1>&6 - echo $ac_n "checking for main in -lpcap""... $ac_c" 1>&6 -echo "configure:1652: checking for main in -lpcap" >&5 -ac_lib_var=`echo pcap'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + ;; + esac + + + # Most operating systems have gethostbyname() in the default searched + # libraries (i.e. libc): + echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 +echo "configure:1697: checking for gethostbyname" >&5 +if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-lpcap $LIBS" -cat > conftest.$ac_ext < conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname(); int main() { -main() + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +gethostbyname(); +#endif + ; return 0; } EOF -if { (eval echo configure:1667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + eval "ac_cv_func_gethostbyname=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + eval "ac_cv_func_gethostbyname=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" - fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + +if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then echo "$ac_t""yes" 1>&6 - libpcap="-lpcap" + : else echo "$ac_t""no" 1>&6 -fi - - if test $libpcap = FAIL ; then - { echo "configure: error: see the INSTALL doc for more info" 1>&2; exit 1; } - fi - else - V_PCAPDEP=$libpcap - V_INCLS="-I$d $V_INCLS" - echo "$ac_t""$libpcap" 1>&6 - fi - LIBS="$libpcap $LIBS" - -V_GROUP=0 -case "$target_os" in - -aix*) - cat >> confdefs.h <<\EOF -#define _SUN 1 -EOF - - ;; - -irix*) - V_GROUP=sys - ;; - -osf*) - V_GROUP=system - case "$target_os" in - - osf1*) - ;; - - osf2*) - ;; - - *) - cat >> confdefs.h <<\EOF -#define __STDC__ 2 -EOF - - ;; - esac - ;; - -solaris*) - V_GROUP=sys - ;; - -linux*) - V_INCLS="$V_INCLS -Ilinux-include" - ;; -esac - -if test -f /dev/bpf0 ; then - V_GROUP=bpf -fi - -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1744: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then +# Some OSes (eg. Solaris) place it in libnsl: + echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 +echo "configure:1744: checking for gethostbyname in -lnsl" >&5 +ac_lib_var=`echo nsl'_'gethostbyname'_' | sed 'y%./+- %__p__%'` +if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext < conftest.$ac_ext < -#include -#include -#include +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname(); + +int main() { +gethostbyname() +; return 0; } EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1757: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then +if { (eval echo configure:1763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - ac_cv_header_stdc=yes + eval "ac_cv_lbl_lib_$ac_lib_var=yes" else - echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_header_stdc=no + eval "ac_cv_lbl_lib_$ac_lib_var=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +# Some strange OSes (SINIX) have it in libsocket: + echo $ac_n "checking for gethostbyname in -lsocket""... $ac_c" 1>&6 +echo "configure:1790: checking for gethostbyname in -lsocket" >&5 +ac_lib_var=`echo socket'_'gethostbyname'_' | sed 'y%./+- %__p__%'` +if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket $LIBS" cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname(); + +int main() { +gethostbyname() +; return 0; } EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : +if { (eval echo configure:1809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lbl_lib_$ac_lib_var=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_header_stdc=no + eval "ac_cv_lbl_lib_$ac_lib_var=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" fi +if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +# Unfortunately libsocket sometimes depends on libnsl. + # AC_CHECK_LIB's API is essentially broken so the + # following ugliness is necessary: + echo $ac_n "checking for gethostbyname in -lsocket""... $ac_c" 1>&6 +echo "configure:1838: checking for gethostbyname in -lsocket" >&5 +ac_lib_var=`echo socket'_'gethostbyname'_'-lnsl | sed 'y%./+- %__p__%'` +if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket -lnsl $LIBS" cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname(); + +int main() { +gethostbyname() +; return 0; } EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : +if { (eval echo configure:1857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lbl_lib_$ac_lib_var=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_header_stdc=no + eval "ac_cv_lbl_lib_$ac_lib_var=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then - : +if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="-lsocket -lnsl $LIBS" else - cat > conftest.$ac_ext <&6 +echo $ac_n "checking for gethostbyname in -lresolv""... $ac_c" 1>&6 +echo "configure:1876: checking for gethostbyname in -lresolv" >&5 +ac_lib_var=`echo resolv'_'gethostbyname | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lresolv $LIBS" +cat > conftest.$ac_ext < -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname(); +int main() { +gethostbyname() +; return 0; } EOF -if { (eval echo configure:1824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - : +if { (eval echo configure:1895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" fi -rm -fr conftest* +rm -f conftest* +LIBS="$ac_save_LIBS" + fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 fi + fi -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF +fi fi -echo $ac_n "checking for int32_t""... $ac_c" 1>&6 -echo "configure:1848: checking for int32_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then +fi + + echo $ac_n "checking for socket""... $ac_c" 1>&6 +echo "configure:1931: checking for socket" >&5 +if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char socket(); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char socket(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_socket) || defined (__stub___socket) +choke me +#else +socket(); #endif + +; return 0; } EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then +if { (eval echo configure:1959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - ac_cv_type_int32_t=yes + eval "ac_cv_func_socket=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_type_int32_t=no + eval "ac_cv_func_socket=no" fi rm -f conftest* - fi -echo "$ac_t""$ac_cv_type_int32_t" 1>&6 -if test $ac_cv_type_int32_t = no; then - cat >> confdefs.h <<\EOF -#define int32_t int -EOF -fi - -echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6 -echo "configure:1881: checking for u_int32_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then +if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 +echo "configure:1977: checking for socket in -lsocket" >&5 +ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext < conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char socket(); + +int main() { +socket() +; return 0; } EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "u_int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then +if { (eval echo configure:1996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - ac_cv_type_u_int32_t=yes + eval "ac_cv_lib_$ac_lib_var=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_type_u_int32_t=no + eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" fi -echo "$ac_t""$ac_cv_type_u_int32_t" 1>&6 -if test $ac_cv_type_u_int32_t = no; then - cat >> confdefs.h <<\EOF -#define u_int32_t u_int -EOF - -fi - - -rm -f os-proto.h - if test "${LBL_CFLAGS+set}" = set; then - V_CCOPT="$V_CCOPT ${LBL_CFLAGS}" - fi - if test $ac_cv_prog_gcc = yes -a -f .devel ; then - if test "${LBL_CFLAGS+set}" != set; then - if test "$ac_cv_prog_cc_g" = yes ; then - V_CCOPT="-g $V_CCOPT" - fi - V_CCOPT="$V_CCOPT -Wall" - if test $ac_cv_gcc_vers -gt 1 ; then - V_CCOPT="$V_CCOPT -Wmissing-prototypes -Wstrict-prototypes" - fi - fi - 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 - cat >> confdefs.h <<\EOF -#define HAVE_OS_PROTO_H 1 +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&2 - fi - fi + LIBS="-lsocket $LIBS" -echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1942: checking return type of signal handlers" >&5 -if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 +echo "configure:2022: checking for socket in -lsocket" >&5 +ac_lib_var=`echo socket'_'socket'_'-lnsl | sed 'y%./+- %__p__%'` +if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext < conftest.$ac_ext < -#include -#ifdef signal -#undef signal -#endif -#ifdef __cplusplus -extern "C" void (*signal (int, void (*)(int)))(int); -#else -void (*signal ()) (); -#endif +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char socket(); int main() { -int i; +socket() ; return 0; } EOF -if { (eval echo configure:1964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - ac_cv_type_signal=void + eval "ac_cv_lbl_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_type_signal=int + eval "ac_cv_lbl_lib_$ac_lib_var=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="-lsocket -lnsl $LIBS" +else + echo "$ac_t""no" 1>&6 fi -echo "$ac_t""$ac_cv_type_signal" 1>&6 -cat >> confdefs.h <> confdefs.h <<\EOF -#define RETSIGVAL + # DLPI needs putmsg under HPUX so test for -lstr while we're at it + echo $ac_n "checking for putmsg in -lstr""... $ac_c" 1>&6 +echo "configure:2067: checking for putmsg in -lstr" >&5 +ac_lib_var=`echo str'_'putmsg | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lstr $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" - else - cat >> confdefs.h <<\EOF -#define RETSIGVAL (0) +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo str | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <> confdefs.h <<\EOF -#define _BSD_SIGNALS 1 -EOF +else + echo "$ac_t""no" 1>&6 +fi - ;; + - *) - for ac_func in sigset + LBL_LIBS="$LIBS" + pfopen=/usr/examples/packetfilter/pfopen.c + if test -f $pfopen ; then + for ac_func in pfopen do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2006: checking for $ac_func" >&5 +echo "configure:2121: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2054,21 +2169,249 @@ else fi done - if test $ac_cv_func_sigset = yes ; then - cat >> confdefs.h <<\EOF -#define signal sigset + if test $ac_cv_func_pfopen = "no" ; then + echo "$ac_t""Using $pfopen" 1>&6 + LIBS="$LIBS $pfopen" + fi + fi + echo $ac_n "checking for local pcap library""... $ac_c" 1>&6 +echo "configure:2179: checking for local pcap library" >&5 + 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 $places ../libpcap libpcap ; do + basedir=`echo $dir | sed -e 's/[ab][0-9]*$//'` + if test $lastdir = $basedir ; then + continue; + fi + lastdir=$dir + if test -r $dir/pcap.c ; then + libpcap=$dir/libpcap.a + d=$dir + fi + done + if test $libpcap = FAIL ; then + echo "$ac_t""not found" 1>&6 + echo $ac_n "checking for main in -lpcap""... $ac_c" 1>&6 +echo "configure:2198: checking for main in -lpcap" >&5 +ac_lib_var=`echo pcap'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpcap $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + libpcap="-lpcap" +else + echo "$ac_t""no" 1>&6 +fi + + if test $libpcap = FAIL ; then + { echo "configure: error: see the INSTALL doc for more info" 1>&2; exit 1; } + fi + else + V_PCAPDEP=$libpcap + V_INCLS="-I$d $V_INCLS" + echo "$ac_t""$libpcap" 1>&6 + fi + LIBS="$libpcap $LIBS" + case "$target_os" in + aix*) + pseexe="/lib/pse.exp" + echo $ac_n "checking for $pseexe""... $ac_c" 1>&6 +echo "configure:2247: checking for $pseexe" >&5 + if test -f $pseexe ; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -I:$pseexe" fi ;; esac + +V_GROUP=0 +if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then + V_GROUP=wheel +fi +case "$target_os" in + +aix*) + cat >> confdefs.h <<\EOF +#define _SUN 1 +EOF + + ;; + +irix*) + V_GROUP=sys + ;; + +linux*) + V_INCLS="$V_INCLS -Ilinux-include" + ;; + +osf*) + V_GROUP=system + cat >> confdefs.h <<\EOF +#define __STDC__ 2 +EOF + + ;; + +solaris*) + V_GROUP=sys + ;; +esac + +if test -f /dev/bpf0 ; then + V_GROUP=bpf +fi + +echo $ac_n "checking for int32_t using $CC""... $ac_c" 1>&6 +echo "configure:2294: checking for int32_t using $CC" >&5 + if eval "test \"`echo '$''{'ac_cv_lbl_have_int32_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +# if STDC_HEADERS +# include +# include +# endif +int main() { +int32_t i +; return 0; } +EOF +if { (eval echo configure:2312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_lbl_have_int32_t=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_lbl_have_int32_t=no +fi +rm -f conftest* +fi + + echo "$ac_t""$ac_cv_lbl_have_int32_t" 1>&6 + if test $ac_cv_lbl_have_int32_t = no ; then + cat >> confdefs.h <<\EOF +#define int32_t int +EOF + + fi +echo $ac_n "checking for u_int32_t using $CC""... $ac_c" 1>&6 +echo "configure:2332: checking for u_int32_t using $CC" >&5 + if eval "test \"`echo '$''{'ac_cv_lbl_have_u_int32_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +# if STDC_HEADERS +# include +# include +# endif +int main() { +u_int32_t i +; return 0; } +EOF +if { (eval echo configure:2350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_lbl_have_u_int32_t=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_lbl_have_u_int32_t=no +fi +rm -f conftest* +fi + + echo "$ac_t""$ac_cv_lbl_have_u_int32_t" 1>&6 + if test $ac_cv_lbl_have_u_int32_t = no ; then + cat >> confdefs.h <<\EOF +#define u_int32_t u_int +EOF + + fi + +rm -f os-proto.h + if test "${LBL_CFLAGS+set}" = set; then + V_CCOPT="$V_CCOPT ${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 + V_CCOPT="-g $V_CCOPT" + fi + V_CCOPT="$V_CCOPT -Wall" + if test $ac_cv_lbl_gcc_vers -gt 1 ; then + V_CCOPT="$V_CCOPT -Wmissing-prototypes -Wstrict-prototypes" + fi + fi + else + case "$target_os" in + + irix6*) + V_CCOPT="$V_CCOPT -n32" + ;; + + *) + ;; + esac + fi + os=`echo $target_os | sed -e 's/\([0-9][0-9]*\)[^0-9].*$/\1/'` + name="lbl/os-$os.h" + if test -f $name ; then + ln -s $name os-proto.h + cat >> confdefs.h <<\EOF +#define HAVE_OS_PROTO_H 1 +EOF + + else + echo "configure: warning: can't find $name" 1>&2 + fi + fi + echo $ac_n "checking if sockaddr struct has sa_len member""... $ac_c" 1>&6 -echo "configure:2067: checking if sockaddr struct has sa_len member" >&5 - if eval "test \"`echo '$''{'ac_cv_sockaddr_has_sa_len'+set}'`\" = set"; then +echo "configure:2410: checking if sockaddr struct has sa_len member" >&5 + if eval "test \"`echo '$''{'ac_cv_lbl_sockaddr_has_sa_len'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2077,20 +2420,20 @@ int main() { u_int i = sizeof(((struct sockaddr *)0)->sa_len) ; return 0; } EOF -if { (eval echo configure:2081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - ac_cv_sockaddr_has_sa_len=yes + ac_cv_lbl_sockaddr_has_sa_len=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_sockaddr_has_sa_len=no + ac_cv_lbl_sockaddr_has_sa_len=no fi rm -f conftest* fi - echo "$ac_t""$ac_cv_sockaddr_has_sa_len" 1>&6 - if test $ac_cv_sockaddr_has_sa_len = yes ; then + echo "$ac_t""$ac_cv_lbl_sockaddr_has_sa_len" 1>&6 + if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then cat >> confdefs.h <<\EOF #define HAVE_SOCKADDR_SA_LEN 1 EOF @@ -2098,14 +2441,14 @@ EOF fi echo $ac_n "checking if ether_header uses ether_addr structs""... $ac_c" 1>&6 -echo "configure:2102: checking if ether_header uses ether_addr structs" >&5 +echo "configure:2445: checking if ether_header uses ether_addr structs" >&5 if eval "test \"`echo '$''{'ac_cv_ether_header_has_ea'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else LBL_SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $V_INCLS" cat > conftest.$ac_ext < @@ -2123,7 +2466,7 @@ u_int i = sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet) ; return 0; } EOF -if { (eval echo configure:2127: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_ether_header_has_ea=yes else @@ -2145,14 +2488,14 @@ EOF fi echo $ac_n "checking if ether_arp uses ether_addr structs""... $ac_c" 1>&6 -echo "configure:2149: checking if ether_arp uses ether_addr structs" >&5 +echo "configure:2492: checking if ether_arp uses ether_addr structs" >&5 if eval "test \"`echo '$''{'ac_cv_ether_arp_has_ea'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else LBL_SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $V_INCLS" cat > conftest.$ac_ext < @@ -2170,7 +2513,7 @@ u_int i = sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet) ; return 0; } EOF -if { (eval echo configure:2174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2517: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_ether_arp_has_ea=yes else @@ -2192,14 +2535,14 @@ EOF fi echo $ac_n "checking if ether_arp uses erp_xsha member""... $ac_c" 1>&6 -echo "configure:2196: checking if ether_arp uses erp_xsha member" >&5 +echo "configure:2539: checking if ether_arp uses erp_xsha member" >&5 if eval "test \"`echo '$''{'ac_cv_struct_ether_arp_x'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else LBL_SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $V_INCLS" cat > conftest.$ac_ext < @@ -2216,7 +2559,7 @@ int main() { u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha) ; return 0; } EOF -if { (eval echo configure:2220: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2563: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_ether_arp_x=yes else @@ -2238,14 +2581,14 @@ EOF fi echo $ac_n "checking if unaligned accesses fail""... $ac_c" 1>&6 -echo "configure:2242: checking if unaligned accesses fail" >&5 - if eval "test \"`echo '$''{'ac_cv_unaligned_fail'+set}'`\" = set"; then +echo "configure:2585: checking if unaligned accesses fail" >&5 + if eval "test \"`echo '$''{'ac_cv_lbl_unaligned_fail'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$target_cpu" in alpha|hp*|mips|sparc) - ac_cv_unaligned_fail=yes + ac_cv_lbl_unaligned_fail=yes ;; *) @@ -2278,13 +2621,13 @@ EOF ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \ conftest.c $LIBS >/dev/null 2>&1 if test ! -x conftest ; then - ac_cv_unaligned_fail=yes + ac_cv_lbl_unaligned_fail=yes else ./conftest >conftest.out if test ! -s conftest.out ; then - ac_cv_unaligned_fail=yes + ac_cv_lbl_unaligned_fail=yes else - ac_cv_unaligned_fail=no + ac_cv_lbl_unaligned_fail=no fi fi rm -f conftest* core core.conftest @@ -2292,17 +2635,23 @@ EOF esac fi - echo "$ac_t""$ac_cv_unaligned_fail" 1>&6 - if test $ac_cv_unaligned_fail = yes ; then + echo "$ac_t""$ac_cv_lbl_unaligned_fail" 1>&6 + if test $ac_cv_lbl_unaligned_fail = yes ; then cat >> confdefs.h <<\EOF #define LBL_ALIGN 1 EOF fi -if test -r lbl/gnuc.h ; then +if test "${srcdir}" = "." ; then + srcdirprefix="" +else + srcdirprefix="./" +fi + +if test -r ${srcdirprefix}lbl/gnuc.h ; then rm -f gnuc.h - ln -s lbl/gnuc.h gnuc.h + ln -s ${srcdirprefix}lbl/gnuc.h gnuc.h fi @@ -2321,7 +2670,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2325: checking for a BSD compatible install" >&5 +echo "configure:2674: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 diff --git a/contrib/tcpdump/configure.in b/contrib/tcpdump/configure.in index 65bf5a9..f2a2126 100755 --- a/contrib/tcpdump/configure.in +++ b/contrib/tcpdump/configure.in @@ -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) diff --git a/contrib/tcpdump/gmt2local.c b/contrib/tcpdump/gmt2local.c new file mode 100644 index 0000000..5812cfe --- /dev/null +++ b/contrib/tcpdump/gmt2local.c @@ -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 +#include + +#include +#ifdef TIME_WITH_SYS_TIME +#include +#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); +} diff --git a/contrib/tcpdump/gmt2local.h b/contrib/tcpdump/gmt2local.h new file mode 100644 index 0000000..4933b09 --- /dev/null +++ b/contrib/tcpdump/gmt2local.h @@ -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 diff --git a/contrib/tcpdump/interface.h b/contrib/tcpdump/interface.h index 0b14a0a..7ccb3f5 100644 --- a/contrib/tcpdump/interface.h +++ b/contrib/tcpdump/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 @@ -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 *); diff --git a/contrib/tcpdump/lbl/os-solaris2.h b/contrib/tcpdump/lbl/os-solaris2.h index cd0a76b..7c0e772 100644 --- a/contrib/tcpdump/lbl/os-solaris2.h +++ b/contrib/tcpdump/lbl/os-solaris2.h @@ -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 *); diff --git a/contrib/tcpdump/llc.h b/contrib/tcpdump/llc.h index 89c10d5..36185a7 100644 --- a/contrib/tcpdump/llc.h +++ b/contrib/tcpdump/llc.h @@ -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 diff --git a/contrib/tcpdump/machdep.c b/contrib/tcpdump/machdep.c index 11a7d99..7dd443a 100644 --- a/contrib/tcpdump/machdep.c +++ b/contrib/tcpdump/machdep.c @@ -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 @@ -30,8 +30,6 @@ static const char rcsid[] = #include #endif -#include - #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 diff --git a/contrib/tcpdump/nfsfh.h b/contrib/tcpdump/nfsfh.h index 383c784..5881d52 100644 --- a/contrib/tcpdump/nfsfh.h +++ b/contrib/tcpdump/nfsfh.h @@ -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); diff --git a/contrib/tcpdump/ospf.h b/contrib/tcpdump/ospf.h index c111a90..eee7944 100644 --- a/contrib/tcpdump/ospf.h +++ b/contrib/tcpdump/ospf.h @@ -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 /* */ diff --git a/contrib/tcpdump/parsenfsfh.c b/contrib/tcpdump/parsenfsfh.c index 9746672..d7969bb 100644 --- a/contrib/tcpdump/parsenfsfh.c +++ b/contrib/tcpdump/parsenfsfh.c @@ -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 #include #include +#ifdef HAVE_MEMORY_H #include +#endif #include #include @@ -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; diff --git a/contrib/tcpdump/ppp.h b/contrib/tcpdump/ppp.h new file mode 100644 index 0000000..ccd546a --- /dev/null +++ b/contrib/tcpdump/ppp.h @@ -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 */ diff --git a/contrib/tcpdump/print-arp.c b/contrib/tcpdump/print-arp.c index 19f9a9c..adafdf5 100644 --- a/contrib/tcpdump/print-arp.c +++ b/contrib/tcpdump/print-arp.c @@ -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 @@ -37,6 +37,9 @@ struct rtentry; #include #include +#ifdef HAVE_MEMORY_H +#include +#endif #include #include diff --git a/contrib/tcpdump/print-atalk.c b/contrib/tcpdump/print-atalk.c index 3b6f1cd..6ece6e7 100644 --- a/contrib/tcpdump/print-atalk.c +++ b/contrib/tcpdump/print-atalk.c @@ -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 @@ -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); diff --git a/contrib/tcpdump/print-atm.c b/contrib/tcpdump/print-atm.c index 13c989d..de58566 100644 --- a/contrib/tcpdump/print-atm.c +++ b/contrib/tcpdump/print-atm.c @@ -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 @@ -46,9 +46,9 @@ struct rtentry; #include #include +#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 diff --git a/contrib/tcpdump/print-bootp.c b/contrib/tcpdump/print-bootp.c index 8dc598e..0b032b4 100644 --- a/contrib/tcpdump/print-bootp.c +++ b/contrib/tcpdump/print-bootp.c @@ -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 @@ -39,6 +39,9 @@ struct rtentry; #include #include +#ifdef HAVE_MEMORY_H +#include +#endif #include #include @@ -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 */ diff --git a/contrib/tcpdump/print-decnet.c b/contrib/tcpdump/print-decnet.c index 695ab17..29b85bd 100644 --- a/contrib/tcpdump/print-decnet.c +++ b/contrib/tcpdump/print-decnet.c @@ -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 @@ -39,6 +39,9 @@ struct rtentry; #endif #include +#ifdef HAVE_MALLOC_H +#include +#endif #include #include #include diff --git a/contrib/tcpdump/print-domain.c b/contrib/tcpdump/print-domain.c index 18b77f4..c96fb07 100644 --- a/contrib/tcpdump/print-domain.c +++ b/contrib/tcpdump/print-domain.c @@ -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 @@ -44,8 +44,12 @@ struct rtentry; #include #include +#ifdef NOERROR #undef NOERROR /* Solaris sucks */ +#endif +#ifdef NOERROR #undef T_UNSPEC /* SINIX does too */ +#endif #include #include @@ -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" }, diff --git a/contrib/tcpdump/print-ether.c b/contrib/tcpdump/print-ether.c index f692efb..07a5d12 100644 --- a/contrib/tcpdump/print-ether.c +++ b/contrib/tcpdump/print-ether.c @@ -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 @@ -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 */ diff --git a/contrib/tcpdump/print-fddi.c b/contrib/tcpdump/print-fddi.c index 29a5531..3c1813a 100644 --- a/contrib/tcpdump/print-fddi.c +++ b/contrib/tcpdump/print-fddi.c @@ -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 #include #include -#include #include #include @@ -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; diff --git a/contrib/tcpdump/print-igrp.c b/contrib/tcpdump/print-igrp.c index ca994d1..87e8e79 100644 --- a/contrib/tcpdump/print-igrp.c +++ b/contrib/tcpdump/print-igrp.c @@ -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 +#include /* concession to AIX */ #include #include @@ -39,8 +40,8 @@ static const char rcsid[] = #include #include -#include "addrtoname.h" #include "interface.h" +#include "addrtoname.h" #include "igrp.h" #include "extract.h" /* must come after interface.h */ diff --git a/contrib/tcpdump/print-ip.c b/contrib/tcpdump/print-ip.c index 363fd61..30e13a1 100644 --- a/contrib/tcpdump/print-ip.c +++ b/contrib/tcpdump/print-ip.c @@ -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 @@ -37,6 +37,9 @@ static const char rcsid[] = #include #include +#ifdef HAVE_MALLOC_H +#include +#endif #include #include #include @@ -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; diff --git a/contrib/tcpdump/print-isoclns.c b/contrib/tcpdump/print-isoclns.c index 90b88c8..629dfe0 100644 --- a/contrib/tcpdump/print-isoclns.c +++ b/contrib/tcpdump/print-isoclns.c @@ -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 @@ -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; diff --git a/contrib/tcpdump/print-krb.c b/contrib/tcpdump/print-krb.c index 99cb581..eca6265 100644 --- a/contrib/tcpdump/print-krb.c +++ b/contrib/tcpdump/print-krb.c @@ -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 @@ -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; diff --git a/contrib/tcpdump/print-llc.c b/contrib/tcpdump/print-llc.c index ad57771..da68156 100644 --- a/contrib/tcpdump/print-llc.c +++ b/contrib/tcpdump/print-llc.c @@ -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 @@ -34,7 +34,6 @@ static const char rcsid[] = #include #include -#include #include #include diff --git a/contrib/tcpdump/print-nfs.c b/contrib/tcpdump/print-nfs.c index c16291d..a8e371e 100644 --- a/contrib/tcpdump/print-nfs.c +++ b/contrib/tcpdump/print-nfs.c @@ -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 @@ -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); } /* diff --git a/contrib/tcpdump/print-ntp.c b/contrib/tcpdump/print-ntp.c index 67368d0..dc14ba1 100644 --- a/contrib/tcpdump/print-ntp.c +++ b/contrib/tcpdump/print-ntp.c @@ -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 @@ -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 *); diff --git a/contrib/tcpdump/print-null.c b/contrib/tcpdump/print-null.c index ba731d8..a5bbd27 100644 --- a/contrib/tcpdump/print-null.c +++ b/contrib/tcpdump/print-null.c @@ -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 @@ -50,15 +50,19 @@ struct rtentry; #include #include -#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) { diff --git a/contrib/tcpdump/print-ospf.c b/contrib/tcpdump/print-ospf.c index 44e8737..3de4ce5 100644 --- a/contrib/tcpdump/print-ospf.c +++ b/contrib/tcpdump/print-ospf.c @@ -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 @@ -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; diff --git a/contrib/tcpdump/print-ppp.c b/contrib/tcpdump/print-ppp.c index 27dee0e..6532382 100644 --- a/contrib/tcpdump/print-ppp.c +++ b/contrib/tcpdump/print-ppp.c @@ -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 #include #include @@ -44,15 +43,16 @@ struct rtentry; #include #include #include -#include #include #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 -#include -#include +/* 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 diff --git a/contrib/tcpdump/print-raw.c b/contrib/tcpdump/print-raw.c new file mode 100644 index 0000000..3628955 --- /dev/null +++ b/contrib/tcpdump/print-raw.c @@ -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 +#include +#include +#include +#include + +#if __STDC__ +struct mbuf; +struct rtentry; +#endif +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#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'); +} diff --git a/contrib/tcpdump/print-sl.c b/contrib/tcpdump/print-sl.c index dfea3bf..a97a495 100644 --- a/contrib/tcpdump/print-sl.c +++ b/contrib/tcpdump/print-sl.c @@ -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 #include #include -#include #include #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 #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 diff --git a/contrib/tcpdump/print-snmp.c b/contrib/tcpdump/print-snmp.c index c98fdbe..8367470 100644 --- a/contrib/tcpdump/print-snmp.c +++ b/contrib/tcpdump/print-snmp.c @@ -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 #include -#include #include +#ifdef HAVE_MEMORY_H +#include +#endif +#include #include #include "interface.h" diff --git a/contrib/tcpdump/print-sunrpc.c b/contrib/tcpdump/print-sunrpc.c index 5e3f9ae..8bd9ae8 100644 --- a/contrib/tcpdump/print-sunrpc.c +++ b/contrib/tcpdump/print-sunrpc.c @@ -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 @@ -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); diff --git a/contrib/tcpdump/print-tcp.c b/contrib/tcpdump/print-tcp.c index e9bf240..fbda84c 100644 --- a/contrib/tcpdump/print-tcp.c +++ b/contrib/tcpdump/print-tcp.c @@ -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 @@ -34,6 +34,9 @@ static const char rcsid[] = #include #include +#ifdef HAVE_MEMORY_H +#include +#endif #include #include #include diff --git a/contrib/tcpdump/print-tftp.c b/contrib/tcpdump/print-tftp.c index 5a0b618..d8a7b3e 100644 --- a/contrib/tcpdump/print-tftp.c +++ b/contrib/tcpdump/print-tftp.c @@ -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 @@ -31,6 +31,9 @@ static const char rcsid[] = #include +#ifdef SEGSIZE +#undef SEGSIZE /* SINIX sucks */ +#endif #include #include diff --git a/contrib/tcpdump/print-udp.c b/contrib/tcpdump/print-udp.c index 3960de8..0cba30d 100644 --- a/contrib/tcpdump/print-udp.c +++ b/contrib/tcpdump/print-udp.c @@ -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 @@ -35,9 +35,16 @@ static const char rcsid[] = #include #include +#ifdef NOERROR #undef NOERROR /* Solaris sucks */ +#endif +#ifdef T_UNSPEC #undef T_UNSPEC /* SINIX does too */ +#endif #include +#ifdef SEGSIZE +#undef SEGSIZE +#endif #include #include diff --git a/contrib/tcpdump/print-wb.c b/contrib/tcpdump/print-wb.c index 12e4081..cd60848 100644 --- a/contrib/tcpdump/print-wb.c +++ b/contrib/tcpdump/print-wb.c @@ -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 @@ -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; + 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) { - case PT_KILL: - printf(" wb-kill"); - return; + if (ph->ph_flags) + printf("*"); + switch (ph->ph_type) { - case PT_ID: - if (wb_id((struct pkt_id *)(ph + 1), len) >= 0) - return; - break; + case PT_KILL: + printf(" wb-kill"); + return; - case PT_RREQ: - if (wb_rreq((struct pkt_rreq *)(ph + 1), len) >= 0) - return; - break; + case PT_ID: + if (wb_id((struct pkt_id *)(ph + 1), len) >= 0) + return; + break; - case PT_RREP: - if (wb_rrep((struct pkt_rrep *)(ph + 1), len) >= 0) - return; - break; + case PT_RREQ: + if (wb_rreq((struct pkt_rreq *)(ph + 1), len) >= 0) + return; + break; - case PT_DRAWOP: - if (wb_drawop((struct pkt_dop *)(ph + 1), len) >= 0) - return; - break; + case PT_RREP: + if (wb_rrep((struct pkt_rrep *)(ph + 1), len) >= 0) + return; + break; - case PT_PREQ: - if (wb_preq((struct pkt_preq *)(ph + 1), len) >= 0) - return; - break; + case PT_DRAWOP: + if (wb_drawop((struct pkt_dop *)(ph + 1), len) >= 0) + return; + break; - case PT_PREP: - if (wb_prep((struct pkt_prep *)(ph + 1), len) >= 0) - return; - break; + case PT_PREQ: + if (wb_preq((struct pkt_preq *)(ph + 1), len) >= 0) + return; + break; - default: - printf(" wb-%d!", ph->ph_type); + 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]"); } diff --git a/contrib/tcpdump/savestr.c b/contrib/tcpdump/savestr.c new file mode 100644 index 0000000..2b0c864 --- /dev/null +++ b/contrib/tcpdump/savestr.c @@ -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 + +#ifdef HAVE_MALLOC_H +#include +#endif +#include +#include + +#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); +} diff --git a/contrib/tcpdump/savestr.h b/contrib/tcpdump/savestr.h new file mode 100644 index 0000000..51b4402 --- /dev/null +++ b/contrib/tcpdump/savestr.h @@ -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 *); diff --git a/contrib/tcpdump/setsignal.c b/contrib/tcpdump/setsignal.c new file mode 100644 index 0000000..6f797ff --- /dev/null +++ b/contrib/tcpdump/setsignal.c @@ -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 + +#ifdef HAVE_MEMORY_H +#include +#endif +#include +#ifdef HAVE_SIGACTION +#include +#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 +} + diff --git a/contrib/tcpdump/setsignal.h b/contrib/tcpdump/setsignal.h new file mode 100644 index 0000000..39b6065 --- /dev/null +++ b/contrib/tcpdump/setsignal.h @@ -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 diff --git a/contrib/tcpdump/tcpdump.1 b/contrib/tcpdump/tcpdump.1 index 68757a4..d1be277 100644 --- a/contrib/tcpdump/tcpdump.1 +++ b/contrib/tcpdump/tcpdump.1 @@ -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 diff --git a/contrib/tcpdump/tcpdump.c b/contrib/tcpdump/tcpdump.c index 3076a79..14a12e7 100644 --- a/contrib/tcpdump/tcpdump.c +++ b/contrib/tcpdump/tcpdump.c @@ -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, diff --git a/contrib/tcpdump/util.c b/contrib/tcpdump/util.c index 254a64e..6b07200 100644 --- a/contrib/tcpdump/util.c +++ b/contrib/tcpdump/util.c @@ -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 @@ -34,6 +34,9 @@ static const char rcsid[] = #ifdef HAVE_FCNTL_H #include #endif +#ifdef HAVE_MALLOC_H +#include +#endif #include #include #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); -} -- cgit v1.1