summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>1997-05-27 02:11:31 +0000
committerfenner <fenner@FreeBSD.org>1997-05-27 02:11:31 +0000
commita9b9c86c8a0ccde5c1480bf5a0ba250d949a6d65 (patch)
treee094325bbde8f6c3c673d34a84cb20359f0f55fd /contrib/tcpdump
parent97a804ef88319863cfa8146c068ec895f4ad8316 (diff)
downloadFreeBSD-src-a9b9c86c8a0ccde5c1480bf5a0ba250d949a6d65.zip
FreeBSD-src-a9b9c86c8a0ccde5c1480bf5a0ba250d949a6d65.tar.gz
Virgin import of LBL tcpdump v3.3
Diffstat (limited to 'contrib/tcpdump')
-rw-r--r--contrib/tcpdump/CHANGES44
-rw-r--r--contrib/tcpdump/FILES16
-rw-r--r--contrib/tcpdump/INSTALL70
-rw-r--r--contrib/tcpdump/Makefile.in37
-rw-r--r--contrib/tcpdump/README4
-rw-r--r--contrib/tcpdump/VERSION2
-rw-r--r--contrib/tcpdump/acsite.m4505
-rw-r--r--contrib/tcpdump/addrtoname.c28
-rw-r--r--contrib/tcpdump/bpf_dump.c6
-rwxr-xr-xcontrib/tcpdump/config.guess203
-rwxr-xr-xcontrib/tcpdump/config.sub150
-rwxr-xr-xcontrib/tcpdump/configure867
-rwxr-xr-xcontrib/tcpdump/configure.in87
-rw-r--r--contrib/tcpdump/extract.h4
-rw-r--r--contrib/tcpdump/igrp.h6
-rwxr-xr-xcontrib/tcpdump/install-sh18
-rw-r--r--contrib/tcpdump/interface.h166
-rw-r--r--contrib/tcpdump/lbl/os-solaris2.h65
-rw-r--r--contrib/tcpdump/lbl/os-sunos4.h24
-rw-r--r--contrib/tcpdump/lbl/os-ultrix4.h39
-rw-r--r--contrib/tcpdump/machdep.c4
-rw-r--r--contrib/tcpdump/nfsfh.h4
-rw-r--r--contrib/tcpdump/parsenfsfh.c53
-rw-r--r--contrib/tcpdump/print-arp.c6
-rw-r--r--contrib/tcpdump/print-atalk.c5
-rw-r--r--contrib/tcpdump/print-atm.c4
-rw-r--r--contrib/tcpdump/print-bootp.c4
-rw-r--r--contrib/tcpdump/print-decnet.c6
-rw-r--r--contrib/tcpdump/print-domain.c6
-rw-r--r--contrib/tcpdump/print-dvmrp.c115
-rw-r--r--contrib/tcpdump/print-egp.c6
-rw-r--r--contrib/tcpdump/print-ether.c4
-rw-r--r--contrib/tcpdump/print-fddi.c6
-rw-r--r--contrib/tcpdump/print-gre.c141
-rw-r--r--contrib/tcpdump/print-icmp.c6
-rw-r--r--contrib/tcpdump/print-igrp.c4
-rw-r--r--contrib/tcpdump/print-ip.c40
-rw-r--r--contrib/tcpdump/print-ipx.c13
-rw-r--r--contrib/tcpdump/print-isoclns.c8
-rw-r--r--contrib/tcpdump/print-krb.c30
-rw-r--r--contrib/tcpdump/print-llc.c8
-rw-r--r--contrib/tcpdump/print-netbios.c18
-rw-r--r--contrib/tcpdump/print-nfs.c192
-rw-r--r--contrib/tcpdump/print-ntp.c6
-rw-r--r--contrib/tcpdump/print-null.c12
-rw-r--r--contrib/tcpdump/print-ospf.c892
-rw-r--r--contrib/tcpdump/print-pim.c4
-rw-r--r--contrib/tcpdump/print-ppp.c4
-rw-r--r--contrib/tcpdump/print-rip.c6
-rw-r--r--contrib/tcpdump/print-sl.c7
-rw-r--r--contrib/tcpdump/print-snmp.c11
-rw-r--r--contrib/tcpdump/print-sunrpc.c4
-rw-r--r--contrib/tcpdump/print-tcp.c80
-rw-r--r--contrib/tcpdump/print-tftp.c4
-rw-r--r--contrib/tcpdump/print-udp.c180
-rw-r--r--contrib/tcpdump/print-wb.c36
-rw-r--r--contrib/tcpdump/strcasecmp.c2
-rw-r--r--contrib/tcpdump/tcpdump.155
-rw-r--r--contrib/tcpdump/tcpdump.c24
-rw-r--r--contrib/tcpdump/util.c68
-rw-r--r--contrib/tcpdump/vfprintf.c4
61 files changed, 2725 insertions, 1698 deletions
diff --git a/contrib/tcpdump/CHANGES b/contrib/tcpdump/CHANGES
index d98f033..b887300 100644
--- a/contrib/tcpdump/CHANGES
+++ b/contrib/tcpdump/CHANGES
@@ -1,4 +1,46 @@
-@(#) $Header: CHANGES,v 1.42 96/07/23 14:36:37 leres Exp $ (LBL)
+@(#) $Header: CHANGES,v 1.45 96/12/07 20:38:04 leres Exp $ (LBL)
+
+v3.3 Sat Nov 30 20:56:27 PST 1996
+
+- Added Linux support.
+
+- GRE encapsulated packet printer thanks to John Hawkinson
+ (jhawk@mit.edu)
+
+- Rewrite gmt2local() to avoid problematic os dependencies.
+
+- Suppress nfs truncation message on errors.
+
+- Add missing m4 quoting in AC_LBL_UNALIGNED_ACCESS autoconf macro.
+ Reported by Joachim Ott (ott@ardala.han.de)
+
+- Enable "ip_hl vs. ip_vhl" workaround for OSF4 too.
+
+- Print arp hardware type in host order. Thanks to Onno van der Linden
+ (onno@simplex.nl)
+
+- Avoid solaris compiler warnings. Thanks to Bruce Barnett
+ (barnett@grymoire.crd.ge.com)
+
+- Fix rip printer to not print one more route than is actually in the
+ packet. Thanks to Jean-Luc Richier (Jean-Luc.Richier@imag.fr) and
+ Bill Fenner (fenner@parc.xerox.com)
+
+- Use autoconf endian detection since BYTE_ORDER isn't defined on all systems.
+
+- Fix dvmrp printer truncation checks and add a dvmrp probe printer.
+ Thanks to Danny J. Mitzel (mitzel@ipsilon.com)
+
+- Rewrite ospf printer to improve truncation checks.
+
+- Don't parse tcp options past the EOL. As noted by David Sacerdote
+ (davids@secnet.com). Also, check tcp options to make sure they ar
+ actually in the tcp header (in addition to the normal truncation
+ checks). Fix the SACK code to print the N blocks (instead of the
+ first block N times).
+
+- Don't say really small UDP packets are truncated just because they
+ aren't big enough to be a RPC. As noted by David Sacerdote.
v3.2.1 Sun Jul 14 03:02:26 PDT 1996
diff --git a/contrib/tcpdump/FILES b/contrib/tcpdump/FILES
index 5d4c338..549cee3 100644
--- a/contrib/tcpdump/FILES
+++ b/contrib/tcpdump/FILES
@@ -4,7 +4,7 @@ INSTALL
Makefile.in
README
VERSION
-aclocal.m4
+acsite.m4
addrtoname.c
addrtoname.h
appletalk.h
@@ -26,6 +26,19 @@ ipx.h
lbl/gnuc.h
lbl/os-solaris2.h
lbl/os-sunos4.h
+lbl/os-ultrix4.h
+linux-include/net/slcompress.h
+linux-include/net/slip.h
+linux-include/netinet/if_ether.h
+linux-include/netinet/in_systm.h
+linux-include/netinet/ip.h
+linux-include/netinet/ip_icmp.h
+linux-include/netinet/ip_var.h
+linux-include/netinet/tcp.h
+linux-include/netinet/tcp_var.h
+linux-include/netinet/tcpip.h
+linux-include/netinet/udp.h
+linux-include/netinet/udp_var.h
llc.h
machdep.c
machdep.h
@@ -49,6 +62,7 @@ print-dvmrp.c
print-egp.c
print-ether.c
print-fddi.c
+print-gre.c
print-icmp.c
print-igrp.c
print-ip.c
diff --git a/contrib/tcpdump/INSTALL b/contrib/tcpdump/INSTALL
index c5512c0..9d6b9e1 100644
--- a/contrib/tcpdump/INSTALL
+++ b/contrib/tcpdump/INSTALL
@@ -1,4 +1,4 @@
-@(#) $Header: INSTALL,v 1.25 96/07/21 04:02:01 leres Exp $ (LBL)
+@(#) $Header: INSTALL,v 1.28 96/12/11 20:15:42 leres Exp $ (LBL)
If you have not built libpcap, do so first. See the README
file in this directory for the ftp location.
@@ -7,7 +7,7 @@ You will need an ANSI C compiler to build tcpdump. The configure script
will abort if your compiler is not ANSI compliant. If this happens, use
the GNU C compiler, available via anonymous ftp:
- ftp://prep.ai.mit.edu/pub/gnu/gcc-*.tar.gz
+ ftp://prep.ai.mit.edu/pub/gnu/gcc.tar.gz
After libpcap has been built (either install it with "make install" and
"make install-incl" or make sure both the libpcap and tcpdump source
@@ -28,6 +28,20 @@ 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 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
+generates warnings instead of fatal errors (?!?!) This makes configure
+think that the ether_arp struct is used when in fact it is not. To get
+around this, delete:
+
+ -DETHER_HEADER_HAS_EA=1 -DETHER_ARP_HAS_EA=1
+
+from the Makefile after running configure (and before attempting to
+compile tcpdump.
+
+Another workaround is to use gcc.
+
If your system is not one which we have tested tcpdump on, you may have
to modify the configure script and Makefile.in. Please send us patches
for any modifications you need to make. However, we are not interested
@@ -43,11 +57,11 @@ INSTALL - this file
Makefile.in - compilation rules (input to the configure script)
README - description of distribution
VERSION - version of this release
-aclocal.m4 - autoconf macros
+acsite.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
+atime.awk - TCP ack awk script
bootp.h - BOOTP definitions
bpf_dump.c - bpf instruction pretty-printer routine
config.guess - autoconf support
@@ -57,13 +71,14 @@ configure.in - configure script source
decnet.h - DECnet definitions
ethertype.h - ethernet definitions
extract.h - alignment definitions
-fddi.h - FDDI definitions
-igrp.h - Interior Gateway Routing Protoco definitions
+fddi.h - Fiber Distributed Data Interface definitions
+igrp.h - Interior Gateway Routing Protocol definitions
install-sh - BSD style install script
interface.h - globals, prototypes and definitions
ipx.h - IPX definitions
lbl/gnuc.h - gcc macros and defines
lbl/os-*.h - os dependent defines and prototypes
+linux-include/* - network include files missing on Linux
llc.h - LLC definitions
machdep.c - machine dependent routines
machdep.h - machine dependent definitions
@@ -71,45 +86,46 @@ makemib - mib to header script
mib.h - mib definitions
mkdep - construct Makefile dependency list
netbios.h - NETBIOS definitions
-nfsfh.h - NFS file handle definitions
-nfsv2.h - NFS V2 definitions
-ntp.h - NTP definitions
-ospf.h - OSPF definitions
-packetdat.awk - tcp chunk summary awk script
-parsenfsfh.c - NFS file parser routines
-print-arp.c - ARP printer routines
+nfsfh.h - Network File System file handle definitions
+nfsv2.h - Network File System V2 definitions
+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
+print-arp.c - Address Resolution Protocol printer routines
print-atalk.c - AppleTalk printer routines
print-atm.c - atm printer routines
print-bootp.c - BOOTP printer routines
print-decnet.c - DECnet printer routines
print-domain.c - Domain Name System printer routines
-print-egp.c - EGP printer routines
+print-egp.c - External Gateway Protocol printer routines
print-ether.c - ethernet printer routines
-print-fddi.c - FDDI printer routines
-print-icmp.c - ICMP printer routines
-print-igrp.c - Interior Gateway Routing Protoco printer routines
+print-fddi.c - Fiber Distributed Data Interface printer routines
+print-gre.c - Generic Routing Encapsulation printer routines
+print-icmp.c - Internet Control Message Protocol printer routines
+print-igrp.c - Interior Gateway Routing Protocol printer routines
print-ip.c - ip printer routines
print-ipx.c - IPX printer routines
print-isoclns.c - isoclns printer routines
print-krb.c - Kerberos printer routines
print-llc.c - llc printer routines
print-netbios.c - netbios printer routines
-print-nfs.c - NFS printer routines
-print-ntp.c - NTP printer routines
+print-nfs.c - Network File System printer routines
+print-ntp.c - Network Time Protocol printer routines
print-null.c - null printer routines
-print-ospf.c - ospf printer routines
+print-ospf.c - Open Shortest Path First printer routines
print-pim.c - Protocol Independent Multicast printer routines
-print-ppp.c - PPP printer routines
-print-rip.c - RIP printer routines
-print-sl.c - CSLIP printer routines
-print-snmp.c - SNMP printer routines
-print-sunrpc.c - Sun RPC printer routines
+print-ppp.c - Point to Point Protocol 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
+print-sunrpc.c - Sun Remote Procedure Call printer routines
print-tcp.c - TCP printer routines
-print-tftp.c - TFTP printer routines
+print-tftp.c - Trivial File Transfer Protocol printer routines
print-udp.c - UDP printer routines
print-wb.c - white board printer routines
send-ack.awk - unidirectional tcp send/ack awk script
-stime.awk - tcp send awk script
+stime.awk - TCP send awk script
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 f4490ba..03aa51a 100644
--- a/contrib/tcpdump/Makefile.in
+++ b/contrib/tcpdump/Makefile.in
@@ -17,7 +17,7 @@
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# @(#) $Header: Makefile.in,v 1.195 96/07/16 23:52:06 leres Exp $ (LBL)
+# @(#) $Header: Makefile.in,v 1.198 96/12/05 22:12:11 leres Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
@@ -31,6 +31,10 @@ BINDEST = @sbindir@
# Pathname of directory to install the man page
MANDEST = @mandir@
+# VPATH
+srcdir = @srcdir@
+VPATH = @srcdir@
+
#
# You shouldn't need to edit anything below here.
#
@@ -53,18 +57,17 @@ INSTALL = @INSTALL@
# problem if you don't own the file but can write to the directory.
.c.o:
@rm -f $@
- $(CC) $(CFLAGS) -c $*.c
-
-CSRC = tcpdump.c addrtoname.c \
- print-ether.c print-ip.c print-arp.c print-tcp.c \
- print-udp.c print-atalk.c print-domain.c print-tftp.c \
- print-bootp.c print-nfs.c print-icmp.c print-igrp.c \
- print-sl.c print-ppp.c print-rip.c print-snmp.c \
- print-ntp.c print-null.c print-egp.c print-ospf.c \
- print-fddi.c print-llc.c print-sunrpc.c print-wb.c \
- print-decnet.c print-isoclns.c print-ipx.c \
- print-atm.c print-dvmrp.c print-pim.c print-krb.c \
- util.c machdep.c bpf_dump.c parsenfsfh.c
+ $(CC) $(CFLAGS) -c $(srcdir)/$*.c
+
+CSRC = tcpdump.c \
+ print-arp.c print-atalk.c print-atm.c print-bootp.c \
+ print-decnet.c print-domain.c print-dvmrp.c print-egp.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
LOCALSRC =
GENSRC = version.c
@@ -79,6 +82,7 @@ HDR = addrtoname.h appletalk.h bootp.h decnet.h \
TAGHDR = \
/usr/include/arpa/tftp.h \
+ /usr/include/net/if_arp.h \
/usr/include/net/slip.h \
/usr/include/netinet/if_ether.h \
/usr/include/netinet/in.h \
@@ -96,15 +100,16 @@ tcpdump: $(OBJ) @V_PCAPDEP@
$(CC) $(CFLAGS) -o $@ $(OBJ) $(LIBS)
version.o: version.c
-version.c: VERSION
+version.c: $(srcdir)/VERSION
@rm -f $@
- sed -e 's/.*/char version[] = "&";/' VERSION > $@
+ sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@
install: force
$(INSTALL) -m 550 -o bin -g @V_GROUP@ tcpdump $(DESTDIR)$(BINDEST)
install-man: force
- $(INSTALL) -m 444 -o bin -g bin tcpdump.1 $(DESTDIR)$(MANDEST)/man1
+ $(INSTALL) -m 444 -o bin -g bin $(srcdir)/tcpdump.1 \
+ $(DESTDIR)$(MANDEST)/man1
lint: $(GENSRC) force
lint -hbxn $(SRC) | \
diff --git a/contrib/tcpdump/README b/contrib/tcpdump/README
index 49a4578b..db670f7 100644
--- a/contrib/tcpdump/README
+++ b/contrib/tcpdump/README
@@ -1,6 +1,6 @@
-@(#) $Header: README,v 1.49 96/07/15 18:28:23 leres Exp $ (LBL)
+@(#) $Header: README,v 1.50 96/08/20 14:36:28 leres Exp $ (LBL)
-TCPDUMP 3.2.1
+TCPDUMP 3.3
Lawrence Berkeley National Laboratory
Network Research Group
tcpdump@ee.lbl.gov
diff --git a/contrib/tcpdump/VERSION b/contrib/tcpdump/VERSION
index e4604e3..eb39e53 100644
--- a/contrib/tcpdump/VERSION
+++ b/contrib/tcpdump/VERSION
@@ -1 +1 @@
-3.2.1
+3.3
diff --git a/contrib/tcpdump/acsite.m4 b/contrib/tcpdump/acsite.m4
new file mode 100644
index 0000000..746faf1
--- /dev/null
+++ b/contrib/tcpdump/acsite.m4
@@ -0,0 +1,505 @@
+dnl @(#) $Header: acsite.m4,v 1.41 96/11/29 15:30:40 leres Exp $ (LBL)
+dnl
+dnl Copyright (c) 1995, 1996
+dnl The Regents of the University of California. All rights reserved.
+dnl
+dnl Redistribution and use in source and binary forms, with or without
+dnl modification, are permitted provided that: (1) source code distributions
+dnl retain the above copyright notice and this paragraph in its entirety, (2)
+dnl distributions including binary code include the above copyright notice and
+dnl this paragraph in its entirety in the documentation or other materials
+dnl provided with the distribution, and (3) all advertising materials mentioning
+dnl features or use of this software display the following acknowledgement:
+dnl ``This product includes software developed by the University of California,
+dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+dnl the University nor the names of its contributors may be used to endorse
+dnl or promote products derived from this software without specific prior
+dnl written permission.
+dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+dnl
+dnl LBL autoconf macros
+dnl
+
+dnl
+dnl Determine which compiler we're using (cc or gcc)
+dnl If using gcc, determine the version number
+dnl If using cc, require that it support ansi prototypes
+dnl If using gcc, use -O2 (otherwise use -O)
+dnl If using cc, explicitly specify /usr/local/include
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_C_INIT(copt, incls)
+dnl
+dnl results:
+dnl
+dnl $1 (copt set)
+dnl $2 (incls set)
+dnl CC
+dnl ac_cv_gcc_vers
+dnl LBL_CFLAGS
+dnl
+dnl XXX need to add test to make sure ac_prog_cc hasn't been called
+AC_DEFUN(AC_LBL_C_INIT,
+ [AC_PREREQ(2.12)
+ $1=-O
+ $2=""
+ if test "${CFLAGS+set}" = set; then
+ LBL_CFLAGS="$CFLAGS"
+ fi
+ if test -z "$CC" ; then
+ case "$target_os" in
+
+ bsdi*)
+ AC_CHECK_PROG(SHLICC2, shlicc2, yes, no)
+ if test $SHLICC2 = yes ; then
+ CC=shlicc2
+ export CC
+ fi
+ ;;
+ esac
+ fi
+ AC_PROG_CC
+ if test $ac_cv_prog_gcc = yes ; then
+ if test "$SHLICC2" = yes ; then
+ ac_cv_gcc_vers=2
+ $1=-O2
+ else
+ AC_MSG_CHECKING(gcc version)
+ AC_CACHE_VAL(ac_cv_gcc_vers,
+ ac_cv_gcc_vers=`$CC -v 2>&1 | \
+ sed -n -e '$s/.* //' -e '$s/\..*//p'`)
+ AC_MSG_RESULT($ac_cv_gcc_vers)
+ if test $ac_cv_gcc_vers -gt 1 ; then
+ $1=-O2
+ fi
+ fi
+ else
+ AC_MSG_CHECKING(that $CC handles ansi prototypes)
+ AC_CACHE_VAL(ac_cv_cc_ansi_prototypes,
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>],
+ [int frob(int, char *)],
+ ac_cv_cc_ansi_prototypes=yes,
+ ac_cv_cc_ansi_prototypes=no))
+ AC_MSG_RESULT($ac_cv_cc_ansi_prototypes)
+ if test $ac_cv_cc_ansi_prototypes = no ; then
+ case "$target_os" in
+
+ hpux*)
+ AC_MSG_CHECKING(for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE))
+ savedcflags="$CFLAGS"
+ CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
+ AC_CACHE_VAL(ac_cv_cc_hpux_cc_aa,
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>],
+ [int frob(int, char *)],
+ ac_cv_cc_hpux_cc_aa=yes,
+ ac_cv_cc_hpux_cc_aa=no))
+ AC_MSG_RESULT($ac_cv_cc_hpux_cc_aa)
+ if test $ac_cv_cc_hpux_cc_aa = no ; then
+ AC_MSG_ERROR(see the INSTALL for more info)
+ fi
+ CFLAGS="$savedcflags"
+ V_CCOPT="-Aa $V_CCOPT"
+ AC_DEFINE(_HPUX_SOURCE)
+ ;;
+
+ *)
+ AC_MSG_ERROR(see the INSTALL for more info)
+ ;;
+ esac
+ fi
+ $2=-I/usr/local/include
+
+ case "$target_os" in
+
+ irix*)
+ V_CCOPT="$V_CCOPT -xansi -signed -g3"
+ ;;
+
+ osf*)
+ V_CCOPT="$V_CCOPT -g3"
+ ;;
+
+ ultrix*)
+ AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes)
+ AC_CACHE_VAL(ac_cv_cc_const_proto,
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>],
+ [struct a { int b; };
+ void c(const struct a *)],
+ ac_cv_cc_const_proto=yes,
+ ac_cv_cc_const_proto=no))
+ AC_MSG_RESULT($ac_cv_cc_const_proto)
+ if test $ac_cv_cc_const_proto = no ; then
+ AC_DEFINE(const,)
+ fi
+ ;;
+ esac
+ fi
+])
+
+dnl
+dnl Use pfopen.c if available and pfopen() not in standard libraries
+dnl Require libpcap
+dnl Look for libpcap in ..
+dnl Use the installed libpcap if there is no local version
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_LIBPCAP(pcapdep, incls)
+dnl
+dnl results:
+dnl
+dnl $1 (pcapdep set)
+dnl $2 (incls appended)
+dnl LIBS
+dnl
+AC_DEFUN(AC_LBL_LIBPCAP,
+ [pfopen=/usr/examples/packetfilter/pfopen.c
+ if test -f $pfopen ; then
+ AC_CHECK_FUNCS(pfopen)
+ if test $ac_cv_func_pfopen = "no" ; then
+ AC_MSG_RESULT(Using $pfopen)
+ LIBS="$LIBS $pfopen"
+ fi
+ fi
+ AC_MSG_CHECKING(for local pcap library)
+ libpcap=FAIL
+ lastdir=FAIL
+ places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | \
+ egrep '/libpcap-[[0-9]]*\.[[0-9]]*(\.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
+ for dir in $places ../libpcap libpcap ; do
+ basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'`
+ if test $lastdir = $basedir ; then
+ dnl skip alphas when an actual release is present
+ continue;
+ fi
+ lastdir=$dir
+ if test -r $dir/pcap.c ; then
+ libpcap=$dir/libpcap.a
+ d=$dir
+ dnl continue and select the last one that exists
+ fi
+ done
+ if test $libpcap = FAIL ; then
+ AC_MSG_RESULT(not found)
+ AC_CHECK_LIB(pcap, main, libpcap="-lpcap")
+ if test $libpcap = FAIL ; then
+ AC_MSG_ERROR(see the INSTALL doc for more info)
+ fi
+ else
+ $1=$libpcap
+ $2="-I$d $$2"
+ AC_MSG_RESULT($libpcap)
+ fi
+ LIBS="$libpcap $LIBS"])
+
+dnl
+dnl Define RETSIGTYPE and RETSIGVAL
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_TYPE_SIGNAL
+dnl
+dnl results:
+dnl
+dnl RETSIGTYPE (defined)
+dnl RETSIGVAL (defined)
+dnl
+AC_DEFUN(AC_LBL_TYPE_SIGNAL,
+ [AC_TYPE_SIGNAL
+ if test "$ac_cv_type_signal" = void ; then
+ AC_DEFINE(RETSIGVAL,)
+ else
+ AC_DEFINE(RETSIGVAL,(0))
+ fi
+ case "$target_os" in
+
+ irix*)
+ AC_DEFINE(_BSD_SIGNALS)
+ ;;
+
+ *)
+ AC_CHECK_FUNCS(sigset)
+ if test $ac_cv_func_sigset = yes ; then
+ AC_DEFINE(signal, sigset)
+ fi
+ ;;
+ esac])
+
+dnl
+dnl If using gcc, see if fixincludes should be run
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_FIXINCLUDES
+dnl
+AC_DEFUN(AC_LBL_FIXINCLUDES,
+ [if test $ac_cv_prog_gcc = yes ; then
+ AC_MSG_CHECKING(if fixincludes is needed)
+ AC_CACHE_VAL(ac_cv_gcc_fixincludes,
+ AC_TRY_COMPILE(
+ [/*
+ * This generates a "duplicate case value" when fixincludes
+ * has not be run.
+ */
+# include <sys/types.h>
+# include <sys/time.h>
+# include <sys/ioctl.h>
+# ifdef HAVE_SYS_IOCCOM_H
+# include <sys/ioccom.h>
+# endif],
+ [switch (0) {
+ case _IO('A', 1):;
+ case _IO('B', 1):;
+ }],
+ ac_cv_gcc_fixincludes=yes,
+ ac_cv_gcc_fixincludes=no))
+ AC_MSG_RESULT($ac_cv_gcc_fixincludes)
+ if test $ac_cv_gcc_fixincludes = no ; then
+ # Don't cache failure
+ unset ac_cv_gcc_fixincludes
+ AC_MSG_ERROR(see the INSTALL for more info)
+ fi
+ fi])
+
+dnl
+dnl Check for flex, default to lex
+dnl Require flex 2.4 or higher
+dnl Check for bison, default to yacc
+dnl Default to lex/yacc if both flex and bison are not available
+dnl Define the yy prefix string if using flex and bison
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix)
+dnl
+dnl results:
+dnl
+dnl $1 (lex set)
+dnl $2 (yacc appended)
+dnl $3 (optional flex and bison -P prefix)
+dnl
+AC_DEFUN(AC_LBL_LEX_AND_YACC,
+ [AC_CHECK_PROGS($1, flex, lex)
+ if test "$$1" = flex ; then
+ # The -V flag was added in 2.4
+ AC_MSG_CHECKING(for flex 2.4 or higher)
+ AC_CACHE_VAL(ac_cv_flex_v24,
+ if flex -V >/dev/null 2>&1; then
+ ac_cv_flex_v24=yes
+ else
+ ac_cv_flex_v24=no
+ fi)
+ AC_MSG_RESULT($ac_cv_flex_v24)
+ if test $ac_cv_flex_v24 = no ; then
+ s="2.4 or higher required"
+ AC_MSG_WARN(ignoring obsolete flex executable ($s))
+ $1=lex
+ fi
+ fi
+ AC_CHECK_PROGS($2, bison, yacc)
+ if test "$$2" = bison ; then
+ $2="$$2 -y"
+ fi
+ if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then
+ AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc)
+ $1=lex
+ $2=yacc
+ fi
+ if test "$$1" = flex -a -n "$3" ; then
+ $1="$$1 -P$3"
+ $2="$$2 -p $3"
+ fi])
+
+dnl
+dnl Checks to see if union wait is used with WEXITSTATUS()
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_UNION_WAIT
+dnl
+dnl results:
+dnl
+dnl DECLWAITSTATUS (defined)
+dnl
+AC_DEFUN(AC_LBL_UNION_WAIT,
+ [AC_MSG_CHECKING(if union wait is used)
+ AC_CACHE_VAL(ac_cv_union_wait,
+ AC_TRY_COMPILE([
+# include <sys/types.h>
+# include <sys/wait.h>],
+ [int status;
+ u_int i = WEXITSTATUS(status);
+ u_int j = waitpid(0, &status, 0);],
+ ac_cv_union_wait=no,
+ ac_cv_union_wait=yes))
+ AC_MSG_RESULT($ac_cv_union_wait)
+ if test $ac_cv_union_wait = yes ; then
+ AC_DEFINE(DECLWAITSTATUS,union wait)
+ else
+ AC_DEFINE(DECLWAITSTATUS,int)
+ fi])
+
+dnl
+dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_SOCKADDR_SA_LEN
+dnl
+dnl results:
+dnl
+dnl HAVE_SOCKADDR_SA_LEN (defined)
+dnl
+AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
+ [AC_MSG_CHECKING(if sockaddr struct has sa_len member)
+ AC_CACHE_VAL(ac_cv_sockaddr_has_sa_len,
+ AC_TRY_COMPILE([
+# include <sys/types.h>
+# include <sys/socket.h>],
+ [u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
+ ac_cv_sockaddr_has_sa_len=yes,
+ ac_cv_sockaddr_has_sa_len=no))
+ AC_MSG_RESULT($ac_cv_sockaddr_has_sa_len)
+ if test $ac_cv_sockaddr_has_sa_len = yes ; then
+ AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
+ fi])
+
+dnl
+dnl Checks to see if -R is used
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_HAVE_RUN_PATH
+dnl
+dnl results:
+dnl
+dnl ac_cv_have_run_path (yes or no)
+dnl
+AC_DEFUN(AC_LBL_HAVE_RUN_PATH,
+ [AC_MSG_CHECKING(for ${CC-cc} -R)
+ AC_CACHE_VAL(ac_cv_have_run_path,
+ [echo 'main(){}' > conftest.c
+ ${CC-cc} -o conftest conftest.c -R/a1/b2/c3 >conftest.out 2>&1
+ if test ! -s conftest.out ; then
+ ac_cv_have_run_path=yes
+ else
+ ac_cv_have_run_path=no
+ fi
+ rm -f conftest*])
+ AC_MSG_RESULT($ac_cv_have_run_path)
+ ])
+
+dnl
+dnl Checks to see if unaligned memory accesses fail
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_UNALIGNED_ACCESS
+dnl
+dnl results:
+dnl
+dnl LBL_ALIGN (DEFINED)
+dnl
+AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
+ [AC_MSG_CHECKING(if unaligned accesses fail)
+ AC_CACHE_VAL(ac_cv_unaligned_fail,
+ [case "$target_cpu" in
+
+ alpha|hp*|mips|sparc)
+ ac_cv_unaligned_fail=yes
+ ;;
+
+ *)
+ cat >conftest.c <<EOF
+# include <sys/types.h>
+# include <sys/wait.h>
+# include <stdio.h>
+ unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
+ main() {
+ unsigned int i;
+ pid_t pid;
+ int status;
+ /* avoid "core dumped" message */
+ pid = fork();
+ if (pid < 0)
+ exit(2);
+ if (pid > 0) {
+ /* parent */
+ pid = waitpid(pid, &status, 0);
+ if (pid < 0)
+ exit(3);
+ exit(!WIFEXITED(status));
+ }
+ /* child */
+ i = *(unsigned int *)&a[[1]];
+ printf("%d\n", i);
+ exit(0);
+ }
+EOF
+ ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
+ conftest.c $LIBS >/dev/null 2>&1
+ if test ! -x conftest ; then
+ dnl failed to compile for some reason
+ ac_cv_unaligned_fail=yes
+ else
+ ./conftest >conftest.out
+ if test ! -s conftest.out ; then
+ ac_cv_unaligned_fail=yes
+ else
+ ac_cv_unaligned_fail=no
+ fi
+ fi
+ rm -f conftest* core core.conftest
+ ;;
+ esac])
+ AC_MSG_RESULT($ac_cv_unaligned_fail)
+ if test $ac_cv_unaligned_fail = yes ; then
+ AC_DEFINE(LBL_ALIGN)
+ fi])
+
+dnl
+dnl If using gcc and the file .devel exists:
+dnl Compile with -g (if supported) and -Wall
+dnl If using gcc 2, do extra prototype checking
+dnl If an os prototype include exists, symlink os-proto.h to it
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_DEVEL(copt)
+dnl
+dnl results:
+dnl
+dnl $1 (copt appended)
+dnl HAVE_OS_PROTO_H (defined)
+dnl os-proto.h (symlinked)
+dnl
+AC_DEFUN(AC_LBL_DEVEL,
+ [rm -f os-proto.h
+ if test "${LBL_CFLAGS+set}" = set; then
+ $1="$$1 ${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
+ $1="-g $$1"
+ fi
+ $1="$$1 -Wall"
+ if test $ac_cv_gcc_vers -gt 1 ; then
+ $1="$$1 -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
+ AC_DEFINE(HAVE_OS_PROTO_H)
+ else
+ AC_MSG_WARN(can't find $name)
+ fi
+ fi])
diff --git a/contrib/tcpdump/addrtoname.c b/contrib/tcpdump/addrtoname.c
index af2a757..fbeb2c1 100644
--- a/contrib/tcpdump/addrtoname.c
+++ b/contrib/tcpdump/addrtoname.c
@@ -22,8 +22,8 @@
* and address to string conversion routines
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: addrtoname.c,v 1.49 96/07/02 00:19:35 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: addrtoname.c,v 1.54 96/12/05 22:10:19 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
@@ -164,7 +164,7 @@ getname(const u_char *ap)
addr = *(const u_int32_t *)ap;
#else
/*
- * Deal with alignment.
+ * Extract 32 bits in network order, dealing with alignment.
*/
switch ((long)ap & 3) {
@@ -173,26 +173,26 @@ getname(const u_char *ap)
break;
case 2:
-#if BYTE_ORDER == LITTLE_ENDIAN
- addr = ((u_int32_t)*(u_short *)(ap + 2) << 16) |
- (u_int32_t)*(u_short *)ap;
-#else
+#ifdef WORDS_BIGENDIAN
addr = ((u_int32_t)*(u_short *)ap << 16) |
(u_int32_t)*(u_short *)(ap + 2);
+#else
+ addr = ((u_int32_t)*(u_short *)(ap + 2) << 16) |
+ (u_int32_t)*(u_short *)ap;
#endif
break;
default:
-#if BYTE_ORDER == LITTLE_ENDIAN
- addr = ((u_int32_t)ap[3] << 24) |
- ((u_int32_t)ap[2] << 16) |
- ((u_int32_t)ap[1] << 8) |
- (u_int32_t)ap[0];
-#else
+#ifdef WORDS_BIGENDIAN
addr = ((u_int32_t)ap[0] << 24) |
((u_int32_t)ap[1] << 16) |
((u_int32_t)ap[2] << 8) |
(u_int32_t)ap[3];
+#else
+ addr = ((u_int32_t)ap[3] << 24) |
+ ((u_int32_t)ap[2] << 16) |
+ ((u_int32_t)ap[1] << 8) |
+ (u_int32_t)ap[0];
#endif
break;
}
@@ -738,7 +738,7 @@ dnaddr_string(u_short dnaddr)
/* Return a zero'ed hnamemem struct and cuts down on calloc() overhead */
struct hnamemem *
-newhnamemem()
+newhnamemem(void)
{
register struct hnamemem *p;
static struct hnamemem *ptr = NULL;
diff --git a/contrib/tcpdump/bpf_dump.c b/contrib/tcpdump/bpf_dump.c
index cc345cf..8364325 100644
--- a/contrib/tcpdump/bpf_dump.c
+++ b/contrib/tcpdump/bpf_dump.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1992, 1993, 1994, 1995
+ * Copyright (c) 1992, 1993, 1994, 1995, 1996
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -19,8 +19,8 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: bpf_dump.c,v 1.8 95/10/19 20:28:00 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: bpf_dump.c,v 1.9 96/09/26 23:11:04 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
diff --git a/contrib/tcpdump/config.guess b/contrib/tcpdump/config.guess
index d8c2470..e9e4455 100755
--- a/contrib/tcpdump/config.guess
+++ b/contrib/tcpdump/config.guess
@@ -67,21 +67,28 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-cbm-openbsd${UNAME_RELEASE}
+ exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
- Pyramid*:OSx*:*:*)
+ Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
- sun4*:SunOS:5.*:*)
+ NILE:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
- echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
@@ -101,25 +108,60 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
atari*:NetBSD:*:*)
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-atari-openbsd${UNAME_RELEASE}
+ exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-sun-openbsd${UNAME_RELEASE}
+ exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-apple-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
- mips:*:4*:UMIPS)
- echo mips-mips-riscos4sysv
- exit 0 ;;
- mips:*:5*:RISCos)
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >dummy.c
+ int main (argc, argv) int argc; char **argv; {
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy \
+ && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
@@ -137,7 +179,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88100 ] ; then
+ if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
@@ -163,10 +205,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i[34]86:AIX:*:*)
+ i?86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
@@ -211,7 +253,7 @@ EOF
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
@@ -229,7 +271,7 @@ EOF
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/7?? | 9000/8?[679] ) HP_ARCH=hppa1.1 ;;
+ 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
9000/8?? ) HP_ARCH=hppa1.0 ;;
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
@@ -277,6 +319,13 @@ EOF
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
+ i?86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
@@ -304,17 +353,33 @@ EOF
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE}
exit 0 ;;
- CRAY*C90:*:*:*)
- echo c90-cray-unicos${UNAME_RELEASE}
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
+ F300:UNIX_System_V:*:*)
+ FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
- i[34]86:BSD/386:*:* | *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ hp3[0-9][05]:OpenBSD:*:*)
+ echo m68k-hp-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:BSD/386:*:* | *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
@@ -322,8 +387,11 @@ EOF
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
i*:CYGWIN*:*)
- echo i386-unknown-cygwin32
+ echo i386-pc-cygwin32
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin32
@@ -338,23 +406,27 @@ EOF
# The BFD linker knows what the default object file format is, so
# first see if it will tell us.
ld_help_string=`ld --help 2>&1`
- if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
- echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
- echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
- echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0
+ if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
+ echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
- echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
+ echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
- echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
+ echo "powerpc-unknown-linux-gnu" ; exit 0
elif test "${UNAME_MACHINE}" = "alpha" ; then
- echo alpha-unknown-linux ; exit 0
+ echo alpha-unknown-linux-gnu ; exit 0
+ elif test "${UNAME_MACHINE}" = "sparc" ; then
+ echo sparc-unknown-linux-gnu ; exit 0
else
- # Either a pre-BFD a.out linker (linuxoldld) or one that does not give us
- # useful --help. Gcc wants to distinguish between linuxoldld and linuxaout.
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
+ # useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
test ! -d /usr/lib/ldscripts/. \
- && echo "${UNAME_MACHINE}-unknown-linuxoldld" && exit 0
+ && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
# Determine whether the default compiler is a.out or elf
cat >dummy.c <<EOF
main(argc, argv)
@@ -362,9 +434,9 @@ int argc;
char *argv[];
{
#ifdef __ELF__
- printf ("%s-unknown-linux\n", argv[1]);
+ printf ("%s-pc-linux-gnu\n", argv[1]);
#else
- printf ("%s-unknown-linuxaout\n", argv[1]);
+ printf ("%s-pc-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
@@ -374,32 +446,32 @@ EOF
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
- i[34]86:DYNIX/ptx:4*:*)
+ i?86:DYNIX/ptx:4*:*)
echo i386-sequent-sysv4
exit 0 ;;
- i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*)
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
else
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi
exit 0 ;;
- i[34]86:*:3.2:*)
+ i?86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
- echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
- echo ${UNAME_MACHINE}-unknown-sysv32
+ echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
Intel:Mach:3*:*)
- echo i386-unknown-mach3
+ echo i386-pc-mach3
exit 0 ;;
paragon:*:*:*)
echo i860-intel-osf1
@@ -415,28 +487,36 @@ EOF
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
- M680[234]0:*:R3V[567]*:*)
+ M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0)
- uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4.3 && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- uname -p 2>/dev/null | grep 86 >/dev/null \
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
- m680[234]0:LynxOS:2.[23]*:*)
- echo m68k-lynx-lynxos${UNAME_RELEASE}
+ m68*:LynxOS:2.*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
- i[34]86:LynxOS:2.[23]*:*)
- echo i386-lynx-lynxos${UNAME_RELEASE}
+ i?86:LynxOS:2.*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
- TSUNAMI:LynxOS:2.[23]*:*)
- echo sparc-lynx-lynxos${UNAME_RELEASE}
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
- rs6000:LynxOS:2.[23]*:*)
- echo rs6000-lynx-lynxos${UNAME_RELEASE}
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
@@ -449,16 +529,29 @@ EOF
echo ns32k-sni-sysv
fi
exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
- R3000:*System_V*:*:*)
+ R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
@@ -502,7 +595,7 @@ main ()
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3");
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
@@ -519,7 +612,7 @@ main ()
#endif
#if defined (__386BSD__)
- printf ("i386-unknown-bsd\n"); exit (0);
+ printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
diff --git a/contrib/tcpdump/config.sub b/contrib/tcpdump/config.sub
index e67a800..0432524 100755
--- a/contrib/tcpdump/config.sub
+++ b/contrib/tcpdump/config.sub
@@ -1,9 +1,9 @@
#! /bin/sh
# Configuration validation subroutine script, version 1.1.
-# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
+# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,6 +41,8 @@
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
if [ x$1 = x ]
@@ -62,11 +64,21 @@ case $1 in
;;
esac
-# Separate what the user gave into CPU-COMPANY and OS (if any).
-basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-if [ $basic_machine != $1 ]
-then os=`echo $1 | sed 's/.*-/-/'`
-else os=; fi
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ linux-gnu*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
@@ -81,38 +93,43 @@ case $os in
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple)
os=
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
+ -sco5)
+ os=sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
-sco4)
os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*)
os=-lynxos
@@ -123,35 +140,44 @@ case $os in
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
+ -psos*)
+ os=-psos
+ ;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
- tahoe | i[345]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
+ tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
| arme[lb] | pyramid \
- | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
- | alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
- | powerpc | powerpcle | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
+ | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
+ | alpha | we32k | ns16k | clipper | i370 | sh \
+ | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
| pdp11 | mips64el | mips64orion | mips64orionel \
- | sparc)
+ | sparc | sparclet | sparclite | sparc64)
basic_machine=$basic_machine-unknown
;;
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i[3456]86)
+ basic_machine=$basic_machine-pc
+ ;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
- vax-* | tahoe-* | i[345]86-* | i860-* | m68k-* | m68000-* | m88k-* \
+ vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
- | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
+ | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
- | mips64el-* | mips64orion-* | mips64orionel-*)
+ | mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
@@ -190,6 +216,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-sysv
;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
balance)
basic_machine=ns32k-sequent
os=-dynix
@@ -222,6 +252,10 @@ case $basic_machine in
basic_machine=cray2-cray
os=-unicos
;;
+ [ctj]90-cray)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
crds | unos)
basic_machine=m68k-crds
;;
@@ -303,25 +337,28 @@ case $basic_machine in
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
+ hppa-next)
+ os=-nextstep3
+ ;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i[345]86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ i[3456]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
- i[345]86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ i[3456]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
- i[345]86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ i[3456]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
- i[345]86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ i[3456]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
iris | iris4d)
@@ -419,14 +456,18 @@ case $basic_machine in
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
- pentium | p5 | p6)
- # We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
+ pentium | p5)
basic_machine=i586-intel
;;
- pentium-* | p5-* | p6-*)
- # We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
+ pentiumpro | p6)
+ basic_machine=i686-intel
+ ;;
+ pentium-* | p5-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
+ pentiumpro-* | p6-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
k5)
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
basic_machine=i586-amd
@@ -536,6 +577,9 @@ case $basic_machine in
basic_machine=vax-dec
os=-vms
;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
@@ -615,6 +659,8 @@ esac
if [ x"$os" != x"" ]
then
case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
@@ -626,24 +672,29 @@ case $os in
os=-sysv4
;;
-gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux|'`
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[345]* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigados* | -msdos* | -newsos* | -unicos* | -aos* \
- | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
- | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
+ | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* )
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -linux-gnu* | -uxpv*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
@@ -668,6 +719,9 @@ case $os in
-ctix* | -uts*)
os=-sysv
;;
+ -ns2 )
+ os=-nextstep2
+ ;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
@@ -775,6 +829,9 @@ case $basic_machine in
m88k-omron*)
os=-luna
;;
+ *-next )
+ os=-nextstep
+ ;;
*-sequent)
os=-ptx
;;
@@ -808,6 +865,9 @@ case $basic_machine in
*-masscomp)
os=-rtu
;;
+ f301-fujitsu)
+ os=-uxpv
+ ;;
*)
os=-none
;;
@@ -826,9 +886,6 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
- -lynxos*)
- vendor=lynx
- ;;
-aix*)
vendor=ibm
;;
@@ -856,9 +913,12 @@ case $basic_machine in
-ptx*)
vendor=sequent
;;
- -vxworks*)
+ -vxsim* | -vxworks*)
vendor=wrs
;;
+ -aux*)
+ vendor=apple
+ ;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
diff --git a/contrib/tcpdump/configure b/contrib/tcpdump/configure
index 5083c2f..ca84512 100755
--- a/contrib/tcpdump/configure
+++ b/contrib/tcpdump/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.10
+# Generated automatically using autoconf version 2.12
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@@ -49,6 +49,8 @@ mandir='${prefix}/man'
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
ac_prev=
for ac_option
@@ -330,7 +332,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.10"
+ echo "configure generated by autoconf version 2.12"
exit 0 ;;
-with-* | --with-*)
@@ -432,11 +434,14 @@ do
done
# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -rf conftest* confdefs.h
@@ -498,6 +503,7 @@ ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
@@ -560,6 +566,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
host_alias=$host
case "$host_alias" in
@@ -574,12 +581,13 @@ NONE)
esac
host=`$ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+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
target_alias=$target
case "$target_alias" in
@@ -591,12 +599,13 @@ NONE)
esac
target=`$ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+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
build_alias=$build
case "$build_alias" in
@@ -608,9 +617,9 @@ NONE)
esac
build=`$ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$build" 1>&6
test "$host_alias" != "$target_alias" &&
@@ -625,8 +634,12 @@ if test -z "$PWD" ; then
PWD=`pwd`
fi
-V_CCOPT=-O
+
+ V_CCOPT=-O
V_INCLS=""
+ if test "${CFLAGS+set}" = set; then
+ LBL_CFLAGS="$CFLAGS"
+ fi
if test -z "$CC" ; then
case "$target_os" in
@@ -634,6 +647,7 @@ V_CCOPT=-O
# 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
if eval "test \"`echo '$''{'ac_cv_prog_SHLICC2'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -669,6 +683,7 @@ 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
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -697,6 +712,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
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -743,7 +759,47 @@ fi
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
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
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 774 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+if { (eval echo configure:778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ 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
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+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 "$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
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -752,7 +808,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:756: \"$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:812: \"$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
@@ -760,29 +816,34 @@ fi
fi
echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
if test $ac_cv_prog_gcc = yes; then
GCC=yes
- if test "${CFLAGS+set}" != set; then
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then
+ ac_test_CFLAGS="${CFLAGS+set}"
+ 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
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_gcc_g=yes
+ ac_cv_prog_cc_g=yes
else
- ac_cv_prog_gcc_g=no
+ ac_cv_prog_cc_g=no
fi
rm -f conftest*
fi
-echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
- if test $ac_cv_prog_gcc_g = yes; then
- CFLAGS="-g -O"
- else
- CFLAGS="-O"
- fi
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
fi
else
GCC=
@@ -795,6 +856,7 @@ fi
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 $ac_n "(cached) $ac_c" 1>&6
else
@@ -809,27 +871,28 @@ 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 $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 817 "configure"
+#line 880 "configure"
#include "confdefs.h"
#include <sys/types.h>
-int main() { return 0; }
-int t() {
+int main() {
int frob(int, char *)
; return 0; }
EOF
-if { (eval echo configure:825: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_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
fi
rm -f conftest*
-
fi
echo "$ac_t""$ac_cv_cc_ansi_prototypes" 1>&6
@@ -838,29 +901,30 @@ fi
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
savedcflags="$CFLAGS"
CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
if eval "test \"`echo '$''{'ac_cv_cc_hpux_cc_aa'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 848 "configure"
+#line 912 "configure"
#include "confdefs.h"
#include <sys/types.h>
-int main() { return 0; }
-int t() {
+int main() {
int frob(int, char *)
; return 0; }
EOF
-if { (eval echo configure:856: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_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
fi
rm -f conftest*
-
fi
echo "$ac_t""$ac_cv_cc_hpux_cc_aa" 1>&6
@@ -875,41 +939,6 @@ EOF
;;
- sni*)
- echo $ac_n "checking for SINIX ansi compiler ($CC -kansi)""... $ac_c" 1>&6
- savedcflags="$CFLAGS"
- CFLAGS="-kansi"
- if eval "test \"`echo '$''{'ac_cv_cc_sinix_kansi'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 887 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-int main() { return 0; }
-int t() {
-int frob(int, char *)
-; return 0; }
-EOF
-if { (eval echo configure:895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_cc_sinix_kansi=yes
-else
- rm -rf conftest*
- ac_cv_cc_sinix_kansi=no
-fi
-rm -f conftest*
-
-fi
-
- echo "$ac_t""$ac_cv_cc_sinix_kansi" 1>&6
- if test $ac_cv_cc_sinix_kansi = no ; then
- { echo "configure: error: see the INSTALL for more info" 1>&2; exit 1; }
- fi
- CFLAGS="$savedcflags"
- V_CCOPT="-kansi $V_CCOPT"
- ;;
-
*)
{ echo "configure: error: see the INSTALL for more info" 1>&2; exit 1; }
;;
@@ -929,28 +958,29 @@ fi
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 $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 937 "configure"
+#line 967 "configure"
#include "confdefs.h"
#include <sys/types.h>
-int main() { return 0; }
-int t() {
+int main() {
struct a { int b; };
void c(const struct a *)
; return 0; }
EOF
-if { (eval echo configure:946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:975: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_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
fi
rm -f conftest*
-
fi
echo "$ac_t""$ac_cv_cc_const_proto" 1>&6
@@ -966,6 +996,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
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -980,33 +1011,37 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 984 "configure"
+#line 1015 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:990: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
else
echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 999 "configure"
+#line 1032 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
else
echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
CPP=/lib/cpp
fi
@@ -1023,24 +1058,27 @@ echo "$ac_t""$CPP" 1>&6
for ac_hdr in fcntl.h net/slip.h rpc/rpcent.h
do
-ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
+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
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1033 "configure"
+#line 1069 "configure"
#include "confdefs.h"
#include <$ac_hdr>
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:1074: \"$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
@@ -1048,7 +1086,7 @@ 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 | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'`
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
@@ -1059,29 +1097,30 @@ 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
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1067 "configure"
+#line 1106 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
-int main() { return 0; }
-int t() {
+int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:1077: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_header_time=no
fi
rm -f conftest*
-
fi
echo "$ac_t""$ac_cv_header_time" 1>&6
@@ -1096,11 +1135,12 @@ fi
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
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1104 "configure"
+#line 1144 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1110,8 +1150,7 @@ else
builtin and then its argument prototype would still apply. */
char $ac_func();
-int main() { return 0; }
-int t() {
+int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
@@ -1124,34 +1163,41 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1167: \"$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 <<EOF
+#define $ac_tr_func 1
+EOF
+
else
echo "$ac_t""no" 1>&6
LIBOBJS="$LIBOBJS ${ac_func}.o"
fi
-
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
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1155 "configure"
+#line 1201 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1161,8 +1207,7 @@ else
builtin and then its argument prototype would still apply. */
char $ac_func();
-int main() { return 0; }
-int t() {
+int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
@@ -1175,16 +1220,18 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1224: \"$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'`
@@ -1198,26 +1245,119 @@ fi
done
-echo $ac_n "checking for -ldnet""... $ac_c" 1>&6
-ac_lib_var=`echo dnet'_'main | tr './+\055' '__p_'`
+echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+echo "configure:1250: 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 <<EOF
+#line 1257 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:1268: \"$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 <<EOF
+#line 1272 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:1283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_bigendian=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_bigendian=no
+fi
+rm -f conftest*
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+if test $ac_cv_c_bigendian = unknown; then
+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 <<EOF
+#line 1303 "configure"
+#include "confdefs.h"
+main () {
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long l;
+ char c[sizeof (long)];
+ } u;
+ u.l = 1;
+ exit (u.c[sizeof (long) - 1] == 1);
+}
+EOF
+if { (eval echo configure:1316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_c_bigendian=no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_bigendian=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_bigendian" 1>&6
+if test $ac_cv_c_bigendian = yes; then
+ cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+fi
+
+
+echo $ac_n "checking for main in -ldnet""... $ac_c" 1>&6
+echo "configure:1341: 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
else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1210 "configure"
+#line 1349 "configure"
#include "confdefs.h"
-int main() { return 0; }
-int t() {
+int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
@@ -1227,7 +1367,8 @@ 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 dnet | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ ac_tr_lib=HAVE_LIB`echo dnet | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
@@ -1238,26 +1379,28 @@ else
echo "$ac_t""no" 1>&6
fi
-echo $ac_n "checking for -lrpc""... $ac_c" 1>&6
-ac_lib_var=`echo rpc'_'main | tr './+\055' '__p_'`
+echo $ac_n "checking for main in -lrpc""... $ac_c" 1>&6
+echo "configure:1384: 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
else
ac_save_LIBS="$LIBS"
LIBS="-lrpc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1250 "configure"
+#line 1392 "configure"
#include "confdefs.h"
-int main() { return 0; }
-int t() {
+int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
@@ -1267,7 +1410,8 @@ 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 rpc | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ ac_tr_lib=HAVE_LIB`echo rpc | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
@@ -1278,26 +1422,28 @@ else
echo "$ac_t""no" 1>&6
fi
-echo $ac_n "checking for -lnsl""... $ac_c" 1>&6
-ac_lib_var=`echo nsl'_'main | tr './+\055' '__p_'`
+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 <<EOF
-#line 1290 "configure"
+#line 1435 "configure"
#include "confdefs.h"
-int main() { return 0; }
-int t() {
+int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
@@ -1307,7 +1453,8 @@ 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 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
@@ -1318,26 +1465,28 @@ else
echo "$ac_t""no" 1>&6
fi
-echo $ac_n "checking for -lstr""... $ac_c" 1>&6
-ac_lib_var=`echo str'_'main | tr './+\055' '__p_'`
+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 <<EOF
-#line 1330 "configure"
+#line 1478 "configure"
#include "confdefs.h"
-int main() { return 0; }
-int t() {
+int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
@@ -1347,7 +1496,8 @@ 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 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ ac_tr_lib=HAVE_LIB`echo str | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
@@ -1370,26 +1520,28 @@ irix5.2*)
;;
*)
- echo $ac_n "checking for -lsocket""... $ac_c" 1>&6
-ac_lib_var=`echo socket'_'main | tr './+\055' '__p_'`
+ 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 <<EOF
-#line 1382 "configure"
+#line 1533 "configure"
#include "confdefs.h"
-int main() { return 0; }
-int t() {
+int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
@@ -1399,7 +1551,8 @@ 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 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
@@ -1418,11 +1571,12 @@ pfopen=/usr/examples/packetfilter/pfopen.c
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 <<EOF
-#line 1426 "configure"
+#line 1580 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1432,8 +1586,7 @@ else
builtin and then its argument prototype would still apply. */
char $ac_func();
-int main() { return 0; }
-int t() {
+int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
@@ -1446,16 +1599,18 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+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'`
@@ -1474,10 +1629,17 @@ done
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 ../libpcap $places libpcap ; do
+ for dir in $places ../libpcap libpcap ; do
+ basedir=`echo $dir | sed -e 's/[ab][0-9]*$//'`
+ if test $lastdir = $basedir ; then
+ continue;
+ fi
+ lastdir=$dir
if test -r $dir/pcap.c ; then
libpcap=$dir/libpcap.a
d=$dir
@@ -1485,26 +1647,28 @@ done
done
if test $libpcap = FAIL ; then
echo "$ac_t""not found" 1>&6
- echo $ac_n "checking for -lpcap""... $ac_c" 1>&6
-ac_lib_var=`echo pcap'_'main | tr './+\055' '__p_'`
+ 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 <<EOF
-#line 1497 "configure"
+#line 1660 "configure"
#include "confdefs.h"
-int main() { return 0; }
-int t() {
+int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
@@ -1547,7 +1711,13 @@ osf*)
V_GROUP=system
case "$target_os" in
- osf3*)
+ osf1*)
+ ;;
+
+ osf2*)
+ ;;
+
+ *)
cat >> confdefs.h <<\EOF
#define __STDC__ 2
EOF
@@ -1559,44 +1729,23 @@ EOF
solaris*)
V_GROUP=sys
;;
+
+linux*)
+ V_INCLS="$V_INCLS -Ilinux-include"
+ ;;
esac
if test -f /dev/bpf0 ; then
V_GROUP=bpf
fi
-# If we cannot run a trivial program, we must be cross compiling.
-echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_c_cross=yes
-else
-cat > conftest.$ac_ext <<EOF
-#line 1578 "configure"
-#include "confdefs.h"
-main(){return(0);}
-EOF
-{ (eval echo configure:1582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
-if test -s conftest && (./conftest; exit) 2>/dev/null; then
- ac_cv_c_cross=no
-else
- ac_cv_c_cross=yes
-fi
-fi
-rm -fr conftest*
-fi
-
-echo "$ac_t""$ac_cv_c_cross" 1>&6
-cross_compiling=$ac_cv_c_cross
-
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 <<EOF
-#line 1600 "configure"
+#line 1749 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1604,13 +1753,15 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1608: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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
@@ -1619,7 +1770,7 @@ 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
-#line 1623 "configure"
+#line 1774 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1637,7 +1788,7 @@ 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
-#line 1641 "configure"
+#line 1792 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1657,8 +1808,8 @@ if test $ac_cv_header_stdc = yes; then
if test "$cross_compiling" = yes; then
:
else
-cat > conftest.$ac_ext <<EOF
-#line 1662 "configure"
+ cat > conftest.$ac_ext <<EOF
+#line 1813 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1669,15 +1820,19 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-{ (eval echo configure:1673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
-if test -s conftest && (./conftest; exit) 2>/dev/null; then
+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
-fi
rm -fr conftest*
fi
+
+fi
fi
echo "$ac_t""$ac_cv_header_stdc" 1>&6
@@ -1689,19 +1844,21 @@ 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 <<EOF
-#line 1697 "configure"
+#line 1853 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
+#include <stddef.h>
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "int32_t" >/dev/null 2>&1; then
+ egrep "int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
rm -rf conftest*
ac_cv_type_int32_t=yes
else
@@ -1720,19 +1877,21 @@ 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 <<EOF
-#line 1728 "configure"
+#line 1886 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
+#include <stddef.h>
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "u_int32_t" >/dev/null 2>&1; then
+ 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
@@ -1751,12 +1910,40 @@ 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
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1760 "configure"
+#line 1947 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -1769,20 +1956,20 @@ extern "C" void (*signal (int, void (*)(int)))(int);
void (*signal ()) ();
#endif
-int main() { return 0; }
-int t() {
+int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:1778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_type_signal=int
fi
rm -f conftest*
-
fi
echo "$ac_t""$ac_cv_type_signal" 1>&6
@@ -1815,11 +2002,12 @@ EOF
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
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1823 "configure"
+#line 2011 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1829,8 +2017,7 @@ else
builtin and then its argument prototype would still apply. */
char $ac_func();
-int main() { return 0; }
-int t() {
+int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
@@ -1843,16 +2030,18 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2034: \"$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'`
@@ -1873,53 +2062,31 @@ EOF
fi
;;
esac
-
-rm -f os-proto.h
- if test $ac_cv_prog_gcc = yes -a -f .devel ; then
- if test $ac_cv_prog_gcc_g = yes ; then
- 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
- os=`echo $target_os | sed -e 's/\([0-9]\)[0-9.][0-9.]*$/\1/'`
- name="lbl/os-$os.h"
- if test -f $name ; then
- ln -s $name os-proto.h
- cat >> confdefs.h <<\EOF
-#define HAVE_OS_PROTO_H 1
-EOF
-
- else
- echo "configure: warning: can't find $name" 1>&2
- fi
- fi
-
echo $ac_n "checking if sockaddr struct has sa_len member""... $ac_c" 1>&6
+echo "configure:2067: checking if sockaddr struct has sa_len member" >&5
if eval "test \"`echo '$''{'ac_cv_sockaddr_has_sa_len'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1905 "configure"
+#line 2072 "configure"
#include "confdefs.h"
# include <sys/types.h>
# include <sys/socket.h>
-int main() { return 0; }
-int t() {
+int main() {
u_int i = sizeof(((struct sockaddr *)0)->sa_len)
; return 0; }
EOF
-if { (eval echo configure:1915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_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
fi
rm -f conftest*
-
fi
echo "$ac_t""$ac_cv_sockaddr_has_sa_len" 1>&6
@@ -1930,127 +2097,15 @@ EOF
fi
-echo $ac_n "checking if altzone is available""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_decl_altzone'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1939 "configure"
-#include "confdefs.h"
-
-# include <sys/types.h>
-# include <sys/time.h>
-# ifdef TIME_WITH_SYS_TIME
-# include <time.h>
-# endif
-int main() { return 0; }
-int t() {
-long i = -altzone
-; return 0; }
-EOF
-if { (eval echo configure:1952: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_decl_altzone=yes
-else
- rm -rf conftest*
- ac_cv_decl_altzone=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_decl_altzone" 1>&6
-if test $ac_cv_decl_altzone = yes ; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALTZONE 1
-EOF
-
-fi
-
-echo $ac_n "checking if timezone and daylight are available""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_decl_timezone'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1976 "configure"
-#include "confdefs.h"
-
-# include <sys/types.h>
-# include <sys/time.h>
-# ifdef TIME_WITH_SYS_TIME
-# include <time.h>
-# endif
-int main() { return 0; }
-int t() {
-long i;
- tzset();
- i = -timezone + daylight ? 3600 : 0
-; return 0; }
-EOF
-if { (eval echo configure:1991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
- rm -rf conftest*
- ac_cv_decl_timezone=yes
-else
- rm -rf conftest*
- ac_cv_decl_timezone=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_decl_timezone" 1>&6
-if test $ac_cv_decl_timezone = yes ; then
- cat >> confdefs.h <<\EOF
-#define HAVE_TIMEZONE 1
-EOF
-
-fi
-
-if test $ac_cv_decl_altzone = no ; then
- echo $ac_n "checking if tm struct has tm_gmtoff member""... $ac_c" 1>&6
- if eval "test \"`echo '$''{'ac_cv_tm_has_tm_gmtoff'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2016 "configure"
-#include "confdefs.h"
-
-# include <sys/types.h>
-# include <sys/time.h>
-# ifdef TIME_WITH_SYS_TIME
-# include <time.h>
-# endif
-int main() { return 0; }
-int t() {
-u_int i = sizeof(((struct tm *)0)->tm_gmtoff)
-; return 0; }
-EOF
-if { (eval echo configure:2029: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_tm_has_tm_gmtoff=yes
-else
- rm -rf conftest*
- ac_cv_tm_has_tm_gmtoff=no
-fi
-rm -f conftest*
-
-fi
-
- echo "$ac_t""$ac_cv_tm_has_tm_gmtoff" 1>&6
- if test $ac_cv_tm_has_tm_gmtoff = yes ; then
- cat >> confdefs.h <<\EOF
-#define HAVE_TM_GMTOFF 1
-EOF
-
- fi
-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
if eval "test \"`echo '$''{'ac_cv_ether_header_has_ea'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2054 "configure"
+ LBL_SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $V_INCLS"
+ cat > conftest.$ac_ext <<EOF
+#line 2109 "configure"
#include "confdefs.h"
# include <sys/types.h>
@@ -2063,21 +2118,22 @@ else
# include <net/if.h>
# include <netinet/in.h>
# include <netinet/if_ether.h>
-int main() { return 0; }
-int t() {
+int main() {
u_int i =
sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)
; return 0; }
EOF
-if { (eval echo configure:2073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2127: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_ether_header_has_ea=yes
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_ether_header_has_ea=no
fi
rm -f conftest*
-
+ CFLAGS="$LBL_SAVE_CFLAGS"
fi
echo "$ac_t""$ac_cv_ether_header_has_ea" 1>&6
@@ -2089,11 +2145,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
if eval "test \"`echo '$''{'ac_cv_ether_arp_has_ea'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2097 "configure"
+ LBL_SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $V_INCLS"
+ cat > conftest.$ac_ext <<EOF
+#line 2156 "configure"
#include "confdefs.h"
# include <sys/types.h>
@@ -2106,21 +2165,22 @@ else
# include <net/if.h>
# include <netinet/in.h>
# include <netinet/if_ether.h>
-int main() { return 0; }
-int t() {
+int main() {
u_int i =
sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)
; return 0; }
EOF
-if { (eval echo configure:2116: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_ether_arp_has_ea=yes
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_ether_arp_has_ea=no
fi
rm -f conftest*
-
+ CFLAGS="$LBL_SAVE_CFLAGS"
fi
echo "$ac_t""$ac_cv_ether_arp_has_ea" 1>&6
@@ -2132,11 +2192,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
if eval "test \"`echo '$''{'ac_cv_struct_ether_arp_x'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2140 "configure"
+ LBL_SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $V_INCLS"
+ cat > conftest.$ac_ext <<EOF
+#line 2203 "configure"
#include "confdefs.h"
# include <sys/types.h>
@@ -2149,20 +2212,21 @@ else
# include <net/if.h>
# include <netinet/in.h>
# include <netinet/if_ether.h>
-int main() { return 0; }
-int t() {
+int main() {
u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)
; return 0; }
EOF
-if { (eval echo configure:2158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2220: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_ether_arp_x=yes
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_struct_ether_arp_x=no
fi
rm -f conftest*
-
+ CFLAGS="$LBL_SAVE_CFLAGS"
fi
echo "$ac_t""$ac_cv_struct_ether_arp_x" 1>&6
@@ -2174,6 +2238,7 @@ 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 $ac_n "(cached) $ac_c" 1>&6
else
@@ -2205,7 +2270,7 @@ else
exit(!WIFEXITED(status));
}
/* child */
- i = *(unsigned int *)&a1;
+ i = *(unsigned int *)&a[1];
printf("%d\n", i);
exit(0);
}
@@ -2256,11 +2321,12 @@ 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
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
case "$ac_dir/" in
@@ -2283,7 +2349,7 @@ else
;;
esac
done
- IFS="$ac_save_ifs"
+ IFS="$ac_save_IFS"
fi
if test "${ac_cv_path_install+set}" = set; then
@@ -2322,11 +2388,25 @@ cat > confcache <<\EOF
# --recheck option to rerun configure.
#
EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
- sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \
- >> confcache
+ case `(ac_space=' '; set) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
if cmp -s $cache_file confcache; then
:
else
@@ -2393,7 +2473,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.10"
+ echo "$CONFIG_STATUS generated by autoconf version 2.12"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
@@ -2462,20 +2542,56 @@ s%@INSTALL_DATA@%$INSTALL_DATA%g
CEOF
EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile]", defaulting infile="outfile.in".
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
- # Adjust relative srcdir, etc. for subdirectories.
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
@@ -2503,6 +2619,7 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
[/$]*) INSTALL="$ac_given_INSTALL" ;;
*) INSTALL="$ac_dots$ac_given_INSTALL" ;;
esac
+
echo creating "$ac_file"
rm -f "$ac_file"
configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
@@ -2511,16 +2628,22 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
# $configure_input" ;;
*) ac_comsub= ;;
esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
sed -e "$ac_comsub
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
s%@INSTALL@%$INSTALL%g
-" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
fi; done
-rm -f conftest.subs
+rm -f conftest.s*
+EOF
+cat >> $CONFIG_STATUS <<EOF
+EOF
+cat >> $CONFIG_STATUS <<\EOF
exit 0
EOF
diff --git a/contrib/tcpdump/configure.in b/contrib/tcpdump/configure.in
index 3fa0509..65bf5a9 100755
--- a/contrib/tcpdump/configure.in
+++ b/contrib/tcpdump/configure.in
@@ -1,4 +1,4 @@
-dnl @(#) $Header: configure.in,v 1.53 96/07/17 15:27:31 leres Exp $ (LBL)
+dnl @(#) $Header: configure.in,v 1.58 96/11/29 15:37:31 leres Exp $ (LBL)
dnl
dnl Copyright (c) 1994, 1995, 1996
dnl The Regents of the University of California. All rights reserved.
@@ -24,6 +24,9 @@ AC_HEADER_TIME
AC_REPLACE_FUNCS(vfprintf strcasecmp)
AC_CHECK_FUNCS(ether_ntoa setlinebuf)
+dnl The following generates a warning...
+AC_C_BIGENDIAN
+
AC_CHECK_LIB(dnet, main)
AC_CHECK_LIB(rpc, main)
AC_CHECK_LIB(nsl, main)
@@ -63,7 +66,13 @@ osf*)
V_GROUP=system
case "$target_os" in
- osf3*)
+ osf1*)
+ ;;
+
+ osf2*)
+ ;;
+
+ *)
dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
AC_DEFINE(__STDC__,2)
;;
@@ -73,6 +82,10 @@ osf*)
solaris*)
V_GROUP=sys
;;
+
+linux*)
+ V_INCLS="$V_INCLS -Ilinux-include"
+ ;;
esac
if test -f /dev/bpf0 ; then
@@ -82,66 +95,15 @@ fi
AC_CHECK_TYPE(int32_t, int)
AC_CHECK_TYPE(u_int32_t, u_int)
-AC_LBL_TYPE_SIGNAL
-
AC_LBL_DEVEL(V_CCOPT)
+AC_LBL_TYPE_SIGNAL
AC_LBL_SOCKADDR_SA_LEN
-AC_MSG_CHECKING(if altzone is available)
-AC_CACHE_VAL(ac_cv_decl_altzone,
- AC_TRY_COMPILE([
-# include <sys/types.h>
-# include <sys/time.h>
-# ifdef TIME_WITH_SYS_TIME
-# include <time.h>
-# endif],
- [long i = -altzone],
- ac_cv_decl_altzone=yes,
- ac_cv_decl_altzone=no))
-AC_MSG_RESULT($ac_cv_decl_altzone)
-if test $ac_cv_decl_altzone = yes ; then
- AC_DEFINE(HAVE_ALTZONE)
-fi
-
-AC_MSG_CHECKING(if timezone and daylight are available)
-AC_CACHE_VAL(ac_cv_decl_timezone,
- AC_TRY_LINK([
-# include <sys/types.h>
-# include <sys/time.h>
-# ifdef TIME_WITH_SYS_TIME
-# include <time.h>
-# endif],
- [long i;
- tzset();
- i = -timezone + daylight ? 3600 : 0],
- ac_cv_decl_timezone=yes,
- ac_cv_decl_timezone=no))
-AC_MSG_RESULT($ac_cv_decl_timezone)
-if test $ac_cv_decl_timezone = yes ; then
- AC_DEFINE(HAVE_TIMEZONE)
-fi
-
-if test $ac_cv_decl_altzone = no ; then
- AC_MSG_CHECKING(if tm struct has tm_gmtoff member)
- AC_CACHE_VAL(ac_cv_tm_has_tm_gmtoff,
- AC_TRY_COMPILE([
-# include <sys/types.h>
-# include <sys/time.h>
-# ifdef TIME_WITH_SYS_TIME
-# include <time.h>
-# endif],
- [u_int i = sizeof(((struct tm *)0)->tm_gmtoff)],
- ac_cv_tm_has_tm_gmtoff=yes,
- ac_cv_tm_has_tm_gmtoff=no))
- AC_MSG_RESULT($ac_cv_tm_has_tm_gmtoff)
- if test $ac_cv_tm_has_tm_gmtoff = yes ; then
- AC_DEFINE(HAVE_TM_GMTOFF)
- fi
-fi
-
AC_MSG_CHECKING(if ether_header uses ether_addr structs)
AC_CACHE_VAL(ac_cv_ether_header_has_ea,
+ LBL_SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $V_INCLS"
AC_TRY_COMPILE([
# include <sys/types.h>
# if __STDC__
@@ -156,7 +118,8 @@ AC_CACHE_VAL(ac_cv_ether_header_has_ea,
[u_int i =
sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
ac_cv_ether_header_has_ea=yes,
- ac_cv_ether_header_has_ea=no))
+ ac_cv_ether_header_has_ea=no)
+ CFLAGS="$LBL_SAVE_CFLAGS")
AC_MSG_RESULT($ac_cv_ether_header_has_ea)
if test $ac_cv_ether_header_has_ea = yes ; then
AC_DEFINE(ETHER_HEADER_HAS_EA)
@@ -164,6 +127,8 @@ fi
AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
+ LBL_SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $V_INCLS"
AC_TRY_COMPILE([
# include <sys/types.h>
# if __STDC__
@@ -178,7 +143,8 @@ AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
[u_int i =
sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
ac_cv_ether_arp_has_ea=yes,
- ac_cv_ether_arp_has_ea=no))
+ ac_cv_ether_arp_has_ea=no)
+ CFLAGS="$LBL_SAVE_CFLAGS")
AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
if test $ac_cv_ether_arp_has_ea = yes ; then
AC_DEFINE(ETHER_ARP_HAS_EA)
@@ -186,6 +152,8 @@ fi
AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
+ LBL_SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $V_INCLS"
AC_TRY_COMPILE([
# include <sys/types.h>
# include <sys/socket.h>
@@ -199,7 +167,8 @@ AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
# include <netinet/if_ether.h>],
[u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
ac_cv_struct_ether_arp_x=yes,
- ac_cv_struct_ether_arp_x=no))
+ ac_cv_struct_ether_arp_x=no)
+ CFLAGS="$LBL_SAVE_CFLAGS")
AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
if test $ac_cv_struct_ether_arp_x = yes ; then
AC_DEFINE(ETHER_ARP_HAS_X)
diff --git a/contrib/tcpdump/extract.h b/contrib/tcpdump/extract.h
index 62f3f30..fbc8b5f 100644
--- a/contrib/tcpdump/extract.h
+++ b/contrib/tcpdump/extract.h
@@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: extract.h,v 1.14 96/07/15 18:23:12 leres Exp $ (LBL)
+ * @(#) $Header: extract.h,v 1.15 96/11/26 22:03:22 leres Exp $ (LBL)
*/
/* Network to host order macros */
@@ -36,7 +36,7 @@
#define EXTRACT_16BITS(p) \
((u_short)ntohs(*(u_short *)(p)))
#define EXTRACT_32BITS(p) \
- ntohl(*(u_int32_t *)(p))
+ ((u_int32_t)ntohl(*(u_int32_t *)(p)))
#endif
#define EXTRACT_24BITS(p) \
diff --git a/contrib/tcpdump/igrp.h b/contrib/tcpdump/igrp.h
index cf4c1a4..cc6088a 100644
--- a/contrib/tcpdump/igrp.h
+++ b/contrib/tcpdump/igrp.h
@@ -3,12 +3,12 @@
/* IGRP Header */
struct igrphdr {
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_char ig_op:4; /* opcode */
+#ifdef WORDS_BIGENDIAN
u_char ig_v:4; /* protocol version number */
+ u_char ig_op:4; /* opcode */
#else
- u_char ig_v:4; /* protocol version number */
u_char ig_op:4; /* opcode */
+ u_char ig_v:4; /* protocol version number */
#endif
u_char ig_ed; /* edition number */
u_short ig_as; /* autonomous system number */
diff --git a/contrib/tcpdump/install-sh b/contrib/tcpdump/install-sh
index 5871924..ebc6691 100755
--- a/contrib/tcpdump/install-sh
+++ b/contrib/tcpdump/install-sh
@@ -1,15 +1,27 @@
#! /bin/sh
#
# install - install a program, script, or datafile
-# This comes from X11R5.
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
# set DOITPROG to echo to test this script
diff --git a/contrib/tcpdump/interface.h b/contrib/tcpdump/interface.h
index d33a8ff..0b14a0a 100644
--- a/contrib/tcpdump/interface.h
+++ b/contrib/tcpdump/interface.h
@@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: interface.h,v 1.95 96/07/14 19:38:52 leres Exp $ (LBL)
+ * @(#) $Header: interface.h,v 1.100 96/12/10 22:55:04 leres Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -51,6 +51,59 @@ extern int packettype; /* as specified by -T */
#define PT_RTP 4 /* Real-Time Applications protocol */
#define PT_RTCP 5 /* Real-Time Applications control protocol */
+#ifndef min
+#define min(a,b) ((a)>(b)?(b):(a))
+#endif
+#ifndef max
+#define max(a,b) ((b)>(a)?(b):(a))
+#endif
+
+/*
+ * The default snapshot length. This value allows most printers to print
+ * useful information while keeping the amount of unwanted data down.
+ * In particular, it allows for an ethernet header, tcp/ip header, and
+ * 14 bytes of data (assuming no ip options).
+ */
+#define DEFAULT_SNAPLEN 68
+
+#ifndef BIG_ENDIAN
+#define BIG_ENDIAN 4321
+#define LITTLE_ENDIAN 1234
+#endif
+
+#ifdef ETHER_HEADER_HAS_EA
+#define ESRC(ep) ((ep)->ether_shost.ether_addr_octet)
+#define EDST(ep) ((ep)->ether_dhost.ether_addr_octet)
+#else
+#define ESRC(ep) ((ep)->ether_shost)
+#define EDST(ep) ((ep)->ether_dhost)
+#endif
+
+#ifdef ETHER_ARP_HAS_X
+#define SHA(ap) ((ap)->arp_xsha)
+#define THA(ap) ((ap)->arp_xtha)
+#define SPA(ap) ((ap)->arp_xspa)
+#define TPA(ap) ((ap)->arp_xtpa)
+#else
+#ifdef ETHER_ARP_HAS_EA
+#define SHA(ap) ((ap)->arp_sha.ether_addr_octet)
+#define THA(ap) ((ap)->arp_tha.ether_addr_octet)
+#else
+#define SHA(ap) ((ap)->arp_sha)
+#define THA(ap) ((ap)->arp_tha)
+#endif
+#define SPA(ap) ((ap)->arp_spa)
+#define TPA(ap) ((ap)->arp_tpa)
+#endif
+
+#ifndef NTOHL
+#define NTOHL(x) (x) = ntohl(x)
+#define NTOHS(x) (x) = ntohs(x)
+#define HTONL(x) (x) = htonl(x)
+#define HTONS(x) (x) = htons(x)
+#endif
+#endif
+
extern char *program_name; /* used to generate self-identifying messages */
extern int32_t thiszone; /* seconds offset from gmt to local time */
@@ -60,7 +113,16 @@ extern int snaplen;
extern const u_char *packetp;
extern const u_char *snapend;
-#define TCHECK2(var, l) if ((u_char *)&(var) > snapend - (l)) goto trunc
+/* True if "l" bytes of "var" were captured */
+#define TTEST2(var, l) ((u_char *)&(var) <= snapend - (l))
+
+/* True if "var" was captured */
+#define TTEST(var) TTEST2(var, sizeof(var))
+
+/* Bail if "l" bytes of "var" were not captured */
+#define TCHECK2(var, l) if (!TTEST2(var, l)) goto trunc
+
+/* Bail if "var" was not captured */
#define TCHECK(var) TCHECK2(var, sizeof(var))
#ifdef __STDC__
@@ -99,97 +161,43 @@ extern char *dnnum_string(u_short);
struct pcap_pkthdr;
#endif
-extern void atm_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
-extern void ether_if_print(u_char *, const struct pcap_pkthdr *,
+extern int ether_encap_print(u_short, const u_char *, u_int, u_int);
+extern int llc_print(const u_char *, u_int, u_int, const u_char *,
const u_char *);
-extern void fddi_if_print(u_char *, const struct pcap_pkthdr *, const u_char*);
-extern void null_if_print(u_char *, const struct pcap_pkthdr *, const u_char*);
-extern void ppp_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
-extern void sl_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
-
-extern void arp_print(const u_char *, u_int, u_int);
-extern void ip_print(const u_char *, u_int);
-extern void tcp_print(const u_char *, u_int, const u_char *);
-extern void udp_print(const u_char *, u_int, const u_char *);
-extern void icmp_print(const u_char *, const u_char *);
-extern void igrp_print(const u_char *, u_int, const u_char *);
-extern void default_print(const u_char *, u_int);
-extern void default_print_unaligned(const u_char *, u_int);
-
extern void aarp_print(const u_char *, u_int);
+extern void arp_print(const u_char *, u_int, u_int);
extern void atalk_print(const u_char *, u_int);
+extern void atm_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void bootp_print(const u_char *, u_int, u_short, u_short);
extern void decnet_print(const u_char *, u_int, u_int);
+extern void default_print(const u_char *, u_int);
+extern void default_print_unaligned(const u_char *, u_int);
+extern void dvmrp_print(const u_char *, u_int);
extern void egp_print(const u_char *, u_int, const u_char *);
-extern int ether_encap_print(u_short, const u_char *, u_int, u_int);
+extern void ether_if_print(u_char *, const struct pcap_pkthdr *,
+ const u_char *);
+extern void fddi_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
+extern void gre_print(const u_char *, u_int);
+extern void icmp_print(const u_char *, const u_char *);
+extern void igrp_print(const u_char *, u_int, const u_char *);
+extern void ip_print(const u_char *, u_int);
extern void ipx_print(const u_char *, u_int);
-extern void isoclns_print(const u_char *, u_int, u_int,
- const u_char *, const u_char *);
-extern int llc_print(const u_char *, u_int, u_int,
- const u_char *, const u_char *);
+extern void isoclns_print(const u_char *, u_int, u_int, const u_char *,
+ const u_char *);
+extern void krb_print(const u_char *, u_int);
extern void nfsreply_print(const u_char *, u_int, const u_char *);
extern void nfsreq_print(const u_char *, u_int, const u_char *);
extern void ns_print(const u_char *, u_int);
extern void ntp_print(const u_char *, u_int);
+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 rip_print(const u_char *, u_int);
+extern void sl_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 *);
extern void tftp_print(const u_char *, u_int);
+extern void udp_print(const u_char *, u_int, const u_char *);
extern void wb_print(const void *, u_int);
-extern void dvmrp_print(const u_char *, u_int);
-extern void pim_print(const u_char *, u_int);
-extern void krb_print(const u_char *, u_int);
-
-#ifndef min
-#define min(a,b) ((a)>(b)?(b):(a))
-#endif
-#ifndef max
-#define max(a,b) ((b)>(a)?(b):(a))
-#endif
-
-/*
- * The default snapshot length. This value allows most printers to print
- * useful information while keeping the amount of unwanted data down.
- * In particular, it allows for an ethernet header, tcp/ip header, and
- * 14 bytes of data (assuming no ip options).
- */
-#define DEFAULT_SNAPLEN 68
-
-#ifndef BIG_ENDIAN
-#define BIG_ENDIAN 4321
-#define LITTLE_ENDIAN 1234
-#endif
-
-#ifdef ETHER_HEADER_HAS_EA
-#define ESRC(ep) ((ep)->ether_shost.ether_addr_octet)
-#define EDST(ep) ((ep)->ether_dhost.ether_addr_octet)
-#else
-#define ESRC(ep) ((ep)->ether_shost)
-#define EDST(ep) ((ep)->ether_dhost)
-#endif
-
-#ifdef ETHER_ARP_HAS_X
-#define SHA(ap) ((ap)->arp_xsha)
-#define THA(ap) ((ap)->arp_xtha)
-#define SPA(ap) ((ap)->arp_xspa)
-#define TPA(ap) ((ap)->arp_xtpa)
-#else
-#ifdef ETHER_ARP_HAS_EA
-#define SHA(ap) ((ap)->arp_sha.ether_addr_octet)
-#define THA(ap) ((ap)->arp_tha.ether_addr_octet)
-#else
-#define SHA(ap) ((ap)->arp_sha)
-#define THA(ap) ((ap)->arp_tha)
-#endif
-#define SPA(ap) ((ap)->arp_spa)
-#define TPA(ap) ((ap)->arp_tpa)
-#endif
-
-#ifndef NTOHL
-#define NTOHL(x) (x) = ntohl(x)
-#define NTOHS(x) (x) = ntohs(x)
-#define HTONL(x) (x) = htonl(x)
-#define HTONS(x) (x) = htons(x)
-#endif
-#endif
diff --git a/contrib/tcpdump/lbl/os-solaris2.h b/contrib/tcpdump/lbl/os-solaris2.h
index 96a581f..cd0a76b 100644
--- a/contrib/tcpdump/lbl/os-solaris2.h
+++ b/contrib/tcpdump/lbl/os-solaris2.h
@@ -18,25 +18,17 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: os-solaris2.h,v 1.16 96/07/05 22:11:23 leres Exp $ (LBL)
+ * @(#) $Header: os-solaris2.h,v 1.17 96/11/29 15:17:49 leres Exp $ (LBL)
*/
-/* Signal routines are this type */
-#define SIGRET void
-/* Signal routines use "return SIGRETVAL;" */
-#define SIGRETVAL
-/* The wait() status variable is this type */
-#define WAITSTATUS int
-
-#define major(x) ((int)(((unsigned)(x)>>8)&0377))
-#define minor(x) ((int)((x)&0377))
-
/* 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 flock(int, int);
int getdtablesize(void);
int gethostname(char *, int);
+int getpagesize(void);
char *getusershell(void);
char *getwd(char *);
int iruserok(u_int, int, char *, char *);
@@ -60,54 +52,3 @@ void unsetenv(const char *);
struct timeval;
#endif
int utimes(const char *, struct timeval *);
-
-/* Solaris signal compat */
-#ifndef sigmask
-#define sigmask(m) (1 << ((m)-1))
-#endif
-#ifndef signal
-#define signal(s, f) sigset(s, f)
-#endif
-
-/* Solaris random compat */
-#ifndef srandom
-#define srandom(seed) srand48((long)seed)
-#endif
-#ifndef random
-#define random() lrand48()
-#endif
-
-#ifndef CBREAK
-#define CBREAK O_CBREAK
-#define CRMOD O_CRMOD
-#define RAW O_RAW
-#define TBDELAY O_TBDELAY
-#endif
-
-#ifndef TIOCPKT_DATA
-#define TIOCPKT_DATA 0x00 /* data packet */
-#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
-#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
-#define TIOCPKT_STOP 0x04 /* stop output */
-#define TIOCPKT_START 0x08 /* start output */
-#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
-#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
-#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */
-#endif
-
-#ifndef STDERR_FILENO
-#define STDERR_FILENO 2
-#define STDOUT_FILENO 1
-#define STDIN_FILENO 0
-#endif
-
-#ifndef FD_SET
-#define FD_SET(n, p) ((p)->fds_bits[0] |= (1<<(n)))
-#define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1<<(n)))
-#define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n)))
-#define FD_ZERO(p) ((p)->fds_bits[0] = 0)
-#endif
-
-#ifndef S_ISTXT
-#define S_ISTXT S_ISVTX
-#endif
diff --git a/contrib/tcpdump/lbl/os-sunos4.h b/contrib/tcpdump/lbl/os-sunos4.h
index 7733d941..667fdb8 100644
--- a/contrib/tcpdump/lbl/os-sunos4.h
+++ b/contrib/tcpdump/lbl/os-sunos4.h
@@ -18,13 +18,9 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: os-sunos4.h,v 1.31 96/06/24 02:39:07 leres Exp $ (LBL)
+ * @(#) $Header: os-sunos4.h,v 1.32 96/11/29 15:18:18 leres Exp $ (LBL)
*/
-#define SIGRET void
-#define SIGRETVAL
-#define WAITSTATUS int
-
/* Prototypes missing in SunOS 4 */
#ifdef FILE
int _filbuf(FILE *);
@@ -201,14 +197,6 @@ int wait(int *);
pid_t wait3(int *, int, struct rusage *);
#endif
-extern int opterr, optind, optopt;
-extern char *optarg;
-
-/* Map protocol types */
-#define ETHERPUP_IPTYPE ETHERTYPE_IP
-#define ETHERPUP_REVARPTYPE ETHERTYPE_REVARP
-#define ETHERPUP_ARPTYPE ETHERTYPE_ARP
-
/* Ugly signal hacking */
#ifdef SIG_ERR
#undef SIG_ERR
@@ -225,13 +213,3 @@ extern char *optarg;
#undef SIG_HOLD
#define SIG_HOLD (void (*)(int))3
#endif
-
-#ifndef S_ISTXT
-#define S_ISTXT S_ISVTX
-#endif
-
-#ifndef S_IRWXU
-#define S_IRWXU 0000700 /* RWX mask for owner */
-#define S_IRWXG 0000070 /* RWX mask for group */
-#define S_IRWXO 0000007 /* RWX mask for other */
-#endif
diff --git a/contrib/tcpdump/lbl/os-ultrix4.h b/contrib/tcpdump/lbl/os-ultrix4.h
new file mode 100644
index 0000000..1949fa4
--- /dev/null
+++ b/contrib/tcpdump/lbl/os-ultrix4.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1990, 1993, 1994, 1995, 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.
+ *
+ * @(#) $Header: os-ultrix4.h,v 1.19 96/11/29 15:33:19 leres Exp $ (LBL)
+ */
+
+/* Prototypes missing in Ultrix 4 */
+int bcmp(const char *, const char *, u_int);
+void bcopy(const void *, void *, u_int);
+void bzero(void *, u_int);
+void endservent(void);
+int getopt(int, char * const *, const char *);
+#ifdef __STDC__
+struct timeval;
+struct timezone;
+#endif
+int gettimeofday(struct timeval *, struct timezone *);
+int ioctl(int, int, caddr_t);
+int pfopen(char *, int);
+int setlinebuf(FILE *);
+int socket(int, int, int);
+int strcasecmp(const char *, const char *);
diff --git a/contrib/tcpdump/machdep.c b/contrib/tcpdump/machdep.c
index b1d0c1d..11a7d99 100644
--- a/contrib/tcpdump/machdep.c
+++ b/contrib/tcpdump/machdep.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#)$Header: machdep.c,v 1.1 96/07/15 18:33:19 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: machdep.c,v 1.3 96/12/10 23:24:28 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
diff --git a/contrib/tcpdump/nfsfh.h b/contrib/tcpdump/nfsfh.h
index 0ba5b56..383c784 100644
--- a/contrib/tcpdump/nfsfh.h
+++ b/contrib/tcpdump/nfsfh.h
@@ -1,5 +1,5 @@
/*
- * $Header: nfsfh.h,v 1.4 95/10/19 20:27:44 leres Exp $
+ * $Header: nfsfh.h,v 1.5 96/08/20 14:33:23 leres Exp $
*
* nfsfh.h - NFS file handle definitions (for portable use)
*
@@ -24,7 +24,7 @@ typedef struct {
* our internal representation of that.
*/
typedef struct {
- my_devt fsid_dev;
+ my_devt Fsid_dev; /* XXX avoid name conflict with AIX */
u_int32_t fsid_code;
} my_fsid;
diff --git a/contrib/tcpdump/parsenfsfh.c b/contrib/tcpdump/parsenfsfh.c
index 67de658..9746672 100644
--- a/contrib/tcpdump/parsenfsfh.c
+++ b/contrib/tcpdump/parsenfsfh.c
@@ -1,7 +1,3 @@
-#ifndef lint
-static char *RCSid = "$Header: parsenfsfh.c,v 1.9 95/10/19 20:27:44 leres Exp $";
-#endif
-
/*
* parsenfsfh.c - portable parser for NFS file handles
* uses all sorts of heuristics
@@ -11,6 +7,11 @@ static char *RCSid = "$Header: parsenfsfh.c,v 1.9 95/10/19 20:27:44 leres Exp $"
* Western Research Laboratory
*/
+#ifndef lint
+static const char rcsid[] =
+ "@(#) $Header: parsenfsfh.c,v 1.12 96/12/10 23:25:50 leres Exp $ (LBL)";
+#endif
+
#include <sys/types.h>
#include <sys/time.h>
@@ -215,8 +216,8 @@ int ourself; /* true if file handle was generated on this host */
switch (fhtype) {
case FHT_AUSPEX:
- fsidp->fsid_dev.Minor = fhp[7];
- fsidp->fsid_dev.Major = fhp[6];
+ fsidp->Fsid_dev.Minor = fhp[7];
+ fsidp->Fsid_dev.Major = fhp[6];
fsidp->fsid_code = 0;
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@@ -231,8 +232,8 @@ int ourself; /* true if file handle was generated on this host */
/* XXX could ignore 3 high-order bytes */
temp = make_uint32(fhp[3], fhp[2], fhp[1], fhp[0]);
- fsidp->fsid_dev.Minor = temp & 0xFFFFF;
- fsidp->fsid_dev.Major = (temp>>20) & 0xFFF;
+ fsidp->Fsid_dev.Minor = temp & 0xFFFFF;
+ fsidp->Fsid_dev.Major = (temp>>20) & 0xFFF;
temp = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]);
*inop = temp;
@@ -241,8 +242,8 @@ int ourself; /* true if file handle was generated on this host */
break;
case FHT_IRIX4:
- fsidp->fsid_dev.Minor = fhp[3];
- fsidp->fsid_dev.Major = fhp[2];
+ fsidp->Fsid_dev.Minor = fhp[3];
+ fsidp->Fsid_dev.Major = fhp[2];
fsidp->fsid_code = 0;
temp = make_uint32(fhp[8], fhp[9], fhp[10], fhp[11]);
@@ -253,8 +254,8 @@ int ourself; /* true if file handle was generated on this host */
break;
case FHT_IRIX5:
- fsidp->fsid_dev.Minor = make_uint16(fhp[2], fhp[3]);
- fsidp->fsid_dev.Major = make_uint16(fhp[0], fhp[1]);
+ fsidp->Fsid_dev.Minor = make_uint16(fhp[2], fhp[3]);
+ fsidp->Fsid_dev.Major = make_uint16(fhp[0], fhp[1]);
fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]);
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@@ -270,8 +271,8 @@ int ourself; /* true if file handle was generated on this host */
break;
case FHT_SUNOS4:
- fsidp->fsid_dev.Minor = fhp[3];
- fsidp->fsid_dev.Major = fhp[2];
+ fsidp->Fsid_dev.Minor = fhp[3];
+ fsidp->Fsid_dev.Major = fhp[2];
fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]);
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@@ -283,9 +284,9 @@ int ourself; /* true if file handle was generated on this host */
case FHT_SUNOS5:
temp = make_uint16(fhp[0], fhp[1]);
- fsidp->fsid_dev.Major = (temp>>2) & 0x3FFF;
+ fsidp->Fsid_dev.Major = (temp>>2) & 0x3FFF;
temp = make_uint24(fhp[1], fhp[2], fhp[3]);
- fsidp->fsid_dev.Minor = temp & 0x3FFFF;
+ fsidp->Fsid_dev.Minor = temp & 0x3FFFF;
fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]);
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@@ -297,8 +298,8 @@ int ourself; /* true if file handle was generated on this host */
case FHT_ULTRIX:
fsidp->fsid_code = 0;
- fsidp->fsid_dev.Minor = fhp[0];
- fsidp->fsid_dev.Major = fhp[1];
+ fsidp->Fsid_dev.Minor = fhp[0];
+ fsidp->Fsid_dev.Major = fhp[1];
temp = make_uint32(fhp[7], fhp[6], fhp[5], fhp[4]);
*inop = temp;
@@ -318,8 +319,8 @@ int ourself; /* true if file handle was generated on this host */
memset((char *)tempa, 0, sizeof(tempa));
memcpy((char *)tempa, fh, 14); /* ensure alignment */
- fsidp->fsid_dev.Minor = tempa[0] + (tempa[1]<<1);
- fsidp->fsid_dev.Major = tempa[2] + (tempa[3]<<1);
+ fsidp->Fsid_dev.Minor = tempa[0] + (tempa[1]<<1);
+ fsidp->Fsid_dev.Major = tempa[2] + (tempa[3]<<1);
fsidp->fsid_code = 0;
}
@@ -335,8 +336,8 @@ int ourself; /* true if file handle was generated on this host */
break;
case FHT_AIX32:
- fsidp->fsid_dev.Minor = make_uint16(fhp[2], fhp[3]);
- fsidp->fsid_dev.Major = make_uint16(fhp[0], fhp[1]);
+ fsidp->Fsid_dev.Minor = make_uint16(fhp[2], fhp[3]);
+ fsidp->Fsid_dev.Major = make_uint16(fhp[0], fhp[1]);
fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]);
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@@ -347,9 +348,9 @@ int ourself; /* true if file handle was generated on this host */
break;
case FHT_HPUX9:
- fsidp->fsid_dev.Major = fhp[0];
+ fsidp->Fsid_dev.Major = fhp[0];
temp = make_uint24(fhp[1], fhp[2], fhp[3]);
- fsidp->fsid_dev.Minor = temp;
+ fsidp->Fsid_dev.Minor = temp;
fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]);
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@@ -371,8 +372,8 @@ int ourself; /* true if file handle was generated on this host */
#endif
/* XXX for now, give "bogus" values to aid debugging */
fsidp->fsid_code = 0;
- fsidp->fsid_dev.Minor = 257;
- fsidp->fsid_dev.Major = 257;
+ fsidp->Fsid_dev.Minor = 257;
+ fsidp->Fsid_dev.Major = 257;
*inop = 1;
/* display will show this string instead of (257,257) */
diff --git a/contrib/tcpdump/print-arp.c b/contrib/tcpdump/print-arp.c
index 14f6d8e..19f9a9c 100644
--- a/contrib/tcpdump/print-arp.c
+++ b/contrib/tcpdump/print-arp.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-arp.c,v 1.39 96/07/17 14:56:17 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-arp.c,v 1.41 96/10/27 14:54:50 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -126,5 +126,5 @@ arp_print(register const u_char *bp, u_int length, u_int caplen)
return;
}
if (hrd != ARPHRD_ETHER)
- printf(" hardware #%d", ap->arp_hrd);
+ printf(" hardware #%d", hrd);
}
diff --git a/contrib/tcpdump/print-atalk.c b/contrib/tcpdump/print-atalk.c
index e2ae825..3b6f1cd 100644
--- a/contrib/tcpdump/print-atalk.c
+++ b/contrib/tcpdump/print-atalk.c
@@ -20,9 +20,10 @@
*
* Format and print AppleTalk packets.
*/
+
#ifndef lint
-static char rcsid[] =
- "@(#)$Header: print-atalk.c,v 1.43 96/07/23 14:16:55 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-atalk.c,v 1.45 96/12/10 23:24:07 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
diff --git a/contrib/tcpdump/print-atm.c b/contrib/tcpdump/print-atm.c
index f8754a1..13c989d 100644
--- a/contrib/tcpdump/print-atm.c
+++ b/contrib/tcpdump/print-atm.c
@@ -19,8 +19,8 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-atm.c,v 1.7 96/07/23 14:17:21 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-atm.c,v 1.8 96/09/26 23:36:41 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
diff --git a/contrib/tcpdump/print-bootp.c b/contrib/tcpdump/print-bootp.c
index 0a699f1..8dc598e 100644
--- a/contrib/tcpdump/print-bootp.c
+++ b/contrib/tcpdump/print-bootp.c
@@ -21,8 +21,8 @@
* Format and print bootp packets.
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-bootp.c,v 1.42 96/07/23 14:17:22 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-bootp.c,v 1.43 96/09/26 23:36:42 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
diff --git a/contrib/tcpdump/print-decnet.c b/contrib/tcpdump/print-decnet.c
index fbc14ba..695ab17 100644
--- a/contrib/tcpdump/print-decnet.c
+++ b/contrib/tcpdump/print-decnet.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-decnet.c,v 1.22 96/07/23 14:17:22 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-decnet.c,v 1.24 96/11/05 13:30:38 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -733,7 +733,7 @@ char *
dnnum_string(u_short dnaddr)
{
char *str;
- int area = (dnaddr & AREAMASK) >> AREASHIFT;
+ int area = (u_short)(dnaddr & AREAMASK) >> AREASHIFT;
int node = dnaddr & NODEMASK;
str = (char *)malloc(sizeof("00.0000"));
diff --git a/contrib/tcpdump/print-domain.c b/contrib/tcpdump/print-domain.c
index cbeae4b..18b77f4 100644
--- a/contrib/tcpdump/print-domain.c
+++ b/contrib/tcpdump/print-domain.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-domain.c,v 1.35 96/07/23 14:17:22 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-domain.c,v 1.37 96/12/10 23:21:06 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -323,7 +323,7 @@ ns_rprint(register const u_char *cp, register const u_char *bp)
printf(" %.*s", len, cp);
break;
}
- return (rp); /* XXX This isn't always right*/
+ return (rp); /* XXX This isn't always right */
}
void
diff --git a/contrib/tcpdump/print-dvmrp.c b/contrib/tcpdump/print-dvmrp.c
index dc7ed3e..585fde9 100644
--- a/contrib/tcpdump/print-dvmrp.c
+++ b/contrib/tcpdump/print-dvmrp.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
-"@(#) $Header: print-dvmrp.c,v 1.9 96/07/23 14:17:23 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-dvmrp.c,v 1.13 96/12/10 23:16:30 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -71,6 +71,7 @@ static char rcsid[] =
#define DVMRP_NF_DISABLED 0x20 /* administratively disabled */
#define DVMRP_NF_QUERIER 0x40 /* I am the subnet's querier */
+static void print_probe(const u_char *, const u_char *, u_int);
static void print_report(const u_char *, const u_char *, u_int);
static void print_neighbors(const u_char *, const u_char *, u_int);
static void print_neighbors2(const u_char *, const u_char *, u_int);
@@ -99,8 +100,11 @@ dvmrp_print(register const u_char *bp, register u_int len)
len -= 8;
switch (type) {
+
case DVMRP_PROBE:
printf(" Probe");
+ if (vflag)
+ print_probe(bp, ep, len);
break;
case DVMRP_REPORT:
@@ -119,25 +123,19 @@ dvmrp_print(register const u_char *bp, register u_int len)
break;
case DVMRP_ASK_NEIGHBORS2:
- printf(" Ask-neighbors");
+ printf(" Ask-neighbors2");
break;
case DVMRP_NEIGHBORS2:
- printf(" Neighbors");
- bp -= 4;
- target_level = ((u_int32_t) * bp++ << 24);
- /*
- * Group address in IGMP
- */
-
- target_level += ((u_int32_t) * bp++ << 16);
+ printf(" Neighbors2");
/*
- * header is version number
+ * extract version and capabilities from IGMP group
+ * address field
*/
-
- target_level += ((u_int32_t) * bp++ << 8);
- target_level += ((u_int32_t) * bp++);
- target_level = htonl(target_level);
+ bp -= 4;
+ target_level = (bp[0] << 24) | (bp[1] << 16) |
+ (bp[2] << 8) | bp[3];
+ bp += 4;
print_neighbors2(bp, ep, len);
break;
@@ -163,20 +161,18 @@ dvmrp_print(register const u_char *bp, register u_int len)
}
static void
-print_report(const u_char *bp, const u_char *ep, u_int len)
+print_report(register const u_char *bp, register const u_char *ep,
+ register u_int len)
{
- u_int32_t mask, origin;
- int metric;
- int i;
- int width;
- int done;
+ register u_int32_t mask, origin;
+ register int metric, i, width, done;
while (len > 0) {
if (len < 3) {
printf(" [|]");
return;
}
- mask = 0xff << 24 | bp[0] << 16 | bp[1] << 8 | bp[2];
+ mask = (u_int32_t)0xff << 24 | bp[0] << 16 | bp[1] << 8 | bp[2];
width = 1;
if (bp[0])
width = 2;
@@ -213,18 +209,45 @@ print_report(const u_char *bp, const u_char *ep, u_int len)
}
}
-#define GET_ADDR(to) (memcpy((char*)to, (char*)bp, 4), bp += 4)
+#define GET_ADDR(to) (memcpy((char *)to, (char *)bp, 4), bp += 4)
static void
-print_neighbors(const u_char *bp, const u_char *ep, u_int len)
+print_probe(register const u_char *bp, register const u_char *ep,
+ register u_int len)
+{
+ register u_int32_t genid;
+ u_char neighbor[4];
+
+ if ((len < 4) || ((bp + 4) > ep)) {
+ /* { (ctags) */
+ printf(" [|}");
+ return;
+ }
+ genid = (bp[0] << 24) | (bp[1] << 16) | (bp[2] << 8) | bp[3];
+ bp += 4;
+ len -= 4;
+ printf("\n\tgenid %u", genid);
+
+ while ((len > 0) && (bp < ep)) {
+ if ((len < 4) || ((bp + 4) > ep)) {
+ printf(" [|]");
+ return;
+ }
+ GET_ADDR(neighbor);
+ len -= 4;
+ printf("\n\tneighbor %s", ipaddr_string(neighbor));
+ }
+}
+
+static void
+print_neighbors(register const u_char *bp, register const u_char *ep,
+ register u_int len)
{
u_char laddr[4], neighbor[4];
- u_char metric;
- u_char thresh;
- u_char save_nflag;
- int ncount;
+ register u_char metric;
+ register u_char thresh;
+ register int ncount;
- save_nflag = nflag;
while (len > 0 && bp < ep) {
if (len < 7 || (bp + 7) >= ep) {
printf(" [|]");
@@ -237,9 +260,7 @@ print_neighbors(const u_char *bp, const u_char *ep, u_int len)
len -= 7;
while (--ncount >= 0 && (len >= 4) && (bp + 4) < ep) {
GET_ADDR(neighbor);
- nflag = 0;
printf(" [%s ->", ipaddr_string(laddr));
- nflag = save_nflag;
printf(" %s, (%d/%d)]",
ipaddr_string(neighbor), metric, thresh);
len -= 4;
@@ -248,20 +269,17 @@ print_neighbors(const u_char *bp, const u_char *ep, u_int len)
}
static void
-print_neighbors2(const u_char *bp, const u_char *ep, u_int len)
+print_neighbors2(register const u_char *bp, register const u_char *ep,
+ register u_int len)
{
u_char laddr[4], neighbor[4];
- u_char metric;
- u_char thresh;
- u_char flags;
- u_char save_nflag;
- int ncount;
+ register u_char metric, thresh, flags;
+ register int ncount;
printf(" (v %d.%d):",
(int)target_level & 0xff,
(int)(target_level >> 8) & 0xff);
- save_nflag = nflag;
while (len > 0 && bp < ep) {
if (len < 8 || (bp + 8) >= ep) {
printf(" [|]");
@@ -273,11 +291,9 @@ print_neighbors2(const u_char *bp, const u_char *ep, u_int len)
flags = *bp++;
ncount = *bp++;
len -= 8;
- while (--ncount >= 0 && (len >= 4) && (bp + 4) < ep) {
+ while (--ncount >= 0 && (len >= 4) && (bp + 4) <= ep) {
GET_ADDR(neighbor);
- nflag = 0;
printf(" [%s -> ", ipaddr_string(laddr));
- nflag = save_nflag;
printf("%s (%d/%d", ipaddr_string(neighbor),
metric, thresh);
if (flags & DVMRP_NF_TUNNEL)
@@ -301,14 +317,15 @@ print_neighbors2(const u_char *bp, const u_char *ep, u_int len)
}
static void
-print_prune(const u_char *bp, const u_char *ep, u_int len)
+print_prune(register const u_char *bp, register const u_char *ep,
+ register u_int len)
{
union a {
u_char b[4];
u_int32_t i;
} prune_timer;
- if (len < 12 || (bp + 12) >= ep) {
+ if (len < 12 || (bp + 12) > ep) {
printf(" [|]");
return;
}
@@ -319,10 +336,11 @@ print_prune(const u_char *bp, const u_char *ep, u_int len)
}
static void
-print_graft(const u_char *bp, const u_char *ep, u_int len)
+print_graft(register const u_char *bp, register const u_char *ep,
+ register u_int len)
{
- if (len < 8 || (bp + 8) >= ep) {
+ if (len < 8 || (bp + 8) > ep) {
printf(" [|]");
return;
}
@@ -330,10 +348,11 @@ print_graft(const u_char *bp, const u_char *ep, u_int len)
}
static void
-print_graft_ack(const u_char *bp, const u_char *ep, u_int len)
+print_graft_ack(register const u_char *bp, register const u_char *ep,
+ register u_int len)
{
- if (len < 8 || (bp + 8) >= ep) {
+ if (len < 8 || (bp + 8) > ep) {
printf(" [|]");
return;
}
diff --git a/contrib/tcpdump/print-egp.c b/contrib/tcpdump/print-egp.c
index 362da01..a621630 100644
--- a/contrib/tcpdump/print-egp.c
+++ b/contrib/tcpdump/print-egp.c
@@ -19,8 +19,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-egp.c,v 1.21 96/07/14 19:38:59 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-egp.c,v 1.23 96/11/05 13:30:35 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -182,7 +182,7 @@ egpnrprint(register const struct egp_packet *egp, register u_int length)
TCHECK2(cp[0], 1);
distances = *cp++;
printf(" %s %s ",
- gateways < egp->egp_intgw ? "int" : "ext",
+ gateways < (int)egp->egp_intgw ? "int" : "ext",
ipaddr_string(&addr));
comma = "";
diff --git a/contrib/tcpdump/print-ether.c b/contrib/tcpdump/print-ether.c
index b2a1644..f692efb 100644
--- a/contrib/tcpdump/print-ether.c
+++ b/contrib/tcpdump/print-ether.c
@@ -19,8 +19,8 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-ether.c,v 1.42 96/07/23 14:17:23 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-ether.c,v 1.43 96/09/26 23:36:43 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
diff --git a/contrib/tcpdump/print-fddi.c b/contrib/tcpdump/print-fddi.c
index 59999b8..29a5531 100644
--- a/contrib/tcpdump/print-fddi.c
+++ b/contrib/tcpdump/print-fddi.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#)$Header: print-fddi.c,v 1.31 96/07/14 19:38:59 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-fddi.c,v 1.33 96/12/10 23:20:49 leres Exp $ (LBL)";
#endif
#ifdef HAVE_FDDI
@@ -279,7 +279,7 @@ fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h,
/*
* Get the FDDI addresses into a canonical form
*/
- extract_fddi_addrs(fddip, (char*)ESRC(&ehdr), (char*)EDST(&ehdr));
+ extract_fddi_addrs(fddip, (char *)ESRC(&ehdr), (char *)EDST(&ehdr));
/*
* 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.
diff --git a/contrib/tcpdump/print-gre.c b/contrib/tcpdump/print-gre.c
new file mode 100644
index 0000000..dd1ac83
--- /dev/null
+++ b/contrib/tcpdump/print-gre.c
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 1996
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Lawrence Berkeley Laboratory,
+ * Berkeley, CA. The name of the University may not 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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Initial contribution from John Hawkinson <jhawk@bbnplanet.com>
+ *
+ * This module implements support for decoding GRE (Generic Routing
+ * Encapsulation) tunnels; they're documented in RFC1701 and RFC1702.
+ * This code only supports the IP encapsulation thereof.
+ */
+
+#ifndef lint
+static const char rcsid[] =
+ "@(#) $Header: print-gre.c,v 1.4 96/12/10 23:28:23 leres Exp $";
+#endif
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+
+#include <netdb.h>
+#include <stdio.h>
+
+#include "interface.h"
+#include "addrtoname.h"
+#include "extract.h" /* must come after interface.h */
+
+#define GRE_SIZE (20)
+
+struct gre {
+ u_short flags;
+ u_short proto;
+ union {
+ struct gre_ckof {
+ u_short cksum;
+ u_short offset;
+ } gre_ckof;
+ u_int32_t key;
+ u_int32_t seq;
+ } gre_void1;
+ union {
+ u_int32_t key;
+ u_int32_t seq;
+ u_int32_t routing;
+ } gre_void2;
+ union {
+ u_int32_t seq;
+ u_int32_t routing;
+ } gre_void3;
+ union {
+ u_int32_t routing;
+ } gre_void4;
+};
+
+#define GRE_CP 0x8000 /* Checksum Present */
+#define GRE_RP 0x4000 /* Routing Present */
+#define GRE_KP 0x2000 /* Key Present */
+#define GRE_SP 0x1000 /* Sequence Present */
+
+
+#define GREPROTO_IP 0x0800
+
+
+/*
+ * Deencapsulate and print a GRE-tunneled IP datagram
+ */
+void
+gre_print(const u_char *bp, u_int length)
+{
+ const u_char *cp = bp + 4;
+ const struct gre *gre;
+ u_short flags, proto;
+
+ gre = (const struct gre *)bp;
+
+ if (length < GRE_SIZE) {
+ goto trunc;
+ }
+ flags = EXTRACT_16BITS(&gre->flags);
+ proto = EXTRACT_16BITS(&gre->proto);
+
+ if (vflag) {
+ /* Decode the flags */
+ putchar('[');
+ if (flags & GRE_CP)
+ putchar('C');
+ if (flags & GRE_RP)
+ putchar('R');
+ if (flags & GRE_KP)
+ putchar('K');
+ if (flags & GRE_SP)
+ putchar('S');
+ fputs("] ", stdout);
+ }
+ /* Checksum & Offset are present */
+ if ((flags & GRE_CP) | (flags & GRE_RP))
+ cp += 4;
+
+ /* We don't support routing fields (variable length) now. Punt. */
+ if (flags & GRE_RP)
+ return;
+
+ if (flags & GRE_KP)
+ cp += 4;
+ if (flags & GRE_SP)
+ cp += 4;
+
+ switch (proto) {
+
+ case GREPROTO_IP:
+ ip_print(cp, length - ((cp - bp) / sizeof(u_char)));
+ break;
+
+ default:
+ printf("gre-proto-0x%04X", proto);
+ break;
+ }
+ return;
+
+trunc:
+ fputs("[|gre]", stdout);
+
+}
diff --git a/contrib/tcpdump/print-icmp.c b/contrib/tcpdump/print-icmp.c
index 429000b..c72988d 100644
--- a/contrib/tcpdump/print-icmp.c
+++ b/contrib/tcpdump/print-icmp.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-icmp.c,v 1.36 96/07/23 14:17:24 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-icmp.c,v 1.38 96/09/26 23:36:44 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -273,7 +273,7 @@ icmp_print(register const u_char *bp, register const u_char *bp2)
ihp = (struct ih_rdiscovery *)&dp->icmp_void;
TCHECK(*ihp);
- (void)strcpy(cp, "lifetime ");
+ (void)strcpy(cp, " lifetime ");
cp = buf + strlen(buf);
lifetime = EXTRACT_16BITS(&ihp->ird_lifetime);
if (lifetime < 60)
diff --git a/contrib/tcpdump/print-igrp.c b/contrib/tcpdump/print-igrp.c
index 8ce5bad..ca994d1 100644
--- a/contrib/tcpdump/print-igrp.c
+++ b/contrib/tcpdump/print-igrp.c
@@ -22,8 +22,8 @@
*/
#ifndef lint
-static char rcsid[] =
-"@(#) $Header: print-igrp.c,v 1.4 96/07/23 14:04:55 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-igrp.c,v 1.6 96/12/10 23:27:35 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
diff --git a/contrib/tcpdump/print-ip.c b/contrib/tcpdump/print-ip.c
index 935bb7c..363fd61 100644
--- a/contrib/tcpdump/print-ip.c
+++ b/contrib/tcpdump/print-ip.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-ip.c,v 1.56 96/07/23 14:17:24 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-ip.c,v 1.62 96/12/10 23:20:31 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -64,17 +64,17 @@ struct tr_query {
u_int tr_src; /* traceroute source */
u_int tr_dst; /* traceroute destination */
u_int tr_raddr; /* traceroute response address */
-#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
+#ifdef WORDS_BIGENDIAN
struct {
- u_int qid : 24; /* traceroute query id */
- u_int ttl : 8; /* traceroute response ttl */
+ u_int ttl : 8; /* traceroute response ttl */
+ u_int qid : 24; /* traceroute query id */
} q;
#else
struct {
- u_int ttl : 8; /* traceroute response ttl */
- u_int qid : 24; /* traceroute query id */
+ u_int qid : 24; /* traceroute query id */
+ u_int ttl : 8; /* traceroute response ttl */
} q;
-#endif /* BYTE_ORDER */
+#endif
};
#define tr_rttl q.ttl
@@ -121,7 +121,7 @@ struct tr_resp {
static void print_mtrace(register const u_char *bp, register u_int len)
{
- register struct tr_query* tr = (struct tr_query*)(bp + 8);
+ register struct tr_query *tr = (struct tr_query *)(bp + 8);
printf("mtrace %d: %s to %s reply-to %s", tr->tr_qid,
ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
@@ -132,7 +132,7 @@ static void print_mtrace(register const u_char *bp, register u_int len)
static void print_mresp(register const u_char *bp, register u_int len)
{
- register struct tr_query* tr = (struct tr_query*)(bp + 8);
+ register struct tr_query *tr = (struct tr_query *)(bp + 8);
printf("mresp %d: %s to %s reply-to %s", tr->tr_qid,
ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
@@ -201,12 +201,12 @@ igmp_print(register const u_char *bp, register u_int len,
/* Check the IGMP checksum */
u_int32_t sum = 0;
int count;
- const u_short *sp = (u_short*)bp;
+ const u_short *sp = (u_short *)bp;
for (count = len / 2; --count >= 0; )
sum += *sp++;
if (len & 1)
- sum += ntohs(*(unsigned char*) sp << 8);
+ sum += ntohs(*(u_char *) sp << 8);
while (sum >> 16)
sum = (sum & 0xffff) + (sum >> 16);
sum = 0xffff & ~sum;
@@ -447,6 +447,22 @@ ip_print(register const u_char *bp, register u_int length)
}
break;
+#ifndef IPPROTO_GRE
+#define IPPROTO_GRE 47
+#endif
+ case IPPROTO_GRE:
+ if (vflag)
+ (void)printf("gre %s > %s: ",
+ ipaddr_string(&ip->ip_src),
+ ipaddr_string(&ip->ip_dst));
+ /* do it */
+ gre_print(cp, len);
+ if (! vflag) {
+ printf(" (gre encap)");
+ return;
+ }
+ break;
+
default:
(void)printf("%s > %s:", ipaddr_string(&ip->ip_src),
ipaddr_string(&ip->ip_dst));
diff --git a/contrib/tcpdump/print-ipx.c b/contrib/tcpdump/print-ipx.c
index 77666ca1..ccd6b53 100644
--- a/contrib/tcpdump/print-ipx.c
+++ b/contrib/tcpdump/print-ipx.c
@@ -17,15 +17,14 @@
* 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.
- */
-
-/*
+ *
* Format and print Novell IPX packets.
* Contributed by Brad Parker (brad@fcr.com).
*/
+
#ifndef lint
-static char rcsid[] =
- "@(#)$Header: print-ipx.c,v 1.16 96/07/23 14:17:24 leres Exp $";
+static const char rcsid[] =
+ "@(#) $Header: print-ipx.c,v 1.19 96/12/10 23:23:52 leres Exp $";
#endif
#include <sys/param.h>
@@ -145,7 +144,7 @@ ipx_sap_print(const u_short *ipx, u_int length)
if (length > 0) {
TCHECK(ipx[1]);
(void)printf(" %x '", EXTRACT_16BITS(&ipx[0]));
- fn_print((char *)&ipx[1], (char *)&ipx[1] + 48);
+ fn_print((u_char *)&ipx[1], (u_char *)&ipx[1] + 48);
putchar('\'');
}
break;
@@ -160,7 +159,7 @@ ipx_sap_print(const u_short *ipx, u_int length)
for (i = 0; i < 8 && length > 0; i++) {
TCHECK2(ipx[27], 1);
(void)printf(" %x '", EXTRACT_16BITS(&ipx[0]));
- fn_print((char *)&ipx[1], (char *)&ipx[1] + 48);
+ fn_print((u_char *)&ipx[1], (u_char *)&ipx[1] + 48);
printf("' addr %s",
ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (u_char *)&ipx[27]));
ipx += 32;
diff --git a/contrib/tcpdump/print-isoclns.c b/contrib/tcpdump/print-isoclns.c
index c7db005..90b88c8 100644
--- a/contrib/tcpdump/print-isoclns.c
+++ b/contrib/tcpdump/print-isoclns.c
@@ -17,15 +17,13 @@
* 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.
- */
-
-/*
+ *
* Original code by Matt Thomas, Digital Equipment Corporation
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-isoclns.c,v 1.12 96/07/14 19:39:00 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-isoclns.c,v 1.14 96/12/10 23:26:56 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
diff --git a/contrib/tcpdump/print-krb.c b/contrib/tcpdump/print-krb.c
index 1615b0c..99cb581 100644
--- a/contrib/tcpdump/print-krb.c
+++ b/contrib/tcpdump/print-krb.c
@@ -22,8 +22,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-krb.c,v 1.6 96/07/23 14:17:24 leres Exp $";
+static const char rcsid[] =
+ "@(#) $Header: print-krb.c,v 1.8 96/12/10 23:17:39 leres Exp $";
#endif
#include <sys/param.h>
@@ -110,19 +110,19 @@ static struct tok kerr2str[] = {
/* little endian (unaligned) to host byte order */
/* XXX need to look at this... */
-#define vtohlp(x) ((( ((char*)(x))[0] ) ) | \
- (( ((char*)(x))[1] ) << 8) | \
- (( ((char*)(x))[2] ) << 16) | \
- (( ((char*)(x))[3] ) << 24))
-#define vtohsp(x) ((( ((char*)(x))[0] ) ) | \
- (( ((char*)(x))[1] ) << 8))
+#define vtohlp(x) ((( ((char *)(x))[0] ) ) | \
+ (( ((char *)(x))[1] ) << 8) | \
+ (( ((char *)(x))[2] ) << 16) | \
+ (( ((char *)(x))[3] ) << 24))
+#define vtohsp(x) ((( ((char *)(x))[0] ) ) | \
+ (( ((char *)(x))[1] ) << 8))
/* network (big endian) (unaligned) to host byte order */
-#define ntohlp(x) ((( ((char*)(x))[3] ) ) | \
- (( ((char*)(x))[2] ) << 8) | \
- (( ((char*)(x))[1] ) << 16) | \
- (( ((char*)(x))[0] ) << 24))
-#define ntohsp(x) ((( ((char*)(x))[1] ) ) | \
- (( ((char*)(x))[0] ) << 8))
+#define ntohlp(x) ((( ((char *)(x))[3] ) ) | \
+ (( ((char *)(x))[2] ) << 8) | \
+ (( ((char *)(x))[1] ) << 16) | \
+ (( ((char *)(x))[0] ) << 24))
+#define ntohsp(x) ((( ((char *)(x))[1] ) ) | \
+ (( ((char *)(x))[0] ) << 8))
@@ -281,7 +281,7 @@ krb_print(const u_char *dat, u_int length)
case 4:
printf(" v%d", kp->pvno);
- krb4_print((const u_char*)kp);
+ krb4_print((const u_char *)kp);
break;
case 106:
diff --git a/contrib/tcpdump/print-llc.c b/contrib/tcpdump/print-llc.c
index e8e3f52..ad57771 100644
--- a/contrib/tcpdump/print-llc.c
+++ b/contrib/tcpdump/print-llc.c
@@ -17,16 +17,14 @@
* 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.
- */
-
-/*
+ *
* Code by Matt Thomas, Digital Equipment Corporation
* with an awful lot of hacking by Jeffrey Mogul, DECWRL
*/
#ifndef lint
-static char rcsid[] =
- "@(#)$Header: print-llc.c,v 1.20 96/07/23 14:17:25 leres Exp $";
+static const char rcsid[] =
+ "@(#) $Header: print-llc.c,v 1.22 96/12/10 23:23:37 leres Exp $";
#endif
#include <sys/param.h>
diff --git a/contrib/tcpdump/print-netbios.c b/contrib/tcpdump/print-netbios.c
index 73d86f4..34cc655 100644
--- a/contrib/tcpdump/print-netbios.c
+++ b/contrib/tcpdump/print-netbios.c
@@ -17,21 +17,15 @@
* 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.
- */
-
-/*
+ *
* Format and print NETBIOS packets.
* Contributed by Brad Parker (brad@fcr.com).
*/
-#ifndef lint
-static char rcsid[] =
- "@(#)$Header: print-netbios.c,v 1.8 96/07/23 14:17:25 leres Exp $";
-#endif
-#ifdef __STDC__
-#include <stdlib.h>
+#ifndef lint
+static const char rcsid[] =
+ "@(#) $Header: print-netbios.c,v 1.10 96/12/10 23:25:12 leres Exp $";
#endif
-#include <stdio.h>
#include <sys/param.h>
#include <sys/socket.h>
@@ -45,6 +39,10 @@ static char rcsid[] =
#include <netinet/tcp.h>
#include <netinet/tcpip.h>
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
+#include <stdio.h>
#include <string.h>
#include "interface.h"
diff --git a/contrib/tcpdump/print-nfs.c b/contrib/tcpdump/print-nfs.c
index 6ea7701..c16291d 100644
--- a/contrib/tcpdump/print-nfs.c
+++ b/contrib/tcpdump/print-nfs.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-nfs.c,v 1.56 96/07/23 14:17:25 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-nfs.c,v 1.63 96/12/10 23:18:07 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -58,6 +58,8 @@ static void xid_map_enter(const struct rpc_msg *, const struct ip *);
static int32_t xid_map_find(const struct rpc_msg *, const struct ip *);
static void interp_reply(const struct rpc_msg *, u_int32_t, u_int);
+static int nfserr; /* true if we error rather than trunc */
+
void
nfsreply_print(register const u_char *bp, u_int length,
register const u_char *bp2)
@@ -66,6 +68,7 @@ nfsreply_print(register const u_char *bp, u_int length,
register const struct ip *ip;
int32_t proc;
+ nfserr = 0; /* assume no error */
rp = (const struct rpc_msg *)bp;
ip = (const struct ip *)bp2;
@@ -119,7 +122,7 @@ parsereq(register const struct rpc_msg *rp, register u_int length)
}
}
trunc:
- return (0);
+ return (NULL);
}
/*
@@ -133,7 +136,7 @@ parsefh(register const u_int32_t *dp)
nfs_printfh(dp);
return (dp + 8);
}
- return (0);
+ return (NULL);
}
/*
@@ -148,7 +151,7 @@ parsefn(register const u_int32_t *dp)
/* Bail if we don't have the string length */
if ((u_char *)dp > snapend - sizeof(*dp))
- return(0);
+ return (NULL);
/* Fetch string length; convert to host order */
len = *dp++;
@@ -158,7 +161,7 @@ parsefn(register const u_int32_t *dp)
/* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */
dp += ((len + 3) & ~3) / sizeof(*dp);
if ((u_char *)dp > snapend)
- return (0);
+ return (NULL);
/* XXX seems like we should be checking the length */
putchar('"');
(void) fn_printn(cp, len, NULL);
@@ -176,8 +179,8 @@ static const u_int32_t *
parsefhn(register const u_int32_t *dp)
{
dp = parsefh(dp);
- if (dp == 0)
- return (0);
+ if (dp == NULL)
+ return (NULL);
putchar(' ');
return (parsefn(dp));
}
@@ -190,6 +193,7 @@ nfsreq_print(register const u_char *bp, u_int length,
register const struct ip *ip;
register const u_int32_t *dp;
+ nfserr = 0; /* assume no error */
rp = (const struct rpc_msg *)bp;
ip = (const struct ip *)bp2;
if (!nflag)
@@ -222,13 +226,13 @@ nfsreq_print(register const u_char *bp, u_int length,
case NFSPROC_GETATTR:
printf(" getattr");
- if ((dp = parsereq(rp, length)) != 0 && parsefh(dp) != 0)
+ if ((dp = parsereq(rp, length)) != NULL && parsefh(dp) != NULL)
return;
break;
case NFSPROC_SETATTR:
printf(" setattr");
- if ((dp = parsereq(rp, length)) != 0 && parsefh(dp) != 0)
+ if ((dp = parsereq(rp, length)) != NULL && parsefh(dp) != NULL)
return;
break;
@@ -239,20 +243,20 @@ nfsreq_print(register const u_char *bp, u_int length,
#endif
case NFSPROC_LOOKUP:
printf(" lookup");
- if ((dp = parsereq(rp, length)) != 0 && parsefhn(dp) != 0)
+ if ((dp = parsereq(rp, length)) != NULL && parsefhn(dp) != NULL)
return;
break;
case NFSPROC_READLINK:
printf(" readlink");
- if ((dp = parsereq(rp, length)) != 0 && parsefh(dp) != 0)
+ if ((dp = parsereq(rp, length)) != NULL && parsefh(dp) != NULL)
return;
break;
case NFSPROC_READ:
printf(" read");
- if ((dp = parsereq(rp, length)) != 0 &&
- (dp = parsefh(dp)) != 0) {
+ if ((dp = parsereq(rp, length)) != NULL &&
+ (dp = parsefh(dp)) != NULL) {
TCHECK2(dp[0], 3 * sizeof(*dp));
printf(" %u bytes @ %u",
(u_int32_t)ntohl(dp[1]),
@@ -264,8 +268,8 @@ nfsreq_print(register const u_char *bp, u_int length,
#if NFSPROC_WRITECACHE != NFSPROC_NOOP
case NFSPROC_WRITECACHE:
printf(" writecache");
- if ((dp = parsereq(rp, length)) != 0 &&
- (dp = parsefh(dp)) != 0) {
+ if ((dp = parsereq(rp, length)) != NULL &&
+ (dp = parsefh(dp)) != NULL) {
TCHECK2(dp[0], 4 * sizeof(*dp));
printf(" %u (%u) bytes @ %u (%u)",
(u_int32_t)ntohl(dp[3]),
@@ -278,8 +282,8 @@ nfsreq_print(register const u_char *bp, u_int length,
#endif
case NFSPROC_WRITE:
printf(" write");
- if ((dp = parsereq(rp, length)) != 0 &&
- (dp = parsefh(dp)) != 0) {
+ if ((dp = parsereq(rp, length)) != NULL &&
+ (dp = parsefh(dp)) != NULL) {
TCHECK2(dp[0], 4 * sizeof(*dp));
printf(" %u (%u) bytes @ %u (%u)",
(u_int32_t)ntohl(dp[3]),
@@ -292,62 +296,62 @@ nfsreq_print(register const u_char *bp, u_int length,
case NFSPROC_CREATE:
printf(" create");
- if ((dp = parsereq(rp, length)) != 0 && parsefhn(dp) != 0)
+ if ((dp = parsereq(rp, length)) != NULL && parsefhn(dp) != NULL)
return;
break;
case NFSPROC_REMOVE:
printf(" remove");
- if ((dp = parsereq(rp, length)) != 0 && parsefhn(dp) != 0)
+ if ((dp = parsereq(rp, length)) != NULL && parsefhn(dp) != NULL)
return;
break;
case NFSPROC_RENAME:
printf(" rename");
- if ((dp = parsereq(rp, length)) != 0 &&
- (dp = parsefhn(dp)) != 0) {
+ if ((dp = parsereq(rp, length)) != NULL &&
+ (dp = parsefhn(dp)) != NULL) {
fputs(" ->", stdout);
- if (parsefhn(dp) != 0)
+ if (parsefhn(dp) != NULL)
return;
}
break;
case NFSPROC_LINK:
printf(" link");
- if ((dp = parsereq(rp, length)) != 0 &&
- (dp = parsefh(dp)) != 0) {
+ if ((dp = parsereq(rp, length)) != NULL &&
+ (dp = parsefh(dp)) != NULL) {
fputs(" ->", stdout);
- if (parsefhn(dp) != 0)
+ if (parsefhn(dp) != NULL)
return;
}
break;
case NFSPROC_SYMLINK:
printf(" symlink");
- if ((dp = parsereq(rp, length)) != 0 &&
- (dp = parsefhn(dp)) != 0) {
+ if ((dp = parsereq(rp, length)) != NULL &&
+ (dp = parsefhn(dp)) != NULL) {
fputs(" -> ", stdout);
- if (parsefn(dp) != 0)
+ if (parsefn(dp) != NULL)
return;
}
break;
case NFSPROC_MKDIR:
printf(" mkdir");
- if ((dp = parsereq(rp, length)) != 0 && parsefhn(dp) != 0)
+ if ((dp = parsereq(rp, length)) != NULL && parsefhn(dp) != NULL)
return;
break;
case NFSPROC_RMDIR:
printf(" rmdir");
- if ((dp = parsereq(rp, length)) != 0 && parsefhn(dp) != 0)
+ if ((dp = parsereq(rp, length)) != NULL && parsefhn(dp) != NULL)
return;
break;
case NFSPROC_READDIR:
printf(" readdir");
- if ((dp = parsereq(rp, length)) != 0 &&
- (dp = parsefh(dp)) != 0) {
+ if ((dp = parsereq(rp, length)) != NULL &&
+ (dp = parsefh(dp)) != NULL) {
TCHECK2(dp[0], 2 * sizeof(*dp));
/*
* Print the offset as signed, since -1 is common,
@@ -362,7 +366,7 @@ nfsreq_print(register const u_char *bp, u_int length,
case NFSPROC_STATFS:
printf(" statfs");
- if ((dp = parsereq(rp, length)) != 0 && parsefh(dp) != 0)
+ if ((dp = parsereq(rp, length)) != NULL && parsefh(dp) != NULL)
return;
break;
@@ -371,7 +375,8 @@ nfsreq_print(register const u_char *bp, u_int length,
return;
}
trunc:
- fputs(" [|nfs]", stdout);
+ if (!nfserr)
+ fputs(" [|nfs]", stdout);
}
/*
@@ -390,26 +395,23 @@ nfs_printfh(register const u_int32_t *dp)
ino_t ino;
char *sfsname = NULL;
- Parse_fh((caddr_t*)dp, &fsid, &ino, NULL, &sfsname, 0);
+ Parse_fh((caddr_t *)dp, &fsid, &ino, NULL, &sfsname, 0);
if (sfsname) {
- /* file system ID is ASCII, not numeric, for this server OS */
- static char temp[NFS_FHSIZE+1];
-
- /* Make sure string is null-terminated */
- strncpy(temp, sfsname, NFS_FHSIZE);
- /* Remove trailing spaces */
- sfsname = strchr(temp, ' ');
- if (sfsname)
- *sfsname = 0;
-
- (void)printf(" fh %s/%u", temp, (u_int32_t)ino);
- }
- else {
- (void)printf(" fh %u,%u/%u",
- fsid.fsid_dev.Major,
- fsid.fsid_dev.Minor,
- (u_int32_t)ino);
+ /* file system ID is ASCII, not numeric, for this server OS */
+ static char temp[NFS_FHSIZE+1];
+
+ /* Make sure string is null-terminated */
+ strncpy(temp, sfsname, NFS_FHSIZE);
+ /* Remove trailing spaces */
+ sfsname = strchr(temp, ' ');
+ if (sfsname)
+ *sfsname = 0;
+
+ (void)printf(" fh %s/%u", temp, (u_int32_t)ino);
+ } else {
+ (void)printf(" fh %u,%u/%u",
+ fsid.Fsid_dev.Major, fsid.Fsid_dev.Minor, (u_int32_t)ino);
}
}
@@ -480,7 +482,7 @@ xid_map_find(const struct rpc_msg *rp, const struct ip *ip)
} while (i != xid_map_hint);
/* search failed */
- return(-1);
+ return (-1);
}
/*
@@ -515,10 +517,9 @@ parserep(register const struct rpc_msg *rp, register u_int length)
*/
dp = ((const u_int32_t *)&rp->rm_reply) + 1;
TCHECK2(dp[0], 1);
- return(0);
len = ntohl(dp[1]);
if (len >= length)
- return(0);
+ return (NULL);
/*
* skip past the ar_verf credentials.
*/
@@ -536,56 +537,58 @@ parserep(register const struct rpc_msg *rp, register u_int length)
case PROG_UNAVAIL:
printf(" PROG_UNAVAIL");
- return(0);
+ nfserr = 1; /* suppress trunc string */
+ return (NULL);
case PROG_MISMATCH:
printf(" PROG_MISMATCH");
- return(0);
+ nfserr = 1; /* suppress trunc string */
+ return (NULL);
case PROC_UNAVAIL:
printf(" PROC_UNAVAIL");
- return(0);
+ nfserr = 1; /* suppress trunc string */
+ return (NULL);
case GARBAGE_ARGS:
printf(" GARBAGE_ARGS");
- return(0);
+ nfserr = 1; /* suppress trunc string */
+ return (NULL);
case SYSTEM_ERR:
printf(" SYSTEM_ERR");
- return(0);
+ nfserr = 1; /* suppress trunc string */
+ return (NULL);
default:
printf(" ar_stat %d", astat);
- return(0);
+ nfserr = 1; /* suppress trunc string */
+ return (NULL);
}
/* successful return */
if ((sizeof(astat) + ((u_char *)dp)) < snapend)
- return((u_int32_t *) (sizeof(astat) + ((char *)dp)));
+ return ((u_int32_t *) (sizeof(astat) + ((char *)dp)));
trunc:
- return (0);
+ return (NULL);
}
static const u_int32_t *
parsestatus(const u_int32_t *dp)
{
- int errnum;
+ register int errnum;
TCHECK(dp[0]);
errnum = ntohl(dp[0]);
if (errnum != 0) {
- char *errmsg;
-
- if (qflag)
- return(0);
-
- errmsg = pcap_strerror(errnum);
- printf(" ERROR: %s", errmsg);
- return(0);
+ if (!qflag)
+ printf(" ERROR: %s", pcap_strerror(errnum));
+ nfserr = 1; /* suppress trunc string */
+ return (NULL);
}
return (dp + 1);
trunc:
- return (0);
+ return (NULL);
}
static struct tok type2str[] = {
@@ -643,6 +646,7 @@ trunc:
static int
parseattrstat(const u_int32_t *dp, int verbose)
{
+
dp = parsestatus(dp);
if (dp == NULL)
return (0);
@@ -653,6 +657,7 @@ parseattrstat(const u_int32_t *dp, int verbose)
static int
parsediropres(const u_int32_t *dp)
{
+
dp = parsestatus(dp);
if (dp == NULL)
return (0);
@@ -669,7 +674,7 @@ parselinkres(const u_int32_t *dp)
{
dp = parsestatus(dp);
if (dp == NULL)
- return(0);
+ return (0);
putchar(' ');
return (parsefn(dp) != NULL);
@@ -682,7 +687,7 @@ parsestatfs(const u_int32_t *dp)
dp = parsestatus(dp);
if (dp == NULL)
- return(0);
+ return (0);
if (!qflag) {
sfsp = (const struct nfsv2_statfs *)dp;
@@ -704,7 +709,7 @@ static int
parserddires(const u_int32_t *dp)
{
dp = parsestatus(dp);
- if (dp == 0)
+ if (dp == NULL)
return (0);
if (!qflag) {
TCHECK(dp[0]);
@@ -742,14 +747,14 @@ interp_reply(const struct rpc_msg *rp, u_int32_t proc, u_int length)
case NFSPROC_GETATTR:
printf(" getattr");
dp = parserep(rp, length);
- if (dp != 0 && parseattrstat(dp, !qflag) != 0)
+ if (dp != NULL && parseattrstat(dp, !qflag) != 0)
return;
break;
case NFSPROC_SETATTR:
printf(" setattr");
dp = parserep(rp, length);
- if (dp != 0 && parseattrstat(dp, !qflag) != 0)
+ if (dp != NULL && parseattrstat(dp, !qflag) != 0)
return;
break;
@@ -761,21 +766,21 @@ interp_reply(const struct rpc_msg *rp, u_int32_t proc, u_int length)
case NFSPROC_LOOKUP:
printf(" lookup");
dp = parserep(rp, length);
- if (dp != 0 && parsediropres(dp) != 0)
+ if (dp != NULL && parsediropres(dp) != 0)
return;
break;
case NFSPROC_READLINK:
printf(" readlink");
dp = parserep(rp, length);
- if (dp != 0 && parselinkres(dp) != 0)
+ if (dp != NULL && parselinkres(dp) != 0)
return;
break;
case NFSPROC_READ:
printf(" read");
dp = parserep(rp, length);
- if (dp != 0 && parseattrstat(dp, vflag) != 0)
+ if (dp != NULL && parseattrstat(dp, vflag) != 0)
return;
break;
@@ -787,70 +792,70 @@ interp_reply(const struct rpc_msg *rp, u_int32_t proc, u_int length)
case NFSPROC_WRITE:
printf(" write");
dp = parserep(rp, length);
- if (dp != 0 && parseattrstat(dp, vflag) != 0)
+ if (dp != NULL && parseattrstat(dp, vflag) != 0)
return;
break;
case NFSPROC_CREATE:
printf(" create");
dp = parserep(rp, length);
- if (dp != 0 && parsediropres(dp) != 0)
+ if (dp != NULL && parsediropres(dp) != 0)
return;
break;
case NFSPROC_REMOVE:
printf(" remove");
dp = parserep(rp, length);
- if (dp != 0 && parsestatus(dp) != 0)
+ if (dp != NULL && parsestatus(dp) != 0)
return;
break;
case NFSPROC_RENAME:
printf(" rename");
dp = parserep(rp, length);
- if (dp != 0 && parsestatus(dp) != 0)
+ if (dp != NULL && parsestatus(dp) != 0)
return;
break;
case NFSPROC_LINK:
printf(" link");
dp = parserep(rp, length);
- if (dp != 0 && parsestatus(dp) != 0)
+ if (dp != NULL && parsestatus(dp) != 0)
return;
break;
case NFSPROC_SYMLINK:
printf(" symlink");
dp = parserep(rp, length);
- if (dp != 0 && parsestatus(dp) != 0)
+ if (dp != NULL && parsestatus(dp) != 0)
return;
break;
case NFSPROC_MKDIR:
printf(" mkdir");
dp = parserep(rp, length);
- if (dp != 0 && parsediropres(dp) != 0)
+ if (dp != NULL && parsediropres(dp) != 0)
return;
break;
case NFSPROC_RMDIR:
printf(" rmdir");
dp = parserep(rp, length);
- if (dp != 0 && parsestatus(dp) != 0)
+ if (dp != NULL && parsestatus(dp) != 0)
return;
break;
case NFSPROC_READDIR:
printf(" readdir");
dp = parserep(rp, length);
- if (dp != 0 && parserddires(dp) != 0)
+ if (dp != NULL && parserddires(dp) != 0)
return;
break;
case NFSPROC_STATFS:
printf(" statfs");
dp = parserep(rp, length);
- if (dp != 0 && parsestatfs(dp) != 0)
+ if (dp != NULL && parsestatfs(dp) != 0)
return;
break;
@@ -858,5 +863,6 @@ interp_reply(const struct rpc_msg *rp, u_int32_t proc, u_int length)
printf(" proc-%u", proc);
return;
}
- fputs(" [|nfs]", stdout);
+ if (!nfserr)
+ fputs(" [|nfs]", stdout);
}
diff --git a/contrib/tcpdump/print-ntp.c b/contrib/tcpdump/print-ntp.c
index ec6c8f0..67368d0 100644
--- a/contrib/tcpdump/print-ntp.c
+++ b/contrib/tcpdump/print-ntp.c
@@ -24,8 +24,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-ntp.c,v 1.23 96/07/23 14:17:26 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-ntp.c,v 1.25 96/11/05 13:30:37 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -71,7 +71,7 @@ ntp_print(register const u_char *cp, u_int length)
TCHECK(bp->status);
- version = (bp->status & VERSIONMASK) >> 3;
+ version = (int)(bp->status & VERSIONMASK) >> 3;
printf(" v%d", version);
leapind = bp->status & LEAPMASK;
diff --git a/contrib/tcpdump/print-null.c b/contrib/tcpdump/print-null.c
index 89e1695..ba731d8 100644
--- a/contrib/tcpdump/print-null.c
+++ b/contrib/tcpdump/print-null.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#)$Header: print-null.c,v 1.19 96/07/14 19:39:02 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-null.c,v 1.22 96/12/10 23:18:58 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -46,15 +46,19 @@ struct rtentry;
#include <netinet/tcp.h>
#include <netinet/tcpip.h>
+#include <pcap.h>
#include <stdio.h>
#include <string.h>
-#include "interface.h"
#include "addrtoname.h"
-#include "pcap.h"
+#include "interface.h"
#define NULL_HDRLEN 4
+#ifndef AF_NS
+#define AF_NS 6 /* XEROX NS protocols */
+#endif
+
static void
null_print(const u_char *p, const struct ip *ip, u_int length)
{
diff --git a/contrib/tcpdump/print-ospf.c b/contrib/tcpdump/print-ospf.c
index 70d8701..44e8737 100644
--- a/contrib/tcpdump/print-ospf.c
+++ b/contrib/tcpdump/print-ospf.c
@@ -22,8 +22,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-ospf.c,v 1.19 96/07/14 19:39:03 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-ospf.c,v 1.23 96/12/10 23:15:46 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -44,8 +44,8 @@ static char rcsid[] =
#include "ospf.h"
struct bits {
- u_int32_t bit;
- const char *str;
+ u_int32_t bit;
+ const char *str;
};
static const struct bits ospf_option_bits[] = {
@@ -63,506 +63,518 @@ static const struct bits ospf_rla_flag_bits[] = {
{ 0, NULL }
};
-static const char *ospf_types[OSPF_TYPE_MAX] = {
- (char *) 0,
- "hello",
- "dd",
- "ls_req",
- "ls_upd",
- "ls_ack"
+static struct tok type2str[] = {
+ { OSPF_TYPE_UMD, "umd" },
+ { OSPF_TYPE_HELLO, "hello" },
+ { OSPF_TYPE_DB, "dd" },
+ { OSPF_TYPE_LSR, "ls_req" },
+ { OSPF_TYPE_LSU, "ls_upd" },
+ { OSPF_TYPE_LSA, "ls_ack" },
+ { 0, NULL }
};
+static char tstr[] = " [|ospf]";
+
+/* Forwards */
+static inline void ospf_print_seqage(u_int32_t, time_t);
+static inline void ospf_print_bits(const struct bits *, u_char);
+static void ospf_print_ls_type(u_int, const struct in_addr *,
+ const struct in_addr *, const char *);
+static int ospf_print_lshdr(const struct lsa_hdr *);
+static int ospf_print_lsa(const struct lsa *);
+static int ospf_decode_v2(const struct ospfhdr *, const u_char *);
+
static inline void
ospf_print_seqage(register u_int32_t seq, register time_t us)
{
- register time_t sec = us % 60;
- register time_t mins = (us / 60) % 60;
- register time_t hour = us/3600;
-
- printf(" S %X age ", seq);
- if (hour) {
- printf("%u:%02u:%02u",
- (u_int32_t)hour,
- (u_int32_t)mins,
- (u_int32_t)sec);
- } else if (mins) {
- printf("%u:%02u",
- (u_int32_t)mins,
- (u_int32_t)sec);
- } else {
- printf("%u",
- (u_int32_t)sec);
- }
+ register time_t sec = us % 60;
+ register time_t mins = (us / 60) % 60;
+ register time_t hour = us / 3600;
+
+ printf(" S %X age ", seq);
+ if (hour)
+ printf("%u:%02u:%02u",
+ (u_int32_t) hour, (u_int32_t) mins, (u_int32_t) sec);
+ else if (mins)
+ printf("%u:%02u", (u_int32_t) mins, (u_int32_t) sec);
+ else
+ printf("%u", (u_int32_t) sec);
}
static inline void
ospf_print_bits(register const struct bits *bp, register u_char options)
{
- char sep = ' ';
-
- do {
- if (options & bp->bit) {
- printf("%c%s",
- sep,
- bp->str);
- sep = '/';
- }
- } while ((++bp)->bit) ;
+ register char sep = ' ';
+
+ do {
+ if (options & bp->bit) {
+ printf("%c%s", sep, bp->str);
+ sep = '/';
+ }
+ } while ((++bp)->bit);
}
+static void
+ospf_print_ls_type(register u_int ls_type,
+ register const struct in_addr *ls_stateid,
+ register const struct in_addr *ls_router, register const char *fmt)
+{
-#define LS_PRINT(lsp, type) switch (type) { \
- case LS_TYPE_ROUTER: \
- printf(" rtr %s ", ipaddr_string(&lsp->ls_router)); break; \
- case LS_TYPE_NETWORK: \
- printf(" net dr %s if %s", ipaddr_string(&lsp->ls_router), ipaddr_string(&lsp->ls_stateid)); break; \
- case LS_TYPE_SUM_IP: \
- printf(" sum %s abr %s", ipaddr_string(&lsp->ls_stateid), ipaddr_string(&lsp->ls_router)); break; \
- case LS_TYPE_SUM_ABR: \
- printf(" abr %s rtr %s", ipaddr_string(&lsp->ls_router), ipaddr_string(&lsp->ls_stateid)); break; \
- case LS_TYPE_ASE: \
- printf(" ase %s asbr %s", ipaddr_string(&lsp->ls_stateid), ipaddr_string(&lsp->ls_router)); break; \
- case LS_TYPE_GROUP: \
- printf(" group %s rtr %s", ipaddr_string(&lsp->ls_stateid), ipaddr_string(&lsp->ls_router)); break; \
- }
+ switch (ls_type) {
-static int
-ospf_print_lshdr(register const struct lsa_hdr *lshp, const caddr_t end)
-{
- if ((caddr_t) (lshp + 1) > end) {
- return 1;
- }
+ case LS_TYPE_ROUTER:
+ printf(" rtr %s ", ipaddr_string(ls_router));
+ break;
+
+ case LS_TYPE_NETWORK:
+ printf(" net dr %s if %s",
+ ipaddr_string(ls_router),
+ ipaddr_string(ls_stateid));
+ break;
- printf(" {"); /* } (ctags) */
+ case LS_TYPE_SUM_IP:
+ printf(" sum %s abr %s",
+ ipaddr_string(ls_stateid),
+ ipaddr_string(ls_router));
+ break;
+
+ case LS_TYPE_SUM_ABR:
+ printf(" abr %s rtr %s",
+ ipaddr_string(ls_router),
+ ipaddr_string(ls_stateid));
+ break;
+
+ case LS_TYPE_ASE:
+ printf(" ase %s asbr %s",
+ ipaddr_string(ls_stateid),
+ ipaddr_string(ls_router));
+ break;
+
+ case LS_TYPE_GROUP:
+ printf(" group %s rtr %s",
+ ipaddr_string(ls_stateid),
+ ipaddr_string(ls_router));
+ break;
+
+ default:
+ putchar(' ');
+ printf(fmt, ls_type);
+ break;
+ }
+}
- if (!lshp->ls_type || lshp->ls_type >= LS_TYPE_MAX) {
- printf(" ??LS type %d?? }", lshp->ls_type); /* { (ctags) */
- return 1;
- }
+static int
+ospf_print_lshdr(register const struct lsa_hdr *lshp)
+{
- ospf_print_bits(ospf_option_bits, lshp->ls_options);
- ospf_print_seqage(ntohl(lshp->ls_seq), ntohs(lshp->ls_age));
+ TCHECK(lshp->ls_type);
+ printf(" {"); /* } (ctags) */
- LS_PRINT(lshp, lshp->ls_type);
+ TCHECK(lshp->ls_options);
+ ospf_print_bits(ospf_option_bits, lshp->ls_options);
+ TCHECK(lshp->ls_seq);
+ ospf_print_seqage(ntohl(lshp->ls_seq), ntohs(lshp->ls_age));
+ ospf_print_ls_type(lshp->ls_type, &lshp->ls_stateid, &lshp->ls_router,
+ "ls_type %d");
- return 0;
+ return (0);
+trunc:
+ return (1);
}
/*
* Print a single link state advertisement. If truncated return 1, else 0.
*/
-
static int
-ospf_print_lsa(register const struct lsa *lsap, const caddr_t end)
+ospf_print_lsa(register const struct lsa *lsap)
{
- register const char *ls_end;
- const struct rlalink *rlp;
- const struct tos_metric *tosp;
- const struct in_addr *ap;
- const struct aslametric *almp;
- const struct mcla *mcp;
- const u_int32_t *lp;
- int j, k;
-
- if (ospf_print_lshdr(&lsap->ls_hdr, end)) {
- return 1;
- }
-
- ls_end = (caddr_t) lsap + ntohs(lsap->ls_hdr.ls_length);
-
- if (ls_end > end) {
- printf(" }"); /* { (ctags) */
- return 1;
- }
-
- switch (lsap->ls_hdr.ls_type) {
- case LS_TYPE_ROUTER:
- ospf_print_bits(ospf_rla_flag_bits, lsap->lsa_un.un_rla.rla_flags);
-
- j = ntohs(lsap->lsa_un.un_rla.rla_count);
- rlp = lsap->lsa_un.un_rla.rla_link;
- while (j--) {
- struct rlalink *rln = (struct rlalink *) ((caddr_t) (rlp + 1) + ((rlp->link_toscount) * sizeof (struct tos_metric)));
-
- if ((caddr_t) rln > ls_end) {
+ register const u_char *ls_end;
+ register const struct rlalink *rlp;
+ register const struct tos_metric *tosp;
+ register const struct in_addr *ap;
+ register const struct aslametric *almp;
+ register const struct mcla *mcp;
+ register const u_int32_t *lp;
+ register int j, k;
+
+ if (ospf_print_lshdr(&lsap->ls_hdr))
+ return (1);
+ TCHECK(lsap->ls_hdr.ls_length);
+ ls_end = (u_char *)lsap + ntohs(lsap->ls_hdr.ls_length);
+ switch (lsap->ls_hdr.ls_type) {
+
+ case LS_TYPE_ROUTER:
+ TCHECK(lsap->lsa_un.un_rla.rla_flags);
+ ospf_print_bits(ospf_rla_flag_bits,
+ lsap->lsa_un.un_rla.rla_flags);
+
+ TCHECK(lsap->lsa_un.un_rla.rla_count);
+ j = ntohs(lsap->lsa_un.un_rla.rla_count);
+ 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);
+ printf(" {"); /* } (ctags) */
+ switch (rlp->link_type) {
+
+ case RLA_TYPE_VIRTUAL:
+ printf(" virt");
+ /* Fall through */
+
+ case RLA_TYPE_ROUTER:
+ printf(" nbrid %s if %s",
+ ipaddr_string(&rlp->link_id),
+ ipaddr_string(&rlp->link_data));
+ break;
+
+ case RLA_TYPE_TRANSIT:
+ printf(" dr %s if %s",
+ ipaddr_string(&rlp->link_id),
+ ipaddr_string(&rlp->link_data));
+ break;
+
+ case RLA_TYPE_STUB:
+ printf(" net %s mask %s",
+ ipaddr_string(&rlp->link_id),
+ ipaddr_string(&rlp->link_data));
+ break;
+
+ default:
+ /* { (ctags) */
+ printf(" ??RouterLinksType %d?? }",
+ rlp->link_type);
+ return (0);
+ }
+ printf(" tos 0 metric %d", ntohs(rlp->link_tos0metric));
+ tosp = (struct tos_metric *)
+ ((sizeof rlp->link_tos0metric) + (u_char *) rlp);
+ for (k = 0; k < (int) rlp->link_toscount; ++k, ++tosp) {
+ TCHECK(*tosp);
+ printf(" tos %d metric %d",
+ tosp->tos_type,
+ ntohs(tosp->tos_metric));
+ }
+ /* { (ctags) */
+ printf(" }");
+ rlp = rln;
+ }
break;
- }
- printf(" {"); /* } (ctags) */
-
- switch (rlp->link_type) {
- case RLA_TYPE_VIRTUAL:
- printf(" virt");
- /* Fall through */
- case RLA_TYPE_ROUTER:
- printf(" nbrid %s if %s",
- ipaddr_string(&rlp->link_id),
- ipaddr_string(&rlp->link_data));
+ case LS_TYPE_NETWORK:
+ TCHECK(lsap->lsa_un.un_nla.nla_mask);
+ printf(" mask %s rtrs",
+ ipaddr_string(&lsap->lsa_un.un_nla.nla_mask));
+ ap = lsap->lsa_un.un_nla.nla_router;
+ while ((u_char *)ap < ls_end) {
+ TCHECK(*ap);
+ printf(" %s", ipaddr_string(ap));
+ ++ap;
+ }
break;
- case RLA_TYPE_TRANSIT:
- printf(" dr %s if %s",
- ipaddr_string(&rlp->link_id),
- ipaddr_string(&rlp->link_data));
+ case LS_TYPE_SUM_IP:
+ TCHECK(lsap->lsa_un.un_nla.nla_mask);
+ printf(" mask %s",
+ ipaddr_string(&lsap->lsa_un.un_sla.sla_mask));
+ /* Fall through */
+
+ case LS_TYPE_SUM_ABR:
+ TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
+ lp = lsap->lsa_un.un_sla.sla_tosmetric;
+ while ((u_char *)lp < ls_end) {
+ register u_int32_t ul;
+
+ TCHECK(*lp);
+ ul = ntohl(*lp);
+ printf(" tos %d metric %d",
+ (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS,
+ ul & SLA_MASK_METRIC);
+ ++lp;
+ }
break;
- case RLA_TYPE_STUB:
- printf(" net %s mask %s",
- ipaddr_string(&rlp->link_id),
- ipaddr_string(&rlp->link_data));
+ case LS_TYPE_ASE:
+ TCHECK(lsap->lsa_un.un_nla.nla_mask);
+ printf(" mask %s",
+ ipaddr_string(&lsap->lsa_un.un_asla.asla_mask));
+
+ TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
+ almp = lsap->lsa_un.un_asla.asla_metric;
+ while ((u_char *)almp < ls_end) {
+ register u_int32_t ul;
+
+ TCHECK(almp->asla_tosmetric);
+ ul = ntohl(almp->asla_tosmetric);
+ printf(" type %d tos %d metric %d",
+ (ul & ASLA_FLAG_EXTERNAL) ? 2 : 1,
+ (ul & ASLA_MASK_TOS) >> ASLA_SHIFT_TOS,
+ (ul & ASLA_MASK_METRIC));
+ TCHECK(almp->asla_forward);
+ if (almp->asla_forward.s_addr) {
+ printf(" forward %s",
+ ipaddr_string(&almp->asla_forward));
+ }
+ TCHECK(almp->asla_tag);
+ if (almp->asla_tag.s_addr) {
+ printf(" tag %s",
+ ipaddr_string(&almp->asla_tag));
+ }
+ ++almp;
+ }
break;
- default:
- printf(" ??RouterLinksType %d?? }", /* { (ctags) */
- rlp->link_type);
- return 0;
- }
- printf(" tos 0 metric %d",
- ntohs(rlp->link_tos0metric));
- tosp = (struct tos_metric *) ((sizeof rlp->link_tos0metric) + (caddr_t) rlp);
- for (k = 0; k < rlp->link_toscount; k++, tosp++) {
- printf(" tos %d metric %d",
- tosp->tos_type,
- ntohs(tosp->tos_metric));
- }
- printf(" }"); /* { (ctags) */
- rlp = rln;
- }
- break;
-
- case LS_TYPE_NETWORK:
- printf(" mask %s rtrs",
- ipaddr_string(&lsap->lsa_un.un_nla.nla_mask));
- for (ap = lsap->lsa_un.un_nla.nla_router;
- (caddr_t) (ap + 1) <= ls_end;
- ap++) {
- printf(" %s",
- ipaddr_string(ap));
+ case LS_TYPE_GROUP:
+ /* Multicast extensions as of 23 July 1991 */
+ mcp = lsap->lsa_un.un_mcla;
+ while ((u_char *)mcp < ls_end) {
+ TCHECK(mcp->mcla_vid);
+ switch (ntohl(mcp->mcla_vtype)) {
+
+ case MCLA_VERTEX_ROUTER:
+ printf(" rtr rtrid %s",
+ ipaddr_string(&mcp->mcla_vid));
+ break;
+
+ case MCLA_VERTEX_NETWORK:
+ printf(" net dr %s",
+ ipaddr_string(&mcp->mcla_vid));
+ break;
+
+ default:
+ printf(" ??VertexType %u??",
+ (u_int32_t)ntohl(mcp->mcla_vtype));
+ break;
+ }
+ ++mcp;
+ }
}
- break;
- case LS_TYPE_SUM_IP:
- printf(" mask %s",
- ipaddr_string(&lsap->lsa_un.un_sla.sla_mask));
- /* Fall through */
+ /* { (ctags) */
+ fputs(" }", stdout);
+ return (0);
+trunc:
+ fputs(" }", stdout);
+ return (1);
+}
- case LS_TYPE_SUM_ABR:
+static int
+ospf_decode_v2(register const struct ospfhdr *op,
+ register const u_char *dataend)
+{
+ register const struct in_addr *ap;
+ register const struct lsr *lsrp;
+ register const struct lsa_hdr *lshp;
+ register const struct lsa *lsap;
+ register char sep;
+ register int i;
- for (lp = lsap->lsa_un.un_sla.sla_tosmetric;
- (caddr_t) (lp + 1) <= ls_end;
- lp++) {
- u_int32_t ul = ntohl(*lp);
+ switch (op->ospf_type) {
- printf(" tos %d metric %d",
- (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS,
- ul & SLA_MASK_METRIC);
- }
- break;
-
- case LS_TYPE_ASE:
- printf(" mask %s",
- ipaddr_string(&lsap->lsa_un.un_asla.asla_mask));
-
- for (almp = lsap->lsa_un.un_asla.asla_metric;
- (caddr_t) (almp + 1) <= ls_end;
- almp++) {
- u_int32_t ul = ntohl(almp->asla_tosmetric);
-
- printf(" type %d tos %d metric %d",
- (ul & ASLA_FLAG_EXTERNAL) ? 2 : 1,
- (ul & ASLA_MASK_TOS) >> ASLA_SHIFT_TOS,
- (ul & ASLA_MASK_METRIC));
- if (almp->asla_forward.s_addr) {
- printf(" forward %s",
- ipaddr_string(&almp->asla_forward));
- }
- if (almp->asla_tag.s_addr) {
- printf(" tag %s",
- ipaddr_string(&almp->asla_tag));
- }
- }
- break;
-
- case LS_TYPE_GROUP:
- /* Multicast extensions as of 23 July 1991 */
- for (mcp = lsap->lsa_un.un_mcla;
- (caddr_t) (mcp + 1) <= ls_end;
- mcp++) {
- switch (ntohl(mcp->mcla_vtype)) {
- case MCLA_VERTEX_ROUTER:
- printf(" rtr rtrid %s",
- ipaddr_string(&mcp->mcla_vid));
+ case OSPF_TYPE_UMD:
+ /*
+ * Rob Coltun's special monitoring packets;
+ * do nothing
+ */
break;
- case MCLA_VERTEX_NETWORK:
- printf(" net dr %s",
- ipaddr_string(&mcp->mcla_vid));
+ case OSPF_TYPE_HELLO:
+ if (vflag) {
+ TCHECK(op->ospf_hello.hello_deadint);
+ ospf_print_bits(ospf_option_bits,
+ op->ospf_hello.hello_options);
+ printf(" mask %s int %d pri %d dead %u",
+ ipaddr_string(&op->ospf_hello.hello_mask),
+ ntohs(op->ospf_hello.hello_helloint),
+ op->ospf_hello.hello_priority,
+ (u_int32_t)ntohl(op->ospf_hello.hello_deadint));
+ }
+ TCHECK(op->ospf_hello.hello_dr);
+ if (op->ospf_hello.hello_dr.s_addr != 0)
+ printf(" dr %s",
+ ipaddr_string(&op->ospf_hello.hello_dr));
+ TCHECK(op->ospf_hello.hello_bdr);
+ if (op->ospf_hello.hello_bdr.s_addr != 0)
+ printf(" bdr %s",
+ ipaddr_string(&op->ospf_hello.hello_bdr));
+ if (vflag) {
+ printf(" nbrs");
+ ap = op->ospf_hello.hello_neighbor;
+ while ((u_char *)ap < dataend) {
+ TCHECK(*ap);
+ printf(" %s", ipaddr_string(ap));
+ ++ap;
+ }
+ }
+ break; /* HELLO */
+
+ case OSPF_TYPE_DB:
+ TCHECK(op->ospf_db.db_options);
+ ospf_print_bits(ospf_option_bits, op->ospf_db.db_options);
+ sep = ' ';
+ TCHECK(op->ospf_db.db_flags);
+ if (op->ospf_db.db_flags & OSPF_DB_INIT) {
+ printf("%cI", sep);
+ sep = '/';
+ }
+ if (op->ospf_db.db_flags & OSPF_DB_MORE) {
+ printf("%cM", sep);
+ sep = '/';
+ }
+ if (op->ospf_db.db_flags & OSPF_DB_MASTER) {
+ printf("%cMS", sep);
+ sep = '/';
+ }
+ TCHECK(op->ospf_db.db_seq);
+ printf(" S %X", (u_int32_t)ntohl(op->ospf_db.db_seq));
+
+ if (vflag) {
+ /* Print all the LS adv's */
+ lshp = op->ospf_db.db_lshdr;
+
+ while (!ospf_print_lshdr(lshp)) {
+ /* { (ctags) */
+ printf(" }");
+ ++lshp;
+ }
+ }
break;
- default:
- printf(" ??VertexType %u??",
- (u_int32_t)ntohl(mcp->mcla_vtype));
+ case OSPF_TYPE_LSR:
+ if (vflag) {
+ lsrp = op->ospf_lsr;
+ while ((u_char *)lsrp < dataend) {
+ TCHECK(*lsrp);
+ printf(" {"); /* } (ctags) */
+ ospf_print_ls_type(ntohl(lsrp->ls_type),
+ &lsrp->ls_stateid,
+ &lsrp->ls_router,
+ "LinkStateType %d");
+ /* { (ctags) */
+ printf(" }");
+ ++lsrp;
+ }
+ }
break;
- }
- }
- }
- printf(" }"); /* { (ctags) */
- return 0;
-}
+ case OSPF_TYPE_LSU:
+ if (vflag) {
+ lsap = op->ospf_lsu.lsu_lsa;
+ TCHECK(op->ospf_lsu.lsu_count);
+ i = ntohl(op->ospf_lsu.lsu_count);
+ while (i--) {
+ if (ospf_print_lsa(lsap))
+ goto trunc;
+ lsap = (struct lsa *)((u_char *)lsap +
+ ntohs(lsap->ls_hdr.ls_length));
+ }
+ }
+ break;
-void
-ospf_print(register const u_char *bp, register u_int length,
- register const u_char *bp2)
-{
- register const struct ospfhdr *op;
- register const struct ip *ip;
- register const caddr_t end = (caddr_t)snapend;
- register const struct lsa *lsap;
- register const struct lsa_hdr *lshp;
- char sep;
- int i, j;
- const struct in_addr *ap;
- const struct lsr *lsrp;
-
- op = (struct ospfhdr *)bp;
- ip = (struct ip *)bp2;
- /* Print the source and destination address */
- (void) printf("%s > %s:",
- ipaddr_string(&ip->ip_src),
- ipaddr_string(&ip->ip_dst));
-
- if ((caddr_t) (&op->ospf_len + 1) > end) {
- goto trunc_test;
- }
-
- /* If the type is valid translate it, or just print the type */
- /* value. If it's not valid, say so and return */
- if (op->ospf_type || op->ospf_type < OSPF_TYPE_MAX) {
- printf(" OSPFv%d-%s %d:",
- op->ospf_version,
- ospf_types[op->ospf_type],
- length);
- } else {
- printf(" ospf-v%d-??type %d?? %d:",
- op->ospf_version,
- op->ospf_type,
- length);
- return;
- }
-
- if (length != ntohs(op->ospf_len)) {
- printf(" ??len %d??",
- ntohs(op->ospf_len));
- goto trunc_test;
- }
-
- if ((caddr_t) (&op->ospf_routerid + 1) > end) {
- goto trunc_test;
- }
-
- /* Print the routerid if it is not the same as the source */
- if (ip->ip_src.s_addr != op->ospf_routerid.s_addr) {
- printf(" rtrid %s",
- ipaddr_string(&op->ospf_routerid));
- }
-
- if ((caddr_t) (&op->ospf_areaid + 1) > end) {
- goto trunc_test;
- }
-
- if (op->ospf_areaid.s_addr) {
- printf(" area %s",
- ipaddr_string(&op->ospf_areaid));
- } else {
- printf(" backbone");
- }
-
- if ((caddr_t) (op->ospf_authdata + OSPF_AUTH_SIZE) > end) {
- goto trunc_test;
- }
-
- if (vflag) {
- /* Print authentication data (should we really do this?) */
- switch (ntohs(op->ospf_authtype)) {
- case OSPF_AUTH_NONE:
- break;
-
- case OSPF_AUTH_SIMPLE:
- printf(" auth ");
- j = 0;
- for (i = 0; i < sizeof (op->ospf_authdata); i++) {
- if (!isprint(op->ospf_authdata[i])) {
- j = 1;
- break;
+ case OSPF_TYPE_LSA:
+ if (vflag) {
+ lshp = op->ospf_lsa.lsa_lshdr;
+
+ while (!ospf_print_lshdr(lshp)) {
+ /* { (ctags) */
+ printf(" }");
+ ++lshp;
+ }
}
- }
- if (j) {
- /* Print the auth-data as a string of octets */
- printf("%s.%s",
- ipaddr_string((struct in_addr *) op->ospf_authdata),
- ipaddr_string((struct in_addr *) &op->ospf_authdata[sizeof (struct in_addr)]));
- } else {
- /* Print the auth-data as a text string */
- printf("'%.8s'",
- op->ospf_authdata);
- }
- break;
+ break;
default:
- printf(" ??authtype-%d??",
- ntohs(op->ospf_authtype));
- return;
+ printf("v2 type %d", op->ospf_type);
+ break;
}
- }
-
-
- /* Do rest according to version. */
- switch (op->ospf_version) {
- case 2:
- /* ospf version 2 */
- switch (op->ospf_type) {
- case OSPF_TYPE_UMD: /* Rob Coltun's special monitoring packets; do nothing */
- break;
+ return (0);
+trunc:
+ return (1);
+}
- case OSPF_TYPE_HELLO:
- if ((caddr_t) (&op->ospf_hello.hello_deadint + 1) > end) {
- break;
- }
- if (vflag) {
- ospf_print_bits(ospf_option_bits, op->ospf_hello.hello_options);
- printf(" mask %s int %d pri %d dead %u",
- ipaddr_string(&op->ospf_hello.hello_mask),
- ntohs(op->ospf_hello.hello_helloint),
- op->ospf_hello.hello_priority,
- (u_int32_t)ntohl(op->ospf_hello.hello_deadint));
- }
-
- if ((caddr_t) (&op->ospf_hello.hello_dr + 1) > end) {
- break;
- }
- if (op->ospf_hello.hello_dr.s_addr) {
- printf(" dr %s",
- ipaddr_string(&op->ospf_hello.hello_dr));
- }
+void
+ospf_print(register const u_char *bp, register u_int length,
+ register const u_char *bp2)
+{
+ register const struct ospfhdr *op;
+ register const struct ip *ip;
+ register const u_char *dataend;
+ register const char *cp;
+
+ op = (struct ospfhdr *)bp;
+ ip = (struct ip *)bp2;
+ /* Print the source and destination address */
+ (void) printf("%s > %s:",
+ ipaddr_string(&ip->ip_src),
+ ipaddr_string(&ip->ip_dst));
+
+ /* 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);
+ cp = tok2str(type2str, "type%d", op->ospf_type);
+ printf(" OSPFv%d-%s %d:", op->ospf_version, cp, length);
+ if (*cp == 't')
+ return;
+
+ TCHECK(op->ospf_len);
+ if (length != ntohs(op->ospf_len)) {
+ printf(" [len %d]", ntohs(op->ospf_len));
+ return;
+ }
+ dataend = bp + length;
- if ((caddr_t) (&op->ospf_hello.hello_bdr + 1) > end) {
- break;
- }
- if (op->ospf_hello.hello_bdr.s_addr) {
- printf(" bdr %s",
- ipaddr_string(&op->ospf_hello.hello_bdr));
- }
-
- if (vflag) {
- if ((caddr_t) (op->ospf_hello.hello_neighbor + 1) > end) {
- break;
- }
- printf(" nbrs");
- for (ap = op->ospf_hello.hello_neighbor;
- (caddr_t) (ap + 1) <= end;
- ap++) {
- printf(" %s",
- ipaddr_string(ap));
- }
- }
- break; /* HELLO */
+ /* Print the routerid if it is not the same as the source */
+ TCHECK(op->ospf_routerid);
+ if (ip->ip_src.s_addr != op->ospf_routerid.s_addr)
+ printf(" rtrid %s", ipaddr_string(&op->ospf_routerid));
- case OSPF_TYPE_DB:
- if ((caddr_t) (&op->ospf_db.db_seq + 1) > end) {
- break;
- }
- ospf_print_bits(ospf_option_bits, op->ospf_db.db_options);
- sep = ' ';
- if (op->ospf_db.db_flags & OSPF_DB_INIT) {
- printf("%cI",
- sep);
- sep = '/';
- }
- if (op->ospf_db.db_flags & OSPF_DB_MORE) {
- printf("%cM",
- sep);
- sep = '/';
- }
- if (op->ospf_db.db_flags & OSPF_DB_MASTER) {
- printf("%cMS",
- sep);
- sep = '/';
- }
- printf(" S %X", (u_int32_t)ntohl(op->ospf_db.db_seq));
-
- if (vflag) {
- /* Print all the LS adv's */
- lshp = op->ospf_db.db_lshdr;
-
- while (!ospf_print_lshdr(lshp, end)) {
- printf(" }"); /* { (ctags) */
- lshp++;
- }
- }
- break;
+ TCHECK(op->ospf_areaid);
+ if (op->ospf_areaid.s_addr != 0)
+ printf(" area %s", ipaddr_string(&op->ospf_areaid));
+ else
+ printf(" backbone");
- case OSPF_TYPE_LSR:
- if (vflag) {
- for (lsrp = op->ospf_lsr; (caddr_t) (lsrp+1) <= end; lsrp++) {
- int32_t type;
+ if (vflag) {
+ /* Print authentication data (should we really do this?) */
+ TCHECK2(op->ospf_authdata[0], sizeof(op->ospf_authdata));
+ switch (ntohs(op->ospf_authtype)) {
- if ((caddr_t) (lsrp + 1) > end) {
+ case OSPF_AUTH_NONE:
break;
- }
- printf(" {"); /* } (ctags) */
- if (!(type = ntohl(lsrp->ls_type)) || type >= LS_TYPE_MAX) {
- printf(" ??LinkStateType %d }", type); /* { (ctags) */
- printf(" }"); /* { (ctags) */
+ case OSPF_AUTH_SIMPLE:
+ printf(" auth \"");
+ (void)fn_printn(op->ospf_authdata,
+ sizeof(op->ospf_authdata), NULL);
+ printf("\"");
break;
- }
- LS_PRINT(lsrp, type);
- printf(" }"); /* { (ctags) */
+ default:
+ printf(" ??authtype-%d??", ntohs(op->ospf_authtype));
+ return;
}
- }
- break;
-
- case OSPF_TYPE_LSU:
- if (vflag) {
- lsap = op->ospf_lsu.lsu_lsa;
- i = ntohl(op->ospf_lsu.lsu_count);
-
- while (i-- &&
- !ospf_print_lsa(lsap, end)) {
- lsap = (struct lsa *) ((caddr_t) lsap + ntohs(lsap->ls_hdr.ls_length));
- }
- }
- break;
-
+ }
+ /* Do rest according to version. */
+ switch (op->ospf_version) {
- case OSPF_TYPE_LSA:
- if (vflag) {
- lshp = op->ospf_lsa.lsa_lshdr;
+ case 2:
+ /* ospf version 2 */
+ if (ospf_decode_v2(op, dataend))
+ goto trunc;
+ break;
- while (!ospf_print_lshdr(lshp, end)) {
- printf(" }"); /* { (ctags) */
- lshp++;
- }
+ default:
+ printf(" ospf [version %d]", op->ospf_version);
break;
- }
- } /* end switch on v2 packet type */
- break;
-
- default:
- printf(" ospf [version %d]",
- op->ospf_version);
- break;
- } /* end switch on version */
-
- trunc_test:
- if ((snapend - bp) < length) {
- printf(" [|]");
- }
-
- return; /* from ospf_print */
+ } /* end switch on version */
+
+ return;
+trunc:
+ fputs(tstr, stdout);
}
diff --git a/contrib/tcpdump/print-pim.c b/contrib/tcpdump/print-pim.c
index 2cf0cdd..9b52ef8 100644
--- a/contrib/tcpdump/print-pim.c
+++ b/contrib/tcpdump/print-pim.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-pim.c,v 1.6 96/07/23 14:17:26 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-pim.c,v 1.7 96/09/26 23:36:48 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
diff --git a/contrib/tcpdump/print-ppp.c b/contrib/tcpdump/print-ppp.c
index 5436551..27dee0e 100644
--- a/contrib/tcpdump/print-ppp.c
+++ b/contrib/tcpdump/print-ppp.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#)$Header: print-ppp.c,v 1.22 96/07/14 19:39:03 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-ppp.c,v 1.24 96/12/10 23:23:12 leres Exp $ (LBL)";
#endif
#ifdef PPP
diff --git a/contrib/tcpdump/print-rip.c b/contrib/tcpdump/print-rip.c
index 8791712..4daf6e2 100644
--- a/contrib/tcpdump/print-rip.c
+++ b/contrib/tcpdump/print-rip.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-rip.c,v 1.34 96/07/23 14:17:26 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-rip.c,v 1.36 96/11/29 01:22:50 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -99,7 +99,7 @@ rip_print(const u_char *dat, u_int length)
register const struct rip_netinfo *ni;
register int i, j, trunc;
- i = min(length, snapend - dat) - (sizeof(*rp) - sizeof(*ni));
+ i = min(length, snapend - dat) - sizeof(*rp);
if (i < 0)
return;
diff --git a/contrib/tcpdump/print-sl.c b/contrib/tcpdump/print-sl.c
index 631714d..dfea3bf 100644
--- a/contrib/tcpdump/print-sl.c
+++ b/contrib/tcpdump/print-sl.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#)$Header: print-sl.c,v 1.38 96/07/15 18:23:25 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-sl.c,v 1.41 96/12/10 23:19:42 leres Exp $ (LBL)";
#endif
#ifdef HAVE_NET_SLIP_H
@@ -139,7 +139,7 @@ sliplink_print(register const u_char *p, register const struct ip *ip,
case TYPE_UNCOMPRESSED_TCP:
/*
- * The connection id is stored in the IP protcol field.
+ * The connection id is stored in the IP protocol field.
* Get it from the link layer since sl_uncompress_tcp()
* has restored the IP header copy to IPPROTO_TCP.
*/
@@ -243,6 +243,7 @@ compressed_sl_print(const u_char *chdr, const struct ip *ip,
#include <sys/types.h>
#include <sys/time.h>
+#include <pcap.h>
#include <stdio.h>
#include "interface.h"
diff --git a/contrib/tcpdump/print-snmp.c b/contrib/tcpdump/print-snmp.c
index 0bc856a..c98fdbe 100644
--- a/contrib/tcpdump/print-snmp.c
+++ b/contrib/tcpdump/print-snmp.c
@@ -39,9 +39,10 @@
# responsibility for the use of this software.
# @(#)snmp.awk.x 1.1 (LANL) 1/15/90
*/
+
#ifndef lint
-static char rcsid[] =
- "@(#) $Id: print-snmp.c,v 3.10 91/01/17 01:18:13 loverso Exp Locker: loverso $ (jlv)";
+static const char rcsid[] =
+ "@(#) $Header: print-snmp.c,v 1.31 96/12/10 23:22:55 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -338,8 +339,8 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
class = form >> 1; /* bits 7&6 -> bits 1&0, range 0-3 */
form &= 0x1; /* bit 5 -> bit 0, range 0-1 */
#else
- form = (*p & ASN_FORM_BITS) >> ASN_FORM_SHIFT;
- class = (*p & ASN_CLASS_BITS) >> ASN_CLASS_SHIFT;
+ form = (u_char)(*p & ASN_FORM_BITS) >> ASN_FORM_SHIFT;
+ class = (u_char)(*p & ASN_CLASS_BITS) >> ASN_CLASS_SHIFT;
#endif
elem->form = form;
elem->class = class;
@@ -400,7 +401,7 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
ifNotTruncated printf("[class?%c/%d]", *Form[form], class);
return -1;
}
- if (id >= Class[class].numIDs) {
+ if ((int)id >= Class[class].numIDs) {
ifNotTruncated printf("[id?%c/%s/%d]", *Form[form],
Class[class].name, id);
return -1;
diff --git a/contrib/tcpdump/print-sunrpc.c b/contrib/tcpdump/print-sunrpc.c
index 71055aa..5e3f9ae 100644
--- a/contrib/tcpdump/print-sunrpc.c
+++ b/contrib/tcpdump/print-sunrpc.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-sunrpc.c,v 1.24 96/07/23 14:17:27 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-sunrpc.c,v 1.25 96/09/26 23:36:49 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
diff --git a/contrib/tcpdump/print-tcp.c b/contrib/tcpdump/print-tcp.c
index a865e19..e9bf240 100644
--- a/contrib/tcpdump/print-tcp.c
+++ b/contrib/tcpdump/print-tcp.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-tcp.c,v 1.46 96/07/23 14:17:27 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-tcp.c,v 1.52 96/12/03 10:59:55 vern Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -100,7 +100,7 @@ tcp_print(register const u_char *bp, register u_int length,
register const struct tcphdr *tp;
register const struct ip *ip;
register u_char flags;
- register u_int hlen;
+ register int hlen;
register char ch;
u_short sport, dport, win, urp;
u_int32_t seq, ack;
@@ -190,6 +190,10 @@ tcp_print(register const u_char *bp, register u_int length,
}
}
hlen = tp->th_off * 4;
+ if (hlen > length) {
+ (void)printf(" [bad hdr length]");
+ return;
+ }
length -= hlen;
if (length > 0 || flags & (TH_SYN | TH_FIN | TH_RST))
(void)printf(" %u:%u(%d)", seq, seq + length, length);
@@ -211,27 +215,30 @@ tcp_print(register const u_char *bp, register u_int length,
putchar(' ');
ch = '<';
while (hlen > 0) {
- --hlen;
putchar(ch);
- if (cp > snapend)
- goto trunc;
+ TCHECK(*cp);
opt = *cp++;
if (ZEROLENOPT(opt))
len = 1;
else {
- if (cp > snapend)
- goto trunc;
- len = *cp++;
- --hlen;
+ TCHECK(*cp);
+ len = *cp++; /* total including type, len */
+ if (len < 2 || len > hlen)
+ goto bad;
+ --hlen; /* account for length byte */
}
+ --hlen; /* account for type byte */
datalen = 0;
+
+/* Bail if "l" bytes of data are not left or were not captured */
+#define LENCHECK(l) { if ((l) > hlen) goto bad; TCHECK2(*cp, l); }
+
switch (opt) {
case TCPOPT_MAXSEG:
(void)printf("mss");
datalen = 2;
- if (cp + datalen > snapend)
- goto trunc;
+ LENCHECK(datalen);
(void)printf(" %u", EXTRACT_16BITS(cp));
break;
@@ -247,8 +254,7 @@ tcp_print(register const u_char *bp, register u_int length,
case TCPOPT_WSCALE:
(void)printf("wscale");
datalen = 1;
- if (cp + datalen > snapend)
- goto trunc;
+ LENCHECK(datalen);
(void)printf(" %u", *cp);
break;
@@ -259,14 +265,12 @@ tcp_print(register const u_char *bp, register u_int length,
case TCPOPT_SACK:
(void)printf("sack");
datalen = len - 2;
- i = datalen;
- for (i = datalen; i > 0; i -= 4) {
- if (cp + i + 4 > snapend)
- goto trunc;
+ for (i = 0; i < datalen; i += 4) {
+ LENCHECK(i + 4);
/* block-size@relative-origin */
(void)printf(" %u@%u",
- EXTRACT_16BITS(cp + 2),
- EXTRACT_16BITS(cp));
+ EXTRACT_16BITS(cp + i + 2),
+ EXTRACT_16BITS(cp + i));
}
if (datalen % 4)
(void)printf("[len %d]", len);
@@ -275,63 +279,52 @@ tcp_print(register const u_char *bp, register u_int length,
case TCPOPT_ECHO:
(void)printf("echo");
datalen = 4;
- if (cp + datalen > snapend)
- goto trunc;
+ LENCHECK(datalen);
(void)printf(" %u", EXTRACT_32BITS(cp));
break;
case TCPOPT_ECHOREPLY:
(void)printf("echoreply");
datalen = 4;
- if (cp + datalen > snapend)
- goto trunc;
+ LENCHECK(datalen);
(void)printf(" %u", EXTRACT_32BITS(cp));
break;
case TCPOPT_TIMESTAMP:
(void)printf("timestamp");
- datalen = 4;
- if (cp + datalen > snapend)
- goto trunc;
+ datalen = 8;
+ LENCHECK(4);
(void)printf(" %u", EXTRACT_32BITS(cp));
- datalen += 4;
- if (cp + datalen > snapend)
- goto trunc;
+ LENCHECK(datalen);
(void)printf(" %u", EXTRACT_32BITS(cp + 4));
break;
case TCPOPT_CC:
(void)printf("cc");
datalen = 4;
- if (cp + datalen > snapend)
- goto trunc;
+ LENCHECK(datalen);
(void)printf(" %u", EXTRACT_32BITS(cp));
break;
case TCPOPT_CCNEW:
(void)printf("ccnew");
datalen = 4;
- if (cp + datalen > snapend)
- goto trunc;
+ LENCHECK(datalen);
(void)printf(" %u", EXTRACT_32BITS(cp));
break;
case TCPOPT_CCECHO:
(void)printf("ccecho");
datalen = 4;
- if (cp + datalen > snapend)
- goto trunc;
+ LENCHECK(datalen);
(void)printf(" %u", EXTRACT_32BITS(cp));
break;
default:
(void)printf("opt-%d:", opt);
datalen = len - 2;
- if (datalen < 0)
- datalen = 0;
for (i = 0; i < datalen; ++i) {
- if (cp + i > snapend)
- goto trunc;
+ LENCHECK(i);
(void)printf("%02x", cp[i]);
}
break;
@@ -348,10 +341,17 @@ tcp_print(register const u_char *bp, register u_int length,
if (datalen != len)
(void)printf("[len %d]", len);
ch = ',';
+ if (opt == TCPOPT_EOL)
+ break;
}
putchar('>');
}
return;
+bad:
+ fputs("[bad opt]", stdout);
+ if (ch != '\0')
+ putchar('>');
+ return;
trunc:
fputs("[|tcp]", stdout);
if (ch != '\0')
diff --git a/contrib/tcpdump/print-tftp.c b/contrib/tcpdump/print-tftp.c
index 97b2f0e..5a0b618 100644
--- a/contrib/tcpdump/print-tftp.c
+++ b/contrib/tcpdump/print-tftp.c
@@ -22,8 +22,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-tftp.c,v 1.27 96/07/23 14:17:28 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-tftp.c,v 1.28 96/09/26 23:36:50 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
diff --git a/contrib/tcpdump/print-udp.c b/contrib/tcpdump/print-udp.c
index c58aedd..3960de8 100644
--- a/contrib/tcpdump/print-udp.c
+++ b/contrib/tcpdump/print-udp.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-udp.c,v 1.55 96/07/23 14:17:28 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-udp.c,v 1.58 96/12/10 23:22:07 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -53,7 +53,7 @@ static char rcsid[] =
struct rtcphdr {
u_short rh_flags; /* T:2 P:1 CNT:5 PT:8 */
- u_short rh_len; /* length of message (in bytes) */
+ u_short rh_len; /* length of message (in words) */
u_int rh_ssrc; /* synchronization src id */
};
@@ -77,27 +77,28 @@ struct rtcp_sr {
* Time stamps are middle 32-bits of ntp timestamp.
*/
struct rtcp_rr {
- u_int rr_srcid; /* sender being reported */
- u_int rr_nr; /* no. packets received */
- u_int rr_np; /* no. packets predicted */
+ u_int rr_srcid; /* sender being reported */
+ u_int rr_nl; /* no. packets lost */
+ u_int rr_ls; /* extended last seq number received */
u_int rr_dv; /* jitter (delay variance) */
u_int rr_lsr; /* orig. ts from last rr from this src */
u_int rr_dlsr; /* time from recpt of last rr to xmit time */
};
/*XXX*/
-#define RTCP_PT_SR 0
-#define RTCP_PT_RR 1
-#define RTCP_PT_SDES 2
+#define RTCP_PT_SR 200
+#define RTCP_PT_RR 201
+#define RTCP_PT_SDES 202
#define RTCP_SDES_CNAME 1
#define RTCP_SDES_NAME 2
#define RTCP_SDES_EMAIL 3
#define RTCP_SDES_PHONE 4
#define RTCP_SDES_LOC 5
#define RTCP_SDES_TOOL 6
-#define RTCP_SDES_TXT 7
-#define RTCP_PT_BYE 3
-#define RTCP_PT_APP 4
+#define RTCP_SDES_NOTE 7
+#define RTCP_SDES_PRIV 8
+#define RTCP_PT_BYE 203
+#define RTCP_PT_APP 204
static void
vat_print(const void *hdr, u_int len, register const struct udphdr *up)
@@ -130,24 +131,26 @@ rtp_print(const void *hdr, u_int len, register const struct udphdr *up)
{
/* rtp v1 or v2 */
u_int *ip = (u_int *)hdr;
- u_int hasopt, contype, hasmarker;
+ u_int hasopt, hasext, contype, hasmarker;
u_int i0 = ntohl(((u_int *)hdr)[0]);
u_int i1 = ntohl(((u_int *)hdr)[1]);
u_int dlen = ntohs(up->uh_ulen) - sizeof(*up) - 8;
- const char* ptype;
+ const char * ptype;
ip += 2;
len >>= 2;
len -= 2;
+ hasopt = 0;
+ hasext = 0;
if ((i0 >> 30) == 1) {
/* rtp v1 */
hasopt = i0 & 0x800000;
contype = (i0 >> 16) & 0x3f;
hasmarker = i0 & 0x400000;
ptype = "rtpv1";
- } else { /*XXX*/
+ } else {
/* rtp v2 */
- hasopt = i0 & 0x20000000;
+ hasext = i0 & 0x10000000;
contype = (i0 >> 16) & 0x7f;
hasmarker = i0 & 0x800000;
dlen -= 4;
@@ -155,14 +158,16 @@ rtp_print(const void *hdr, u_int len, register const struct udphdr *up)
ip += 1;
len -= 1;
}
- printf(" udp/%s %d c%d %s%s %d",
+ printf(" udp/%s %d c%d %s%s %d %u",
ptype,
dlen,
contype,
- hasopt? "+" : "",
+ (hasopt || hasext)? "+" : "",
hasmarker? "*" : "",
- i0 & 0xffff);
+ i0 & 0xffff,
+ i1);
if (vflag) {
+ printf(" %u", i1);
if (hasopt) {
u_int i2, optlen;
do {
@@ -173,50 +178,79 @@ rtp_print(const void *hdr, u_int len, register const struct udphdr *up)
return;
}
ip += optlen;
+ len -= optlen;
} while ((int)i2 >= 0);
}
- if (contype == 0x1f)
+ if (hasext) {
+ u_int i2, extlen;
+ i2 = ip[0];
+ extlen = (i2 & 0xffff) + 1;
+ if (extlen > len) {
+ printf(" !ext");
+ return;
+ }
+ ip += extlen;
+ }
+ if (contype == 0x1f) /*XXX H.261 */
printf(" 0x%04x", ip[0] >> 16);
- printf(" %u", i1);
}
}
-static const u_char*
-rtcp_print(const u_char *hdr)
+static const u_char *
+rtcp_print(const u_char *hdr, const u_char *ep)
{
/* rtp v2 control (rtcp) */
- struct rtcp_rr* rr = 0;
- struct rtcp_sr* sr;
- struct rtcphdr* rh = (struct rtcphdr*)hdr;
- u_int len = (ntohs(rh->rh_len) + 1) * 4;
- u_short flags = ntohs(rh->rh_flags);
- int cnt = (flags >> 8) & 0x1f;
- double ts, dts, jitter;
- if (vflag)
- printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
+ struct rtcp_rr *rr = 0;
+ struct rtcp_sr *sr;
+ struct rtcphdr *rh = (struct rtcphdr *)hdr;
+ u_int len;
+ u_short flags;
+ int cnt;
+ double ts, dts;
+ if ((u_char *)(rh + 1) > ep) {
+ printf(" [|rtcp]");
+ return (ep);
+ }
+ len = (ntohs(rh->rh_len) + 1) * 4;
+ flags = ntohs(rh->rh_flags);
+ cnt = (flags >> 8) & 0x1f;
switch (flags & 0xff) {
case RTCP_PT_SR:
- sr = (struct rtcp_sr*)(rh + 1);
+ sr = (struct rtcp_sr *)(rh + 1);
printf(" sr");
if (len != cnt * sizeof(*rr) + sizeof(*sr) + sizeof(*rh))
printf(" [%d]", len);
- ts = (double)((u_int32_t)ntohl(sr->sr_ts)) / 65536.;
- printf(" @%.2f %up %ub", ts, (u_int32_t)ntohl(sr->sr_np),
- (u_int32_t)ntohl(sr->sr_nb));
- rr = (struct rtcp_rr*)(sr + 1);
+ if (vflag)
+ printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
+ if ((u_char *)(sr + 1) > ep) {
+ printf(" [|rtcp]");
+ return (ep);
+ }
+ ts = (double)((u_int32_t)ntohl(sr->sr_ntp.upper)) +
+ ((double)((u_int32_t)ntohl(sr->sr_ntp.lower)) /
+ 4294967296.0);
+ printf(" @%.2f %u %up %ub", ts, (u_int32_t)ntohl(sr->sr_ts),
+ (u_int32_t)ntohl(sr->sr_np), (u_int32_t)ntohl(sr->sr_nb));
+ rr = (struct rtcp_rr *)(sr + 1);
break;
case RTCP_PT_RR:
printf(" rr");
if (len != cnt * sizeof(*rr) + sizeof(*rh))
printf(" [%d]", len);
- rr = (struct rtcp_rr*)(rh + 1);
+ rr = (struct rtcp_rr *)(rh + 1);
+ if (vflag)
+ printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
break;
case RTCP_PT_SDES:
printf(" sdes %d", len);
+ if (vflag)
+ printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
cnt = 0;
break;
case RTCP_PT_BYE:
printf(" bye %d", len);
+ if (vflag)
+ printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
cnt = 0;
break;
default:
@@ -227,19 +261,18 @@ rtcp_print(const u_char *hdr)
if (cnt > 1)
printf(" c%d", cnt);
while (--cnt >= 0) {
- if ((u_char*)(rr + 1) > snapend) {
+ if ((u_char *)(rr + 1) > ep) {
printf(" [|rtcp]");
- return (snapend);
+ return (ep);
}
if (vflag)
printf(" %u", (u_int32_t)ntohl(rr->rr_srcid));
ts = (double)((u_int32_t)ntohl(rr->rr_lsr)) / 65536.;
dts = (double)((u_int32_t)ntohl(rr->rr_dlsr)) / 65536.;
- jitter = (double)((u_int32_t)ntohl(rr->rr_dv)) / 65536.;
- printf(" %ur %ue %.2fj @%.2f+%.2f",
- (u_int32_t)ntohl(rr->rr_nr),
- (u_int32_t)ntohl(rr->rr_np),
- jitter, ts, dts);
+ printf(" %ul %us %uj @%.2f+%.2f",
+ (u_int32_t)ntohl(rr->rr_nl) & 0x00ffffff,
+ (u_int32_t)ntohl(rr->rr_ls),
+ (u_int32_t)ntohl(rr->rr_dv), ts, dts);
}
return (hdr + len);
}
@@ -260,8 +293,11 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
register const struct udphdr *up;
register const struct ip *ip;
register const u_char *cp;
+ register const u_char *ep = bp + length;
u_short sport, dport, ulen;
+ if (ep > snapend)
+ ep = snapend;
up = (struct udphdr *)bp;
ip = (struct ip *)bp2;
cp = (u_char *)(up + 1);
@@ -328,43 +364,44 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
udpport_string(sport),
ipaddr_string(&ip->ip_dst),
udpport_string(dport));
- while (cp < snapend)
- cp = rtcp_print(cp);
+ while (cp < ep)
+ cp = rtcp_print(cp, ep);
break;
}
return;
}
- if (! qflag) {
+ if (!qflag) {
register struct rpc_msg *rp;
enum msg_type direction;
rp = (struct rpc_msg *)(up + 1);
- TCHECK(rp->rm_direction);
- direction = (enum msg_type)ntohl(rp->rm_direction);
- if (dport == NFS_PORT && direction == CALL) {
- nfsreq_print((u_char *)rp, length, (u_char *)ip);
- return;
- }
- else if (sport == NFS_PORT && direction == REPLY) {
- nfsreply_print((u_char *)rp, length, (u_char *)ip);
- return;
- }
+ if (TTEST(rp->rm_direction)) {
+ direction = (enum msg_type)ntohl(rp->rm_direction);
+ if (dport == NFS_PORT && direction == CALL) {
+ nfsreq_print((u_char *)rp, length,
+ (u_char *)ip);
+ return;
+ }
+ if (sport == NFS_PORT && direction == REPLY) {
+ nfsreply_print((u_char *)rp, length,
+ (u_char *)ip);
+ return;
+ }
#ifdef notdef
- else if (dport == SUNRPC_PORT && direction == CALL) {
- sunrpcrequest_print((u_char *)rp, length, (u_char *)ip);
- return;
- }
-#endif
- else {
- TCHECK2(cp[0], 1);
- if (((struct LAP *)cp)->type == lapDDP &&
- (atalk_port(sport) || atalk_port(dport))) {
- if (vflag)
- fputs("kip ", stdout);
- atalk_print(cp, length);
+ if (dport == SUNRPC_PORT && direction == CALL) {
+ sunrpcrequest_print((u_char *)rp, length, (u_char *)ip);
return;
}
+#endif
+ }
+ if (TTEST(((struct LAP *)cp)->type) &&
+ ((struct LAP *)cp)->type == lapDDP &&
+ (atalk_port(sport) || atalk_port(dport))) {
+ if (vflag)
+ fputs("kip ", stdout);
+ atalk_print(cp, length);
+ return;
}
}
(void)printf("%s.%s > %s.%s:",
@@ -401,7 +438,4 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
#undef ISPORT
} else
(void)printf(" udp %u", (u_int32_t)(ulen - sizeof(*up)));
- return;
-trunc:
- fputs("[|udp]", stdout);
}
diff --git a/contrib/tcpdump/print-wb.c b/contrib/tcpdump/print-wb.c
index 5c9f0d8..12e4081 100644
--- a/contrib/tcpdump/print-wb.c
+++ b/contrib/tcpdump/print-wb.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: print-wb.c,v 1.20 96/07/14 19:39:05 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: print-wb.c,v 1.23 96/12/10 23:21:43 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
@@ -49,7 +49,7 @@ static char rcsid[] =
#define DOP_ALIGN 4
#define DOP_ROUNDUP(x) ((((int)(x)) + (DOP_ALIGN - 1)) & ~(DOP_ALIGN - 1))
#define DOP_NEXT(d)\
- ((struct dophdr*)((u_char *)(d) + \
+ ((struct dophdr *)((u_char *)(d) + \
DOP_ROUNDUP(ntohs((d)->dh_len) + sizeof(*(d)))))
/*
@@ -125,7 +125,7 @@ struct pkt_rreq {
u_int32_t pr_id; /* source id of drawops to be repaired */
struct PageID pr_page; /* page of drawops */
u_int32_t pr_sseq; /* start seqno */
- u_int32_t pr_eseq; /* end seqno*/
+ u_int32_t pr_eseq; /* end seqno */
};
/*
@@ -205,7 +205,7 @@ wb_id(const struct pkt_id *id, u_int len)
}
c = '<';
- for (i = 0; i < nid && (u_char*)io < snapend; ++io, ++i) {
+ for (i = 0; i < nid && (u_char *)io < snapend; ++io, ++i) {
printf("%c%s:%u",
c, ipaddr_string(&io->id), (u_int32_t)ntohl(io->off));
c = ',';
@@ -251,16 +251,16 @@ static int
wb_prep(const struct pkt_prep *prep, u_int len)
{
int n;
- const struct pgstate* ps;
- const u_char* ep = snapend;
+ const struct pgstate *ps;
+ const u_char *ep = snapend;
printf(" wb-prep:");
if (len < sizeof(*prep)) {
return (-1);
}
n = ntohl(prep->pp_n);
- ps = (const struct pgstate*)(prep + 1);
- while (--n >= 0 && (u_char*)ps < ep) {
+ ps = (const struct pgstate *)(prep + 1);
+ while (--n >= 0 && (u_char *)ps < ep) {
const struct id_off *io, *ie;
char c = '<';
@@ -268,16 +268,16 @@ wb_prep(const struct pkt_prep *prep, u_int len)
(u_int32_t)ntohl(ps->slot),
ipaddr_string(&ps->page.p_sid),
(u_int32_t)ntohl(ps->page.p_uid));
- io = (struct id_off*)(ps + 1);
- for (ie = io + ps->nid; io < ie && (u_char*)io < ep; ++io) {
+ io = (struct id_off *)(ps + 1);
+ for (ie = io + ps->nid; io < ie && (u_char *)io < ep; ++io) {
printf("%c%s:%u", c, ipaddr_string(&io->id),
(u_int32_t)ntohl(io->off));
c = ',';
}
printf(">");
- ps = (struct pgstate*)io;
+ ps = (struct pgstate *)io;
}
- return ((u_char*)ps <= ep? 0 : -1);
+ return ((u_char *)ps <= ep? 0 : -1);
}
@@ -323,7 +323,7 @@ wb_dops(const struct dophdr *dh, u_int32_t ss, u_int32_t es)
}
}
dh = DOP_NEXT(dh);
- if ((u_char*)dh >= snapend) {
+ if ((u_char *)dh > snapend) {
printf("[|wb]");
break;
}
@@ -350,7 +350,7 @@ wb_rrep(const struct pkt_rrep *rrep, u_int len)
(u_int32_t)ntohl(dop->pd_eseq));
if (vflag)
- return (wb_dops((const struct dophdr*)(dop + 1),
+ return (wb_dops((const struct dophdr *)(dop + 1),
ntohl(dop->pd_sseq), ntohl(dop->pd_eseq)));
return (0);
}
@@ -370,7 +370,7 @@ wb_drawop(const struct pkt_dop *dop, u_int len)
(u_int32_t)ntohl(dop->pd_eseq));
if (vflag)
- return (wb_dops((const struct dophdr*)(dop + 1),
+ return (wb_dops((const struct dophdr *)(dop + 1),
ntohl(dop->pd_sseq), ntohl(dop->pd_eseq)));
return (0);
}
@@ -381,9 +381,9 @@ wb_drawop(const struct pkt_dop *dop, u_int len)
void
wb_print(register const void *hdr, register u_int len)
{
- register const struct pkt_hdr* ph;
+ register const struct pkt_hdr *ph;
- ph = (const struct pkt_hdr*)hdr;
+ ph = (const struct pkt_hdr *)hdr;
len -= sizeof(*ph);
if (len < 0 || (u_char *)(ph + 1) <= snapend) {
if (ph->ph_flags)
diff --git a/contrib/tcpdump/strcasecmp.c b/contrib/tcpdump/strcasecmp.c
index 5dc3f14..f2ac077 100644
--- a/contrib/tcpdump/strcasecmp.c
+++ b/contrib/tcpdump/strcasecmp.c
@@ -11,7 +11,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
+static const char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
diff --git a/contrib/tcpdump/tcpdump.1 b/contrib/tcpdump/tcpdump.1
index 261666a..68757a4 100644
--- a/contrib/tcpdump/tcpdump.1
+++ b/contrib/tcpdump/tcpdump.1
@@ -1,4 +1,4 @@
-.\" @(#) $Header: tcpdump.1,v 1.61 96/07/14 19:45:00 leres Exp $ (LBL)
+.\" @(#) $Header: tcpdump.1,v 1.65 96/11/29 01:03:01 leres Exp $ (LBL)
.\"
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996
.\" The Regents of the University of California. All rights reserved.
@@ -20,7 +20,7 @@
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
-.TH TCPDUMP 1 "14 July 1996"
+.TH TCPDUMP 1 "29 November 1996"
.SH NAME
tcpdump \- dump traffic on a network
.SH SYNOPSIS
@@ -67,6 +67,7 @@ tcpdump \- dump traffic on a network
.LP
\fITcpdump\fP prints out the headers of packets on a network interface
that match the boolean \fIexpression\fP.
+.LP
.B Under SunOS with nit or bpf:
To run
.I tcpdump
@@ -81,9 +82,10 @@ You must have read access to the network pseudo device, e.g.
You must be root or it must be installed setuid to root.
.B Under IRIX with snoop:
You must be root or it must be installed setuid to root.
-.B Under Ultrix:
-Once the super-user has enabled
-promiscuous-mode operation using
+.B Under Linux:
+You must be root or it must be installed setuid to root.
+.B Under Ultrix and Digital UNIX:
+Once the super-user has enabled promiscuous-mode operation using
.IR pfconfig (8),
any user may run
.BR tcpdump .
@@ -813,6 +815,16 @@ socket buffer since csam's receive window has gotten 19 bytes smaller.
Csam also sends one byte of data to rtsg in this packet.
On the 8th and 9th lines,
csam sends two bytes of urgent, pushed data to rtsg.
+.LP
+If the snapshot was small enough that \fBtcpdump\fP didn't capture
+the full TCP header, it interprets as much of the header as it can
+and then reports ``[|\fItcp\fP]'' to indicate the remainder could not
+be interpreted. If the header contains a bogus option (one with a length
+that's either too small or beyond the end of the header), tcpdump reports
+it as ``[\fIbad opt\fP]'' and does not interpret any further options (since
+it's impossible to tell where they start). If the header length indicates
+options are present but the IP datagram length is not long enough for the
+options to actually be there, tcpdump reports it as ``[\fIbad hdr length\fP]''.
.HD
.B
UDP Packets
@@ -1165,33 +1177,22 @@ serviced the `new packet' interrupt.
.SH "SEE ALSO"
traffic(1C), nit(4P), bpf(4), pcap(3)
.SH AUTHORS
-Van Jacobson (van@ee.lbl.gov),
-Craig Leres (leres@ee.lbl.gov) and
-Steven McCanne (mccanne@ee.lbl.gov), all of the
-Lawrence Berkeley Laboratory, University of California, Berkeley, CA.
+Van Jacobson,
+Craig Leres and
+Steven McCanne, all of the
+Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
+.LP
+The current version is available via anonymous ftp:
+.LP
+.RS
+.I ftp://ftp.ee.lbl.gov/tcpdump.tar.Z
+.RE
.SH BUGS
-Please send bug reports to tcpdump@ee.lbl.gov or libpcap@ee.lbl.gov.
+Please send bug reports to tcpdump@ee.lbl.gov.
.LP
NIT doesn't let you watch your own outbound traffic, BPF will.
We recommend that you use the latter.
.LP
-\fItcpdump\fP for Ultrix requires Ultrix version 4.0 or later; the kernel
-has to have been built with the \fIpacketfilter\fP pseudo-device driver
-(see
-.IR packetfilter (4)).
-In order to watch either your own outbound or inbound traffic,
-you will need to use Ultrix version 4.2 or later, and you will have
-to have used the
-.IR pfconfig (8)
-command to enable ``copyall'' mode.
-.LP
-Under SunOS 4.1, the packet capture code (or Streams NIT) is not what
-you'd call efficient. Don't plan on doing much with your Sun while
-you're monitoring a busy network.
-.LP
-On Sun systems prior to release 3.2, NIT is very buggy.
-If run on an old system, tcpdump may crash the machine.
-.LP
Some attempt should be made to reassemble IP fragments or, at least
to compute the right length for the higher level protocol.
.LP
diff --git a/contrib/tcpdump/tcpdump.c b/contrib/tcpdump/tcpdump.c
index 208e36b..3076a79 100644
--- a/contrib/tcpdump/tcpdump.c
+++ b/contrib/tcpdump/tcpdump.c
@@ -20,11 +20,11 @@
*/
#ifndef lint
-char copyright[] =
+static const char copyright[] =
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996\n\
The Regents of the University of California. All rights reserved.\n";
-static char rcsid[] =
- "@(#)$Header: tcpdump.c,v 1.114 96/07/17 00:12:40 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: tcpdump.c,v 1.118 96/12/10 23:22:27 leres Exp $ (LBL)";
#endif
/*
@@ -142,7 +142,7 @@ main(int argc, char **argv)
program_name = argv[0];
if (abort_on_misalignment(ebuf) < 0)
- error(ebuf);
+ error("%s", ebuf);
opterr = 0;
while ((op = getopt(argc, argv, "c:defF:i:lnNOpqr:s:StT:vw:xY")) != EOF)
@@ -272,7 +272,7 @@ main(int argc, char **argv)
pd = pcap_open_offline(RFileName, ebuf);
if (pd == NULL)
- error(ebuf);
+ error("%s", ebuf);
localnet = 0;
netmask = 0;
if (fflag != 0)
@@ -281,18 +281,18 @@ main(int argc, char **argv)
if (device == NULL) {
device = pcap_lookupdev(ebuf);
if (device == NULL)
- error(ebuf);
+ error("%s", ebuf);
}
pd = pcap_open_live(device, snaplen, !pflag, 1000, ebuf);
if (pd == NULL)
- error(ebuf);
+ error("%s", ebuf);
i = pcap_snapshot(pd);
if (snaplen < i) {
warning("snaplen raised from %d to %d", snaplen, i);
snaplen = i;
}
if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0)
- error(ebuf);
+ error("%s", ebuf);
/*
* Let user own process after socket has been opened.
*/
@@ -304,7 +304,7 @@ main(int argc, char **argv)
cmdbuf = copy_argv(&argv[optind]);
if (pcap_compile(pd, &fcode, cmdbuf, Oflag, netmask) < 0)
- error(pcap_geterr(pd));
+ error("%s", pcap_geterr(pd));
if (dflag) {
bpf_dump(&fcode, dflag);
exit(0);
@@ -316,11 +316,11 @@ main(int argc, char **argv)
(void)signal(SIGHUP, cleanup);
if (pcap_setfilter(pd, &fcode) < 0)
- error(pcap_geterr(pd));
+ error("%s", pcap_geterr(pd));
if (WFileName) {
pcap_dumper_t *p = pcap_dump_open(pd, WFileName);
if (p == NULL)
- error(pcap_geterr(pd));
+ error("%s", pcap_geterr(pd));
printer = pcap_dump;
pcap_userdata = (u_char *)p;
} else {
@@ -413,7 +413,7 @@ default_print(register const u_char *bp, register u_int length)
}
__dead void
-usage()
+usage(void)
{
extern char version[];
diff --git a/contrib/tcpdump/util.c b/contrib/tcpdump/util.c
index 9c74a3a..254a64e 100644
--- a/contrib/tcpdump/util.c
+++ b/contrib/tcpdump/util.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: util.c,v 1.52 96/07/15 18:22:54 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: util.c,v 1.55 96/09/26 23:36:51 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
@@ -296,42 +296,34 @@ 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()
+gmt2local(void)
{
- register int t;
-#if !defined(HAVE_ALTZONE) && !defined(HAVE_TIMEZONE)
- struct timeval tv;
- struct timezone tz;
- register struct tm *tm;
-#endif
-
- t = 0;
-#if !defined(HAVE_ALTZONE) && !defined(HAVE_TIMEZONE)
- if (gettimeofday(&tv, &tz) < 0)
- error("gettimeofday");
- tm = localtime((time_t *)&tv.tv_sec);
-#ifdef HAVE_TM_GMTOFF
- t = tm->tm_gmtoff;
-#else
- t = tz.tz_minuteswest * -60;
- /* XXX Some systems need this, some auto offset tz_minuteswest... */
- if (tm->tm_isdst)
- t += 60 * 60;
-#endif
-#endif
-
-#ifdef HAVE_TIMEZONE
- tzset();
- t = -timezone;
- if (daylight)
- t += 60 * 60;
-#endif
-
-#ifdef HAVE_ALTZONE
- tzset();
- t = -altzone;
-#endif
-
- return (t);
+ 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);
}
diff --git a/contrib/tcpdump/vfprintf.c b/contrib/tcpdump/vfprintf.c
index fa1ed93..8682859 100644
--- a/contrib/tcpdump/vfprintf.c
+++ b/contrib/tcpdump/vfprintf.c
@@ -20,8 +20,8 @@
*/
#ifndef lint
-static char rcsid[] =
- "@(#) $Header: vfprintf.c,v 1.1 95/11/26 13:30:21 leres Exp $ (LBL)";
+static const char rcsid[] =
+ "@(#) $Header: vfprintf.c,v 1.2 96/09/26 23:36:51 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
OpenPOWER on IntegriCloud