diff --git a/contrib/tcpdump/CHANGES b/contrib/tcpdump/CHANGES index b88730011645..9639d4104be3 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 549cee3b8e24..47ffa71c7b81 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 9d6b9e17417e..edb4b1be6b00 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 03aa51acf602..2ad1b244a8ba 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) -tcpdump: $(OBJ) @V_PCAPDEP@ +all: $(PROG) + +$(PROG): $(OBJ) @V_PCAPDEP@ @rm -f $@ - $(CC) $(CFLAGS) -o $@ $(OBJ) $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) version.o: version.c version.c: $(srcdir)/VERSION @@ -105,13 +113,14 @@ version.c: $(srcdir)/VERSION sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@ install: force - $(INSTALL) -m 550 -o bin -g @V_GROUP@ tcpdump $(DESTDIR)$(BINDEST) + $(INSTALL) -m 550 -o bin -g @V_GROUP@ $(PROG) \ + $(DESTDIR)$(BINDEST)/$(PROG) install-man: force - $(INSTALL) -m 444 -o bin -g bin $(srcdir)/tcpdump.1 \ - $(DESTDIR)$(MANDEST)/man1 + $(INSTALL) -m 444 -o bin -g bin $(srcdir)/$(PROG).1 \ + $(DESTDIR)$(MANDEST)/man1/$(PROG).1 -lint: $(GENSRC) force +lint: $(GENSRC) force lint -hbxn $(SRC) | \ grep -v 'struct/union .* never defined' | \ grep -v 'possible pointer alignment problem' @@ -123,11 +132,11 @@ distclean: rm -f $(CLEANFILES) Makefile config.cache config.log config.status \ gnuc.h os-proto.h -tags: $(TAGFILES) +tags: $(TAGFILES) ctags -wtd $(TAGFILES) -tar: force - @cwd=`pwd` ; dir=`basename $$cwd` ; name=tcpdump-`cat VERSION` ; \ +tar: force + @cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \ list="" ; tar="tar chFFf" ; \ for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \ echo \ @@ -140,6 +149,6 @@ tar: force "rm -f ../$$name" ; \ rm -f ../$$name -force: /tmp -depend: $(GENSRC) force +force: /tmp +depend: $(GENSRC) force ./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC) diff --git a/contrib/tcpdump/README b/contrib/tcpdump/README index db670f76f7db..b607c4face6e 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. +The program is loosely based on SMI's "etherfind" although none of the +etherfind code remains. It was originally written by Van Jacobson as +part of an ongoing research project to investigate and improve tcp and +internet gateway performance. The parts of the program originally +taken from Sun's etherfind were later re-written by Steven McCanne of +LBL. To insure that there would be no vestige of proprietary code in +tcpdump, Steve wrote these pieces from the specification given by the +manual entry, with no access to the source of tcpdump or etherfind. -Over the past few years, tcpdump has been steadily improved -by the excellent contributions from the Internet community -(just browse through the CHANGES file). We are grateful for -all the input. +Over the past few years, tcpdump has been steadily improved by the +excellent contributions from the Internet community (just browse +through the CHANGES file). We are grateful for all the input. -Richard Stevens gives an excellent treatment of the Internet -protocols in his book ``TCP/IP Illustrated, Volume 1''. -If you want to learn more about tcpdump and how to interpret -its output, pick up this book. +Richard Stevens gives an excellent treatment of the Internet protocols +in his book ``TCP/IP Illustrated, Volume 1''. If you want to learn more +about tcpdump and how to interpret its output, pick up this book. Some tools for viewing and analyzing tcpdump trace files are available from the Internet Traffic Archive: - http://town.hall.org/Archives/pub/ITA/ + http://www.acm.org/sigcomm/ITA/ + +Another tool that tcpdump users might find useful is tcpslice: + + ftp://ftp.ee.lbl.gov/tcpslice.tar.Z + +It is a program that can be used to extract portions of tcpdump binary +trace files. See the above distribution for further details and +documentation. Problems, bugs, questions, desirable enhancements, source code contributions, etc., should be sent to the email address diff --git a/contrib/tcpdump/VERSION b/contrib/tcpdump/VERSION index eb39e5382f4f..2f4b60750dc3 100644 --- a/contrib/tcpdump/VERSION +++ b/contrib/tcpdump/VERSION @@ -1 +1 @@ -3.3 +3.4 diff --git a/contrib/tcpdump/addrtoname.h b/contrib/tcpdump/addrtoname.h index 1754ee030216..9c43cb87f979 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 ca845122dcb6..3afbf90bb915 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,528 +1510,15 @@ 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 "(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" - -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 -fi -case "$target_os" in -irix5.0*) - ;; - -irix5.1*) - ;; - -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 - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lsocket $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 socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - - ;; -esac - -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:1575: 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 < -/* 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() { - -/* 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:1603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - 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_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -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 - 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" - -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 - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#include -#include -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 - rm -rf conftest* - ac_cv_header_stdc=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 -fi -rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -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 - : -else - 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); } - -EOF -if { (eval echo configure:1824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi - -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 - -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 - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_int32_t=yes -else - rm -rf conftest* - ac_cv_type_int32_t=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 - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "u_int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_u_int32_t=yes -else - rm -rf conftest* - ac_cv_type_u_int32_t=no -fi -rm -f conftest* - -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 -EOF - - else - echo "configure: warning: can't find $name" 1>&2 - fi - fi - -echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1942: checking return type of signal handlers" >&5 + 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 cat > conftest.$ac_ext < #include @@ -1960,7 +1535,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1999,15 +1574,15 @@ EOF ;; *) - for ac_func in sigset + for ac_func in sigset do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2006: checking for $ac_func" >&5 +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 cat > conftest.$ac_ext <&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_func_$ac_func=yes" else @@ -2054,21 +1629,789 @@ else fi done - if test $ac_cv_func_sigset = yes ; then - cat >> confdefs.h <<\EOF -#define signal sigset + 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: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 < +/* 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() { + +/* 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: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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done fi ;; esac -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 + + + # 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 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() { + +/* 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:1725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_gethostbyname=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_gethostbyname=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +# 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 + 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_lbl_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + 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 <&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* + 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 <&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* + 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 +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 <&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 resolv | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +fi + +fi + +fi + +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 < +/* 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 echo configure:1959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_socket=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_socket=no" +fi +rm -f conftest* +fi + +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 + ac_save_LIBS="$LIBS" +LIBS="-lsocket $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 socket | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&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 + ac_save_LIBS="$LIBS" +LIBS="-lsocket -lnsl $LIBS" +cat > conftest.$ac_ext <&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* + 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 + +fi + +fi + + # 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" + +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 +fi + + + + 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: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 < +/* 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() { + +/* 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: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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +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: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: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 65bf5a96ffa9..f2a212639706 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 000000000000..5812cfecbbe5 --- /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 000000000000..4933b0913764 --- /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 0b14a0a2b170..7ccb3f5be877 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 cd0a76b7795e..7c0e7726448f 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 89c10d52bdaa..36185a7ec1c0 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 11a7d99dd838..7dd443a82845 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/ospf.h b/contrib/tcpdump/ospf.h index c111a9047e91..eee79441fb38 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/ppp.h b/contrib/tcpdump/ppp.h new file mode 100644 index 000000000000..ccd546a0b389 --- /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-decnet.c b/contrib/tcpdump/print-decnet.c index 695ab179735b..29b85bdacc03 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-igrp.c b/contrib/tcpdump/print-igrp.c index ca994d1ea3f7..87e8e79819fe 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-krb.c b/contrib/tcpdump/print-krb.c index 99cb5819429c..eca6265fa611 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-ospf.c b/contrib/tcpdump/print-ospf.c index 44e8737048a7..3de4ce53401f 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-raw.c b/contrib/tcpdump/print-raw.c new file mode 100644 index 000000000000..36289550d0c0 --- /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-snmp.c b/contrib/tcpdump/print-snmp.c index c98fdbe587ea..83674705b393 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-tcp.c b/contrib/tcpdump/print-tcp.c index e9bf240730ee..fbda84c409dd 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 5a0b61836630..d8a7b3e6474e 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-wb.c b/contrib/tcpdump/print-wb.c index 12e408123085..cd60848e37b5 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; - len -= sizeof(*ph); - if (len < 0 || (u_char *)(ph + 1) <= snapend) { - if (ph->ph_flags) - printf("*"); - switch (ph->ph_type) { - - case PT_KILL: - printf(" wb-kill"); - return; - - case PT_ID: - if (wb_id((struct pkt_id *)(ph + 1), len) >= 0) - return; - break; - - case PT_RREQ: - if (wb_rreq((struct pkt_rreq *)(ph + 1), len) >= 0) - return; - break; - - case PT_RREP: - if (wb_rrep((struct pkt_rrep *)(ph + 1), len) >= 0) - return; - break; - - case PT_DRAWOP: - if (wb_drawop((struct pkt_dop *)(ph + 1), len) >= 0) - return; - break; - - case PT_PREQ: - if (wb_preq((struct pkt_preq *)(ph + 1), len) >= 0) - return; - break; - - case PT_PREP: - if (wb_prep((struct pkt_prep *)(ph + 1), len) >= 0) - return; - break; - - default: - printf(" wb-%d!", ph->ph_type); - return; - } + if (len < sizeof(*ph) || (u_char *)(ph + 1) > snapend) { + printf("[|wb]"); + return; + } + len -= sizeof(*ph); + + if (ph->ph_flags) + printf("*"); + switch (ph->ph_type) { + + case PT_KILL: + printf(" wb-kill"); + return; + + case PT_ID: + if (wb_id((struct pkt_id *)(ph + 1), len) >= 0) + return; + break; + + case PT_RREQ: + if (wb_rreq((struct pkt_rreq *)(ph + 1), len) >= 0) + return; + break; + + case PT_RREP: + if (wb_rrep((struct pkt_rrep *)(ph + 1), len) >= 0) + return; + break; + + case PT_DRAWOP: + if (wb_drawop((struct pkt_dop *)(ph + 1), len) >= 0) + return; + break; + + case PT_PREQ: + if (wb_preq((struct pkt_preq *)(ph + 1), len) >= 0) + return; + break; + + case PT_PREP: + if (wb_prep((struct pkt_prep *)(ph + 1), len) >= 0) + return; + break; + + default: + printf(" wb-%d!", ph->ph_type); + return; } - printf("[|wb]"); } diff --git a/contrib/tcpdump/savestr.c b/contrib/tcpdump/savestr.c new file mode 100644 index 000000000000..2b0c86468ff3 --- /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 000000000000..51b440291339 --- /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 000000000000..6f797ff83ceb --- /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 000000000000..39b606597e57 --- /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.c b/contrib/tcpdump/tcpdump.c index 3076a79216c6..14a12e7e86ae 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 254a64e885c6..6b072001758e 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); -}