Merge tcpdump 3.3.

The print_nfs.c changes are pretty extensive; this is partially because
 LBL did a lot of cleanup and partially because I removed lots of
 pointless changes away from the LBL style.

PR:		3371
mostly-Submitted by:	Chris Timmons <skynyrd@opus.cts.cwu.edu>
This commit is contained in:
Bill Fenner 1997-05-27 02:17:42 +00:00
parent 5775941a02
commit 2ebf6c0513
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26183
25 changed files with 495 additions and 949 deletions

View File

@ -8,11 +8,11 @@ To upgrade to a newer version of tcpdump, when it is available:
2. Use the command:
cvs import -m 'Virgin import of LBL tcpdump v<version>' \
src/contrib/tcpdump LBL v<version>
-I linux-include src/contrib/tcpdump LBL v<version>
For example, to do the import of version 3.2.1, I typed:
cvs import -m 'Virgin import of LBL tcpdump v3.2.1' \
src/contrib/tcpdump LBL v3_2_1
-I linux-include src/contrib/tcpdump LBL v3_2_1
3. Follow the instructions printed out in step 2 to resolve any
conflicts between local FreeBSD changes and the newer version.

View File

@ -1,505 +0,0 @@
dnl @(#) $Header: aclocal.m4,v 1.32 96/07/23 22:55:48 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
AC_DEFUN(AC_LBL_C_INIT,
[$1=-O
$2=""
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)
;;
sni*)
AC_MSG_CHECKING(for SINIX ansi compiler ($CC -kansi))
savedcflags="$CFLAGS"
CFLAGS="-kansi"
AC_CACHE_VAL(ac_cv_cc_sinix_kansi,
AC_TRY_COMPILE(
[#include <sys/types.h>],
[int frob(int, char *)],
ac_cv_cc_sinix_kansi=yes,
ac_cv_cc_sinix_kansi=no))
AC_MSG_RESULT($ac_cv_cc_sinix_kansi)
if test $ac_cv_cc_sinix_kansi = no ; then
AC_MSG_ERROR(see the INSTALL for more info)
fi
CFLAGS="$savedcflags"
V_CCOPT="-kansi $V_CCOPT"
;;
*)
AC_MSG_ERROR(see the INSTALL for more info)
;;
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
places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | \
egrep '/libpcap-[[0-9]]*\.[[0-9]]*(\.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
for dir in ../libpcap $places libpcap ; do
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 $ac_cv_prog_gcc = yes -a -f .devel ; then
if test $ac_cv_prog_gcc_g = yes ; then
$1="-g $$1"
fi
$1="$$1 -Wall"
if test $ac_cv_gcc_vers -gt 1 ; then
$1="$$1 -Wmissing-prototypes -Wstrict-prototypes"
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])

View File

@ -22,8 +22,8 @@
* and address to string conversion routines
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: addrtoname.c,v 1.49 96/07/02 00:19:35 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: addrtoname.c,v 1.54 96/12/05 22:10:19 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
@ -164,7 +164,7 @@ getname(const u_char *ap)
addr = *(const u_int32_t *)ap;
#else
/*
* Deal with alignment.
* Extract 32 bits in network order, dealing with alignment.
*/
switch ((long)ap & 3) {
@ -173,26 +173,26 @@ getname(const u_char *ap)
break;
case 2:
#if BYTE_ORDER == LITTLE_ENDIAN
addr = ((u_int32_t)*(u_short *)(ap + 2) << 16) |
(u_int32_t)*(u_short *)ap;
#else
#ifdef WORDS_BIGENDIAN
addr = ((u_int32_t)*(u_short *)ap << 16) |
(u_int32_t)*(u_short *)(ap + 2);
#else
addr = ((u_int32_t)*(u_short *)(ap + 2) << 16) |
(u_int32_t)*(u_short *)ap;
#endif
break;
default:
#if BYTE_ORDER == LITTLE_ENDIAN
addr = ((u_int32_t)ap[3] << 24) |
((u_int32_t)ap[2] << 16) |
((u_int32_t)ap[1] << 8) |
(u_int32_t)ap[0];
#else
#ifdef WORDS_BIGENDIAN
addr = ((u_int32_t)ap[0] << 24) |
((u_int32_t)ap[1] << 16) |
((u_int32_t)ap[2] << 8) |
(u_int32_t)ap[3];
#else
addr = ((u_int32_t)ap[3] << 24) |
((u_int32_t)ap[2] << 16) |
((u_int32_t)ap[1] << 8) |
(u_int32_t)ap[0];
#endif
break;
}
@ -739,7 +739,7 @@ dnaddr_string(u_short dnaddr)
/* Return a zero'ed hnamemem struct and cuts down on calloc() overhead */
struct hnamemem *
newhnamemem()
newhnamemem(void)
{
register struct hnamemem *p;
static struct hnamemem *ptr = NULL;

View File

@ -1,5 +1,5 @@
/*
* $Header: nfsfh.h,v 1.4 95/10/19 20:27:44 leres Exp $
* $Header: nfsfh.h,v 1.5 96/08/20 14:33:23 leres Exp $
*
* nfsfh.h - NFS file handle definitions (for portable use)
*
@ -24,7 +24,7 @@ typedef struct {
* our internal representation of that.
*/
typedef struct {
my_devt fsid_dev;
my_devt Fsid_dev; /* XXX avoid name conflict with AIX */
u_int32_t fsid_code;
} my_fsid;

View File

@ -1,7 +1,3 @@
#ifndef lint
static char *RCSid = "$Header: parsenfsfh.c,v 1.9 95/10/19 20:27:44 leres Exp $";
#endif
/*
* parsenfsfh.c - portable parser for NFS file handles
* uses all sorts of heuristics
@ -11,6 +7,11 @@ static char *RCSid = "$Header: parsenfsfh.c,v 1.9 95/10/19 20:27:44 leres Exp $"
* Western Research Laboratory
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: parsenfsfh.c,v 1.12 96/12/10 23:25:50 leres Exp $ (LBL)";
#endif
#include <sys/types.h>
#include <sys/time.h>
@ -216,8 +217,8 @@ int ourself; /* true if file handle was generated on this host */
switch (fhtype) {
case FHT_AUSPEX:
fsidp->fsid_dev.Minor = fhp[7];
fsidp->fsid_dev.Major = fhp[6];
fsidp->Fsid_dev.Minor = fhp[7];
fsidp->Fsid_dev.Major = fhp[6];
fsidp->fsid_code = 0;
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@ -232,8 +233,8 @@ int ourself; /* true if file handle was generated on this host */
/* XXX could ignore 3 high-order bytes */
temp = make_uint32(fhp[3], fhp[2], fhp[1], fhp[0]);
fsidp->fsid_dev.Minor = temp & 0xFFFFF;
fsidp->fsid_dev.Major = (temp>>20) & 0xFFF;
fsidp->Fsid_dev.Minor = temp & 0xFFFFF;
fsidp->Fsid_dev.Major = (temp>>20) & 0xFFF;
temp = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]);
*inop = temp;
@ -242,8 +243,8 @@ int ourself; /* true if file handle was generated on this host */
break;
case FHT_IRIX4:
fsidp->fsid_dev.Minor = fhp[3];
fsidp->fsid_dev.Major = fhp[2];
fsidp->Fsid_dev.Minor = fhp[3];
fsidp->Fsid_dev.Major = fhp[2];
fsidp->fsid_code = 0;
temp = make_uint32(fhp[8], fhp[9], fhp[10], fhp[11]);
@ -254,8 +255,8 @@ int ourself; /* true if file handle was generated on this host */
break;
case FHT_IRIX5:
fsidp->fsid_dev.Minor = make_uint16(fhp[2], fhp[3]);
fsidp->fsid_dev.Major = make_uint16(fhp[0], fhp[1]);
fsidp->Fsid_dev.Minor = make_uint16(fhp[2], fhp[3]);
fsidp->Fsid_dev.Major = make_uint16(fhp[0], fhp[1]);
fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]);
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@ -271,8 +272,8 @@ int ourself; /* true if file handle was generated on this host */
break;
case FHT_SUNOS4:
fsidp->fsid_dev.Minor = fhp[3];
fsidp->fsid_dev.Major = fhp[2];
fsidp->Fsid_dev.Minor = fhp[3];
fsidp->Fsid_dev.Major = fhp[2];
fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]);
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@ -284,9 +285,9 @@ int ourself; /* true if file handle was generated on this host */
case FHT_SUNOS5:
temp = make_uint16(fhp[0], fhp[1]);
fsidp->fsid_dev.Major = (temp>>2) & 0x3FFF;
fsidp->Fsid_dev.Major = (temp>>2) & 0x3FFF;
temp = make_uint24(fhp[1], fhp[2], fhp[3]);
fsidp->fsid_dev.Minor = temp & 0x3FFFF;
fsidp->Fsid_dev.Minor = temp & 0x3FFFF;
fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]);
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@ -298,8 +299,8 @@ int ourself; /* true if file handle was generated on this host */
case FHT_ULTRIX:
fsidp->fsid_code = 0;
fsidp->fsid_dev.Minor = fhp[0];
fsidp->fsid_dev.Major = fhp[1];
fsidp->Fsid_dev.Minor = fhp[0];
fsidp->Fsid_dev.Major = fhp[1];
temp = make_uint32(fhp[7], fhp[6], fhp[5], fhp[4]);
*inop = temp;
@ -319,8 +320,8 @@ int ourself; /* true if file handle was generated on this host */
memset((char *)tempa, 0, sizeof(tempa));
memcpy((char *)tempa, fh, 14); /* ensure alignment */
fsidp->fsid_dev.Minor = tempa[0] + (tempa[1]<<1);
fsidp->fsid_dev.Major = tempa[2] + (tempa[3]<<1);
fsidp->Fsid_dev.Minor = tempa[0] + (tempa[1]<<1);
fsidp->Fsid_dev.Major = tempa[2] + (tempa[3]<<1);
fsidp->fsid_code = 0;
}
@ -336,8 +337,8 @@ int ourself; /* true if file handle was generated on this host */
break;
case FHT_AIX32:
fsidp->fsid_dev.Minor = make_uint16(fhp[2], fhp[3]);
fsidp->fsid_dev.Major = make_uint16(fhp[0], fhp[1]);
fsidp->Fsid_dev.Minor = make_uint16(fhp[2], fhp[3]);
fsidp->Fsid_dev.Major = make_uint16(fhp[0], fhp[1]);
fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]);
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@ -348,9 +349,9 @@ int ourself; /* true if file handle was generated on this host */
break;
case FHT_HPUX9:
fsidp->fsid_dev.Major = fhp[0];
fsidp->Fsid_dev.Major = fhp[0];
temp = make_uint24(fhp[1], fhp[2], fhp[3]);
fsidp->fsid_dev.Minor = temp;
fsidp->Fsid_dev.Minor = temp;
fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]);
temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]);
@ -372,8 +373,8 @@ int ourself; /* true if file handle was generated on this host */
#endif
/* XXX for now, give "bogus" values to aid debugging */
fsidp->fsid_code = 0;
fsidp->fsid_dev.Minor = 257;
fsidp->fsid_dev.Major = 257;
fsidp->Fsid_dev.Minor = 257;
fsidp->Fsid_dev.Major = 257;
*inop = 1;
/* display will show this string instead of (257,257) */

View File

@ -20,8 +20,8 @@
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: print-arp.c,v 1.39 96/07/17 14:56:17 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-arp.c,v 1.41 96/10/27 14:54:50 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -127,5 +127,5 @@ arp_print(register const u_char *bp, u_int length, u_int caplen)
return;
}
if (hrd != ARPHRD_ETHER)
printf(" hardware #%d", ap->arp_hrd);
printf(" hardware #%d", hrd);
}

View File

@ -20,9 +20,10 @@
*
* Format and print AppleTalk packets.
*/
#ifndef lint
static char rcsid[] =
"@(#)$Header: print-atalk.c,v 1.43 96/07/23 14:16:55 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-atalk.c,v 1.45 96/12/10 23:24:07 leres Exp $ (LBL)";
#endif
#include <sys/param.h>

View File

@ -19,8 +19,8 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: print-atm.c,v 1.7 96/07/23 14:17:21 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-atm.c,v 1.8 96/09/26 23:36:41 leres Exp $ (LBL)";
#endif
#include <sys/param.h>

View File

@ -21,8 +21,8 @@
* Format and print bootp packets.
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: print-bootp.c,v 1.42 96/07/23 14:17:22 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-bootp.c,v 1.43 96/09/26 23:36:42 leres Exp $ (LBL)";
#endif
#include <sys/param.h>

View File

@ -20,8 +20,8 @@
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: print-domain.c,v 1.35 96/07/23 14:17:22 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-domain.c,v 1.37 96/12/10 23:21:06 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -323,7 +323,7 @@ ns_rprint(register const u_char *cp, register const u_char *bp)
printf(" %.*s", len, cp);
break;
}
return (rp); /* XXX This isn't always right*/
return (rp); /* XXX This isn't always right */
}
void

View File

@ -19,8 +19,8 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: print-ether.c,v 1.42 96/07/23 14:17:23 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-ether.c,v 1.43 96/09/26 23:36:43 leres Exp $ (LBL)";
#endif
#include <sys/param.h>

View File

@ -20,8 +20,8 @@
*/
#ifndef lint
static char rcsid[] =
"@(#)$Header: print-fddi.c,v 1.31 96/07/14 19:38:59 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-fddi.c,v 1.33 96/12/10 23:20:49 leres Exp $ (LBL)";
#endif
#ifdef HAVE_FDDI
@ -279,7 +279,7 @@ fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h,
/*
* Get the FDDI addresses into a canonical form
*/
extract_fddi_addrs(fddip, (char*)ESRC(&ehdr), (char*)EDST(&ehdr));
extract_fddi_addrs(fddip, (char *)ESRC(&ehdr), (char *)EDST(&ehdr));
/*
* Some printers want to get back at the link level addresses,
* and/or check that they're not walking off the end of the packet.

View File

@ -20,8 +20,8 @@
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: print-icmp.c,v 1.36 96/07/23 14:17:24 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-icmp.c,v 1.38 96/09/26 23:36:44 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -273,7 +273,7 @@ icmp_print(register const u_char *bp, register const u_char *bp2)
ihp = (struct ih_rdiscovery *)&dp->icmp_void;
TCHECK(*ihp);
(void)strcpy(cp, "lifetime ");
(void)strcpy(cp, " lifetime ");
cp = buf + strlen(buf);
lifetime = EXTRACT_16BITS(&ihp->ird_lifetime);
if (lifetime < 60)

View File

@ -20,8 +20,8 @@
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: print-ip.c,v 1.56 96/07/23 14:17:24 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-ip.c,v 1.62 96/12/10 23:20:31 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -64,17 +64,17 @@ struct tr_query {
u_int tr_src; /* traceroute source */
u_int tr_dst; /* traceroute destination */
u_int tr_raddr; /* traceroute response address */
#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
struct {
u_int qid : 24; /* traceroute query id */
u_int ttl : 8; /* traceroute response ttl */
} q;
#else
#ifdef WORDS_BIGENDIAN
struct {
u_int ttl : 8; /* traceroute response ttl */
u_int qid : 24; /* traceroute query id */
} q;
#endif /* BYTE_ORDER */
#else
struct {
u_int qid : 24; /* traceroute query id */
u_int ttl : 8; /* traceroute response ttl */
} q;
#endif
};
#define tr_rttl q.ttl
@ -121,7 +121,7 @@ struct tr_resp {
static void print_mtrace(register const u_char *bp, register u_int len)
{
register struct tr_query* tr = (struct tr_query*)(bp + 8);
register struct tr_query *tr = (struct tr_query *)(bp + 8);
printf("mtrace %d: %s to %s reply-to %s", tr->tr_qid,
ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
@ -132,7 +132,7 @@ static void print_mtrace(register const u_char *bp, register u_int len)
static void print_mresp(register const u_char *bp, register u_int len)
{
register struct tr_query* tr = (struct tr_query*)(bp + 8);
register struct tr_query *tr = (struct tr_query *)(bp + 8);
printf("mresp %d: %s to %s reply-to %s", tr->tr_qid,
ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
@ -209,12 +209,12 @@ igmp_print(register const u_char *bp, register u_int len,
/* Check the IGMP checksum */
u_int32_t sum = 0;
int count;
const u_short *sp = (u_short*)bp;
const u_short *sp = (u_short *)bp;
for (count = len / 2; --count >= 0; )
sum += *sp++;
if (len & 1)
sum += ntohs(*(unsigned char*) sp << 8);
sum += ntohs(*(u_char *) sp << 8);
while (sum >> 16)
sum = (sum & 0xffff) + (sum >> 16);
sum = 0xffff & ~sum;
@ -461,6 +461,22 @@ ip_print(register const u_char *bp, register u_int length)
}
break;
#ifndef IPPROTO_GRE
#define IPPROTO_GRE 47
#endif
case IPPROTO_GRE:
if (vflag)
(void)printf("gre %s > %s: ",
ipaddr_string(&ip->ip_src),
ipaddr_string(&ip->ip_dst));
/* do it */
gre_print(cp, len);
if (! vflag) {
printf(" (gre encap)");
return;
}
break;
default:
(void)printf("%s > %s:", ipaddr_string(&ip->ip_src),
ipaddr_string(&ip->ip_dst));

View File

@ -17,15 +17,14 @@
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/*
*
* Format and print Novell IPX packets.
* Contributed by Brad Parker (brad@fcr.com).
*/
#ifndef lint
static char rcsid[] =
"@(#)$Header: print-ipx.c,v 1.16 96/07/23 14:17:24 leres Exp $";
static const char rcsid[] =
"@(#) $Header: print-ipx.c,v 1.19 96/12/10 23:23:52 leres Exp $";
#endif
#include <sys/param.h>
@ -145,7 +144,7 @@ ipx_sap_print(const u_short *ipx, u_int length)
if (length > 0) {
TCHECK(ipx[1]);
(void)printf(" %x '", EXTRACT_16BITS(&ipx[0]));
fn_print((char *)&ipx[1], (char *)&ipx[1] + 48);
fn_print((u_char *)&ipx[1], (u_char *)&ipx[1] + 48);
putchar('\'');
}
break;
@ -160,7 +159,7 @@ ipx_sap_print(const u_short *ipx, u_int length)
for (i = 0; i < 8 && length > 0; i++) {
TCHECK2(ipx[27], 1);
(void)printf(" %x '", EXTRACT_16BITS(&ipx[0]));
fn_print((char *)&ipx[1], (char *)&ipx[1] + 48);
fn_print((u_char *)&ipx[1], (u_char *)&ipx[1] + 48);
printf("' addr %s",
ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (u_char *)&ipx[27]));
ipx += 32;

View File

@ -17,15 +17,13 @@
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/*
*
* Original code by Matt Thomas, Digital Equipment Corporation
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: print-isoclns.c,v 1.12 96/07/14 19:39:00 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-isoclns.c,v 1.14 96/12/10 23:26:56 leres Exp $ (LBL)";
#endif
#include <sys/types.h>

View File

@ -17,16 +17,14 @@
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/*
*
* Code by Matt Thomas, Digital Equipment Corporation
* with an awful lot of hacking by Jeffrey Mogul, DECWRL
*/
#ifndef lint
static char rcsid[] =
"@(#)$Header: print-llc.c,v 1.20 96/07/23 14:17:25 leres Exp $";
static const char rcsid[] =
"@(#) $Header: print-llc.c,v 1.22 96/12/10 23:23:37 leres Exp $";
#endif
#include <sys/param.h>

File diff suppressed because it is too large Load Diff

View File

@ -24,8 +24,8 @@
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: print-ntp.c,v 1.23 96/07/23 14:17:26 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-ntp.c,v 1.25 96/11/05 13:30:37 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -71,7 +71,7 @@ ntp_print(register const u_char *cp, u_int length)
TCHECK(bp->status);
version = (bp->status & VERSIONMASK) >> 3;
version = (int)(bp->status & VERSIONMASK) >> 3;
printf(" v%d", version);
leapind = bp->status & LEAPMASK;

View File

@ -20,8 +20,8 @@
*/
#ifndef lint
static char rcsid[] =
"@(#)$Header: print-null.c,v 1.19 96/07/14 19:39:02 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-null.c,v 1.22 96/12/10 23:18:58 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -46,15 +46,19 @@ struct rtentry;
#include <netinet/tcp.h>
#include <netinet/tcpip.h>
#include <pcap.h>
#include <stdio.h>
#include <string.h>
#include "interface.h"
#include "addrtoname.h"
#include "pcap.h"
#include "interface.h"
#define NULL_HDRLEN 4
#ifndef AF_NS
#define AF_NS 6 /* XEROX NS protocols */
#endif
static void
null_print(const u_char *p, const struct ip *ip, u_int length)
{

View File

@ -20,8 +20,8 @@
*/
#ifndef lint
static char rcsid[] =
"@(#)$Header: print-ppp.c,v 1.22 96/07/14 19:39:03 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-ppp.c,v 1.24 96/12/10 23:23:12 leres Exp $ (LBL)";
#endif
#ifdef PPP

View File

@ -20,8 +20,8 @@
*/
#ifndef lint
static char rcsid[] =
"@(#)$Header: print-sl.c,v 1.38 96/07/15 18:23:25 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-sl.c,v 1.41 96/12/10 23:19:42 leres Exp $ (LBL)";
#endif
#ifdef HAVE_NET_SLIP_H
@ -139,7 +139,7 @@ sliplink_print(register const u_char *p, register const struct ip *ip,
case TYPE_UNCOMPRESSED_TCP:
/*
* The connection id is stored in the IP protcol field.
* The connection id is stored in the IP protocol field.
* Get it from the link layer since sl_uncompress_tcp()
* has restored the IP header copy to IPPROTO_TCP.
*/
@ -243,6 +243,7 @@ compressed_sl_print(const u_char *chdr, const struct ip *ip,
#include <sys/types.h>
#include <sys/time.h>
#include <pcap.h>
#include <stdio.h>
#include "interface.h"

View File

@ -20,8 +20,8 @@
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: print-sunrpc.c,v 1.24 96/07/23 14:17:27 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-sunrpc.c,v 1.25 96/09/26 23:36:49 leres Exp $ (LBL)";
#endif
#include <sys/param.h>

View File

@ -20,8 +20,8 @@
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: print-udp.c,v 1.55 96/07/23 14:17:28 leres Exp $ (LBL)";
static const char rcsid[] =
"@(#) $Header: print-udp.c,v 1.58 96/12/10 23:22:07 leres Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -53,7 +53,7 @@ static char rcsid[] =
struct rtcphdr {
u_short rh_flags; /* T:2 P:1 CNT:5 PT:8 */
u_short rh_len; /* length of message (in bytes) */
u_short rh_len; /* length of message (in words) */
u_int rh_ssrc; /* synchronization src id */
};
@ -77,27 +77,28 @@ struct rtcp_sr {
* Time stamps are middle 32-bits of ntp timestamp.
*/
struct rtcp_rr {
u_int rr_srcid; /* sender being reported */
u_int rr_nr; /* no. packets received */
u_int rr_np; /* no. packets predicted */
u_int rr_srcid; /* sender being reported */
u_int rr_nl; /* no. packets lost */
u_int rr_ls; /* extended last seq number received */
u_int rr_dv; /* jitter (delay variance) */
u_int rr_lsr; /* orig. ts from last rr from this src */
u_int rr_dlsr; /* time from recpt of last rr to xmit time */
};
/*XXX*/
#define RTCP_PT_SR 0
#define RTCP_PT_RR 1
#define RTCP_PT_SDES 2
#define RTCP_PT_SR 200
#define RTCP_PT_RR 201
#define RTCP_PT_SDES 202
#define RTCP_SDES_CNAME 1
#define RTCP_SDES_NAME 2
#define RTCP_SDES_EMAIL 3
#define RTCP_SDES_PHONE 4
#define RTCP_SDES_LOC 5
#define RTCP_SDES_TOOL 6
#define RTCP_SDES_TXT 7
#define RTCP_PT_BYE 3
#define RTCP_PT_APP 4
#define RTCP_SDES_NOTE 7
#define RTCP_SDES_PRIV 8
#define RTCP_PT_BYE 203
#define RTCP_PT_APP 204
static void
vat_print(const void *hdr, u_int len, register const struct udphdr *up)
@ -130,24 +131,26 @@ rtp_print(const void *hdr, u_int len, register const struct udphdr *up)
{
/* rtp v1 or v2 */
u_int *ip = (u_int *)hdr;
u_int hasopt, contype, hasmarker;
u_int hasopt, hasext, contype, hasmarker;
u_int i0 = ntohl(((u_int *)hdr)[0]);
u_int i1 = ntohl(((u_int *)hdr)[1]);
u_int dlen = ntohs(up->uh_ulen) - sizeof(*up) - 8;
const char* ptype;
const char * ptype;
ip += 2;
len >>= 2;
len -= 2;
hasopt = 0;
hasext = 0;
if ((i0 >> 30) == 1) {
/* rtp v1 */
hasopt = i0 & 0x800000;
contype = (i0 >> 16) & 0x3f;
hasmarker = i0 & 0x400000;
ptype = "rtpv1";
} else { /*XXX*/
} else {
/* rtp v2 */
hasopt = i0 & 0x20000000;
hasext = i0 & 0x10000000;
contype = (i0 >> 16) & 0x7f;
hasmarker = i0 & 0x800000;
dlen -= 4;
@ -155,14 +158,16 @@ rtp_print(const void *hdr, u_int len, register const struct udphdr *up)
ip += 1;
len -= 1;
}
printf(" udp/%s %d c%d %s%s %d",
printf(" udp/%s %d c%d %s%s %d %u",
ptype,
dlen,
contype,
hasopt? "+" : "",
(hasopt || hasext)? "+" : "",
hasmarker? "*" : "",
i0 & 0xffff);
i0 & 0xffff,
i1);
if (vflag) {
printf(" %u", i1);
if (hasopt) {
u_int i2, optlen;
do {
@ -173,50 +178,79 @@ rtp_print(const void *hdr, u_int len, register const struct udphdr *up)
return;
}
ip += optlen;
len -= optlen;
} while ((int)i2 >= 0);
}
if (contype == 0x1f)
if (hasext) {
u_int i2, extlen;
i2 = ip[0];
extlen = (i2 & 0xffff) + 1;
if (extlen > len) {
printf(" !ext");
return;
}
ip += extlen;
}
if (contype == 0x1f) /*XXX H.261 */
printf(" 0x%04x", ip[0] >> 16);
printf(" %u", i1);
}
}
static const u_char*
rtcp_print(const u_char *hdr)
static const u_char *
rtcp_print(const u_char *hdr, const u_char *ep)
{
/* rtp v2 control (rtcp) */
struct rtcp_rr* rr = 0;
struct rtcp_sr* sr;
struct rtcphdr* rh = (struct rtcphdr*)hdr;
u_int len = (ntohs(rh->rh_len) + 1) * 4;
u_short flags = ntohs(rh->rh_flags);
int cnt = (flags >> 8) & 0x1f;
double ts, dts, jitter;
if (vflag)
printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
struct rtcp_rr *rr = 0;
struct rtcp_sr *sr;
struct rtcphdr *rh = (struct rtcphdr *)hdr;
u_int len;
u_short flags;
int cnt;
double ts, dts;
if ((u_char *)(rh + 1) > ep) {
printf(" [|rtcp]");
return (ep);
}
len = (ntohs(rh->rh_len) + 1) * 4;
flags = ntohs(rh->rh_flags);
cnt = (flags >> 8) & 0x1f;
switch (flags & 0xff) {
case RTCP_PT_SR:
sr = (struct rtcp_sr*)(rh + 1);
sr = (struct rtcp_sr *)(rh + 1);
printf(" sr");
if (len != cnt * sizeof(*rr) + sizeof(*sr) + sizeof(*rh))
printf(" [%d]", len);
ts = (double)((u_int32_t)ntohl(sr->sr_ts)) / 65536.;
printf(" @%.2f %up %ub", ts, (u_int32_t)ntohl(sr->sr_np),
(u_int32_t)ntohl(sr->sr_nb));
rr = (struct rtcp_rr*)(sr + 1);
if (vflag)
printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
if ((u_char *)(sr + 1) > ep) {
printf(" [|rtcp]");
return (ep);
}
ts = (double)((u_int32_t)ntohl(sr->sr_ntp.upper)) +
((double)((u_int32_t)ntohl(sr->sr_ntp.lower)) /
4294967296.0);
printf(" @%.2f %u %up %ub", ts, (u_int32_t)ntohl(sr->sr_ts),
(u_int32_t)ntohl(sr->sr_np), (u_int32_t)ntohl(sr->sr_nb));
rr = (struct rtcp_rr *)(sr + 1);
break;
case RTCP_PT_RR:
printf(" rr");
if (len != cnt * sizeof(*rr) + sizeof(*rh))
printf(" [%d]", len);
rr = (struct rtcp_rr*)(rh + 1);
rr = (struct rtcp_rr *)(rh + 1);
if (vflag)
printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
break;
case RTCP_PT_SDES:
printf(" sdes %d", len);
if (vflag)
printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
cnt = 0;
break;
case RTCP_PT_BYE:
printf(" bye %d", len);
if (vflag)
printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
cnt = 0;
break;
default:
@ -227,19 +261,18 @@ rtcp_print(const u_char *hdr)
if (cnt > 1)
printf(" c%d", cnt);
while (--cnt >= 0) {
if ((u_char*)(rr + 1) > snapend) {
if ((u_char *)(rr + 1) > ep) {
printf(" [|rtcp]");
return (snapend);
return (ep);
}
if (vflag)
printf(" %u", (u_int32_t)ntohl(rr->rr_srcid));
ts = (double)((u_int32_t)ntohl(rr->rr_lsr)) / 65536.;
dts = (double)((u_int32_t)ntohl(rr->rr_dlsr)) / 65536.;
jitter = (double)((u_int32_t)ntohl(rr->rr_dv)) / 65536.;
printf(" %ur %ue %.2fj @%.2f+%.2f",
(u_int32_t)ntohl(rr->rr_nr),
(u_int32_t)ntohl(rr->rr_np),
jitter, ts, dts);
printf(" %ul %us %uj @%.2f+%.2f",
(u_int32_t)ntohl(rr->rr_nl) & 0x00ffffff,
(u_int32_t)ntohl(rr->rr_ls),
(u_int32_t)ntohl(rr->rr_dv), ts, dts);
}
return (hdr + len);
}
@ -260,8 +293,11 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
register const struct udphdr *up;
register const struct ip *ip;
register const u_char *cp;
register const u_char *ep = bp + length;
u_short sport, dport, ulen;
if (ep > snapend)
ep = snapend;
up = (struct udphdr *)bp;
ip = (struct ip *)bp2;
cp = (u_char *)(up + 1);
@ -328,43 +364,44 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
udpport_string(sport),
ipaddr_string(&ip->ip_dst),
udpport_string(dport));
while (cp < snapend)
cp = rtcp_print(cp);
while (cp < ep)
cp = rtcp_print(cp, ep);
break;
}
return;
}
if (! qflag) {
if (!qflag) {
register struct rpc_msg *rp;
enum msg_type direction;
rp = (struct rpc_msg *)(up + 1);
TCHECK(rp->rm_direction);
direction = (enum msg_type)ntohl(rp->rm_direction);
if (dport == NFS_PORT && direction == CALL) {
nfsreq_print((u_char *)rp, length, (u_char *)ip);
return;
}
else if (sport == NFS_PORT && direction == REPLY) {
nfsreply_print((u_char *)rp, length, (u_char *)ip);
return;
}
#ifdef notdef
else if (dport == SUNRPC_PORT && direction == CALL) {
sunrpcrequest_print((u_char *)rp, length, (u_char *)ip);
return;
}
#endif
else {
TCHECK2(cp[0], 1);
if (((struct LAP *)cp)->type == lapDDP &&
(atalk_port(sport) || atalk_port(dport))) {
if (vflag)
fputs("kip ", stdout);
atalk_print(cp, length);
if (TTEST(rp->rm_direction)) {
direction = (enum msg_type)ntohl(rp->rm_direction);
if (dport == NFS_PORT && direction == CALL) {
nfsreq_print((u_char *)rp, length,
(u_char *)ip);
return;
}
if (sport == NFS_PORT && direction == REPLY) {
nfsreply_print((u_char *)rp, length,
(u_char *)ip);
return;
}
#ifdef notdef
if (dport == SUNRPC_PORT && direction == CALL) {
sunrpcrequest_print((u_char *)rp, length, (u_char *)ip);
return;
}
#endif
}
if (TTEST(((struct LAP *)cp)->type) &&
((struct LAP *)cp)->type == lapDDP &&
(atalk_port(sport) || atalk_port(dport))) {
if (vflag)
fputs("kip ", stdout);
atalk_print(cp, length);
return;
}
}
(void)printf("%s.%s > %s.%s:",
@ -401,7 +438,4 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
#undef ISPORT
} else
(void)printf(" udp %u", (u_int32_t)(ulen - sizeof(*up)));
return;
trunc:
fputs("[|udp]", stdout);
}

View File

@ -1,4 +1,4 @@
.\" @(#) $Header: tcpdump.1,v 1.61 96/07/14 19:45:00 leres Exp $ (LBL)
.\" @(#) $Header: tcpdump.1,v 1.65 96/11/29 01:03:01 leres Exp $ (LBL)
.\"
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996
.\" The Regents of the University of California. All rights reserved.
@ -20,7 +20,7 @@
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.TH TCPDUMP 1 "14 July 1996"
.TH TCPDUMP 1 "29 November 1996"
.SH NAME
tcpdump \- dump traffic on a network
.SH SYNOPSIS
@ -67,6 +67,7 @@ tcpdump \- dump traffic on a network
.LP
\fITcpdump\fP prints out the headers of packets on a network interface
that match the boolean \fIexpression\fP.
.LP
.B Under SunOS with nit or bpf:
To run
.I tcpdump
@ -81,9 +82,10 @@ You must have read access to the network pseudo device, e.g.
You must be root or it must be installed setuid to root.
.B Under IRIX with snoop:
You must be root or it must be installed setuid to root.
.B Under Ultrix:
Once the super-user has enabled
promiscuous-mode operation using
.B Under Linux:
You must be root or it must be installed setuid to root.
.B Under Ultrix and Digital UNIX:
Once the super-user has enabled promiscuous-mode operation using
.IR pfconfig (8),
any user may run
.BR tcpdump .
@ -825,6 +827,16 @@ socket buffer since csam's receive window has gotten 19 bytes smaller.
Csam also sends one byte of data to rtsg in this packet.
On the 8th and 9th lines,
csam sends two bytes of urgent, pushed data to rtsg.
.LP
If the snapshot was small enough that \fBtcpdump\fP didn't capture
the full TCP header, it interprets as much of the header as it can
and then reports ``[|\fItcp\fP]'' to indicate the remainder could not
be interpreted. If the header contains a bogus option (one with a length
that's either too small or beyond the end of the header), tcpdump reports
it as ``[\fIbad opt\fP]'' and does not interpret any further options (since
it's impossible to tell where they start). If the header length indicates
options are present but the IP datagram length is not long enough for the
options to actually be there, tcpdump reports it as ``[\fIbad hdr length\fP]''.
.HD
.B
UDP Packets
@ -1177,33 +1189,22 @@ serviced the `new packet' interrupt.
.SH "SEE ALSO"
traffic(1C), nit(4P), bpf(4), pcap(3)
.SH AUTHORS
Van Jacobson (van@ee.lbl.gov),
Craig Leres (leres@ee.lbl.gov) and
Steven McCanne (mccanne@ee.lbl.gov), all of the
Lawrence Berkeley Laboratory, University of California, Berkeley, CA.
Van Jacobson,
Craig Leres and
Steven McCanne, all of the
Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
.LP
The current version is available via anonymous ftp:
.LP
.RS
.I ftp://ftp.ee.lbl.gov/tcpdump.tar.Z
.RE
.SH BUGS
Please send bug reports to tcpdump@ee.lbl.gov or libpcap@ee.lbl.gov.
Please send bug reports to tcpdump@ee.lbl.gov.
.LP
NIT doesn't let you watch your own outbound traffic, BPF will.
We recommend that you use the latter.
.LP
\fItcpdump\fP for Ultrix requires Ultrix version 4.0 or later; the kernel
has to have been built with the \fIpacketfilter\fP pseudo-device driver
(see
.IR packetfilter (4)).
In order to watch either your own outbound or inbound traffic,
you will need to use Ultrix version 4.2 or later, and you will have
to have used the
.IR pfconfig (8)
command to enable ``copyall'' mode.
.LP
Under SunOS 4.1, the packet capture code (or Streams NIT) is not what
you'd call efficient. Don't plan on doing much with your Sun while
you're monitoring a busy network.
.LP
On Sun systems prior to release 3.2, NIT is very buggy.
If run on an old system, tcpdump may crash the machine.
.LP
Some attempt should be made to reassemble IP fragments or, at least
to compute the right length for the higher level protocol.
.LP