From: guy Date: Sat, 23 Sep 2000 08:03:27 +0000 (+0000) Subject: Add definitions of Ethernet types from X-Git-Tag: tcpdump-3.5.1~164 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/e89409254248af64db721ede4babbe9fd1753f6c Add definitions of Ethernet types from "linux-includes/netinet/if_ether.h" to "ethertype.h". Move other stuff used by dissectors from to "ether.h", along the lines of "fddi.h" and "token.h". Move ARP declarations from BSD include files to "print-arp.c". Remove from dissectors includes of , and add includes of "ethertype.h" and/or "ether.h" as necessary. Get rid of configuration options that test declarations now made in "ether.h" or "print-arp.c", as those declarations are now under our control, not the OS's control. --- diff --git a/FILES b/FILES index 99d5598f..8cd1eff9 100644 --- a/FILES +++ b/FILES @@ -21,6 +21,7 @@ configure.in decnet.h dhcp6.h dhcp6opt.h +ether.h ethertype.h extract.h fddi.h diff --git a/INSTALL b/INSTALL index e9fcee20..3da23ebb 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ -@(#) $Header: /tcpdump/master/tcpdump/Attic/INSTALL,v 1.44 2000-08-19 02:07:30 guy Exp $ (LBL) +@(#) $Header: /tcpdump/master/tcpdump/Attic/INSTALL,v 1.45 2000-09-23 08:03:27 guy Exp $ (LBL) If you have not built libpcap, do so first. See the README file in this directory for the ftp location. @@ -30,22 +30,6 @@ If you use Linux, this version of libpcap is known to compile and run with 2.0.25 and more modern, and 2.2.x kernels. It is guaranteed not to work with 1.X kernels. -If you use OSF 4, note that that there appears to be some serious bugs -with the stock C compiler. The configure code fragments that detect if -the ether_header and ether_arp structs use the ether_addr struct -generates warnings instead of fatal errors (?!?!) This makes configure -think that the ether_arp struct is used when in fact it is not. To get -around this, comment out: - -#define ETHER_HEADER_HAS_EA 1 -and -#define ETHER_ARP_HAS_EA 1 - -from config.h after running configure (and before attempting to -compile tcpdump). - -Another workaround is to use gcc. - If your system is not one which we have tested tcpdump on, you may have to modify the configure script and Makefile.in. Please send us patches for any modifications you need to make. diff --git a/acconfig.h b/acconfig.h index 261e317c..fab08548 100644 --- a/acconfig.h +++ b/acconfig.h @@ -36,11 +36,6 @@ */ #undef ETHER_HEADER_HAS_EA -/* - * define if struct ether_arp.arp_sha is a struct with ether_addr_octet - */ -#undef ETHER_ARP_HAS_EA - /* define if struct ether_arp contains arp_xsha */ #undef ETHER_ARP_HAS_X diff --git a/config.h.in b/config.h.in index 822a198d..cce38e35 100644 --- a/config.h.in +++ b/config.h.in @@ -43,19 +43,6 @@ /* define if your struct __res_state has the nsort member */ #undef HAVE_NEW_RES_STATE -/* - * define if struct ether_header.ether_dhost is a struct with ether_addr_octet - */ -#undef ETHER_HEADER_HAS_EA - -/* - * define if struct ether_arp.arp_sha is a struct with ether_addr_octet - */ -#undef ETHER_ARP_HAS_EA - -/* define if struct ether_arp contains arp_xsha */ -#undef ETHER_ARP_HAS_X - /* define if you have the addrinfo function. */ #undef HAVE_ADDRINFO diff --git a/configure b/configure index 884a33de..458e74b2 100755 --- a/configure +++ b/configure @@ -4350,148 +4350,8 @@ EOF fi -echo $ac_n "checking if ether_header uses ether_addr structs""... $ac_c" 1>&6 -echo "configure:4355: checking if ether_header uses ether_addr structs" >&5 -if eval "test \"`echo '$''{'ac_cv_ether_header_has_ea'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - LBL_SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $V_INCLS" - cat > conftest.$ac_ext < -# if __STDC__ - /* osf3 has REALLY good prototyes */ - struct mbuf; - struct rtentry; -# endif -# include -# include -# include -# include -int main() { -u_int i = - sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet) -; return 0; } -EOF -if { (eval echo configure:4380: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_ether_header_has_ea=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_ether_header_has_ea=no -fi -rm -f conftest* - CFLAGS="$LBL_SAVE_CFLAGS" -fi - -echo "$ac_t""$ac_cv_ether_header_has_ea" 1>&6 -if test $ac_cv_ether_header_has_ea = yes ; then - cat >> confdefs.h <<\EOF -#define ETHER_HEADER_HAS_EA 1 -EOF - -fi - -echo $ac_n "checking if ether_arp uses ether_addr structs""... $ac_c" 1>&6 -echo "configure:4402: checking if ether_arp uses ether_addr structs" >&5 -if eval "test \"`echo '$''{'ac_cv_ether_arp_has_ea'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - LBL_SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $V_INCLS" - cat > conftest.$ac_ext < -# if __STDC__ - /* osf3 has REALLY good prototyes */ - struct mbuf; - struct rtentry; -# endif -# include -# include -# include -# include -int main() { -u_int i = - sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet) -; return 0; } -EOF -if { (eval echo configure:4427: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_ether_arp_has_ea=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_ether_arp_has_ea=no -fi -rm -f conftest* - CFLAGS="$LBL_SAVE_CFLAGS" -fi - -echo "$ac_t""$ac_cv_ether_arp_has_ea" 1>&6 -if test $ac_cv_ether_arp_has_ea = yes ; then - cat >> confdefs.h <<\EOF -#define ETHER_ARP_HAS_EA 1 -EOF - -fi - -echo $ac_n "checking if ether_arp uses erp_xsha member""... $ac_c" 1>&6 -echo "configure:4449: checking if ether_arp uses erp_xsha member" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_ether_arp_x'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - LBL_SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $V_INCLS" - cat > conftest.$ac_ext < -# include -# if __STDC__ - /* osf3 has REALLY good prototyes */ - struct mbuf; - struct rtentry; -# endif -# include -# include -# include -int main() { -u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha) -; return 0; } -EOF -if { (eval echo configure:4473: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_struct_ether_arp_x=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_ether_arp_x=no -fi -rm -f conftest* - CFLAGS="$LBL_SAVE_CFLAGS" -fi - -echo "$ac_t""$ac_cv_struct_ether_arp_x" 1>&6 -if test $ac_cv_struct_ether_arp_x = yes ; then - cat >> confdefs.h <<\EOF -#define ETHER_ARP_HAS_X 1 -EOF - -fi - echo $ac_n "checking if unaligned accesses fail""... $ac_c" 1>&6 -echo "configure:4495: checking if unaligned accesses fail" >&5 +echo "configure:4355: checking if unaligned accesses fail" >&5 if eval "test \"`echo '$''{'ac_cv_lbl_unaligned_fail'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4556,12 +4416,12 @@ EOF echo $ac_n "checking for h_errno""... $ac_c" 1>&6 -echo "configure:4560: checking for h_errno" >&5 +echo "configure:4420: checking for h_errno" >&5 if eval "test \"`echo '$''{'ac_cv_var_h_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4570,7 +4430,7 @@ int main() { int foo = h_errno; ; return 0; } EOF -if { (eval echo configure:4574: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_var_h_errno=yes else @@ -4598,7 +4458,7 @@ if test "${with_crypto+set}" = set; then else echo $ac_n "checking for SSLeay""... $ac_c" 1>&6 -echo "configure:4602: checking for SSLeay" >&5 +echo "configure:4462: checking for SSLeay" >&5 ac_cv_ssleay_path=no incdir=no for dir in /usr /usr/local /usr/local/ssl /usr/pkg; do @@ -4630,7 +4490,7 @@ if test "$ac_cv_ssleay_path" != no; then LIBS="$LIBS -lrsaref" fi echo $ac_n "checking for des_cbc_encrypt in -lcrypto""... $ac_c" 1>&6 -echo "configure:4634: checking for des_cbc_encrypt in -lcrypto" >&5 +echo "configure:4494: checking for des_cbc_encrypt in -lcrypto" >&5 ac_lib_var=`echo crypto'_'des_cbc_encrypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4638,7 +4498,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypto $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4683,17 +4543,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4687: checking for $ac_hdr" >&5 +echo "configure:4547: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4557: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4722,12 +4582,12 @@ done if test "$ac_cv_header_cast_h" = "yes"; then echo $ac_n "checking for buggy CAST128""... $ac_c" 1>&6 -echo "configure:4726: checking for buggy CAST128" >&5 +echo "configure:4586: checking for buggy CAST128" >&5 if test "$cross_compiling" = yes; then buggy_cast128="cross-compiling, assume yes" else cat > conftest.$ac_ext < @@ -4746,7 +4606,7 @@ main() return 1; } EOF -if { (eval echo configure:4750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then buggy_cast128=yes else @@ -4793,7 +4653,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:4797: checking for a BSD compatible install" >&5 +echo "configure:4657: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 diff --git a/configure.in b/configure.in index b5dcd6d2..ace074ad 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.120 2000-07-11 00:48:16 assar Exp $ (LBL) +dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.121 2000-09-23 08:03:29 guy Exp $ (LBL) dnl dnl Copyright (c) 1994, 1995, 1996, 1997 dnl The Regents of the University of California. All rights reserved. @@ -6,7 +6,7 @@ dnl dnl Process this file with autoconf to produce a configure script. dnl -AC_REVISION($Revision: 1.120 $) +AC_REVISION($Revision: 1.121 $) AC_PREREQ(2.13) AC_INIT(tcpdump.c) @@ -553,80 +553,6 @@ AC_LBL_DEVEL(V_CCOPT) AC_LBL_SOCKADDR_SA_LEN -AC_MSG_CHECKING(if ether_header uses ether_addr structs) -AC_CACHE_VAL(ac_cv_ether_header_has_ea, - LBL_SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $V_INCLS" - AC_TRY_COMPILE([ -# include -# if __STDC__ - /* osf3 has REALLY good prototyes */ - struct mbuf; - struct rtentry; -# endif -# include -# include -# include -# include ], - [u_int i = - sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)], - ac_cv_ether_header_has_ea=yes, - ac_cv_ether_header_has_ea=no) - CFLAGS="$LBL_SAVE_CFLAGS") -AC_MSG_RESULT($ac_cv_ether_header_has_ea) -if test $ac_cv_ether_header_has_ea = yes ; then - AC_DEFINE(ETHER_HEADER_HAS_EA) -fi - -AC_MSG_CHECKING(if ether_arp uses ether_addr structs) -AC_CACHE_VAL(ac_cv_ether_arp_has_ea, - LBL_SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $V_INCLS" - AC_TRY_COMPILE([ -# include -# if __STDC__ - /* osf3 has REALLY good prototyes */ - struct mbuf; - struct rtentry; -# endif -# include -# include -# include -# include ], - [u_int i = - sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)], - ac_cv_ether_arp_has_ea=yes, - ac_cv_ether_arp_has_ea=no) - CFLAGS="$LBL_SAVE_CFLAGS") -AC_MSG_RESULT($ac_cv_ether_arp_has_ea) -if test $ac_cv_ether_arp_has_ea = yes ; then - AC_DEFINE(ETHER_ARP_HAS_EA) -fi - -AC_MSG_CHECKING(if ether_arp uses erp_xsha member) -AC_CACHE_VAL(ac_cv_struct_ether_arp_x, - LBL_SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $V_INCLS" - AC_TRY_COMPILE([ -# include -# include -# if __STDC__ - /* osf3 has REALLY good prototyes */ - struct mbuf; - struct rtentry; -# endif -# include -# include -# include ], - [u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)], - ac_cv_struct_ether_arp_x=yes, - ac_cv_struct_ether_arp_x=no) - CFLAGS="$LBL_SAVE_CFLAGS") -AC_MSG_RESULT($ac_cv_struct_ether_arp_x) -if test $ac_cv_struct_ether_arp_x = yes ; then - AC_DEFINE(ETHER_ARP_HAS_X) -fi - AC_LBL_UNALIGNED_ACCESS AC_VAR_H_ERRNO diff --git a/ether.h b/ether.h new file mode 100644 index 00000000..44081680 --- /dev/null +++ b/ether.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * 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 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. + * + * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 + */ + +#if 0 +#include +#endif + +#define ETHERMTU 1500 + +/* + * The number of bytes in an ethernet (MAC) address. + */ +#define ETHER_ADDR_LEN 6 + +/* + * Ethernet address - 6 octets + */ +struct ether_addr { + u_char ether_addr_octet[ETHER_ADDR_LEN]; +}; + +/* + * Structure of a 10Mb/s Ethernet header. + */ +struct ether_header { + u_char ether_dhost[ETHER_ADDR_LEN]; + u_char ether_shost[ETHER_ADDR_LEN]; + u_short ether_type; +}; diff --git a/ethertype.h b/ethertype.h index 455b0106..1d92d78e 100644 --- a/ethertype.h +++ b/ethertype.h @@ -18,11 +18,33 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.11 2000-06-10 13:49:08 assar Exp $ (LBL) + * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.12 2000-09-23 08:03:30 guy Exp $ (LBL) */ -/* Types missing from some systems */ +/* + * Ethernet types. + * + * We wrap the declarations with #ifdef, so that if a file includes + * , which may declare some of these, we don't + * get a bunch of complaints from the C compiler about redefinitions + * of these values. + * + * We declare all of them here so that no file has to include + * if all it needs are ETHERTYPE_ values. + */ +#ifndef ETHERTYPE_PUP +#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ +#endif +#ifndef ETHERTYPE_IP +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#endif +#ifndef ETHERTYPE_ARP +#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ +#endif +#ifndef ETHERTYPE_REVARP +#define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */ +#endif #ifndef ETHERTYPE_NS #define ETHERTYPE_NS 0x0600 #endif diff --git a/interface.h b/interface.h index 1254b785..6358faaf 100644 --- a/interface.h +++ b/interface.h @@ -18,7 +18,7 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.135 2000-09-18 05:11:43 guy Exp $ (LBL) + * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.136 2000-09-23 08:03:30 guy Exp $ (LBL) */ #ifndef tcpdump_interface_h @@ -131,30 +131,8 @@ extern int packettype; /* as specified by -T */ #define LITTLE_ENDIAN 1234 #endif -#ifdef ETHER_HEADER_HAS_EA -#define ESRC(ep) ((ep)->ether_shost.ether_addr_octet) -#define EDST(ep) ((ep)->ether_dhost.ether_addr_octet) -#else #define ESRC(ep) ((ep)->ether_shost) #define EDST(ep) ((ep)->ether_dhost) -#endif - -#ifdef ETHER_ARP_HAS_X -#define SHA(ap) ((ap)->arp_xsha) -#define THA(ap) ((ap)->arp_xtha) -#define SPA(ap) ((ap)->arp_xspa) -#define TPA(ap) ((ap)->arp_xtpa) -#else -#ifdef ETHER_ARP_HAS_EA -#define SHA(ap) ((ap)->arp_sha.ether_addr_octet) -#define THA(ap) ((ap)->arp_tha.ether_addr_octet) -#else -#define SHA(ap) ((ap)->arp_sha) -#define THA(ap) ((ap)->arp_tha) -#endif -#define SPA(ap) ((ap)->arp_spa) -#define TPA(ap) ((ap)->arp_tpa) -#endif #ifndef NTOHL #define NTOHL(x) (x) = ntohl(x) diff --git a/print-ah.c b/print-ah.c index e2dfc7b0..79200304 100644 --- a/print-ah.c +++ b/print-ah.c @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ah.c,v 1.5 1999-12-15 08:10:17 fenner Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ah.c,v 1.6 2000-09-23 08:03:30 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -39,7 +39,6 @@ static const char rcsid[] = #include #include -#include #include #include #include diff --git a/print-arp.c b/print-arp.c index ac326a4d..1ef2505f 100644 --- a/print-arp.c +++ b/print-arp.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.45 2000-07-01 03:39:01 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.46 2000-09-23 08:03:31 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -37,16 +37,78 @@ struct rtentry; #include #include -#include #include #include #include "interface.h" #include "addrtoname.h" +#include "ether.h" #include "ethertype.h" #include "extract.h" /* must come after interface.h */ +/* + * Address Resolution Protocol. + * + * See RFC 826 for protocol description. ARP packets are variable + * in size; the arphdr structure defines the fixed-length portion. + * Protocol type values are the same as those for 10 Mb/s Ethernet. + * It is followed by the variable-sized fields ar_sha, arp_spa, + * arp_tha and arp_tpa in that order, according to the lengths + * specified. Field names used correspond to RFC 826. + */ +struct arphdr { + u_short ar_hrd; /* format of hardware address */ +#define ARPHRD_ETHER 1 /* ethernet hardware format */ +#define ARPHRD_IEEE802 6 /* token-ring hardware format */ +#define ARPHRD_FRELAY 15 /* frame relay hardware format */ + u_short ar_pro; /* format of protocol address */ + u_char ar_hln; /* length of hardware address */ + u_char ar_pln; /* length of protocol address */ + u_short ar_op; /* one of: */ +#define ARPOP_REQUEST 1 /* request to resolve address */ +#define ARPOP_REPLY 2 /* response to previous request */ +#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ +#define ARPOP_REVREPLY 4 /* response giving protocol address */ +#define ARPOP_INVREQUEST 8 /* request to identify peer */ +#define ARPOP_INVREPLY 9 /* response identifying peer */ +/* + * The remaining fields are variable in size, + * according to the sizes above. + */ +#ifdef COMMENT_ONLY + u_char ar_sha[]; /* sender hardware address */ + u_char ar_spa[]; /* sender protocol address */ + u_char ar_tha[]; /* target hardware address */ + u_char ar_tpa[]; /* target protocol address */ +#endif +}; + +/* + * Ethernet Address Resolution Protocol. + * + * See RFC 826 for protocol description. Structure below is adapted + * to resolving internet addresses. Field names used correspond to + * RFC 826. + */ +struct ether_arp { + struct arphdr ea_hdr; /* fixed-size header */ + u_char arp_sha[6]; /* sender hardware address */ + u_char arp_spa[4]; /* sender protocol address */ + u_char arp_tha[6]; /* target hardware address */ + u_char arp_tpa[4]; /* target protocol address */ +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +#define SHA(ap) ((ap)->arp_sha) +#define THA(ap) ((ap)->arp_tha) +#define SPA(ap) ((ap)->arp_spa) +#define TPA(ap) ((ap)->arp_tpa) + /* Compatibility */ #ifndef REVARP_REQUEST #define REVARP_REQUEST 3 diff --git a/print-atalk.c b/print-atalk.c index 274e0fb5..87be2d2e 100644 --- a/print-atalk.c +++ b/print-atalk.c @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.54 2000-04-02 23:50:48 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.55 2000-09-23 08:03:31 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -44,7 +44,6 @@ struct rtentry; #include #include #include -#include #include #include #include diff --git a/print-atm.c b/print-atm.c index 60b70a81..485f9e96 100644 --- a/print-atm.c +++ b/print-atm.c @@ -20,7 +20,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.13 2000-07-01 03:39:01 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.14 2000-09-23 08:03:33 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -36,7 +36,6 @@ struct rtentry; #include #include -#include #include #include #include diff --git a/print-bootp.c b/print-bootp.c index 2cde5af8..51cc395d 100644 --- a/print-bootp.c +++ b/print-bootp.c @@ -22,7 +22,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.50 2000-07-01 03:56:43 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.51 2000-09-23 08:03:33 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -38,7 +38,6 @@ struct rtentry; #include #include -#include #include #include @@ -46,6 +45,7 @@ struct rtentry; #include "interface.h" #include "addrtoname.h" +#include "ether.h" #include "bootp.h" static void rfc1048_print(const u_char *, u_int); diff --git a/print-chdlc.c b/print-chdlc.c index 41582c50..673fec6d 100644 --- a/print-chdlc.c +++ b/print-chdlc.c @@ -22,7 +22,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.5 2000-09-18 05:11:44 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.6 2000-09-23 08:03:33 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -42,7 +42,6 @@ struct rtentry; #include #include #include -#include #include #include @@ -55,6 +54,7 @@ struct rtentry; #include "interface.h" #include "addrtoname.h" +#include "ethertype.h" #include "ppp.h" #include "chdlc.h" diff --git a/print-cip.c b/print-cip.c index b2b6d16b..6913c267 100644 --- a/print-cip.c +++ b/print-cip.c @@ -22,7 +22,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.4 2000-04-28 11:34:12 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.5 2000-09-23 08:03:34 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -37,7 +37,6 @@ static const char rcsid[] = #include #include -#include #include #include #include @@ -50,6 +49,8 @@ static const char rcsid[] = #include "interface.h" #include "addrtoname.h" +#include "ethertype.h" +#include "ether.h" const u_char *packetp; const u_char *snapend; diff --git a/print-domain.c b/print-domain.c index d2929426..40bfeae0 100644 --- a/print-domain.c +++ b/print-domain.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.46 2000-07-05 23:50:37 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.47 2000-09-23 08:03:34 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -37,7 +37,6 @@ struct rtentry; #include #include -#include #include #include #include diff --git a/print-esp.c b/print-esp.c index f7690bde..4e1c67b0 100644 --- a/print-esp.c +++ b/print-esp.c @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.6 2000-01-15 02:33:06 mcr Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.7 2000-09-23 08:03:34 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -40,7 +40,6 @@ static const char rcsid[] = #include #include -#include #include #include #include diff --git a/print-ether.c b/print-ether.c index 573fdba8..33c58e28 100644 --- a/print-ether.c +++ b/print-ether.c @@ -20,7 +20,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.51 2000-07-01 03:39:02 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.52 2000-09-23 08:03:35 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -36,7 +36,6 @@ struct rtentry; #include #include -#include #include #include #include @@ -55,6 +54,8 @@ struct rtentry; #include "addrtoname.h" #include "ethertype.h" +#include "ether.h" + const u_char *packetp; const u_char *snapend; diff --git a/print-fddi.c b/print-fddi.c index bd4bd4f9..161ed37c 100644 --- a/print-fddi.c +++ b/print-fddi.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.41 2000-07-01 03:39:02 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.42 2000-09-23 08:03:35 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -39,7 +39,6 @@ struct rtentry; #include #include -#include #include #include @@ -53,6 +52,7 @@ struct rtentry; #include "addrtoname.h" #include "ethertype.h" +#include "ether.h" #include "fddi.h" /* diff --git a/print-frag6.c b/print-frag6.c index f064d0b4..59e03b6a 100644 --- a/print-frag6.c +++ b/print-frag6.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.5 2000-02-03 18:16:40 itojun Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.6 2000-09-23 08:03:35 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -38,7 +38,6 @@ static const char rcsid[] = #include #include -#include #include #include #include diff --git a/print-icmp.c b/print-icmp.c index f7b1b2b9..b04032d5 100644 --- a/print-icmp.c +++ b/print-icmp.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.48 2000-07-01 03:39:03 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.49 2000-09-23 08:03:35 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -37,7 +37,6 @@ struct rtentry; #include #include -#include #include #include #include diff --git a/print-icmp6.c b/print-icmp6.c index 485d0bbe..ff9bb250 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.21 2000-08-30 14:28:44 itojun Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.22 2000-09-23 08:03:36 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -40,7 +40,6 @@ static const char rcsid[] = #include #include -#include #include #include #include diff --git a/print-ipcomp.c b/print-ipcomp.c index 86625429..cd4df116 100644 --- a/print-ipcomp.c +++ b/print-ipcomp.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ipcomp.c,v 1.4 2000-01-19 04:51:11 itojun Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ipcomp.c,v 1.5 2000-09-23 08:03:36 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -38,7 +38,6 @@ static const char rcsid[] = #include #include -#include #include #include #include diff --git a/print-isakmp.c b/print-isakmp.c index 81035626..d9e2884b 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -30,7 +30,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.15 2000-09-23 04:43:42 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.16 2000-09-23 08:03:37 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -48,7 +48,6 @@ struct rtentry; #include #include -#include #include #include #include diff --git a/print-isoclns.c b/print-isoclns.c index bf832fb6..a6a1c866 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.17 2000-07-01 03:39:06 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.18 2000-09-23 08:03:37 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -39,7 +39,6 @@ struct rtentry; #include #include -#include #include diff --git a/print-lane.c b/print-lane.c index 8021f6e4..be7849c4 100644 --- a/print-lane.c +++ b/print-lane.c @@ -22,7 +22,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.4 2000-07-10 04:35:58 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.5 2000-09-23 08:03:37 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -37,7 +37,6 @@ static const char rcsid[] = #include #include -#include #include #include #include @@ -50,6 +49,7 @@ static const char rcsid[] = #include "interface.h" #include "addrtoname.h" +#include "ether.h" #include "lane.h" static inline void diff --git a/print-lcp.c b/print-lcp.c index d7695e14..1d40273a 100644 --- a/print-lcp.c +++ b/print-lcp.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = -"@(#) $Header: /tcpdump/master/tcpdump/Attic/print-lcp.c,v 1.6 2000-07-01 03:39:06 assar Exp $ (LBL)"; +"@(#) $Header: /tcpdump/master/tcpdump/Attic/print-lcp.c,v 1.7 2000-09-23 08:03:38 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -37,7 +37,6 @@ struct rtentry; #include #include -#include #include #include diff --git a/print-nfs.c b/print-nfs.c index abae3709..395107bf 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.81 2000-08-03 18:52:24 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.82 2000-09-23 08:03:38 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -37,7 +37,6 @@ struct rtentry; #include #include -#include #include #include #ifdef INET6 diff --git a/print-ntp.c b/print-ntp.c index 886a45fa..532e37a2 100644 --- a/print-ntp.c +++ b/print-ntp.c @@ -25,7 +25,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.28 2000-07-01 03:39:07 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.29 2000-09-23 08:03:38 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -41,7 +41,6 @@ struct rtentry; #include #include -#include #include #include diff --git a/print-null.c b/print-null.c index 5c312e15..c08f28dc 100644 --- a/print-null.c +++ b/print-null.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.31 2000-07-01 03:39:07 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.32 2000-09-23 08:03:39 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -41,7 +41,6 @@ struct rtentry; #include #include #include -#include #include #include #include diff --git a/print-ppp.c b/print-ppp.c index 72ca4039..4f0215a3 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -31,7 +31,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.45 2000-09-18 05:23:31 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.46 2000-09-23 08:03:39 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -51,7 +51,6 @@ struct rtentry; #include #include #include -#include #include #include diff --git a/print-pppoe.c b/print-pppoe.c index 5dff577f..dccba9ba 100644 --- a/print-pppoe.c +++ b/print-pppoe.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = -"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.6 2000-08-18 07:44:47 itojun Exp $ (LBL)"; +"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.7 2000-09-23 08:03:40 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -37,7 +37,6 @@ struct rtentry; #include #include -#include #include #include @@ -46,6 +45,7 @@ struct rtentry; #include "addrtoname.h" #include "ppp.h" #include "ethertype.h" +#include "ether.h" #include "extract.h" /* must come after interface.h */ /* Codes */ diff --git a/print-raw.c b/print-raw.c index 80a707d3..c335bb5c 100644 --- a/print-raw.c +++ b/print-raw.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.27 2000-07-11 01:22:39 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.28 2000-09-23 08:03:40 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -41,7 +41,6 @@ struct rtentry; #include #include #include -#include #include #include #include diff --git a/print-rt6.c b/print-rt6.c index 5fce586c..329553e1 100644 --- a/print-rt6.c +++ b/print-rt6.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.9 2000-06-16 19:41:31 assar Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.10 2000-09-23 08:03:40 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -38,7 +38,6 @@ static const char rcsid[] = #include #include -#include #include #include #include diff --git a/print-sl.c b/print-sl.c index 9f2858a0..32bb693a 100644 --- a/print-sl.c +++ b/print-sl.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.47 2000-07-01 03:39:09 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.48 2000-09-23 08:03:40 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -44,7 +44,6 @@ struct rtentry; #include #include #include -#include #include #include diff --git a/print-sunrpc.c b/print-sunrpc.c index d9667a2b..d3f75ab1 100644 --- a/print-sunrpc.c +++ b/print-sunrpc.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.33 2000-07-01 03:39:10 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.34 2000-09-23 08:03:41 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -37,7 +37,6 @@ struct rtentry; #include #include -#include #include #include #include diff --git a/print-token.c b/print-token.c index 3168b6e4..917c225b 100644 --- a/print-token.c +++ b/print-token.c @@ -25,7 +25,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.2 2000-07-30 05:55:44 assar Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.3 2000-09-23 08:03:41 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -41,7 +41,6 @@ struct rtentry; #include #include -#include #include #include @@ -52,6 +51,7 @@ struct rtentry; #include "addrtoname.h" #include "ethertype.h" +#include "ether.h" #include "token.h" /* Extract src, dst addresses */ diff --git a/print-vjc.c b/print-vjc.c index baec41a5..817e4f0f 100644 --- a/print-vjc.c +++ b/print-vjc.c @@ -27,7 +27,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-vjc.c,v 1.4 2000-07-01 03:39:11 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-vjc.c,v 1.5 2000-09-23 08:03:41 guy Exp $ (LBL)"; #endif #include @@ -43,7 +43,6 @@ struct rtentry; #include #include #include -#include #include #include diff --git a/smbutil.c b/smbutil.c index c91b2cc5..f7ee7aa5 100644 --- a/smbutil.c +++ b/smbutil.c @@ -11,7 +11,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.9 2000-07-29 08:03:06 assar Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.10 2000-09-23 08:03:42 guy Exp $"; #endif #include @@ -22,7 +22,6 @@ static const char rcsid[] = #include #include -#include #include #include