diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-03-28 18:32:03 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-03-28 18:32:03 +0000 |
commit | 2b86d46d706b3f60e3804b6ee9348752aa601b9a (patch) | |
tree | 73171006c6a2e830fe9b6742f081ab1e0b24131c | |
parent | 4932ef3dcc5b76692e982fbb4d17153e998f69ba (diff) | |
download | wireshark-2b86d46d706b3f60e3804b6ee9348752aa601b9a.tar.gz wireshark-2b86d46d706b3f60e3804b6ee9348752aa601b9a.tar.bz2 wireshark-2b86d46d706b3f60e3804b6ee9348752aa601b9a.zip |
Jun-ichiro's IPv6 patch is merged in with ethereal and now uses the new
proto*() functions. The configure script tries to use ipv6 name resolution if
it knows the type of ipv6 stack the user has (this can be avoided with the
--disable-ipv6 switch) Additionally, the configure script now deals with wiretap
better. If the user doesn't want to compile wiretap, the wiretap is never
visited. A few unnecessary #includes were removed from some wiretap files, and
a CPP macro was moved from bpf.c to wtap.h.
svn path=/trunk/; revision=229
-rw-r--r-- | Makefile.am | 15 | ||||
-rw-r--r-- | Makefile.in | 43 | ||||
-rw-r--r-- | README | 24 | ||||
-rw-r--r-- | acinclude.m4 | 94 | ||||
-rw-r--r-- | aclocal.m4 | 99 | ||||
-rwxr-xr-x | configure | 321 | ||||
-rw-r--r-- | configure.in | 26 | ||||
-rw-r--r-- | packet-atalk.c | 2 | ||||
-rw-r--r-- | packet-ip.c | 31 | ||||
-rw-r--r-- | packet-ip.h | 28 | ||||
-rw-r--r-- | packet-ipv6.c | 379 | ||||
-rw-r--r-- | packet-ipv6.h | 486 | ||||
-rw-r--r-- | packet.c | 3 | ||||
-rw-r--r-- | packet.h | 25 | ||||
-rw-r--r-- | resolv.c | 48 | ||||
-rw-r--r-- | resolv.h | 6 | ||||
-rw-r--r-- | wiretap/Makefile.am | 8 | ||||
-rw-r--r-- | wiretap/Makefile.in | 10 | ||||
-rw-r--r-- | wiretap/README | 14 | ||||
-rw-r--r-- | wiretap/aclocal.m4 | 9 | ||||
-rw-r--r-- | wiretap/bpf-engine.c | 1 | ||||
-rw-r--r-- | wiretap/bpf.c | 13 | ||||
-rw-r--r-- | wiretap/config.h.in | 3 | ||||
-rwxr-xr-x | wiretap/configure | 384 | ||||
-rw-r--r-- | wiretap/configure.in | 4 | ||||
-rw-r--r-- | wiretap/netmon.c | 3 | ||||
-rw-r--r-- | wiretap/wtap.h | 15 |
27 files changed, 1795 insertions, 299 deletions
diff --git a/Makefile.am b/Makefile.am index 3c3baeaa66..07423d8a45 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,11 +26,13 @@ ethereal_SOURCES = \ packet-fddi.c \ packet-giop.c \ packet-http.c \ - packet-llc.c \ - packet-lpd.c \ packet-ip.c \ + packet-icmpv6.c \ + packet-ipsec.c \ packet-ipv6.c \ packet-ipx.c \ + packet-llc.c \ + packet-lpd.c \ packet-nbipx.c \ packet-nbns.c \ packet-ncp.c \ @@ -88,9 +90,10 @@ ps.c: print.ps rdps rdps: rdps.c $(CC) -o rdps rdps.c -DISTCLEANFILES = \ - rdps \ - ps.c +DISTCLEANFILES = \ + rdps \ + ps.c \ + *~ EXTRA_DIST = \ doc/Makefile \ @@ -103,4 +106,4 @@ EXTRA_DIST = \ print.ps \ rdps.c -SUBDIRS= wiretap +SUBDIRS = @SUBDIRS@ diff --git a/Makefile.in b/Makefile.in index 545ee3ff39..3a60edb9c5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -71,7 +71,6 @@ RANLIB = @RANLIB@ SNPRINTF_C = @SNPRINTF_C@ SNPRINTF_O = @SNPRINTF_O@ VERSION = @VERSION@ -WIRETAP_DIR = @WIRETAP_DIR@ bin_PROGRAMS = ethereal @@ -101,11 +100,13 @@ ethereal_SOURCES = \ packet-fddi.c \ packet-giop.c \ packet-http.c \ - packet-llc.c \ - packet-lpd.c \ packet-ip.c \ + packet-icmpv6.c \ + packet-ipsec.c \ packet-ipv6.c \ packet-ipx.c \ + packet-llc.c \ + packet-lpd.c \ packet-nbipx.c \ packet-nbns.c \ packet-ncp.c \ @@ -157,9 +158,10 @@ EXTRA_ethereal_SOURCES = \ ethereal_DEPENDENCIES = @SNPRINTF_O@ @LIBWIRETAP_A@ ethereal_LDADD = @SNPRINTF_O@ @LIBWIRETAP_A@ -DISTCLEANFILES = \ - rdps \ - ps.c +DISTCLEANFILES = \ + rdps \ + ps.c \ + *~ EXTRA_DIST = \ doc/Makefile \ @@ -172,7 +174,7 @@ EXTRA_DIST = \ print.ps \ rdps.c -SUBDIRS= wiretap +SUBDIRS = @SUBDIRS@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h @@ -188,11 +190,11 @@ ethereal_OBJECTS = capture.o column.o ethereal.o ethertype.o file.o \ filter.o follow.o gtkpacket.o menu.o packet.o packet-aarp.o \ packet-arp.o packet-atalk.o packet-bootp.o packet-cdp.o packet-data.o \ packet-dns.o packet-eth.o packet-fddi.o packet-giop.o packet-http.o \ -packet-llc.o packet-lpd.o packet-ip.o packet-ipv6.o packet-ipx.o \ -packet-nbipx.o packet-nbns.o packet-ncp.o packet-null.o packet-osi.o \ -packet-ospf.o packet-ppp.o packet-raw.o packet-rip.o packet-tcp.o \ -packet-tftp.o packet-tr.o packet-trmac.o packet-udp.o packet-vines.o \ -prefs.o print.o ps.o resolv.o util.o +packet-ip.o packet-icmpv6.o packet-ipsec.o packet-ipv6.o packet-ipx.o \ +packet-llc.o packet-lpd.o packet-nbipx.o packet-nbns.o packet-ncp.o \ +packet-null.o packet-osi.o packet-ospf.o packet-ppp.o packet-raw.o \ +packet-rip.o packet-tcp.o packet-tftp.o packet-tr.o packet-trmac.o \ +packet-udp.o packet-vines.o prefs.o print.o ps.o resolv.o util.o ethereal_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @@ -219,14 +221,15 @@ DEP_FILES = .deps/capture.P .deps/column.P .deps/ethereal.P \ .deps/packet-atalk.P .deps/packet-bootp.P .deps/packet-cdp.P \ .deps/packet-data.P .deps/packet-dns.P .deps/packet-eth.P \ .deps/packet-fddi.P .deps/packet-giop.P .deps/packet-http.P \ -.deps/packet-ip.P .deps/packet-ipv6.P .deps/packet-ipx.P \ -.deps/packet-llc.P .deps/packet-lpd.P .deps/packet-nbipx.P \ -.deps/packet-nbns.P .deps/packet-ncp.P .deps/packet-null.P \ -.deps/packet-osi.P .deps/packet-ospf.P .deps/packet-ppp.P \ -.deps/packet-raw.P .deps/packet-rip.P .deps/packet-tcp.P \ -.deps/packet-tftp.P .deps/packet-tr.P .deps/packet-trmac.P \ -.deps/packet-udp.P .deps/packet-vines.P .deps/packet.P .deps/prefs.P \ -.deps/print.P .deps/ps.P .deps/resolv.P .deps/snprintf.P .deps/util.P +.deps/packet-icmpv6.P .deps/packet-ip.P .deps/packet-ipsec.P \ +.deps/packet-ipv6.P .deps/packet-ipx.P .deps/packet-llc.P \ +.deps/packet-lpd.P .deps/packet-nbipx.P .deps/packet-nbns.P \ +.deps/packet-ncp.P .deps/packet-null.P .deps/packet-osi.P \ +.deps/packet-ospf.P .deps/packet-ppp.P .deps/packet-raw.P \ +.deps/packet-rip.P .deps/packet-tcp.P .deps/packet-tftp.P \ +.deps/packet-tr.P .deps/packet-trmac.P .deps/packet-udp.P \ +.deps/packet-vines.P .deps/packet.P .deps/prefs.P .deps/print.P \ +.deps/ps.P .deps/resolv.P .deps/snprintf.P .deps/util.P SOURCES = $(ethereal_SOURCES) $(EXTRA_ethereal_SOURCES) OBJECTS = $(ethereal_OBJECTS) @@ -13,13 +13,17 @@ The latest distribution can be found in the subdirectory http://ethereal.zing.org/distribution +Interesting and exotic packet traces can be found at + + http://ethereal.zing.org/~gram/sample.html + Installation ------------ Ethereal is known to compile and run on the following systems: - - Linux (2.0.x) + - Linux (2.0.x, 2.1.x, 2.2.x) - Solaris (2.5.1, 2.6) - FreeBSD (2.2.5, 2.2.6) @@ -64,8 +68,22 @@ If you want to add support for other packet-capture file formats, please look at the wiretap source code in the wiretap directory. Please report any problems that are wiretap related to -Gilbert Ramirez <gram@verdict.uthscsa.edu>. He uses token-ring at work, so he -is especially interested in any non-token-ring trace files you can send him. +Gilbert Ramirez <gram@verdict.uthscsa.edu>. + + +IPv6 +---- +If your operating system includes IPv6 support, ethereal will attempt to +use reverse name resolution capabilities when decoding IPv6 packets. If +you want to turn off name resolution while using ethereal, start ethereal +with the "-n" option. If you would like to compile ethereal without +support for IPv6 name resolution, use the "--disable-ipv6" option with +"./configure". If you compile ethereal without IPv6 name resolution, +you will still be able to decode IPv6 packets, but you'll only see IPv6 +addresses, not host names. + +The "Follow TCP Stream" feature only supports TCP over IPv4. Support for TCP +over IPv6 is planned. Disclaimer diff --git a/acinclude.m4 b/acinclude.m4 index e5b6615eca..4295ac5071 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -48,6 +48,9 @@ dnl Written by David MacKenzie, with help from dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. +# +# AC_ETHEREAL_STRUCT_SA_LEN +# dnl AC_STRUCT_ST_BLKSIZE extracted from the file in qustion, dnl "acspecific.m4" in GNU Autoconf 2.12, and turned into dnl AC_ETHEREAL_STRUCT_SA_LEN, which checks if "struct sockaddr" @@ -57,7 +60,6 @@ dnl Done by Guy Harris <guy@netapp.com> on 1998-11-14. dnl ### Checks for structure members - AC_DEFUN(AC_ETHEREAL_STRUCT_SA_LEN, [AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_ethereal_struct_sa_len, [AC_TRY_COMPILE([#include <sys/types.h> @@ -67,3 +69,93 @@ if test $ac_cv_ethereal_struct_sa_len = yes; then AC_DEFINE(HAVE_SA_LEN) fi ]) + + +# +# AC_ETHEREAL_IPV6_STACK +# +# By Jun-ichiro "itojun" Hagino, <itojun@iijlab.net> + +AC_DEFUN(AC_ETHEREAL_IPV6_STACK, +[ + v6type=unknown + v6lib=none + + AC_MSG_CHECKING([ipv6 stack type]) + for i in v6d toshiba kame inria zeta linux; do + case $i in + v6d) + AC_EGREP_CPP(yes, [dnl +#include </usr/local/v6/include/sys/types.h> +#ifdef __V6D__ +yes +#endif], + [v6type=$i; v6lib=v6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-I/usr/local/v6/include $CFLAGS"]) + ;; + toshiba) + AC_EGREP_CPP(yes, [dnl +#include <sys/param.h> +#ifdef _TOSHIBA_INET6 +yes +#endif], + [v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-DINET6 $CFLAGS"]) + ;; + kame) + AC_EGREP_CPP(yes, [dnl +#include <netinet/in.h> +#ifdef __KAME__ +yes +#endif], + [v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-DINET6 $CFLAGS"]) + ;; + inria) + AC_EGREP_CPP(yes, [dnl +#include <netinet/in.h> +#ifdef IPV6_INRIA_VERSION +yes +#endif], + [v6type=$i; CFLAGS="-DINET6 $CFLAGS"]) + ;; + zeta) + AC_EGREP_CPP(yes, [dnl +#include <sys/param.h> +#ifdef _ZETA_MINAMI_INET6 +yes +#endif], + [v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-DINET6 $CFLAGS"]) + ;; + linux) + if test -d /usr/inet6; then + v6type=$i + v6lib=inet6 + v6libdir=/usr/inet6 + CFLAGS="-DINET6 $CFLAGS" + fi + ;; + esac + if test "$v6type" != "unknown"; then + break + fi + done + + if test "$v6lib" != "none"; then + for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do + if test -d $dir -a -f $dir/lib$v6lib.a; then + LIBS="-L$dir -l$v6lib $LIBS" + break + fi + done + enable_ipv6="yes" + else + enable_ipv6="no" + fi + AC_MSG_RESULT(["$v6type, $v6lib"]) +]) diff --git a/aclocal.m4 b/aclocal.m4 index 9192f53645..0f14536c82 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -60,6 +60,9 @@ dnl Written by David MacKenzie, with help from dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. +# +# AC_ETHEREAL_STRUCT_SA_LEN +# dnl AC_STRUCT_ST_BLKSIZE extracted from the file in qustion, dnl "acspecific.m4" in GNU Autoconf 2.12, and turned into dnl AC_ETHEREAL_STRUCT_SA_LEN, which checks if "struct sockaddr" @@ -69,7 +72,6 @@ dnl Done by Guy Harris <guy@netapp.com> on 1998-11-14. dnl ### Checks for structure members - AC_DEFUN(AC_ETHEREAL_STRUCT_SA_LEN, [AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_ethereal_struct_sa_len, [AC_TRY_COMPILE([#include <sys/types.h> @@ -80,6 +82,96 @@ if test $ac_cv_ethereal_struct_sa_len = yes; then fi ]) + +# +# AC_ETHEREAL_IPV6_STACK +# +# By Jun-ichiro "itojun" Hagino, <itojun@iijlab.net> + +AC_DEFUN(AC_ETHEREAL_IPV6_STACK, +[ + v6type=unknown + v6lib=none + + AC_MSG_CHECKING([ipv6 stack type]) + for i in v6d toshiba kame inria zeta linux; do + case $i in + v6d) + AC_EGREP_CPP(yes, [dnl +#include </usr/local/v6/include/sys/types.h> +#ifdef __V6D__ +yes +#endif], + [v6type=$i; v6lib=v6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-I/usr/local/v6/include $CFLAGS"]) + ;; + toshiba) + AC_EGREP_CPP(yes, [dnl +#include <sys/param.h> +#ifdef _TOSHIBA_INET6 +yes +#endif], + [v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-DINET6 $CFLAGS"]) + ;; + kame) + AC_EGREP_CPP(yes, [dnl +#include <netinet/in.h> +#ifdef __KAME__ +yes +#endif], + [v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-DINET6 $CFLAGS"]) + ;; + inria) + AC_EGREP_CPP(yes, [dnl +#include <netinet/in.h> +#ifdef IPV6_INRIA_VERSION +yes +#endif], + [v6type=$i; CFLAGS="-DINET6 $CFLAGS"]) + ;; + zeta) + AC_EGREP_CPP(yes, [dnl +#include <sys/param.h> +#ifdef _ZETA_MINAMI_INET6 +yes +#endif], + [v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-DINET6 $CFLAGS"]) + ;; + linux) + if test -d /usr/inet6; then + v6type=$i + v6lib=inet6 + v6libdir=/usr/inet6 + CFLAGS="-DINET6 $CFLAGS" + fi + ;; + esac + if test "$v6type" != "unknown"; then + break + fi + done + + if test "$v6lib" != "none"; then + for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do + if test -d $dir -a -f $dir/lib$v6lib.a; then + LIBS="-L$dir -l$v6lib $LIBS" + break + fi + done + enable_ipv6="yes" + else + enable_ipv6="no" + fi + AC_MSG_RESULT(["$v6type, $v6lib"]) +]) + # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. @@ -244,10 +336,13 @@ int main () { int major, minor, micro; + char *tmp_version; system ("touch conf.gtktest"); - if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtk_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } @@ -20,6 +20,8 @@ ac_help="$ac_help ac_help="$ac_help --with-wiretap Include wiretap library. --without-wiretap Don't include wiretap library (default)" +ac_help="$ac_help + --enable-ipv6 use ipv6 name resolution, if available. [default=yes]" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -558,7 +560,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # 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:562: checking for a BSD compatible install" >&5 +echo "configure:564: 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 @@ -611,7 +613,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:615: checking whether build environment is sane" >&5 +echo "configure:617: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -668,7 +670,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:672: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:674: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -714,7 +716,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:718: checking for working aclocal" >&5 +echo "configure:720: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -727,7 +729,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:731: checking for working autoconf" >&5 +echo "configure:733: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -740,7 +742,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:744: checking for working automake" >&5 +echo "configure:746: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -753,7 +755,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:757: checking for working autoheader" >&5 +echo "configure:759: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -766,7 +768,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:770: checking for working makeinfo" >&5 +echo "configure:772: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -787,7 +789,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:791: checking host system type" >&5 +echo "configure:793: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -811,7 +813,7 @@ echo "$ac_t""$host" 1>&6 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:815: checking for $ac_word" >&5 +echo "configure:817: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -840,7 +842,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:844: checking for $ac_word" >&5 +echo "configure:846: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -888,7 +890,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:892: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:894: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -898,11 +900,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 902 "configure" +#line 904 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -922,12 +924,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:926: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:928: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:931: checking whether we are using GNU C" >&5 +echo "configure:933: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -936,7 +938,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:940: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:942: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -951,7 +953,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:955: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:957: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -981,7 +983,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:985: checking for $ac_word" >&5 +echo "configure:987: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1010,7 +1012,7 @@ fi # If we're running gcc, add '-Wall' to CFLAGS. echo $ac_n "checking to see if we can add '-Wall' to CFLAGS""... $ac_c" 1>&6 -echo "configure:1014: checking to see if we can add '-Wall' to CFLAGS" >&5 +echo "configure:1016: checking to see if we can add '-Wall' to CFLAGS" >&5 if test x$GCC != x ; then CFLAGS="-Wall $CFLAGS" echo "$ac_t""yes" 1>&6 @@ -1036,7 +1038,7 @@ EOF case "$host_os" in solaris*) echo $ac_n "checking for LD_LIBRARY_PATH""... $ac_c" 1>&6 -echo "configure:1040: checking for LD_LIBRARY_PATH" >&5 +echo "configure:1042: checking for LD_LIBRARY_PATH" >&5 if test x$LD_LIBRARY_PATH != x ; then LIBS="$LIBS -R$LD_LIBRARY_PATH" echo "$ac_t""yes -- added LD_LIBRARY_PATH to run-time linker path" 1>&6 @@ -1088,7 +1090,7 @@ fi # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1092: checking for $ac_word" >&5 +echo "configure:1094: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1119,7 +1121,7 @@ fi min_gtk_version=1.0.0 echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 -echo "configure:1123: checking for GTK - version >= $min_gtk_version" >&5 +echo "configure:1125: checking for GTK - version >= $min_gtk_version" >&5 no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes @@ -1142,7 +1144,7 @@ echo "configure:1123: checking for GTK - version >= $min_gtk_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext <<EOF -#line 1146 "configure" +#line 1148 "configure" #include "confdefs.h" #include <gtk/gtk.h> @@ -1152,10 +1154,13 @@ int main () { int major, minor, micro; + char *tmp_version; system ("touch conf.gtktest"); - if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtk_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } @@ -1205,7 +1210,7 @@ main () } EOF -if { (eval echo configure:1209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1214: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1239,7 +1244,7 @@ fi CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat > conftest.$ac_ext <<EOF -#line 1243 "configure" +#line 1248 "configure" #include "confdefs.h" #include <gtk/gtk.h> @@ -1249,7 +1254,7 @@ int main() { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } EOF -if { (eval echo configure:1253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" @@ -1290,7 +1295,7 @@ rm -f conftest* # Evidently, some systems have pcap.h, etc. in */include/pcap echo $ac_n "checking for extraneous pcap header directories""... $ac_c" 1>&6 -echo "configure:1294: checking for extraneous pcap header directories" >&5 +echo "configure:1299: checking for extraneous pcap header directories" >&5 found_pcap_dir="" for pcap_dir in /usr/include/pcap /usr/local/include/pcap do @@ -1310,7 +1315,7 @@ fi # Pcap checks echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1314: checking how to run the C preprocessor" >&5 +echo "configure:1319: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1325,13 +1330,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1329 "configure" +#line 1334 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1340: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1342,13 +1347,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1346 "configure" +#line 1351 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1352: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1357: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1372,17 +1377,17 @@ echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "net/bpf.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for net/bpf.h""... $ac_c" 1>&6 -echo "configure:1376: checking for net/bpf.h" >&5 +echo "configure:1381: checking for net/bpf.h" >&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 -#line 1381 "configure" +#line 1386 "configure" #include "confdefs.h" #include <net/bpf.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1386: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1391: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1406,17 +1411,17 @@ fi ac_safe=`echo "pcap.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for pcap.h""... $ac_c" 1>&6 -echo "configure:1410: checking for pcap.h" >&5 +echo "configure:1415: checking for pcap.h" >&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 -#line 1415 "configure" +#line 1420 "configure" #include "confdefs.h" #include <pcap.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1420: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1439,7 +1444,7 @@ else fi echo $ac_n "checking for pcap_open_offline in -lpcap""... $ac_c" 1>&6 -echo "configure:1443: checking for pcap_open_offline in -lpcap" >&5 +echo "configure:1448: checking for pcap_open_offline in -lpcap" >&5 ac_lib_var=`echo pcap'_'pcap_open_offline | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1447,7 +1452,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 1451 "configure" +#line 1456 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1458,7 +1463,7 @@ int main() { pcap_open_offline() ; return 0; } EOF -if { (eval echo configure:1462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1489,7 +1494,7 @@ fi # Wiretap check echo $ac_n "checking whether to include wiretap library""... $ac_c" 1>&6 -echo "configure:1493: checking whether to include wiretap library" >&5 +echo "configure:1498: checking whether to include wiretap library" >&5 # Check whether --with-wiretap or --without-wiretap was given. if test "${with_wiretap+set}" = set; then withval="$with_wiretap" @@ -1500,9 +1505,12 @@ if test "${with_wiretap+set}" = set; then #define WITH_WIRETAP 1 EOF - CFLAGS="$CFLAGS -Iwiretap" - LIBWIRETAP_A="wiretap/libwiretap.a" WIRETAP_DIR="wiretap" + if test x$WIRETAP_DIR != x ; then + CFLAGS="$CFLAGS -Iwiretap" + LIBWIRETAP_A="wiretap/libwiretap.a" + SUBDIRS="$SUBDIRS wiretap" + fi ;; *) echo "$ac_t""no" 1>&6 @@ -1518,13 +1526,164 @@ fi +# Check whether --enable-ipv6 or --disable-ipv6 was given. +if test "${enable_ipv6+set}" = set; then + enableval="$enable_ipv6" + : +else + enable_ipv6=yes +fi + + +echo $ac_n "checking whether to enable ipv6 name resolution if available""... $ac_c" 1>&6 +echo "configure:1540: checking whether to enable ipv6 name resolution if available" >&5 +if test "x$enable_ipv6" = "xno" ; then + echo "$ac_t""no" 1>&6 +else + echo "$ac_t""yes" 1>&6 + + v6type=unknown + v6lib=none + + echo $ac_n "checking ipv6 stack type""... $ac_c" 1>&6 +echo "configure:1550: checking ipv6 stack type" >&5 + for i in v6d toshiba kame inria zeta linux; do + case $i in + v6d) + cat > conftest.$ac_ext <<EOF +#line 1555 "configure" +#include "confdefs.h" +dnl +#include </usr/local/v6/include/sys/types.h> +#ifdef __V6D__ +yes +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + v6type=$i; v6lib=v6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-I/usr/local/v6/include $CFLAGS" +fi +rm -f conftest* + + ;; + toshiba) + cat > conftest.$ac_ext <<EOF +#line 1575 "configure" +#include "confdefs.h" +dnl +#include <sys/param.h> +#ifdef _TOSHIBA_INET6 +yes +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-DINET6 $CFLAGS" +fi +rm -f conftest* + + ;; + kame) + cat > conftest.$ac_ext <<EOF +#line 1595 "configure" +#include "confdefs.h" +dnl +#include <netinet/in.h> +#ifdef __KAME__ +yes +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-DINET6 $CFLAGS" +fi +rm -f conftest* + + ;; + inria) + cat > conftest.$ac_ext <<EOF +#line 1615 "configure" +#include "confdefs.h" +dnl +#include <netinet/in.h> +#ifdef IPV6_INRIA_VERSION +yes +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + v6type=$i; CFLAGS="-DINET6 $CFLAGS" +fi +rm -f conftest* + + ;; + zeta) + cat > conftest.$ac_ext <<EOF +#line 1633 "configure" +#include "confdefs.h" +dnl +#include <sys/param.h> +#ifdef _ZETA_MINAMI_INET6 +yes +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-DINET6 $CFLAGS" +fi +rm -f conftest* + + ;; + linux) + if test -d /usr/inet6; then + v6type=$i + v6lib=inet6 + v6libdir=/usr/inet6 + CFLAGS="-DINET6 $CFLAGS" + fi + ;; + esac + if test "$v6type" != "unknown"; then + break + fi + done + + if test "$v6lib" != "none"; then + for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do + if test -d $dir -a -f $dir/lib$v6lib.a; then + LIBS="-L$dir -l$v6lib $LIBS" + break + fi + done + enable_ipv6="yes" + else + enable_ipv6="no" + fi + echo "$ac_t"""$v6type, $v6lib"" 1>&6 + +fi + + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1523: checking for ANSI C header files" >&5 +echo "configure:1682: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1528 "configure" +#line 1687 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1532,7 +1691,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1549,7 +1708,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1553 "configure" +#line 1712 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1567,7 +1726,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1571 "configure" +#line 1730 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1588,7 +1747,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1592 "configure" +#line 1751 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1599,7 +1758,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1626,17 +1785,17 @@ for ac_hdr in fcntl.h strings.h sys/ioctl.h sys/time.h unistd.h stdarg.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1630: checking for $ac_hdr" >&5 +echo "configure:1789: 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 -#line 1635 "configure" +#line 1794 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1667,17 +1826,17 @@ for ac_hdr in sys/sockio.h sys/types.h netinet/in.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1671: checking for $ac_hdr" >&5 +echo "configure:1830: 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 -#line 1676 "configure" +#line 1835 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1681: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1710,12 +1869,12 @@ done # for get_interface_list(). echo $ac_n "checking for sa_len in struct sockaddr""... $ac_c" 1>&6 -echo "configure:1714: checking for sa_len in struct sockaddr" >&5 +echo "configure:1873: checking for sa_len in struct sockaddr" >&5 if eval "test \"`echo '$''{'ac_cv_ethereal_struct_sa_len'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1719 "configure" +#line 1878 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/socket.h> @@ -1723,7 +1882,7 @@ int main() { struct sockaddr s; s.sa_len; ; return 0; } EOF -if { (eval echo configure:1727: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1886: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_ethereal_struct_sa_len=yes else @@ -1746,14 +1905,14 @@ fi # We must know our byte order echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:1750: checking whether byte ordering is bigendian" >&5 +echo "configure:1909: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext <<EOF -#line 1757 "configure" +#line 1916 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -1764,11 +1923,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1768: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext <<EOF -#line 1772 "configure" +#line 1931 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -1779,7 +1938,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1942: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -1799,7 +1958,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 1803 "configure" +#line 1962 "configure" #include "confdefs.h" main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -1812,7 +1971,7 @@ main () { exit (u.c[sizeof (long) - 1] == 1); } EOF -if { (eval echo configure:1816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -1838,13 +1997,13 @@ fi if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1842: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:2001: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 1848 "configure" +#line 2007 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -1862,7 +2021,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 1866 "configure" +#line 2025 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -1884,12 +2043,12 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 fi echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:1888: checking for socket" >&5 +echo "configure:2047: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1893 "configure" +#line 2052 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char socket(); below. */ @@ -1912,7 +2071,7 @@ socket(); ; return 0; } EOF -if { (eval echo configure:1916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -1938,12 +2097,12 @@ fi SNPRINTF_C="" SNPRINTF_O="" echo $ac_n "checking for snprintf""... $ac_c" 1>&6 -echo "configure:1942: checking for snprintf" >&5 +echo "configure:2101: checking for snprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_snprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1947 "configure" +#line 2106 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char snprintf(); below. */ @@ -1966,7 +2125,7 @@ snprintf(); ; return 0; } EOF -if { (eval echo configure:1970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_snprintf=yes" else @@ -2000,7 +2159,7 @@ fi if test x$WIRETAP_DIR != x ; then - subdirs="wiretap" + subdirs="$WIRETAP_DIR" fi trap '' 1 2 15 @@ -2158,7 +2317,7 @@ s%@GTK_CFLAGS@%$GTK_CFLAGS%g s%@GTK_LIBS@%$GTK_LIBS%g s%@CPP@%$CPP%g s%@LIBWIRETAP_A@%$LIBWIRETAP_A%g -s%@WIRETAP_DIR@%$WIRETAP_DIR%g +s%@SUBDIRS@%$SUBDIRS%g s%@SNPRINTF_C@%$SNPRINTF_C%g s%@SNPRINTF_O@%$SNPRINTF_O%g s%@subdirs@%$subdirs%g @@ -2408,7 +2567,7 @@ if test "$no_recursion" != yes; then esac done - for ac_config_dir in wiretap; do + for ac_config_dir in $WIRETAP_DIR; do # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. diff --git a/configure.in b/configure.in index 354a15a63d..1d677f537d 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.19 1999/01/10 21:23:41 gerald Exp $ +# $Id: configure.in,v 1.20 1999/03/28 18:31:58 gram Exp $ dnl Process this file with autoconf to produce a configure script. AC_INIT(etypes.h) @@ -81,9 +81,12 @@ AC_ARG_WITH(wiretap, yes) AC_MSG_RESULT(yes) AC_DEFINE(WITH_WIRETAP) - CFLAGS="$CFLAGS -Iwiretap" - LIBWIRETAP_A="wiretap/libwiretap.a" WIRETAP_DIR="wiretap" + if test x$WIRETAP_DIR != x ; then + CFLAGS="$CFLAGS -Iwiretap" + LIBWIRETAP_A="wiretap/libwiretap.a" + SUBDIRS="$SUBDIRS wiretap" + fi ;; *) AC_MSG_RESULT(no) @@ -94,7 +97,20 @@ AC_ARG_WITH(wiretap, AC_MSG_RESULT(no) ) AC_SUBST(LIBWIRETAP_A) -AC_SUBST(WIRETAP_DIR) +AC_SUBST(SUBDIRS) + +dnl ipv6 check +AC_ARG_ENABLE(ipv6, +[ --enable-ipv6 use ipv6 name resolution, if available. [default=yes]],,enable_ipv6=yes) + +AC_MSG_CHECKING(whether to enable ipv6 name resolution if available) +if test "x$enable_ipv6" = "xno" ; then + AC_MSG_RESULT(no) +else + AC_MSG_RESULT(yes) + AC_ETHEREAL_IPV6_STACK +fi + dnl Checks for header files. AC_HEADER_STDC @@ -132,6 +148,6 @@ AC_SUBST(SNPRINTF_O) AM_CONFIG_HEADER(config.h) if test x$WIRETAP_DIR != x ; then - AC_CONFIG_SUBDIRS(wiretap) + AC_CONFIG_SUBDIRS($WIRETAP_DIR) fi AC_OUTPUT(Makefile) diff --git a/packet-atalk.c b/packet-atalk.c index 7a70f23905..fbc4527d81 100644 --- a/packet-atalk.c +++ b/packet-atalk.c @@ -29,11 +29,9 @@ #include <glib.h> #include "packet.h" -#if BYTE_ORDER == LITTLE_ENDIAN #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif -#endif extern packet_info pi; diff --git a/packet-ip.c b/packet-ip.c index 210a08fdc1..0c1b325ec1 100644 --- a/packet-ip.c +++ b/packet-ip.c @@ -1,7 +1,7 @@ /* packet-ip.c * Routines for IP and miscellaneous IP protocol packet disassembly * - * $Id: packet-ip.c,v 1.18 1999/03/23 03:14:38 gram Exp $ + * $Id: packet-ip.c,v 1.19 1999/03/28 18:31:58 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -565,6 +565,8 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { { IPTOS_PREC_INTERNETCONTROL, "internetwork control" }, { IPTOS_PREC_NETCONTROL, "network control" }, { 0, NULL } }; + int advance; + guint8 nxt; /* To do: check for runts, errs, etc. */ /* Avoids alignment problems on many architectures. */ @@ -582,6 +584,9 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { case IP_PROTO_TCP: case IP_PROTO_UDP: case IP_PROTO_OSPF: + case IP_PROTO_ESP: + case IP_PROTO_AH: + case IP_PROTO_IPV6: /* Names are set in the associated dissect_* routines */ break; default: @@ -701,7 +706,18 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { pi.ip_src = iph.ip_src; offset += hlen; - switch (iph.ip_p) { + nxt = iph.ip_p; + if (iph.ip_off & IP_OFFSET) { + /* fragmented */ + if (check_col(fd, COL_INFO)) + col_add_fstr(fd, COL_INFO, "Fragmented IP protocol (proto=%02x, off=%d)", + iph.ip_p, iph.ip_off & IP_OFFSET); + dissect_data(pd, offset, fd, tree); + return; + } + +again: + switch (nxt) { case IP_PROTO_ICMP: dissect_icmp(pd, offset, fd, tree); break; @@ -717,6 +733,17 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { case IP_PROTO_OSPF: dissect_ospf(pd, offset, fd, tree); break; + case IP_PROTO_AH: + advance = dissect_ah(pd, offset, fd, tree); + nxt = pd[offset]; + offset += advance; + goto again; + case IP_PROTO_ESP: + dissect_esp(pd, offset, fd, tree); + break; + case IP_PROTO_IPV6: + dissect_ipv6(pd, offset, fd, tree); + break; } } diff --git a/packet-ip.h b/packet-ip.h index 2dc52ea39d..a05bfac0d0 100644 --- a/packet-ip.h +++ b/packet-ip.h @@ -1,7 +1,7 @@ /* packet-ip.h * Definitions for IP packet disassembly structures and routines * - * $Id: packet-ip.h,v 1.1 1999/03/23 03:14:38 gram Exp $ + * $Id: packet-ip.h,v 1.2 1999/03/28 18:31:59 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -33,6 +33,32 @@ #define IP_PROTO_UDP 17 #define IP_PROTO_OSPF 89 +#define IP_PROTO_IP 0 /* dummy for IP */ +#define IP_PROTO_HOPOPTS 0 /* IP6 hop-by-hop options */ +#define IP_PROTO_ICMP 1 /* control message protocol */ +#define IP_PROTO_IGMP 2 /* group mgmt protocol */ +#define IP_PROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IP_PROTO_IPIP 4 /* IP inside IP */ +#define IP_PROTO_IPV4 4 /* IP header */ +#define IP_PROTO_TCP 6 /* tcp */ +#define IP_PROTO_EGP 8 /* exterior gateway protocol */ +#define IP_PROTO_PUP 12 /* pup */ +#define IP_PROTO_UDP 17 /* user datagram protocol */ +#define IP_PROTO_IDP 22 /* xns idp */ +#define IP_PROTO_TP 29 /* tp-4 w/ class negotiation */ +#define IP_PROTO_IPV6 41 /* IP6 header */ +#define IP_PROTO_ROUTING 43 /* IP6 routing header */ +#define IP_PROTO_FRAGMENT 44 /* IP6 fragmentation header */ +#define IP_PROTO_ESP 50 /* ESP */ +#define IP_PROTO_AH 51 /* AH */ +#define IP_PROTO_ICMPV6 58 /* ICMP6 */ +#define IP_PROTO_NONE 59 /* IP6 no next header */ +#define IP_PROTO_DSTOPTS 60 /* IP6 no next header */ +#define IP_PROTO_EON 80 /* ISO cnlp */ +#define IP_PROTO_OSPF 89 +#define IP_PROTO_ENCAP 98 /* encapsulation header */ +#define IP_PROTO_PIM 103 /* Protocol Independent Mcast */ + typedef enum { NO_LENGTH, /* option has no data, hence no length */ FIXED_LENGTH, /* option always has the same length */ diff --git a/packet-ipv6.c b/packet-ipv6.c index 9a4cffe200..c7e4ad8e28 100644 --- a/packet-ipv6.c +++ b/packet-ipv6.c @@ -1,7 +1,7 @@ /* packet-ipv6.c * Routines for IPv6 packet disassembly * - * $Id: packet-ipv6.c,v 1.6 1999/03/23 03:14:38 gram Exp $ + * $Id: packet-ipv6.c,v 1.7 1999/03/28 18:31:59 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -30,42 +30,98 @@ #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif +#include <sys/socket.h> #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif +#include <string.h> +#include <stdio.h> #include <glib.h> #include "packet.h" #include "packet-ip.h" #include "packet-ipv6.h" #include "etypes.h" +#include "resolv.h" + +#ifndef offsetof +#define offsetof(type, member) ((size_t)(&((type *)0)->member)) +#endif + +static const char * +inet_ntop6(const u_char *src, char *dst, size_t size); + +static const char * +inet_ntop4(const u_char *src, char *dst, size_t size); + +static int +dissect_routing6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + return 0; +} + +static int +dissect_frag6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + if (check_col(fd, COL_INFO)) { + col_add_fstr(fd, COL_INFO, "IPv6 fragment"); + } + return 0; +} + +static int +dissect_hopopts(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + return 0; +} + +static int +dissect_dstopts(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + struct ip6_dest dstopt; + int len; + proto_tree *dstopt_tree; + proto_item *ti; + + memcpy(&dstopt, (void *) &pd[offset], sizeof(dstopt)); + len = (dstopt.ip6d_len + 1) << 3; + + if (tree) { + /* !!! specify length */ + ti = proto_tree_add_item(tree, offset, len, + "Destination Option Header"); + dstopt_tree = proto_tree_new(); + proto_item_add_subtree(ti, dstopt_tree, ETT_IPv6); + + proto_tree_add_item(dstopt_tree, + offset + offsetof(struct ip6_dest, ip6d_len), 1, + "Length: %d (%d bytes)", dstopt.ip6d_len, len); + + /* decode... */ + } + + return len; +} + void dissect_ipv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree *ipv6_tree; proto_item *ti; + guint8 nxt; + int advance; - e_ipv6_header ipv6; - - memcpy(&ipv6, (void *) &pd[offset], 8); - - switch(ipv6.next_header){ - /* - case IP_PROTO_ICMP: - case IP_PROTO_IGMP: - case IP_PROTO_TCP: - case IP_PROTO_UDP: - case IP_PROTO_OSPF: - */ - /* Names are set in the associated dissect_* routines */ - /* break; */ - default: - if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "IPv6"); - if (check_col(fd, COL_INFO)) - col_add_fstr(fd, COL_INFO, "IPv6 support is still under development (%d)", ipv6.next_header); - } + struct ip6_hdr ipv6; + + memcpy(&ipv6, (void *) &pd[offset], sizeof(ipv6)); + + if (check_col(fd, COL_PROTOCOL)) + col_add_str(fd, COL_PROTOCOL, "IPv6"); + if (check_col(fd, COL_RES_NET_SRC)) + col_add_str(fd, COL_RES_NET_SRC, get_hostname6(&ipv6.ip6_src)); + if (check_col(fd, COL_UNRES_NET_SRC)) + col_add_str(fd, COL_UNRES_NET_SRC, ip6_to_str(&ipv6.ip6_src)); + if (check_col(fd, COL_RES_NET_DST)) + col_add_str(fd, COL_RES_NET_DST, get_hostname6(&ipv6.ip6_dst)); + if (check_col(fd, COL_UNRES_NET_DST)) + col_add_str(fd, COL_UNRES_NET_DST, ip6_to_str(&ipv6.ip6_dst)); if (tree) { /* !!! specify length */ @@ -74,31 +130,268 @@ dissect_ipv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_item_add_subtree(ti, ipv6_tree, ETT_IPv6); /* !!! warning: version also contains 4 Bit priority */ - proto_tree_add_item(ipv6_tree, offset, 1, "Version: %d Priority: %d", ipv6.version >> 4 , ipv6.version & 15); - proto_tree_add_item(ipv6_tree, offset + 6, 1, "Next Header: %d", ipv6.next_header); - proto_tree_add_item(ipv6_tree, offset + 4, 2, "Payload Length: %d", ntohs(ipv6.payload_length)); + proto_tree_add_item(ipv6_tree, + offset + offsetof(struct ip6_hdr, ip6_vfc), 1, + "Version: %d", ipv6.ip6_vfc >> 4); + + proto_tree_add_item(ipv6_tree, + offset + offsetof(struct ip6_hdr, ip6_flow), 4, + "Flowinfo: 0x%07x", ipv6.ip6_flow & IPV6_FLOWINFO_MASK); + + proto_tree_add_item(ipv6_tree, + offset + offsetof(struct ip6_hdr, ip6_plen), 2, + "Payload Length: %d", ntohs(ipv6.ip6_plen)); + + proto_tree_add_item(ipv6_tree, + offset + offsetof(struct ip6_hdr, ip6_nxt), 1, + "Next Header: %d", ipv6.ip6_nxt); + + proto_tree_add_item(ipv6_tree, + offset + offsetof(struct ip6_hdr, ip6_hlim), 1, + "Hop limit: %d", ipv6.ip6_hlim); + + proto_tree_add_item(ipv6_tree, + offset + offsetof(struct ip6_hdr, ip6_src), 16, +#ifdef INET6 + "Source address: %s (%s)", + get_hostname6(&ipv6.ip6_src), +#else + "Source address: %s", +#endif + ip6_to_str(&ipv6.ip6_src)); + + proto_tree_add_item(ipv6_tree, + offset + offsetof(struct ip6_hdr, ip6_dst), 16, +#ifdef INET6 + "Destination address: %s (%s)", + get_hostname6(&ipv6.ip6_dst), +#else + "Destination address: %s", +#endif + ip6_to_str(&ipv6.ip6_dst)); } /* start of the new header (could be a extension header) */ offset += 40; - switch (ipv6.next_header) { - case IP_PROTO_ICMP: - dissect_icmp(pd, offset, fd, tree); - break; - case IP_PROTO_IGMP: - dissect_igmp(pd, offset, fd, tree); - break; - case IP_PROTO_TCP: - dissect_tcp(pd, offset, fd, tree); - break; - case IP_PROTO_UDP: - dissect_udp(pd, offset, fd, tree); - break; - case IP_PROTO_OSPF: - dissect_ospf(pd, offset, fd, tree); - break; - default: - dissect_data(pd, offset, fd, tree); - } + nxt = ipv6.ip6_nxt; + +again: + switch (nxt) { + case IP_PROTO_HOPOPTS: + dissect_hopopts(pd, offset, fd, tree); +#if 0 + goto again; +#else + break; +#endif + case IP_PROTO_IPIP: + dissect_ip(pd, offset, fd, tree); + break; + case IP_PROTO_ROUTING: + dissect_routing6(pd, offset, fd, tree); +#if 0 + goto again; +#else + break; +#endif + case IP_PROTO_FRAGMENT: + dissect_frag6(pd, offset, fd, tree); +#if 0 + goto again; +#else + break; +#endif + case IP_PROTO_ICMPV6: + dissect_icmpv6(pd, offset, fd, tree); + break; + case IP_PROTO_NONE: + if (check_col(fd, COL_INFO)) { + col_add_fstr(fd, COL_INFO, "IPv6 no next header"); + } + break; + case IP_PROTO_AH: + advance = dissect_ah(pd, offset, fd, tree); + nxt = pd[offset]; + offset += advance; + goto again; + case IP_PROTO_ESP: + dissect_esp(pd, offset, fd, tree); + break; + case IP_PROTO_DSTOPTS: + advance = dissect_dstopts(pd, offset, fd, tree); + nxt = pd[offset]; + offset += advance; + goto again; + case IP_PROTO_TCP: + dissect_tcp(pd, offset, fd, tree); + break; + case IP_PROTO_UDP: + dissect_udp(pd, offset, fd, tree); + break; + default: + if (check_col(fd, COL_INFO)) { + col_add_fstr(fd, COL_INFO, "Unknown IPv6 protocol (0x%02x)", + ipv6.ip6_nxt); + } + dissect_data(pd, offset, fd, tree); + } +} + +gchar * +ip6_to_str(struct e_in6_addr *ad) { + static gchar buf[4 * 8 + 8]; + + inet_ntop6((u_char*)ad, (gchar*)buf, sizeof(buf)); + return buf; +} + +#ifndef NS_IN6ADDRSZ +#define NS_IN6ADDRSZ 16 +#endif + +#ifndef NS_INT16SZ +#define NS_INT16SZ (sizeof(guint16)) +#endif + +#define SPRINTF(x) ((size_t)sprintf x) + +/* + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* const char * + * inet_ntop4(src, dst, size) + * format an IPv4 address + * return: + * `dst' (as a const) + * notes: + * (1) uses no statics + * (2) takes a u_char* not an in_addr as input + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop4(src, dst, size) + const u_char *src; + char *dst; + size_t size; +{ + static const char fmt[] = "%u.%u.%u.%u"; + char tmp[sizeof "255.255.255.255"]; + + if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) { + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +/* const char * + * inet_ntop6(src, dst, size) + * convert IPv6 binary address into presentation (printable) format + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop6(src, dst, size) + const u_char *src; + char *dst; + size_t size; +{ + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; + struct { int base, len; } best, cur; + u_int words[NS_IN6ADDRSZ / NS_INT16SZ]; + int i; + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof words); + for (i = 0; i < NS_IN6ADDRSZ; i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + best.base = -1; + cur.base = -1; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + if (words[i] == 0) { + if (cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* + * Format the result. + */ + tp = tmp; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + /* Are we inside the best run of 0x00's? */ + if (best.base != -1 && i >= best.base && + i < (best.base + best.len)) { + if (i == best.base) + *tp++ = ':'; + continue; + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) + *tp++ = ':'; + /* Is this address an encapsulated IPv4? */ + if (i == 6 && best.base == 0 && + (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { + if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) + return (NULL); + tp += strlen(tp); + break; + } + tp += SPRINTF((tp, "%x", words[i])); + } + /* Was it a trailing run of 0x00's? */ + if (best.base != -1 && (best.base + best.len) == + (NS_IN6ADDRSZ / NS_INT16SZ)) + *tp++ = ':'; + *tp++ = '\0'; + + /* + * Check for overflow, copy, and we're done. + */ + if ((size_t)(tp - tmp) > size) { + return (NULL); + } + strcpy(dst, tmp); + return (dst); } diff --git a/packet-ipv6.h b/packet-ipv6.h index 75ac3d9dd0..f37465ebad 100644 --- a/packet-ipv6.h +++ b/packet-ipv6.h @@ -1,8 +1,478 @@ -typedef struct _e_ipv6_header{ - /* the version contains 4-bit version and 4-bit priority */ - guint8 version; - guint8 flow_label[3]; - guint16 payload_length; - guint8 next_header; - guint8 hop_limit; -} e_ipv6_header; +#ifndef __PACKET_IPV6_H_DEFINED__ +#define __PACKET_IPV6_H_DEFINED__ + +struct e_in6_addr { + union { + guint32 u6_addr32[4]; + guint16 u6_addr16[8]; + guint8 u6_addr8[16]; + } u6_addr; /* 128 bit IP6 address */ +}; + +#define s6_addr32 u6_addr.u6_addr32 +#define s6_addr16 u6_addr.u6_addr16 +#define s6_addr8 u6_addr.u6_addr8 +#define s6_addr u6_addr.u6_addr8 + +#define INET6_ADDRSTRLEN 46 + +/* + * Definition for internet protocol version 6. + * RFC 1883 + */ +struct ip6_hdr { + union { + struct ip6_hdrctl { + guint32 ip6_un1_flow; /* 20 bits of flow-ID */ + guint16 ip6_un1_plen; /* payload length */ + guint8 ip6_un1_nxt; /* next header */ + guint8 ip6_un1_hlim; /* hop limit */ + } ip6_un1; + guint8 ip6_un2_vfc; /* 4 bits version, 4 bits class */ + } ip6_ctlun; + struct e_in6_addr ip6_src; /* source address */ + struct e_in6_addr ip6_dst; /* destination address */ +}; + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + +#define IPV6_VERSION 0x60 +#define IPV6_VERSION_MASK 0xf0 + +#if BYTE_ORDER == BIG_ENDIAN +#define IPV6_FLOWINFO_MASK 0x0fffffff /* flow info (28 bits) */ +#define IPV6_FLOWLABEL_MASK 0x000fffff /* flow label (20 bits) */ +#endif /* BIG_ENDIAN */ +#if BYTE_ORDER == LITTLE_ENDIAN +#define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */ +#define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */ +#endif /* LITTLE_ENDIAN */ + +/* + * Extension Headers + */ + +struct ip6_ext { + u_char ip6e_nxt; + u_char ip6e_len; +}; + +/* Hop-by-Hop options header */ +/* XXX should we pad it to force alignment on an 8-byte boundary? */ +struct ip6_hbh { + guint8 ip6h_nxt; /* next header */ + guint8 ip6h_len; /* length in units of 8 octets */ + /* followed by options */ +}; + +/* Destination options header */ +/* XXX should we pad it to force alignment on an 8-byte boundary? */ +struct ip6_dest { + guint8 ip6d_nxt; /* next header */ + guint8 ip6d_len; /* length in units of 8 octets */ + /* followed by options */ +}; + +/* Option types and related macros */ +#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ +#define IP6OPT_PADN 0x01 /* 00 0 00001 */ +#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ +#define IP6OPT_JUMBO_LEN 6 +#define IP6OPT_RTALERT 0x05 /* 00 0 00101 */ +#define IP6OPT_RTALERT_LEN 4 +#define IP6OPT_RTALERT_MLD 0 /* Datagram contains MLD message */ +#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains RSVP message */ +#define IP6OPT_MINLEN 2 + +#define IP6OPT_TYPE(o) ((o) & 0xC0) +#define IP6OPT_TYPE_SKIP 0x00 +#define IP6OPT_TYPE_DISCARD 0x40 +#define IP6OPT_TYPE_FORCEICMP 0x80 +#define IP6OPT_TYPE_ICMP 0xC0 + +#define IP6OPT_MUTABLE 0x20 + +/* Routing header */ +struct ip6_rthdr { + guint8 ip6r_nxt; /* next header */ + guint8 ip6r_len; /* length in units of 8 octets */ + guint8 ip6r_type; /* routing type */ + guint8 ip6r_segleft; /* segments left */ + /* followed by routing type specific data */ +}; + +/* Type 0 Routing header */ +struct ip6_rthdr0 { + guint8 ip6r0_nxt; /* next header */ + guint8 ip6r0_len; /* length in units of 8 octets */ + guint8 ip6r0_type; /* always zero */ + guint8 ip6r0_segleft; /* segments left */ + guint8 ip6r0_reserved; /* reserved field */ + guint8 ip6r0_slmap[3]; /* strict/loose bit map */ + struct e_in6_addr ip6r0_addr[1]; /* up to 23 addresses */ +}; + +/* Fragment header */ +struct ip6_frag { + guint8 ip6f_nxt; /* next header */ + guint8 ip6f_reserved; /* reserved field */ + guint16 ip6f_offlg; /* offset, reserved, and flag */ + guint32 ip6f_ident; /* identification */ +}; + +#if BYTE_ORDER == BIG_ENDIAN +#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */ +#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */ +#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ +#else /* BYTE_ORDER == LITTLE_ENDIAN */ +#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */ +#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */ +#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */ +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +/* + * Definition for ICMPv6. + * RFC 1885 + */ + +#define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr) + - sizeof(struct icmp6_hdr) */ + +struct icmp6_hdr { + guint8 icmp6_type; /* type field */ + guint8 icmp6_code; /* code field */ + guint16 icmp6_cksum; /* checksum field */ + union { + guint32 icmp6_un_data32[1]; /* type-specific field */ + guint16 icmp6_un_data16[2]; /* type-specific field */ + guint8 icmp6_un_data8[4]; /* type-specific field */ + } icmp6_dataun; +}; + +#define icmp6_data32 icmp6_dataun.icmp6_un_data32 +#define icmp6_data16 icmp6_dataun.icmp6_un_data16 +#define icmp6_data8 icmp6_dataun.icmp6_un_data8 +#define icmp6_pptr icmp6_data32[0] /* parameter prob */ +#define icmp6_mtu icmp6_data32[0] /* packet too big */ +#define icmp6_id icmp6_data16[0] /* echo request/reply */ +#define icmp6_seq icmp6_data16[1] /* echo request/reply */ +#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ + +#define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ +#define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ +#define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ +#define ICMP6_PARAM_PROB 4 /* ip6 header bad */ + +#define ICMP6_ECHO_REQUEST 128 /* echo service */ +#define ICMP6_ECHO_REPLY 129 /* echo reply */ +#define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */ +#define MLD6_LISTENER_QUERY 130 /* multicast listener query */ +#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */ +#define MLD6_LISTENER_REPORT 131 /* multicast listener report */ +#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ +#define MLD6_LISTENER_DONE 132 /* multicast listener done */ + +#define ND_ROUTER_SOLICIT 133 /* router solicitation */ +#define ND_ROUTER_ADVERT 134 /* router advertisment */ +#define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */ +#define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisment */ +#define ND_REDIRECT 137 /* redirect */ + +#define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */ + +/* xxx: actually not assigned yet */ +#define ICMP6_WRUREQUEST 140 /* who are you request */ +#define ICMP6_WRUREPLY 141 /* who are you reply */ +#define ICMP6_FQDN_QUERY 140 /* FQDN query */ +#define ICMP6_FQDN_REPLY 141 /* FQDN reply */ + +#define ICMP6_MAXTYPE 141 + +#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ +#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */ +#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor */ +#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ +#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */ + +#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */ +#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */ + +#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ +#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */ +#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */ + +#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ + +#define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */ +#define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ +#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ + +/* + * Multicast Listener Discovery + */ +struct mld6_hdr { + struct icmp6_hdr mld6_hdr; + struct e_in6_addr mld6_addr; /* multicast address */ +}; + +#define mld6_type mld6_hdr.icmp6_type +#define mld6_code mld6_hdr.icmp6_code +#define mld6_cksum mld6_hdr.icmp6_cksum +#define mld6_maxdelay mld6_hdr.icmp6_data16[0] +#define mld6_reserved mld6_hdr.icmp6_data16[1] + +/* + * Neighbor Discovery + */ + +struct nd_router_solicit { /* router solicitation */ + struct icmp6_hdr nd_rs_hdr; + /* could be followed by options */ +}; + +#define nd_rs_type nd_rs_hdr.icmp6_type +#define nd_rs_code nd_rs_hdr.icmp6_code +#define nd_rs_cksum nd_rs_hdr.icmp6_cksum +#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] + +struct nd_router_advert { /* router advertisement */ + struct icmp6_hdr nd_ra_hdr; + guint32 nd_ra_reachable; /* reachable time */ + guint32 nd_ra_retransmit; /* retransmit timer */ + /* could be followed by options */ +}; + +#define nd_ra_type nd_ra_hdr.icmp6_type +#define nd_ra_code nd_ra_hdr.icmp6_code +#define nd_ra_cksum nd_ra_hdr.icmp6_cksum +#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] +#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] +#define ND_RA_FLAG_MANAGED 0x80 +#define ND_RA_FLAG_OTHER 0x40 +#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] + +struct nd_neighbor_solicit { /* neighbor solicitation */ + struct icmp6_hdr nd_ns_hdr; + struct e_in6_addr nd_ns_target; /*target address */ + /* could be followed by options */ +}; + +#define nd_ns_type nd_ns_hdr.icmp6_type +#define nd_ns_code nd_ns_hdr.icmp6_code +#define nd_ns_cksum nd_ns_hdr.icmp6_cksum +#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] + +struct nd_neighbor_advert { /* neighbor advertisement */ + struct icmp6_hdr nd_na_hdr; + struct e_in6_addr nd_na_target; /* target address */ + /* could be followed by options */ +}; + +#define nd_na_type nd_na_hdr.icmp6_type +#define nd_na_code nd_na_hdr.icmp6_code +#define nd_na_cksum nd_na_hdr.icmp6_cksum +#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] +#if BYTE_ORDER == BIG_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80000000 +#define ND_NA_FLAG_SOLICITED 0x40000000 +#define ND_NA_FLAG_OVERRIDE 0x20000000 +#elif BYTE_ORDER == LITTLE_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80 +#define ND_NA_FLAG_SOLICITED 0x40 +#define ND_NA_FLAG_OVERRIDE 0x20 +#endif + +struct nd_redirect { /* redirect */ + struct icmp6_hdr nd_rd_hdr; + struct e_in6_addr nd_rd_target; /* target address */ + struct e_in6_addr nd_rd_dst; /* destination address */ + /* could be followed by options */ +}; + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] + +struct nd_opt_hdr { /* Neighbor discovery option header */ + guint8 nd_opt_type; + guint8 nd_opt_len; + /* followed by option specific data*/ +}; + +#define ND_OPT_SOURCE_LINKADDR 1 +#define ND_OPT_TARGET_LINKADDR 2 +#define ND_OPT_PREFIX_INFORMATION 3 +#define ND_OPT_REDIRECTED_HEADER 4 +#define ND_OPT_MTU 5 + +struct nd_opt_prefix_info { /* prefix information */ + guint8 nd_opt_pi_type; + guint8 nd_opt_pi_len; + guint8 nd_opt_pi_prefix_len; + guint8 nd_opt_pi_flags_reserved; + guint32 nd_opt_pi_valid_time; + guint32 nd_opt_pi_preferred_time; + guint32 nd_opt_pi_reserved2; + struct e_in6_addr nd_opt_pi_prefix; +}; + +#define ND_OPT_PI_FLAG_ONLINK 0x80 +#define ND_OPT_PI_FLAG_AUTO 0x40 + +struct nd_opt_rd_hdr { /* redirected header */ + guint8 nd_opt_rh_type; + guint8 nd_opt_rh_len; + guint16 nd_opt_rh_reserved1; + guint32 nd_opt_rh_reserved2; + /* followed by IP header and data */ +}; + +struct nd_opt_mtu { /* MTU option */ + guint8 nd_opt_mtu_type; + guint8 nd_opt_mtu_len; + guint16 nd_opt_mtu_reserved; + guint32 nd_opt_mtu_mtu; +}; + +#if 0 +/* disregard until used. We have to decide how to handle guint64 */ +/* + * icmp6 namelookup + */ + +struct icmp6_namelookup { + struct icmp6_hdr icmp6_nl_hdr; + guint64 icmp6_nl_nonce; + guint32 icmp6_nl_ttl; +#if 0 + guint8 icmp6_nl_len; + guint8 icmp6_nl_name[3]; +#endif + /* could be followed by options */ +}; +#endif + +/* + * Router Renumbering. as router-renum-05.txt + */ +#if BYTE_ORDER == BIG_ENDIAN /* net byte order */ +struct icmp6_router_renum { /* router renumbering header */ + struct icmp6_hdr rr_hdr; + guint8 rr_segnum; + guint8 rr_test : 1; + guint8 rr_reqresult : 1; + guint8 rr_forceapply : 1; + guint8 rr_specsite : 1; + guint8 rr_prevdone : 1; + guint8 rr_flags_reserved : 3; + guint16 rr_maxdelay; + guint32 rr_reserved; +}; +#elif BYTE_ORDER == LITTLE_ENDIAN +struct icmp6_router_renum { /* router renumbering header */ + struct icmp6_hdr rr_hdr; + guint8 rr_segnum; + guint8 rr_flags_reserved : 3; + guint8 rr_prevdone : 1; + guint8 rr_specsite : 1; + guint8 rr_forceapply : 1; + guint8 rr_reqresult : 1; + guint8 rr_test : 1; + guint16 rr_maxdelay; + guint32 rr_reserved; +}; +#endif /* BYTE_ORDER */ + +#define rr_type rr_hdr.icmp6_type +#define rr_code rr_hdr.icmp6_code +#define rr_cksum rr_hdr.icmp6_cksum +#define rr_seqnum rr_hdr.icmp6_data32[0] + +struct rr_pco_match { /* match prefix part */ + guint8 rpm_code; + guint8 rpm_len; + guint8 rpm_ordinal; + guint8 rpm_matchlen; + guint8 rpm_minlen; + guint8 rpm_maxlen; + guint16 rpm_reserved; + struct e_in6_addr rpm_prefix; +}; + +#define RPM_PCO_ADD 1 +#define RPM_PCO_CHANGE 2 +#define RPM_PCO_SETGLOBAL 3 +#define RPM_PCO_MAX 4 + +#if BYTE_ORDER == BIG_ENDIAN /* net byte order */ +struct rr_pco_use { /* use prefix part */ + guint8 rpu_uselen; + guint8 rpu_keeplen; + guint8 rpu_mask_onlink : 1; + guint8 rpu_mask_autonomous : 1; + guint8 rpu_mask_reserved : 6; + guint8 rpu_onlink : 1; + guint8 rpu_autonomous : 1; + guint8 rpu_raflags_reserved : 6; + guint32 rpu_vltime; + guint32 rpu_pltime; + guint32 rpu_decr_vltime : 1; + guint32 rpu_decr_pltime : 1; + guint32 rpu_flags_reserved : 6; + guint32 rpu_reserved : 24; + struct e_in6_addr rpu_prefix; +}; +#elif BYTE_ORDER == LITTLE_ENDIAN +struct rr_pco_use { /* use prefix part */ + guint8 rpu_uselen; + guint8 rpu_keeplen; + guint8 rpu_mask_reserved : 6; + guint8 rpu_mask_autonomous : 1; + guint8 rpu_mask_onlink : 1; + guint8 rpu_raflags_reserved : 6; + guint8 rpu_autonomous : 1; + guint8 rpu_onlink : 1; + guint32 rpu_vltime; + guint32 rpu_pltime; + guint32 rpu_flags_reserved : 6; + guint32 rpu_decr_pltime : 1; + guint32 rpu_decr_vltime : 1; + guint32 rpu_reserved : 24; + struct e_in6_addr rpu_prefix; +}; +#endif /* BYTE_ORDER */ + +#if BYTE_ORDER == BIG_ENDIAN /* net byte order */ +struct rr_result { /* router renumbering result message */ + guint8 rrr_reserved; + guint8 rrr_flags_reserved : 6; + guint8 rrr_outofbound : 1; + guint8 rrr_forbidden : 1; + guint8 rrr_ordinal; + guint8 rrr_matchedlen; + guint32 rrr_ifid; + struct e_in6_addr rrr_prefix; +}; +#elif BYTE_ORDER == LITTLE_ENDIAN +struct rr_result { /* router renumbering result message */ + guint8 rrr_reserved; + guint8 rrr_forbidden : 1; + guint8 rrr_outofbound : 1; + guint8 rrr_flags_reserved : 6; + guint8 rrr_ordinal; + guint8 rrr_matchedlen; + guint32 rrr_ifid; + struct e_in6_addr rrr_prefix; +}; +#endif /* BYTE_ORDER */ + +struct e_in6_addr; +gchar* ip6_to_str(struct e_in6_addr *); + +#endif /* __PACKET_IPV6_H_DEFINED__ */ @@ -1,7 +1,7 @@ /* packet.c * Routines for packet disassembly * - * $Id: packet.c,v 1.21 1999/03/23 03:14:45 gram Exp $ + * $Id: packet.c,v 1.22 1999/03/28 18:31:59 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -30,6 +30,7 @@ #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif +#include <sys/socket.h> #include <glib.h> @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.41 1999/03/23 03:14:45 gram Exp $ + * $Id: packet.h,v 1.42 1999/03/28 18:32:00 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -54,8 +54,19 @@ #define hi_nibble(b) ((b & 0xf0) >> 4) #define lo_nibble(b) (b & 0x0f) +/* Byte ordering */ +#ifndef BYTE_ORDER + #define LITTLE_ENDIAN 4321 + #define BIG_ENDIAN 1234 + #ifdef WORDS_BIGENDIAN + #define BYTE_ORDER BIG_ENDIAN + #else + #define BYTE_ORDER LITTLE_ENDIAN + #endif +#endif + /* Useful when highlighting regions inside a dissect_*() function. With this - * macro, you can highlight from the start of the packet to the end of the + * macro, you can highlight from an arbitrary offset to the end of the * frame. See dissect_data() for an example. */ #define END_OF_FRAME (fd->cap_len - offset) @@ -196,6 +207,11 @@ enum { ETT_CDP, ETT_HTTP, ETT_TFTP, + ETT_AH, + ETT_ESP, + ETT_ICMPv6, + ETT_ICMPv6OPT, + ETT_ICMPv6FLAG, NUM_TREE_TYPES /* last item number plus one */ }; @@ -250,7 +266,7 @@ proto_item* proto_tree_add_item(proto_tree *tree, gint start, gint len, __attribute__((format (printf, 4, 5))); #else proto_item* proto_tree_add_item(proto_tree *tree, gint start, gint len, - gchar *format, ...) + gchar *format, ...); #endif void dissect_packet(const u_char *, frame_data *, proto_tree *); @@ -293,6 +309,7 @@ void dissect_tr(const u_char *, frame_data *, proto_tree *); * tree * * They should never modify the packet data. */ +int dissect_ah(const u_char *, int, frame_data *, proto_tree *); void dissect_aarp(const u_char *, int, frame_data *, proto_tree *); void dissect_arp(const u_char *, int, frame_data *, proto_tree *); void dissect_bootp(const u_char *, int, frame_data *, proto_tree *); @@ -300,9 +317,11 @@ void dissect_cdp(const u_char *, int, frame_data *, proto_tree *); void dissect_data(const u_char *, int, frame_data *, proto_tree *); void dissect_ddp(const u_char *, int, frame_data *, proto_tree *); void dissect_dns(const u_char *, int, frame_data *, proto_tree *); +void dissect_esp(const u_char *, int, frame_data *, proto_tree *); void dissect_giop(const u_char *, int, frame_data *, proto_tree *); void dissect_http(const u_char *, int, frame_data *, proto_tree *); void dissect_icmp(const u_char *, int, frame_data *, proto_tree *); +void dissect_icmpv6(const u_char *, int, frame_data *, proto_tree *); void dissect_igmp(const u_char *, int, frame_data *, proto_tree *); void dissect_ip(const u_char *, int, frame_data *, proto_tree *); void dissect_ipv6(const u_char *, int, frame_data *, proto_tree *); @@ -1,7 +1,7 @@ /* resolv.c * Routines for network object lookup * - * $Id: resolv.c,v 1.5 1998/12/17 05:42:32 gram Exp $ + * $Id: resolv.c,v 1.6 1999/03/28 18:32:00 gram Exp $ * * Laurent Deniel <deniel@worldnet.fr> * @@ -57,6 +57,7 @@ #include "ethereal.h" #include "packet.h" +#include "packet-ipv6.h" #include "resolv.h" #ifndef MAXNAMELEN @@ -253,6 +254,40 @@ static u_char *host_name_lookup(u_int addr) } /* host_name_lookup */ +static u_char *host_name_lookup6(struct e_in6_addr *addr) +{ + static u_char name[MAXNAMELEN]; +#ifdef INET6 + struct hostent *hostp; + +#ifdef AVOID_DNS_TIMEOUT + + /* Quick hack to avoid DNS/YP timeout */ + + if (!setjmp(hostname_env)) { + signal(SIGALRM, abort_network_query); + alarm(DNS_TIMEOUT); +#endif /* AVOID_DNS_TIMEOUT */ + hostp = gethostbyaddr((char *)addr, sizeof(*addr), AF_INET6); +#ifdef AVOID_DNS_TIMEOUT + alarm(0); +#endif + if (hostp != NULL) { + strncpy(name, hostp->h_name, MAXNAMELEN); + name[MAXNAMELEN-1] = '\0'; + return name; + } +#ifdef AVOID_DNS_TIMEOUT + } +#endif + + /* unknown host or DNS timeout */ +#endif /* INET6 */ + sprintf(name, "%s", ip6_to_str(addr)); + + return (name); +} + /* * Miscellaneous functions */ @@ -663,6 +698,17 @@ extern u_char *get_hostname(u_int addr) return host_name_lookup(addr); } +extern gchar *get_hostname6(struct e_in6_addr *addr) +{ +#ifdef INET6 + if (!g_resolving_actif) + return ip6_to_str(addr); + if (IN6_IS_ADDR_LINKLOCAL(addr) || IN6_IS_ADDR_MULTICAST(addr)) + return ip6_to_str(addr); +#endif + return host_name_lookup6(addr); +} + extern void add_host_name(u_int addr, u_char *name) { @@ -1,7 +1,7 @@ /* resolv.h * Definitions for network object lookup * - * $Id: resolv.h,v 1.3 1998/09/25 23:24:07 gerald Exp $ + * $Id: resolv.h,v 1.4 1999/03/28 18:32:01 gram Exp $ * * Laurent Deniel <deniel@worldnet.fr> * @@ -54,6 +54,10 @@ extern u_char *get_tcp_port(u_int port); /* get_hostname returns the host name or "%d.%d.%d.%d" if not found */ extern u_char *get_hostname(u_int addr); +/* get_hostname returns the host name, or numeric addr if not found */ +struct e_in6_addr; +gchar* get_hostname6(struct e_in6_addr *ad); + /* get_ether_name returns the logical name if found in ethers files else "<vendor>_%02x:%02x:%02x" if the vendor code is known else "%02x:%02x:%02x:%02x:%02x:%02x" */ diff --git a/wiretap/Makefile.am b/wiretap/Makefile.am index 1f4587e16e..eb1d7ca220 100644 --- a/wiretap/Makefile.am +++ b/wiretap/Makefile.am @@ -54,10 +54,10 @@ FILTERS = \ filter-eth \ filter-tr -CT_YACC=bison -y -CT_LEX=flex -i -RT_YACC=bison -y -p wtap_ -RT_LEX=flex -i -Pwtap_ +CT_YACC=@YACC@ +CT_LEX=@LEX@ -i +RT_YACC=@YACC@ -p wtap_ +RT_LEX=@LEX@ -i -Pwtap_ ct-grammar.c : ct-grammar.y @rm -f $@ ct-tokdefs.h diff --git a/wiretap/Makefile.in b/wiretap/Makefile.in index d655743a53..f7565c47ec 100644 --- a/wiretap/Makefile.in +++ b/wiretap/Makefile.in @@ -64,11 +64,13 @@ GLIB_LIBS = @GLIB_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ +LEX = @LEX@ LIBWIRETAP_A = @LIBWIRETAP_A@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ +YACC = @YACC@ bin_PROGRAMS = wiretap filterc noinst_LIBRARIES = @LIBWIRETAP_A@ @@ -126,10 +128,10 @@ FILTERS = \ filter-eth \ filter-tr -CT_YACC=bison -y -CT_LEX=flex -i -RT_YACC=bison -y -p wtap_ -RT_LEX=flex -i -Pwtap_ +CT_YACC=@YACC@ +CT_LEX=@LEX@ -i +RT_YACC=@YACC@ -p wtap_ +RT_LEX=@LEX@ -i -Pwtap_ wiretap_SOURCES = \ wiretap.c \ diff --git a/wiretap/README b/wiretap/README index db4972b39c..ebcc9ca21b 100644 --- a/wiretap/README +++ b/wiretap/README @@ -1,4 +1,4 @@ -$Id: README,v 1.13 1999/03/01 22:59:47 guy Exp $ +$Id: README,v 1.14 1999/03/28 18:32:01 gram Exp $ Wiretap is a library that is being developed as a future replacement for libpcap, the current standard Unix library for packet capturing. Libpcap is @@ -35,12 +35,8 @@ which we could support. Wiretap is very good at reading many file formats, as per #2 above. Display filters are now appearing in wiretap, but they are still basic. Development is continuing on the BPF compiler, so display -filters will continue to be enhanced. Wiretap can't capture packets yet, -but once it can, it will have the ability to do capture-filtering via -BPF, either through BPF kernel facilities or through a user-space BPF -implementation. BPF is my first target, but the filter compiler will -be generic enough so that as per #6, other packet-filtering engines can -be used. +filters will continue to be enhanced. Please read the README.filters file for +information regarding the syntax of wiretap filters. File Formats @@ -57,7 +53,7 @@ Sniffer (uncompressed) The Sniffer format is documented in the Sniffer manual. Unfortunately, Sniffer manuals tend to document only the format for the Sniffer model they document. Token-Ring and ethernet seems to work well, though. -If you have an ATM Sniffer file, both Guy and I would be *very* +If you have an ATM Sniffer file, both Guy and Gilbert would be *very* interested in receiving a sample. (see 'AUTHORS' file for our e-mail addresses). @@ -85,7 +81,7 @@ Network Monitor --------------- Microsoft's Network Monitor file format is supported, at least under Ethernet and token-ring. If you have capture files of other datalink types, please send -them to Guy Harris. +them to Guy. "snoop" ------- diff --git a/wiretap/aclocal.m4 b/wiretap/aclocal.m4 index 56bb18e8ad..71be451d59 100644 --- a/wiretap/aclocal.m4 +++ b/wiretap/aclocal.m4 @@ -331,6 +331,15 @@ for am_file in <<$1>>; do done<<>>dnl>>) changequote([,]))]) + +dnl AM_PROG_LEX +dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT +AC_DEFUN(AM_PROG_LEX, +[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) +AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex") +AC_PROG_LEX +AC_DECL_YYTEXT]) + # Configure paths for GTK+ # Owen Taylor 97-11-3 diff --git a/wiretap/bpf-engine.c b/wiretap/bpf-engine.c index ae81c24243..d1bff53587 100644 --- a/wiretap/bpf-engine.c +++ b/wiretap/bpf-engine.c @@ -22,7 +22,6 @@ * 2 of the License, or (at your option) any later version. */ -#include <netinet/in.h> #include <glib.h> #include "wtap.h" #include "bpf-engine.h" diff --git a/wiretap/bpf.c b/wiretap/bpf.c index 04281d1381..d22841d7df 100644 --- a/wiretap/bpf.c +++ b/wiretap/bpf.c @@ -114,15 +114,6 @@ bpf_code_unit_alloc(guint8 label, guint16 code, guint8 jt, guint8 jf, guint32 k) } -#define phtons(p) ((guint16) \ - ((guint16)*((guint8 *)p+0)<<8| \ - (guint16)*((guint8 *)p+1)<<0)) - -#define phtonl(p) ((guint32)*((guint8 *)p+0)<<24| \ - (guint32)*((guint8 *)p+1)<<16| \ - (guint32)*((guint8 *)p+2)<<8| \ - (guint32)*((guint8 *)p+3)<<0) - /* Finds ftype in the bytecmp_table, the relation, and the n-string byte array, and creates BPF that will check those bytes */ static GList* @@ -179,8 +170,8 @@ bpf_mk_bytecmp(int ftype, int rel_opcode, guint8 *bytes) bpf = bpf_code_unit_alloc(NO_LABEL, BPF_ALU|BPF_AND, - 0, 0, - htonl(0xffffff)); + 0, 0, 0xffffff); + /*htonl(0xffffff));*/ g_list_append(L, bpf); bpf = bpf_code_unit_alloc(NO_LABEL, diff --git a/wiretap/config.h.in b/wiretap/config.h.in index ae3d87c4d7..4ae27a3df1 100644 --- a/wiretap/config.h.in +++ b/wiretap/config.h.in @@ -3,6 +3,9 @@ /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define if lex declares yytext as a char * by default, not a char[]. */ +#undef YYTEXT_POINTER + #undef PACKAGE #undef VERSION diff --git a/wiretap/configure b/wiretap/configure index b03c85562f..24324b3b6e 100755 --- a/wiretap/configure +++ b/wiretap/configure @@ -987,10 +987,279 @@ else echo "$ac_t""no" 1>&6 fi +for ac_prog in 'bison -y' byacc +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:996: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_YACC="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +YACC="$ac_cv_prog_YACC" +if test -n "$YACC"; then + echo "$ac_t""$YACC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1026: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +#line 1041 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1047: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +#line 1058 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1064: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +missing_dir=`cd $ac_aux_dir && pwd` +for ac_prog in flex lex +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1092: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LEX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +LEX="$ac_cv_prog_LEX" +if test -n "$LEX"; then + echo "$ac_t""$LEX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$LEX" && break +done +test -n "$LEX" || LEX=""$missing_dir/missing flex"" + +# Extract the first word of "flex", so it can be a program name with args. +set dummy flex; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1124: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LEX="flex" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" +fi +fi +LEX="$ac_cv_prog_LEX" +if test -n "$LEX"; then + echo "$ac_t""$LEX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$LEXLIB" +then + case "$LEX" in + flex*) ac_lib=fl ;; + *) ac_lib=l ;; + esac + echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 +echo "configure:1157: checking for yywrap in -l$ac_lib" >&5 +ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-l$ac_lib $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1165 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char yywrap(); + +int main() { +yywrap() +; return 0; } +EOF +if { (eval echo configure:1176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LEXLIB="-l$ac_lib" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +echo $ac_n "checking lex output file root""... $ac_c" 1>&6 +echo "configure:1199: checking lex output file root" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # The minimal lex program is just a single line: %%. But some broken lexes +# (Solaris, I think it was) want two %% lines, so accommodate them. +echo '%% +%%' | $LEX +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; } +fi +fi + +echo "$ac_t""$ac_cv_prog_lex_root" 1>&6 +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 +echo "configure:1220: checking whether yytext is a pointer" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c +ac_save_LIBS="$LIBS" +LIBS="$LIBS $LEXLIB" +cat > conftest.$ac_ext <<EOF +#line 1232 "configure" +#include "confdefs.h" +`cat $LEX_OUTPUT_ROOT.c` +int main() { + +; return 0; } +EOF +if { (eval echo configure:1239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + ac_cv_prog_lex_yytext_pointer=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +LIBS="$ac_save_LIBS" +rm -f "${LEX_OUTPUT_ROOT}.c" + +fi + +echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6 +if test $ac_cv_prog_lex_yytext_pointer = yes; then + cat >> confdefs.h <<\EOF +#define YYTEXT_POINTER 1 +EOF + +fi + # If we're running gcc, add '-Wall' to CFLAGS. echo $ac_n "checking to see if we can add '-Wall' to CFLAGS""... $ac_c" 1>&6 -echo "configure:994: checking to see if we can add '-Wall' to CFLAGS" >&5 +echo "configure:1263: checking to see if we can add '-Wall' to CFLAGS" >&5 if test x$GCC != x ; then CFLAGS="-Wall $CFLAGS" echo "$ac_t""yes" 1>&6 @@ -1052,7 +1321,7 @@ fi # Extract the first word of "glib-config", so it can be a program name with args. set dummy glib-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1056: checking for $ac_word" >&5 +echo "configure:1325: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GLIB_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1083,7 +1352,7 @@ fi min_glib_version=1.1.0 echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6 -echo "configure:1087: checking for GLIB - version >= $min_glib_version" >&5 +echo "configure:1356: checking for GLIB - version >= $min_glib_version" >&5 no_glib="" if test "$GLIB_CONFIG" = "no" ; then no_glib=yes @@ -1106,7 +1375,7 @@ echo "configure:1087: checking for GLIB - version >= $min_glib_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext <<EOF -#line 1110 "configure" +#line 1379 "configure" #include "confdefs.h" #include <glib.h> @@ -1182,7 +1451,7 @@ main () } EOF -if { (eval echo configure:1186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1216,7 +1485,7 @@ fi CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" cat > conftest.$ac_ext <<EOF -#line 1220 "configure" +#line 1489 "configure" #include "confdefs.h" #include <glib.h> @@ -1226,7 +1495,7 @@ int main() { return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ; return 0; } EOF -if { (eval echo configure:1230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GLIB or finding the wrong" @@ -1307,7 +1576,7 @@ fi # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1311: checking for $ac_word" >&5 +echo "configure:1580: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1338,7 +1607,7 @@ fi min_gtk_version=1.0.0 echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 -echo "configure:1342: checking for GTK - version >= $min_gtk_version" >&5 +echo "configure:1611: checking for GTK - version >= $min_gtk_version" >&5 no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes @@ -1361,7 +1630,7 @@ echo "configure:1342: checking for GTK - version >= $min_gtk_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext <<EOF -#line 1365 "configure" +#line 1634 "configure" #include "confdefs.h" #include <gtk/gtk.h> @@ -1427,7 +1696,7 @@ main () } EOF -if { (eval echo configure:1431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1461,7 +1730,7 @@ fi CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat > conftest.$ac_ext <<EOF -#line 1465 "configure" +#line 1734 "configure" #include "confdefs.h" #include <gtk/gtk.h> @@ -1471,7 +1740,7 @@ int main() { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } EOF -if { (eval echo configure:1475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" @@ -1517,7 +1786,7 @@ fi # Wiretap check (copied and modified from ethereal) echo $ac_n "checking whether to include wiretap library""... $ac_c" 1>&6 -echo "configure:1521: checking whether to include wiretap library" >&5 +echo "configure:1790: checking whether to include wiretap library" >&5 # Check whether --with-wiretap or --without-wiretap was given. if test "${with_wiretap+set}" = set; then withval="$with_wiretap" @@ -1538,74 +1807,13 @@ fi -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1543: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 1558 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1564: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 1575 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1581: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1604: checking for ANSI C header files" >&5 +echo "configure:1812: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1609 "configure" +#line 1817 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1613,7 +1821,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1630,7 +1838,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1634 "configure" +#line 1842 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1648,7 +1856,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1652 "configure" +#line 1860 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1669,7 +1877,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1673 "configure" +#line 1881 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1680,7 +1888,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1707,17 +1915,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1711: checking for $ac_hdr" >&5 +echo "configure:1919: 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 -#line 1716 "configure" +#line 1924 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1721: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1929: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1888,6 +2096,11 @@ s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g s%@CC@%$CC%g s%@RANLIB@%$RANLIB%g +s%@YACC@%$YACC%g +s%@LEX@%$LEX%g +s%@LEXLIB@%$LEXLIB%g +s%@CPP@%$CPP%g +s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g s%@GLIB_CONFIG@%$GLIB_CONFIG%g s%@GLIB_CFLAGS@%$GLIB_CFLAGS%g s%@GLIB_LIBS@%$GLIB_LIBS%g @@ -1895,7 +2108,6 @@ s%@GTK_CONFIG@%$GTK_CONFIG%g s%@GTK_CFLAGS@%$GTK_CFLAGS%g s%@GTK_LIBS@%$GTK_LIBS%g s%@LIBWIRETAP_A@%$LIBWIRETAP_A%g -s%@CPP@%$CPP%g CEOF EOF diff --git a/wiretap/configure.in b/wiretap/configure.in index 3151b388d9..ddadbef14d 100644 --- a/wiretap/configure.in +++ b/wiretap/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.8 1999/03/03 08:51:58 guy Exp $ +# $Id: configure.in,v 1.9 1999/03/28 18:32:02 gram Exp $ dnl Process this file with autoconf to produce a configure script. AC_INIT(wtap.c) AM_INIT_AUTOMAKE(libwtap.a, 0.0.0) @@ -7,6 +7,8 @@ AM_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC AC_PROG_RANLIB +AC_PROG_YACC +AM_PROG_LEX # If we're running gcc, add '-Wall' to CFLAGS. AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS) diff --git a/wiretap/netmon.c b/wiretap/netmon.c index 8e53a8dbc5..ae4d8dbeb3 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -1,6 +1,6 @@ /* netmon.c * - * $Id: netmon.c,v 1.5 1999/03/01 18:57:05 gram Exp $ + * $Id: netmon.c,v 1.6 1999/03/28 18:32:02 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ -#include <netinet/in.h> #include <time.h> #include "wtap.h" #include "buffer.h" diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 4f3402b2b5..1f93b9d7d6 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1,6 +1,6 @@ /* wtap.h * - * $Id: wtap.h,v 1.16 1999/03/22 02:46:46 guy Exp $ + * $Id: wtap.h,v 1.17 1999/03/28 18:32:03 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -177,6 +177,19 @@ void wtap_close(wtap *wth); (guint32)*((guint8 *)p+3)<<0) #endif +#ifndef phtons +#define phtons(p) ((guint16) \ + ((guint16)*((guint8 *)p+0)<<8| \ + (guint16)*((guint8 *)p+1)<<0)) +#endif + +#ifndef phtonl +#define phtonl(p) ((guint32)*((guint8 *)p+0)<<24| \ + (guint32)*((guint8 *)p+1)<<16| \ + (guint32)*((guint8 *)p+2)<<8| \ + (guint32)*((guint8 *)p+3)<<0) +#endif + #ifndef pletohs #define pletohs(p) ((guint16) \ ((guint16)*((guint8 *)p+1)<<8| \ |