diff options
Diffstat (limited to 'contrib/tcpdump')
46 files changed, 427 insertions, 3367 deletions
diff --git a/contrib/tcpdump/FREEBSD-upgrade b/contrib/tcpdump/FREEBSD-upgrade new file mode 100644 index 0000000..02c2e36 --- /dev/null +++ b/contrib/tcpdump/FREEBSD-upgrade @@ -0,0 +1,28 @@ +This directory contains virgin copies of the original distribution files +on a "vendor" branch. Do not, under any circumstances, attempt to upgrade +the files in this directory via patches and a cvs commit. + +To upgrade to a newer version of tcpdump, when it is available: + 1. Unpack the new version into an empty directory. + [Do not make ANY changes to the files.] + + 2. Use the command: + cvs import -m 'Virgin import of LBL tcpdump 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' \ + -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. + +Do not, under any circumstances, deviate from this procedure. + +To make local changes to tcpdump, simply patch and commit to the main +branch (aka HEAD). Never make local changes on the LBL branch. + +All local changes should be submitted to "tcpdump@ee.lbl.gov" for +inclusion in the next vendor release. + +pst@freebsd.org - 19 Aug 1996 diff --git a/contrib/tcpdump/aclocal.m4 b/contrib/tcpdump/aclocal.m4 deleted file mode 100644 index 38076b6..0000000 --- a/contrib/tcpdump/aclocal.m4 +++ /dev/null @@ -1,1256 +0,0 @@ -dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.106.2.6 2005/06/03 22:10:16 guy Exp $ (LBL) -dnl -dnl Copyright (c) 1995, 1996, 1997, 1998 -dnl The Regents of the University of California. All rights reserved. -dnl -dnl Redistribution and use in source and binary forms, with or without -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 LDFLAGS -dnl ac_cv_lbl_gcc_vers -dnl LBL_CFLAGS -dnl -AC_DEFUN(AC_LBL_C_INIT, - [AC_PREREQ(2.12) - AC_BEFORE([$0], [AC_PROG_CC]) - AC_BEFORE([$0], [AC_LBL_FIXINCLUDES]) - AC_BEFORE([$0], [AC_LBL_DEVEL]) - AC_ARG_WITH(gcc, [ --without-gcc don't use gcc]) - $1="-O" - $2="" - if test "${srcdir}" != "." ; then - $2="-I\$(srcdir)" - fi - if test "${CFLAGS+set}" = set; then - LBL_CFLAGS="$CFLAGS" - fi - if test -z "$CC" ; then - case "$host_os" in - - bsdi*) - AC_CHECK_PROG(SHLICC2, shlicc2, yes, no) - if test $SHLICC2 = yes ; then - CC=shlicc2 - export CC - fi - ;; - esac - fi - if test -z "$CC" -a "$with_gcc" = no ; then - CC=cc - export CC - fi - AC_PROG_CC - if test "$GCC" = yes ; then - if test "$SHLICC2" = yes ; then - ac_cv_lbl_gcc_vers=2 - $1="-O2" - else - AC_MSG_CHECKING(gcc version) - AC_CACHE_VAL(ac_cv_lbl_gcc_vers, - ac_cv_lbl_gcc_vers=`$CC -v 2>&1 | \ - sed -e '/^gcc version /!d' \ - -e 's/^gcc version //' \ - -e 's/ .*//' -e 's/^[[[^0-9]]]*//' \ - -e 's/\..*//'`) - AC_MSG_RESULT($ac_cv_lbl_gcc_vers) - if test $ac_cv_lbl_gcc_vers -gt 1 ; then - $1="-O2" - fi - fi - else - AC_MSG_CHECKING(that $CC handles ansi prototypes) - AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes, - AC_TRY_COMPILE( - [#include <sys/types.h>], - [int frob(int, char *)], - ac_cv_lbl_cc_ansi_prototypes=yes, - ac_cv_lbl_cc_ansi_prototypes=no)) - AC_MSG_RESULT($ac_cv_lbl_cc_ansi_prototypes) - if test $ac_cv_lbl_cc_ansi_prototypes = no ; then - case "$host_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_lbl_cc_hpux_cc_aa, - AC_TRY_COMPILE( - [#include <sys/types.h>], - [int frob(int, char *)], - ac_cv_lbl_cc_hpux_cc_aa=yes, - ac_cv_lbl_cc_hpux_cc_aa=no)) - AC_MSG_RESULT($ac_cv_lbl_cc_hpux_cc_aa) - if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then - AC_MSG_ERROR(see the INSTALL doc for more info) - fi - CFLAGS="$savedcflags" - V_CCOPT="-Aa $V_CCOPT" - AC_DEFINE(_HPUX_SOURCE) - ;; - - *) - AC_MSG_ERROR(see the INSTALL doc for more info) - ;; - esac - fi - $2="$$2 -I/usr/local/include" - LDFLAGS="$LDFLAGS -L/usr/local/lib" - - case "$host_os" in - - irix*) - V_CCOPT="$V_CCOPT -xansi -signed -O" - ;; - - osf*) - V_CCOPT="$V_CCOPT -std1 -O" - ;; - - ultrix*) - AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes) - AC_CACHE_VAL(ac_cv_lbl_cc_const_proto, - AC_TRY_COMPILE( - [#include <sys/types.h>], - [struct a { int b; }; - void c(const struct a *)], - ac_cv_lbl_cc_const_proto=yes, - ac_cv_lbl_cc_const_proto=no)) - AC_MSG_RESULT($ac_cv_lbl_cc_const_proto) - if test $ac_cv_lbl_cc_const_proto = no ; then - AC_DEFINE(const,) - fi - ;; - esac - fi -]) - - -# -# Try compiling a sample of the type of code that appears in -# gencode.c with "inline", "__inline__", and "__inline". -# -# Autoconf's AC_C_INLINE, at least in autoconf 2.13, isn't good enough, -# as it just tests whether a function returning "int" can be inlined; -# at least some versions of HP's C compiler can inline that, but can't -# inline a function that returns a struct pointer. -# -AC_DEFUN(AC_LBL_C_INLINE, - [AC_MSG_CHECKING(for inline) - AC_CACHE_VAL(ac_cv_lbl_inline, [ - ac_cv_lbl_inline="" - ac_lbl_cc_inline=no - for ac_lbl_inline in inline __inline__ __inline - do - AC_TRY_COMPILE( - [#define inline $ac_lbl_inline - static inline struct iltest *foo(void); - struct iltest { - int iltest1; - int iltest2; - }; - - static inline struct iltest * - foo() - { - static struct iltest xxx; - - return &xxx; - }],,ac_lbl_cc_inline=yes,) - if test "$ac_lbl_cc_inline" = yes ; then - break; - fi - done - if test "$ac_lbl_cc_inline" = yes ; then - ac_cv_lbl_inline=$ac_lbl_inline - fi]) - if test ! -z "$ac_cv_lbl_inline" ; then - AC_MSG_RESULT($ac_cv_lbl_inline) - else - AC_MSG_RESULT(no) - fi - AC_DEFINE_UNQUOTED(inline, $ac_cv_lbl_inline, [Define as token for inline if inlining supported])]) - -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 LBL_LIBS -dnl -AC_DEFUN(AC_LBL_LIBPCAP, - [AC_REQUIRE([AC_LBL_LIBRARY_NET]) - dnl - dnl save a copy before locating libpcap.a - dnl - LBL_LIBS="$LIBS" - pfopen=/usr/examples/packetfilter/pfopen.c - if test -f $pfopen ; then - AC_CHECK_FUNCS(pfopen) - if test $ac_cv_func_pfopen = "no" ; then - AC_MSG_RESULT(Using $pfopen) - LIBS="$LIBS $pfopen" - fi - fi - AC_MSG_CHECKING(for local pcap library) - libpcap=FAIL - lastdir=FAIL - places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \ - egrep '/libpcap-[[0-9]]*.[[0-9]]*(.[[0-9]]*)?([[ab]][[0-9]]*)?$'` - for dir in $places $srcdir/../libpcap $srcdir/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/libpcap.a ; 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 - dnl - dnl Good old Red Hat Linux puts "pcap.h" in - dnl "/usr/include/pcap"; had the LBL folks done so, - dnl that would have been a good idea, but for - dnl the Red Hat folks to do so just breaks source - dnl compatibility with other systems. - dnl - dnl We work around this by assuming that, as we didn't - dnl find a local libpcap, libpcap is in /usr/lib or - dnl /usr/local/lib and that the corresponding header - dnl file is under one of those directories; if we don't - dnl find it in either of those directories, we check to - dnl see if it's in a "pcap" subdirectory of them and, - dnl if so, add that subdirectory to the "-I" list. - dnl - AC_MSG_CHECKING(for extraneous pcap header directories) - if test \( ! -r /usr/local/include/pcap.h \) -a \ - \( ! -r /usr/include/pcap.h \); then - if test -r /usr/local/include/pcap/pcap.h; then - d="/usr/local/include/pcap" - elif test -r /usr/include/pcap/pcap.h; then - d="/usr/include/pcap" - fi - fi - if test -z "$d" ; then - AC_MSG_RESULT(not found) - else - $2="-I$d $$2" - AC_MSG_RESULT(found -- -I$d added) - fi - else - $1=$libpcap - places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \ - egrep '/libpcap-[[0-9]]*.[[0-9]]*(.[[0-9]]*)?([[ab]][[0-9]]*)?$'` - if test -r $d/pcap.h; then - $2="-I$d $$2" - elif test -r $places/pcap.h; then - $2="-I$places $$2" - else - AC_MSG_ERROR(cannot find pcap.h, see INSTALL) - fi - AC_MSG_RESULT($libpcap) - fi - LIBS="$libpcap $LIBS" - case "$host_os" in - - aix*) - pseexe="/lib/pse.exp" - AC_MSG_CHECKING(for $pseexe) - if test -f $pseexe ; then - AC_MSG_RESULT(yes) - LIBS="$LIBS -I:$pseexe" - fi - # - # We need "-lodm" and "-lcfg", as libpcap requires them on - # AIX, and we just build a static libpcap.a and thus can't - # arrange that when you link with libpcap you automatically - # link with those libraries. - # - LIBS="$LIBS -lodm -lcfg" - ;; - esac - - dnl - dnl Check for "pcap_list_datalinks()", "pcap_set_datalink()", - dnl and "pcap_datalink_name_to_val()", and use substitute versions - dnl if they're not present. - dnl - AC_CHECK_FUNC(pcap_list_datalinks, - AC_DEFINE(HAVE_PCAP_LIST_DATALINKS), - [ - AC_LIBOBJ(datalinks) - ]) - AC_CHECK_FUNC(pcap_set_datalink, - AC_DEFINE(HAVE_PCAP_SET_DATALINK)) - AC_CHECK_FUNC(pcap_datalink_name_to_val, - [ - AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL) - AC_CHECK_FUNC(pcap_datalink_val_to_description, - AC_DEFINE(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION), - [ - AC_LIBOBJ(dlnames) - ]) - ], - [ - AC_LIBOBJ(dlnames) - ]) - - dnl - dnl Check for "pcap_breakloop()"; you can't substitute for it if - dnl it's absent (it has hooks into the live capture routines), - dnl so just define the HAVE_ value if it's there. - dnl - AC_CHECK_FUNCS(pcap_breakloop) - - dnl - dnl Check for "pcap_dump_ftell()" and use a substitute version - dnl if it's not present. - AC_CHECK_FUNC(pcap_dump_ftell, - AC_DEFINE(HAVE_PCAP_DUMP_FTELL), - [ - AC_LIBOBJ(pcap_dump_ftell) - ]) -]) - -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_BEFORE([$0], [AC_LBL_LIBPCAP]) - AC_TYPE_SIGNAL - if test "$ac_cv_type_signal" = void ; then - AC_DEFINE(RETSIGVAL,) - else - AC_DEFINE(RETSIGVAL,(0)) - fi - case "$host_os" in - - irix*) - AC_DEFINE(_BSD_SIGNALS) - ;; - - *) - dnl prefer sigaction() to sigset() - AC_CHECK_FUNCS(sigaction) - if test $ac_cv_func_sigaction = no ; then - AC_CHECK_FUNCS(sigset) - fi - ;; - esac]) - -dnl -dnl If using gcc, make sure we have ANSI ioctl definitions -dnl -dnl usage: -dnl -dnl AC_LBL_FIXINCLUDES -dnl -AC_DEFUN(AC_LBL_FIXINCLUDES, - [if test "$GCC" = yes ; then - AC_MSG_CHECKING(for ANSI ioctl definitions) - AC_CACHE_VAL(ac_cv_lbl_gcc_fixincludes, - AC_TRY_COMPILE( - [/* - * This generates a "duplicate case value" when fixincludes - * 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_lbl_gcc_fixincludes=yes, - ac_cv_lbl_gcc_fixincludes=no)) - AC_MSG_RESULT($ac_cv_lbl_gcc_fixincludes) - if test $ac_cv_lbl_gcc_fixincludes = no ; then - # Don't cache failure - unset ac_cv_lbl_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_ARG_WITH(flex, [ --without-flex don't use flex]) - AC_ARG_WITH(bison, [ --without-bison don't use bison]) - if test "$with_flex" = no ; then - $1=lex - else - AC_CHECK_PROGS($1, flex, lex) - fi - if test "$$1" = flex ; then - # The -V flag was added in 2.4 - AC_MSG_CHECKING(for flex 2.4 or higher) - AC_CACHE_VAL(ac_cv_lbl_flex_v24, - if flex -V >/dev/null 2>&1; then - ac_cv_lbl_flex_v24=yes - else - ac_cv_lbl_flex_v24=no - fi) - AC_MSG_RESULT($ac_cv_lbl_flex_v24) - if test $ac_cv_lbl_flex_v24 = no ; then - s="2.4 or higher required" - AC_MSG_WARN(ignoring obsolete flex executable ($s)) - $1=lex - fi - fi - if test "$with_bison" = no ; then - $2=yacc - else - AC_CHECK_PROGS($2, bison, yacc) - fi - if test "$$2" = bison ; then - $2="$$2 -y" - fi - 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_lbl_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_lbl_union_wait=no, - ac_cv_lbl_union_wait=yes)) - AC_MSG_RESULT($ac_cv_lbl_union_wait) - if test $ac_cv_lbl_union_wait = yes ; then - AC_DEFINE(DECLWAITSTATUS,union wait) - else - AC_DEFINE(DECLWAITSTATUS,int) - 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_lbl_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_lbl_sockaddr_has_sa_len=yes, - ac_cv_lbl_sockaddr_has_sa_len=no)) - AC_MSG_RESULT($ac_cv_lbl_sockaddr_has_sa_len) - if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then - AC_DEFINE(HAVE_SOCKADDR_SA_LEN) - fi]) - -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_lbl_have_run_path (yes or no) -dnl -AC_DEFUN(AC_LBL_HAVE_RUN_PATH, - [AC_MSG_CHECKING(for ${CC-cc} -R) - AC_CACHE_VAL(ac_cv_lbl_have_run_path, - [echo 'main(){}' > conftest.c - ${CC-cc} -o conftest conftest.c -R/a1/b2/c3 >conftest.out 2>&1 - if test ! -s conftest.out ; then - ac_cv_lbl_have_run_path=yes - else - ac_cv_lbl_have_run_path=no - fi - rm -f conftest*]) - AC_MSG_RESULT($ac_cv_lbl_have_run_path) - ]) - -dnl -dnl Check whether a given format can be used to print 64-bit integers -dnl -AC_DEFUN(AC_LBL_CHECK_64BIT_FORMAT, - [ - AC_MSG_CHECKING([whether %$1x can be used to format 64-bit integers]) - AC_RUN_IFELSE( - [ - AC_LANG_SOURCE( - [[ -# ifdef HAVE_INTTYPES_H - #include <inttypes.h> -# endif -# ifdef HAVE_SYS_BITYPES_H - #include <sys/bitypes.h> -# endif - #include <stdio.h> - #include <sys/types.h> - - main() - { - u_int64_t t = 1; - char strbuf[16+1]; - sprintf(strbuf, "%016$1x", t << 32); - if (strcmp(strbuf, "0000000100000000") == 0) - exit(0); - else - exit(1); - } - ]]) - ], - [ - AC_DEFINE(PRId64, "$1d") - AC_DEFINE(PRIo64, "$1o") - AC_DEFINE(PRIx64, "$1x") - AC_DEFINE(PRIu64, "$1u") - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - $2 - ]) - ]) - -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_lbl_unaligned_fail, - [case "$host_cpu" in - - # - # These are CPU types where: - # - # the CPU faults on an unaligned access, but at least some - # OSes that support that CPU catch the fault and simulate - # the unaligned access (e.g., Alpha/{Digital,Tru64} UNIX) - - # the simulation is slow, so we don't want to use it; - # - # the CPU, I infer (from the old - # - # XXX: should also check that they don't do weird things (like on arm) - # - # comment) doesn't fault on unaligned accesses, but doesn't - # do a normal unaligned fetch, either (e.g., presumably, ARM); - # - # for whatever reason, the test program doesn't work - # (this has been claimed to be the case for several of those - # CPUs - I don't know what the problem is; the problem - # was reported as "the test program dumps core" for SuperH, - # but that's what the test program is *supposed* to do - - # it dumps core before it writes anything, so the test - # for an empty output file should find an empty output - # file and conclude that unaligned accesses don't work). - # - # This run-time test won't work if you're cross-compiling, so - # in order to support cross-compiling for a particular CPU, - # we have to wire in the list of CPU types anyway, as far as - # I know, so perhaps we should just have a set of CPUs on - # which we know it doesn't work, a set of CPUs on which we - # know it does work, and have the script just fail on other - # cpu types and update it when such a failure occurs. - # - alpha*|arm*|hp*|mips*|sh*|sparc*|ia64|nv1) - ac_cv_lbl_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_lbl_unaligned_fail=yes - else - ./conftest >conftest.out - if test ! -s conftest.out ; then - ac_cv_lbl_unaligned_fail=yes - else - ac_cv_lbl_unaligned_fail=no - fi - fi - rm -f conftest* core core.conftest - ;; - esac]) - AC_MSG_RESULT($ac_cv_lbl_unaligned_fail) - if test $ac_cv_lbl_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 or later, do extra prototype checking and some other -dnl checks -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 -f .devel ; then - if test "$GCC" = yes ; then - if test "${LBL_CFLAGS+set}" != set; then - if test "$ac_cv_prog_cc_g" = yes ; then - $1="-g $$1" - fi - $1="$$1 -Wall" - if test $ac_cv_lbl_gcc_vers -gt 1 ; then - $1="$$1 -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -W" - fi - fi - else - case "$host_os" in - - irix6*) - V_CCOPT="$V_CCOPT -n32" - ;; - - *) - ;; - esac - fi - os=`echo $host_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]) - -dnl -dnl Improved version of AC_CHECK_LIB -dnl -dnl Thanks to John Hawkinson (jhawk@mit.edu) -dnl -dnl usage: -dnl -dnl AC_LBL_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, -dnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) -dnl -dnl results: -dnl -dnl LIBS -dnl -dnl XXX - "AC_LBL_LIBRARY_NET" was redone to use "AC_SEARCH_LIBS" -dnl rather than "AC_LBL_CHECK_LIB", so this isn't used any more. -dnl We keep it around for reference purposes in case it's ever -dnl useful in the future. -dnl - -define(AC_LBL_CHECK_LIB, -[AC_MSG_CHECKING([for $2 in -l$1]) -dnl Use a cache variable name containing the library, function -dnl name, and extra libraries to link with, because the test really is -dnl for library $1 defining function $2, when linked with potinal -dnl library $5, not just for library $1. Separate tests with the same -dnl $1 and different $2's or $5's may have different results. -ac_lib_var=`echo $1['_']$2['_']$5 | sed 'y%./+- %__p__%'` -AC_CACHE_VAL(ac_cv_lbl_lib_$ac_lib_var, -[ac_save_LIBS="$LIBS" -LIBS="-l$1 $5 $LIBS" -AC_TRY_LINK(dnl -ifelse([$2], [main], , dnl Avoid conflicting decl of main. -[/* Override any gcc2 internal prototype to avoid an error. */ -]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus -extern "C" -#endif -])dnl -[/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $2(); -]), - [$2()], - eval "ac_cv_lbl_lib_$ac_lib_var=yes", - eval "ac_cv_lbl_lib_$ac_lib_var=no") -LIBS="$ac_save_LIBS" -])dnl -if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then - AC_MSG_RESULT(yes) - ifelse([$3], , -[changequote(, )dnl - ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` -changequote([, ])dnl - AC_DEFINE_UNQUOTED($ac_tr_lib) - LIBS="-l$1 $LIBS" -], [$3]) -else - AC_MSG_RESULT(no) -ifelse([$4], , , [$4 -])dnl -fi -]) - -dnl -dnl AC_LBL_LIBRARY_NET -dnl -dnl This test is for network applications that need socket() and -dnl gethostbyname() -ish functions. Under Solaris, those applications -dnl need to link with "-lsocket -lnsl". Under IRIX, they need to link -dnl with "-lnsl" but should *not* link with "-lsocket" because -dnl libsocket.a breaks a number of things (for instance: -dnl gethostbyname() under IRIX 5.2, and snoop sockets under most -dnl versions of IRIX). -dnl -dnl Unfortunately, many application developers are not aware of this, -dnl and mistakenly write tests that cause -lsocket to be used under -dnl IRIX. It is also easy to write tests that cause -lnsl to be used -dnl under operating systems where neither are necessary (or useful), -dnl such as SunOS 4.1.4, which uses -lnsl for TLI. -dnl -dnl This test exists so that every application developer does not test -dnl this in a different, and subtly broken fashion. - -dnl It has been argued that this test should be broken up into two -dnl seperate tests, one for the resolver libraries, and one for the -dnl libraries necessary for using Sockets API. Unfortunately, the two -dnl are carefully intertwined and allowing the autoconf user to use -dnl them independantly potentially results in unfortunate ordering -dnl dependancies -- as such, such component macros would have to -dnl carefully use indirection and be aware if the other components were -dnl executed. Since other autoconf macros do not go to this trouble, -dnl and almost no applications use sockets without the resolver, this -dnl complexity has not been implemented. -dnl -dnl The check for libresolv is in case you are attempting to link -dnl statically and happen to have a libresolv.a lying around (and no -dnl libnsl.a). -dnl -AC_DEFUN(AC_LBL_LIBRARY_NET, [ - # Most operating systems have gethostbyname() in the default searched - # libraries (i.e. libc): - # Some OSes (eg. Solaris) place it in libnsl - # Some strange OSes (SINIX) have it in libsocket: - AC_SEARCH_LIBS(gethostbyname, nsl socket resolv) - # Unfortunately libsocket sometimes depends on libnsl and - # AC_SEARCH_LIBS isn't up to the task of handling dependencies like this. - if test "$ac_cv_search_gethostbyname" = "no" - then - AC_CHECK_LIB(socket, gethostbyname, - LIBS="-lsocket -lnsl $LIBS", , -lnsl) - fi - AC_SEARCH_LIBS(socket, socket, , - AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)) - # DLPI needs putmsg under HPUX so test for -lstr while we're at it - AC_SEARCH_LIBS(putmsg, str) - ]) - -dnl Copyright (c) 1999 WIDE Project. All rights reserved. -dnl -dnl Redistribution and use in source and binary forms, with or without -dnl modification, are permitted provided that the following conditions -dnl are met: -dnl 1. Redistributions of source code must retain the above copyright -dnl notice, this list of conditions and the following disclaimer. -dnl 2. Redistributions in binary form must reproduce the above copyright -dnl notice, this list of conditions and the following disclaimer in the -dnl documentation and/or other materials provided with the distribution. -dnl 3. Neither the name of the project nor the names of its contributors -dnl may be used to endorse or promote products derived from this software -dnl without specific prior written permission. -dnl -dnl THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND -dnl ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -dnl ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE -dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -dnl OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -dnl LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -dnl SUCH DAMAGE. - -dnl -dnl Checks to see if AF_INET6 is defined -AC_DEFUN(AC_CHECK_AF_INET6, [ - AC_MSG_CHECKING(for AF_INET6) - AC_CACHE_VAL($1, - AC_TRY_COMPILE([ -# include <sys/types.h> -# include <sys/socket.h>], - [int a = AF_INET6], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 = yes ; then - AC_DEFINE(HAVE_AF_INET6) - fi -]) - -dnl -dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member -dnl borrowed from LBL libpcap -AC_DEFUN(AC_CHECK_SA_LEN, [ - AC_MSG_CHECKING(if sockaddr struct has sa_len member) - AC_CACHE_VAL($1, - AC_TRY_COMPILE([ -# include <sys/types.h> -# include <sys/socket.h>], - [u_int i = sizeof(((struct sockaddr *)0)->sa_len)], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 = yes ; then - AC_DEFINE(HAVE_SOCKADDR_SA_LEN) - fi -]) - -dnl -dnl Checks for portable prototype declaration macro -AC_DEFUN(AC_CHECK_PORTABLE_PROTO, [ - AC_MSG_CHECKING(for __P) - AC_CACHE_VAL($1, - AC_TRY_COMPILE([ -# include <unistd.h>], - [int f __P(())], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 = yes; then - AC_DEFINE(HAVE_PORTABLE_PROTOTYPE) - fi -]) - -dnl checks for u_intXX_t -AC_DEFUN(AC_CHECK_BITTYPES, [ - $1=yes -dnl check for u_int8_t - AC_MSG_CHECKING(for u_int8_t) - AC_CACHE_VAL(ac_cv_u_int8_t, - AC_TRY_COMPILE([ -# include <sys/types.h>], - [u_int8_t i], - ac_cv_u_int8_t=yes, - ac_cv_u_int8_t=no)) - AC_MSG_RESULT($ac_cv_u_int8_t) - if test $ac_cv_u_int8_t = yes; then - AC_DEFINE(HAVE_U_INT8_T) - else - $1=no - fi -dnl check for u_int16_t - AC_MSG_CHECKING(for u_int16_t) - AC_CACHE_VAL(ac_cv_u_int16_t, - AC_TRY_COMPILE([ -# include <sys/types.h>], - [u_int16_t i], - ac_cv_u_int16_t=yes, - ac_cv_u_int16_t=no)) - AC_MSG_RESULT($ac_cv_u_int16_t) - if test $ac_cv_u_int16_t = yes; then - AC_DEFINE(HAVE_U_INT16_T) - else - $1=no - fi -dnl check for u_int32_t - AC_MSG_CHECKING(for u_int32_t) - AC_CACHE_VAL(ac_cv_u_int32_t, - AC_TRY_COMPILE([ -# include <sys/types.h>], - [u_int32_t i], - ac_cv_u_int32_t=yes, - ac_cv_u_int32_t=no)) - AC_MSG_RESULT($ac_cv_u_int32_t) - if test $ac_cv_u_int32_t = yes; then - AC_DEFINE(HAVE_U_INT32_T) - else - $1=no - fi -dnl check for u_int64_t - AC_MSG_CHECKING(for u_int64_t) - AC_CACHE_VAL(ac_cv_u_int64_t, - AC_TRY_COMPILE([ -# include <sys/types.h>], - [u_int64_t i], - ac_cv_u_int64_t=yes, - ac_cv_u_int64_t=no)) - AC_MSG_RESULT($ac_cv_u_int64_t) - if test $ac_cv_u_int64_t = yes; then - AC_DEFINE(HAVE_U_INT64_T) - else - $1=no - fi -]) - -dnl -dnl Checks for addrinfo structure -AC_DEFUN(AC_STRUCT_ADDRINFO, [ - AC_MSG_CHECKING(for addrinfo) - AC_CACHE_VAL($1, - AC_TRY_COMPILE([ -# include <netdb.h>], - [struct addrinfo a], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 = yes; then - AC_DEFINE(HAVE_ADDRINFO) - else - AC_DEFINE(NEED_ADDRINFO_H) - fi -]) - -dnl -dnl Checks for NI_MAXSERV -AC_DEFUN(AC_NI_MAXSERV, [ - AC_MSG_CHECKING(for NI_MAXSERV) - AC_CACHE_VAL($1, - AC_EGREP_CPP(yes, [#include <netdb.h> -#ifdef NI_MAXSERV -yes -#endif], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 != yes; then - AC_DEFINE(NEED_ADDRINFO_H) - fi -]) - -dnl -dnl Checks for NI_NAMEREQD -AC_DEFUN(AC_NI_NAMEREQD, [ - AC_MSG_CHECKING(for NI_NAMEREQD) - AC_CACHE_VAL($1, - AC_EGREP_CPP(yes, [#include <netdb.h> -#ifdef NI_NOFQDN -yes -#endif], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 != yes; then - AC_DEFINE(NEED_ADDRINFO_H) - fi -]) - -dnl -dnl Checks for sockaddr_storage structure -AC_DEFUN(AC_STRUCT_SA_STORAGE, [ - AC_MSG_CHECKING(for sockaddr_storage) - AC_CACHE_VAL($1, - AC_TRY_COMPILE([ -# include <sys/types.h> -# include <sys/socket.h>], - [struct sockaddr_storage s], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 = yes; then - AC_DEFINE(HAVE_SOCKADDR_STORAGE) - fi -]) - -dnl -dnl Checks for macro of IP address size -AC_DEFUN(AC_CHECK_ADDRSZ, [ - $1=yes -dnl check for INADDRSZ - AC_MSG_CHECKING(for INADDRSZ) - AC_CACHE_VAL(ac_cv_inaddrsz, - AC_TRY_COMPILE([ -# include <arpa/nameser.h>], - [int a = INADDRSZ], - ac_cv_inaddrsz=yes, - ac_cv_inaddrsz=no)) - AC_MSG_RESULT($ac_cv_inaddrsz) - if test $ac_cv_inaddrsz = yes; then - AC_DEFINE(HAVE_INADDRSZ) - else - $1=no - fi -dnl check for IN6ADDRSZ - AC_MSG_CHECKING(for IN6ADDRSZ) - AC_CACHE_VAL(ac_cv_in6addrsz, - AC_TRY_COMPILE([ -# include <arpa/nameser.h>], - [int a = IN6ADDRSZ], - ac_cv_in6addrsz=yes, - ac_cv_in6addrsz=no)) - AC_MSG_RESULT($ac_cv_in6addrsz) - if test $ac_cv_in6addrsz = yes; then - AC_DEFINE(HAVE_IN6ADDRSZ) - else - $1=no - fi -]) - -dnl -dnl check for RES_USE_INET6 -AC_DEFUN(AC_CHECK_RES_USE_INET6, [ - AC_MSG_CHECKING(for RES_USE_INET6) - AC_CACHE_VAL($1, - AC_TRY_COMPILE([ -# include <sys/types.h> -# include <netinet/in.h> -# include <resolv.h>], - [int a = RES_USE_INET6], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 = yes; then - AC_DEFINE(HAVE_RES_USE_INET6) - fi -]) - -dnl -dnl check for AAAA -AC_DEFUN(AC_CHECK_AAAA, [ - AC_MSG_CHECKING(for AAAA) - AC_CACHE_VAL($1, - AC_TRY_COMPILE([ -# include <sys/types.h> -# include <arpa/nameser.h>], - [int a = T_AAAA], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 = yes; then - AC_DEFINE(HAVE_AAAA) - fi -]) - -dnl -dnl check for struct res_state_ext -AC_DEFUN(AC_STRUCT_RES_STATE_EXT, [ - AC_MSG_CHECKING(for res_state_ext) - AC_CACHE_VAL($1, - AC_TRY_COMPILE([ -# include <sys/types.h> -# include <netinet/in.h> -# include <netinet6/in6.h> -# include <resolv.h>], - [struct __res_state_ext e], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 = yes; then - AC_DEFINE(HAVE_RES_STATE_EXT) - fi -]) - -dnl -dnl check for struct res_state_ext -AC_DEFUN(AC_STRUCT_RES_STATE, [ - AC_MSG_CHECKING(for nsort in res_state) - AC_CACHE_VAL($1, - AC_TRY_COMPILE([ -# include <sys/types.h> -# include <netinet/in.h> -# include <netinet6/in6.h> -# include <resolv.h>], - [struct __res_state e; e.nsort = 0], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 = yes; then - AC_DEFINE(HAVE_NEW_RES_STATE) - fi -]) - -dnl -dnl check for h_errno -AC_DEFUN(AC_VAR_H_ERRNO, [ - AC_MSG_CHECKING(for h_errno) - AC_CACHE_VAL(ac_cv_var_h_errno, - AC_TRY_COMPILE([ -# include <sys/types.h> -# include <netdb.h>], - [int foo = h_errno;], - ac_cv_var_h_errno=yes, - ac_cv_var_h_errno=no)) - AC_MSG_RESULT($ac_cv_var_h_errno) - if test "$ac_cv_var_h_errno" = "yes"; then - AC_DEFINE(HAVE_H_ERRNO) - fi -]) - -dnl -dnl Test for __attribute__ -dnl - -AC_DEFUN(AC_C___ATTRIBUTE__, [ -AC_MSG_CHECKING(for __attribute__) -AC_CACHE_VAL(ac_cv___attribute__, [ -AC_COMPILE_IFELSE( - AC_LANG_SOURCE([[ -#include <stdlib.h> - -static void foo(void) __attribute__ ((noreturn)); - -static void -foo(void) -{ - exit(1); -} - -int -main(int argc, char **argv) -{ - foo(); -} - ]]), -ac_cv___attribute__=yes, -ac_cv___attribute__=no)]) -if test "$ac_cv___attribute__" = "yes"; then - AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__]) - V_DEFS="$V_DEFS -D_U_=\"__attribute__((unused))\"" -else - V_DEFS="$V_DEFS -D_U_=\"\"" -fi -AC_MSG_RESULT($ac_cv___attribute__) -]) diff --git a/contrib/tcpdump/acsite.m4 b/contrib/tcpdump/acsite.m4 deleted file mode 100644 index 746faf1..0000000 --- a/contrib/tcpdump/acsite.m4 +++ /dev/null @@ -1,505 +0,0 @@ -dnl @(#) $Header: acsite.m4,v 1.41 96/11/29 15:30:40 leres Exp $ (LBL) -dnl -dnl Copyright (c) 1995, 1996 -dnl The Regents of the University of California. All rights reserved. -dnl -dnl Redistribution and use in source and binary forms, with or without -dnl modification, are permitted provided that: (1) source code distributions -dnl retain the above copyright notice and this paragraph in its entirety, (2) -dnl distributions including binary code include the above copyright notice and -dnl this paragraph in its entirety in the documentation or other materials -dnl provided with the distribution, and (3) all advertising materials mentioning -dnl features or use of this software display the following acknowledgement: -dnl ``This product includes software developed by the University of California, -dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of -dnl the University nor the names of its contributors may be used to endorse -dnl or promote products derived from this software without specific prior -dnl written permission. -dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED -dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -dnl -dnl LBL autoconf macros -dnl - -dnl -dnl Determine which compiler we're using (cc or gcc) -dnl If using gcc, determine the version number -dnl If using cc, require that it support ansi prototypes -dnl If using gcc, use -O2 (otherwise use -O) -dnl If using cc, explicitly specify /usr/local/include -dnl -dnl usage: -dnl -dnl AC_LBL_C_INIT(copt, incls) -dnl -dnl results: -dnl -dnl $1 (copt set) -dnl $2 (incls set) -dnl CC -dnl ac_cv_gcc_vers -dnl LBL_CFLAGS -dnl -dnl XXX need to add test to make sure ac_prog_cc hasn't been called -AC_DEFUN(AC_LBL_C_INIT, - [AC_PREREQ(2.12) - $1=-O - $2="" - if test "${CFLAGS+set}" = set; then - LBL_CFLAGS="$CFLAGS" - fi - if test -z "$CC" ; then - case "$target_os" in - - bsdi*) - AC_CHECK_PROG(SHLICC2, shlicc2, yes, no) - if test $SHLICC2 = yes ; then - CC=shlicc2 - export CC - fi - ;; - esac - fi - AC_PROG_CC - if test $ac_cv_prog_gcc = yes ; then - if test "$SHLICC2" = yes ; then - ac_cv_gcc_vers=2 - $1=-O2 - else - AC_MSG_CHECKING(gcc version) - AC_CACHE_VAL(ac_cv_gcc_vers, - ac_cv_gcc_vers=`$CC -v 2>&1 | \ - sed -n -e '$s/.* //' -e '$s/\..*//p'`) - AC_MSG_RESULT($ac_cv_gcc_vers) - if test $ac_cv_gcc_vers -gt 1 ; then - $1=-O2 - fi - fi - else - AC_MSG_CHECKING(that $CC handles ansi prototypes) - AC_CACHE_VAL(ac_cv_cc_ansi_prototypes, - AC_TRY_COMPILE( - [#include <sys/types.h>], - [int frob(int, char *)], - ac_cv_cc_ansi_prototypes=yes, - ac_cv_cc_ansi_prototypes=no)) - AC_MSG_RESULT($ac_cv_cc_ansi_prototypes) - if test $ac_cv_cc_ansi_prototypes = no ; then - case "$target_os" in - - hpux*) - AC_MSG_CHECKING(for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)) - savedcflags="$CFLAGS" - CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS" - AC_CACHE_VAL(ac_cv_cc_hpux_cc_aa, - AC_TRY_COMPILE( - [#include <sys/types.h>], - [int frob(int, char *)], - ac_cv_cc_hpux_cc_aa=yes, - ac_cv_cc_hpux_cc_aa=no)) - AC_MSG_RESULT($ac_cv_cc_hpux_cc_aa) - if test $ac_cv_cc_hpux_cc_aa = no ; then - AC_MSG_ERROR(see the INSTALL for more info) - fi - CFLAGS="$savedcflags" - V_CCOPT="-Aa $V_CCOPT" - AC_DEFINE(_HPUX_SOURCE) - ;; - - *) - AC_MSG_ERROR(see the INSTALL for more info) - ;; - esac - fi - $2=-I/usr/local/include - - case "$target_os" in - - irix*) - V_CCOPT="$V_CCOPT -xansi -signed -g3" - ;; - - osf*) - V_CCOPT="$V_CCOPT -g3" - ;; - - ultrix*) - AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes) - AC_CACHE_VAL(ac_cv_cc_const_proto, - AC_TRY_COMPILE( - [#include <sys/types.h>], - [struct a { int b; }; - void c(const struct a *)], - ac_cv_cc_const_proto=yes, - ac_cv_cc_const_proto=no)) - AC_MSG_RESULT($ac_cv_cc_const_proto) - if test $ac_cv_cc_const_proto = no ; then - AC_DEFINE(const,) - fi - ;; - esac - fi -]) - -dnl -dnl Use pfopen.c if available and pfopen() not in standard libraries -dnl Require libpcap -dnl Look for libpcap in .. -dnl Use the installed libpcap if there is no local version -dnl -dnl usage: -dnl -dnl AC_LBL_LIBPCAP(pcapdep, incls) -dnl -dnl results: -dnl -dnl $1 (pcapdep set) -dnl $2 (incls appended) -dnl LIBS -dnl -AC_DEFUN(AC_LBL_LIBPCAP, - [pfopen=/usr/examples/packetfilter/pfopen.c - if test -f $pfopen ; then - AC_CHECK_FUNCS(pfopen) - if test $ac_cv_func_pfopen = "no" ; then - AC_MSG_RESULT(Using $pfopen) - LIBS="$LIBS $pfopen" - fi - fi - AC_MSG_CHECKING(for local pcap library) - libpcap=FAIL - lastdir=FAIL - places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | \ - egrep '/libpcap-[[0-9]]*\.[[0-9]]*(\.[[0-9]]*)?([[ab]][[0-9]]*)?$'` - for dir in $places ../libpcap libpcap ; do - basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'` - if test $lastdir = $basedir ; then - dnl skip alphas when an actual release is present - continue; - fi - lastdir=$dir - if test -r $dir/pcap.c ; then - libpcap=$dir/libpcap.a - d=$dir - dnl continue and select the last one that exists - fi - done - if test $libpcap = FAIL ; then - AC_MSG_RESULT(not found) - AC_CHECK_LIB(pcap, main, libpcap="-lpcap") - if test $libpcap = FAIL ; then - AC_MSG_ERROR(see the INSTALL doc for more info) - fi - else - $1=$libpcap - $2="-I$d $$2" - AC_MSG_RESULT($libpcap) - fi - LIBS="$libpcap $LIBS"]) - -dnl -dnl Define RETSIGTYPE and RETSIGVAL -dnl -dnl usage: -dnl -dnl AC_LBL_TYPE_SIGNAL -dnl -dnl results: -dnl -dnl RETSIGTYPE (defined) -dnl RETSIGVAL (defined) -dnl -AC_DEFUN(AC_LBL_TYPE_SIGNAL, - [AC_TYPE_SIGNAL - if test "$ac_cv_type_signal" = void ; then - AC_DEFINE(RETSIGVAL,) - else - AC_DEFINE(RETSIGVAL,(0)) - fi - case "$target_os" in - - irix*) - AC_DEFINE(_BSD_SIGNALS) - ;; - - *) - AC_CHECK_FUNCS(sigset) - if test $ac_cv_func_sigset = yes ; then - AC_DEFINE(signal, sigset) - fi - ;; - esac]) - -dnl -dnl If using gcc, see if fixincludes should be run -dnl -dnl usage: -dnl -dnl AC_LBL_FIXINCLUDES -dnl -AC_DEFUN(AC_LBL_FIXINCLUDES, - [if test $ac_cv_prog_gcc = yes ; then - AC_MSG_CHECKING(if fixincludes is needed) - AC_CACHE_VAL(ac_cv_gcc_fixincludes, - AC_TRY_COMPILE( - [/* - * This generates a "duplicate case value" when fixincludes - * has not be run. - */ -# include <sys/types.h> -# include <sys/time.h> -# include <sys/ioctl.h> -# ifdef HAVE_SYS_IOCCOM_H -# include <sys/ioccom.h> -# endif], - [switch (0) { - case _IO('A', 1):; - case _IO('B', 1):; - }], - ac_cv_gcc_fixincludes=yes, - ac_cv_gcc_fixincludes=no)) - AC_MSG_RESULT($ac_cv_gcc_fixincludes) - if test $ac_cv_gcc_fixincludes = no ; then - # Don't cache failure - unset ac_cv_gcc_fixincludes - AC_MSG_ERROR(see the INSTALL for more info) - fi - fi]) - -dnl -dnl Check for flex, default to lex -dnl Require flex 2.4 or higher -dnl Check for bison, default to yacc -dnl Default to lex/yacc if both flex and bison are not available -dnl Define the yy prefix string if using flex and bison -dnl -dnl usage: -dnl -dnl AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix) -dnl -dnl results: -dnl -dnl $1 (lex set) -dnl $2 (yacc appended) -dnl $3 (optional flex and bison -P prefix) -dnl -AC_DEFUN(AC_LBL_LEX_AND_YACC, - [AC_CHECK_PROGS($1, flex, lex) - if test "$$1" = flex ; then - # The -V flag was added in 2.4 - AC_MSG_CHECKING(for flex 2.4 or higher) - AC_CACHE_VAL(ac_cv_flex_v24, - if flex -V >/dev/null 2>&1; then - ac_cv_flex_v24=yes - else - ac_cv_flex_v24=no - fi) - AC_MSG_RESULT($ac_cv_flex_v24) - if test $ac_cv_flex_v24 = no ; then - s="2.4 or higher required" - AC_MSG_WARN(ignoring obsolete flex executable ($s)) - $1=lex - fi - fi - AC_CHECK_PROGS($2, bison, yacc) - if test "$$2" = bison ; then - $2="$$2 -y" - fi - if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then - AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc) - $1=lex - $2=yacc - fi - if test "$$1" = flex -a -n "$3" ; then - $1="$$1 -P$3" - $2="$$2 -p $3" - fi]) - -dnl -dnl Checks to see if union wait is used with WEXITSTATUS() -dnl -dnl usage: -dnl -dnl AC_LBL_UNION_WAIT -dnl -dnl results: -dnl -dnl DECLWAITSTATUS (defined) -dnl -AC_DEFUN(AC_LBL_UNION_WAIT, - [AC_MSG_CHECKING(if union wait is used) - AC_CACHE_VAL(ac_cv_union_wait, - AC_TRY_COMPILE([ -# include <sys/types.h> -# include <sys/wait.h>], - [int status; - u_int i = WEXITSTATUS(status); - u_int j = waitpid(0, &status, 0);], - ac_cv_union_wait=no, - ac_cv_union_wait=yes)) - AC_MSG_RESULT($ac_cv_union_wait) - if test $ac_cv_union_wait = yes ; then - AC_DEFINE(DECLWAITSTATUS,union wait) - else - AC_DEFINE(DECLWAITSTATUS,int) - fi]) - -dnl -dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member -dnl -dnl usage: -dnl -dnl AC_LBL_SOCKADDR_SA_LEN -dnl -dnl results: -dnl -dnl HAVE_SOCKADDR_SA_LEN (defined) -dnl -AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN, - [AC_MSG_CHECKING(if sockaddr struct has sa_len member) - AC_CACHE_VAL(ac_cv_sockaddr_has_sa_len, - AC_TRY_COMPILE([ -# include <sys/types.h> -# include <sys/socket.h>], - [u_int i = sizeof(((struct sockaddr *)0)->sa_len)], - ac_cv_sockaddr_has_sa_len=yes, - ac_cv_sockaddr_has_sa_len=no)) - AC_MSG_RESULT($ac_cv_sockaddr_has_sa_len) - if test $ac_cv_sockaddr_has_sa_len = yes ; then - AC_DEFINE(HAVE_SOCKADDR_SA_LEN) - fi]) - -dnl -dnl Checks to see if -R is used -dnl -dnl usage: -dnl -dnl AC_LBL_HAVE_RUN_PATH -dnl -dnl results: -dnl -dnl ac_cv_have_run_path (yes or no) -dnl -AC_DEFUN(AC_LBL_HAVE_RUN_PATH, - [AC_MSG_CHECKING(for ${CC-cc} -R) - AC_CACHE_VAL(ac_cv_have_run_path, - [echo 'main(){}' > conftest.c - ${CC-cc} -o conftest conftest.c -R/a1/b2/c3 >conftest.out 2>&1 - if test ! -s conftest.out ; then - ac_cv_have_run_path=yes - else - ac_cv_have_run_path=no - fi - rm -f conftest*]) - AC_MSG_RESULT($ac_cv_have_run_path) - ]) - -dnl -dnl Checks to see if unaligned memory accesses fail -dnl -dnl usage: -dnl -dnl AC_LBL_UNALIGNED_ACCESS -dnl -dnl results: -dnl -dnl LBL_ALIGN (DEFINED) -dnl -AC_DEFUN(AC_LBL_UNALIGNED_ACCESS, - [AC_MSG_CHECKING(if unaligned accesses fail) - AC_CACHE_VAL(ac_cv_unaligned_fail, - [case "$target_cpu" in - - alpha|hp*|mips|sparc) - ac_cv_unaligned_fail=yes - ;; - - *) - cat >conftest.c <<EOF -# include <sys/types.h> -# include <sys/wait.h> -# include <stdio.h> - unsigned char a[[5]] = { 1, 2, 3, 4, 5 }; - main() { - unsigned int i; - pid_t pid; - int status; - /* avoid "core dumped" message */ - pid = fork(); - if (pid < 0) - exit(2); - if (pid > 0) { - /* parent */ - pid = waitpid(pid, &status, 0); - if (pid < 0) - exit(3); - exit(!WIFEXITED(status)); - } - /* child */ - i = *(unsigned int *)&a[[1]]; - printf("%d\n", i); - exit(0); - } -EOF - ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \ - conftest.c $LIBS >/dev/null 2>&1 - if test ! -x conftest ; then - dnl failed to compile for some reason - ac_cv_unaligned_fail=yes - else - ./conftest >conftest.out - if test ! -s conftest.out ; then - ac_cv_unaligned_fail=yes - else - ac_cv_unaligned_fail=no - fi - fi - rm -f conftest* core core.conftest - ;; - esac]) - AC_MSG_RESULT($ac_cv_unaligned_fail) - if test $ac_cv_unaligned_fail = yes ; then - AC_DEFINE(LBL_ALIGN) - fi]) - -dnl -dnl If using gcc and the file .devel exists: -dnl Compile with -g (if supported) and -Wall -dnl If using gcc 2, do extra prototype checking -dnl If an os prototype include exists, symlink os-proto.h to it -dnl -dnl usage: -dnl -dnl AC_LBL_DEVEL(copt) -dnl -dnl results: -dnl -dnl $1 (copt appended) -dnl HAVE_OS_PROTO_H (defined) -dnl os-proto.h (symlinked) -dnl -AC_DEFUN(AC_LBL_DEVEL, - [rm -f os-proto.h - if test "${LBL_CFLAGS+set}" = set; then - $1="$$1 ${LBL_CFLAGS}" - fi - if test $ac_cv_prog_gcc = yes -a -f .devel ; then - if test "${LBL_CFLAGS+set}" != set; then - if test "$ac_cv_prog_cc_g" = yes ; then - $1="-g $$1" - fi - $1="$$1 -Wall" - if test $ac_cv_gcc_vers -gt 1 ; then - $1="$$1 -Wmissing-prototypes -Wstrict-prototypes" - fi - fi - os=`echo $target_os | sed -e 's/\([[0-9]][[0-9]]*\)[[^0-9]].*$/\1/'` - name="lbl/os-$os.h" - if test -f $name ; then - ln -s $name os-proto.h - AC_DEFINE(HAVE_OS_PROTO_H) - else - AC_MSG_WARN(can't find $name) - fi - fi]) diff --git a/contrib/tcpdump/addrtoname.c b/contrib/tcpdump/addrtoname.c index ba4963b..bb0f2f5 100644 --- a/contrib/tcpdump/addrtoname.c +++ b/contrib/tcpdump/addrtoname.c @@ -20,10 +20,12 @@ * * Internet, ethernet, port, and protocol string to address * and address to string conversion routines + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.108.2.7 2005/09/29 07:46:45 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.108.2.5 2005/04/25 08:43:05 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -88,6 +90,7 @@ struct hnamemem tporttable[HASHNAMESIZE]; struct hnamemem uporttable[HASHNAMESIZE]; struct hnamemem eprototable[HASHNAMESIZE]; struct hnamemem dnaddrtable[HASHNAMESIZE]; +struct hnamemem llcsaptable[HASHNAMESIZE]; struct hnamemem ipxsaptable[HASHNAMESIZE]; #if defined(INET6) && defined(WIN32) @@ -460,10 +463,9 @@ lookup_protoid(const u_char *pi) const char * etheraddr_string(register const u_char *ep) { - register int i; + register u_int i, oui; register char *cp; register struct enamemem *tp; - int oui; char buf[BUFSIZE]; tp = lookup_emem(ep); @@ -475,9 +477,9 @@ etheraddr_string(register const u_char *ep) /* * We don't cast it to "const struct ether_addr *" - * because some systems fail to declare the second - * argument as a "const" pointer, even though they - * don't modify what it points to. + * because some systems don't modify the Ethernet + * address but fail to declare the second argument + * as a "const" pointer. */ if (ether_ntohost(buf2, (struct ether_addr *)ep) == 0) { tp->e_name = strdup(buf2); @@ -486,20 +488,20 @@ etheraddr_string(register const u_char *ep) } #endif cp = buf; - oui = EXTRACT_24BITS(ep); + oui=EXTRACT_24BITS(ep); *cp++ = hex[*ep >> 4 ]; *cp++ = hex[*ep++ & 0xf]; - for (i = 5; --i >= 0;) { - *cp++ = ':'; - *cp++ = hex[*ep >> 4 ]; - *cp++ = hex[*ep++ & 0xf]; - } - - if (!nflag) { - snprintf(cp, BUFSIZE - (2 + 5*3), " (oui %s)", - tok2str(oui_values, "Unknown", oui)); - } else - *cp = '\0'; + for (i = 5; (int)--i >= 0;) { + *cp++ = ':'; + *cp++ = hex[*ep >> 4 ]; + *cp++ = hex[*ep++ & 0xf]; + } + + if (!nflag) { + snprintf(cp,BUFSIZE," (oui %s)", + tok2str(oui_values,"Unknown",oui)); + } else + *cp = '\0'; tp->e_name = strdup(buf); return (tp->e_name); } @@ -585,6 +587,25 @@ protoid_string(register const u_char *pi) return (tp->p_name); } +const char * +llcsap_string(u_char sap) +{ + register struct hnamemem *tp; + register u_int32_t i = sap; + char buf[sizeof("sap 00")]; + + for (tp = &llcsaptable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt) + if (tp->addr == i) + return (tp->name); + + tp->addr = i; + tp->nxt = newhnamemem(); + + snprintf(buf, sizeof(buf), "sap %02x", sap & 0xff); + tp->name = strdup(buf); + return (tp->name); +} + #define ISONSAP_MAX_LENGTH 20 const char * isonsap_string(const u_char *nsap, register u_int nsap_length) @@ -853,6 +874,40 @@ init_etherarray(void) } } +static struct tok llcsap_db[] = { + { LLCSAP_NULL, "null" }, + { LLCSAP_8021B_I, "802.1b-gsap" }, + { LLCSAP_8021B_G, "802.1b-isap" }, + { LLCSAP_IP, "ip-sap" }, + { LLCSAP_PROWAYNM, "proway-nm" }, + { LLCSAP_8021D, "802.1d" }, + { LLCSAP_RS511, "eia-rs511" }, + { LLCSAP_ISO8208, "x.25/llc2" }, + { LLCSAP_PROWAY, "proway" }, + { LLCSAP_SNAP, "snap" }, + { LLCSAP_IPX, "IPX" }, + { LLCSAP_NETBEUI, "netbeui" }, + { LLCSAP_ISONS, "iso-clns" }, + { LLCSAP_GLOBAL, "global" }, + { 0, NULL } +}; + +static void +init_llcsaparray(void) +{ + register int i; + register struct hnamemem *table; + + for (i = 0; llcsap_db[i].s != NULL; i++) { + table = &llcsaptable[llcsap_db[i].v]; + while (table->name) + table = table->nxt; + table->name = llcsap_db[i].s; + table->addr = llcsap_db[i].v; + table->nxt = newhnamemem(); + } +} + static struct tok ipxsap_db[] = { { 0x0000, "Unknown" }, { 0x0001, "User" }, @@ -1109,6 +1164,7 @@ init_addrtoname(u_int32_t localnet, u_int32_t mask) init_etherarray(); init_servarray(); init_eprotoarray(); + init_llcsaparray(); init_protoidarray(); init_ipxsaparray(); } diff --git a/contrib/tcpdump/dhcp6.h b/contrib/tcpdump/dhcp6.h deleted file mode 100644 index 8381b11..0000000 --- a/contrib/tcpdump/dhcp6.h +++ /dev/null @@ -1,200 +0,0 @@ -/* @(#) $Header: /tcpdump/master/tcpdump/Attic/dhcp6.h,v 1.4 2000/12/17 23:07:48 guy Exp $ (LBL) */ -/* - * Copyright (C) 1998 and 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project 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 BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * draft-ietf-dhc-dhcpv6-15 - */ - -#ifndef __DHCP6_H_DEFINED -#define __DHCP6_H_DEFINED - -/* Error Values */ -#define DH6ERR_FAILURE 16 -#define DH6ERR_AUTHFAIL 17 -#define DH6ERR_POORLYFORMED 18 -#define DH6ERR_UNAVAIL 19 -#define DH6ERR_NOBINDING 20 -#define DH6ERR_INVALIDSOURCE 21 -#define DH6ERR_NOSERVER 23 -#define DH6ERR_ICMPERROR 64 - -/* Message type */ -#define DH6_SOLICIT 1 -#define DH6_ADVERT 2 -#define DH6_REQUEST 3 -#define DH6_REPLY 4 -#define DH6_RELEASE 5 -#define DH6_RECONFIG 6 - -/* Predefined addresses */ -#define DH6ADDR_ALLAGENT "ff02::1:2" -#define DH6ADDR_ALLSERVER "ff05::1:3" -#define DH6ADDR_ALLRELAY "ff05::1:4" -#define DH6PORT_DOWNSTREAM "546" -#define DH6PORT_UPSTREAM "547" - -/* Protocol constants */ -#define ADV_CLIENT_WAIT 2 /* sec */ -#define DEFAULT_SOLICIT_HOPCOUNT 4 -#define SERVER_MIN_ADV_DELAY 100 /* msec */ -#define SERVER_MAX_ADV_DELAY 1000 /* msec */ -#define REPLY_MSG_TIMEOUT 2 /* sec */ -#define REQUEST_MSG_MIN_RETRANS 10 /* retransmissions */ -#define RECONF_MSG_MIN_RETRANS 10 /* retransmissions */ -#define RECONF_MSG_RETRANS_INTERVAL 12 /* sec */ -#define RECONF_MMSG_MIN_RESP 2 /* sec */ -#define RECONF_MMSG_MAX_RESP 10 /* sec */ -#define RECONF_MULTICAST_REQUEST_WAIT 120 /* sec */ -#define MIN_SOLICIT_DELAY 1 /* sec */ -#define MAX_SOLICIT_DELAY 5 /* sec */ -#define XID_TIMEOUT 600 /* sec */ - -/* DHCP6 base packet format */ -struct dhcp6_solicit { - u_int8_t dh6sol_msgtype; /* DH6_SOLICIT */ - u_int8_t dh6sol_flags; -#define DH6SOL_CLOSE 0x80 -#define DH6SOL_PREFIX 0x40 - /* XXX: solicit-ID is a 9-bit field...ugly! */ -#define DH6SOL_SOLICIT_ID_MASK 0x01ff -#define DH6SOL_SOLICIT_ID_SHIFT 0 -#define DH6SOL_SOLICIT_ID(x) \ - (((x) & DH6SOL_SOLICIT_ID_MASK) >> DH6SOL_SOLICIT_ID_SHIFT) -#define DH6SOL_SOLICIT_PLEN_MASK 0xfe00 -#define DH6SOL_SOLICIT_PLEN_SHIFT 9 -#define DH6SOL_SOLICIT_PLEN(x) \ - (((x) & DH6SOL_SOLICIT_PLEN_MASK) >> DH6SOL_SOLICIT_PLEN_SHIFT) - u_int16_t dh6sol_plen_id; /* prefix-len and solict-ID */ - struct in6_addr dh6sol_cliaddr; /* client's lladdr */ - struct in6_addr dh6sol_relayaddr; /* relay agent's lladdr */ -}; - -struct dhcp6_advert { - u_int8_t dh6adv_msgtype; /* DH6_ADVERT */ - u_int8_t dh6adv_rsv_id; /* reserved and uppermost bit of ID */ - u_int8_t dh6adv_solcit_id; /* lower 8 bits of solicit-ID */ - u_int8_t dh6adv_pref; - struct in6_addr dh6adv_cliaddr; /* client's link-local addr */ - struct in6_addr dh6adv_relayaddr; /* relay agent's (non-ll) addr */ - struct in6_addr dh6adv_serveraddr; /* server's addr */ - /* extensions */ -}; - -struct dhcp6_request { - u_int8_t dh6req_msgtype; /* DH6_REQUEST */ - u_int8_t dh6req_flags; -#define DH6REQ_CLOSE 0x80 -#define DH6REQ_REBOOT 0x40 - u_int16_t dh6req_xid; /* transaction-ID */ - struct in6_addr dh6req_cliaddr; /* client's lladdr */ - struct in6_addr dh6req_relayaddr; /* relay agent's (non-ll) addr */ - struct in6_addr dh6req_serveraddr; /* server's addr */ - /* extensions */ -}; - -struct dhcp6_reply { - u_int8_t dh6rep_msgtype; /* DH6_REPLY */ - u_int8_t dh6rep_flagandstat; -#define DH6REP_RELAYPRESENT 0x80 -#define DH6REP_STATMASK 0x7f - u_int16_t dh6rep_xid; /* transaction-ID */ - struct in6_addr dh6rep_cliaddr; /* client's lladdr */ - /* struct in6_addr dh6rep_relayaddr; optional: relay address */ - /* extensions */ -}; - -/* XXX: followings are based on older drafts */ -struct dhcp6_release { - u_int8_t dh6rel_msgtype; /* DH6_RELEASE */ - u_int8_t dh6rel_flags; -#define DH6REL_DIRECT 0x80 - u_int16_t dh6rel_xid; /* transaction-ID */ - struct in6_addr dh6rel_cliaddr; /* client's lladdr */ - struct in6_addr dh6rel_relayaddr; /* relay agent's (non-ll) addr */ - struct in6_addr dh6rel_reladdr; /* server's addr to be released */ - /* extensions */ -}; - -struct dhcp6_reconfig { - u_int8_t dh6cfg_msgtype; /* DH6_RECONFIG */ - u_int8_t dh6cfg_flags; -#define DH6REP_NOREPLY 0x80 - u_int16_t dh6cfg_xid; /* transaction-ID */ - struct in6_addr dh6cfg_servaddr; /* server's addr */ - /* extensions */ -}; - -union dhcp6 { - u_int8_t dh6_msgtype; - struct dhcp6_solicit dh6_sol; - struct dhcp6_advert dh6_adv; - struct dhcp6_request dh6_req; - struct dhcp6_reply dh6_rep; - struct dhcp6_release dh6_rel; - struct dhcp6_reconfig dh6_cfg; -}; - -/* DHCP6 extension */ -struct dhcp6e_ipaddr { - u_int16_t dh6eip_type; - u_int16_t dh6eip_len; - u_int8_t dh6eip_status; -#define DH6EX_IP_SUCCESS 0 /* request granted, no errors */ -#define DH6EX_IP_SECFAIL 18 /* Security parameters failed */ -#define DH6EX_IP_AAAAFAIL 20 /* AAAA Record Parameter Problem */ -#define DH6EX_IP_PTRFAIL 21 /* PTR Record Parameter Problem */ -#define DH6EX_IP_PARAMFAIL 22 /* Unable to honor required params */ -#define DH6EX_IP_DNSNAMEFAIL 23 /* DNS name string error */ -#define DH6EX_IP_NODYNDNS 24 /* dynDNS Not Implemented */ -#define DH6EX_IP_NOAUTHDNS 25 /* Authoritative DNS Server not found */ -#define DH6EX_IP_DNSFORMFAIL 33 /* DNS format error */ -#define DH6EX_IP_SERVFAIL 34 /* dynDNS unavailable at this time */ -#define DH6EX_IP_NXDOMAIN 35 /* name does not exist */ -#define DH6EX_IP_NOTIMP 36 /* DNS does not support the Opcode */ -#define DH6EX_IP_REFUSED 37 /* DNS refuses specified operation */ -#define DH6EX_IP_YXDOMAIN 38 /* name does not exist */ -#define DH6EX_IP_YXRRSET 39 /* RRset does not exist */ -#define DH6EX_IP_NXRRSET 40 /* RRset does not exist */ -#define DH6EX_IP_NOTAUTH 41 /* non authoritative name server */ -#define DH6EX_IP_NOTZONE 42 /* prerequisite out of zone */ - u_int8_t dh6eip_flags; -#define DH6EX_IP_CLIANTADDR 0x80 /* C: cliant's addr */ -#define DH6EX_IP_LIFETIME 0x40 /* L: preferred/valid lifetime */ -#define DH6EX_IP_FORCEOPTS 0x20 /* Q: options are mandatory */ -#define DH6EX_IP_AAAA 0x10 /* A: DNS dynamic update for AAAA */ -#define DH6EX_IP_PTR 0x08 /* P: DNS dynamic update for PTR*/ - u_int8_t dh6eip_pad; - u_int8_t dh6eip_prefixlen; - /* struct in6_addr: client's address (if C bit = 1) */ - /* u_int: preferred lifetime (if L bit = 1) */ - /* u_int: valid lifetime (if L bit = 1) */ - /* string: DNS name */ -}; - -#endif /*__DHCP6_H_DEFINED*/ diff --git a/contrib/tcpdump/dhcp6opt.h b/contrib/tcpdump/dhcp6opt.h deleted file mode 100644 index fc6534d..0000000 --- a/contrib/tcpdump/dhcp6opt.h +++ /dev/null @@ -1,81 +0,0 @@ -/* @(#) $Header: /tcpdump/master/tcpdump/Attic/dhcp6opt.h,v 1.4 2001/09/17 21:57:51 fenner Exp $ (LBL) */ -/* - * Copyright (C) 1998 and 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project 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 BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * draft-ietf-dhc-v6exts-11 - */ - -#ifndef __DHCP6OPT_H_DEFINED -#define __DHCP6OPT_H_DEFINED - -#define OL6_N -1 -#define OL6_16N -2 -#define OL6_Z -3 - -#define OT6_NONE 0 -#define OT6_V6 1 -#define OT6_STR 2 -#define OT6_NUM 3 - -struct dhcp6_opt { - u_int code; - int len; - const char *name; - int type; -}; - -/* index to parameters */ -#define DH6T_CLIENT_ADV_WAIT 1 /* milliseconds */ -#define DH6T_DEFAULT_SOLICIT_HOPCOUNT 2 /* times */ -#define DH6T_SERVER_MIN_ADV_DELAY 3 /* milliseconds */ -#define DH6T_SERVER_MAX_ADV_DELAY 4 /* milliseconds */ -#define DH6T_REQUEST_MSG_MIN_RETRANS 5 /* retransmissions */ -#define DH6T_REPLY_MSG_TIMEOUT 6 /* milliseconds */ -#define DH6T_REPLY_MSG_RETRANS_INTERVAL 7 /* milliseconds */ -#define DH6T_RECONF_MSG_TIMEOUT 8 /* milliseconds */ -#define DH6T_RECONF_MSG_MIN_RETRANS 9 /* retransmissions */ -#define DH6T_RECONF_MSG_RETRANS_INTERVAL 10 /* milliseconds */ -#define DH6T_RECONF_MMSG_MIN_RESP 11 /* milliseconds */ -#define DH6T_RECONF_MMSG_MAX_RESP 12 /* milliseconds */ -#define DH6T_MIN_SOLICIT_DELAY 13 /* milliseconds */ -#define DH6T_MAX_SOLICIT_DELAY 14 /* milliseconds */ -#define DH6T_XID_TIMEOUT 15 /* milliseconds */ -#define DH6T_RECONF_MULTICAST_REQUEST_WAIT 16 /* milliseconds */ - -#if 0 -extern struct dhcp6_opt *dh6o_pad; -extern struct dhcp6_opt *dh6o_end; -extern int dhcp6_param[]; -extern void dhcp6opttab_init (void); -extern struct dhcp6_opt *dhcp6opttab_byname (char *); -extern struct dhcp6_opt *dhcp6opttab_bycode (u_int); -#endif - -#endif /*__DHCP6OPT_H_DEFINED*/ diff --git a/contrib/tcpdump/ethertype.h b/contrib/tcpdump/ethertype.h index 36dc8e2..808cdcf 100644 --- a/contrib/tcpdump/ethertype.h +++ b/contrib/tcpdump/ethertype.h @@ -18,7 +18,9 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.24.2.1 2005/07/10 14:51:10 hannes Exp $ (LBL) + * + * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.24 2004/10/07 16:04:07 hannes Exp $ (LBL) + * $FreeBSD$ */ /* @@ -109,9 +111,6 @@ #ifndef ETHERTYPE_PPP #define ETHERTYPE_PPP 0x880b #endif -#ifndef ETHERTYPE_SLOW -#define ETHERTYPE_SLOW 0x8809 -#endif #ifndef ETHERTYPE_MPLS #define ETHERTYPE_MPLS 0x8847 #endif @@ -124,6 +123,12 @@ #ifndef ETHERTYPE_PPPOES #define ETHERTYPE_PPPOES 0x8864 #endif +#ifndef ETHERTYPE_PPPOED2 +#define ETHERTYPE_PPPOED2 0x3c12 +#endif +#ifndef ETHERTYPE_PPPOES2 +#define ETHERTYPE_PPPOES2 0x3c13 +#endif #ifndef ETHERTYPE_JUMBO #define ETHERTYPE_JUMBO 0x8870 #endif diff --git a/contrib/tcpdump/interface.h b/contrib/tcpdump/interface.h index dcbd9b2..3fb09b4 100644 --- a/contrib/tcpdump/interface.h +++ b/contrib/tcpdump/interface.h @@ -18,7 +18,9 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.244.2.18 2005/09/29 07:46:45 hannes Exp $ (LBL) + * + * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.244 2005/04/06 21:33:27 mcr Exp $ (LBL) + * $FreeBSD$ */ #ifndef tcpdump_interface_h @@ -155,6 +157,7 @@ extern void safeputchar(int); extern void safeputs(const char *); extern const char *isonsap_string(const u_char *, register u_int); +extern const char *llcsap_string(u_char); extern const char *protoid_string(const u_char *); extern const char *ipxsap_string(u_short); extern const char *dnname_string(u_short); @@ -165,13 +168,11 @@ extern const char *dnnum_string(u_short); #include <pcap.h> extern int print_unknown_data(const u_char *, const char *,int); -extern void ascii_print(const u_char *, u_int); -extern void hex_and_ascii_print_with_offset(const char *, const u_char *, - u_int, u_int); -extern void hex_and_ascii_print(const char *, const u_char *, u_int); +extern void ascii_print_with_offset(const char *, const u_char *, u_int, u_int); +extern void ascii_print(const char *, const u_char *, u_int); extern void hex_print_with_offset(const char *, const u_char *, u_int, u_int); -extern void hex_print(const char *, const u_char *, u_int); extern void telnet_print(const u_char *, u_int); +extern void hex_print(const char *, const u_char *, u_int); extern int ether_encap_print(u_short, const u_char *, u_int, u_int, u_short *); extern int llc_print(const u_char *, u_int, u_int, const u_char *, const u_char *, u_short *); @@ -203,7 +204,6 @@ extern void fddi_print(const u_char *, u_int, u_int); extern u_int fddi_if_print(const struct pcap_pkthdr *, const u_char *); extern u_int fr_if_print(const struct pcap_pkthdr *, const u_char *); extern u_int fr_print(register const u_char *, u_int); -extern u_int mfr_print(register const u_char *, u_int); extern u_int ieee802_11_if_print(const struct pcap_pkthdr *, const u_char *); extern u_int ieee802_11_radio_if_print(const struct pcap_pkthdr *, const u_char *); @@ -252,7 +252,6 @@ extern u_int lane_if_print(const struct pcap_pkthdr *, const u_char *); extern u_int cip_if_print(const struct pcap_pkthdr *, const u_char *); extern u_int sl_bsdos_if_print(const struct pcap_pkthdr *, const u_char *); extern u_int chdlc_if_print(const struct pcap_pkthdr *, const u_char *); -extern u_int chdlc_print(register const u_char *, u_int); extern u_int juniper_atm1_print(const struct pcap_pkthdr *, const u_char *); extern u_int juniper_atm2_print(const struct pcap_pkthdr *, const u_char *); extern u_int juniper_mfr_print(const struct pcap_pkthdr *, register const u_char *); @@ -264,10 +263,6 @@ extern u_int juniper_ggsn_print(const struct pcap_pkthdr *, const u_char *); extern u_int juniper_es_print(const struct pcap_pkthdr *, const u_char *); extern u_int juniper_monitor_print(const struct pcap_pkthdr *, const u_char *); extern u_int juniper_services_print(const struct pcap_pkthdr *, const u_char *); -extern u_int juniper_ether_print(const struct pcap_pkthdr *, const u_char *); -extern u_int juniper_ppp_print(const struct pcap_pkthdr *, const u_char *); -extern u_int juniper_frelay_print(const struct pcap_pkthdr *, const u_char *); -extern u_int juniper_chdlc_print(const struct pcap_pkthdr *, const u_char *); extern u_int sll_if_print(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 *); @@ -290,14 +285,12 @@ extern const char *nt_errstr(u_int32_t); extern void print_data(const unsigned char *, int); extern void l2tp_print(const u_char *, u_int); extern void vrrp_print(const u_char *, u_int, int); -extern void slow_print(const u_char *, u_int); extern void pgm_print(const u_char *, u_int, const u_char *); extern void cdp_print(const u_char *, u_int, u_int); extern void stp_print(const u_char *, u_int); extern void radius_print(const u_char *, u_int); extern void lwres_print(const u_char *, u_int); extern void pptp_print(const u_char *); -extern void dccp_print(const u_char *, const u_char *, u_int); extern void sctp_print(const u_char *, const u_char *, u_int); extern void mpls_print(const u_char *, u_int); extern void mpls_lsp_ping_print(const u_char *, u_int); @@ -354,7 +347,6 @@ extern netdissect_options *gndo; #define Xflag gndo->ndo_Xflag #define Cflag gndo->ndo_Cflag #define Aflag gndo->ndo_Aflag -#define suppress_default_print gndo->ndo_suppress_default_print #define packettype gndo->ndo_packettype #define tcpmd5secret gndo->ndo_tcpmd5secret #define Wflag gndo->ndo_Wflag diff --git a/contrib/tcpdump/lbl/gnuc.h b/contrib/tcpdump/lbl/gnuc.h deleted file mode 100644 index 1615d43..0000000 --- a/contrib/tcpdump/lbl/gnuc.h +++ /dev/null @@ -1,43 +0,0 @@ -/* @(#) $Header: /tcpdump/master/tcpdump/lbl/gnuc.h,v 1.3.1.1 1999/10/07 23:47:13 mcr Exp $ (LBL) */ - -/* Define __P() macro, if necessary */ -#ifndef __P -#if __STDC__ -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -/* inline foo */ -#ifdef __GNUC__ -#define inline __inline -#else -#define inline -#endif - -/* - * Handle new and old "dead" routine prototypes - * - * For example: - * - * __dead void foo(void) __attribute__((volatile)); - * - */ -#ifdef __GNUC__ -#ifndef __dead -#define __dead volatile -#endif -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -#ifndef __attribute__ -#define __attribute__(args) -#endif -#endif -#else -#ifndef __dead -#define __dead -#endif -#ifndef __attribute__ -#define __attribute__(args) -#endif -#endif diff --git a/contrib/tcpdump/missing/cdecl_ext.h b/contrib/tcpdump/missing/cdecl_ext.h deleted file mode 100644 index 9591db2..0000000 --- a/contrib/tcpdump/missing/cdecl_ext.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project 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 BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#ifndef HAVE_PORTABLE_PROTOTYPE - -#if defined(__STDC__) || defined(__cplusplus) -#define __P(protos) protos /* full-blown ANSI C */ -#else -#define __P(protos) () /* traditional C preprocessor */ -#endif - -#endif /* !HAVE_PORTABLE_PROTOTYPE */ diff --git a/contrib/tcpdump/nfs.h b/contrib/tcpdump/nfs.h index 3d47c7d..82c8dd3 100644 --- a/contrib/tcpdump/nfs.h +++ b/contrib/tcpdump/nfs.h @@ -36,6 +36,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $FreeBSD$ * @(#)nfsproto.h 8.2 (Berkeley) 3/30/95 */ diff --git a/contrib/tcpdump/nfsfh.h b/contrib/tcpdump/nfsfh.h index b8a82e4..8a337ba 100644 --- a/contrib/tcpdump/nfsfh.h +++ b/contrib/tcpdump/nfsfh.h @@ -39,6 +39,8 @@ * Jeffrey C. Mogul * Digital Equipment Corporation * Western Research Laboratory + * $FreeBSD$ + * $NetBSD: nfsfh.h,v 1.1.1.2 1997/10/03 17:25:13 christos Exp $ */ /* diff --git a/contrib/tcpdump/nfsv2.h b/contrib/tcpdump/nfsv2.h deleted file mode 100644 index b2c0ff9..0000000 --- a/contrib/tcpdump/nfsv2.h +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 1994, 1995, 1996 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Rick Macklem at The University of Guelph. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)nfsv2.h 7.11 (Berkeley) 9/30/92 - */ - -/* - * nfs definitions as per the version 2 specs - */ - -/* - * Constants as defined in the Sun NFS Version 2 spec. - * "NFS: Network File System Protocol Specification" RFC1094 - */ - -#define NFS_PORT 2049 -#define NFS_PROG 100003 -#define NFS_VER2 2 -#define NFS_MAXDGRAMDATA 8192 -#define NFS_MAXDATA 32768 -#define NFS_MAXPATHLEN 1024 -#define NFS_MAXNAMLEN 255 -#define NFS_FHSIZE 32 -#define NFS_MAXPKTHDR 404 -#define NFS_MAXPACKET (NFS_MAXPKTHDR+NFS_MAXDATA) -#define NFS_MINPACKET 20 -#define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ - -/* Stat numbers for rpc returns */ -#define NFS_OK 0 -#define NFSERR_PERM 1 -#define NFSERR_NOENT 2 -#define NFSERR_IO 5 -#define NFSERR_NXIO 6 -#define NFSERR_ACCES 13 -#define NFSERR_EXIST 17 -#define NFSERR_NODEV 19 -#define NFSERR_NOTDIR 20 -#define NFSERR_ISDIR 21 -#define NFSERR_FBIG 27 -#define NFSERR_NOSPC 28 -#define NFSERR_ROFS 30 -#define NFSERR_NAMETOL 63 -#define NFSERR_NOTEMPTY 66 -#define NFSERR_DQUOT 69 -#define NFSERR_STALE 70 -#define NFSERR_WFLUSH 99 - -/* Sizes in bytes of various nfs rpc components */ -#define NFSX_FH 32 -#define NFSX_UNSIGNED 4 -#define NFSX_NFSFATTR 68 -#define NFSX_NQFATTR 92 -#define NFSX_NFSSATTR 32 -#define NFSX_NQSATTR 44 -#define NFSX_COOKIE 4 -#define NFSX_NFSSTATFS 20 -#define NFSX_NQSTATFS 28 -#define NFSX_FATTR(isnq) ((isnq) ? NFSX_NQFATTR : NFSX_NFSFATTR) -#define NFSX_SATTR(isnq) ((isnq) ? NFSX_NQSATTR : NFSX_NFSSATTR) -#define NFSX_STATFS(isnq) ((isnq) ? NFSX_NQSTATFS : NFSX_NFSSTATFS) - -/* nfs rpc procedure numbers */ -#define NFSPROC_NULL 0 -#define NFSPROC_GETATTR 1 -#define NFSPROC_SETATTR 2 -#define NFSPROC_NOOP 3 -#define NFSPROC_ROOT NFSPROC_NOOP /* Obsolete */ -#define NFSPROC_LOOKUP 4 -#define NFSPROC_READLINK 5 -#define NFSPROC_READ 6 -#define NFSPROC_WRITECACHE NFSPROC_NOOP /* Obsolete */ -#define NFSPROC_WRITE 8 -#define NFSPROC_CREATE 9 -#define NFSPROC_REMOVE 10 -#define NFSPROC_RENAME 11 -#define NFSPROC_LINK 12 -#define NFSPROC_SYMLINK 13 -#define NFSPROC_MKDIR 14 -#define NFSPROC_RMDIR 15 -#define NFSPROC_READDIR 16 -#define NFSPROC_STATFS 17 - -/* NQ nfs numbers */ -#define NQNFSPROC_READDIRLOOK 18 -#define NQNFSPROC_GETLEASE 19 -#define NQNFSPROC_VACATED 20 -#define NQNFSPROC_EVICTED 21 -#define NQNFSPROC_ACCESS 22 - -#define NFS_NPROCS 23 -/* Conversion macros */ -extern int vttoif_tab[]; -#define vtonfs_mode(t,m) \ - txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \ - MAKEIMODE((t), (m))) -#define nfstov_mode(a) (fxdr_unsigned(u_short, (a))&07777) -#define vtonfs_type(a) txdr_unsigned(nfs_type[((int32_t)(a))]) -#define nfstov_type(a) ntov_type[fxdr_unsigned(u_int32_t,(a))&0x7] - -/* File types */ -typedef enum { - NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5 -} tcpdump_nfstype; - -/* Structs for common parts of the rpc's */ -struct nfsv2_time { - u_int32_t nfs_sec; - u_int32_t nfs_usec; -}; - -struct nqnfs_time { - u_int32_t nq_sec; - u_int32_t nq_nsec; -}; - -/* - * File attributes and setable attributes. These structures cover both - * NFS version 2 and the NQNFS protocol. Note that the union is only - * used to that one pointer can refer to both variants. These structures - * go out on the wire and must be densely packed, so no quad data types - * are used. (all fields are int32_t or u_int32_t's or structures of same) - * NB: You can't do sizeof(struct nfsv2_fattr), you must use the - * NFSX_FATTR(isnq) macro. - */ -struct nfsv2_fattr { - u_int32_t fa_type; - u_int32_t fa_mode; - u_int32_t fa_nlink; - u_int32_t fa_uid; - u_int32_t fa_gid; - union { - struct { - u_int32_t nfsfa_size; - u_int32_t nfsfa_blocksize; - u_int32_t nfsfa_rdev; - u_int32_t nfsfa_blocks; - u_int32_t nfsfa_fsid; - u_int32_t nfsfa_fileid; - struct nfsv2_time nfsfa_atime; - struct nfsv2_time nfsfa_mtime; - struct nfsv2_time nfsfa_ctime; - } fa_nfsv2; - struct { - struct { - u_int32_t nqfa_qsize[2]; - } nqfa_size; - u_int32_t nqfa_blocksize; - u_int32_t nqfa_rdev; - struct { - u_int32_t nqfa_qbytes[2]; - } nqfa_bytes; - u_int32_t nqfa_fsid; - u_int32_t nqfa_fileid; - struct nqnfs_time nqfa_atime; - struct nqnfs_time nqfa_mtime; - struct nqnfs_time nqfa_ctime; - u_int32_t nqfa_flags; - u_int32_t nqfa_gen; - struct { - u_int32_t nqfa_qfilerev[2]; - } nqfa_filerev; - } fa_nqnfs; - } fa_un; -}; - -/* and some ugly defines for accessing union components */ -#define fa_nfssize fa_un.fa_nfsv2.nfsfa_size -#define fa_nfsblocksize fa_un.fa_nfsv2.nfsfa_blocksize -#define fa_nfsrdev fa_un.fa_nfsv2.nfsfa_rdev -#define fa_nfsblocks fa_un.fa_nfsv2.nfsfa_blocks -#define fa_nfsfsid fa_un.fa_nfsv2.nfsfa_fsid -#define fa_nfsfileid fa_un.fa_nfsv2.nfsfa_fileid -#define fa_nfsatime fa_un.fa_nfsv2.nfsfa_atime -#define fa_nfsmtime fa_un.fa_nfsv2.nfsfa_mtime -#define fa_nfsctime fa_un.fa_nfsv2.nfsfa_ctime -#define fa_nqsize fa_un.fa_nqnfs.nqfa_size -#define fa_nqblocksize fa_un.fa_nqnfs.nqfa_blocksize -#define fa_nqrdev fa_un.fa_nqnfs.nqfa_rdev -#define fa_nqbytes fa_un.fa_nqnfs.nqfa_bytes -#define fa_nqfsid fa_un.fa_nqnfs.nqfa_fsid -#define fa_nqfileid fa_un.fa_nqnfs.nqfa_fileid -#define fa_nqatime fa_un.fa_nqnfs.nqfa_atime -#define fa_nqmtime fa_un.fa_nqnfs.nqfa_mtime -#define fa_nqctime fa_un.fa_nqnfs.nqfa_ctime -#define fa_nqflags fa_un.fa_nqnfs.nqfa_flags -#define fa_nqgen fa_un.fa_nqnfs.nqfa_gen -#define fa_nqfilerev fa_un.fa_nqnfs.nqfa_filerev - -struct nfsv2_sattr { - u_int32_t sa_mode; - u_int32_t sa_uid; - u_int32_t sa_gid; - union { - struct { - u_int32_t nfssa_size; - struct nfsv2_time nfssa_atime; - struct nfsv2_time nfssa_mtime; - } sa_nfsv2; - struct { - struct { - u_int32_t nqsa_qsize[2]; - } nqsa_size; - struct nqnfs_time nqsa_atime; - struct nqnfs_time nqsa_mtime; - u_int32_t nqsa_flags; - u_int32_t nqsa_rdev; - } sa_nqnfs; - } sa_un; -}; - -/* and some ugly defines for accessing the unions */ -#define sa_nfssize sa_un.sa_nfsv2.nfssa_size -#define sa_nfsatime sa_un.sa_nfsv2.nfssa_atime -#define sa_nfsmtime sa_un.sa_nfsv2.nfssa_mtime -#define sa_nqsize sa_un.sa_nqnfs.nqsa_size -#define sa_nqatime sa_un.sa_nqnfs.nqsa_atime -#define sa_nqmtime sa_un.sa_nqnfs.nqsa_mtime -#define sa_nqflags sa_un.sa_nqnfs.nqsa_flags -#define sa_nqrdev sa_un.sa_nqnfs.nqsa_rdev - -struct nfsv2_statfs { - u_int32_t sf_tsize; - u_int32_t sf_bsize; - u_int32_t sf_blocks; - u_int32_t sf_bfree; - u_int32_t sf_bavail; - u_int32_t sf_files; /* Nqnfs only */ - u_int32_t sf_ffree; /* ditto */ -}; diff --git a/contrib/tcpdump/parsenfsfh.c b/contrib/tcpdump/parsenfsfh.c index 686d01e..2e3da02 100644 --- a/contrib/tcpdump/parsenfsfh.c +++ b/contrib/tcpdump/parsenfsfh.c @@ -38,6 +38,8 @@ * Jeffrey C. Mogul * Digital Equipment Corporation * Western Research Laboratory + * + * $FreeBSD$ */ #ifndef lint diff --git a/contrib/tcpdump/ppp.h b/contrib/tcpdump/ppp.h index 71621ca..484ea46 100644 --- a/contrib/tcpdump/ppp.h +++ b/contrib/tcpdump/ppp.h @@ -14,22 +14,30 @@ * University. Carnegie Mellon makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. + * + * $FreeBSD$ */ #define PPP_HDRLEN 4 /* length of PPP header */ +#undef PPP_ADDRESS #define PPP_ADDRESS 0xff /* The address byte value */ +#undef PPP_CONTROL #define PPP_CONTROL 0x03 /* The control byte value */ #define PPP_WITHDIRECTION_IN 0x00 /* non-standard for DLT_PPP_WITHDIRECTION */ #define PPP_WITHDIRECTION_OUT 0x01 /* non-standard for DLT_PPP_WITHDIRECTION */ /* Protocol numbers */ +#ifndef PPP_IP #define PPP_IP 0x0021 /* Raw IP */ +#endif #define PPP_OSI 0x0023 /* OSI Network Layer */ #define PPP_NS 0x0025 /* Xerox NS IDP */ #define PPP_DECNET 0x0027 /* DECnet Phase IV */ #define PPP_APPLE 0x0029 /* Appletalk */ +#ifndef PPP_IPX #define PPP_IPX 0x002b /* Novell IPX */ +#endif #define PPP_VJC 0x002d /* Van Jacobson Compressed TCP/IP */ #define PPP_VJNC 0x002f /* Van Jacobson Uncompressed TCP/IP */ #define PPP_BRPDU 0x0031 /* Bridging PDU */ diff --git a/contrib/tcpdump/print-arp.c b/contrib/tcpdump/print-arp.c index 68e9dc6..3dc2894 100644 --- a/contrib/tcpdump/print-arp.c +++ b/contrib/tcpdump/print-arp.c @@ -17,6 +17,8 @@ * 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. + * + * $FreeBSD$ */ #ifndef lint diff --git a/contrib/tcpdump/print-atalk.c b/contrib/tcpdump/print-atalk.c index f1f45a3..1d575a6 100644 --- a/contrib/tcpdump/print-atalk.c +++ b/contrib/tcpdump/print-atalk.c @@ -19,6 +19,8 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Format and print AppleTalk packets. + * + * $FreeBSD$ */ #ifndef lint @@ -99,6 +101,7 @@ llap_print(register const u_char *bp, u_int length) u_short snet; u_int hdrlen; +#if 0 /* * Our packet is on a 4-byte boundary, as we're either called * directly from a top-level link-layer printer (ltalk_if_print) @@ -110,6 +113,12 @@ llap_print(register const u_char *bp, u_int length) lp = (const struct LAP *)bp; bp += sizeof(*lp); length -= sizeof(*lp); +#else + { + static struct LAP lp_ = {0, 0, lapDDP}; + lp = &lp_; + } +#endif hdrlen = sizeof(*lp); switch (lp->type) { @@ -213,7 +222,7 @@ aarp_print(register const u_char *bp, u_int length) case 2: /* response */ (void)printf("reply %s is-at %s", - AT(pdaddr), etheraddr_string(ap->hdaddr)); + AT(psaddr), etheraddr_string(ap->hsaddr)); return; case 3: /* probe (oy!) */ @@ -567,10 +576,10 @@ ataddr_string(u_short atnet, u_char athost) else continue; - for (tp = &hnametable[i3 & (HASHNAMESIZE-1)]; + for (tp = &hnametable[i2 & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt) ; - tp->addr = i3; + tp->addr = i2; tp->nxt = newhnamemem(); tp->name = strdup(nambuf); } diff --git a/contrib/tcpdump/print-atm.c b/contrib/tcpdump/print-atm.c index b14a580..4e061b0 100644 --- a/contrib/tcpdump/print-atm.c +++ b/contrib/tcpdump/print-atm.c @@ -17,10 +17,12 @@ * 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. + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.38.2.3 2005/07/07 01:24:34 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.38.2.2 2005/06/20 07:45:06 hannes Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -106,7 +108,7 @@ atm_llc_print(const u_char *p, int length, int caplen) printf("(LLC %s) ", etherproto_string(htons(extracted_ethertype))); } - if (!suppress_default_print) + if (!xflag && !qflag) default_print(p, caplen); } } @@ -135,7 +137,6 @@ atm_if_print(const struct pcap_pkthdr *h, const u_char *p) printf("[|atm]"); return (caplen); } - /* * Extract the presumed LLC header into a variable, for quick * testing. diff --git a/contrib/tcpdump/print-bootp.c b/contrib/tcpdump/print-bootp.c index 8108993..844aecc 100644 --- a/contrib/tcpdump/print-bootp.c +++ b/contrib/tcpdump/print-bootp.c @@ -19,6 +19,8 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Format and print bootp packets. + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = diff --git a/contrib/tcpdump/print-bxxp.c b/contrib/tcpdump/print-bxxp.c deleted file mode 100644 index 56be54f..0000000 --- a/contrib/tcpdump/print-bxxp.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2000, Richard Sharpe - * - * This software may be distributed either under the terms of the - * BSD-style licence that accompanies tcpdump or under the GNU GPL - * version 2 or later. - * - * print-bxxp.c - * - */ - -#ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-bxxp.c,v 1.3 2000/10/05 04:10:01 itojun Exp $"; -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <sys/param.h> -#include <sys/time.h> - -#ifdef HAVE_MEMORY_H -#include <memory.h> -#endif -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include "interface.h" -#include "extract.h" - -/* Check for a string but not go beyond length - * Return TRUE on match, FALSE otherwise - * - * Looks at the first few chars up to tl1 ... - */ - -int l_strnstart(const u_char *, u_int, const u_char *, u_int); - -int -l_strnstart(register const u_char *tstr1, register u_int tl1, - register const u_char *str2, register u_int l2) -{ - - if (tl1 > l2) - return 0; - - return (strncmp(tstr1, str2, tl1) == 0 ? 1 : 0); - -} - -void -bxxp_print(register const u_char *bp, register u_int length) -{ - - if (l_strnstart("REQ ", 4, bp, length)) { /* A REQuest */ - - printf(" BXXP REQ"); - - } - else if (l_strnstart("RSP ", 4, bp, length)) { - - printf(" BXXP RSP"); - - } - else if (l_strnstart("SEQ ", 4, bp, length)) { - - printf(" BXXP SEQ"); - - } - else if (l_strnstart("END", 4, bp, length)) { - - printf(" BXXP END"); - - } - else - printf(" BXXP (payload or undecoded)"); - -} diff --git a/contrib/tcpdump/print-domain.c b/contrib/tcpdump/print-domain.c index adcf592..08b5cea 100644 --- a/contrib/tcpdump/print-domain.c +++ b/contrib/tcpdump/print-domain.c @@ -17,6 +17,8 @@ * 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. + * + * $FreeBSD$ */ #ifndef lint diff --git a/contrib/tcpdump/print-ether.c b/contrib/tcpdump/print-ether.c index 8d87830..a82fc93 100644 --- a/contrib/tcpdump/print-ether.c +++ b/contrib/tcpdump/print-ether.c @@ -17,10 +17,12 @@ * 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. + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95.2.4 2005/07/10 14:47:57 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95.2.2 2005/07/01 16:16:30 hannes Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -65,7 +67,6 @@ const struct tok ethertype_values[] = { { ETHERTYPE_AARP, "Appletalk ARP" }, { ETHERTYPE_IPX, "IPX" }, { ETHERTYPE_PPP, "PPP" }, - { ETHERTYPE_SLOW, "Slow Protocols" }, { ETHERTYPE_PPPOED, "PPPoE D" }, { ETHERTYPE_PPPOES, "PPPoE S" }, { ETHERTYPE_EAPOL, "EAPOL" }, @@ -137,7 +138,7 @@ ether_print(const u_char *p, u_int length, u_int caplen) if (!eflag) ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN); - if (!suppress_default_print) + if (!xflag && !qflag) default_print(p, caplen); } } else if (ether_encap_print(ether_type, p, length, caplen, @@ -146,7 +147,7 @@ ether_print(const u_char *p, u_int length, u_int caplen) if (!eflag) ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN); - if (!suppress_default_print) + if (!xflag && !qflag) default_print(p, caplen); } } @@ -246,7 +247,7 @@ ether_encap_print(u_short ether_type, const u_char *p, ether_hdr_print(p - 18, length + 4); } - if (!suppress_default_print) + if (!xflag && !qflag) default_print(p - 18, caplen + 4); return (1); @@ -271,7 +272,7 @@ ether_encap_print(u_short ether_type, const u_char *p, ether_hdr_print(p - 16, length + 2); } - if (!suppress_default_print) + if (!xflag && !qflag) default_print(p - 16, caplen + 2); return (1); @@ -282,6 +283,8 @@ ether_encap_print(u_short ether_type, const u_char *p, case ETHERTYPE_PPPOED: case ETHERTYPE_PPPOES: + case ETHERTYPE_PPPOED2: + case ETHERTYPE_PPPOES2: pppoe_print(p, length); return (1); @@ -296,10 +299,6 @@ ether_encap_print(u_short ether_type, const u_char *p, } return (1); - case ETHERTYPE_SLOW: - slow_print(p, length); - return (1); - case ETHERTYPE_LOOPBACK: return (1); diff --git a/contrib/tcpdump/print-fddi.c b/contrib/tcpdump/print-fddi.c index 7d12a30..acb68a9 100644 --- a/contrib/tcpdump/print-fddi.c +++ b/contrib/tcpdump/print-fddi.c @@ -17,11 +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. + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.64.2.1 2005/07/07 01:24:35 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.64 2004/03/17 23:24:37 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -280,7 +282,7 @@ fddi_print(const u_char *p, u_int length, u_int caplen) printf("(LLC %s) ", etherproto_string(htons(extracted_ethertype))); } - if (!suppress_default_print) + if (!xflag && !qflag) default_print(p, caplen); } } else if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_SMT) @@ -290,7 +292,7 @@ fddi_print(const u_char *p, u_int length, u_int caplen) if (!eflag) fddi_hdr_print(fddip, length + FDDI_HDRLEN, ESRC(&ehdr), EDST(&ehdr)); - if (!suppress_default_print) + if (!xflag && !qflag) default_print(p, caplen); } } diff --git a/contrib/tcpdump/print-fr.c b/contrib/tcpdump/print-fr.c index 189612d..6e5798f 100644 --- a/contrib/tcpdump/print-fr.c +++ b/contrib/tcpdump/print-fr.c @@ -17,11 +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. + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.32.2.12 2005/08/23 03:15:51 guy Exp $ (LBL)"; + "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.32.2.4 2005/05/27 14:56:52 hannes Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -82,20 +84,6 @@ struct tok fr_header_flag_values[] = { { 0, NULL } }; -/* FRF.15 / FRF.16 */ -#define MFR_B_BIT 0x80 -#define MFR_E_BIT 0x40 -#define MFR_C_BIT 0x20 -#define MFR_BEC_MASK (MFR_B_BIT | MFR_E_BIT | MFR_C_BIT) -#define MFR_CTRL_FRAME (MFR_B_BIT | MFR_E_BIT | MFR_C_BIT) -#define MFR_FRAG_FRAME (MFR_B_BIT | MFR_E_BIT ) - -struct tok frf_flag_values[] = { - { MFR_B_BIT, "Begin" }, - { MFR_E_BIT, "End" }, - { MFR_C_BIT, "Control" }, - { 0, NULL } -}; /* Finds out Q.922 address length, DLCI and flags. Returns 0 on success * save the flags dep. on address length @@ -264,6 +252,7 @@ fr_print(register const u_char *p, u_int length) if (eflag) fr_hdr_print(length, addr_len, dlci, flags, nlpid); + p += hdr_len; length -= hdr_len; @@ -289,7 +278,7 @@ fr_print(register const u_char *p, u_int length) if (!eflag) fr_hdr_print(length + hdr_len, hdr_len, dlci, flags, nlpid); - if (!suppress_default_print) + if (!xflag && !qflag) default_print(p - hdr_len, length + hdr_len); } break; @@ -318,191 +307,6 @@ fr_print(register const u_char *p, u_int length) } -#define MFR_CTRL_MSG_ADD_LINK 1 -#define MFR_CTRL_MSG_ADD_LINK_ACK 2 -#define MFR_CTRL_MSG_ADD_LINK_REJ 3 -#define MFR_CTRL_MSG_HELLO 4 -#define MFR_CTRL_MSG_HELLO_ACK 5 -#define MFR_CTRL_MSG_REMOVE_LINK 6 -#define MFR_CTRL_MSG_REMOVE_LINK_ACK 7 - -struct tok mfr_ctrl_msg_values[] = { - { MFR_CTRL_MSG_ADD_LINK, "Add Link" }, - { MFR_CTRL_MSG_ADD_LINK_ACK, "Add Link ACK" }, - { MFR_CTRL_MSG_ADD_LINK_REJ, "Add Link Reject" }, - { MFR_CTRL_MSG_HELLO, "Hello" }, - { MFR_CTRL_MSG_HELLO_ACK, "Hello ACK" }, - { MFR_CTRL_MSG_REMOVE_LINK, "Remove Link" }, - { MFR_CTRL_MSG_REMOVE_LINK_ACK, "Remove Link ACK" }, - { 0, NULL } -}; - -#define MFR_CTRL_IE_BUNDLE_ID 1 -#define MFR_CTRL_IE_LINK_ID 2 -#define MFR_CTRL_IE_MAGIC_NUM 3 -#define MFR_CTRL_IE_TIMESTAMP 5 -#define MFR_CTRL_IE_VENDOR_EXT 6 -#define MFR_CTRL_IE_CAUSE 7 - -struct tok mfr_ctrl_ie_values[] = { - { MFR_CTRL_IE_BUNDLE_ID, "Bundle ID"}, - { MFR_CTRL_IE_LINK_ID, "Link ID"}, - { MFR_CTRL_IE_MAGIC_NUM, "Magic Number"}, - { MFR_CTRL_IE_TIMESTAMP, "Timestamp"}, - { MFR_CTRL_IE_VENDOR_EXT, "Vendor Extension"}, - { MFR_CTRL_IE_CAUSE, "Cause"}, - { 0, NULL } -}; - -#define MFR_ID_STRING_MAXLEN 50 - -struct ie_tlv_header_t { - u_int8_t ie_type; - u_int8_t ie_len; -}; - -u_int -mfr_print(register const u_char *p, u_int length) -{ - u_int tlen,idx,hdr_len = 0; - u_int16_t sequence_num; - u_int8_t ie_type,ie_len; - const u_int8_t *tptr; - - -/* - * FRF.16 Link Integrity Control Frame - * - * 7 6 5 4 3 2 1 0 - * +----+----+----+----+----+----+----+----+ - * | B | E | C=1| 0 0 0 0 | EA | - * +----+----+----+----+----+----+----+----+ - * | 0 0 0 0 0 0 0 0 | - * +----+----+----+----+----+----+----+----+ - * | message type | - * +----+----+----+----+----+----+----+----+ - */ - - TCHECK2(*p, 4); /* minimum frame header length */ - - if ((p[0] & MFR_BEC_MASK) == MFR_CTRL_FRAME && p[1] == 0) { - printf("FRF.16 Control, Flags [%s], %s, length %u", - bittok2str(frf_flag_values,"none",(p[0] & MFR_BEC_MASK)), - tok2str(mfr_ctrl_msg_values,"Unknown Message (0x%02x)",p[2]), - length); - tptr = p + 3; - tlen = length -3; - hdr_len = 3; - - if (!vflag) - return hdr_len; - - while (tlen>sizeof(struct ie_tlv_header_t)) { - TCHECK2(*tptr, sizeof(struct ie_tlv_header_t)); - ie_type=tptr[0]; - ie_len=tptr[1]; - - printf("\n\tIE %s (%u), length %u: ", - tok2str(mfr_ctrl_ie_values,"Unknown",ie_type), - ie_type, - ie_len); - - /* infinite loop check */ - if (ie_type == 0 || ie_len <= sizeof(struct ie_tlv_header_t)) - return hdr_len; - - TCHECK2(*tptr,ie_len); - tptr+=sizeof(struct ie_tlv_header_t); - /* tlv len includes header */ - ie_len-=sizeof(struct ie_tlv_header_t); - tlen-=sizeof(struct ie_tlv_header_t); - - switch (ie_type) { - - case MFR_CTRL_IE_MAGIC_NUM: - printf("0x%08x",EXTRACT_32BITS(tptr)); - break; - - case MFR_CTRL_IE_BUNDLE_ID: /* same message format */ - case MFR_CTRL_IE_LINK_ID: - for (idx = 0; idx < ie_len && idx < MFR_ID_STRING_MAXLEN; idx++) { - if (*(tptr+idx) != 0) /* don't print null termination */ - safeputchar(*(tptr+idx)); - else - break; - } - break; - - case MFR_CTRL_IE_TIMESTAMP: - if (ie_len == sizeof(struct timeval)) { - ts_print((const struct timeval *)tptr); - break; - } - /* fall through and hexdump if no unix timestamp */ - - /* - * FIXME those are the defined IEs that lack a decoder - * you are welcome to contribute code ;-) - */ - - case MFR_CTRL_IE_VENDOR_EXT: - case MFR_CTRL_IE_CAUSE: - - default: - if (vflag <= 1) - print_unknown_data(tptr,"\n\t ",ie_len); - break; - } - - /* do we want to see a hexdump of the IE ? */ - if (vflag > 1 ) - print_unknown_data(tptr,"\n\t ",ie_len); - - tlen-=ie_len; - tptr+=ie_len; - } - return hdr_len; - } -/* - * FRF.16 Fragmentation Frame - * - * 7 6 5 4 3 2 1 0 - * +----+----+----+----+----+----+----+----+ - * | B | E | C=0|seq. (high 4 bits) | EA | - * +----+----+----+----+----+----+----+----+ - * | sequence (low 8 bits) | - * +----+----+----+----+----+----+----+----+ - * | DLCI (6 bits) | CR | EA | - * +----+----+----+----+----+----+----+----+ - * | DLCI (4 bits) |FECN|BECN| DE | EA | - * +----+----+----+----+----+----+----+----+ - */ - - sequence_num = (p[0]&0x1e)<<7 | p[1]; - /* whole packet or first fragment ? */ - if ((p[0] & MFR_BEC_MASK) == MFR_FRAG_FRAME || - (p[0] & MFR_BEC_MASK) == MFR_B_BIT) { - printf("FRF.16 Frag, seq %u, Flags [%s], ", - sequence_num, - bittok2str(frf_flag_values,"none",(p[0] & MFR_BEC_MASK))); - hdr_len = 2; - fr_print(p+hdr_len,length-hdr_len); - return hdr_len; - } - - /* must be a middle or the last fragment */ - printf("FRF.16 Frag, seq %u, Flags [%s]", - sequence_num, - bittok2str(frf_flag_values,"none",(p[0] & MFR_BEC_MASK))); - print_unknown_data(p,"\n\t",length); - - return hdr_len; - - trunc: - printf("[|mfr]"); - return length; -} - /* an NLPID of 0xb1 indicates a 2-byte * FRF.15 header * @@ -518,6 +322,13 @@ mfr_print(register const u_char *p, u_int length) * +----+----+----+----+----+----+----+----+ */ +struct tok frf15_flag_values[] = { + { 0x80, "Begin" }, + { 0x40, "End" }, + { 0x20, "Control" }, + { 0, NULL } +}; + #define FR_FRF15_FRAGTYPE 0x01 static void @@ -525,13 +336,13 @@ frf15_print (const u_char *p, u_int length) { u_int16_t sequence_num, flags; - flags = p[0]&MFR_BEC_MASK; + flags = p[0]&0xe0; sequence_num = (p[0]&0x1e)<<7 | p[1]; printf("FRF.15, seq 0x%03x, Flags [%s],%s Fragmentation, length %u", sequence_num, - bittok2str(frf_flag_values,"none",flags), - p[0]&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End", + bittok2str(frf15_flag_values,"none",flags), + flags&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End", length); /* TODO: @@ -643,10 +454,10 @@ struct tok fr_lmi_report_type_ie_values[] = { { 0, NULL } }; -/* array of 16 codepages - currently we only support codepage 1,5 */ +/* array of 16 codepages - currently we only support codepage 5 */ static struct tok *fr_q933_ie_codesets[] = { NULL, - fr_q933_ie_values_codeset5, + NULL, NULL, NULL, NULL, @@ -663,16 +474,22 @@ static struct tok *fr_q933_ie_codesets[] = { NULL }; -static int fr_q933_print_ie_codeset5(const struct ie_tlv_header_t *ie_p, + +struct common_ie_header { + u_int8_t ie_id; + u_int8_t ie_len; +}; + +static int fr_q933_print_ie_codeset5(const struct common_ie_header *ie_p, const u_char *p); -typedef int (*codeset_pr_func_t)(const struct ie_tlv_header_t *ie_p, +typedef int (*codeset_pr_func_t)(const struct common_ie_header *ie_p, const u_char *p); -/* array of 16 codepages - currently we only support codepage 1,5 */ +/* array of 16 codepages - currently we only support codepage 5 */ static codeset_pr_func_t fr_q933_print_ie_codeset[] = { NULL, - fr_q933_print_ie_codeset5, + NULL, NULL, NULL, NULL, @@ -693,11 +510,10 @@ void q933_print(const u_char *p, u_int length) { const u_char *ptemp = p; - struct ie_tlv_header_t *ie_p; + struct common_ie_header *ie_p; int olen; int is_ansi = 0; u_int codeset; - u_int ie_is_known = 0; if (length < 9) { /* shortest: Q.933a LINK VERIFY */ printf("[|q.933]"); @@ -712,7 +528,7 @@ q933_print(const u_char *p, u_int length) printf("%s", eflag ? "" : "Q.933, "); /* printing out header part */ - printf("%s, codeset %u", is_ansi ? "ANSI" : "CCITT", codeset); + printf(is_ansi ? "ANSI" : "CCITT"); if (p[0]) printf(", Call Ref: 0x%02x", p[0]); @@ -736,10 +552,10 @@ q933_print(const u_char *p, u_int length) ptemp += 2 + is_ansi; /* Loop through the rest of IE */ - while (length > sizeof(struct ie_tlv_header_t )) { - ie_p = (struct ie_tlv_header_t *)ptemp; - if (length < sizeof(struct ie_tlv_header_t ) || - length < sizeof(struct ie_tlv_header_t ) + ie_p->ie_len) { + while (length > sizeof(struct common_ie_header)) { + ie_p = (struct common_ie_header *)ptemp; + if (length < sizeof(struct common_ie_header) || + length < sizeof(struct common_ie_header) + ie_p->ie_len) { if (vflag) /* not bark if there is just a trailer */ printf("\n[|q.933]"); else @@ -751,23 +567,19 @@ q933_print(const u_char *p, u_int length) * however some IEs (DLCI Status, Link Verify) * are also intereststing in non-verbose mode */ if (vflag) - printf("\n\t%s IE (0x%02x), length %u: ", - tok2str(fr_q933_ie_codesets[codeset],"unknown",ie_p->ie_type), - ie_p->ie_type, + printf("\n\t%s IE (%u), length %u: ", + tok2str(fr_q933_ie_codesets[codeset],"unknown",ie_p->ie_id), + ie_p->ie_id, ie_p->ie_len); - - /* sanity check */ - if (ie_p->ie_type == 0 || ie_p->ie_len == 0) - return; - - if (fr_q933_print_ie_codeset[codeset] != NULL) - ie_is_known = fr_q933_print_ie_codeset[codeset](ie_p, ptemp); - - if (vflag >= 1 && !ie_is_known) - print_unknown_data(ptemp+2,"\n\t",ie_p->ie_len); + + if (!fr_q933_print_ie_codeset[codeset] || + (*fr_q933_print_ie_codeset[codeset])(ie_p, ptemp)) { + if (vflag <= 1) + print_unknown_data(ptemp+2,"\n\t",ie_p->ie_len); + } /* do we want to see a hexdump of the IE ? */ - if (vflag> 1 && ie_is_known) + if (vflag> 1) print_unknown_data(ptemp+2,"\n\t ",ie_p->ie_len); length = length - ie_p->ie_len - 2; @@ -778,11 +590,11 @@ q933_print(const u_char *p, u_int length) } static int -fr_q933_print_ie_codeset5(const struct ie_tlv_header_t *ie_p, const u_char *p) +fr_q933_print_ie_codeset5(const struct common_ie_header *ie_p, const u_char *p) { u_int dlci; - switch (ie_p->ie_type) { + switch (ie_p->ie_id) { case FR_LMI_ANSI_REPORT_TYPE_IE: /* fall through */ case FR_LMI_CCITT_REPORT_TYPE_IE: diff --git a/contrib/tcpdump/print-icmp.c b/contrib/tcpdump/print-icmp.c index 191005c..1ef5a68 100644 --- a/contrib/tcpdump/print-icmp.c +++ b/contrib/tcpdump/print-icmp.c @@ -17,6 +17,8 @@ * 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. + * + * $FreeBSD$ */ #ifndef lint diff --git a/contrib/tcpdump/print-ip.c b/contrib/tcpdump/print-ip.c index c5bac0b..9773c29 100644 --- a/contrib/tcpdump/print-ip.c +++ b/contrib/tcpdump/print-ip.c @@ -17,11 +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. + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149.2.2 2005/09/20 06:05:38 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149.2.1 2005/05/20 21:15:46 hannes Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -411,10 +413,6 @@ again: case IPPROTO_SCTP: sctp_print(ipds->cp, (const u_char *)ipds->ip, ipds->len); break; - - case IPPROTO_DCCP: - dccp_print(ipds->cp, (const u_char *)ipds->ip, ipds->len); - break; case IPPROTO_TCP: tcp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip, @@ -669,7 +667,7 @@ ip_print(netdissect_options *ndo, ipds->nh = ipds->ip->ip_p; if (ipds->nh != IPPROTO_TCP && ipds->nh != IPPROTO_UDP && - ipds->nh != IPPROTO_SCTP && ipds->nh != IPPROTO_DCCP) { + ipds->nh != IPPROTO_SCTP) { (void)printf("%s > %s: ", ipaddr_string(&ipds->ip->ip_src), ipaddr_string(&ipds->ip->ip_dst)); diff --git a/contrib/tcpdump/print-ip6.c b/contrib/tcpdump/print-ip6.c index 9361f8f..cdf2f2a 100644 --- a/contrib/tcpdump/print-ip6.c +++ b/contrib/tcpdump/print-ip6.c @@ -17,11 +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. + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47.2.3 2005/09/20 06:05:38 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47.2.2 2005/07/03 20:36:33 hannes Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -116,7 +118,7 @@ ip6_print(register const u_char *bp, register u_int length) if (cp == (const u_char *)(ip6 + 1) && nh != IPPROTO_TCP && nh != IPPROTO_UDP && - nh != IPPROTO_DCCP && nh != IPPROTO_SCTP) { + nh != IPPROTO_SCTP) { (void)printf("%s > %s: ", ip6addr_string(&ip6->ip6_src), ip6addr_string(&ip6->ip6_dst)); } @@ -160,9 +162,6 @@ ip6_print(register const u_char *bp, register u_int length) case IPPROTO_SCTP: sctp_print(cp, (const u_char *)ip6, len); return; - case IPPROTO_DCCP: - dccp_print(cp, (const u_char *)ip6, len); - return; case IPPROTO_TCP: tcp_print(cp, len, (const u_char *)ip6, fragmented); return; diff --git a/contrib/tcpdump/print-ipx.c b/contrib/tcpdump/print-ipx.c index 5309aa4..4afc4b3 100644 --- a/contrib/tcpdump/print-ipx.c +++ b/contrib/tcpdump/print-ipx.c @@ -20,6 +20,8 @@ * * Format and print Novell IPX packets. * Contributed by Brad Parker (brad@fcr.com). + * + * $FreeBSD$ */ #ifndef lint @@ -196,7 +198,7 @@ ipx_rip_print(const u_short *ipx, u_int length) (void)printf("ipx-rip-req"); if (length > 0) { TCHECK(ipx[3]); - (void)printf(" %u/%d.%d", EXTRACT_32BITS(&ipx[0]), + (void)printf(" %x/%d.%d", EXTRACT_32BITS(&ipx[0]), EXTRACT_16BITS(&ipx[2]), EXTRACT_16BITS(&ipx[3])); } break; @@ -204,7 +206,7 @@ ipx_rip_print(const u_short *ipx, u_int length) (void)printf("ipx-rip-resp"); for (i = 0; i < 50 && length > 0; i++) { TCHECK(ipx[3]); - (void)printf(" %u/%d.%d", EXTRACT_32BITS(&ipx[0]), + (void)printf(" %x/%d.%d", EXTRACT_32BITS(&ipx[0]), EXTRACT_16BITS(&ipx[2]), EXTRACT_16BITS(&ipx[3])); ipx += 4; diff --git a/contrib/tcpdump/print-isoclns.c b/contrib/tcpdump/print-isoclns.c index ca2481f..ccfabc7 100644 --- a/contrib/tcpdump/print-isoclns.c +++ b/contrib/tcpdump/print-isoclns.c @@ -22,11 +22,13 @@ * * Extensively modified by Hannes Gredler (hannes@juniper.net) for more * complete IS-IS & CLNP support. + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.133.2.19 2005/09/20 10:15:22 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.133.2.12 2005/06/16 01:14:52 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -110,9 +112,7 @@ static struct tok isis_pdu_values[] = { #define ISIS_TLV_LSP 9 /* iso10589 */ #define ISIS_TLV_AUTH 10 /* iso10589, rfc3567 */ #define ISIS_TLV_CHECKSUM 12 /* rfc3358 */ -#define ISIS_TLV_CHECKSUM_MINLEN 2 #define ISIS_TLV_LSP_BUFFERSIZE 14 /* iso10589 rev2 */ -#define ISIS_TLV_LSP_BUFFERSIZE_MINLEN 2 #define ISIS_TLV_EXT_IS_REACH 22 /* draft-ietf-isis-traffic-05 */ #define ISIS_TLV_IS_ALIAS_ID 24 /* draft-ietf-isis-ext-lsp-frags-02 */ #define ISIS_TLV_DECNET_PHASE4 42 @@ -121,7 +121,6 @@ static struct tok isis_pdu_values[] = { #define ISIS_TLV_PROTOCOLS 129 /* rfc1195 */ #define ISIS_TLV_EXT_IP_REACH 130 /* rfc1195, rfc2966 */ #define ISIS_TLV_IDRP_INFO 131 /* rfc1195 */ -#define ISIS_TLV_IDRP_INFO_MINLEN 1 #define ISIS_TLV_IPADDR 132 /* rfc1195 */ #define ISIS_TLV_IPAUTH 133 /* rfc1195 */ #define ISIS_TLV_TE_ROUTER_ID 134 /* draft-ietf-isis-traffic-05 */ @@ -131,20 +130,15 @@ static struct tok isis_pdu_values[] = { #define ISIS_TLV_NORTEL_PRIVATE1 176 #define ISIS_TLV_NORTEL_PRIVATE2 177 #define ISIS_TLV_RESTART_SIGNALING 211 /* rfc3847 */ -#define ISIS_TLV_RESTART_SIGNALING_FLAGLEN 1 -#define ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN 2 #define ISIS_TLV_MT_IS_REACH 222 /* draft-ietf-isis-wg-multi-topology-05 */ #define ISIS_TLV_MT_SUPPORTED 229 /* draft-ietf-isis-wg-multi-topology-05 */ -#define ISIS_TLV_MT_SUPPORTED_MINLEN 2 #define ISIS_TLV_IP6ADDR 232 /* draft-ietf-isis-ipv6-02 */ #define ISIS_TLV_MT_IP_REACH 235 /* draft-ietf-isis-wg-multi-topology-05 */ #define ISIS_TLV_IP6_REACH 236 /* draft-ietf-isis-ipv6-02 */ #define ISIS_TLV_MT_IP6_REACH 237 /* draft-ietf-isis-wg-multi-topology-05 */ #define ISIS_TLV_PTP_ADJ 240 /* rfc3373 */ #define ISIS_TLV_IIH_SEQNR 241 /* draft-shen-isis-iih-sequence-00 */ -#define ISIS_TLV_IIH_SEQNR_MINLEN 4 #define ISIS_TLV_VENDOR_PRIVATE 250 /* draft-ietf-isis-experimental-tlv-01 */ -#define ISIS_TLV_VENDOR_PRIVATE_MINLEN 3 static struct tok isis_tlv_values[] = { { ISIS_TLV_AREA_ADDR, "Area address(es)"}, @@ -344,12 +338,11 @@ static struct tok clnp_option_qos_global_values[] = { #define ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR 8 /* draft-ietf-isis-traffic-05 */ #define ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW 9 /* draft-ietf-isis-traffic-05 */ #define ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW 10 /* draft-ietf-isis-traffic-05 */ -#define ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW 11 /* rfc4124 */ -#define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD 12 /* draft-ietf-tewg-diff-te-proto-06 */ +#define ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW 11 /* draft-ietf-isis-traffic-05 */ +#define ISIS_SUBTLV_EXT_IS_REACH_DIFFSERV_TE 12 /* draft-ietf-tewg-diff-te-proto-06 */ #define ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC 18 /* draft-ietf-isis-traffic-05 */ #define ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20 /* draft-ietf-isis-gmpls-extensions */ #define ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR 21 /* draft-ietf-isis-gmpls-extensions */ -#define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS 22 /* rfc4124 */ static struct tok isis_ext_is_reach_subtlv_values[] = { { ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP, "Administrative groups" }, @@ -360,11 +353,10 @@ static struct tok isis_ext_is_reach_subtlv_values[] = { { ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW, "Maximum link bandwidth" }, { ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW, "Reservable link bandwidth" }, { ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW, "Unreserved bandwidth" }, + { ISIS_SUBTLV_EXT_IS_REACH_DIFFSERV_TE, "Diffserv TE" }, { ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC, "Traffic Engineering Metric" }, { ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE, "Link Protection Type" }, { ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR, "Interface Switching Capability" }, - { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD, "Bandwidth Constraints (old)" }, - { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS, "Bandwidth Constraints" }, { 250, "Reserved for cisco specific extensions" }, { 251, "Reserved for cisco specific extensions" }, { 252, "Reserved for cisco specific extensions" }, @@ -790,7 +782,6 @@ static int clnp_print (const u_int8_t *pptr, u_int length) if (clnp_flags & CLNP_SEGMENT_PART) { clnp_segment_header = (const struct clnp_segment_header_t *) pptr; - TCHECK(*clnp_segment_header); printf("\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u", EXTRACT_16BITS(clnp_segment_header->data_unit_id), EXTRACT_16BITS(clnp_segment_header->segment_offset), @@ -851,7 +842,7 @@ static int clnp_print (const u_int8_t *pptr, u_int length) if (tlen < source_address_length+1) { printf("\n\t NSAP address goes past end of option"); break; - } + } if (source_address_length > 0) { source_address=(tptr+1); TCHECK2(*source_address, source_address_length); @@ -1409,9 +1400,9 @@ trunctlv: */ static int -isis_print_is_reach_subtlv (const u_int8_t *tptr,u_int subt,u_int subl,const char *ident) { +isis_print_is_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *ident) { - u_int te_class,priority_level; + int priority_level,bandwidth_constraint; union { /* int to float conversion buffer for several subTLVs */ float f; u_int32_t i; @@ -1441,7 +1432,7 @@ isis_print_is_reach_subtlv (const u_int8_t *tptr,u_int subt,u_int subl,const cha break; case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR: case ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR: - if (subl >= sizeof(struct in_addr)) + if (subl >= 4) printf(", %s", ipaddr_string(tptr)); break; case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW : @@ -1453,29 +1444,28 @@ isis_print_is_reach_subtlv (const u_int8_t *tptr,u_int subt,u_int subl,const cha break; case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW : if (subl >= 32) { - for (te_class = 0; te_class < 8; te_class++) { + for (priority_level = 0; priority_level < 8; priority_level++) { bw.i = EXTRACT_32BITS(tptr); - printf("%s TE-Class %u: %.3f Mbps", + printf("%s priority level %d: %.3f Mbps", ident, - te_class, + priority_level, bw.f*8/1000000 ); tptr+=4; } } break; - case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS: /* fall through */ - case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD: + case ISIS_SUBTLV_EXT_IS_REACH_DIFFSERV_TE: printf("%sBandwidth Constraints Model ID: %s (%u)", ident, tok2str(diffserv_te_bc_values, "unknown", *tptr), *tptr); tptr++; /* decode BCs until the subTLV ends */ - for (te_class = 0; te_class < (subl-1)/4; te_class++) { + for (bandwidth_constraint = 0; bandwidth_constraint < (subl-1)/4; bandwidth_constraint++) { bw.i = EXTRACT_32BITS(tptr); - printf("%s Bandwidth constraint CT%u: %.3f Mbps", + printf("%s Bandwidth constraint %d: %.3f Mbps", ident, - te_class, + bandwidth_constraint, bw.f*8/1000000 ); tptr+=4; } @@ -1616,7 +1606,7 @@ static int isis_print_extd_ip_reach (const u_int8_t *tptr, const char *ident, u_int16_t afi) { char ident_buffer[20]; - u_int8_t prefix[sizeof(struct in6_addr)]; /* shared copy buffer for IPv4 and IPv6 prefixes */ + u_int8_t prefix[16]; /* shared copy buffer for IPv4 and IPv6 prefixes */ u_int metric, status_byte, bit_length, byte_length, sublen, processed, subtlvtype, subtlvlen; if (!TTEST2(*tptr, 4)) @@ -1646,7 +1636,7 @@ isis_print_extd_ip_reach (const u_int8_t *tptr, const char *ident, u_int16_t afi if (!TTEST2(*tptr, byte_length)) return (0); - memset(prefix, 0, sizeof(struct in6_addr)); /* clear the copy buffer */ + memset(prefix, 0, 16); /* clear the copy buffer */ memcpy(prefix,tptr,byte_length); /* copy as much as is stored in the TLV */ tptr+=byte_length; processed+=byte_length; @@ -2274,15 +2264,15 @@ static int isis_print (const u_int8_t *p, u_int length) break; case ISIS_TLV_IP6ADDR: - while (tmp>=sizeof(struct in6_addr)) { - if (!TTEST2(*tptr, sizeof(struct in6_addr))) + while (tmp>=16) { + if (!TTEST2(*tptr, 16)) goto trunctlv; printf("\n\t IPv6 interface address: %s", ip6addr_string(tptr)); - tptr += sizeof(struct in6_addr); - tmp -= sizeof(struct in6_addr); + tptr += 16; + tmp -= 16; } break; #endif @@ -2372,18 +2362,18 @@ static int isis_print (const u_int8_t *p, u_int length) break; case ISIS_TLV_TE_ROUTER_ID: - if (!TTEST2(*pptr, sizeof(struct in_addr))) + if (!TTEST2(*pptr, 4)) goto trunctlv; printf("\n\t Traffic Engineering Router ID: %s", ipaddr_string(pptr)); break; case ISIS_TLV_IPADDR: - while (tmp>=sizeof(struct in_addr)) { - if (!TTEST2(*tptr, sizeof(struct in_addr))) + while (tmp>=4) { + if (!TTEST2(*tptr, 4)) goto trunctlv; printf("\n\t IPv4 interface address: %s", ipaddr_string(tptr)); - tptr += sizeof(struct in_addr); - tmp -= sizeof(struct in_addr); + tptr += 4; + tmp -= 4; } break; @@ -2413,21 +2403,21 @@ static int isis_print (const u_int8_t *p, u_int length) printf(", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(*tptr++) ? "numbered" : "unnumbered"); tmp--; - if (tmp < sizeof(struct in_addr)) + if (tmp < 4) break; - if (!TTEST2(*tptr,sizeof(struct in_addr))) + if (!TTEST2(*tptr,4)) goto trunctlv; printf("\n\t IPv4 interface address: %s", ipaddr_string(tptr)); - tptr+=sizeof(struct in_addr); - tmp-=sizeof(struct in_addr); + tptr+=4; + tmp-=4; - if (tmp < sizeof(struct in_addr)) + if (tmp < 4) break; - if (!TTEST2(*tptr,sizeof(struct in_addr))) + if (!TTEST2(*tptr,4)) goto trunctlv; printf("\n\t IPv4 neighbor address: %s", ipaddr_string(tptr)); - tptr+=sizeof(struct in_addr); - tmp-=sizeof(struct in_addr); + tptr+=4; + tmp-=4; while (tmp>=4) { if (!TTEST2(*tptr, 4)) @@ -2460,9 +2450,9 @@ static int isis_print (const u_int8_t *p, u_int length) break; case ISIS_TLV_CHECKSUM: - if (tmp < ISIS_TLV_CHECKSUM_MINLEN) + if (tmp < 2) break; - if (!TTEST2(*tptr, ISIS_TLV_CHECKSUM_MINLEN)) + if (!TTEST2(*tptr, 2)) goto trunctlv; printf("\n\t checksum: 0x%04x ", EXTRACT_16BITS(tptr)); /* do not attempt to verify the checksum if it is zero @@ -2476,8 +2466,6 @@ static int isis_print (const u_int8_t *p, u_int length) break; case ISIS_TLV_MT_SUPPORTED: - if (tmp < ISIS_TLV_MT_SUPPORTED_MINLEN) - break; while (tmp>1) { /* length can only be a multiple of 2, otherwise there is something broken -> so decode down until length is 1 */ @@ -2495,41 +2483,30 @@ static int isis_print (const u_int8_t *p, u_int length) break; case ISIS_TLV_RESTART_SIGNALING: - /* first attempt to decode the flags */ - if (tmp < ISIS_TLV_RESTART_SIGNALING_FLAGLEN) - break; - if (!TTEST2(*tptr, ISIS_TLV_RESTART_SIGNALING_FLAGLEN)) - goto trunctlv; - printf("\n\t Flags [%s]", - bittok2str(isis_restart_flag_values, "none", *tptr)); - tptr+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN; - tmp-=ISIS_TLV_RESTART_SIGNALING_FLAGLEN; - - /* is there anything other than the flags field? */ - if (tmp == 0) - break; - - if (tmp < ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN) - break; - if (!TTEST2(*tptr, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN)) + if (tmp < 3) + break; + if (!TTEST2(*tptr, 3)) goto trunctlv; - - printf(", Remaining holding time %us", EXTRACT_16BITS(tptr+1)); - tptr+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN; - tmp-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN; - - /* is there an additional sysid field present ?*/ + printf("\n\t Flags [%s], Remaining holding time %us", + bittok2str(isis_restart_flag_values, "none", *tptr), + EXTRACT_16BITS(tptr+1)); + tptr+=3; + tmp-=3; if (tmp == SYSTEM_ID_LEN) { if (!TTEST2(*tptr, SYSTEM_ID_LEN)) goto trunctlv; printf(", for %s",isis_print_id(tptr,SYSTEM_ID_LEN)); - } + } else if (tmp == NODE_ID_LEN) { + if (!TTEST2(*tptr, NODE_ID_LEN)) + goto trunctlv; + printf(", for %s",isis_print_id(tptr,NODE_ID_LEN)); + } break; case ISIS_TLV_IDRP_INFO: - if (tmp < ISIS_TLV_IDRP_INFO_MINLEN) + if (tmp < 1) break; - if (!TTEST2(*tptr, ISIS_TLV_IDRP_INFO_MINLEN)) + if (!TTEST2(*tptr, 1)) goto trunctlv; printf("\n\t Inter-Domain Information Type: %s", tok2str(isis_subtlv_idrp_values, @@ -2551,9 +2528,9 @@ static int isis_print (const u_int8_t *p, u_int length) break; case ISIS_TLV_LSP_BUFFERSIZE: - if (tmp < ISIS_TLV_LSP_BUFFERSIZE_MINLEN) + if (tmp < 2) break; - if (!TTEST2(*tptr, ISIS_TLV_LSP_BUFFERSIZE_MINLEN)) + if (!TTEST2(*tptr, 2)) goto trunctlv; printf("\n\t LSP Buffersize: %u",EXTRACT_16BITS(tptr)); break; @@ -2600,17 +2577,17 @@ static int isis_print (const u_int8_t *p, u_int length) break; case ISIS_TLV_IIH_SEQNR: - if (tmp < ISIS_TLV_IIH_SEQNR_MINLEN) + if (tmp < 4) break; - if (!TTEST2(*tptr, ISIS_TLV_IIH_SEQNR_MINLEN)) /* check if four bytes are on the wire */ + if (!TTEST2(*tptr, 4)) /* check if four bytes are on the wire */ goto trunctlv; printf("\n\t Sequence number: %u", EXTRACT_32BITS(tptr) ); break; case ISIS_TLV_VENDOR_PRIVATE: - if (tmp < ISIS_TLV_VENDOR_PRIVATE_MINLEN) + if (tmp < 3) break; - if (!TTEST2(*tptr, ISIS_TLV_VENDOR_PRIVATE_MINLEN)) /* check if enough byte for a full oui */ + if (!TTEST2(*tptr, 3)) /* check if enough byte for a full oui */ goto trunctlv; vendor_id = EXTRACT_24BITS(tptr); printf("\n\t Vendor: %s (%u)", diff --git a/contrib/tcpdump/print-lcp.c b/contrib/tcpdump/print-lcp.c deleted file mode 100644 index ddea9c6..0000000 --- a/contrib/tcpdump/print-lcp.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that: (1) source code distributions - * retain the above copyright notice and this paragraph in its entirety, (2) - * distributions including binary code include the above copyright notice and - * this paragraph in its entirety in the documentation or other materials - * provided with the distribution, and (3) all advertising materials mentioning - * features or use of this software display the following acknowledgement: - * ``This product includes software developed by the University of California, - * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of - * the University nor the names of its contributors may be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef lint -static const char rcsid[] = -"@(#) $Header: /tcpdump/master/tcpdump/print-lcp.c,v 1.9 2000/10/06 04:23:12 guy Exp $ (LBL)"; -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <sys/param.h> -#include <sys/time.h> -#include <sys/socket.h> - -#include <netinet/in.h> - -#include <stdio.h> -#include <string.h> - -#include "interface.h" -#include "addrtoname.h" -#include "extract.h" /* must come after interface.h */ -#include "ppp.h" - -/* Codes */ -enum { - LCP_CONFREQ = 1, - LCP_CONFACK = 2, - LCP_CONFNAK = 3, - LCP_CONFREJ = 4, - LCP_TERMREQ = 5, - LCP_TERMACK = 6, - LCP_CODEREJ = 7, - LCP_PROTREJ = 8, - LCP_ECHOREQ = 9, - LCP_ECHOREP = 10, - LCP_DISCARD = 11 -}; - -static struct tok lcpcode2str[] = { - { LCP_CONFREQ, "ConfReq" }, - { LCP_CONFACK, "ConfAck" }, - { LCP_CONFNAK, "ConfNak" }, - { LCP_CONFREJ, "ConfRej" }, - { LCP_TERMREQ, "TermReq" }, - { LCP_TERMACK, "TermAck" }, - { LCP_CODEREJ, "CodeRej" }, - { LCP_PROTREJ, "ProtRej" }, - { LCP_ECHOREQ, "EchoReq" }, - { LCP_ECHOREP, "EchoRep" }, - { LCP_DISCARD, "Discard" }, - { 0, NULL } -}; - - -enum { - LCP_RESERVED = 0, - LCP_MRU = 1, - LCP_ASYNCMAP = 2, - LCP_AUTHPROTO = 3, - LCP_QUALPROTO = 4, - LCP_MAGICNUM = 5, - LCP_PCOMP = 7, - LCP_ACFCOMP = 8, - LCP_CALLBACK = 13 -}; - -static struct tok lcpoption2str[] = { - { LCP_RESERVED, "reserved"}, - { LCP_MRU, "mru"}, - { LCP_ASYNCMAP, "asyncmap"}, - { LCP_AUTHPROTO, "auth"}, - { LCP_QUALPROTO, "qual"}, - { LCP_MAGICNUM, "magic"}, - { LCP_PCOMP, "pcomp"}, - { LCP_ACFCOMP, "acfcomp"}, - { LCP_CALLBACK, "callback"}, - { 0, NULL } -}; - -static struct tok lcpauth2str[] = { - {0xc023, "PAP"}, - {0xc223, "CHAP"}, - { 0, NULL } -}; - -static struct tok lcpqual2str[] = { - {0xc025, "LQR"}, - { 0, NULL } -}; - -static struct tok lcpchap2str[] = { - {0x05, "MD5"}, - {0x80, "MS"}, - { 0, NULL } -}; - -void -lcp_print(register const u_char *bp, u_int length) -{ - u_short lcp_code, lcp_id, lcp_length; - const u_char *lcp_data; - - lcp_data = bp+4; - - if (snapend < lcp_data) { - printf(" [LCP|]"); - return; - } - - lcp_code = bp[0]; - lcp_id = bp[1]; - lcp_length = EXTRACT_16BITS(bp+2); - - printf("LCP %s id=0x%x", tok2str(lcpcode2str, "LCP-#%d", lcp_code), lcp_id); - - switch (lcp_code) { - case LCP_CONFREQ: - case LCP_CONFACK: - case LCP_CONFNAK: - case LCP_CONFREJ: - /* Print Options */ - { - u_char lcpopt_type, lcpopt_length; - const u_char *p=lcp_data; - while (p+2 < lcp_data+lcp_length && p+2 < snapend) { - lcpopt_type = p[0]; - lcpopt_length = p[1]; - p+=2; - printf(" <%s ",tok2str(lcpoption2str, "option-#%d", lcpopt_type)); - if (lcpopt_length) - switch (lcpopt_type) { - case LCP_MRU: - if (snapend < p+2) return; - printf("%d",ntohs(*(u_short*)p)); - if (lcpopt_length != 4) printf(" len=%d!",lcpopt_length); - break; - case LCP_AUTHPROTO: - if (snapend < p+2) return; - printf("%s",tok2str(lcpauth2str, "AUTH-%#x", ntohs(*(u_short*)p))); - if (lcpopt_length < 4) printf(" len=%d!",lcpopt_length); - if (lcpopt_length >= 5 && p < snapend) - printf(" %s",tok2str(lcpchap2str, "%#x", p[0])); - break; - case LCP_QUALPROTO: - if (snapend < p+2) return; - printf("%s",tok2str(lcpqual2str, "QUAL-%#x", ntohs(*(u_short*)p))); - if (lcpopt_length < 4) printf(" len=%d!",lcpopt_length); - /* Print data field of auth? */ - break; - case LCP_ASYNCMAP: - case LCP_MAGICNUM: - if (snapend < p+4) return; - printf("%#x", (unsigned)ntohl(*(u_long*)p)); - if (lcpopt_length != 6) printf(" len=%d!",lcpopt_length); - break; - case LCP_PCOMP: - case LCP_ACFCOMP: - case LCP_RESERVED: - if (lcpopt_length != 2) printf(" len=%d!",lcpopt_length); - break; - default: - if (lcpopt_length != 2) printf(" len=%d",lcpopt_length); - break; - } - printf(">"); - p+=lcpopt_length-2; - } - } - break; - case LCP_ECHOREQ: - case LCP_ECHOREP: - case LCP_DISCARD: - if (snapend < lcp_data+4) return; - printf(" magic=%#x", (unsigned)ntohl(*(u_long *) lcp_data)); - lcp_data +=4; - break; - case LCP_PROTREJ: - if (snapend < lcp_data+2) return; - printf(" prot=%s", tok2str(ppptype2str, "PROT-%#x", ntohs(*(u_short *) lcp_data))); - /* TODO print rejected packet too ? */ - break; - case LCP_CODEREJ: - if (snapend < lcp_data+4) return; - printf(" "); - lcp_print(lcp_data, (lcp_length+lcp_data > snapend ? snapend-lcp_data : lcp_length)); - break; - case LCP_TERMREQ: - case LCP_TERMACK: - break; - default: - break; - } - - return; -} diff --git a/contrib/tcpdump/print-llc.c b/contrib/tcpdump/print-llc.c index dcb740b..cc665f5 100644 --- a/contrib/tcpdump/print-llc.c +++ b/contrib/tcpdump/print-llc.c @@ -20,11 +20,13 @@ * * Code by Matt Thomas, Digital Equipment Corporation * with an awful lot of hacking by Jeffrey Mogul, DECWRL + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61.2.5 2005/09/29 07:40:13 hannes Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61.2.4 2005/04/26 07:27:16 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -50,7 +52,6 @@ static struct tok llc_values[] = { { LLCSAP_8021B_I, "802.1B I" }, { LLCSAP_8021B_G, "802.1B G" }, { LLCSAP_IP, "IP" }, - { LLCSAP_SNA, "SNA" }, { LLCSAP_PROWAYNM, "ProWay NM" }, { LLCSAP_8021D, "STP" }, { LLCSAP_RS511, "RS511" }, @@ -63,7 +64,7 @@ static struct tok llc_values[] = { { 0, NULL }, }; -static struct tok llc_cmd_values[] = { +static struct tok cmd2str[] = { { LLC_UI, "ui" }, { LLC_TEST, "test" }, { LLC_XID, "xid" }, @@ -75,23 +76,6 @@ static struct tok llc_cmd_values[] = { { 0, NULL } }; -static const struct tok llc_flag_values[] = { - { 0, "Command" }, - { LLC_GSAP, "Response" }, - { LLC_U_POLL, "Poll" }, - { LLC_GSAP|LLC_U_POLL, "Final" }, - { LLC_GSAP|LLC_IS_POLL, "Final" }, - { 0, NULL } -}; - -static const struct tok llc_supervisory_values[] = { - { 0, "Receiver Ready" }, - { 1, "Reject" }, - { 2, "Receiver not Ready" }, - { 0, NULL } -}; - - static const struct tok cisco_values[] = { { PID_CISCO_CDP, "CDP" }, { 0, NULL } @@ -133,7 +117,7 @@ int llc_print(const u_char *p, u_int length, u_int caplen, const u_char *esrc, const u_char *edst, u_short *extracted_ethertype) { - u_int8_t dsap_field, dsap, ssap_field, ssap; + u_int8_t dsap, ssap; u_int16_t control; int is_u; register int ret; @@ -144,10 +128,8 @@ llc_print(const u_char *p, u_int length, u_int caplen, return(0); } - dsap_field = *p; - dsap = dsap_field & ~LLC_IG; - ssap_field = *(p + 1); - ssap = ssap_field & ~LLC_GSAP; + dsap = *p; + ssap = *(p + 1); /* * OK, what type of LLC frame is this? The length @@ -196,23 +178,27 @@ llc_print(const u_char *p, u_int length, u_int caplen, */ if (eflag) - printf("IPX 802.3: "); + printf("IPX-802.3: "); ipx_print(p, length); return (1); } if (eflag) { - printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x)", - tok2str(llc_values, "Unknown", dsap), - dsap, - tok2str(llc_values, "Unknown", ssap), - ssap); - if (is_u) { - printf(", cmd 0x%02x: ", control); + printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x), cmd 0x%02x: ", + tok2str(llc_values, "Unknown", dsap), + dsap, + tok2str(llc_values, "Unknown", ssap), + ssap, + control); } else { - printf(", cmd 0x%04x: ", control); + printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x), cmd 0x%04x: ", + tok2str(llc_values, "Unknown", dsap), + dsap, + tok2str(llc_values, "Unknown", ssap), + ssap, + control); } } @@ -237,9 +223,7 @@ llc_print(const u_char *p, u_int length, u_int caplen, * * Skip DSAP, LSAP, and control field. */ - if (eflag) - printf("IPX 802.2: "); - + printf("(NOV-802.2) "); ipx_print(p+3, length-3); return (1); } @@ -294,33 +278,42 @@ llc_print(const u_char *p, u_int length, u_int caplen, } if (!eflag) { - if (ssap == dsap) { + if ((ssap & ~LLC_GSAP) == dsap) { if (esrc == NULL || edst == NULL) - (void)printf("%s ", tok2str(llc_values, "Unknown DSAP 0x%02x", dsap)); + (void)printf("%s ", llcsap_string(dsap)); else (void)printf("%s > %s %s ", etheraddr_string(esrc), etheraddr_string(edst), - tok2str(llc_values, "Unknown DSAP 0x%02x", dsap)); + llcsap_string(dsap)); } else { if (esrc == NULL || edst == NULL) (void)printf("%s > %s ", - tok2str(llc_values, "Unknown SSAP 0x%02x", ssap), - tok2str(llc_values, "Unknown DSAP 0x%02x", dsap)); + llcsap_string(ssap & ~LLC_GSAP), + llcsap_string(dsap)); else (void)printf("%s %s > %s %s ", etheraddr_string(esrc), - tok2str(llc_values, "Unknown SSAP 0x%02x", ssap), + llcsap_string(ssap & ~LLC_GSAP), etheraddr_string(edst), - tok2str(llc_values, "Unknown DSAP 0x%02x", dsap)); + llcsap_string(dsap)); } } if (is_u) { - printf("Unnumbered, %s, Flags [%s], length %u", - tok2str(llc_cmd_values, "%02x", LLC_U_CMD(control)), - bittok2str(llc_flag_values,"?",(ssap) | (control & LLC_U_POLL)), - length); + const char *m; + char f; + + m = tok2str(cmd2str, "%02x", LLC_U_CMD(control)); + switch ((ssap & LLC_GSAP) | (control & LLC_U_POLL)) { + case 0: f = 'C'; break; + case LLC_GSAP: f = 'R'; break; + case LLC_U_POLL: f = 'P'; break; + case LLC_GSAP|LLC_U_POLL: f = 'F'; break; + default: f = '?'; break; + } + + printf("%s/%c", m, f); p += 3; length -= 3; @@ -335,19 +328,27 @@ llc_print(const u_char *p, u_int length, u_int caplen, } } } else { + char f; + + switch ((ssap & LLC_GSAP) | (control & LLC_IS_POLL)) { + case 0: f = 'C'; break; + case LLC_GSAP: f = 'R'; break; + case LLC_IS_POLL: f = 'P'; break; + case LLC_GSAP|LLC_IS_POLL: f = 'F'; break; + default: f = '?'; break; + } if ((control & LLC_S_FMT) == LLC_S_FMT) { - (void)printf("Supervisory, %s, rcv seq %u, Flags [%s], length %u", - tok2str(llc_supervisory_values,"?",LLC_S_CMD(control)), + static const char *llc_s[] = { "rr", "rej", "rnr", "03" }; + (void)printf("%s (r=%d,%c)", + llc_s[LLC_S_CMD(control)], LLC_IS_NR(control), - bittok2str(llc_flag_values,"?",(ssap) | (control & LLC_IS_POLL)), - length); + f); } else { - (void)printf("Information, send seq %u, rcv seq %u, Flags [%s], length %u", + (void)printf("I (s=%d,r=%d,%c)", LLC_I_NS(control), LLC_IS_NR(control), - bittok2str(llc_flag_values,"?",(ssap) | (control & LLC_IS_POLL)), - length); + f); } p += 4; length -= 4; diff --git a/contrib/tcpdump/print-nfs.c b/contrib/tcpdump/print-nfs.c index a702170..8929d73 100644 --- a/contrib/tcpdump/print-nfs.c +++ b/contrib/tcpdump/print-nfs.c @@ -17,6 +17,8 @@ * 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. + * + * $FreeBSD$ */ #ifndef lint diff --git a/contrib/tcpdump/print-ntp.c b/contrib/tcpdump/print-ntp.c index 606a654..9e8ccfa 100644 --- a/contrib/tcpdump/print-ntp.c +++ b/contrib/tcpdump/print-ntp.c @@ -21,6 +21,8 @@ * Format and print ntp packets. * By Jeffrey Mogul/DECWRL * loosely based on print-bootp.c + * + * $FreeBSD$ */ #ifndef lint diff --git a/contrib/tcpdump/print-null.c b/contrib/tcpdump/print-null.c index 7fd4541..04254d2 100644 --- a/contrib/tcpdump/print-null.c +++ b/contrib/tcpdump/print-null.c @@ -17,11 +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. + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.53.2.3 2005/07/07 01:24:38 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.53.2.2 2005/05/19 07:26:18 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -173,7 +175,7 @@ null_if_print(const struct pcap_pkthdr *h, const u_char *p) /* unknown AF_ value */ if (!eflag) null_hdr_print(family, length + NULL_HDRLEN); - if (!suppress_default_print) + if (!xflag && !qflag) default_print(p, caplen); } diff --git a/contrib/tcpdump/print-pim.c b/contrib/tcpdump/print-pim.c index 8af2160..d4bafe4 100644 --- a/contrib/tcpdump/print-pim.c +++ b/contrib/tcpdump/print-pim.c @@ -17,11 +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. + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.45.2.3 2005/07/11 20:24:34 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.45.2.2 2005/04/20 22:08:44 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -140,7 +142,7 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len) return; } - TCHECK2(bp[0], sizeof(struct in_addr)); + TCHECK2(bp[0], 4); if (vflag > 1) (void)printf("\n"); (void)printf(" Upstream Nbr: %s", ipaddr_string(bp)); @@ -165,9 +167,9 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len) * XXX - does the address have length "addrlen" and the * mask length "maddrlen"? */ - TCHECK2(bp[0], sizeof(struct in_addr)); + TCHECK2(bp[0], 4); (void)printf("\n\tGroup: %s", ipaddr_string(bp)); - TCHECK2(bp[4], sizeof(struct in_addr)); + TCHECK2(bp[4], 4); if (EXTRACT_32BITS(&bp[4]) != 0xffffffff) (void)printf("/%s", ipaddr_string(&bp[4])); TCHECK2(bp[8], 4); @@ -247,7 +249,7 @@ pimv1_print(register const u_char *bp, register u_int len) break; case 2: (void)printf(" Register-Stop"); - TCHECK2(bp[12], sizeof(struct in_addr)); + TCHECK2(bp[12], 4); (void)printf(" for %s > %s", ipaddr_string(&bp[8]), ipaddr_string(&bp[12])); break; @@ -270,7 +272,7 @@ pimv1_print(register const u_char *bp, register u_int len) break; case 5: (void)printf(" Assert"); - TCHECK2(bp[16], sizeof(struct in_addr)); + TCHECK2(bp[16], 4); (void)printf(" for %s > %s", ipaddr_string(&bp[16]), ipaddr_string(&bp[8])); if (EXTRACT_32BITS(&bp[12]) != 0xffffffff) @@ -520,12 +522,12 @@ pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent) switch (bp[0]) { case 1: af = AF_INET; - len = sizeof(struct in_addr); + len = 4; break; #ifdef INET6 case 2: af = AF_INET6; - len = sizeof(struct in6_addr); + len = 16; break; #endif default: @@ -536,11 +538,11 @@ pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent) hdrlen = 2; } else { switch (pimv2_addr_len) { - case sizeof(struct in_addr): + case 4: af = AF_INET; break; #ifdef INET6 - case sizeof(struct in6_addr): + case 16: af = AF_INET6; break; #endif diff --git a/contrib/tcpdump/print-ppp.c b/contrib/tcpdump/print-ppp.c index b6bafae..3c48c78 100644 --- a/contrib/tcpdump/print-ppp.c +++ b/contrib/tcpdump/print-ppp.c @@ -20,6 +20,8 @@ * * Extensively modified by Motonori Shindo (mshindo@mshindo.net) for more * complete PPP support. + * + * $FreeBSD$ */ /* diff --git a/contrib/tcpdump/print-sl.c b/contrib/tcpdump/print-sl.c index f28a21a..97389d8 100644 --- a/contrib/tcpdump/print-sl.c +++ b/contrib/tcpdump/print-sl.c @@ -17,6 +17,8 @@ * 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. + * + * $FreeBSD$ */ #ifndef lint diff --git a/contrib/tcpdump/print-sunrpc.c b/contrib/tcpdump/print-sunrpc.c index 03e28a4..420ec36 100644 --- a/contrib/tcpdump/print-sunrpc.c +++ b/contrib/tcpdump/print-sunrpc.c @@ -17,6 +17,8 @@ * 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. + * + * $FreeBSD$ */ #ifndef lint diff --git a/contrib/tcpdump/print-token.c b/contrib/tcpdump/print-token.c index a2b3d0f..3f8e215 100644 --- a/contrib/tcpdump/print-token.c +++ b/contrib/tcpdump/print-token.c @@ -22,10 +22,12 @@ * * Further tweaked to more closely resemble print-fddi.c * Guy Harris <guy@alum.mit.edu> + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.25.2.1 2005/07/07 01:24:40 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.25 2004/03/17 23:24:38 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -167,7 +169,7 @@ token_print(const u_char *p, u_int length, u_int caplen) printf("(LLC %s) ", etherproto_string(htons(extracted_ethertype))); } - if (!suppress_default_print) + if (!xflag && !qflag) default_print(p, caplen); } } else { @@ -176,7 +178,7 @@ token_print(const u_char *p, u_int length, u_int caplen) if (!eflag) token_hdr_print(trp, length + TOKEN_HDRLEN + route_len, ESRC(&ehdr), EDST(&ehdr)); - if (!suppress_default_print) + if (!xflag && !qflag) default_print(p, caplen); } return (hdr_len); diff --git a/contrib/tcpdump/print-udp.c b/contrib/tcpdump/print-udp.c index 87da886..089da1a 100644 --- a/contrib/tcpdump/print-udp.c +++ b/contrib/tcpdump/print-udp.c @@ -17,6 +17,8 @@ * 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. + * + * $FreeBSD$ */ #ifndef lint diff --git a/contrib/tcpdump/savestr.c b/contrib/tcpdump/savestr.c deleted file mode 100644 index a81227c..0000000 --- a/contrib/tcpdump/savestr.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 1997 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that: (1) source code distributions - * retain the above copyright notice and this paragraph in its entirety, (2) - * distributions including binary code include the above copyright notice and - * this paragraph in its entirety in the documentation or other materials - * provided with the distribution, and (3) all advertising materials mentioning - * features or use of this software display the following acknowledgement: - * ``This product includes software developed by the University of California, - * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of - * the University nor the names of its contributors may be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/Attic/savestr.c,v 1.6 2000/07/11 00:49:02 assar Exp $ (LBL)"; -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <sys/types.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#ifdef HAVE_OS_PROTO_H -#include "os-proto.h" -#endif - -#include "savestr.h" - -/* A replacement for strdup() that cuts down on malloc() overhead */ -char * -savestr(register const char *str) -{ - register u_int size; - register char *p; - static char *strptr = NULL; - static u_int strsize = 0; - - size = strlen(str) + 1; - if (size > strsize) { - strsize = 1024; - if (strsize < size) - strsize = size; - strptr = (char *)malloc(strsize); - if (strptr == NULL) { - fprintf(stderr, "savestr: malloc\n"); - exit(1); - } - } - (void)strcpy(strptr, str); - p = strptr; - strptr += size; - strsize -= size; - return (p); -} diff --git a/contrib/tcpdump/savestr.h b/contrib/tcpdump/savestr.h deleted file mode 100644 index 8fe995e..0000000 --- a/contrib/tcpdump/savestr.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 1997 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that: (1) source code distributions - * retain the above copyright notice and this paragraph in its entirety, (2) - * distributions including binary code include the above copyright notice and - * this paragraph in its entirety in the documentation or other materials - * provided with the distribution, and (3) all advertising materials mentioning - * features or use of this software display the following acknowledgement: - * ``This product includes software developed by the University of California, - * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of - * the University nor the names of its contributors may be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * @(#) $Header: /tcpdump/master/tcpdump/Attic/savestr.h,v 1.1.1.1 1999/10/07 23:47:12 mcr Exp $ (LBL) - */ - -extern char *savestr(const char *); diff --git a/contrib/tcpdump/tcpdump-stdinc.h b/contrib/tcpdump/tcpdump-stdinc.h index 0319ff9..6591183 100644 --- a/contrib/tcpdump/tcpdump-stdinc.h +++ b/contrib/tcpdump/tcpdump-stdinc.h @@ -29,7 +29,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * - * @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.12.2.4 2005/07/09 21:19:45 risso Exp $ (LBL) + * @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.12 2005/03/27 01:35:45 guy Exp $ (LBL) + * + * $FreeBSD$ */ /* @@ -46,11 +48,11 @@ #include <stdio.h> #include <winsock2.h> -#include <Ws2tcpip.h> #include "bittypes.h" #include <ctype.h> #include <time.h> #include <io.h> +#include "IP6_misc.h" #include <fcntl.h> #include <sys/types.h> #include <net/netdb.h> /* in wpcap's Win32/include */ @@ -143,37 +145,6 @@ typedef char* caddr_t; #define FOPEN_WRITE_BIN FOPEN_WRITE_TXT #endif -#if defined(__GNUC__) && defined(__i386__) && !defined(__ntohl) - #undef ntohl - #undef ntohs - #undef htonl - #undef htons - - extern __inline__ unsigned long __ntohl (unsigned long x); - extern __inline__ unsigned short __ntohs (unsigned short x); - - #define ntohl(x) __ntohl(x) - #define ntohs(x) __ntohs(x) - #define htonl(x) __ntohl(x) - #define htons(x) __ntohs(x) - - extern __inline__ unsigned long __ntohl (unsigned long x) - { - __asm__ ("xchgb %b0, %h0\n\t" /* swap lower bytes */ - "rorl $16, %0\n\t" /* swap words */ - "xchgb %b0, %h0" /* swap higher bytes */ - : "=q" (x) : "0" (x)); - return (x); - } - - extern __inline__ unsigned short __ntohs (unsigned short x) - { - __asm__ ("xchgb %b0, %h0" /* swap bytes */ - : "=q" (x) : "0" (x)); - return (x); - } -#endif - #ifndef INET_ADDRSTRLEN #define INET_ADDRSTRLEN 16 #endif diff --git a/contrib/tcpdump/tcpdump.1 b/contrib/tcpdump/tcpdump.1 index d44beeb..3d5bdbd 100644 --- a/contrib/tcpdump/tcpdump.1 +++ b/contrib/tcpdump/tcpdump.1 @@ -1,4 +1,4 @@ -.\" @(#) $Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.167.2.6 2005/09/05 09:14:37 guy Exp $ (LBL) +.\" @(#) $Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.167.2.4 2005/05/02 21:27:34 guy Exp $ (LBL) .\" .\" $NetBSD: tcpdump.8,v 1.9 2003/03/31 00:18:17 perry Exp $ .\" @@ -22,6 +22,8 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" +.\" $FreeBSD$ +.\" .TH TCPDUMP 1 "18 April 2005" .SH NAME tcpdump \- dump traffic on a network @@ -99,6 +101,11 @@ tcpdump \- dump traffic on a network ] .ti +8 [ +.B \-y +.I datalinktype +] +.ti +8 +[ .I expression ] .br @@ -639,6 +646,15 @@ protos are: .BR arp , .BR rarp , .BR decnet , +.BR lat , +.BR sca , +.BR moprc , +.BR mopdl , +.BR iso , +.BR esis , +.BR isis , +.BR icmp , +.BR icmp6 , .B tcp and .BR udp . @@ -1013,72 +1029,20 @@ Note that \fItcpdump\fP does not currently know how to parse these protocols. .IP "\fBvlan \fI[vlan_id]\fR" True if the packet is an IEEE 802.1Q VLAN packet. -If \fI[vlan_id]\fR is specified, only true if the packet has the specified +If \fI[vlan_id]\fR is specified, only true is the packet has the specified \fIvlan_id\fR. Note that the first \fBvlan\fR keyword encountered in \fIexpression\fR -changes the decoding offsets for the remainder of \fIexpression\fR on -the assumption that the packet is a VLAN packet. The \fBvlan -\fI[vlan_id]\fR expression may be used more than once, to filter on VLAN -hierarchies. Each use of that expression increments the filter offsets -by 4. -.IP -For example: -.in +.5i -.nf -\fBvlan 100 && vlan 200\fR +changes the decoding offsets for the remainder of \fIexpression\fR +on the assumption that the packet is a VLAN packet. +the \fI[vlan_id]\fR statement may be used more than once, to filter on vlan hierarchies. +each use of the \fI[vlan_id]\fR \fIexpression\fR increments the filter offsets by 4. .fi -.in -.5i -filters on VLAN 200 encapsulated within VLAN 100, and -.in +.5i -.nf -\fBvlan && vlan 300 && ip\fR -.fi -.in -.5i -filters IPv4 protocols encapsulated in VLAN 300 encapsulated within any -higher order VLAN. -.IP "\fBmpls \fI[label_num]\fR" -True if the packet is an MPLS packet. -If \fI[label_num]\fR is specified, only true is the packet has the specified -\fIlabel_num\fR. -Note that the first \fBmpls\fR keyword encountered in \fIexpression\fR -changes the decoding offsets for the remainder of \fIexpression\fR on -the assumption that the packet is a MPLS-encapsulated IP packet. The -\fBmpls \fI[label_num]\fR expression may be used more than once, to -filter on MPLS hierarchies. Each use of that expression increments the -filter offsets by 4. -.IP -For example: -.in +.5i -.nf -\fBmpls 100000 && mpls 1024\fR +example(s): .fi -.in -.5i -filters packets with an outer label of 100000 and an inner label of -1024, and -.in +.5i -.nf -\fBmpls && mpls 1024 && host 192.9.200.1\fR +"vlan 100 && vlan 200" filters on vlan 200 encapsulated within vlan 100 .fi -.in -.5i -filters packets to or from 192.9.200.1 with an inner label of 1024 and -any outer label. -.IP \fBpppoed\fP -True if the packet is a PPP-over-Ethernet Discovery packet (Ethernet -type 0x8863). -.IP \fBpppoes\fP -True if the packet is a PPP-over-Ethernet Session packet (Ethernet -type 0x8864). -Note that the first \fBpppoes\fR keyword encountered in \fIexpression\fR -changes the decoding offsets for the remainder of \fIexpression\fR on -the assumption that the packet is a PPPoE session packet. -.IP -For example: -.in +.5i -.nf -\fBpppoes && ip\fR +"vlan && vlan 300 && ip" filters IPv4 protocols encapsulated in vlan 300 encapsulated within any higher order vlan .fi -.in -.5i -filters IPv4 protocols encapsulated in PPPoE. .IP "\fBtcp\fR, \fBudp\fR, \fBicmp\fR" Abbreviations for: .in +.5i @@ -2252,7 +2216,7 @@ is made to account for the time lag between when the Ethernet interface removed the packet from the wire and when the kernel serviced the `new packet' interrupt. .SH "SEE ALSO" -stty(1), pcap(3), bpf(4), nit(4P), pfconfig(8) +bpf(4), pcap(3) .SH AUTHORS The original authors are: .LP @@ -2293,6 +2257,13 @@ patches@tcpdump.org NIT doesn't let you watch your own outbound traffic, BPF will. We recommend that you use the latter. .LP +When running +.BR tcpdump +with the +.B \-v +option on a network interface supporting checksum off-loading, +IP packets sourced from this machine will have many false 'bad cksum 0' errors. +.LP On Linux systems with 2.0[.x] kernels: .IP packets on the loopback device will be seen twice; diff --git a/contrib/tcpdump/tcpdump.c b/contrib/tcpdump/tcpdump.c index b7bedfe..3263824 100644 --- a/contrib/tcpdump/tcpdump.c +++ b/contrib/tcpdump/tcpdump.c @@ -30,9 +30,11 @@ static const char copyright[] _U_ = "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\ The Regents of the University of California. All rights reserved.\n"; static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.253.2.11 2005/08/23 10:29:41 hannes Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.253.2.8 2005/07/05 21:09:05 mcr Exp $ (LBL)"; #endif +/* $FreeBSD$ */ + /* * tcpdump - monitor tcp/ip traffic on an ethernet. * @@ -253,18 +255,6 @@ static struct printer printers[] = { #ifdef DLT_JUNIPER_SERVICES { juniper_services_print, DLT_JUNIPER_SERVICES }, #endif -#ifdef DLT_JUNIPER_ETHER - { juniper_ether_print, DLT_JUNIPER_ETHER }, -#endif -#ifdef DLT_JUNIPER_PPP - { juniper_ppp_print, DLT_JUNIPER_PPP }, -#endif -#ifdef DLT_JUNIPER_FRELAY - { juniper_frelay_print, DLT_JUNIPER_FRELAY }, -#endif -#ifdef DLT_JUNIPER_CHDLC - { juniper_chdlc_print, DLT_JUNIPER_CHDLC }, -#endif { NULL, 0 }, }; @@ -504,6 +494,8 @@ main(int argc, char **argv) break; case 'A': + ++xflag; + ++Xflag; ++Aflag; break; @@ -665,7 +657,6 @@ main(int argc, char **argv) case 'q': ++qflag; - ++suppress_default_print; break; case 'r': @@ -746,12 +737,10 @@ main(int argc, char **argv) case 'x': ++xflag; - ++suppress_default_print; break; case 'X': ++Xflag; - ++suppress_default_print; break; case 'y': @@ -1237,28 +1226,9 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp) snapend = sp + h->caplen; hdrlen = (*print_info->printer)(h, sp); - if (Xflag) { - /* - * Print the raw packet data in hex and ASCII. - */ - if (Xflag > 1) { - /* - * Include the link-layer header. - */ - hex_and_ascii_print("\n\t", sp, h->caplen); - } else { - /* - * Don't include the link-layer header - and if - * we have nothing past the link-layer header, - * print nothing. - */ - if (h->caplen > hdrlen) - hex_and_ascii_print("\n\t", sp + hdrlen, - h->caplen - hdrlen); - } - } else if (xflag) { + if (xflag) { /* - * Print the raw packet data in hex. + * Print the raw packet data. */ if (xflag > 1) { /* @@ -1275,15 +1245,15 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp) hex_print("\n\t", sp + hdrlen, h->caplen - hdrlen); } - } else if (Aflag) { + } else if (Xflag) { /* - * Print the raw packet data in ASCII. + * Print the raw packet data. */ - if (Aflag > 1) { + if (Xflag > 1) { /* * Include the link-layer header. */ - ascii_print(sp, h->caplen); + ascii_print("\n\t", sp, h->caplen); } else { /* * Don't include the link-layer header - and if @@ -1291,7 +1261,8 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp) * print nothing. */ if (h->caplen > hdrlen) - ascii_print(sp + hdrlen, h->caplen - hdrlen); + ascii_print("\n\t", sp + hdrlen, + h->caplen - hdrlen); } } @@ -1330,12 +1301,12 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp) #endif /* - * By default, print the specified data out in hex and ASCII. + * By default, print the specified data out in hex. */ static void ndo_default_print(netdissect_options *ndo _U_, const u_char *bp, u_int length) { - hex_and_ascii_print("\n\t", bp, length); /* pass on lf and identation string */ + ascii_print("\n\t", bp, length); /* pass on lf and identation string */ } void diff --git a/contrib/tcpdump/token.h b/contrib/tcpdump/token.h index 8e7fd6d..e466c84 100644 --- a/contrib/tcpdump/token.h +++ b/contrib/tcpdump/token.h @@ -25,6 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $FreeBSD$ */ #define TOKEN_HDRLEN 14 |