Index: mtr/.cvsignore
diff -u /dev/null mtr/.cvsignore:1.2
--- /dev/null	Thu Feb  7 01:09:31 2002
+++ mtr/.cvsignore	Fri Sep  3 00:29:06 1999
@@ -0,0 +1,6 @@
+Makefile
+config.log
+config.status
+config.cache
+config.h
+stamp-h
Index: mtr/ChangeLog
diff -u mtr/ChangeLog:1.1.1.1 mtr/ChangeLog:1.1
--- mtr/ChangeLog:1.1.1.1	Wed Dec 12 15:20:11 2001
+++ mtr/ChangeLog	Thu Jan 27 14:50:19 2000
@@ -1,11 +0,0 @@
-2001-04-15  root  <alane@geeksrus.net>
-
-	* Added this file so that automake won't complain.
-	* Commented out the test for res_init in configure.in;
-	it does not work for GLIBC2 systems (e.g., RedHat 7+).
-	* Fixed the subordinate CHECK_LIBS on the test for res_mkquery,
-	so that they test for res_mkquery, not res_init.
-	
-	  
-	  
-
Index: mtr/Makefile
diff -u mtr/Makefile:1.1.1.1 mtr/Makefile:removed
--- mtr/Makefile:1.1.1.1	Sat Aug 28 04:25:09 1999
+++ mtr/Makefile	Thu Feb  7 01:09:32 2002
@@ -1,16 +0,0 @@
-
-#
-# This is an attempt on simplifying the compilation of mtr to a simple "make". 
-#
-
-firstrule: 
-	./configure
-	$(MAKE)
-
-clean: 
-	rm -f *.o *~ core
-
-distclean: clean
-	rm -f mtr config.cache config.status config.log \
-	          stamp-h stamp-h[0-9]* TAGS ID
-
Index: mtr/acconfig.h
diff -u mtr/acconfig.h:1.1.1.1 mtr/acconfig.h:1.2
--- mtr/acconfig.h:1.1.1.1	Sat Aug 28 04:24:51 1999
+++ mtr/acconfig.h	Fri Sep  3 00:10:44 1999
@@ -49,3 +49,6 @@
 #else
 #error No 32 bit type
 #endif
+
+/* IPv6 support */
+#undef ENABLE_IPV6
Index: mtr/config.h.in
diff -u mtr/config.h.in:1.1.1.2 mtr/config.h.in:1.4
--- mtr/config.h.in:1.1.1.2	Wed Mar  8 09:58:51 2000
+++ mtr/config.h.in	Thu Feb  7 00:22:13 2002
@@ -34,6 +34,9 @@
 /* Define if you have the attron function.  */
 #undef HAVE_ATTRON
 
+/* Define if you have the getnameinfo function.  */
+#undef HAVE_GETNAMEINFO
+
 /* Define if you have the seteuid function.  */
 #undef HAVE_SETEUID
 
@@ -108,3 +111,6 @@
 #else
 #error No 32 bit type
 #endif
+
+/* IPv6 support */
+#undef ENABLE_IPV6
Index: mtr/configure
diff -u mtr/configure:1.1.1.4 mtr/configure:1.6
--- mtr/configure:1.1.1.4	Wed Feb  6 21:08:13 2002
+++ mtr/configure	Wed Feb  6 22:24:33 2002
@@ -12,6 +12,9 @@
 ac_default_prefix=/usr/local
 # Any additions from configure.in:
 ac_help="$ac_help
+  --enable-ipv6		Enable ipv6 (with ipv4) support
+  --disable-ipv6		Disable ipv6 support"
+ac_help="$ac_help
   --without-gtk           Do not try to use GTK+ at all"
 ac_help="$ac_help
   --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)"
@@ -36,6 +39,7 @@
 program_transform_name=s,x,x,
 silent=
 site=
+sitefile=
 srcdir=
 target=NONE
 verbose=
@@ -150,6 +154,7 @@
   --help                  print this message
   --no-create             do not create output files
   --quiet, --silent       do not print \`checking...' messages
+  --site-file=FILE        use FILE as the site file
   --version               print the version of autoconf that created configure
 Directory and file names:
   --prefix=PREFIX         install architecture-independent files in PREFIX
@@ -320,6 +325,11 @@
   -site=* | --site=* | --sit=*)
     site="$ac_optarg" ;;
 
+  -site-file | --site-file | --site-fil | --site-fi | --site-f)
+    ac_prev=sitefile ;;
+  -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
+    sitefile="$ac_optarg" ;;
+
   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
     ac_prev=srcdir ;;
   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@@ -485,12 +495,16 @@
 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
 
 # Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
-  if test "x$prefix" != xNONE; then
-    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
-  else
-    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+if test -z "$sitefile"; then
+  if test -z "$CONFIG_SITE"; then
+    if test "x$prefix" != xNONE; then
+      CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+    else
+      CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+    fi
   fi
+else
+  CONFIG_SITE="$sitefile"
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
@@ -560,7 +574,7 @@
 # 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:564: checking for a BSD compatible install" >&5
+echo "configure:578: 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
@@ -613,7 +627,7 @@
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:617: checking whether build environment is sane" >&5
+echo "configure:631: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -670,7 +684,7 @@
 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:674: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:688: 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
@@ -716,7 +730,7 @@
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:720: checking for working aclocal" >&5
+echo "configure:734: 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.
@@ -729,7 +743,7 @@
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:733: checking for working autoconf" >&5
+echo "configure:747: 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.
@@ -742,7 +756,7 @@
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:746: checking for working automake" >&5
+echo "configure:760: 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.
@@ -755,7 +769,7 @@
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:759: checking for working autoheader" >&5
+echo "configure:773: 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.
@@ -768,7 +782,7 @@
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:772: checking for working makeinfo" >&5
+echo "configure:786: 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.
@@ -791,7 +805,7 @@
 # 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:795: checking for $ac_word" >&5
+echo "configure:809: 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
@@ -821,7 +835,7 @@
   # 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:825: checking for $ac_word" >&5
+echo "configure:839: 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
@@ -872,7 +886,7 @@
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:876: checking for $ac_word" >&5
+echo "configure:890: 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
@@ -904,7 +918,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:908: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:922: 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.
@@ -915,12 +929,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 919 "configure"
+#line 933 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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
@@ -946,12 +960,12 @@
   { 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:950: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:964: 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:955: checking whether we are using GNU C" >&5
+echo "configure:969: 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
@@ -960,7 +974,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:964: \"$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:978: \"$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
@@ -979,7 +993,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:983: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:997: 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
@@ -1010,9 +1024,89 @@
   fi
 fi
 
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1029: 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 1044 "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:1050: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+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 1061 "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:1067: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1078 "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:1084: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+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*
+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 size of unsigned char""... $ac_c" 1>&6
-echo "configure:1016: checking size of unsigned char" >&5
+echo "configure:1110: checking size of unsigned char" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_char'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1020,7 +1114,7 @@
   ac_cv_sizeof_unsigned_char=1
 else
   cat > conftest.$ac_ext <<EOF
-#line 1024 "configure"
+#line 1118 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -1031,7 +1125,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:1035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_unsigned_char=`cat conftestval`
 else
@@ -1051,7 +1145,7 @@
 
 
 echo $ac_n "checking size of unsigned short""... $ac_c" 1>&6
-echo "configure:1055: checking size of unsigned short" >&5
+echo "configure:1149: checking size of unsigned short" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_short'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1059,7 +1153,7 @@
   ac_cv_sizeof_unsigned_short=2
 else
   cat > conftest.$ac_ext <<EOF
-#line 1063 "configure"
+#line 1157 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -1070,7 +1164,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:1074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_unsigned_short=`cat conftestval`
 else
@@ -1090,7 +1184,7 @@
 
 
 echo $ac_n "checking size of unsigned int""... $ac_c" 1>&6
-echo "configure:1094: checking size of unsigned int" >&5
+echo "configure:1188: checking size of unsigned int" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_int'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1098,7 +1192,7 @@
   ac_cv_sizeof_unsigned_int=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 1102 "configure"
+#line 1196 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -1109,7 +1203,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:1113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_unsigned_int=`cat conftestval`
 else
@@ -1129,7 +1223,7 @@
 
 
 echo $ac_n "checking size of unsigned long""... $ac_c" 1>&6
-echo "configure:1133: checking size of unsigned long" >&5
+echo "configure:1227: checking size of unsigned long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1137,7 +1231,7 @@
   ac_cv_sizeof_unsigned_long=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 1141 "configure"
+#line 1235 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -1148,7 +1242,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:1152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_unsigned_long=`cat conftestval`
 else
@@ -1176,7 +1270,7 @@
 # We have to trust the linker not to mess things up... (It should not
 # pull in anything if we don't refer to anything in the lib). 
 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:1180: checking for tgetent in -ltermcap" >&5
+echo "configure:1274: checking for tgetent in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1184,7 +1278,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1188 "configure"
+#line 1282 "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
@@ -1195,7 +1289,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:1199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1224,12 +1318,12 @@
 
 
 echo $ac_n "checking for initscr""... $ac_c" 1>&6
-echo "configure:1228: checking for initscr" >&5
+echo "configure:1322: checking for initscr" >&5
 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1233 "configure"
+#line 1327 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -1252,7 +1346,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -1270,7 +1364,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:1274: checking for initscr in -lncurses" >&5
+echo "configure:1368: checking for initscr in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1278,7 +1372,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1282 "configure"
+#line 1376 "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
@@ -1289,7 +1383,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:1293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1315,7 +1409,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:1319: checking for initscr in -lcurses" >&5
+echo "configure:1413: checking for initscr in -lcurses" >&5
 ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1323,7 +1417,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1327 "configure"
+#line 1421 "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
@@ -1334,7 +1428,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:1338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1360,7 +1454,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for initscr in -lcursesX""... $ac_c" 1>&6
-echo "configure:1364: checking for initscr in -lcursesX" >&5
+echo "configure:1458: checking for initscr in -lcursesX" >&5
 ac_lib_var=`echo cursesX'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1368,7 +1462,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcursesX  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1372 "configure"
+#line 1466 "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
@@ -1379,7 +1473,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:1383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1419,15 +1513,365 @@
 fi
 
 
-for ac_func in attron
+CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
+echo $ac_n "checking whether to enable ipv6""... $ac_c" 1>&6
+echo "configure:1519: checking whether to enable ipv6" >&5
+# Check whether --enable-ipv6 or --disable-ipv6 was given.
+if test "${enable_ipv6+set}" = set; then
+  enableval="$enable_ipv6"
+   case "$enableval" in
+  no)
+       echo "$ac_t""no" 1>&6
+       ipv6=no
+       ;;
+  *)   echo "$ac_t""yes" 1>&6
+       cat >> confdefs.h <<\EOF
+#define ENABLE_IPV6 1
+EOF
+
+       ipv6=yes
+       ;;
+  esac 
+else
+  if test "$cross_compiling" = yes; then
+  echo "$ac_t""no" 1>&6
+  ipv6=no
+
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1543 "configure"
+#include "confdefs.h"
+ /* AF_INET6 avalable check */
+#include <sys/types.h>
+#include <sys/socket.h>
+main()
+{
+  exit(0);
+ if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
+   exit(1);
+ else
+   exit(0);
+}
+
+EOF
+if { (eval echo configure:1558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define ENABLE_IPV6 1
+EOF
+
+  ipv6=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  echo "$ac_t""no" 1>&6
+  ipv6=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+
+ipv6type=unknown
+ipv6lib=none
+ipv6trylibc=no
+
+if test "$ipv6" = "yes"; then
+	echo $ac_n "checking ipv6 stack type""... $ac_c" 1>&6
+echo "configure:1585: checking ipv6 stack type" >&5
+	for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
+		case $i in
+		inria)
+						cat > conftest.$ac_ext <<EOF
+#line 1590 "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*
+  ipv6type=$i;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		kame)
+						cat > conftest.$ac_ext <<EOF
+#line 1609 "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*
+  ipv6type=$i;
+				ipv6lib=inet6;
+				ipv6libdir=/usr/local/v6/lib;
+				ipv6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		linux-glibc)
+						cat > conftest.$ac_ext <<EOF
+#line 1631 "configure"
+#include "confdefs.h"
+dnl
+#include <features.h>
+#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ipv6type=$i;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		linux-libinet6)
+						if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
+				ipv6type=$i
+				ipv6lib=inet6
+				ipv6libdir=/usr/inet6/lib
+				ipv6trylibc=yes;
+				CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
+			fi
+			;;
+		toshiba)
+			cat > conftest.$ac_ext <<EOF
+#line 1659 "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*
+  ipv6type=$i;
+				ipv6lib=inet6;
+				ipv6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		v6d)
+			cat > conftest.$ac_ext <<EOF
+#line 1680 "configure"
+#include "confdefs.h"
+dnl
+#include </usr/local/v6/include/sys/v6config.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*
+  ipv6type=$i;
+				ipv6lib=v6;
+				ipv6libdir=/usr/local/v6/lib;
+				CFLAGS="-I/usr/local/v6/include $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		zeta)
+			cat > conftest.$ac_ext <<EOF
+#line 1701 "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*
+  ipv6type=$i;
+				ipv6lib=inet6;
+				ipv6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		esac
+		if test "$ipv6type" != "unknown"; then
+			break
+		fi
+	done
+	echo "$ac_t""$ipv6type" 1>&6
+fi
+
+if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
+	if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
+		LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
+		echo "You have $ipv6lib library, using it"
+	else
+		if test "$ipv6trylibc" = "yes"; then
+			echo "You do not have $ipv6lib library, using libc"
+		else
+			echo 'Fatal: no $ipv6lib library found.  cannot continue.'
+			echo "You need to fetch lib$ipv6lib.a from appropriate"
+			echo 'ipv6 kit and compile beforehand.'
+			exit 1
+		fi
+	fi
+fi
+
+
+echo $ac_n "checking getaddrinfo bug""... $ac_c" 1>&6
+echo "configure:1746: checking getaddrinfo bug" >&5
+if test "$cross_compiling" = yes; then
+  echo "$ac_t""buggy" 1>&6
+buggygetaddrinfo=yes
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1752 "configure"
+#include "confdefs.h"
+
+#include <sys/types.h>
+#include <netdb.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+main()
+{
+  int passive, gaierr, inet4 = 0, inet6 = 0;
+  struct addrinfo hints, *ai, *aitop;
+  char straddr[INET6_ADDRSTRLEN], strport[16];
+
+  for (passive = 0; passive <= 1; passive++) {
+    memset(&hints, 0, sizeof(hints));
+    hints.ai_family = AF_UNSPEC;
+    hints.ai_flags = passive ? AI_PASSIVE : 0;
+    hints.ai_socktype = SOCK_STREAM;
+    if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
+      (void)gai_strerror(gaierr);
+      goto bad;
+    }
+    for (ai = aitop; ai; ai = ai->ai_next) {
+      if (ai->ai_addr == NULL ||
+          ai->ai_addrlen == 0 ||
+          getnameinfo(ai->ai_addr, ai->ai_addrlen,
+                      straddr, sizeof(straddr), strport, sizeof(strport),
+                      NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
+        goto bad;
+      }
+      switch (ai->ai_family) {
+      case AF_INET:
+        if (strcmp(strport, "54321") != 0) {
+          goto bad;
+        }
+        if (passive) {
+          if (strcmp(straddr, "0.0.0.0") != 0) {
+            goto bad;
+          }
+        } else {
+          if (strcmp(straddr, "127.0.0.1") != 0) {
+            goto bad;
+          }
+        }
+        inet4++;
+        break;
+      case AF_INET6:
+        if (strcmp(strport, "54321") != 0) {
+          goto bad;
+        }
+        if (passive) {
+          if (strcmp(straddr, "::") != 0) {
+            goto bad;
+          }
+        } else {
+          if (strcmp(straddr, "::1") != 0) {
+            goto bad;
+          }
+        }
+        inet6++;
+        break;
+      case AF_UNSPEC:
+        goto bad;
+        break;
+      default:
+        /* another family support? */
+        break;
+      }
+    }
+  }
+
+  if (!(inet4 == 0 || inet4 == 2))
+    goto bad;
+  if (!(inet6 == 0 || inet6 == 2))
+    goto bad;
+
+  if (aitop)
+    freeaddrinfo(aitop);
+  exit(0);
+
+ bad:
+  if (aitop)
+    freeaddrinfo(aitop);
+  exit(1);
+}
+
+EOF
+if { (eval echo configure:1841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  echo "$ac_t""good" 1>&6
+buggygetaddrinfo=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  echo "$ac_t""buggy" 1>&6
+buggygetaddrinfo=yes
+fi
+rm -fr conftest*
+fi
+
+
+if test "$buggygetaddrinfo" = "yes"; then
+	if test "$ipv6" = "yes" -a "$ipv6type" != "linux"; then
+		echo 'Fatal: You must get working getaddrinfo() function.'
+		echo '       or you can specify "--disable-ipv6"'.
+		exit 1
+	elif test "$ipv6type" = "linux"; then
+		echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
+		echo '         Better upgreade your system library to newest version'
+		echo '         of GNU C library (aka glibc).'
+	fi
+fi
+for ac_func in getaddrinfo getnameinfo
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1426: checking for $ac_func" >&5
+echo "configure:1870: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1431 "configure"
+#line 1875 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1450,7 +1894,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1471,106 +1915,85 @@
  
 else
   echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
 fi
 done
 
 
 
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1481: 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
+
+for ac_func in attron
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1929: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+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 1496 "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:1502: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
-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 1513 "configure"
+#line 1934 "configure"
 #include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
 #include <assert.h>
-Syntax Error
+/* 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 $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1519: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+if { (eval echo configure:1957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  CPP="${CC-cc} -nologo -E"
-  cat > conftest.$ac_ext <<EOF
-#line 1530 "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:1536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
+  eval "ac_cv_func_$ac_func=yes"
 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*
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
-  ac_cv_prog_CPP="$CPP"
 fi
-  CPP="$ac_cv_prog_CPP"
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
 else
-  ac_cv_prog_CPP="$CPP"
+  echo "$ac_t""no" 1>&6
 fi
-echo "$ac_t""$CPP" 1>&6
+done
 
+
+
 for ac_hdr in ncurses.h ncurses/curses.h curses.h cursesX.h sys/types.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1564: checking for $ac_hdr" >&5
+echo "configure:1987: 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 1569 "configure"
+#line 1992 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1997: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1600,17 +2023,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1604: checking for $ac_hdr" >&5
+echo "configure:2027: 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 1609 "configure"
+#line 2032 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1614: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2037: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1638,7 +2061,7 @@
 
 
 echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6
-echo "configure:1642: checking for floor in -lm" >&5
+echo "configure:2065: checking for floor in -lm" >&5
 ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1646,7 +2069,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1650 "configure"
+#line 2073 "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
@@ -1657,7 +2080,7 @@
 floor()
 ; return 0; }
 EOF
-if { (eval echo configure:1661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1746,7 +2169,7 @@
   # 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:1750: checking for $ac_word" >&5
+echo "configure:2173: 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
@@ -1759,7 +2182,7 @@
   ;;
   *)
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
+  ac_dummy="no"
   for ac_dir in $ac_dummy; do 
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
@@ -1768,7 +2191,7 @@
     fi
   done
   IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no"
+  test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="gtk12-config"
   ;;
 esac
 fi
@@ -1781,7 +2204,7 @@
 
   min_gtk_version=1.0.0
   echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:1785: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:2208: checking for GTK - version >= $min_gtk_version" >&5
   no_gtk=""
   if test "$GTK_CONFIG" = "no" ; then
     no_gtk=yes
@@ -1804,7 +2227,7 @@
   echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
   cat > conftest.$ac_ext <<EOF
-#line 1808 "configure"
+#line 2231 "configure"
 #include "confdefs.h"
 
 #include <gtk/gtk.h>
@@ -1882,7 +2305,7 @@
 }
 
 EOF
-if { (eval echo configure:1886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1917,7 +2340,7 @@
           CFLAGS="$CFLAGS $GTK_CFLAGS"
           LIBS="$LIBS $GTK_LIBS"
           cat > conftest.$ac_ext <<EOF
-#line 1921 "configure"
+#line 2344 "configure"
 #include "confdefs.h"
 
 #include <gtk/gtk.h>
@@ -1927,7 +2350,7 @@
  return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); 
 ; return 0; }
 EOF
-if { (eval echo configure:1931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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"
@@ -1979,12 +2402,12 @@
 fi
 
 echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:1983: checking for socket" >&5
+echo "configure:2406: 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 1988 "configure"
+#line 2411 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char socket(); below.  */
@@ -2007,7 +2430,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_socket=yes"
 else
@@ -2025,7 +2448,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:2029: checking for socket in -lsocket" >&5
+echo "configure:2452: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2033,7 +2456,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2037 "configure"
+#line 2460 "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
@@ -2044,7 +2467,7 @@
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2048: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2076,12 +2499,12 @@
 
 
 echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:2080: checking for gethostbyname" >&5
+echo "configure:2503: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2085 "configure"
+#line 2508 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -2104,7 +2527,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -2122,7 +2545,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2126: checking for gethostbyname in -lnsl" >&5
+echo "configure:2549: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2130,7 +2553,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2134 "configure"
+#line 2557 "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
@@ -2141,7 +2564,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2179,12 +2602,12 @@
 for ac_func in seteuid
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2183: checking for $ac_func" >&5
+echo "configure:2606: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2188 "configure"
+#line 2611 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2207,7 +2630,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2234,12 +2657,12 @@
 #  AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid))
 
 echo $ac_n "checking for res_mkquery""... $ac_c" 1>&6
-echo "configure:2238: checking for res_mkquery" >&5
+echo "configure:2661: checking for res_mkquery" >&5
 if eval "test \"`echo '$''{'ac_cv_func_res_mkquery'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2243 "configure"
+#line 2666 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char res_mkquery(); below.  */
@@ -2262,7 +2685,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_res_mkquery=yes"
 else
@@ -2280,7 +2703,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for res_mkquery in -lbind""... $ac_c" 1>&6
-echo "configure:2284: checking for res_mkquery in -lbind" >&5
+echo "configure:2707: checking for res_mkquery in -lbind" >&5
 ac_lib_var=`echo bind'_'res_mkquery | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2288,7 +2711,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lbind  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2292 "configure"
+#line 2715 "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
@@ -2299,7 +2722,7 @@
 res_mkquery()
 ; return 0; }
 EOF
-if { (eval echo configure:2303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2325,7 +2748,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for res_mkquery in -lresolv""... $ac_c" 1>&6
-echo "configure:2329: checking for res_mkquery in -lresolv" >&5
+echo "configure:2752: checking for res_mkquery in -lresolv" >&5
 ac_lib_var=`echo resolv'_'res_mkquery | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2333,7 +2756,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2337 "configure"
+#line 2760 "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
@@ -2344,7 +2767,7 @@
 res_mkquery()
 ; return 0; }
 EOF
-if { (eval echo configure:2348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2378,12 +2801,12 @@
 
 
 echo $ac_n "checking for herror""... $ac_c" 1>&6
-echo "configure:2382: checking for herror" >&5
+echo "configure:2805: checking for herror" >&5
 if eval "test \"`echo '$''{'ac_cv_func_herror'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2387 "configure"
+#line 2810 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char herror(); below.  */
@@ -2406,7 +2829,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_herror=yes"
 else
@@ -2430,12 +2853,12 @@
 fi
 
 echo $ac_n "checking for strerror""... $ac_c" 1>&6
-echo "configure:2434: checking for strerror" >&5
+echo "configure:2857: checking for strerror" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2439 "configure"
+#line 2862 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strerror(); below.  */
@@ -2458,7 +2881,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_strerror=yes"
 else
@@ -2633,6 +3056,7 @@
 s%@CURSES_OBJ@%$CURSES_OBJ%g
 s%@CC@%$CC%g
 s%@CPP@%$CPP%g
+s%@LIBOBJS@%$LIBOBJS%g
 s%@GTK_CONFIG@%$GTK_CONFIG%g
 s%@GTK_CFLAGS@%$GTK_CFLAGS%g
 s%@GTK_LIBS@%$GTK_LIBS%g
Index: mtr/configure.in
diff -u mtr/configure.in:1.1.1.4 mtr/configure.in:1.8
--- mtr/configure.in:1.1.1.4	Wed Feb  6 21:08:13 2002
+++ mtr/configure.in	Thu Feb  7 00:24:30 2002
@@ -8,6 +8,7 @@
 CURSES_OBJ=curses.o
 
 AC_PROG_CC
+AC_PROG_CPP
 
 AC_CHECK_SIZEOF(unsigned char, 1)
 AC_CHECK_SIZEOF(unsigned short, 2)
@@ -30,6 +31,44 @@
 	AC_MSG_WARN(Building without curses display support)
 	AC_DEFINE(NO_CURSES)
 	CURSES_OBJ=))))
+
+AC_MSG_CHECKING([whether to enable ipv6])
+AC_ARG_ENABLE(ipv6,
+[  --enable-ipv6		Enable ipv6 (with ipv4) support
+  --disable-ipv6		Disable ipv6 support],
+[ case "$enableval" in
+  no)
+       AC_MSG_RESULT(no)
+       ipv6=no
+       ;;
+  *)   AC_MSG_RESULT(yes)
+       AC_DEFINE(ENABLE_IPV6)
+       ipv6=yes
+       ;;
+  esac ],
+
+  AC_TRY_RUN([ /* AF_INET6 avalable check */
+#include <sys/types.h>
+#include <sys/socket.h>
+main()
+{
+  exit(0);
+ if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
+   exit(1);
+ else
+   exit(0);
+}
+],
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(ENABLE_IPV6)
+  ipv6=yes,
+  AC_MSG_RESULT(no)
+  ipv6=no,
+  AC_MSG_RESULT(no)
+  ipv6=no
+))
+
+AC_REPLACE_FUNCS(getnameinfo)
 
 AC_CHECK_FUNCS(attron)
 
Index: mtr/curses.c
diff -u mtr/curses.c:1.1.1.2 mtr/curses.c:1.6
--- mtr/curses.c:1.1.1.2	Wed Feb  6 21:08:14 2002
+++ mtr/curses.c	Wed Feb  6 22:24:33 2002
@@ -22,6 +22,14 @@
 #ifndef NO_CURSES
 #include <ctype.h>
 #include <stdlib.h>
+#if defined(HAVE_SYS_TYPES_H)
+#include <sys/types.h>
+#else
+/* If a system doesn't have sys/types.h, lets hope that time_t is an int */
+#define time_t int
+#endif
+#include <netdb.h>
+#include <sys/socket.h>
 
 #if defined(HAVE_NCURSES_H)
 #  include <ncurses.h>
@@ -35,13 +43,6 @@
 #  error No curses header file available
 #endif
 
-#if defined(HAVE_SYS_TYPES_H)
-#include <sys/types.h>
-#else
-/* If a system doesn't have sys/types.h, lets hope that time_t is an int */
-#define time_t int
-#endif
-
 #ifndef HAVE_ATTRON
 #define attron(x) 
 #define attroff(x) 
@@ -97,9 +98,10 @@
 void mtr_curses_hosts(int startstat) {
   int max;
   int at;
-  int addr;
+  const struct sockaddr *addr;
   int y, x;
-  char *name;
+  const char *name;
+  char hbuf[128];
 
   max = net_max();
 
@@ -108,12 +110,18 @@
     addr = net_addr(at);
 
     if(addr != 0) {
-      name = dns_lookup(addr);
+      name = dns_lookup((struct sockaddr *)addr);
       if(name != NULL) {
 	printw("%s", name);
       } else {
-	printw("%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, 
-	       (addr >> 8) & 0xff, addr & 0xff);
+	getnameinfo(addr,
+#ifdef linux
+		SA_LEN(addr),
+#else
+		addr->sa_len,
+#endif
+		hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
+	printw("%s", hbuf);
       }
 
       getyx(stdscr, y, x);
@@ -185,7 +193,6 @@
 void mtr_fill_graph(int at, int cols) {
 	int* saved;
 	int i;
-	int val;
 
 	saved = net_saved_pings(at);
 	for (i = SAVED_PINGS-cols; i < SAVED_PINGS; i++) {
@@ -210,8 +217,10 @@
 }
 
 void mtr_curses_graph(int startstat, int cols) {
-	int max, at, addr, y, x;
-	char* name;
+	int max, at, y, x;
+	const struct sockaddr *addr;
+	const char* name;
+	char hbuf[128];
 
 	max = net_max();
 
@@ -224,11 +233,18 @@
 			continue;
 		}
 
-		name = dns_lookup(addr);
+		name = dns_lookup((struct sockaddr *)addr);
 		if (name) {
 			printw("%s", name);
 		} else {
-			printw("%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) && 0xff, (addr >> 8) & 0xff, addr & 0xff);
+			getnameinfo(addr,
+#ifdef linux
+				SA_LEN(addr),
+#else
+				addr->sa_len,
+#endif
+				hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
+			printw("%s", hbuf);
 		}
 
 		getyx(stdscr, y, x);
Index: mtr/display.c
diff -u mtr/display.c:1.1.1.1 mtr/display.c:1.2
--- mtr/display.c:1.1.1.1	Sat Aug 28 04:25:03 1999
+++ mtr/display.c	Wed Sep  8 11:30:06 1999
@@ -17,12 +17,17 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <config.h>
+#include <unistd.h>
 #include "display.h"
 #include "mtr-curses.h"
 #include "mtr-gtk.h"
 #include "report.h"
 #include "select.h"
+#include "split.h"
+#include "raw.h"
 
 extern int DisplayMode;
 
@@ -149,7 +154,7 @@
 }
 
 
-void display_rawhost(int host, int ip_addr) {
+void display_rawhost(int host, struct sockaddr *addr) {
   switch(DisplayMode) {
   case DisplayReport:
   case DisplaySplit:            /* BL */
@@ -157,7 +162,7 @@
   case DisplayGTK:
     break;
   case DisplayRaw:
-    raw_rawhost (host, ip_addr);
+    raw_rawhost (host, addr);
     break;
   }
 }
Index: mtr/display.h
diff -u mtr/display.h:1.1.1.3 mtr/display.h:1.4
--- mtr/display.h:1.1.1.3	Wed Feb  6 21:08:10 2002
+++ mtr/display.h	Wed Feb  6 22:24:33 2002
@@ -27,7 +27,7 @@
 void display_close();
 void display_redraw();
 void display_rawping(int hostnum, int msec);
-void display_rawhost(int hostnum, int ip_addr);
+void display_rawhost(int hostnum, struct sockaddr *addr);
 int display_keyaction();
 void display_loop();
 void display_clear();
Index: mtr/dns.c
diff -u mtr/dns.c:1.1.1.3 mtr/dns.c:1.13
--- mtr/dns.c:1.1.1.3	Wed Feb  6 21:08:11 2002
+++ mtr/dns.c	Thu Feb  7 00:44:32 2002
@@ -43,6 +43,8 @@
 #include <stdlib.h>
 #include <errno.h>
 
+#include "dns.h"
+
 #ifdef NO_STRERROR
 extern int sys_nerr;
 extern char *sys_errlist[];
@@ -80,7 +82,7 @@
 typedef unsigned short word;
 typedef unsigned long dword;
 
-typedef unsigned int ip_t;
+typedef u_int32_t ip_t;
 
 /* Structures */
 
@@ -95,7 +97,11 @@
    struct resolve *previoushost;
    float expiretime; /* Fucking HPUX has a problem with "double" here. */
    char *hostname;
+   int af;
    ip_t ip;
+#ifdef ENABLE_IPV6
+   struct in6_addr ip6;
+#endif
    word id;
    byte state;
 };
@@ -124,7 +130,7 @@
    "unknown error",
 };
 
-#define ResourcetypeCount 17
+#define ResourcetypeCount 36
 char *resourcetypes[ResourcetypeCount+1] = {
    "unknown type",
    "A: host address",
@@ -143,6 +149,25 @@
    "MINFO: mailbox or mail list information",
    "MX: mail exchange",
    "TXT: text string",
+   "RP: responsible person",
+   "AFSDB: AFS cell database",
+   "X25: X_25 calling address",
+   "ISDN: ISDN calling address",
+   "RT: router",
+   "NSAP: NSAP address",
+   "NSAP_PTR: reverse NSAP lookup (deprecated)",
+   "SIG: security signature",
+   "KEY: security key",
+   "PX: X.400 mail mapping",
+   "GPOS: geographical position (withdrawn)",
+   "AAAA: IP6 Address",
+   "LOC: Location Information",
+   "NXT: Next Valid Name in Zone",
+   "EID: Endpoint identifier",
+   "NIMLOC: Nimrod locator",
+   "SRV: Server selection",
+   "ATMA: ATM Address",
+   "NAPTR: Naming Authority PoinTeR",
    "unknown type",
 };
 
@@ -243,14 +268,17 @@
 
 struct resolve *idbash[BashSize];
 struct resolve *ipbash[BashSize];
+#ifdef ENABLE_IPV6
+struct resolve *ip6bash[BashSize];
+#endif
 struct resolve *hostbash[BashSize];
 struct resolve *expireresolves = NULL;
 struct resolve *lastresolve = NULL;
 struct logline *streamlog = NULL;
 struct logline *lastlog = NULL;
 
-ip_t alignedip;
-ip_t localhost;
+struct in_addr alignedip;
+struct in_addr localhost;
 
 double sweeptime;
 
@@ -413,15 +441,37 @@
 ip_t longipstr(char *s){
    return inet_addr(s);
 }
+
+char *satostr(struct sockaddr *sa) {
+   static char hbuf[256];
+   getnameinfo(sa,
+#ifdef linux
+		SA_LEN(sa),
+#else
+		sa->sa_len,
+#endif
+		hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
+   return hbuf;
+}
 
-int dns_forward(char *name){
+int dns_forward4(char *name){
    struct hostent *host;
-   if ((host = gethostbyname(name)))
+   if ((host = gethostbyname2(name, AF_INET)))
       return *(int *)host->h_addr;
    else
       return 0;
 }
 
+#ifdef ENABLE_IPV6
+struct in6_addr *dns_forward6(char *name){
+   struct hostent *host;
+   if ((host = gethostbyname2(name, AF_INET6)))
+      return (struct in6_addr *)host->h_addr;
+   else
+      return 0;
+}
+#endif
+
 int dns_waitfd(){
    return resfd;
 }
@@ -448,7 +498,7 @@
        strerror(errno));
       exit(-1);
    }
-   localhost = longipstr("127.0.0.1");
+   localhost.s_addr = longipstr("127.0.0.1");
    aseed = time(NULL) ^ (time(NULL) << 3) ^ (dword)getpid();
    for (i = 0;i < BashSize;i++){
       idbash[i] = NULL;
@@ -475,6 +525,15 @@
    return (dword)BashModulo(ip);
 }
 
+#ifdef ENABLE_IPV6
+dword getip6bash(struct in6_addr *addr) {
+   u_int32_t x;
+   x = *(u_int32_t *)&addr->s6_addr[0];
+   x ^= *(u_int32_t *)&addr->s6_addr[12];
+   return (dword)BashModulo(x);
+}
+#endif
+
 dword gethostbash(char *host){
    dword bashvalue = 0;
    for (;*host;host++){
@@ -515,11 +574,12 @@
 void unlinkresolveid(struct resolve *rp){
    dword bashnum;
    bashnum = getidbash(rp->id);
-   if (idbash[bashnum] == rp)
+   if (idbash[bashnum] == rp) {
       if (rp->previousid)
          idbash[bashnum] = rp->previousid;
       else
          idbash[bashnum] = rp->nextid;
+   }
    if (rp->nextid)
       rp->nextid->previousid = rp->previousid;
    if (rp->previousid)
@@ -557,11 +617,12 @@
 void unlinkresolvehost(struct resolve *rp){
    dword bashnum;
    bashnum = gethostbash(rp->hostname);
-   if (hostbash[bashnum] == rp)
+   if (hostbash[bashnum] == rp) {
       if (rp->previoushost)
          hostbash[bashnum] = rp->previoushost;
       else
          hostbash[bashnum] = rp->nexthost;
+   }
    if (rp->nexthost)
       rp->nexthost->previoushost = rp->previoushost;
    if (rp->previoushost)
@@ -569,7 +630,7 @@
    statfree(rp->hostname);
 }
 
-void linkresolveip(struct resolve *addrp){
+void linkresolveip4(struct resolve *addrp){
    struct resolve *rp;
    dword bashnum;
    bashnum = getipbash(addrp->ip);
@@ -597,14 +658,77 @@
    ipbash[bashnum] = addrp;
 }
 
+#ifdef ENABLE_IPV6
+void linkresolveip6(struct resolve *addrp){
+   struct resolve *rp;
+   dword bashnum;
+   bashnum = getip6bash(&addrp->ip6);
+   rp = ip6bash[bashnum];
+   if (rp){
+      while ((rp->nextip)
+          && (addrp->ip6.s6_addr[15] > rp->nextip->ip6.s6_addr[15])) {
+         rp = rp->nextip;
+      }
+      while ((rp->previousip)
+          && (addrp->ip6.s6_addr[15] < rp->previousip->ip6.s6_addr[15])) {
+         rp = rp->previousip;
+      }
+      if (rp->ip6.s6_addr[15] < addrp->ip6.s6_addr[15]){
+         addrp->previousip = rp;
+         addrp->nextip = rp->nextip;
+         if (rp->nextip)
+            rp->nextip->previousip = addrp;
+         rp->nextip = addrp;
+      } else {
+         addrp->previousip = rp->previousip;
+         addrp->nextip = rp;
+         if (rp->previousip)
+            rp->previousip->nextip = addrp;
+         rp->previousip = addrp;
+      }
+   } else
+      addrp->nextip = addrp->previousip = NULL;
+   ip6bash[bashnum] = addrp;
+}
+#endif
+
+void linkresolveip(struct resolve *addrp){
+   switch (addrp->af) {
+   case AF_INET:
+      linkresolveip4(addrp);
+      break;
+#ifdef ENABLE_IPV6
+   case AF_INET6:
+      linkresolveip6(addrp);
+      break;
+#endif
+   }
+}
+
 void unlinkresolveip(struct resolve *rp){
    dword bashnum;
-   bashnum = getipbash(rp->ip);
-   if (ipbash[bashnum] == rp)
-      if (rp->previousip)
-         ipbash[bashnum] = rp->previousip;
-      else
-         ipbash[bashnum] = rp->nextip;
+   switch (rp->af) {
+   case AF_INET:
+      bashnum = getipbash(rp->ip);
+      if (ipbash[bashnum] == rp) {
+	 if (rp->previousip)
+	    ipbash[bashnum] = rp->previousip;
+	 else
+	    ipbash[bashnum] = rp->nextip;
+      }
+      break;
+#ifdef ENABLE_IPV6
+   case AF_INET6:
+      bashnum = getip6bash(&rp->ip6);
+      if (ip6bash[bashnum] == rp) {
+	 if (rp->previousip)
+	    ip6bash[bashnum] = rp->previousip;
+	 else
+	    ip6bash[bashnum] = rp->nextip;
+      }
+      break;
+#endif
+   }
    if (rp->nextip)
       rp->nextip->previousip = rp->previousip;
    if (rp->previousip)
@@ -638,34 +762,6 @@
    resolvecount++;
 }
 
-void lastlinkresolve(struct resolve *rp){
-   struct resolve *irp;
-   if (lastresolve){
-      irp = lastresolve;
-      while ((irp->previous) && (rp->expiretime < irp->expiretime)) irp = irp->previous;
-      while ((irp->next) && (rp->expiretime >= irp->expiretime)) irp = irp->next;
-      if (rp->expiretime >= irp->expiretime){
-         rp->next = NULL;
-         rp->previous = irp;
-         irp->next = rp;
-         lastresolve = rp;
-      } else {
-         rp->previous = irp->previous;
-         rp->next = irp;
-         if (irp->previous)
-            irp->previous->next = rp;
-         else
-            expireresolves = rp;
-         irp->previous = rp;
-      }
-   } else {
-      rp->next = NULL;
-      rp->previous = NULL;
-      expireresolves = lastresolve = rp;
-   }
-   resolvecount++;
-}
-
 void untieresolve(struct resolve *rp){
    if (rp->previous)
       rp->previous->next = rp->next;
@@ -686,7 +782,7 @@
       unlinkresolvehost(rp);
 }
 
-struct resolve *findid(word id){
+struct resolve *findid(word id) {
    struct resolve *rp;
    int bashnum;
    bashnum = getidbash(id);
@@ -705,26 +801,6 @@
    return rp; /* NULL */
 }
 
-struct resolve *findhost(char *hostname){
-   struct resolve *rp;
-   int bashnum;
-   bashnum = gethostbash(hostname);
-   rp = hostbash[bashnum];
-   if (rp){
-      while ((rp->nexthost) && (strcasecmp(hostname,rp->nexthost->hostname) >= 0))
-         rp = rp->nexthost;
-      while ((rp->previoushost) && (strcasecmp(hostname,rp->nexthost->hostname) <= 0))
-         rp = rp->previoushost;
-      if (strcasecmp(hostname,rp->hostname))
-         return NULL;
-      else {
-         hostbash[bashnum] = rp;
-         return rp;
-      }
-   }
-   return rp; /* NULL */
-}
-
 struct resolve *findip(ip_t ip){
    struct resolve *rp;
    dword bashnum;
@@ -744,9 +820,32 @@
    return rp; /* NULL */
 }
 
+#ifdef ENABLE_IPV6
+struct resolve *findip6(struct in6_addr *addr) {
+   struct resolve *rp;
+   dword bashnum;
+   bashnum = getip6bash(addr);
+   rp = ip6bash[bashnum];
+   if (rp){
+      while ((rp->nextip) && (addr->s6_addr[15] >= rp->nextip->ip6.s6_addr[15]))
+         rp = rp->nextip;
+      while ((rp->previousip)
+       && (addr->s6_addr[15] <= rp->previousip->ip6.s6_addr[15])) {
+         rp = rp->previousip;
+      }
+      if (IN6_ARE_ADDR_EQUAL(addr, &rp->ip6)){
+         ip6bash[bashnum] = rp;
+         return rp;
+      } else
+         return NULL;
+   }
+   return rp; /* NULL */
+}
+#endif
+
 void restell(char *s){
    fputs(s,stderr);
-   fputs("\r",stderr);
+   fputs("\n",stderr);
 }
 
 void dorequest(char *s,int type,word id){
@@ -765,20 +864,44 @@
        sizeof(struct sockaddr));
 }
 
+char *ptrstring4(ip_t ip, char *buf, size_t siz) {
+   u_char *p;
+   p = (u_char *)&ip;
+   snprintf(buf, siz, "%u.%u.%u.%u.in-addr.arpa",
+      p[3], p[2], p[1], p[0]);
+   return buf;
+}
+
+#ifdef ENABLE_IPV6
+char *ptrstring6(struct in6_addr *ip6, char *buf, size_t siz) {
+   char *p, *q;
+   int i;
+   const char *hex = "0123456789abcdef";
+
+   p = buf;
+   q = buf + siz;
+   for (i = sizeof(struct in6_addr) - 1; i >= 0 && p < q; i--) {
+      *p++ = hex[ip6->s6_addr[i] & 0x0f];
+      *p++ = '.';
+      *p++ = hex[(ip6->s6_addr[i] >> 4) & 0x0f];
+      *p++ = '.';
+      *p = '\0';
+   }
+   strcpy(p, "ip6.int");
+   return buf;
+}
+#endif
+
 void resendrequest(struct resolve *rp,int type){
-   if (type == T_A){
+   if (type == T_A || type == T_AAAA) {
       dorequest(rp->hostname,type,rp->id);
       if (debug){
          sprintf(tempstring,"Resolver: Sent reverse authentication request for \"%s\".",
           rp->hostname);
          restell(tempstring);
       }
-   } else if (type == T_PTR){
-      sprintf(tempstring,"%u.%u.%u.%u.in-addr.arpa",
-       ((byte *)&rp->ip)[3],
-        ((byte *)&rp->ip)[2],
-         ((byte *)&rp->ip)[1],
-          ((byte *)&rp->ip)[0]);
+   } else if (type == T_PTR && rp->af == AF_INET){
+      ptrstring4(rp->ip, tempstring, sizeof(tempstring));
       dorequest(tempstring,type,rp->id);
       if (debug){
          sprintf(tempstring,"Resolver: Sent domain lookup request for \"%s\".",
@@ -786,6 +909,18 @@
          restell(tempstring);
       }
    }
+#ifdef ENABLE_IPV6
+   else if (type == T_PTR && rp->af == AF_INET6) {
+      char buf[128];
+      ptrstring6(&rp->ip6, tempstring, sizeof(tempstring));
+      dorequest(tempstring,type,rp->id);
+      if (debug){
+         sprintf(tempstring,"Resolver: Sent domain lookup request for \"%s\".",
+          inet_ntop(AF_INET6, &rp->ip6, buf, sizeof(buf)));
+         restell(tempstring);
+      }
+   }
+#endif
 }
 
 void sendrequest(struct resolve *rp,int type){
@@ -882,11 +1017,14 @@
                case STATE_PTRREQ1:
                case STATE_PTRREQ2:
                case STATE_PTRREQ3:
-                  sprintf(stackstring,"%u.%u.%u.%u.in-addr.arpa",
-                   ((byte *)&rp->ip)[3],
-                    ((byte *)&rp->ip)[2],
-                     ((byte *)&rp->ip)[1],
-                      ((byte *)&rp->ip)[0]);
+		  if (rp->af == AF_INET)
+		     ptrstring4(rp->ip, stackstring, sizeof(stackstring));
+#ifdef ENABLE_IPV6
+		  else if (rp->af == AF_INET6)
+		     ptrstring6(&rp->ip6, stackstring, sizeof(stackstring));
+#endif
+		  else
+		     stackstring[0] = '\0';
                   break;
             }
             *namestring = '\0';
@@ -1000,7 +1138,7 @@
                               sprintf(tempstring,"Resolver: Reverse authentication failed: %s != ",
                                strlongip(rp->ip));
                               memcpy(&alignedip,(ip_t *)c,sizeof(ip_t));
-                              strcat(tempstring,strlongip(alignedip));
+                              strcat(tempstring,strlongip(alignedip.s_addr));
                               restell(tempstring);
                               res_hostipmismatch++;
                               failrp(rp);
@@ -1080,7 +1218,7 @@
    r = recvfrom(resfd,(byte *)resrecvbuf,MaxPacketsize,0,(struct sockaddr *)&from,&fromlen);
    if (r > 0){
       /* Check to see if this server is actually one we sent to */
-      if (from.sin_addr.s_addr == localhost){
+      if (from.sin_addr.s_addr == localhost.s_addr){
          for (i = 0;i < _res.nscount;i++)
             if ((_res.nsaddr_list[i].sin_addr.s_addr == from.sin_addr.s_addr) ||
                 (!_res.nsaddr_list[i].sin_addr.s_addr))	/* 0.0.0.0 replies as 127.0.0.1 */
@@ -1102,12 +1240,13 @@
 }
 
 int istime(double x,double *sinterval){
-   if (x)
+   if (x) {
       if (x > sweeptime){
          if (*sinterval > x - sweeptime)
             *sinterval = x - sweeptime;
       } else
          return 1;
+   }
    return 0;
 }
 
@@ -1153,22 +1292,33 @@
       (void)istime(expireresolves->expiretime,sinterval);
 }
 
-char *dns_lookup2(ip_t ip){
+char *dns_lookup2(struct sockaddr *sa) {
    struct resolve *rp;
-   ip = htonl(ip);
-   if ((rp = findip(ip))){
+   switch (sa->sa_family) {
+   case AF_INET:
+      rp = findip(((struct sockaddr_in *)sa)->sin_addr.s_addr);
+      break;
+#ifdef ENABLE_IPV6
+   case AF_INET6:
+      rp = findip6(&((struct sockaddr_in6 *)sa)->sin6_addr);
+      break;
+#endif
+   default:
+      return satostr(sa);
+   }
+   if (rp){
       if ((rp->state == STATE_FINISHED) || (rp->state == STATE_FAILED)){
          if ((rp->state == STATE_FINISHED) && (rp->hostname)){
             if (debug){
                sprintf(tempstring,"Resolver: Used cached record: %s == \"%s\".\n",
-                strlongip(ip),rp->hostname);
+                satostr(sa),rp->hostname);
                restell(tempstring);
             }
             return rp->hostname;
          } else {
             if (debug){
                sprintf(tempstring,"Resolver: Used failed record: %s == ???\n",
-                strlongip(ip));
+                satostr(sa));
                restell(tempstring);
             }
             return NULL;
@@ -1181,20 +1331,35 @@
    rp = allocresolve();
    rp->state = STATE_PTRREQ1;
    rp->expiretime = sweeptime + ResRetryDelay1;
-   rp->ip = ip;
-   linkresolve(rp);
-   rp->ip = ip;
-   linkresolveip(rp);
-   sendrequest(rp,T_PTR);
+   switch (sa->sa_family) {
+   case AF_INET:
+      rp->af = AF_INET;
+      rp->ip = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
+      linkresolve(rp);
+      rp->ip = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
+      linkresolveip(rp);
+      sendrequest(rp,T_PTR);
+      break;
+#ifdef ENABLE_IPV6
+   case AF_INET6:
+      rp->af = AF_INET6;
+      rp->ip6 = ((struct sockaddr_in6 *)sa)->sin6_addr;
+      linkresolve(rp);
+      rp->ip6 = ((struct sockaddr_in6 *)sa)->sin6_addr;
+      linkresolveip(rp);
+      sendrequest(rp, T_PTR);
+      break;
+#endif
+   }
    return NULL;
 }
 
 int use_dns = 1;
 
-char *dns_lookup(ip_t ip){
-  char *t;
+char *dns_lookup(struct sockaddr *addr) {
+  const char *t;
 
-  if (!dns) return strlongip (ip);
-  t = dns_lookup2 (ip);
-  return (t&&use_dns)?t:strlongip(ip);
+  if (!dns) return satostr (addr);
+  t = dns_lookup2 (addr);
+  return (t&&use_dns)?t:satostr(addr);
 }
Index: mtr/dns.h
diff -u mtr/dns.h:1.1.1.1 mtr/dns.h:1.6
--- mtr/dns.h:1.1.1.1	Sat Aug 28 04:25:03 1999
+++ mtr/dns.h	Thu Feb  7 00:44:32 2002
@@ -19,11 +19,12 @@
 
 /*  Prototypes for dns.c  */
 
+struct in6_addr;
 void dns_open();
 int dns_waitfd();
 void dns_ack();
 void dns_events(double *sinterval);
-char *dns_lookup(int address);
-char *dns_lookup2(int address);
-int dns_forward(char *name);
-char *strlongip (int address);
+char *dns_lookup(struct sockaddr *address);
+char *dns_lookup2(struct sockaddr *address);
+int dns_forward4(char *name);
+struct in6_addr *dns_forward6(char *name);
Index: mtr/getopt.c
diff -u mtr/getopt.c:1.1.1.1 mtr/getopt.c:1.2
--- mtr/getopt.c:1.1.1.1	Sat Aug 28 04:25:05 1999
+++ mtr/getopt.c	Wed Sep  8 11:30:07 1999
@@ -39,6 +39,7 @@
 #endif
 
 #include <stdio.h>
+#include <string.h>
 
 /* Comment out all this code if we are using the GNU C Library, and are not
    actually compiling the library itself.  This code is part of the GNU C
@@ -538,7 +539,7 @@
 		optarg = nameend + 1;
 	      else
 		{
-		  if (opterr)
+		  if (opterr) {
 		   if (argv[optind - 1][1] == '-')
 		    /* --option */
 		    fprintf (stderr,
@@ -549,6 +550,7 @@
 		    fprintf (stderr,
 		     _("%s: option `%c%s' doesn't allow an argument\n"),
 		     argv[0], argv[optind - 1][0], pfound->name);
+		  }
 
 		  nextchar += strlen (nextchar);
 		  return '?';
Index: mtr/gtk.c
diff -u mtr/gtk.c:1.1.1.2 mtr/gtk.c:1.8
--- mtr/gtk.c:1.1.1.2	Wed Dec 12 15:20:09 2001
+++ mtr/gtk.c	Wed Dec 12 15:23:18 2001
@@ -20,6 +20,10 @@
 
 #include <config.h>
 #include <sys/time.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <stdio.h>
 
 #ifndef NO_GTK
 #include <stdlib.h>
@@ -40,7 +44,13 @@
 extern float WaitTime;
 static int tag;
 static GtkWidget *Pause_Button;
+#ifdef ENABLE_IPV6
+static GtkWidget *Af_Button;
+#endif
+
+void gtk_net_data __P((gpointer data, gint fd, GdkInputCondition cond));
 
+extern int af;
 
 void gtk_add_ping_timeout (void)
 {
@@ -100,6 +110,21 @@
   return FALSE;
 }
 
+#ifdef ENABLE_IPV6
+gint Af_clicked(GtkWidget *Button, gpointer data) {
+  if (af == AF_INET)
+    af = AF_INET6;
+  else if (af == AF_INET6)
+    af = AF_INET;
+
+  /* pause for safety */
+  gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(Pause_Button) , 1);
+  gtk_redraw();
+
+  return FALSE;
+}
+#endif
+
 /*
  * There is a small problem with the following code:
  * The timeout is canceled and removed in order to ensure that
@@ -120,10 +145,31 @@
 
 gint Host_activate(GtkWidget *Entry, gpointer data) {
   int addr;
+  const struct in6_addr *addr6;
+  int ok;
 
-  addr = dns_forward(gtk_entry_get_text(GTK_ENTRY(Entry)));
-  if(addr) {
-    net_reopen(addr);
+  ok = 0;
+  switch (af) {
+  case AF_INET:
+    addr = dns_forward4(gtk_entry_get_text(GTK_ENTRY(Entry)));
+    if (addr) {
+      net4_reopen(addr);
+      ok = 1;
+    }
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    addr6 = dns_forward6(gtk_entry_get_text(GTK_ENTRY(Entry)));
+    if (addr6) {
+      net6_reopen((struct in6_addr *)addr6);
+      ok = 1;
+    }
+    break;
+#endif
+  default:
+    break;
+  }
+  if(ok) {
     /* If we are "Paused" at this point it is usually because someone
        entered a non-existing host. Therefore do the go-ahead... --REW */
     gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON( Pause_Button ) , 0);
@@ -147,6 +193,8 @@
   GtkWidget *Entry;
   GtkAdjustment *Adjustment;
 
+  af = AF_INET;	/*XXX*/
+
   Button = gtk_button_new_with_label("Quit");
   gtk_box_pack_end(GTK_BOX(Toolbar), Button, FALSE, FALSE, 0);
   gtk_signal_connect(GTK_OBJECT(Button), "clicked",
@@ -165,6 +213,14 @@
                     GTK_SIGNAL_FUNC(Pause_clicked), NULL);
   gtk_widget_show(Pause_Button);
 
+#ifdef ENABLE_IPV6
+  Af_Button = gtk_toggle_button_new_with_label("IPv6");
+  gtk_box_pack_end(GTK_BOX(Toolbar), Af_Button, FALSE, FALSE, 0);
+  gtk_signal_connect(GTK_OBJECT(Af_Button), "clicked",
+                    GTK_SIGNAL_FUNC(Af_clicked), NULL);
+  gtk_widget_show(Af_Button);
+#endif
+
   /* allow root only to set zero delay */
   Adjustment = (GtkAdjustment *)gtk_adjustment_new(WaitTime,
                                                   getuid()==0 ? 0.00:1.00,
@@ -199,20 +255,28 @@
 GtkWidget *ReportBody;
 
 GtkWidget *GetRow(int index) {
-  int addr;
-  char str[256], *name;
+  const struct sockaddr *addr;
+  char str[256];
+  const char *name;
   GtkWidget *Row, *Label;
 
   Row = gtk_fixed_new();
   
   addr = net_addr(index);
   name = "???";
-  if(addr != 0) {
-    name = dns_lookup(addr);
+  if (addr != 0) {
+    name = dns_lookup((struct sockaddr *)addr);
     if(!name) {
       /* Actually this is not neccesary: 
 	 dns_lookup always returns a printable string */
-      name = strlongip (addr);
+      getnameinfo(addr,
+#ifdef linux
+		SA_LEN(addr),
+#else
+		addr->sa_len,
+#endif
+		str, sizeof(str), NULL, 0, NI_NUMERICHOST);
+      name = str;
     }
   }
 
@@ -281,20 +345,26 @@
 }
 
 void gtk_update_row(GtkCList *List, int row) {
-  int addr;
-  char str[256], *name;
+  const struct sockaddr *addr;
+  char str[256];
+  const char *name;
 
   addr = net_addr(row);
   name = "???";
   if(addr != 0) {
-    name = dns_lookup(addr);
+    name = dns_lookup((struct sockaddr *)addr);
     if(!name) {
-      sprintf(str, "%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, 
-	      (addr >> 8) & 0xff, addr & 0xff);
+      getnameinfo(addr,
+#ifdef linux
+		SA_LEN(addr),
+#else
+		addr->sa_len,
+#endif
+		str, sizeof(str), NULL, 0, NI_NUMERICHOST);
       name = str;
     }
   }
-  gtk_set_field(List, row, 0, name);
+  gtk_set_field(List, row, 0, (char *)name);
 
   gtk_set_field_num(List, row, 1, "%d%%", net_percent(row));
   gtk_set_field_num(List, row, 2, "%d", net_returned(row));  
@@ -406,10 +476,12 @@
   gtk_redraw();
 }
 
-
 void gtk_loop() {
   gtk_add_ping_timeout ();
-  gdk_input_add(net_waitfd(), GDK_INPUT_READ, gtk_net_data, NULL);
+  gdk_input_add(net4_waitfd(), GDK_INPUT_READ, gtk_net_data, NULL);
+#ifdef ENABLE_IPV6
+  gdk_input_add(net6_waitfd(), GDK_INPUT_READ, gtk_net_data, NULL);
+#endif
   gdk_input_add(dns_waitfd(), GDK_INPUT_READ, gtk_dns_data, NULL);
 
   gtk_main();
Index: mtr/mtr.c
diff -u mtr/mtr.c:1.1.1.3 mtr/mtr.c:1.8
--- mtr/mtr.c:1.1.1.3	Wed Dec 12 15:20:06 2001
+++ mtr/mtr.c	Wed Dec 12 15:23:18 2001
@@ -22,6 +22,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
 
 #include "mtr-curses.h"
 #include "getopt.h"
@@ -47,6 +50,7 @@
 char LocalHostname[128];
 int dns = 1;
 int packetsize = MINPACKET;
+int af = AF_INET;
 
 void parse_arg(int argc, char **argv) {
   int opt;
@@ -62,12 +66,20 @@
     { "no-dns", 0, 0, 'n' },
     { "split", 0, 0, 's' },     /* BL */
     { "raw", 0, 0, 'l' },
+#ifdef ENABLE_IPV6
+    { "ipv6", 0, 0, '6' },
+    { "ipv4", 0, 0, '4' },
+#endif
     { 0, 0, 0, 0 }
   };
 
   opt = 0;
   while(1) {
-    opt = getopt_long(argc, argv, "hvrc:tgklnsi:p:", long_options, NULL);
+    opt = getopt_long(argc, argv, "hvrc:tgklnsi:p:"
+#ifdef ENABLE_IPV6
+	"46"
+#endif
+	, long_options, NULL);
     if(opt == -1)
       break;
 
@@ -111,6 +123,14 @@
       if (getuid() != 0 && WaitTime < 1.0)
        WaitTime = 1.0;
       break;
+#ifdef ENABLE_IPV6
+    case '4':
+      af = AF_INET;
+      break;
+    case '6':
+      af = AF_INET6;
+      break;
+#endif
     }
   }
 
@@ -132,7 +152,6 @@
 {
   int argc;
   char *argv[128], *p;
-  int i;
 
   if (!string) return;
 
@@ -155,7 +174,6 @@
   int net_preopen_result;
 
   /*  Get the raw sockets first thing, so we can drop to user euid immediately  */
-
   net_preopen_result = net_preopen ();
 
   /*  Now drop to user permissions  */
@@ -182,7 +200,7 @@
   }
 
   if(PrintHelp) {
-    printf("usage: %s [-hvrctglsni] [--help] [--version] [--report]\n"
+    printf("usage: %s [-hvrctglsni46] [--help] [--version] [--report]\n"
 	   "\t\t[--report-cycles=COUNT] [--curses] [--gtk]\n"
            "\t\t[--raw] [--split] [--no-dns]\n"      /* BL */
            "\t\t[--psize=bytes/-p=bytes]\n"            /* ok */
@@ -201,7 +219,7 @@
   }
 
 
-  host = gethostbyname(Hostname);
+  host = gethostbyname2(Hostname, af);
   if(host == NULL) {
 #ifndef NO_HERROR
     herror("mtr");
@@ -211,11 +229,23 @@
     exit(1);
   }
 
-  traddr = *(int *)host->h_addr;
-
-  if(net_open(traddr) != 0) {
-    printf("mtr: Unable to get raw socket.  (Executable not suid?)\n");
-    exit(1);
+  switch (af) {
+  case AF_INET:
+    traddr = *(int *)host->h_addr;
+
+    if(net4_open(traddr) != 0) {
+      printf("mtr: Unable to get raw socket.  (Executable not suid?)\n");
+      exit(1);
+    }
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    if(net6_open((struct in6_addr *)host->h_addr) != 0) {
+      printf("mtr: Unable to get raw socket.  (Executable not suid?)\n");
+      exit(1);
+    }
+    break;
+#endif
   }
 
   display_open();
Index: mtr/net.c
diff -u mtr/net.c:1.1.1.3 mtr/net.c:1.13
--- mtr/net.c:1.1.1.3	Wed Feb  6 21:08:11 2002
+++ mtr/net.c	Thu Feb  7 00:44:32 2002
@@ -30,14 +30,29 @@
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#ifdef ENABLE_IPV6
+#include <netinet/ip6.h>
+#include <netinet/icmp6.h>
+#endif
 #include <memory.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <math.h>
 #include <errno.h>
+#include <netdb.h>
 
 #include "net.h"
+#include "display.h"
+
+#ifndef ENABLE_IPV6
+#define sockaddr_storage sockaddr
+#undef ss_len
+#define ss_len sa_len
+#undef ss_family
+#define ss_family sa_family
+#endif
 
+#define ICMP6ECHOLEN	8
 
 
 #define MaxTransit 4
@@ -82,7 +97,16 @@
 
 
 struct nethost {
-  uint32 addr;
+  union {
+    struct sockaddr_in _addr4;
+#define addr4 _addr._addr4.sin_addr
+#ifdef ENABLE_IPV6
+    struct sockaddr_in6 _addr6;
+#define addr6 _addr._addr6.sin6_addr
+#endif
+    struct sockaddr _addr0;
+#define addr0 _addr._addr0
+  } _addr;
   int xmit;
   int returned;
   long long total;
@@ -112,10 +136,11 @@
 static struct sequence sequence[MaxSequence];
 static struct timeval reset = { 0, 0 };
 
-int timestamp;
-int sendsock;
-int recvsock;
-struct sockaddr_in remoteaddress;
+static int sendsock4 = -1, recvsock4 = -1;
+#ifdef ENABLE_IPV6
+static int sendsock6 = -1, recvsock6 = -1;
+#endif
+static struct sockaddr_storage remoteaddress;
 static int batch_at = 0;
 
 
@@ -172,7 +197,7 @@
 }
 
 /*  Attempt to find the host at a particular number of hops away  */
-void net_send_query(int index) {
+void net4_send_query(int index) {
   /*ok  char packet[sizeof(struct IPHeader) + sizeof(struct ICMPHeader)];*/
   char packet[MAXPACKET];
   struct IPHeader *ip;
@@ -182,6 +207,9 @@
   int rv;
   static int first=1;
 
+  if ( sendsock4 < 0 )
+    return;
+
   if ( packetsize < MINPACKET ) packetsize = MINPACKET;
   if ( packetsize > MAXPACKET ) packetsize = MAXPACKET;
   memset(packet, 0, packetsize);
@@ -197,7 +225,7 @@
   ip->ttl = index + 1;
   ip->protocol = IPPROTO_ICMP;
   ip->saddr = 0;
-  ip->daddr = remoteaddress.sin_addr.s_addr;
+  ip->daddr = ((struct sockaddr_in *)&remoteaddress)->sin_addr.s_addr;
 
   icmp->type = ICMP_ECHO;
   icmp->id = getpid();
@@ -207,26 +235,153 @@
   ip->check = checksum(ip, packetsize);
 
   gettimeofday(&sequence[icmp->sequence].time, NULL);
-  rv = sendto(sendsock, packet, packetsize, 0, 
-	 (struct sockaddr *)&remoteaddress, sizeof(remoteaddress));
+  rv = sendto(sendsock4, packet, packetsize, 0, 
+	 (struct sockaddr *)&remoteaddress,
+#ifdef linux
+	 SA_LEN((struct sockaddr *)&remoteaddress)
+#else
+	 remoteaddress.ss_len
+#endif
+	 );
   if (first && (rv < 0) && (errno == EINVAL)) {
     ip->len = packetsize;
-    rv = sendto(sendsock, packet, packetsize, 0, 
-		(struct sockaddr *)&remoteaddress, sizeof(remoteaddress));
+    rv = sendto(sendsock4, packet, packetsize, 0, 
+		(struct sockaddr *)&remoteaddress,
+#ifdef linux
+		SA_LEN((struct sockaddr *)&remoteaddress)
+#else
+		remoteaddress.ss_len
+#endif
+		);
     if (rv >= 0) {
       fprintf (stderr, "You've got a broken (FreeBSD?) system\n");
       BSDfix = 1;
     }
   }
+  if (rv < 0) {
+    perror("sendto");
+    exit(1);
+  }
   first = 0;
 }
 
+#ifdef ENABLE_IPV6
+void net6_send_query(int index) {
+  /*ok  char packet[sizeof(struct IPHeader) + sizeof(struct ICMPHeader)];*/
+  char packet[MAXPACKET];
+  struct icmp6_hdr *icmp6;
+
+  /*ok  int packetsize = sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + datasize;*/
+  int rv;
+  static int first=1;
+  int hops;
+
+  if (sendsock6 < 0)
+    return;
+
+  if (packetsize < MINPACKET) packetsize = MINPACKET;
+  if (packetsize > MAXPACKET) packetsize = MAXPACKET;
+  memset(packet, 0, packetsize);
+
+  hops = index + 1;
+  if (setsockopt(sendsock6, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
+	&hops, sizeof(hops)) < 0) {
+    perror("setsockopt(IPV6_UNICAST_HOPS)");
+    exit(1);
+  }
+
+  icmp6 = (struct icmp6_hdr *)packet;
+
+  icmp6->icmp6_type = ICMP6_ECHO_REQUEST;
+  icmp6->icmp6_code = 0;
+  icmp6->icmp6_cksum = 0;
+  icmp6->icmp6_seq = new_sequence(index);
+  icmp6->icmp6_id = getpid() & 0xffff;
+
+  gettimeofday(&sequence[icmp6->icmp6_seq].time, NULL);
+  rv = sendto(sendsock6, packet, packetsize, 0, 
+	 (struct sockaddr *)&remoteaddress,
+#ifdef linux
+	 SA_LEN((struct sockaddr *)&remoteaddress)
+#else
+	 remoteaddress.ss_len
+#endif
+	);
+  if (rv < 0) {
+    perror("sendto");
+    exit(1);
+  }
+  first = 0;
+}
+#endif
+
+void net_send_query(int index) {
+  switch (remoteaddress.ss_family) {
+  case AF_INET:
+    net4_send_query(index);
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    net6_send_query(index);
+    break;
+#endif
+  }
+}
+
 /*   We got a return on something we sent out.  Record the address and
      time.  */
-void net_process_ping(int seq, uint32 addr, struct timeval now) {
+void net4_process_ping(int seq, uint32 addr, struct timeval now) {
+  int index;
+  int totusec;
+
+  if(sendsock4 < 0)
+    return;
+
+  if(seq < 0 || seq >= MaxSequence)
+    return;
+
+  if(!sequence[seq].transit)
+    return;
+  sequence[seq].transit = 0;
+
+  index = sequence[seq].index;
+
+  totusec = (now.tv_sec  - sequence[seq].time.tv_sec ) * 1000000 +
+            (now.tv_usec - sequence[seq].time.tv_usec);
+
+  if(host[index].addr4.s_addr == 0) {
+    host[index].addr0.sa_family = AF_INET;
+#ifndef linux
+    host[index].addr0.sa_len = sizeof(struct sockaddr_in);
+#endif
+    host[index].addr4.s_addr = addr;
+    display_rawhost(index, &host[index].addr0);
+  }
+  if(host[index].returned <= 0) {
+    host[index].best = host[index].worst = totusec;
+  }
+  host[index].last = totusec;
+  if(totusec < host[index].best)
+    host[index].best = totusec;
+  if(totusec > host[index].worst)
+    host[index].worst = totusec;
+
+  host[index].total += totusec;
+  host[index].returned++;
+  host[index].transit = 0;
+
+  net_save_return(index, sequence[seq].saved_seq, totusec);
+  display_rawping(index, totusec);
+}
+
+#ifdef ENABLE_IPV6
+void net6_process_ping(int seq, struct in6_addr *addr, struct timeval now) {
   int index;
   int totusec;
 
+  if(sendsock6 < 0)
+    return;
+
   if(seq < 0 || seq >= MaxSequence)
     return;
 
@@ -239,9 +394,13 @@
   totusec = (now.tv_sec  - sequence[seq].time.tv_sec ) * 1000000 +
             (now.tv_usec - sequence[seq].time.tv_usec);
 
-  if(host[index].addr == 0) {
-    host[index].addr = addr;
-    display_rawhost(index, host[index].addr);
+  if(IN6_IS_ADDR_UNSPECIFIED(&host[index].addr6)) {
+    host[index].addr0.sa_family = AF_INET6;
+#ifndef linux
+    host[index].addr0.sa_len = sizeof(struct sockaddr_in6);
+#endif
+    host[index].addr6 = *addr;
+    display_rawhost(index, &host[index].addr0);
   }
   if(host[index].returned <= 0) {
     host[index].best = host[index].worst = totusec;
@@ -259,23 +418,25 @@
   net_save_return(index, sequence[seq].saved_seq, totusec);
   display_rawping(index, totusec);
 }
+#endif
 
 /*  We know a packet has come in, because the main select loop has called us,
     now we just need to read it, see if it is for us, and if it is a reply 
-    to something we sent, then call net_process_ping()  */
-void net_process_return() {
+    to something we sent, then call net4_process_ping()  */
+void net4_process_return() {
   char packet[2048];
   struct sockaddr_in fromaddr;
   int fromaddrsize;
   int num;
-  int at;
   struct ICMPHeader *header;
   struct timeval now;
 
+  if(recvsock4 < 0) return;
+
   gettimeofday(&now, NULL);
 
   fromaddrsize = sizeof(fromaddr);
-  num = recvfrom(recvsock, packet, 2048, 0, 
+  num = recvfrom(recvsock4, packet, 2048, 0, 
 		 (struct sockaddr *)&fromaddr, &fromaddrsize);
 
   if(num < sizeof(struct IPHeader) + sizeof(struct ICMPHeader))
@@ -286,7 +447,7 @@
     if(header->id != (uint16)getpid())
       return;
 
-    net_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);
+    net4_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);
   } else if(header->type == ICMP_TIME_EXCEEDED) {
     if(num < sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + 
              sizeof(struct IPHeader) + sizeof(struct ICMPHeader))
@@ -296,13 +457,69 @@
 				sizeof(struct ICMPHeader) + sizeof(struct IPHeader));
     if(header->id != (uint16)getpid())
       return;
+
+    net4_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);
+  }
+}
+
+#ifdef ENABLE_IPV6
+void net6_process_return() {
+  char packet[2048];
+  struct sockaddr_storage fromaddr;
+  int fromaddrsize;
+  int num;
+  struct icmp6_hdr *header;
+  struct timeval now;
+
+  if(recvsock6 < 0) return;
+
+  gettimeofday(&now, NULL);
+
+  fromaddrsize = sizeof(fromaddr);
+  num = recvfrom(recvsock6, packet, 2048, 0, 
+		 (struct sockaddr *)&fromaddr, &fromaddrsize);
+
+  if (num < sizeof(struct icmp6_hdr))
+    return;
+
+  header = (struct icmp6_hdr *)packet;
+  if(header->icmp6_type == ICMP6_ECHO_REPLY) {
+    if(header->icmp6_id != (uint16)(getpid() & 0xffff))
+      return;
+
+    net6_process_ping(header->icmp6_seq,
+      &((struct sockaddr_in6 *)&fromaddr)->sin6_addr, now);
+  } else if (header->icmp6_type == ICMP6_TIME_EXCEEDED) {
+    if(num < sizeof(struct icmp6_hdr) + 
+             sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr))
+      return;
+    
+    header = (struct icmp6_hdr *)(packet + sizeof(struct icmp6_hdr)
+					    + sizeof(struct ip6_hdr));
+    if(header->icmp6_id != (getpid() & 0xffff))
+      return;
 
-    net_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);
+    net6_process_ping(header->icmp6_seq,
+      &((struct sockaddr_in6 *)&fromaddr)->sin6_addr, now);
   }
 }
+#endif
+
+void net_process_return() {
+  switch (remoteaddress.ss_family) {
+  case AF_INET:
+    net4_process_return();
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    net6_process_return();
+    break;
+#endif
+  }
+}
 
-int net_addr(int at) {
-  return ntohl(host[at].addr);
+const struct sockaddr *net_addr(int at) {
+  return &host[at].addr0;
 }
 
 int net_percent(int at) {
@@ -331,15 +548,47 @@
   return host[at].total / host[at].returned;
 }
 
+static int finaladdr(int at) {
+  switch (remoteaddress.ss_family) {
+  case AF_INET:
+    if (host[at].addr4.s_addr == ((struct sockaddr_in *)&remoteaddress)->sin_addr.s_addr)
+      return 1;
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    if (IN6_ARE_ADDR_EQUAL(&host[at].addr6, &((struct sockaddr_in6 *)&remoteaddress)->sin6_addr))
+      return 1;
+    break;
+#endif
+  }
+  return 0;
+}
+
+static int unspecaddr(int at) {
+  switch (remoteaddress.ss_family) {
+  case AF_INET:
+    if (host[at].addr4.s_addr == 0)
+      return 1;
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    if (IN6_IS_ADDR_UNSPECIFIED(&host[at].addr6))
+      return 1;
+    break;
+#endif
+  }
+  return 0;
+}
+
 int net_max() {
   int at;
   int max;
 
   max = 0;
   for(at = 0; at < MaxHost-2; at++) {
-    if(host[at].addr == remoteaddress.sin_addr.s_addr) {
+    if(finaladdr(at)) {
       return at + 1;
-    } else if(host[at].addr != 0) {
+    } else if(!unspecaddr(at)) {
       max = at + 2;
     }
   }
@@ -377,13 +626,13 @@
   n_unknown = 0;
 
   for (i=0;i<batch_at;i++) {
-    if (host[i].addr == 0)
+    if (unspecaddr(i))
       n_unknown++;
-    if (host[i].addr == remoteaddress.sin_addr.s_addr)
+    if (finaladdr(i))
       n_unknown = 100; /* Make sure we drop into "we should restart" */
   }
 
-  if ((host[batch_at].addr == remoteaddress.sin_addr.s_addr) ||
+  if (finaladdr(batch_at) ||
       (n_unknown > MAX_UNKNOWN_HOSTS) ||
       (batch_at >= MaxHost-2)) {
     numhosts = batch_at+1;
@@ -399,50 +648,146 @@
 int net_preopen() {
   int trueopt = 1;
 
-  sendsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
-  if(sendsock < 0)
-    return -1;
+  sendsock4 = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
 
 #ifdef IP_HDRINCL
   /*  FreeBSD wants this to avoid sending out packets with protocol type RAW
       to the network.  */
-  if(setsockopt(sendsock, SOL_IP, IP_HDRINCL, &trueopt, sizeof(trueopt)))
+  if(setsockopt(sendsock4, SOL_IP, IP_HDRINCL, &trueopt, sizeof(trueopt)))
   {
     perror("setsockopt(IP_HDRINCL,1)");
-    return -1;
+    sendsock4 = -1;
   }
 #endif
 
-  recvsock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
-  if(recvsock < 0)
+  if(sendsock4 >= 0)
+    recvsock4 = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
+  if(recvsock4 < 0) {
+    close(sendsock4);
+    sendsock4 = -1;
+  }
+
+#ifdef ENABLE_IPV6
+  sendsock6 = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
+
+  if(sendsock6 >= 0)
+    recvsock6 = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
+  if(recvsock6 < 0) {
+    close(sendsock6);
+    sendsock6 = -1;
+  }
+
+  /* Make sure we have either a valid IPV4 or IPV6 socket pair. */
+  if(((recvsock4 < 0) || (sendsock4 < 0)) &&
+     ((recvsock6 < 0) || (sendsock6 < 0)))
+    return -1;
+#else
+  /* Make sure we have either a valid IPV4 socket pair. */
+  if((recvsock4 < 0) || (sendsock4 < 0))
     return -1;
+#endif
 
   return 0;
 }
  
-int net_open(int addr) {
+int net4_open(int addr) {
+  struct sockaddr_in *sin;
+
+  if(sendsock4 < 0)
+    return(-1);
+
   net_reset();
+#if 0
+  if (sendsock6 >= 0)
+    close(sendsock6);
+  sendsock6 = -1;
+  if (recvsock6 >= 0)
+    close(recvsock6);
+  recvsock6 = -1;
+#endif
 
-  remoteaddress.sin_family = AF_INET;
-  remoteaddress.sin_addr.s_addr = addr;
+  memset(&remoteaddress, 0, sizeof(remoteaddress));
+  sin = (struct sockaddr_in *)&remoteaddress;
+  sin->sin_family = AF_INET;
+#ifndef linux
+  sin->sin_len = sizeof(struct sockaddr_in);
+#endif
+  sin->sin_addr.s_addr = addr;
 
   return 0;
 }
 
-void net_reopen(int addr) {
+void net4_reopen(int addr) {
+  struct sockaddr_in *sin;
   int at;
 
   for(at = 0; at < MaxHost; at++) {
     memset(&host[at], 0, sizeof(host[at]));
   }
 
-  remoteaddress.sin_family = AF_INET;
-  remoteaddress.sin_addr.s_addr = addr;
+  memset(&remoteaddress, 0, sizeof(remoteaddress));
+  sin = (struct sockaddr_in *)&remoteaddress;
+  sin->sin_family = AF_INET;
+#ifndef linux
+  sin->sin_len = sizeof(struct sockaddr_in);
+#endif
+  sin->sin_addr.s_addr = addr;
 
   net_reset ();
   net_send_batch();
 }
 
+#ifdef ENABLE_IPV6
+int net6_open(struct in6_addr *addr) {
+  struct sockaddr_in6 *sin6;
+
+  if(sendsock6 < 0)
+    return(-1);
+
+  net_reset();
+#if 0
+  if (sendsock4 >= 0)
+    close(sendsock4);
+  sendsock4 = -1;
+  if (recvsock4 >= 0)
+    close(recvsock4);
+  recvsock4 = -1;
+#endif
+
+  memset(&remoteaddress, 0, sizeof(remoteaddress));
+  sin6 = (struct sockaddr_in6 *)&remoteaddress;
+  sin6->sin6_family = AF_INET6;
+#ifndef linux
+  sin6->sin6_len = sizeof(struct sockaddr_in6);
+#endif
+  memcpy(&sin6->sin6_addr, addr, sizeof(*addr));
+
+  return 0;
+}
+
+void net6_reopen(struct in6_addr *addr) {
+  struct sockaddr_in6 *sin6;
+  int at;
+
+  if(sendsock6 < 0) return;
+
+  for(at = 0; at < MaxHost; at++) {
+    memset(&host[at], 0, sizeof(host[at]));
+  }
+
+  memset(&remoteaddress, 0, sizeof(remoteaddress));
+  sin6 = (struct sockaddr_in6 *)&remoteaddress;
+  sin6->sin6_family = AF_INET6;
+#ifndef linux
+  sin6->sin6_len = sizeof(struct sockaddr_in6);
+#endif
+  memcpy(&sin6->sin6_addr, addr, sizeof(*addr));
+
+  net_reset ();
+  net_send_batch();
+}
+#endif
+
 void net_reset() {
   int at;
   int i;
@@ -471,12 +816,39 @@
 }
 
 void net_close() {
-  close(sendsock);
-  close(recvsock);
+  if (sendsock4 >= 0)
+    close(sendsock4);
+  if (recvsock4 >= 0)
+    close(recvsock4);
+#ifdef ENABLE_IPV6
+  if (sendsock6 >= 0)
+    close(sendsock6);
+  if (recvsock6 >= 0)
+    close(recvsock6);
+#endif
+}
+
+int net4_waitfd() {
+  return recvsock4;
 }
 
+#ifdef ENABLE_IPV6
+int net6_waitfd() {
+  return recvsock6;
+}
+#endif
+
 int net_waitfd() {
-  return recvsock;
+  switch (remoteaddress.ss_family) {
+  case AF_INET:
+    return net4_waitfd();
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    return net6_waitfd();
+#endif
+  default:
+    return -1;
+  }
 }
 
 
Index: mtr/net.h
diff -u mtr/net.h:1.1.1.2 mtr/net.h:1.6
--- mtr/net.h:1.1.1.2	Wed Feb  6 21:08:12 2002
+++ mtr/net.h	Wed Feb  6 22:24:34 2002
@@ -19,16 +19,27 @@
 
 /*  Prototypes for functions in net.c  */
 
+struct in6_addr;
+
 int net_preopen();
-int net_open(int address);
-void net_reopen(int address);
+int net4_open(int address);
+void net4_reopen(int address);
+#ifdef ENABLE_IPV6
+int net6_open(struct in6_addr *address);
+void net6_reopen(struct in6_addr *address);
+#endif
 void net_reset();
 void net_close();
 int net_waitfd();
+int net4_waitfd();
+#ifdef ENABLE_IPV6
+int net6_waitfd();
+#endif
 void net_process_return();
 int net_max();
-int net_addr(int at);
+const struct sockaddr *net_addr(int at);
 int net_percent(int at);
+int net_last(int at);
 int net_best(int at);
 int net_worst(int at);
 int net_avg(int at);
Index: mtr/raw.c
diff -u mtr/raw.c:1.1.1.1 mtr/raw.c:1.7
--- mtr/raw.c:1.1.1.1	Sat Aug 28 04:25:09 1999
+++ mtr/raw.c	Thu Jan 13 13:32:00 2000
@@ -22,6 +22,9 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netdb.h>
 
 
 #include "raw.h"
@@ -30,6 +33,7 @@
 
 static int havename[MaxHost];
 
+#if 0
 static char *addr_to_str(int addr)
 {
   static char buf[20];
@@ -41,14 +45,14 @@
 	   (addr >> 24) & 0xff);
   return buf;
 }
+#endif
 
-
 void raw_rawping (int host, int msec)
 {
-  char *name;
+  const char *name;
 
   if (!havename[host]) {
-    name = dns_lookup2(net_addr(host));
+    name = dns_lookup2((struct sockaddr *)net_addr(host));
     if (name) {
       havename[host]++;
       printf ("d %d %s\n", host, name);
@@ -58,9 +62,17 @@
 }
 
 
-void raw_rawhost (int host, int ip_addr)
+void raw_rawhost (int host, struct sockaddr *addr)
 {
-  printf ("h %d %s\n", host, addr_to_str (ip_addr));
+  char hbuf[128];
+  getnameinfo(addr,
+#ifdef linux
+	SA_LEN(addr),
+#else
+	addr->sa_len,
+#endif
+	hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
+  printf ("h %d %s\n", host, hbuf);
 }
 
 
Index: mtr/raw.h
diff -u mtr/raw.h:1.1.1.1 mtr/raw.h:1.2
--- mtr/raw.h:1.1.1.1	Sat Aug 28 04:25:09 1999
+++ mtr/raw.h	Fri Sep  3 02:12:37 1999
@@ -21,4 +21,4 @@
 
 /*  Prototypes for raw.c  */
 void raw_rawping(int host, int msec);
-void raw_rawhost(int host, int addr);
+void raw_rawhost(int host, struct sockaddr *addr);
Index: mtr/report.c
diff -u mtr/report.c:1.1.1.1 mtr/report.c:1.4
--- mtr/report.c:1.1.1.1	Sat Aug 28 04:25:03 1999
+++ mtr/report.c	Wed Sep  8 11:30:08 1999
@@ -36,10 +36,9 @@
 }
 
 void report_close() {
-  int at, max, addr;
-  int haddr;
-  char name[81];
-  struct hostent *host;
+  int at, max;
+  const struct sockaddr *addr;
+  char name[128];
 
   max = net_max();
 
@@ -50,16 +49,13 @@
     if(addr == 0) {
       sprintf(name, "???");
     } else {
-      haddr = htonl(addr);
-      host = dns?gethostbyaddr((char *)&haddr, sizeof(int), AF_INET):NULL;
-
-      if (host != NULL) {
-	 strncpy(name, host->h_name, 80);
-	 name[80] = 0;
-      } else {
-	sprintf(name, "%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, 
-		(addr >> 8) & 0xff, addr & 0xff);
-      }
+      getnameinfo(addr,
+#ifdef linux
+		SA_LEN(addr),
+#else
+		addr->sa_len,
+#endif
+		name, sizeof(name), NULL, 0, dns ? 0 : NI_NUMERICHOST);
     }
 
     /* Coding tip: 
Index: mtr/select.c
diff -u mtr/select.c:1.1.1.3 mtr/select.c:1.4
--- mtr/select.c:1.1.1.3	Wed Feb  6 21:08:16 2002
+++ mtr/select.c	Wed Feb  6 22:24:34 2002
@@ -20,6 +20,7 @@
 #include <config.h>
 #include <sys/types.h>
 #include <sys/time.h>
+#include <sys/socket.h>
 #include <unistd.h>
 #include <time.h>
 #include <sys/select.h>
@@ -46,7 +47,6 @@
   int NumPing;
   int paused;
   struct timeval lasttime, thistime, selecttime;
-  float wt;
   int dt;
 
   NumPing = 0; 
Index: mtr/split.c
diff -u mtr/split.c:1.1.1.1 mtr/split.c:1.5
--- mtr/split.c:1.1.1.1	Sat Aug 28 04:25:09 1999
+++ mtr/split.c	Tue May  8 18:57:11 2001
@@ -24,13 +24,15 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <sys/types.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
 
 #include "display.h"
 #include "dns.h"
-/*
 #include "net.h"
 #include "split.h"
-*/
 
 #include <config.h>
 
@@ -71,10 +73,11 @@
 split_redraw() {
   int   max;
   int   at;
-  int   addr;
-  char *name;
+  const struct sockaddr *addr;
+  const char *name;
   char  newLine[MAX_LINE_SIZE];
   int   i;
+  char hbuf[128];
 
 #if DEBUG
   fprintf(stderr, "split_redraw()\n"); 
@@ -97,7 +100,7 @@
     addr = net_addr(at);
     
     if(addr != 0) {
-      name = dns_lookup(addr);
+      name = dns_lookup((struct sockaddr *)addr);
       if(name != NULL) {
 	/* May be we should test name's length */
 	sprintf(newLine, "%s %d %d %d %d %d %d", name,
@@ -106,9 +109,15 @@
 		net_best(at) /1000, net_avg(at)/1000, 
 		net_worst(at)/1000);
       } else {
-	sprintf(newLine, "%d.%d.%d.%d %d %d %d %d %d %d", 
-		(addr >> 24) & 0xff, (addr >> 16) & 0xff, 
-		(addr >> 8) & 0xff, addr & 0xff,
+	getnameinfo(addr,
+#ifdef linux
+			SA_LEN(addr),
+#else
+			addr->sa_len,
+#endif
+			hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
+	sprintf(newLine, "%s %d %d %d %d %d %d", 
+		hbuf,
 		net_percent(at),
 		net_returned(at), net_xmit(at),
 		net_best(at) /1000, net_avg(at)/1000, 
Index: mtr/img/.cvsignore
diff -u /dev/null mtr/img/.cvsignore:1.1
--- /dev/null	Thu Feb  7 01:09:34 2002
+++ mtr/img/.cvsignore	Fri Sep  3 00:29:09 1999
@@ -0,0 +1 @@
+Makefile
