diff options
Diffstat (limited to 'contrib/tcpdump')
44 files changed, 158 insertions, 2421 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 5391e9f..0000000 --- a/contrib/tcpdump/aclocal.m4 +++ /dev/null @@ -1,1102 +0,0 @@ -dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.80.2.4 2002/07/13 09:38:53 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 .. | 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/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 - 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 - ;; - esac]) - -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 sigset() to sigaction() - AC_CHECK_FUNCS(sigset) - if test $ac_cv_func_sigset = no ; then - AC_CHECK_FUNCS(sigaction) - 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 Due to the stupid way it's implemented, AC_CHECK_TYPE is nearly useless. -dnl -dnl usage: -dnl -dnl AC_LBL_CHECK_TYPE -dnl -dnl results: -dnl -dnl int32_t (defined) -dnl u_int32_t (defined) -dnl -AC_DEFUN(AC_LBL_CHECK_TYPE, - [AC_MSG_CHECKING(for $1 using $CC) - AC_CACHE_VAL(ac_cv_lbl_have_$1, - AC_TRY_COMPILE([ -# include "confdefs.h" -# include <sys/types.h> -# if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -# endif], - [$1 i], - ac_cv_lbl_have_$1=yes, - ac_cv_lbl_have_$1=no)) - AC_MSG_RESULT($ac_cv_lbl_have_$1) - if test $ac_cv_lbl_have_$1 = no ; then - AC_DEFINE($1, $2) - fi]) - -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 - - # XXX: should also check that they don't do weird things (like on arm) - alpha*|arm*|hp*|mips*|sparc*|ia64) - 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, 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 -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" - 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 - -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 -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_TRY_COMPILE([ -#include <stdlib.h> -], -[ -static void foo(void) __attribute__ ((noreturn)); - -static void -foo(void) -{ - exit(1); -} -], -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__]) -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 1f4bf9f..99e50dd 100644 --- a/contrib/tcpdump/addrtoname.c +++ b/contrib/tcpdump/addrtoname.c @@ -20,6 +20,8 @@ * * Internet, ethernet, port, and protocol string to address * and address to string conversion routines + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] = @@ -586,15 +588,16 @@ isonsap_string(const u_char *nsap) if (tp->e_name) return tp->e_name; - tp->e_name = cp = (char *)malloc(nlen * 2 + 2); + tp->e_name = cp = (char *)malloc(nlen * 2 + 2 + (nlen>>1)); if (cp == NULL) error("isonsap_string: malloc"); nsap++; - *cp++ = '/'; - for (i = nlen; (int)--i >= 0;) { + for (i = 0; i < nlen; i++) { *cp++ = hex[*nsap >> 4]; *cp++ = hex[*nsap++ & 0xf]; + if (((i & 1) == 0) && (i + 1 < nlen)) + *cp++ = '.'; } *cp = '\0'; return (tp->e_name); 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 fe5e617..caff2579 100644 --- a/contrib/tcpdump/ethertype.h +++ b/contrib/tcpdump/ethertype.h @@ -19,6 +19,8 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.16 2001/06/21 17:56:02 itojun Exp $ (LBL) + * + * $FreeBSD$ */ /* @@ -117,6 +119,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_LOOPBACK #define ETHERTYPE_LOOPBACK 0x9000 #endif diff --git a/contrib/tcpdump/interface.h b/contrib/tcpdump/interface.h index 2c8f7ac..ed1d53c 100644 --- a/contrib/tcpdump/interface.h +++ b/contrib/tcpdump/interface.h @@ -19,6 +19,8 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.178.4.2 2002/07/10 07:32:17 guy Exp $ (LBL) + * + * $FreeBSD$ */ #ifndef tcpdump_interface_h 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 6de8369..074d5ee 100644 --- a/contrib/tcpdump/nfs.h +++ b/contrib/tcpdump/nfs.h @@ -35,6 +35,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 0d58fe6..6b6a395 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 086ad5f..f93321f 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 7ad4cb0..6c7262d 100644 --- a/contrib/tcpdump/ppp.h +++ b/contrib/tcpdump/ppp.h @@ -14,19 +14,27 @@ * 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 */ /* 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 78f8738..a3aec16 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 d0760c5..3b1104f 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 @@ -112,6 +114,7 @@ llap_print(register const u_char *bp, u_int length) register const struct atShortDDP *sdp; u_short snet; +#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) @@ -123,6 +126,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 switch (lp->type) { case lapShortDDP: @@ -233,7 +242,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!) */ @@ -583,10 +592,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 ced9c46..2090267 100644 --- a/contrib/tcpdump/print-atm.c +++ b/contrib/tcpdump/print-atm.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 static const char rcsid[] = @@ -51,7 +53,7 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) { u_int caplen = h->caplen; u_int length = h->len; - u_short ethertype; + u_short ethertype, extracted_ethertype; ++infodelay; ts_print(&h->ts); @@ -60,7 +62,18 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) printf("[|atm]"); goto out; } - if (p[0] != 0xaa || p[1] != 0xaa || p[2] != 0x03) { + + if (p[4] == 0xaa || p[5] == 0xaa || p[6] == 0x03) { + /* if first 4 bytes are cookie/vpci */ + if (eflag) { + printf("%04x ", + p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]); + } + p += 4; + length -= 4; + caplen -= 4; + } + else if (p[0] != 0xaa || p[1] != 0xaa || p[2] != 0x03) { /*XXX assume 802.6 MAC header from fore driver */ if (eflag) printf("%04x%04x %04x%04x ", @@ -129,14 +142,17 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) /* default_print for now */ #endif default: - /* ether_type not known, print raw packet */ + /* ether_type not known, forward it to llc_print */ if (!eflag) printf("%02x %02x %02x %02x-%02x-%02x %04x: ", packetp[0], packetp[1], packetp[2], /* dsap/ssap/ctrl */ packetp[3], packetp[4], packetp[5], /* manufacturer's code */ ethertype); - if (!xflag && !qflag) - default_print(p, caplen); + if (!xflag && !qflag) { + extracted_ethertype = 0; + /* default_print(p, caplen); */ + llc_print(p-8,length+8,caplen+8,"000000","000000", &extracted_ethertype); + } } if (xflag) default_print(p, caplen); diff --git a/contrib/tcpdump/print-bootp.c b/contrib/tcpdump/print-bootp.c index b46f2b5..c80ccd7 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[] = 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 ee785f2..caabb1a 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 ba76987..a70642e 100644 --- a/contrib/tcpdump/print-ether.c +++ b/contrib/tcpdump/print-ether.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 static const char rcsid[] = @@ -224,6 +226,8 @@ ether_encap_print(u_short ethertype, const u_char *p, case ETHERTYPE_PPPOED: case ETHERTYPE_PPPOES: + case ETHERTYPE_PPPOED2: + case ETHERTYPE_PPPOES2: pppoe_print(p, length); return (1); diff --git a/contrib/tcpdump/print-fddi.c b/contrib/tcpdump/print-fddi.c index 7857863..6a0bf86 100644 --- a/contrib/tcpdump/print-fddi.c +++ b/contrib/tcpdump/print-fddi.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-fr.c b/contrib/tcpdump/print-fr.c index f082488..7039338 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 char rcsid[] = - "@(#)$Header: /cvs/juniper/src/freebsd/contrib/tcpdump/print-fr.c,v 1.2 1997/07/18 20:24:15 boonmark Exp $ (LBL)"; + "@(#)$Header: /home/ncvs/src/contrib/tcpdump/print-fr.c,v 1.1 1997/12/31 21:50:31 pst Exp $ (LBL)"; #endif #ifdef PPP @@ -36,6 +38,7 @@ struct mbuf; struct rtentry; #endif #include <net/if.h> +#include <net/if_var.h> #include <netinet/in.h> #include <netinet/in_systm.h> @@ -394,12 +397,12 @@ q933_print(const u_char *p, int length) break; case LINK_VERIFY_IE_91: case LINK_VERIFY_IE_94: - sprintf(temp_str,"TX Seq: %3d, RX Seq: %3d", + snprintf(temp_str, sizeof(temp_str), "TX Seq: %3d, RX Seq: %3d", ptemp[2], ptemp[3]); decode_str = temp_str; break; case PVC_STATUS_IE: - sprintf(temp_str,"DLCI %d: status %s %s", + snprintf(temp_str,sizeof(temp_str), "DLCI %d: status %s %s", ((ptemp[2]&0x3f)<<4)+ ((ptemp[3]&0x78)>>3), ptemp[4] & 0x8 ?"new,":" ", ptemp[4] & 0x2 ?"Active":"Inactive"); diff --git a/contrib/tcpdump/print-icmp.c b/contrib/tcpdump/print-icmp.c index 263960e..34b6c32 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 e1619c1..6e614e1 100644 --- a/contrib/tcpdump/print-ip.c +++ b/contrib/tcpdump/print-ip.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-ip6.c b/contrib/tcpdump/print-ip6.c index 7c98ad3..0e8bf02 100644 --- a/contrib/tcpdump/print-ip6.c +++ b/contrib/tcpdump/print-ip6.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-ipx.c b/contrib/tcpdump/print-ipx.c index be1befd..9a4f60a 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 @@ -193,7 +195,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; @@ -201,7 +203,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 fc4009c..edc8190 100644 --- a/contrib/tcpdump/print-isoclns.c +++ b/contrib/tcpdump/print-isoclns.c @@ -22,6 +22,8 @@ * * Extensively modified by Hannes Gredler (hannes@juniper.net) for more * complete IS-IS support. + * + * $FreeBSD$ */ #ifndef lint diff --git a/contrib/tcpdump/print-llc.c b/contrib/tcpdump/print-llc.c index 0aa9819..39994a8 100644 --- a/contrib/tcpdump/print-llc.c +++ b/contrib/tcpdump/print-llc.c @@ -20,6 +20,8 @@ * * Code by Matt Thomas, Digital Equipment Corporation * with an awful lot of hacking by Jeffrey Mogul, DECWRL + * + * $FreeBSD$ */ #ifndef lint @@ -314,5 +316,8 @@ llc_print(const u_char *p, u_int length, u_int caplen, caplen -= 4; } (void)printf(" len=%d", length); + if (caplen > 0 && !qflag) { + default_print_unaligned(p, caplen); + } return(1); } diff --git a/contrib/tcpdump/print-nfs.c b/contrib/tcpdump/print-nfs.c index 48dc9e3..c66c97e 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 f5d348f..0c84050 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 2893585..f8aa37b 100644 --- a/contrib/tcpdump/print-null.c +++ b/contrib/tcpdump/print-null.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-pim.c b/contrib/tcpdump/print-pim.c index a8219dc..d624249 100644 --- a/contrib/tcpdump/print-pim.c +++ b/contrib/tcpdump/print-pim.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-ppp.c b/contrib/tcpdump/print-ppp.c index dc2950f..3416ed6 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 3448287..6f2e872 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 968a68c..41d3bfb 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 d2de92d..748c4b6 100644 --- a/contrib/tcpdump/print-token.c +++ b/contrib/tcpdump/print-token.c @@ -22,6 +22,8 @@ * * Further tweaked to more closely resemble print-fddi.c * Guy Harris <guy@alum.mit.edu> + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] = diff --git a/contrib/tcpdump/print-udp.c b/contrib/tcpdump/print-udp.c index c787384..536e9af 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.1 b/contrib/tcpdump/tcpdump.1 index 0b5b857..fb3ec3e 100644 --- a/contrib/tcpdump/tcpdump.1 +++ b/contrib/tcpdump/tcpdump.1 @@ -20,6 +20,8 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" +.\" $FreeBSD$ +.\" .TH TCPDUMP 1 "3 January 2001" .SH NAME tcpdump \- dump traffic on a network @@ -473,6 +475,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 . @@ -1855,7 +1866,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" -traffic(1C), nit(4P), bpf(4), pcap(3) +bpf(4), pcap(3) .SH AUTHORS The original authors are: .LP diff --git a/contrib/tcpdump/tcpdump.c b/contrib/tcpdump/tcpdump.c index 4f98c08..dd39e4b 100644 --- a/contrib/tcpdump/tcpdump.c +++ b/contrib/tcpdump/tcpdump.c @@ -33,6 +33,8 @@ static const char rcsid[] = "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.173 2001/12/22 22:12:23 guy Exp $ (LBL)"; #endif +/* $FreeBSD$ */ + /* * tcpdump - monitor tcp/ip traffic on an ethernet. * diff --git a/contrib/tcpdump/token.h b/contrib/tcpdump/token.h index 9565969..1e9bd4f 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 |