mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
This commit was generated by cvs2svn to compensate for changes in r26180,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
5775941a02
38 changed files with 2371 additions and 1403 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
$(CC) $(CFLAGS) -c $(srcdir)/$*.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
|
||||
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) | \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
3.2.1
|
||||
3.3
|
||||
|
|
|
|||
505
contrib/tcpdump/acsite.m4
Normal file
505
contrib/tcpdump/acsite.m4
Normal file
|
|
@ -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])
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
203
contrib/tcpdump/config.guess
vendored
203
contrib/tcpdump/config.guess
vendored
|
|
@ -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.[23]*:*)
|
||||
echo sparc-lynx-lynxos${UNAME_RELEASE}
|
||||
TSUNAMI:LynxOS:2.*:*)
|
||||
echo sparc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
rs6000:LynxOS:2.[23]*:*)
|
||||
echo rs6000-lynx-lynxos${UNAME_RELEASE}
|
||||
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
|
||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
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)
|
||||
|
|
|
|||
150
contrib/tcpdump/config.sub
vendored
150
contrib/tcpdump/config.sub
vendored
|
|
@ -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/"`
|
||||
;;
|
||||
|
|
|
|||
867
contrib/tcpdump/configure
vendored
867
contrib/tcpdump/configure
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) \
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,96 +51,6 @@ extern int packettype; /* as specified by -T */
|
|||
#define PT_RTP 4 /* Real-Time Applications protocol */
|
||||
#define PT_RTCP 5 /* Real-Time Applications control protocol */
|
||||
|
||||
extern char *program_name; /* used to generate self-identifying messages */
|
||||
|
||||
extern int32_t thiszone; /* seconds offset from gmt to local time */
|
||||
|
||||
extern int snaplen;
|
||||
/* global pointers to beginning and end of current packet (during printing) */
|
||||
extern const u_char *packetp;
|
||||
extern const u_char *snapend;
|
||||
|
||||
#define TCHECK2(var, l) if ((u_char *)&(var) > snapend - (l)) goto trunc
|
||||
#define TCHECK(var) TCHECK2(var, sizeof(var))
|
||||
|
||||
#ifdef __STDC__
|
||||
struct timeval;
|
||||
#endif
|
||||
|
||||
extern void ts_print(const struct timeval *);
|
||||
extern int32_t gmt2local(void);
|
||||
|
||||
extern int fn_print(const u_char *, const u_char *);
|
||||
extern int fn_printn(const u_char *, u_int, const u_char *);
|
||||
extern const char *tok2str(const struct tok *, const char *, int);
|
||||
extern char *dnaddr_string(u_short);
|
||||
extern char *savestr(const char *);
|
||||
|
||||
extern void wrapup(int);
|
||||
|
||||
#if __STDC__
|
||||
extern __dead void error(const char *, ...)
|
||||
__attribute__((volatile, format (printf, 1, 2)));
|
||||
extern void warning(const char *, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
#endif
|
||||
|
||||
extern char *read_infile(char *);
|
||||
extern char *copy_argv(char **);
|
||||
|
||||
extern char *isonsap_string(const u_char *);
|
||||
extern char *llcsap_string(u_char);
|
||||
extern char *protoid_string(const u_char *);
|
||||
extern char *dnname_string(u_short);
|
||||
extern char *dnnum_string(u_short);
|
||||
|
||||
/* The printer routines. */
|
||||
|
||||
#ifdef __STDC__
|
||||
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 *,
|
||||
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 atalk_print(const u_char *, u_int);
|
||||
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 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 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 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 ospf_print(const u_char *, u_int, const u_char *);
|
||||
extern void rip_print(const u_char *, u_int);
|
||||
extern void snmp_print(const u_char *, u_int);
|
||||
extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
|
||||
extern void tftp_print(const u_char *, u_int);
|
||||
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
|
||||
|
|
@ -193,3 +103,101 @@ extern void krb_print(const u_char *, u_int);
|
|||
#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 */
|
||||
|
||||
extern int snaplen;
|
||||
/* global pointers to beginning and end of current packet (during printing) */
|
||||
extern const u_char *packetp;
|
||||
extern const u_char *snapend;
|
||||
|
||||
/* 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__
|
||||
struct timeval;
|
||||
#endif
|
||||
|
||||
extern void ts_print(const struct timeval *);
|
||||
extern int32_t gmt2local(void);
|
||||
|
||||
extern int fn_print(const u_char *, const u_char *);
|
||||
extern int fn_printn(const u_char *, u_int, const u_char *);
|
||||
extern const char *tok2str(const struct tok *, const char *, int);
|
||||
extern char *dnaddr_string(u_short);
|
||||
extern char *savestr(const char *);
|
||||
|
||||
extern void wrapup(int);
|
||||
|
||||
#if __STDC__
|
||||
extern __dead void error(const char *, ...)
|
||||
__attribute__((volatile, format (printf, 1, 2)));
|
||||
extern void warning(const char *, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
#endif
|
||||
|
||||
extern char *read_infile(char *);
|
||||
extern char *copy_argv(char **);
|
||||
|
||||
extern char *isonsap_string(const u_char *);
|
||||
extern char *llcsap_string(u_char);
|
||||
extern char *protoid_string(const u_char *);
|
||||
extern char *dnname_string(u_short);
|
||||
extern char *dnnum_string(u_short);
|
||||
|
||||
/* The printer routines. */
|
||||
|
||||
#ifdef __STDC__
|
||||
struct pcap_pkthdr;
|
||||
#endif
|
||||
|
||||
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 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 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 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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
39
contrib/tcpdump/lbl/os-ultrix4.h
Normal file
39
contrib/tcpdump/lbl/os-ultrix4.h
Normal file
|
|
@ -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 *);
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
printf(" Neighbors2");
|
||||
/*
|
||||
* extract version and capabilities from IGMP group
|
||||
* address field
|
||||
*/
|
||||
bp -= 4;
|
||||
target_level = ((u_int32_t) * bp++ << 24);
|
||||
/*
|
||||
* Group address in IGMP
|
||||
*/
|
||||
|
||||
target_level += ((u_int32_t) * bp++ << 16);
|
||||
/*
|
||||
* header is version number
|
||||
*/
|
||||
|
||||
target_level += ((u_int32_t) * bp++ << 8);
|
||||
target_level += ((u_int32_t) * bp++);
|
||||
target_level = htonl(target_level);
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 = "";
|
||||
|
|
|
|||
141
contrib/tcpdump/print-gre.c
Normal file
141
contrib/tcpdump/print-gre.c
Normal file
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
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);
|
||||
}
|
||||
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 = ' ';
|
||||
register char sep = ' ';
|
||||
|
||||
do {
|
||||
if (options & bp->bit) {
|
||||
printf("%c%s",
|
||||
sep,
|
||||
bp->str);
|
||||
sep = '/';
|
||||
}
|
||||
} while ((++bp)->bit) ;
|
||||
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) {
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
ospf_print_lshdr(register const struct lsa_hdr *lshp, const caddr_t end)
|
||||
ospf_print_lshdr(register const struct lsa_hdr *lshp)
|
||||
{
|
||||
if ((caddr_t) (lshp + 1) > end) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf(" {"); /* } (ctags) */
|
||||
TCHECK(lshp->ls_type);
|
||||
printf(" {"); /* } (ctags) */
|
||||
|
||||
if (!lshp->ls_type || lshp->ls_type >= LS_TYPE_MAX) {
|
||||
printf(" ??LS type %d?? }", lshp->ls_type); /* { (ctags) */
|
||||
return 1;
|
||||
}
|
||||
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");
|
||||
|
||||
ospf_print_bits(ospf_option_bits, lshp->ls_options);
|
||||
ospf_print_seqage(ntohl(lshp->ls_seq), ntohs(lshp->ls_age));
|
||||
|
||||
LS_PRINT(lshp, lshp->ls_type);
|
||||
|
||||
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;
|
||||
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, end)) {
|
||||
return 1;
|
||||
}
|
||||
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) {
|
||||
|
||||
ls_end = (caddr_t) lsap + ntohs(lsap->ls_hdr.ls_length);
|
||||
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);
|
||||
|
||||
if (ls_end > end) {
|
||||
printf(" }"); /* { (ctags) */
|
||||
return 1;
|
||||
}
|
||||
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)));
|
||||
|
||||
switch (lsap->ls_hdr.ls_type) {
|
||||
case LS_TYPE_ROUTER:
|
||||
ospf_print_bits(ospf_rla_flag_bits, lsap->lsa_un.un_rla.rla_flags);
|
||||
TCHECK(*rln);
|
||||
printf(" {"); /* } (ctags) */
|
||||
switch (rlp->link_type) {
|
||||
|
||||
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)));
|
||||
case RLA_TYPE_VIRTUAL:
|
||||
printf(" virt");
|
||||
/* Fall through */
|
||||
|
||||
if ((caddr_t) rln > ls_end) {
|
||||
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");
|
||||
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 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 RLA_TYPE_ROUTER:
|
||||
printf(" nbrid %s if %s",
|
||||
ipaddr_string(&rlp->link_id),
|
||||
ipaddr_string(&rlp->link_data));
|
||||
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_TRANSIT:
|
||||
printf(" dr %s if %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;
|
||||
|
||||
case RLA_TYPE_STUB:
|
||||
printf(" net %s mask %s",
|
||||
ipaddr_string(&rlp->link_id),
|
||||
ipaddr_string(&rlp->link_data));
|
||||
break;
|
||||
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)) {
|
||||
|
||||
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;
|
||||
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_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));
|
||||
}
|
||||
break;
|
||||
|
||||
case LS_TYPE_SUM_IP:
|
||||
printf(" mask %s",
|
||||
ipaddr_string(&lsap->lsa_un.un_sla.sla_mask));
|
||||
/* Fall through */
|
||||
|
||||
case LS_TYPE_SUM_ABR:
|
||||
|
||||
for (lp = lsap->lsa_un.un_sla.sla_tosmetric;
|
||||
(caddr_t) (lp + 1) <= ls_end;
|
||||
lp++) {
|
||||
u_int32_t ul = ntohl(*lp);
|
||||
|
||||
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));
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf(" }"); /* { (ctags) */
|
||||
return 0;
|
||||
/* { (ctags) */
|
||||
fputs(" }", stdout);
|
||||
return (0);
|
||||
trunc:
|
||||
fputs(" }", stdout);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ospf_print(register const u_char *bp, register u_int length,
|
||||
register const u_char *bp2)
|
||||
static int
|
||||
ospf_decode_v2(register const struct ospfhdr *op,
|
||||
register const u_char *dataend)
|
||||
{
|
||||
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;
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
default:
|
||||
printf(" ??authtype-%d??",
|
||||
ntohs(op->ospf_authtype));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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;
|
||||
|
||||
case OSPF_TYPE_UMD:
|
||||
/*
|
||||
* Rob Coltun's special monitoring packets;
|
||||
* do nothing
|
||||
*/
|
||||
break;
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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;
|
||||
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));
|
||||
}
|
||||
printf(" nbrs");
|
||||
for (ap = op->ospf_hello.hello_neighbor;
|
||||
(caddr_t) (ap + 1) <= end;
|
||||
ap++) {
|
||||
printf(" %s",
|
||||
ipaddr_string(ap));
|
||||
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 */
|
||||
break; /* HELLO */
|
||||
|
||||
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++;
|
||||
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 = '/';
|
||||
}
|
||||
}
|
||||
break;
|
||||
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;
|
||||
|
||||
case OSPF_TYPE_LSR:
|
||||
if (vflag) {
|
||||
for (lsrp = op->ospf_lsr; (caddr_t) (lsrp+1) <= end; lsrp++) {
|
||||
int32_t type;
|
||||
|
||||
if ((caddr_t) (lsrp + 1) > end) {
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" {"); /* } (ctags) */
|
||||
if (!(type = ntohl(lsrp->ls_type)) || type >= LS_TYPE_MAX) {
|
||||
printf(" ??LinkStateType %d }", type); /* { (ctags) */
|
||||
printf(" }"); /* { (ctags) */
|
||||
break;
|
||||
}
|
||||
|
||||
LS_PRINT(lsrp, type);
|
||||
printf(" }"); /* { (ctags) */
|
||||
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;
|
||||
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));
|
||||
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;
|
||||
break;
|
||||
|
||||
|
||||
case OSPF_TYPE_LSA:
|
||||
if (vflag) {
|
||||
lshp = op->ospf_lsa.lsa_lshdr;
|
||||
if (vflag) {
|
||||
lshp = op->ospf_lsa.lsa_lshdr;
|
||||
|
||||
while (!ospf_print_lshdr(lshp, end)) {
|
||||
printf(" }"); /* { (ctags) */
|
||||
lshp++;
|
||||
while (!ospf_print_lshdr(lshp)) {
|
||||
/* { (ctags) */
|
||||
printf(" }");
|
||||
++lshp;
|
||||
}
|
||||
}
|
||||
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 */
|
||||
default:
|
||||
printf("v2 type %d", op->ospf_type);
|
||||
break;
|
||||
}
|
||||
return (0);
|
||||
trunc:
|
||||
return (1);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/* 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));
|
||||
|
||||
TCHECK(op->ospf_areaid);
|
||||
if (op->ospf_areaid.s_addr != 0)
|
||||
printf(" area %s", ipaddr_string(&op->ospf_areaid));
|
||||
else
|
||||
printf(" backbone");
|
||||
|
||||
if (vflag) {
|
||||
/* Print authentication data (should we really do this?) */
|
||||
TCHECK2(op->ospf_authdata[0], sizeof(op->ospf_authdata));
|
||||
switch (ntohs(op->ospf_authtype)) {
|
||||
|
||||
case OSPF_AUTH_NONE:
|
||||
break;
|
||||
|
||||
case OSPF_AUTH_SIMPLE:
|
||||
printf(" auth \"");
|
||||
(void)fn_printn(op->ospf_authdata,
|
||||
sizeof(op->ospf_authdata), NULL);
|
||||
printf("\"");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" ??authtype-%d??", ntohs(op->ospf_authtype));
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* Do rest according to version. */
|
||||
switch (op->ospf_version) {
|
||||
|
||||
case 2:
|
||||
/* ospf version 2 */
|
||||
if (ospf_decode_v2(op, dataend))
|
||||
goto trunc;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" ospf [version %d]", op->ospf_version);
|
||||
break;
|
||||
} /* end switch on version */
|
||||
|
||||
return;
|
||||
trunc:
|
||||
fputs(tstr, stdout);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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[];
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
register int dt, dir;
|
||||
register struct tm *gmt, *loc;
|
||||
time_t t;
|
||||
struct tm sgmt;
|
||||
|
||||
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
|
||||
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;
|
||||
|
||||
#ifdef HAVE_TIMEZONE
|
||||
tzset();
|
||||
t = -timezone;
|
||||
if (daylight)
|
||||
t += 60 * 60;
|
||||
#endif
|
||||
/*
|
||||
* 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;
|
||||
|
||||
#ifdef HAVE_ALTZONE
|
||||
tzset();
|
||||
t = -altzone;
|
||||
#endif
|
||||
|
||||
return (t);
|
||||
return (dt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue