Index: squid11/configure
diff -c squid11/configure:1.1.1.1 squid11/configure:1.3
*** squid11/configure:1.1.1.1	Tue Feb 16 18:03:45 1999
--- squid11/configure	Thu Feb 18 09:31:11 1999
***************
*** 12,17 ****
--- 12,20 ----
  ac_default_prefix=/usr/local
  # Any additions from configure.in:
  ac_default_prefix=/usr/local/squid
+ ac_help="$ac_help
+   --enable-ipv6		Enable ipv6 (with ipv4) support
+   --disable-ipv6		Disable ipv6 support"
  
  # Initialize some variables set by options.
  # The variables have the same names as the options, with
***************
*** 520,526 ****
  
  
  
! # From configure.in Revision: 1.69.2.6 
  ac_aux_dir=
  for ac_dir in aux $srcdir/aux; do
    if test -f $ac_dir/install-sh; then
--- 523,529 ----
  
  
  
! # From configure.in Revision: 1.69.2.7 
  ac_aux_dir=
  for ac_dir in aux $srcdir/aux; do
    if test -f $ac_dir/install-sh; then
***************
*** 548,554 ****
  fi
  
  echo $ac_n "checking host system type""... $ac_c" 1>&6
! echo "configure:552: checking host system type" >&5
  
  host_alias=$host
  case "$host_alias" in
--- 551,557 ----
  fi
  
  echo $ac_n "checking host system type""... $ac_c" 1>&6
! echo "configure:555: checking host system type" >&5
  
  host_alias=$host
  case "$host_alias" in
***************
*** 603,609 ****
  # 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:607: 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
--- 606,612 ----
  # 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:610: 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
***************
*** 632,638 ****
    # 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:636: 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
--- 635,641 ----
    # 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:639: 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
***************
*** 680,686 ****
  fi
  
  echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
! echo "configure:684: 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.
--- 683,689 ----
  fi
  
  echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
! echo "configure:687: 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.
***************
*** 690,700 ****
  cross_compiling=$ac_cv_prog_cc_cross
  
  cat > conftest.$ac_ext <<EOF
! #line 694 "configure"
  #include "confdefs.h"
  main(){return(0);}
  EOF
! if { (eval echo configure:698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    ac_cv_prog_cc_works=yes
    # If we can't run a trivial program, we are probably using a cross compiler.
    if (./conftest; exit) 2>/dev/null; then
--- 693,703 ----
  cross_compiling=$ac_cv_prog_cc_cross
  
  cat > conftest.$ac_ext <<EOF
! #line 697 "configure"
  #include "confdefs.h"
  main(){return(0);}
  EOF
! if { (eval echo configure:701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    ac_cv_prog_cc_works=yes
    # If we can't run a trivial program, we are probably using a cross compiler.
    if (./conftest; exit) 2>/dev/null; then
***************
*** 714,725 ****
    { 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:718: 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:723: 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
--- 717,728 ----
    { 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:721: 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:726: 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
***************
*** 728,734 ****
    yes;
  #endif
  EOF
! if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:732: \"$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
--- 731,737 ----
    yes;
  #endif
  EOF
! if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:735: \"$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
***************
*** 743,749 ****
    ac_save_CFLAGS="$CFLAGS"
    CFLAGS=
    echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
! echo "configure:747: 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
--- 746,752 ----
    ac_save_CFLAGS="$CFLAGS"
    CFLAGS=
    echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
! echo "configure:750: 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
***************
*** 818,824 ****
  fi
  
  echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
! echo "configure:822: checking how to run the C preprocessor" >&5
  # On Suns, sometimes $CPP names a directory.
  if test -n "$CPP" && test -d "$CPP"; then
    CPP=
--- 821,827 ----
  fi
  
  echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
! echo "configure:825: checking how to run the C preprocessor" >&5
  # On Suns, sometimes $CPP names a directory.
  if test -n "$CPP" && test -d "$CPP"; then
    CPP=
***************
*** 833,845 ****
    # On the NeXT, cc -E runs the code through the compiler's parser,
    # not just through cpp.
    cat > conftest.$ac_ext <<EOF
! #line 837 "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:843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
  if test -z "$ac_err"; then
    :
--- 836,848 ----
    # On the NeXT, cc -E runs the code through the compiler's parser,
    # not just through cpp.
    cat > conftest.$ac_ext <<EOF
! #line 840 "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:846: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
  if test -z "$ac_err"; then
    :
***************
*** 850,862 ****
    rm -rf conftest*
    CPP="${CC-cc} -E -traditional-cpp"
    cat > conftest.$ac_ext <<EOF
! #line 854 "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:860: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
  if test -z "$ac_err"; then
    :
--- 853,865 ----
    rm -rf conftest*
    CPP="${CC-cc} -E -traditional-cpp"
    cat > conftest.$ac_ext <<EOF
! #line 857 "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:863: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
  if test -z "$ac_err"; then
    :
***************
*** 878,883 ****
--- 881,1085 ----
  fi
  echo "$ac_t""$CPP" 1>&6
  
+ 
+ echo $ac_n "checking whether to enable ipv6""... $ac_c" 1>&6
+ echo "configure:887: 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 INET6 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 911 "configure"
+ #include "confdefs.h"
+  /* AF_INET6 avalable check */
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ main()
+ {
+  if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
+    exit(1);
+  else
+    exit(0);
+ }
+ 
+ EOF
+ if { (eval echo configure:925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+ then
+   echo "$ac_t""yes" 1>&6
+   cat >> confdefs.h <<\EOF
+ #define INET6 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
+ 
+ if test "$ipv6" = "yes"; then
+ 	echo $ac_n "checking ipv6 stack type""... $ac_c" 1>&6
+ echo "configure:951: checking ipv6 stack type" >&5
+ 	for i in inria kame linux toshiba v6d zeta; do
+ 		case $i in
+ 		inria)
+ 						cat > conftest.$ac_ext <<EOF
+ #line 956 "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 975 "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;
+ 				CFLAGS="-DINET6 $CFLAGS"
+ fi
+ rm -f conftest*
+ 
+ 			;;
+ 		linux)
+ 						if test -d /usr/inet6; then
+ 				ipv6type=$i
+ 				ipv6lib=inet6
+ 				ipv6libdir=/usr/inet6/lib
+ 				CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
+ 			fi
+ 			;;
+ 		toshiba)
+ 			cat > conftest.$ac_ext <<EOF
+ #line 1004 "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 1025 "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 1046 "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"
+ 	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
+ 
  # Find a good install program.  We prefer a C program (faster),
  # so one script is as good as another.  But avoid the broken or
  # incompatible versions:
***************
*** 889,895 ****
  # 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:893: 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
--- 1091,1097 ----
  # 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:1095: 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
***************
*** 941,947 ****
  # Extract the first word of "ranlib", so it can be a program name with args.
  set dummy ranlib; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:945: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 1143,1149 ----
  # Extract the first word of "ranlib", so it can be a program name with args.
  set dummy ranlib; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1147: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 968,974 ****
  fi
  
  echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
! echo "configure:972: checking whether ln -s works" >&5
  if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 1170,1176 ----
  fi
  
  echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
! echo "configure:1174: checking whether ln -s works" >&5
  if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 991,997 ****
  # Extract the first word of "false", so it can be a program name with args.
  set dummy false; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:995: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_FALSE'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 1193,1199 ----
  # Extract the first word of "false", so it can be a program name with args.
  set dummy false; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1197: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_FALSE'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 1023,1029 ****
  # Extract the first word of "true", so it can be a program name with args.
  set dummy true; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1027: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_TRUE'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 1225,1231 ----
  # Extract the first word of "true", so it can be a program name with args.
  set dummy true; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1229: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_TRUE'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 1055,1061 ****
  # Extract the first word of "rm", so it can be a program name with args.
  set dummy rm; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1059: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 1257,1263 ----
  # Extract the first word of "rm", so it can be a program name with args.
  set dummy rm; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1261: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 1087,1093 ****
  # Extract the first word of "mv", so it can be a program name with args.
  set dummy mv; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1091: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 1289,1295 ----
  # Extract the first word of "mv", so it can be a program name with args.
  set dummy mv; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1293: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 1119,1125 ****
  # Extract the first word of "mkdir", so it can be a program name with args.
  set dummy mkdir; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1123: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 1321,1327 ----
  # Extract the first word of "mkdir", so it can be a program name with args.
  set dummy mkdir; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1325: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 1151,1157 ****
  # Extract the first word of "ln", so it can be a program name with args.
  set dummy ln; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1155: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_LN'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 1353,1359 ----
  # Extract the first word of "ln", so it can be a program name with args.
  set dummy ln; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1357: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_LN'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 1183,1189 ****
  # Extract the first word of "perl", so it can be a program name with args.
  set dummy perl; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1187: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 1385,1391 ----
  # Extract the first word of "perl", so it can be a program name with args.
  set dummy perl; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1389: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 1215,1221 ****
  # Extract the first word of "makedepend", so it can be a program name with args.
  set dummy makedepend; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1219: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_MAKEDEPEND'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 1417,1423 ----
  # Extract the first word of "makedepend", so it can be a program name with args.
  set dummy makedepend; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1421: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_MAKEDEPEND'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 1247,1253 ****
  # Extract the first word of "ar", so it can be a program name with args.
  set dummy ar; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1251: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 1449,1455 ----
  # Extract the first word of "ar", so it can be a program name with args.
  set dummy ar; ac_word=$2
  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
! echo "configure:1453: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 1297,1308 ****
  do
  ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
  echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
! echo "configure:1301: checking for $ac_hdr that defines DIR" >&5
  if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 1306 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <$ac_hdr>
--- 1499,1510 ----
  do
  ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
  echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
! echo "configure:1503: checking for $ac_hdr that defines DIR" >&5
  if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 1508 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <$ac_hdr>
***************
*** 1310,1316 ****
  DIR *dirp = 0;
  ; return 0; }
  EOF
! if { (eval echo configure:1314: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    eval "ac_cv_header_dirent_$ac_safe=yes"
  else
--- 1512,1518 ----
  DIR *dirp = 0;
  ; return 0; }
  EOF
! if { (eval echo configure:1516: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    eval "ac_cv_header_dirent_$ac_safe=yes"
  else
***************
*** 1335,1341 ****
  # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
  if test $ac_header_dirent = dirent.h; then
  echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
! echo "configure:1339: checking for opendir in -ldir" >&5
  ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 1537,1543 ----
  # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
  if test $ac_header_dirent = dirent.h; then
  echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
! echo "configure:1541: checking for opendir in -ldir" >&5
  ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 1343,1349 ****
    ac_save_LIBS="$LIBS"
  LIBS="-ldir  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 1347 "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
--- 1545,1551 ----
    ac_save_LIBS="$LIBS"
  LIBS="-ldir  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 1549 "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
***************
*** 1354,1360 ****
  opendir()
  ; return 0; }
  EOF
! if { (eval echo configure:1358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 1556,1562 ----
  opendir()
  ; return 0; }
  EOF
! if { (eval echo configure:1560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 1376,1382 ****
  
  else
  echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
! echo "configure:1380: checking for opendir in -lx" >&5
  ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 1578,1584 ----
  
  else
  echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
! echo "configure:1582: checking for opendir in -lx" >&5
  ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 1384,1390 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lx  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 1388 "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
--- 1586,1592 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lx  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 1590 "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
***************
*** 1395,1401 ****
  opendir()
  ; return 0; }
  EOF
! if { (eval echo configure:1399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 1597,1603 ----
  opendir()
  ; return 0; }
  EOF
! if { (eval echo configure:1601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 1418,1429 ****
  fi
  
  echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
! echo "configure:1422: checking for ANSI C header files" >&5
  if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 1427 "configure"
  #include "confdefs.h"
  #include <stdlib.h>
  #include <stdarg.h>
--- 1620,1631 ----
  fi
  
  echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
! echo "configure:1624: checking for ANSI C header files" >&5
  if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 1629 "configure"
  #include "confdefs.h"
  #include <stdlib.h>
  #include <stdarg.h>
***************
*** 1431,1437 ****
  #include <float.h>
  EOF
  ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
! { (eval echo configure:1435: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
  if test -z "$ac_err"; then
    rm -rf conftest*
--- 1633,1639 ----
  #include <float.h>
  EOF
  ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
! { (eval echo configure:1637: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
  if test -z "$ac_err"; then
    rm -rf conftest*
***************
*** 1448,1454 ****
  if test $ac_cv_header_stdc = yes; then
    # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  cat > conftest.$ac_ext <<EOF
! #line 1452 "configure"
  #include "confdefs.h"
  #include <string.h>
  EOF
--- 1650,1656 ----
  if test $ac_cv_header_stdc = yes; then
    # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  cat > conftest.$ac_ext <<EOF
! #line 1654 "configure"
  #include "confdefs.h"
  #include <string.h>
  EOF
***************
*** 1466,1472 ****
  if test $ac_cv_header_stdc = yes; then
    # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
  cat > conftest.$ac_ext <<EOF
! #line 1470 "configure"
  #include "confdefs.h"
  #include <stdlib.h>
  EOF
--- 1668,1674 ----
  if test $ac_cv_header_stdc = yes; then
    # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
  cat > conftest.$ac_ext <<EOF
! #line 1672 "configure"
  #include "confdefs.h"
  #include <stdlib.h>
  EOF
***************
*** 1487,1493 ****
    :
  else
    cat > conftest.$ac_ext <<EOF
! #line 1491 "configure"
  #include "confdefs.h"
  #include <ctype.h>
  #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
--- 1689,1695 ----
    :
  else
    cat > conftest.$ac_ext <<EOF
! #line 1693 "configure"
  #include "confdefs.h"
  #include <ctype.h>
  #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
***************
*** 1498,1504 ****
  exit (0); }
  
  EOF
! if { (eval echo configure:1502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    :
  else
--- 1700,1706 ----
  exit (0); }
  
  EOF
! if { (eval echo configure:1704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    :
  else
***************
*** 1574,1590 ****
  do
  ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
  echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
! echo "configure:1578: 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 1583 "configure"
  #include "confdefs.h"
  #include <$ac_hdr>
  EOF
  ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
! { (eval echo configure:1588: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
  if test -z "$ac_err"; then
    rm -rf conftest*
--- 1776,1792 ----
  do
  ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
  echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
! echo "configure:1780: 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 1785 "configure"
  #include "confdefs.h"
  #include <$ac_hdr>
  EOF
  ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
! { (eval echo configure:1790: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
  if test -z "$ac_err"; then
    rm -rf conftest*
***************
*** 1612,1623 ****
  
  
  echo $ac_n "checking for working const""... $ac_c" 1>&6
! echo "configure:1616: checking for working const" >&5
  if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 1621 "configure"
  #include "confdefs.h"
  
  int main() {
--- 1814,1825 ----
  
  
  echo $ac_n "checking for working const""... $ac_c" 1>&6
! echo "configure:1818: checking for working const" >&5
  if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 1823 "configure"
  #include "confdefs.h"
  
  int main() {
***************
*** 1666,1672 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:1670: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_c_const=yes
  else
--- 1868,1874 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:1872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_c_const=yes
  else
***************
*** 1688,1703 ****
  
  
  echo $ac_n "checking if ANSI prototypes work""... $ac_c" 1>&6
! echo "configure:1692: checking if ANSI prototypes work" >&5
  cat > conftest.$ac_ext <<EOF
! #line 1694 "configure"
  #include "confdefs.h"
  int foo(char *); int foo (char *bar) {return 1;}
  int main() {
  foo("bar")
  ; return 0; }
  EOF
! if { (eval echo configure:1701: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_ANSI_PROTOTYPES 1
--- 1890,1905 ----
  
  
  echo $ac_n "checking if ANSI prototypes work""... $ac_c" 1>&6
! echo "configure:1894: checking if ANSI prototypes work" >&5
  cat > conftest.$ac_ext <<EOF
! #line 1896 "configure"
  #include "confdefs.h"
  int foo(char *); int foo (char *bar) {return 1;}
  int main() {
  foo("bar")
  ; return 0; }
  EOF
! if { (eval echo configure:1903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_ANSI_PROTOTYPES 1
***************
*** 1713,1721 ****
  rm -f conftest*
  
  echo $ac_n "checking for tm->tm_gmtoff""... $ac_c" 1>&6
! echo "configure:1717: checking for tm->tm_gmtoff" >&5
  cat > conftest.$ac_ext <<EOF
! #line 1719 "configure"
  #include "confdefs.h"
  #include <time.h>
  #include <sys/time.h>
--- 1915,1923 ----
  rm -f conftest*
  
  echo $ac_n "checking for tm->tm_gmtoff""... $ac_c" 1>&6
! echo "configure:1919: checking for tm->tm_gmtoff" >&5
  cat > conftest.$ac_ext <<EOF
! #line 1921 "configure"
  #include "confdefs.h"
  #include <time.h>
  #include <sys/time.h>
***************
*** 1724,1730 ****
  foo.tm_gmtoff = 0;
  ; return 0; }
  EOF
! if { (eval echo configure:1728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_TM_GMTOFF 1
--- 1926,1932 ----
  foo.tm_gmtoff = 0;
  ; return 0; }
  EOF
! if { (eval echo configure:1930: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_TM_GMTOFF 1
***************
*** 1740,1748 ****
  rm -f conftest*
  
  echo $ac_n "checking for extended mallinfo""... $ac_c" 1>&6
! echo "configure:1744: checking for extended mallinfo" >&5
  cat > conftest.$ac_ext <<EOF
! #line 1746 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <malloc.h>
--- 1942,1950 ----
  rm -f conftest*
  
  echo $ac_n "checking for extended mallinfo""... $ac_c" 1>&6
! echo "configure:1946: checking for extended mallinfo" >&5
  cat > conftest.$ac_ext <<EOF
! #line 1948 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <malloc.h>
***************
*** 1751,1757 ****
  foo.mxfast = 0;
  ; return 0; }
  EOF
! if { (eval echo configure:1755: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_EXT_MALLINFO 1
--- 1953,1959 ----
  foo.mxfast = 0;
  ; return 0; }
  EOF
! if { (eval echo configure:1957: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_EXT_MALLINFO 1
***************
*** 1767,1775 ****
  rm -f conftest*
  
  echo $ac_n "checking for ip->ip_hl""... $ac_c" 1>&6
! echo "configure:1771: checking for ip->ip_hl" >&5
  cat > conftest.$ac_ext <<EOF
! #line 1773 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <netinet/in.h>
--- 1969,1977 ----
  rm -f conftest*
  
  echo $ac_n "checking for ip->ip_hl""... $ac_c" 1>&6
! echo "configure:1973: checking for ip->ip_hl" >&5
  cat > conftest.$ac_ext <<EOF
! #line 1975 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <netinet/in.h>
***************
*** 1786,1792 ****
  ip.ip_hl= 0;
  ; return 0; }
  EOF
! if { (eval echo configure:1790: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_IP_HL 1
--- 1988,1994 ----
  ip.ip_hl= 0;
  ; return 0; }
  EOF
! if { (eval echo configure:1992: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_IP_HL 1
***************
*** 1802,1808 ****
  rm -f conftest*
  
  echo $ac_n "checking size of int""... $ac_c" 1>&6
! echo "configure:1806: checking size of int" >&5
  if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 2004,2010 ----
  rm -f conftest*
  
  echo $ac_n "checking size of int""... $ac_c" 1>&6
! echo "configure:2008: checking size of int" >&5
  if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 1810,1816 ****
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 1814 "configure"
  #include "confdefs.h"
  #include <stdio.h>
  main()
--- 2012,2018 ----
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 2016 "configure"
  #include "confdefs.h"
  #include <stdio.h>
  main()
***************
*** 1821,1827 ****
    exit(0);
  }
  EOF
! if { (eval echo configure:1825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    ac_cv_sizeof_int=`cat conftestval`
  else
--- 2023,2029 ----
    exit(0);
  }
  EOF
! if { (eval echo configure:2027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    ac_cv_sizeof_int=`cat conftestval`
  else
***************
*** 1841,1847 ****
  
  
  echo $ac_n "checking size of long""... $ac_c" 1>&6
! echo "configure:1845: checking size of long" >&5
  if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 2043,2049 ----
  
  
  echo $ac_n "checking size of long""... $ac_c" 1>&6
! echo "configure:2047: checking size of long" >&5
  if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 1849,1855 ****
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 1853 "configure"
  #include "confdefs.h"
  #include <stdio.h>
  main()
--- 2051,2057 ----
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 2055 "configure"
  #include "confdefs.h"
  #include <stdio.h>
  main()
***************
*** 1860,1866 ****
    exit(0);
  }
  EOF
! if { (eval echo configure:1864: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    ac_cv_sizeof_long=`cat conftestval`
  else
--- 2062,2068 ----
    exit(0);
  }
  EOF
! if { (eval echo configure:2066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    ac_cv_sizeof_long=`cat conftestval`
  else
***************
*** 1883,1901 ****
  # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  # for constant arguments.  Useless!
  echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
! echo "configure:1887: checking for working alloca.h" >&5
  if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 1892 "configure"
  #include "confdefs.h"
  #include <alloca.h>
  int main() {
  char *p = alloca(2 * sizeof(int));
  ; return 0; }
  EOF
! if { (eval echo configure:1899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    ac_cv_header_alloca_h=yes
  else
--- 2085,2103 ----
  # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  # for constant arguments.  Useless!
  echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
! echo "configure:2089: checking for working alloca.h" >&5
  if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2094 "configure"
  #include "confdefs.h"
  #include <alloca.h>
  int main() {
  char *p = alloca(2 * sizeof(int));
  ; return 0; }
  EOF
! if { (eval echo configure:2101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    ac_cv_header_alloca_h=yes
  else
***************
*** 1916,1927 ****
  fi
  
  echo $ac_n "checking for alloca""... $ac_c" 1>&6
! echo "configure:1920: checking for alloca" >&5
  if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 1925 "configure"
  #include "confdefs.h"
  
  #ifdef __GNUC__
--- 2118,2129 ----
  fi
  
  echo $ac_n "checking for alloca""... $ac_c" 1>&6
! echo "configure:2122: checking for alloca" >&5
  if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2127 "configure"
  #include "confdefs.h"
  
  #ifdef __GNUC__
***************
*** 1944,1950 ****
  char *p = (char *) alloca(1);
  ; return 0; }
  EOF
! if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    ac_cv_func_alloca_works=yes
  else
--- 2146,2152 ----
  char *p = (char *) alloca(1);
  ; return 0; }
  EOF
! if { (eval echo configure:2150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    ac_cv_func_alloca_works=yes
  else
***************
*** 1976,1987 ****
  
  
  echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
! echo "configure:1980: checking whether alloca needs Cray hooks" >&5
  if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 1985 "configure"
  #include "confdefs.h"
  #if defined(CRAY) && ! defined(CRAY2)
  webecray
--- 2178,2189 ----
  
  
  echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
! echo "configure:2182: checking whether alloca needs Cray hooks" >&5
  if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2187 "configure"
  #include "confdefs.h"
  #if defined(CRAY) && ! defined(CRAY2)
  webecray
***************
*** 2006,2017 ****
  if test $ac_cv_os_cray = yes; then
  for ac_func in _getb67 GETB67 getb67; do
    echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:2010: 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 2015 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
--- 2208,2219 ----
  if test $ac_cv_os_cray = yes; then
  for ac_func in _getb67 GETB67 getb67; do
    echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:2212: 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 2217 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
***************
*** 2034,2040 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:2038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
--- 2236,2242 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:2240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
***************
*** 2061,2067 ****
  fi
  
  echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
! echo "configure:2065: checking stack direction for C alloca" >&5
  if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 2263,2269 ----
  fi
  
  echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
! echo "configure:2267: checking stack direction for C alloca" >&5
  if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 2069,2075 ****
    ac_cv_c_stack_direction=0
  else
    cat > conftest.$ac_ext <<EOF
! #line 2073 "configure"
  #include "confdefs.h"
  find_stack_direction ()
  {
--- 2271,2277 ----
    ac_cv_c_stack_direction=0
  else
    cat > conftest.$ac_ext <<EOF
! #line 2275 "configure"
  #include "confdefs.h"
  find_stack_direction ()
  {
***************
*** 2088,2094 ****
    exit (find_stack_direction() < 0);
  }
  EOF
! if { (eval echo configure:2092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    ac_cv_c_stack_direction=1
  else
--- 2290,2296 ----
    exit (find_stack_direction() < 0);
  }
  EOF
! if { (eval echo configure:2294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    ac_cv_c_stack_direction=1
  else
***************
*** 2111,2122 ****
  
  
  echo $ac_n "checking for pid_t""... $ac_c" 1>&6
! echo "configure:2115: checking for pid_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2120 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 2313,2324 ----
  
  
  echo $ac_n "checking for pid_t""... $ac_c" 1>&6
! echo "configure:2317: checking for pid_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2322 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 2144,2155 ****
  fi
  
  echo $ac_n "checking for size_t""... $ac_c" 1>&6
! echo "configure:2148: checking for size_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2153 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 2346,2357 ----
  fi
  
  echo $ac_n "checking for size_t""... $ac_c" 1>&6
! echo "configure:2350: checking for size_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2355 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 2177,2188 ****
  fi
  
  echo $ac_n "checking for off_t""... $ac_c" 1>&6
! echo "configure:2181: checking for off_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2186 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 2379,2390 ----
  fi
  
  echo $ac_n "checking for off_t""... $ac_c" 1>&6
! echo "configure:2383: checking for off_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2388 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 2210,2221 ****
  fi
  
  echo $ac_n "checking for mode_t""... $ac_c" 1>&6
! echo "configure:2214: checking for mode_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2219 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 2412,2423 ----
  fi
  
  echo $ac_n "checking for mode_t""... $ac_c" 1>&6
! echo "configure:2416: checking for mode_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2421 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 2244,2250 ****
  
  
  echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
! echo "configure:2248: checking for main in -lnsl" >&5
  ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2446,2452 ----
  
  
  echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
! echo "configure:2450: checking for main in -lnsl" >&5
  ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2252,2265 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lnsl  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2256 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2454,2467 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lnsl  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2458 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2287,2293 ****
  fi
  
  echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
! echo "configure:2291: checking for main in -lsocket" >&5
  ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2489,2495 ----
  fi
  
  echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
! echo "configure:2493: checking for main in -lsocket" >&5
  ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2295,2308 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lsocket  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2299 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2497,2510 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lsocket  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2501 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2330,2336 ****
  fi
  
  echo $ac_n "checking for main in -lgnumalloc""... $ac_c" 1>&6
! echo "configure:2334: checking for main in -lgnumalloc" >&5
  ac_lib_var=`echo gnumalloc'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2532,2538 ----
  fi
  
  echo $ac_n "checking for main in -lgnumalloc""... $ac_c" 1>&6
! echo "configure:2536: checking for main in -lgnumalloc" >&5
  ac_lib_var=`echo gnumalloc'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2338,2351 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lgnumalloc  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2342 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2540,2553 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lgnumalloc  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2544 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2382,2388 ****
  			;;
  		*)
  			echo $ac_n "checking for main in -lmalloc""... $ac_c" 1>&6
! echo "configure:2386: checking for main in -lmalloc" >&5
  ac_lib_var=`echo malloc'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2584,2590 ----
  			;;
  		*)
  			echo $ac_n "checking for main in -lmalloc""... $ac_c" 1>&6
! echo "configure:2588: checking for main in -lmalloc" >&5
  ac_lib_var=`echo malloc'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2390,2403 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lmalloc  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2394 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2592,2605 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lmalloc  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2596 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2428,2434 ****
  	esac
  fi
  echo $ac_n "checking for main in -lbsd""... $ac_c" 1>&6
! echo "configure:2432: checking for main in -lbsd" >&5
  ac_lib_var=`echo bsd'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2630,2636 ----
  	esac
  fi
  echo $ac_n "checking for main in -lbsd""... $ac_c" 1>&6
! echo "configure:2634: checking for main in -lbsd" >&5
  ac_lib_var=`echo bsd'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2436,2449 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lbsd  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2440 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2638,2651 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lbsd  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2642 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2471,2477 ****
  fi
  
  echo $ac_n "checking for main in -lregex""... $ac_c" 1>&6
! echo "configure:2475: checking for main in -lregex" >&5
  ac_lib_var=`echo regex'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2673,2679 ----
  fi
  
  echo $ac_n "checking for main in -lregex""... $ac_c" 1>&6
! echo "configure:2677: checking for main in -lregex" >&5
  ac_lib_var=`echo regex'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2479,2492 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lregex  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2483 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2681,2694 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lregex  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2685 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2507,2513 ****
  fi
  
  echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6
! echo "configure:2511: checking for inet_aton in -lresolv" >&5
  ac_lib_var=`echo resolv'_'inet_aton | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2709,2715 ----
  fi
  
  echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6
! echo "configure:2713: checking for inet_aton in -lresolv" >&5
  ac_lib_var=`echo resolv'_'inet_aton | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2515,2521 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lresolv  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2519 "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
--- 2717,2723 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lresolv  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2721 "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
***************
*** 2526,2532 ****
  inet_aton()
  ; return 0; }
  EOF
! if { (eval echo configure:2530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2728,2734 ----
  inet_aton()
  ; return 0; }
  EOF
! if { (eval echo configure:2732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2542,2548 ****
  if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
    echo "$ac_t""yes" 1>&6
    echo $ac_n "checking for inet_aton in -l44bsd""... $ac_c" 1>&6
! echo "configure:2546: checking for inet_aton in -l44bsd" >&5
  ac_lib_var=`echo 44bsd'_'inet_aton | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2744,2750 ----
  if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
    echo "$ac_t""yes" 1>&6
    echo $ac_n "checking for inet_aton in -l44bsd""... $ac_c" 1>&6
! echo "configure:2748: checking for inet_aton in -l44bsd" >&5
  ac_lib_var=`echo 44bsd'_'inet_aton | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2550,2556 ****
    ac_save_LIBS="$LIBS"
  LIBS="-l44bsd  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2554 "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
--- 2752,2758 ----
    ac_save_LIBS="$LIBS"
  LIBS="-l44bsd  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2756 "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
***************
*** 2561,2567 ****
  inet_aton()
  ; return 0; }
  EOF
! if { (eval echo configure:2565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2763,2769 ----
  inet_aton()
  ; return 0; }
  EOF
! if { (eval echo configure:2767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2593,2599 ****
  fi
  
  echo $ac_n "checking for main in -lresolv""... $ac_c" 1>&6
! echo "configure:2597: checking for main in -lresolv" >&5
  ac_lib_var=`echo resolv'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2795,2801 ----
  fi
  
  echo $ac_n "checking for main in -lresolv""... $ac_c" 1>&6
! echo "configure:2799: checking for main in -lresolv" >&5
  ac_lib_var=`echo resolv'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2601,2614 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lresolv  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2605 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2803,2816 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lresolv  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2807 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2636,2642 ****
  fi
  
  echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
! echo "configure:2640: checking for main in -lm" >&5
  ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2838,2844 ----
  fi
  
  echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
! echo "configure:2842: checking for main in -lm" >&5
  ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2644,2657 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lm  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2648 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2846,2859 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lm  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2850 "configure"
  #include "confdefs.h"
  
  int main() {
  main()
  ; return 0; }
  EOF
! if { (eval echo configure:2857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2680,2686 ****
  
  
  echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
! echo "configure:2684: checking for crypt in -lcrypt" >&5
  ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2882,2888 ----
  
  
  echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
! echo "configure:2886: checking for crypt in -lcrypt" >&5
  ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2688,2694 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lcrypt  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2692 "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
--- 2890,2896 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lcrypt  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2894 "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
***************
*** 2699,2705 ****
  crypt()
  ; return 0; }
  EOF
! if { (eval echo configure:2703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2901,2907 ----
  crypt()
  ; return 0; }
  EOF
! if { (eval echo configure:2905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2800,2811 ****
  
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:2804: 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 2809 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
--- 3002,3013 ----
  
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:3006: 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 3011 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
***************
*** 2828,2834 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:2832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
--- 3030,3036 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:3034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
***************
*** 2854,2860 ****
  
  
  echo $ac_n "checking if setresuid is implemented""... $ac_c" 1>&6
! echo "configure:2858: checking if setresuid is implemented" >&5
  if eval "test \"`echo '$''{'ac_cv_func_setresuid'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 3056,3062 ----
  
  
  echo $ac_n "checking if setresuid is implemented""... $ac_c" 1>&6
! echo "configure:3060: checking if setresuid is implemented" >&5
  if eval "test \"`echo '$''{'ac_cv_func_setresuid'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 2862,2868 ****
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 2866 "configure"
  #include "confdefs.h"
  
  #include <stdlib.h>
--- 3064,3070 ----
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 3068 "configure"
  #include "confdefs.h"
  
  #include <stdlib.h>
***************
*** 2875,2881 ****
    }
    
  EOF
! if { (eval echo configure:2879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    ac_cv_func_setresuid="yes"
  else
--- 3077,3083 ----
    }
    
  EOF
! if { (eval echo configure:3081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    ac_cv_func_setresuid="yes"
  else
***************
*** 2899,2905 ****
  fi
  
  echo $ac_n "checking if GNUregex needs to be compiled""... $ac_c" 1>&6
! echo "configure:2903: checking if GNUregex needs to be compiled" >&5
  if test "$ac_cv_func_regcomp" = "no" ; then
  	USE_GNUREGEX="yes"
  else
--- 3101,3107 ----
  fi
  
  echo $ac_n "checking if GNUregex needs to be compiled""... $ac_c" 1>&6
! echo "configure:3105: checking if GNUregex needs to be compiled" >&5
  if test "$ac_cv_func_regcomp" = "no" ; then
  	USE_GNUREGEX="yes"
  else
***************
*** 2931,2942 ****
  
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:2935: 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 2940 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
--- 3133,3144 ----
  
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:3137: 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 3142 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
***************
*** 2959,2965 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:2963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
--- 3161,3167 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:3165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
***************
*** 2987,2998 ****
  
  
  echo $ac_n "checking Default FD_SETSIZE value""... $ac_c" 1>&6
! echo "configure:2991: checking Default FD_SETSIZE value" >&5
  if test "$cross_compiling" = yes; then
    DEFAULT_FD_SETSIZE=256
  else
    cat > conftest.$ac_ext <<EOF
! #line 2996 "configure"
  #include "confdefs.h"
  
  #if HAVE_STDIO_H
--- 3189,3200 ----
  
  
  echo $ac_n "checking Default FD_SETSIZE value""... $ac_c" 1>&6
! echo "configure:3193: checking Default FD_SETSIZE value" >&5
  if test "$cross_compiling" = yes; then
    DEFAULT_FD_SETSIZE=256
  else
    cat > conftest.$ac_ext <<EOF
! #line 3198 "configure"
  #include "confdefs.h"
  
  #if HAVE_STDIO_H
***************
*** 3016,3022 ****
  }
  
  EOF
! if { (eval echo configure:3020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    DEFAULT_FD_SETSIZE=`cat conftestval`
  else
--- 3218,3224 ----
  }
  
  EOF
! if { (eval echo configure:3222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    DEFAULT_FD_SETSIZE=`cat conftestval`
  else
***************
*** 3035,3046 ****
  
  
  echo $ac_n "checking Maximum number of filedescriptors we can open""... $ac_c" 1>&6
! echo "configure:3039: checking Maximum number of filedescriptors we can open" >&5
  if test "$cross_compiling" = yes; then
    SQUID_MAXFD=256
  else
    cat > conftest.$ac_ext <<EOF
! #line 3044 "configure"
  #include "confdefs.h"
  
  #include <stdio.h>
--- 3237,3248 ----
  
  
  echo $ac_n "checking Maximum number of filedescriptors we can open""... $ac_c" 1>&6
! echo "configure:3241: checking Maximum number of filedescriptors we can open" >&5
  if test "$cross_compiling" = yes; then
    SQUID_MAXFD=256
  else
    cat > conftest.$ac_ext <<EOF
! #line 3246 "configure"
  #include "confdefs.h"
  
  #include <stdio.h>
***************
*** 3092,3098 ****
  }
  
  EOF
! if { (eval echo configure:3096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    SQUID_MAXFD=`cat conftestval`
  else
--- 3294,3300 ----
  }
  
  EOF
! if { (eval echo configure:3298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    SQUID_MAXFD=`cat conftestval`
  else
***************
*** 3111,3122 ****
  
  
  echo $ac_n "checking Default UDP send buffer size""... $ac_c" 1>&6
! echo "configure:3115: checking Default UDP send buffer size" >&5
  if test "$cross_compiling" = yes; then
    SQUID_UDP_SO_SNDBUF=16384
  else
    cat > conftest.$ac_ext <<EOF
! #line 3120 "configure"
  #include "confdefs.h"
  
  #include <stdlib.h>
--- 3313,3324 ----
  
  
  echo $ac_n "checking Default UDP send buffer size""... $ac_c" 1>&6
! echo "configure:3317: checking Default UDP send buffer size" >&5
  if test "$cross_compiling" = yes; then
    SQUID_UDP_SO_SNDBUF=16384
  else
    cat > conftest.$ac_ext <<EOF
! #line 3322 "configure"
  #include "confdefs.h"
  
  #include <stdlib.h>
***************
*** 3135,3141 ****
  }
  
  EOF
! if { (eval echo configure:3139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    SQUID_UDP_SO_SNDBUF=`cat conftestval`
  else
--- 3337,3343 ----
  }
  
  EOF
! if { (eval echo configure:3341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    SQUID_UDP_SO_SNDBUF=`cat conftestval`
  else
***************
*** 3154,3165 ****
  
  
  echo $ac_n "checking Default UDP receive buffer size""... $ac_c" 1>&6
! echo "configure:3158: checking Default UDP receive buffer size" >&5
  if test "$cross_compiling" = yes; then
    SQUID_UDP_SO_RCVBUF=16384
  else
    cat > conftest.$ac_ext <<EOF
! #line 3163 "configure"
  #include "confdefs.h"
  
  #include <stdlib.h>
--- 3356,3367 ----
  
  
  echo $ac_n "checking Default UDP receive buffer size""... $ac_c" 1>&6
! echo "configure:3360: checking Default UDP receive buffer size" >&5
  if test "$cross_compiling" = yes; then
    SQUID_UDP_SO_RCVBUF=16384
  else
    cat > conftest.$ac_ext <<EOF
! #line 3365 "configure"
  #include "confdefs.h"
  
  #include <stdlib.h>
***************
*** 3178,3184 ****
  }
  
  EOF
! if { (eval echo configure:3182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    SQUID_UDP_SO_RCVBUF=`cat conftestval`
  else
--- 3380,3386 ----
  }
  
  EOF
! if { (eval echo configure:3384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    SQUID_UDP_SO_RCVBUF=`cat conftestval`
  else
***************
*** 3197,3208 ****
  
  
  echo $ac_n "checking Default TCP send buffer size""... $ac_c" 1>&6
! echo "configure:3201: checking Default TCP send buffer size" >&5
  if test "$cross_compiling" = yes; then
    SQUID_TCP_SO_SNDBUF=16384
  else
    cat > conftest.$ac_ext <<EOF
! #line 3206 "configure"
  #include "confdefs.h"
  
  #include <stdlib.h>
--- 3399,3410 ----
  
  
  echo $ac_n "checking Default TCP send buffer size""... $ac_c" 1>&6
! echo "configure:3403: checking Default TCP send buffer size" >&5
  if test "$cross_compiling" = yes; then
    SQUID_TCP_SO_SNDBUF=16384
  else
    cat > conftest.$ac_ext <<EOF
! #line 3408 "configure"
  #include "confdefs.h"
  
  #include <stdlib.h>
***************
*** 3221,3227 ****
  }
  
  EOF
! if { (eval echo configure:3225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    SQUID_TCP_SO_SNDBUF=`cat conftestval`
  else
--- 3423,3429 ----
  }
  
  EOF
! if { (eval echo configure:3427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    SQUID_TCP_SO_SNDBUF=`cat conftestval`
  else
***************
*** 3240,3251 ****
  
  
  echo $ac_n "checking Default TCP receive buffer size""... $ac_c" 1>&6
! echo "configure:3244: checking Default TCP receive buffer size" >&5
  if test "$cross_compiling" = yes; then
    SQUID_TCP_SO_RCVBUF=16384
  else
    cat > conftest.$ac_ext <<EOF
! #line 3249 "configure"
  #include "confdefs.h"
  
  #include <stdlib.h>
--- 3442,3453 ----
  
  
  echo $ac_n "checking Default TCP receive buffer size""... $ac_c" 1>&6
! echo "configure:3446: checking Default TCP receive buffer size" >&5
  if test "$cross_compiling" = yes; then
    SQUID_TCP_SO_RCVBUF=16384
  else
    cat > conftest.$ac_ext <<EOF
! #line 3451 "configure"
  #include "confdefs.h"
  
  #include <stdlib.h>
***************
*** 3264,3270 ****
  }
  
  EOF
! if { (eval echo configure:3268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    SQUID_TCP_SO_RCVBUF=`cat conftestval`
  else
--- 3466,3472 ----
  }
  
  EOF
! if { (eval echo configure:3470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
    SQUID_TCP_SO_RCVBUF=`cat conftestval`
  else
***************
*** 3283,3298 ****
  
  
  echo $ac_n "checking if sys_errlist is already defined""... $ac_c" 1>&6
! echo "configure:3287: checking if sys_errlist is already defined" >&5
  cat > conftest.$ac_ext <<EOF
! #line 3289 "configure"
  #include "confdefs.h"
  #include <stdio.h>
  int main() {
  char *s = sys_errlist[0];
  ; return 0; }
  EOF
! if { (eval echo configure:3296: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    echo "$ac_t""yes" 1>&6
  else
--- 3485,3500 ----
  
  
  echo $ac_n "checking if sys_errlist is already defined""... $ac_c" 1>&6
! echo "configure:3489: checking if sys_errlist is already defined" >&5
  cat > conftest.$ac_ext <<EOF
! #line 3491 "configure"
  #include "confdefs.h"
  #include <stdio.h>
  int main() {
  char *s = sys_errlist[0];
  ; return 0; }
  EOF
! if { (eval echo configure:3498: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    echo "$ac_t""yes" 1>&6
  else
***************
*** 3308,3323 ****
  rm -f conftest*
  
  echo $ac_n "checking for libresolv _dns_ttl_ hack""... $ac_c" 1>&6
! echo "configure:3312: checking for libresolv _dns_ttl_ hack" >&5
  cat > conftest.$ac_ext <<EOF
! #line 3314 "configure"
  #include "confdefs.h"
  extern int _dns_ttl_;
  int main() {
  return _dns_ttl_;
  ; return 0; }
  EOF
! if { (eval echo configure:3321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    echo "$ac_t""yes" 1>&6
  cat >> confdefs.h <<\EOF
--- 3510,3525 ----
  rm -f conftest*
  
  echo $ac_n "checking for libresolv _dns_ttl_ hack""... $ac_c" 1>&6
! echo "configure:3514: checking for libresolv _dns_ttl_ hack" >&5
  cat > conftest.$ac_ext <<EOF
! #line 3516 "configure"
  #include "confdefs.h"
  extern int _dns_ttl_;
  int main() {
  return _dns_ttl_;
  ; return 0; }
  EOF
! if { (eval echo configure:3523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
    echo "$ac_t""yes" 1>&6
  cat >> confdefs.h <<\EOF
Index: squid11/configure.in
diff -c squid11/configure.in:1.1.1.1 squid11/configure.in:1.2
*** squid11/configure.in:1.1.1.1	Tue Feb 16 18:03:45 1999
--- squid11/configure.in	Thu Feb 18 09:31:13 1999
***************
*** 101,106 ****
--- 101,232 ----
  
  dnl Check for programs
  AC_PROG_CPP
+ 
+ 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(INET6)
+        ipv6=yes
+        ;;
+   esac ],
+ 
+   AC_TRY_RUN([ /* AF_INET6 avalable check */
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ main()
+ {
+  if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
+    exit(1);
+  else
+    exit(0);
+ }
+ ],
+   AC_MSG_RESULT(yes)
+   AC_DEFINE(INET6)
+   ipv6=yes,
+   AC_MSG_RESULT(no)
+   ipv6=no,
+   AC_MSG_RESULT(no)
+   ipv6=no
+ ))
+ 
+ ipv6type=unknown
+ ipv6lib=none
+ 
+ if test "$ipv6" = "yes"; then
+ 	AC_MSG_CHECKING([ipv6 stack type])
+ 	for i in inria kame linux toshiba v6d zeta; do
+ 		case $i in
+ 		inria)
+ 			dnl http://www.kame.net/
+ 			AC_EGREP_CPP(yes, [dnl
+ #include <netinet/in.h>
+ #ifdef IPV6_INRIA_VERSION
+ yes
+ #endif],
+ 				[ipv6type=$i;
+ 				CFLAGS="-DINET6 $CFLAGS"])
+ 			;;
+ 		kame)
+ 			dnl http://www.kame.net/
+ 			AC_EGREP_CPP(yes, [dnl
+ #include <netinet/in.h>
+ #ifdef __KAME__
+ yes
+ #endif],
+ 				[ipv6type=$i;
+ 				ipv6lib=inet6;
+ 				ipv6libdir=/usr/local/v6/lib;
+ 				CFLAGS="-DINET6 $CFLAGS"])
+ 			;;
+ 		linux)
+ 			dnl http://www.v6.linux.or.jp/
+ 			if test -d /usr/inet6; then
+ 				ipv6type=$i
+ 				ipv6lib=inet6
+ 				ipv6libdir=/usr/inet6/lib
+ 				CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
+ 			fi
+ 			;;
+ 		toshiba)
+ 			AC_EGREP_CPP(yes, [dnl
+ #include <sys/param.h>
+ #ifdef _TOSHIBA_INET6
+ yes
+ #endif],
+ 				[ipv6type=$i;
+ 				ipv6lib=inet6;
+ 				ipv6libdir=/usr/local/v6/lib;
+ 				CFLAGS="-DINET6 $CFLAGS"])
+ 			;;
+ 		v6d)
+ 			AC_EGREP_CPP(yes, [dnl
+ #include </usr/local/v6/include/sys/v6config.h>
+ #ifdef __V6D__
+ yes
+ #endif],
+ 				[ipv6type=$i;
+ 				ipv6lib=v6;
+ 				ipv6libdir=/usr/local/v6/lib;
+ 				CFLAGS="-I/usr/local/v6/include $CFLAGS"])
+ 			;;
+ 		zeta)
+ 			AC_EGREP_CPP(yes, [dnl
+ #include <sys/param.h>
+ #ifdef _ZETA_MINAMI_INET6
+ yes
+ #endif],
+ 				[ipv6type=$i;
+ 				ipv6lib=inet6;
+ 				ipv6libdir=/usr/local/v6/lib;
+ 				CFLAGS="-DINET6 $CFLAGS"])
+ 			;;
+ 		esac
+ 		if test "$ipv6type" != "unknown"; then
+ 			break
+ 		fi
+ 	done
+ 	AC_MSG_RESULT($ipv6type)
+ 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"
+ 	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
+ 
  AC_PROG_INSTALL
  AC_PROG_RANLIB
  AC_PROG_LN_S
Index: squid11/include/util.h
diff -c squid11/include/util.h:1.1.1.1 squid11/include/util.h:1.2
*** squid11/include/util.h:1.1.1.1	Tue Feb 16 18:03:46 1999
--- squid11/include/util.h	Tue Feb 16 18:18:16 1999
***************
*** 155,159 ****
  
  typedef struct in_addr SIA;
  extern int safe_inet_addr _PARAMS((const char *, SIA *));
! 
  #endif /* ndef _UTIL_H_ */
--- 155,161 ----
  
  typedef struct in_addr SIA;
  extern int safe_inet_addr _PARAMS((const char *, SIA *));
! #ifdef INET6
! extern int safe_inet_sockaddr _PARAMS((const char*,struct sockaddr_storage*));
! #endif
  #endif /* ndef _UTIL_H_ */
Index: squid11/lib/safe_inet_addr.c
diff -c squid11/lib/safe_inet_addr.c:1.1.1.1 squid11/lib/safe_inet_addr.c:1.2
*** squid11/lib/safe_inet_addr.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/lib/safe_inet_addr.c	Tue Feb 16 18:18:18 1999
***************
*** 44,46 ****
--- 44,65 ----
  	addr->s_addr = A.s_addr;
      return 1;
  }
+ 
+ int safe_inet_sockaddr(const char *buf, struct sockaddr_storage *addr)
+ {
+     struct in6_addr inaddr6;
+     struct in_addr  inaddr4;
+ 
+     if (inet_pton(AF_INET6, buf, &inaddr6) != 0) {
+         struct sockaddr_in6 *saddr6p = (struct sockaddr_in6 *)addr;
+         saddr6p->sin6_family = AF_INET6;
+         saddr6p->sin6_addr   = inaddr6;
+         return 1;
+     } else if (inet_aton(buf,&inaddr4) != 0) {
+         struct sockaddr_in *saddr4p = (struct sockaddr_in *)addr;
+         saddr4p->sin_family = AF_INET;
+         saddr4p->sin_addr   = inaddr4;
+         return 1;
+     }
+     return 0;
+ }
Index: squid11/src/acl.c
diff -c squid11/src/acl.c:1.1.1.1 squid11/src/acl.c:1.3
*** squid11/src/acl.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/acl.c	Wed Feb 17 14:54:34 1999
***************
*** 1088,1094 ****
--- 1088,1106 ----
  	ia = ipcache_gethostbyname(r->host, IP_LOOKUP_IF_MISS);
  	if (ia) {
  	    for (k = 0; k < (int) ia->count; k++) {
+ #ifdef INET6
+ 	        if (ia->address[k].__ss_family == AF_INET6) {
+ 		    debug(1,0,"[SD]aclMatchAcl: IPv6 Code!!\n");
+ 	        } else if (ia->address[k].__ss_family == AF_INET) {
+ 		    struct sockaddr_in *saddr4p =
+ 		      (struct sockaddr_in *)&ia->address[k];
+ 		    checklist->dst_addr = saddr4p->sin_addr;
+ 		} else {
+ 		    debug(1,0,"[SD]aclMatchAcl: IPv6 Code!!\n");
+ 		}
+ #else
  		checklist->dst_addr = ia->in_addrs[k];
+ #endif
  		if (aclMatchIp(&acl->data, checklist->dst_addr))
  		    return 1;
  	    }
***************
*** 1105,1116 ****
--- 1117,1154 ----
      case ACL_DST_DOMAIN:
  	if ((ia = ipcacheCheckNumeric(r->host)) == NULL)
  	    return aclMatchDomainList(&acl->data, r->host);
+ #ifdef INET6
+ 	if (ia->address[0].__ss_family == AF_INET) {
+ 	    struct sockaddr_in *saddr4p=(struct sockaddr_in *)&ia->address[0];
+ 	    fqdn = fqdncache_gethostbyaddr(saddr4p->sin_addr,
+ 					   FQDN_LOOKUP_IF_MISS);
+ 	} else {
+ 	    debug(1,0,"[SD]aclMatchAcl: IPv6 Code(2)!!\n");
+ 	}
+ #else
  	fqdn = fqdncache_gethostbyaddr(ia->in_addrs[0], FQDN_LOOKUP_IF_MISS);
+ #endif
  	if (fqdn)
  	    return aclMatchDomainList(&acl->data, fqdn);
  	if (checklist->state[ACL_DST_DOMAIN] == ACL_LOOKUP_NONE) {
+ #ifdef INET6
+ 	    if (ia->address[0].__ss_family == AF_INET6) {
+ 	      struct sockaddr_in6 *saddr6p =
+ 		(struct sockaddr_in6 *)&ia->address[0];
+ 	      char vname[INET6_ADDRSTRLEN];
+ 	      inet_ntop(AF_INET6, &saddr6p->sin6_addr, vname, sizeof vname);
+ 	      debug(28,3,"aclMatchAcl: Can't yet compare '%s' ACL for '%s'\n",
+ 		    acl->name,vname);
+ 	    } else if (ia->address[0].__ss_family == AF_INET) {
+ 	      struct sockaddr_in *saddr4p =
+ 		(struct sockaddr_in *)&ia->address[0];
+ 	      debug(28,3,"aclMatchAcl: Can't yet compare '%s' ACL for '%s'\n",
+ 		    acl->name,inet_ntoa(saddr4p->sin_addr));
+ 	    }
+ #else
  	    debug(28, 3, "aclMatchAcl: Can't yet compare '%s' ACL for '%s'\n",
  		acl->name, inet_ntoa(ia->in_addrs[0]));
+ #endif
  	    checklist->state[ACL_DST_DOMAIN] = ACL_LOOKUP_NEED;
  	    return 0;
  	}
Index: squid11/src/cache_cf.c
diff -c squid11/src/cache_cf.c:1.1.1.1 squid11/src/cache_cf.c:1.2
*** squid11/src/cache_cf.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/cache_cf.c	Tue Feb 16 18:18:22 1999
***************
*** 196,201 ****
--- 196,204 ----
  #define DefaultTcpOutgoingAddr	no_addr.s_addr
  #define DefaultUdpIncomingAddr	INADDR_ANY
  #define DefaultUdpOutgoingAddr	no_addr.s_addr
+ #ifdef INET6
+ #define DefaultUdpOutgoingAddr6	no_addr6
+ #endif
  #define DefaultClientNetmask    0xFFFFFFFFul
  #define DefaultPassProxy	NULL
  #define DefaultSslProxy		NULL
***************
*** 228,233 ****
--- 231,239 ----
  
  static char fatal_str[BUFSIZ];
  static char *safe_xstrdup _PARAMS((const char *p));
+ #ifdef INET6
+ static int ip6_acl_match _PARAMS((struct in6_addr, const ip6_acl *));
+ #endif
  static int ip_acl_match _PARAMS((struct in_addr, const ip_acl *));
  static void addToIPACL _PARAMS((ip_acl **, const char *, ip_access_type));
  static void parseOnOff _PARAMS((int *));
***************
*** 281,287 ****
--- 287,318 ----
      fatal(fatal_str);
  }
  
+ #ifdef INET6
  static int
+ ip6_acl_match(struct in6_addr c, const ip6_acl* a)
+ {
+     static struct in6_addr h;
+     char vname1[INET6_ADDRSTRLEN];
+     char vname2[INET6_ADDRSTRLEN];
+ 
+     inet_ntop(AF_INET6,&c, vname1, sizeof vname1);
+     inet_ntop(AF_INET6,&a->mask6, vname2, sizeof vname2);
+ 
+     h.s6_addr32[0] = c.s6_addr32[0] & a->mask6.s6_addr32[0];
+     h.s6_addr32[1] = c.s6_addr32[1] & a->mask6.s6_addr32[1];
+     h.s6_addr32[2] = c.s6_addr32[2] & a->mask6.s6_addr32[2];
+     h.s6_addr32[3] = c.s6_addr32[3] & a->mask6.s6_addr32[3];
+     inet_ntop(AF_INET6,&h, vname1, sizeof vname1);
+     inet_ntop(AF_INET6,&a->addr6, vname2, sizeof vname2);
+ 
+     if (IN6_ARE_ADDR_EQUAL((&h),(&a->addr6))) {
+         return 1;
+     }
+ 
+     return 0;
+ }
+ #endif
+ static int
  ip_acl_match(struct in_addr c, const ip_acl * a)
  {
      static struct in_addr h;
***************
*** 305,310 ****
--- 336,365 ----
      *a = NULL;
  }
  
+ #ifdef INET6
+ ip_access_type
+ ip6_access_check(struct in6_addr address, const ip6_acl * list)
+ {
+     const ip6_acl *p = NULL;
+     struct in6_addr naddr;
+ 
+     if (!list)
+ 	return IP_ALLOW;
+ 
+     naddr = address;
+ 
+     if (IN6_ARE_ADDR_EQUAL((&naddr),(&local_addr6.sin6_addr)))
+ 	return IP_ALLOW;
+ 
+     /*debug(3, 5, "ip6_access_check: using %s\n", inet_ntoa(naddr));*/
+ 
+     for (p = list; p; p = p->next) {
+         if (ip6_acl_match(naddr, p))
+ 	    return p->access;
+     }
+     return IP_ALLOW;
+ }
+ #endif
  ip_access_type
  ip_access_check(struct in_addr address, const ip_acl * list)
  {
***************
*** 315,322 ****
--- 370,382 ----
  	return IP_ALLOW;
  
      naddr.s_addr = address.s_addr;
+ #ifdef INET6
+     if (naddr.s_addr == local_addr.sin_addr.s_addr)
+ 	return IP_ALLOW;
+ #else
      if (naddr.s_addr == local_addr.s_addr)
  	return IP_ALLOW;
+ #endif
  
      debug(3, 5, "ip_access_check: using %s\n", inet_ntoa(naddr));
  
***************
*** 327,333 ****
      return IP_ALLOW;
  }
  
- 
  static void
  addToIPACL(ip_acl ** list, const char *ip_str, ip_access_type access)
  {
--- 387,392 ----
***************
*** 408,413 ****
--- 467,549 ----
      q->mask.s_addr = lmask.s_addr;
  }
  
+ #ifdef INET6
+ static void
+ addToIPACL6(ip6_acl ** list, const char *ip_str, ip_access_type access)
+ {
+     ip6_acl *p, *q;
+     int mbits = 128;
+     char vname[INET6_ADDRSTRLEN];
+     struct in6_addr in6addr;
+     struct in6_addr lmask;
+     int inv = 0;
+     int i;
+ 
+     if (!ip_str) {
+ 	return;
+     }
+ 
+     if (!(*list)) {
+ 	/* empty list */
+ 	*list = xcalloc(1, sizeof(ip6_acl));
+ 	(*list)->next = NULL;
+ 	q = *list;
+     } else {
+ 	/* find end of list */
+ 	p = *list;
+ 	while (p->next)
+ 	    p = p->next;
+ 	q = xcalloc(1, sizeof(ip6_acl));
+ 	q->next = NULL;
+ 	p->next = q;
+     }
+ 
+     /* decode ip address */
+     if (*ip_str == '!') {
+ 	ip_str++;
+ 	inv = 1;
+     }
+ 
+     /* IPv6 address check */
+     if (!strcasecmp(ip_str, "all")) {
+ 	lmask = in6addr_any;
+ 	q->addr6 = in6addr_any;
+ 	q->mask6 = in6addr_any;
+ 	q->mbits = 128;
+ 	return;
+     } else if (sscanf(ip_str, "%[0-9a-f:]/%d", vname, &mbits) == 2) {
+       if (inet_pton(AF_INET6,vname,&in6addr) == 0) {
+ 	debug(1,0,"addToIPACL6: Not IPv6 address \"%s\".\n",ip_str);
+ 	return;
+       }
+       if (128 < mbits || mbits < 0)
+ 	return;
+     } else if (inet_pton(AF_INET6,ip_str,&in6addr)) {
+       mbits = 128;
+     } else {
+       debug(1,0,"addToIPACL6: Not IPv6 address \"%s\".\n",ip_str);
+       return;
+     }
+ 
+     inet_pton(AF_INET6,"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", &q->mask6);
+ 
+     if (mbits != 128) {
+       for (i =0; i < 16; i++) {
+ 	if (mbits < (i+1)*8) {
+ 	  q->mask6.s6_addr8[i] = 0xff - (0x01 << ((i+1)*8 - mbits)) + 1;
+ 	  break;
+ 	}
+       }
+       for (i++; i < 16; i++)
+ 	q->mask6.s6_addr8[i] = 0x00;
+     }
+ 	 
+     q->access = inv ? (access == IP_ALLOW ? IP_DENY : IP_ALLOW) : access;
+     q->addr6 = in6addr;
+     q->mbits = mbits;
+ }
+ #endif
+ 
  void
  wordlistDestroy(wordlist ** list)
  {
***************
*** 465,471 ****
  
  #define GetInteger(var) \
  	token = strtok(NULL, w_space); \
! 	if( token == NULL) \
  		self_destruct(); \
  	if (sscanf(token, "%d", &var) != 1) \
  		self_destruct();
--- 601,607 ----
  
  #define GetInteger(var) \
  	token = strtok(NULL, w_space); \
! 	if (token == NULL) \
  		self_destruct(); \
  	if (sscanf(token, "%d", &var) != 1) \
  		self_destruct();
***************
*** 776,781 ****
--- 912,928 ----
      }
  }
  
+ #ifdef INET6
+ static void
+ parseIPLine6(ip6_acl ** list)
+ {
+     char *token;
+     while ((token = strtok(NULL, w_space))) {
+ 	addToIPACL6(list, token, IP_DENY);
+     }
+ }
+ #endif
+ 
  static void
  parseWordlist(wordlist ** list)
  {
***************
*** 803,808 ****
--- 950,956 ----
      char *token;
      const struct hostent *hp;
      token = strtok(NULL, w_space);
+     debug(1, 0, "parseAddressLine: %s\n", token);
      if (token == NULL)
  	self_destruct();
      if (safe_inet_addr(token, addr) == 1)
***************
*** 945,950 ****
--- 1093,1109 ----
      int i;
      const struct hostent *hp;
      token = strtok(NULL, w_space);
+ #ifdef INET6
+     if (token == NULL)
+ 	self_destruct();
+     if (safe_inet_addr(token,
+ 		       &((struct sockaddr_in *)&Config.vizHack.addr)->sin_addr) == 1)
+ 	(void) 0;
+     else if ((hp = gethostbyname(token)))	/* dont use ipcache */
+ 	((struct sockaddr_in *)&Config.vizHack.addr)->sin_addr = inaddrFromHostent(hp);
+     else
+ 	self_destruct();
+ #else
      if (token == NULL)
  	self_destruct();
      if (safe_inet_addr(token, &Config.vizHack.addr) == 1)
***************
*** 953,958 ****
--- 1112,1118 ----
  	Config.vizHack.addr = inaddrFromHostent(hp);
      else
  	self_destruct();
+ #endif
      if ((token = strtok(NULL, w_space)) == NULL)
  	self_destruct();
      if (sscanf(token, "%d", &i) == 1)
***************
*** 1278,1289 ****
--- 1438,1473 ----
  	else if (!strcmp(token, "firewall_ip"))
  	    parseIPLine(&Config.firewall_ip_list);
  
+ #ifdef INET6
+ 	else if (!strcmp(token, "local_ip6"))
+ 	    parseIPLine6(&Config.local_ip6_list);
+ 
+ 	else if (!strcmp(token, "firewall_ip6"))
+ 	    parseIPLine6(&Config.firewall_ip6_list);
+ #endif
+ 
  	else if (!strcmp(token, "local_domain"))
  	    parseLocalDomainLine();
  
  	else if (!strcmp(token, "mcast_groups"))
  	    parseMcastGroupLine();
  
+ #ifdef INET6
+ 	else if (!strcmp(token, "tcp_incoming_address"))
+ 	    parseAddressLine(&Config.Addrs.tcp_incoming.sin_addr);
+ 
+ 	else if (!strcmp(token, "tcp_outgoing_address"))
+ 	    parseAddressLine(&Config.Addrs.tcp_outgoing.sin_addr);
+ 
+ 	else if (!strcmp(token, "udp_incoming_address"))
+ 	    parseAddressLine(&Config.Addrs.udp_incoming.sin_addr);
+ 
+ 	else if (!strcmp(token, "udp_outgoing_address"))
+ 	    parseAddressLine(&Config.Addrs.udp_outgoing.sin_addr);
+ 
+ 	else if (!strcmp(token, "client_netmask"))
+ 	    parseAddressLine(&Config.Addrs.client_netmask.sin_addr);
+ #else
  	else if (!strcmp(token, "tcp_incoming_address"))
  	    parseAddressLine(&Config.Addrs.tcp_incoming);
  
***************
*** 1298,1315 ****
  
  	else if (!strcmp(token, "client_netmask"))
  	    parseAddressLine(&Config.Addrs.client_netmask);
! 
  	else if (!strcmp(token, "tcp_recv_bufsize"))
  	    parseIntegerValue(&Config.tcpRcvBufsz);
  
  	else if (!strcmp(token, "log_fqdn"))
  	    parseOnOff(&Config.Log.log_fqdn);
  
  	else if (!strcmp(token, "bind_address"))
  	    parseAddressLine(&Config.Addrs.tcp_incoming);
  
  	else if (!strcmp(token, "outbound_address"))
  	    parseAddressLine(&Config.Addrs.tcp_outgoing);
  
  	else if (!strcmp(token, "http_port") || !strcmp(token, "ascii_port"))
  	    parseHttpPortLine();
--- 1482,1506 ----
  
  	else if (!strcmp(token, "client_netmask"))
  	    parseAddressLine(&Config.Addrs.client_netmask);
! #endif
  	else if (!strcmp(token, "tcp_recv_bufsize"))
  	    parseIntegerValue(&Config.tcpRcvBufsz);
  
  	else if (!strcmp(token, "log_fqdn"))
  	    parseOnOff(&Config.Log.log_fqdn);
+ #ifdef INET6
+ 	else if (!strcmp(token, "bind_address"))
+ 	    parseAddressLine(&Config.Addrs.tcp_incoming.sin_addr);
  
+ 	else if (!strcmp(token, "outbound_address"))
+ 	    parseAddressLine(&Config.Addrs.tcp_outgoing.sin_addr);
+ #else
  	else if (!strcmp(token, "bind_address"))
  	    parseAddressLine(&Config.Addrs.tcp_incoming);
  
  	else if (!strcmp(token, "outbound_address"))
  	    parseAddressLine(&Config.Addrs.tcp_outgoing);
+ #endif
  
  	else if (!strcmp(token, "http_port") || !strcmp(token, "ascii_port"))
  	    parseHttpPortLine();
***************
*** 1649,1659 ****
--- 1840,1870 ----
      Config.Announce.on = 0;
      Config.tcpRcvBufsz = DefaultTcpRcvBufsz;
      Config.udpMaxHitObjsz = DefaultUdpMaxHitObjsz;
+ #ifdef INET6
+     Config.Addrs.tcp_outgoing.sin_addr.s_addr = DefaultTcpOutgoingAddr;
+     Config.Addrs.tcp_outgoing.sin_family     =  AF_INET;
+     Config.Addrs.tcp_incoming.sin_addr.s_addr = DefaultTcpIncomingAddr;
+     Config.Addrs.tcp_incoming.sin_family     =  AF_INET;
+     Config.Addrs.udp_outgoing.sin_addr.s_addr = DefaultUdpOutgoingAddr;
+     Config.Addrs.udp_outgoing.sin_family     =  AF_INET;
+     Config.Addrs.udp_incoming.sin_addr.s_addr = DefaultUdpIncomingAddr;
+     Config.Addrs.udp_incoming.sin_family     =  AF_INET;
+     Config.Addrs.client_netmask.sin_addr.s_addr = DefaultClientNetmask;
+     Config.Addrs.client_netmask.sin_family   =  AF_INET;
+ 
+     Config.Addrs.tcp_incoming6.sin6_family   = AF_INET6;
+     Config.Addrs.udp_outgoing6.sin6_addr = DefaultUdpOutgoingAddr6;
+     Config.Addrs.tcp_outgoing6.sin6_family   = AF_INET6;
+     Config.Addrs.udp_incoming6.sin6_family   = AF_INET6;
+     Config.Addrs.udp_outgoing6.sin6_family   = AF_INET6;
+     Config.Addrs.client_netmask6.sin6_family = AF_INET6;
+ #else
      Config.Addrs.tcp_outgoing.s_addr = DefaultTcpOutgoingAddr;
      Config.Addrs.tcp_incoming.s_addr = DefaultTcpIncomingAddr;
      Config.Addrs.udp_outgoing.s_addr = DefaultUdpOutgoingAddr;
      Config.Addrs.udp_incoming.s_addr = DefaultUdpIncomingAddr;
      Config.Addrs.client_netmask.s_addr = DefaultClientNetmask;
+ #endif
      Config.passProxy = DefaultPassProxy;
      Config.sslProxy = DefaultSslProxy;
      Config.ipcache.size = DefaultIpcacheSize;
Index: squid11/src/cache_cf.h
diff -c squid11/src/cache_cf.h:1.1.1.1 squid11/src/cache_cf.h:1.2
*** squid11/src/cache_cf.h:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/cache_cf.h	Tue Feb 16 18:18:24 1999
***************
*** 130,135 ****
--- 130,144 ----
      IP_DENY
  } ip_access_type;
  
+ #ifdef INET6
+ typedef struct _ip6_acl {
+     struct in6_addr addr6;
+     struct in6_addr mask6;
+     int mbits;
+     ip_access_type access;
+     struct _ip6_acl *next;
+ } ip6_acl;
+ #endif
  typedef struct _ip_acl {
      struct in_addr addr;
      struct in_addr mask;
***************
*** 225,230 ****
--- 234,253 ----
  	int on;
  	u_short port;
      } Announce;
+ #ifdef INET6
+     struct {
+ 	struct sockaddr_in tcp_incoming;
+ 	struct sockaddr_in tcp_outgoing;
+ 	struct sockaddr_in udp_incoming;
+ 	struct sockaddr_in udp_outgoing;
+ 	struct sockaddr_in client_netmask;
+ 	struct sockaddr_in6 tcp_incoming6;
+ 	struct sockaddr_in6 tcp_outgoing6;
+ 	struct sockaddr_in6 udp_incoming6;
+ 	struct sockaddr_in6 udp_outgoing6;
+ 	struct sockaddr_in6 client_netmask6;
+     } Addrs;
+ #else
      struct {
  	struct in_addr tcp_incoming;
  	struct in_addr tcp_outgoing;
***************
*** 232,237 ****
--- 255,261 ----
  	struct in_addr udp_outgoing;
  	struct in_addr client_netmask;
      } Addrs;
+ #endif
      int tcpRcvBufsz;
      int udpMaxHitObjsz;
      wordlist *cache_dirs;
***************
*** 244,249 ****
--- 268,277 ----
      relist *cache_stop_relist;
      ip_acl *local_ip_list;
      ip_acl *firewall_ip_list;
+ #ifdef INET6
+     ip6_acl *local_ip6_list;
+     ip6_acl *firewall_ip6_list;
+ #endif
      peer *sslProxy, *passProxy;
      struct {
  	int size;
***************
*** 257,268 ****
--- 285,305 ----
  	int avgObjectSize;
  	int maxObjectSize;
      } Store;
+ #ifdef INET6
+     struct {
+ 	struct sockaddr_storage addr;
+ 	u_short port;
+ 	int mcast_ttl;
+ 	struct sockaddr_storage S;
+     } vizHack;
+ #else
      struct {
  	struct in_addr addr;
  	u_short port;
  	int mcast_ttl;
  	struct sockaddr_in S;
      } vizHack;
+ #endif
      int levelOneDirs;
      int levelTwoDirs;
      struct {
***************
*** 306,311 ****
--- 343,351 ----
  
  extern int parseConfigFile _PARAMS((const char *file_name));
  extern int setCacheSwapMax _PARAMS((int size));
+ #ifdef INET6
+ extern ip_access_type ip6_access_check _PARAMS((struct in6_addr, const ip6_acl *));
+ #endif
  extern ip_access_type ip_access_check _PARAMS((struct in_addr, const ip_acl *));
  extern void intlistDestroy _PARAMS((intlist **));
  extern void wordlistDestroy _PARAMS((wordlist **));
Index: squid11/src/client.c
diff -c squid11/src/client.c:1.1.1.1 squid11/src/client.c:1.2
*** squid11/src/client.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/client.c	Tue Feb 16 18:18:25 1999
***************
*** 112,124 ****
  
  /* Local functions */
  static int client_comm_connect _PARAMS((int sock, char *dest_host, u_short dest_port));
  static void usage _PARAMS((const char *progname));
  
  static void
  usage(const char *progname)
  {
      fprintf(stderr,
! 	"Usage: %s [-ars] [-i IMS] [-h host] [-p port] [-m method] [-t count] url\n"
  	"Options:\n"
  	"    -a         Do NOT include Accept: header.\n"
  	"    -r         Force cache to reload URL.\n"
--- 112,127 ----
  
  /* Local functions */
  static int client_comm_connect _PARAMS((int sock, char *dest_host, u_short dest_port));
+ #ifdef INET6
+ static int client_comm_connect6 _PARAMS((int sock, char *dest_host, u_short dest_port));
+ #endif
  static void usage _PARAMS((const char *progname));
  
  static void
  usage(const char *progname)
  {
      fprintf(stderr,
! 	"Usage: %s [-ars] [-i IMS] [-h host] [-p port] [-m method] [-t count] [-v prot] url\n"
  	"Options:\n"
  	"    -a         Do NOT include Accept: header.\n"
  	"    -r         Force cache to reload URL.\n"
***************
*** 127,133 ****
  	"    -h host    Retrieve URL from cache on hostname.  Default is localhost.\n"
  	"    -p port    Port number of cache.  Default is %d.\n"
  	"    -m method  Request method, default is GET.\n"
! 	"    -t count   Trace count cache-hops\n",
  	progname, CACHE_HTTP_PORT);
      exit(1);
  }
--- 130,137 ----
  	"    -h host    Retrieve URL from cache on hostname.  Default is localhost.\n"
  	"    -p port    Port number of cache.  Default is %d.\n"
  	"    -m method  Request method, default is GET.\n"
! 	"    -t count   Trace count cache-hops\n"
! 	"    -v prot    IPv4 or IPv6.(default 4)\n",
  	progname, CACHE_HTTP_PORT);
      exit(1);
  }
***************
*** 143,162 ****
      extern char *optarg;
      time_t ims = 0;
      int max_forwards = -1;
  
      /* set the defaults */
      strcpy(hostname, "localhost");
      port = CACHE_HTTP_PORT;
      to_stdout = 1;
      reload = 0;
- 
      if (argc < 2) {
  	usage(argv[0]);		/* need URL */
      } else if (argc >= 2) {
  	strcpy(url, argv[argc - 1]);
  	if (url[0] == '-')
  	    usage(argv[0]);
! 	while ((c = getopt(argc, argv, "ah:i:m:p:rst:?")) != -1)
  	    switch (c) {
  	    case 'a':
  		opt_noaccept = 1;
--- 147,166 ----
      extern char *optarg;
      time_t ims = 0;
      int max_forwards = -1;
+     int inet6 = 0;
  
      /* set the defaults */
      strcpy(hostname, "localhost");
      port = CACHE_HTTP_PORT;
      to_stdout = 1;
      reload = 0;
      if (argc < 2) {
  	usage(argv[0]);		/* need URL */
      } else if (argc >= 2) {
  	strcpy(url, argv[argc - 1]);
  	if (url[0] == '-')
  	    usage(argv[0]);
! 	while ((c = getopt(argc, argv, "ah:i:m:p:rst:v:?")) != -1)
  	    switch (c) {
  	    case 'a':
  		opt_noaccept = 1;
***************
*** 186,191 ****
--- 190,199 ----
  		method = xstrdup("TRACE");
  		max_forwards = atoi(optarg);
  		break;
+ 	    case 'v':
+ 		if (atoi(optarg) == 6)
+ 		  inet6 = 1;
+ 		break;
  	    case '?':		/* usage */
  	    default:
  		usage(argv[0]);
***************
*** 193,198 ****
--- 201,245 ----
  	    }
      }
      /* Connect to the server */
+ #ifdef INET6
+     if (inet6) {
+       if ((conn = socket(PF_INET6, SOCK_STREAM, 0)) < 0) {
+ 	perror("client: socket");
+ 	exit(1);
+       }
+       if (client_comm_connect6(conn, hostname, port) < 0) {
+ 	if (errno == 0) {
+ 	  fprintf(stderr,
+ 		  "client: ERROR: Cannot connect to %s:%d: Host unknown.\n",
+ 		  hostname, port);
+ 	} else {
+ 	  char tbuf[BUFSIZ];
+ 	  sprintf(tbuf, "client: ERROR: Cannot connect to %s:%d",
+ 		  hostname, port);
+ 	  perror(tbuf);
+ 	}
+ 	exit(1);
+       }
+     } else {
+       if ((conn = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
+ 	perror("client: socket");
+ 	exit(1);
+       }
+       if (client_comm_connect(conn, hostname, port) < 0) {
+ 	if (errno == 0) {
+ 	  fprintf(stderr,
+ 		  "client: ERROR: Cannot connect to %s:%d: Host unknown.\n",
+ 		  hostname, port);
+ 	} else {
+ 	  char tbuf[BUFSIZ];
+ 	  sprintf(tbuf, "client: ERROR: Cannot connect to %s:%d",
+ 		  hostname, port);
+ 	  perror(tbuf);
+ 	}
+ 	exit(1);
+       }
+     }
+ #else    
      if ((conn = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
  	perror("client: socket");
  	exit(1);
***************
*** 208,213 ****
--- 255,262 ----
  	}
  	exit(1);
      }
+ #endif
+ 
      /* Build the HTTP request */
      sprintf(msg, "%s %s HTTP/1.0\r\n", method, url);
      if (reload) {
***************
*** 228,233 ****
--- 277,285 ----
      }
      sprintf(buf, "\r\n");
      strcat(msg, buf);
+     fprintf(stdout,"========================\n");
+     fprintf(stdout,"\"%s\"\n",msg);
+     fprintf(stdout,"========================\n");
  
      /* Send the HTTP request */
      bytesWritten = write(conn, msg, strlen(msg));
***************
*** 265,267 ****
--- 317,341 ----
      to_addr.sin_port = htons(dest_port);
      return connect(sock, (struct sockaddr *) &to_addr, sizeof(struct sockaddr_in));
  }
+ #ifdef INET6
+ static int
+ client_comm_connect6(int sock, char *dest_host, u_short dest_port)
+ {
+     const struct hostent *hp;
+     static struct sockaddr_in6 to_addr6;
+     char vname[INET6_ADDRSTRLEN];
+ 
+     /* Set up the destination socket address for message to send to. */
+     to_addr6.sin6_family = AF_INET6;
+ 
+     if ((hp = gethostbyname2(dest_host,AF_INET6)) == 0) {
+ 	return (-1);
+     }
+     xmemcpy(&to_addr6.sin6_addr, hp->h_addr, hp->h_length);
+ 
+     if (inet_ntop(AF_INET6, &to_addr6.sin6_addr, vname, sizeof vname) == 0)
+ 	return (-1);
+     to_addr6.sin6_port = htons(dest_port);
+     return connect(sock, (struct sockaddr *) &to_addr6, sizeof(struct sockaddr_in6));
+ }
+ #endif
Index: squid11/src/client_db.c
diff -c squid11/src/client_db.c:1.1.1.1 squid11/src/client_db.c:1.4
*** squid11/src/client_db.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/client_db.c	Thu Feb 18 02:04:41 1999
***************
*** 34,40 ****
--- 34,44 ----
  typedef struct _client_info {
      char *key;
      struct client_info *next;
+ #ifdef INET6
+     struct sockaddr_storage addr;
+ #else
      struct in_addr addr;
+ #endif
      struct {
  	int result_hist[ERR_MAX];
  	int n_requests;
***************
*** 50,55 ****
--- 54,82 ----
  
  static HashID client_table = 0;
  
+ #ifdef INET6
+ static ClientInfo *clientdbAdd _PARAMS((struct sockaddr* address));
+ 
+ static ClientInfo *
+ clientdbAdd(struct sockaddr* address)
+ {
+     ClientInfo *c;
+     char vname[INET6_ADDRSTRLEN];
+ 
+     c = xcalloc(1, sizeof(ClientInfo));
+     if (address->sa_family == AF_INET6) {
+       inet_pton(AF_INET6,vname,&((struct sockaddr_in6 *)address)->sin6_addr);
+       c->key = xcalloc(0,INET6_ADDRSTRLEN);
+       strcpy(c->key,vname);
+     } else {
+       c->key = xstrdup(inet_ntoa(((struct sockaddr_in *)address)->sin_addr));
+     }
+     c->addr = *(struct sockaddr_storage *)address;
+     hash_join(client_table, (hash_link *) c);
+     meta_data.client_info++;
+     return c;
+ }
+ #else
  static ClientInfo *clientdbAdd _PARAMS((struct in_addr addr));
  
  static ClientInfo *
***************
*** 63,68 ****
--- 90,96 ----
      meta_data.client_info++;
      return c;
  }
+ #endif
  
  void
  clientdbInit(void)
***************
*** 75,80 ****
--- 103,141 ----
      client_info_sz = sizeof(ClientInfo);
  }
  
+ #ifdef INET6
+ void
+ clientdbUpdate(struct sockaddr *address,
+ 	       log_type log_type, u_short port)
+ {
+     char *key;
+     ClientInfo *c;
+     char vname[INET6_ADDRSTRLEN];
+ 
+     if (!Config.Options.client_db)
+ 	return;
+     if (address->sa_family == AF_INET6) {
+         inet_ntop(AF_INET6,&((struct sockaddr_in6 *)address)->sin6_addr,
+ 		  vname,sizeof(vname));
+ 	c = (ClientInfo *) hash_lookup(client_table, vname);
+     } else {
+         key = inet_ntoa(((struct sockaddr_in *)address)->sin_addr);      
+ 	c = (ClientInfo *) hash_lookup(client_table, key);
+     }
+ 
+     if (c == NULL)
+ 	c = clientdbAdd(address);
+     if (c == NULL)
+ 	debug_trap("clientdbUpdate: Failed to add entry");
+     if (port == Config.Port.http) {
+ 	c->Http.n_requests++;
+ 	c->Http.result_hist[log_type]++;
+     } else if (port == Config.Port.icp) {
+ 	c->Icp.n_requests++;
+ 	c->Icp.result_hist[log_type]++;
+     }
+ }
+ #else
  void
  clientdbUpdate(struct in_addr addr, log_type log_type, u_short port)
  {
***************
*** 96,103 ****
--- 157,216 ----
  	c->Icp.result_hist[log_type]++;
      }
  }
+ #endif /* INET6 */
  
  #define CUTOFF_SECONDS 3600
+ #ifdef INET6
+ int
+ clientdbCutoffDenied(struct sockaddr* address)
+ {
+     char *key;
+     int NR;
+     int ND;
+     double p;
+     ClientInfo *c;
+     char vname[INET6_ADDRSTRLEN];
+     if (!Config.Options.client_db)
+ 	return 0;
+ 
+     if (address->sa_family == AF_INET6) {
+         inet_ntop(AF_INET6,&((struct sockaddr_in6 *)address)->sin6_addr,
+ 		  vname,sizeof(vname));
+ 	key = xcalloc(0,INET6_ADDRSTRLEN);
+ 	strcpy(key,vname);
+     } else {
+         key = inet_ntoa(((struct sockaddr_in *)address)->sin_addr);      
+     }
+ 
+     c = (ClientInfo *) hash_lookup(client_table, key);
+     if (c == NULL)
+ 	return 0;
+     /*
+      * If we are in a cutoff window, we don't send a reply
+      */
+     if (squid_curtime - c->cutoff.time < CUTOFF_SECONDS)
+ 	return 1;
+     /*
+      * Calculate the percent of DENIED replies since the last
+      * cutoff time.
+      */
+     NR = c->Icp.n_requests - c->cutoff.n_req;
+     if (NR < 150)
+ 	NR = 150;
+     ND = c->Icp.result_hist[LOG_UDP_DENIED] - c->cutoff.n_denied;
+     p = 100.0 * ND / NR;
+     if (p < 95.0)
+ 	return 0;
+     debug(1, 0, "WARNING: Probable misconfigured neighbor at %s\n", key);
+     debug(1, 0, "WARNING: %d of the last %d ICP replies are DENIED\n", ND, NR);
+     debug(1, 0, "WARNING: No replies will be sent for the next %d seconds\n",
+ 	CUTOFF_SECONDS);
+     c->cutoff.time = squid_curtime;
+     c->cutoff.n_req = c->Icp.n_requests;
+     c->cutoff.n_denied = c->Icp.result_hist[LOG_UDP_DENIED];
+     return 1;
+ }
+ #else
  int
  clientdbCutoffDenied(struct in_addr addr)
  {
***************
*** 137,142 ****
--- 250,256 ----
      c->cutoff.n_denied = c->Icp.result_hist[LOG_UDP_DENIED];
      return 1;
  }
+ #endif
  
  void
  clientdbDump(StoreEntry * sentry)
***************
*** 147,153 ****
--- 261,271 ----
      c = (ClientInfo *) hash_first(client_table);
      while (c) {
  	storeAppendPrintf(sentry, "{Address: %s}\n", c->key);
+ #ifdef INET6
+ 	storeAppendPrintf(sentry, "{Name: %s}\n", fqdnFromAddr(&c->addr));
+ #else	
  	storeAppendPrintf(sentry, "{Name: %s}\n", fqdnFromAddr(c->addr));
+ #endif
  	storeAppendPrintf(sentry, "{    ICP Requests %d}\n",
  	    c->Icp.n_requests);
  	for (l = LOG_TAG_NONE; l < ERR_MAX; l++) {
Index: squid11/src/client_db.h
diff -c squid11/src/client_db.h:1.1.1.1 squid11/src/client_db.h:1.3
*** squid11/src/client_db.h:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/client_db.h	Thu Feb 18 02:04:43 1999
***************
*** 32,39 ****
--- 32,45 ----
  #define CLIENT_DB_H
  
  void clientdbInit _PARAMS((void));
+ #ifdef INET6
+ void clientdbUpdate _PARAMS((struct sockaddr* address,
+ 			     log_type, u_short port));
+ int clientdbCutoffDenied _PARAMS((struct sockaddr* address));
+ #else
  void clientdbUpdate _PARAMS((struct in_addr, log_type, u_short port));
  int clientdbCutoffDenied _PARAMS((struct in_addr));
+ #endif
  void clientdbDump _PARAMS((StoreEntry *));
  extern int client_info_sz;
  
Index: squid11/src/client_side.c
diff -c squid11/src/client_side.c:1.1.1.1 squid11/src/client_side.c:1.3
*** squid11/src/client_side.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/client_side.c	Wed Feb 17 14:54:36 1999
***************
*** 50,59 ****
--- 50,70 ----
  	icpState->url);
      icpState->aclChecklist->state[ACL_DST_IP] = ACL_LOOKUP_DONE;
      if (ia) {
+ #ifdef INET6
+         if (ia->address[0].__ss_family == AF_INET6) {
+ 	    debug(1,0,"[SD]clientLookupDstIPDone: IPv6 Code!!\n");
+ 	} else if (ia->address[0].__ss_family == AF_INET) {
+ 	    struct sockaddr_in *saddr4p=(struct sockaddr_in *)&ia->address[0];
+ 	    icpState->aclChecklist->dst_addr = saddr4p->sin_addr;
+ 	} else {
+ 	    debug(1,0,"[SD]clientLookupDstIPDone: Unknow Family\n");
+ 	}
+ #else
  	icpState->aclChecklist->dst_addr = ia->in_addrs[0];
  	debug(33, 5, "clientLookupDstIPDone: %s is %s\n",
  	    icpState->request->host,
  	    inet_ntoa(icpState->aclChecklist->dst_addr));
+ #endif
      }
      clientAccessCheck(icpState, icpState->aclHandler);
  }
***************
*** 153,159 ****
--- 164,175 ----
      }
      if (icpState->aclChecklist == NULL) {
  	icpState->aclChecklist = xcalloc(1, sizeof(aclCheck_t));
+ #ifdef INET6
+ 	icpState->aclChecklist->src_addr = 
+ 	  ((struct sockaddr_in *)&icpState->peer)->sin_addr;
+ #else
  	icpState->aclChecklist->src_addr = icpState->peer.sin_addr;
+ #endif
  	icpState->aclChecklist->request = requestLink(icpState->request);
  	browser = mime_get_header(icpState->request_hdr, "User-Agent");
  	if (browser != NULL) {
***************
*** 166,172 ****
--- 182,193 ----
  	    ICP_IDENT_SZ);
      }
      /* This so we can have SRC ACLs for cache_host_acl. */
+ #ifdef INET6
+     icpState->request->client_addr =
+       ((struct sockaddr_in *)&icpState->peer)->sin_addr;
+ #else
      icpState->request->client_addr = icpState->peer.sin_addr;
+ #endif
  #if USE_PROXY_AUTH
      if (clientProxyAuthCheck(icpState) == 0) {
  	char *wbuf = NULL;
***************
*** 200,218 ****
--- 221,261 ----
  	    return;
  	} else if (ch->state[ACL_SRC_DOMAIN] == ACL_LOOKUP_NEED) {
  	    ch->state[ACL_SRC_DOMAIN] = ACL_LOOKUP_PENDING;	/* first */
+ #ifdef INET6
+ 	    fqdncache_nbgethostbyaddr(((struct sockaddr_in *)&icpState->peer)->sin_addr,
+ 		icpState->fd,
+ 		clientLookupSrcFQDNDone,
+ 		icpState);
+ #else
  	    fqdncache_nbgethostbyaddr(icpState->peer.sin_addr,
  		icpState->fd,
  		clientLookupSrcFQDNDone,
  		icpState);
+ #endif
  	    return;
  	} else if (ch->state[ACL_DST_DOMAIN] == ACL_LOOKUP_NEED) {
  	    ch->state[ACL_DST_DOMAIN] = ACL_LOOKUP_PENDING;	/* first */
  	    ia = ipcacheCheckNumeric(icpState->request->host);
+ #ifdef INET6
+ 	    if (ia != NULL) {
+ 	        if (ia->address[0].__ss_family == AF_INET) {
+ 		    struct sockaddr_in *saddr4p
+ 		      =(struct sockaddr_in *)&ia->address[0];
+ 		    fqdncache_nbgethostbyaddr(saddr4p->sin_addr,
+ 					      icpState->fd,
+ 					      clientLookupDstFQDNDone,
+ 					      icpState);
+ 		} else {
+ 		    debug(1,0,"[SD]clientAccessCheck: IPv6 Code(2)!!\n");
+ 		}
+ 	    }
+ #else
  	    if (ia != NULL)
  		fqdncache_nbgethostbyaddr(ia->in_addrs[0],
  		    icpState->fd,
  		    clientLookupDstFQDNDone,
  		    icpState);
+ #endif
  	    return;
  	}
      }
Index: squid11/src/comm.c
diff -c squid11/src/comm.c:1.1.1.1 squid11/src/comm.c:1.4
*** squid11/src/comm.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/comm.c	Thu Feb 18 02:04:44 1999
***************
*** 112,117 ****
--- 112,118 ----
  /* Block processing new client requests (accepts on ascii port) when we start
   * running shy of free file descriptors.  For example, under SunOS, we'll keep
   * 64 file descriptors free for disk-i/o and connections to remote servers */
+ struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
  
  int RESERVED_FD = 64;
  
***************
*** 133,139 ****
--- 134,144 ----
  FD_ENTRY *fd_table = NULL;	/* also used in disk.c */
  
  /* STATIC */
+ #ifdef INET6
+ static int commBind _PARAMS((int s, struct sockaddr*, u_short port));
+ #else
  static int commBind _PARAMS((int s, struct in_addr, u_short port));
+ #endif
  static int comm_cleanup_fd_entry _PARAMS((int));
  #ifndef USE_POLL
  static int examine_select _PARAMS((fd_set *, fd_set *));
***************
*** 220,225 ****
--- 225,277 ----
      return fde->local_port;
  }
  
+ #ifdef INET6
+ static int
+ commBind(int s, struct sockaddr *ss, u_short port)
+ {
+     char vname[INET6_ADDRSTRLEN];
+ 
+     if (ss->sa_family == AF_INET6) {
+ 	struct sockaddr_in6 S6;
+ 	memset(&S6, '\0', sizeof(S6));
+ 	S6.sin6_family = AF_INET6;
+ 	S6.sin6_port = htons(port);
+ 	S6.sin6_addr = ((struct sockaddr_in6 *)ss)->sin6_addr;
+ 
+ 	inet_ntop(AF_INET6, &S6.sin6_addr, vname, sizeof vname);
+ 
+ 	if (bind(s, (struct sockaddr *) &S6, sizeof(S6)) == 0)
+ 		return COMM_OK;
+ 	if (IN6_ARE_ADDR_EQUAL((&S6.sin6_addr),(&in6addr_any))) {
+ 		debug(50,0,
+ 		      "commBind: Cannot IPv6 bind socket FD %d to %s:%d: %s\n",
+ 		      s, "*", (int) port, xstrerror());
+ 	} else {
+ 		inet_ntop(AF_INET6, &S6.sin6_addr, vname, sizeof vname);
+ 		debug(50,0,
+ 		      "commBind: Cannot IPv6 bind socket FD %d to %s:%d: %s\n",
+ 		      s, vname, (int) port, xstrerror());
+ 	}
+ 
+ 	return COMM_ERROR;
+     } else {
+ 	struct sockaddr_in S;
+ 	memset(&S, '\0', sizeof(S));
+ 	S.sin_family = AF_INET;
+ 	S.sin_port = htons(port);
+ 	S.sin_addr = ((struct sockaddr_in *)ss)->sin_addr;
+ 
+ 	if (bind(s, (struct sockaddr *) &S, sizeof(S)) == 0)
+ 		return COMM_OK;
+ 	debug(50, 0, "commBind: Cannot bind socket FD %d to %s:%d: %s\n",
+ 	      s,
+ 	      S.sin_addr.s_addr == INADDR_ANY ? "*" : inet_ntoa(S.sin_addr),
+ 	      (int) port,
+ 	      xstrerror());
+ 	return COMM_ERROR;
+     }
+ }
+ #else
  static int
  commBind(int s, struct in_addr in_addr, u_short port)
  {
***************
*** 229,234 ****
--- 281,287 ----
      S.sin_family = AF_INET;
      S.sin_port = htons(port);
      S.sin_addr = in_addr;
+ 
      if (bind(s, (struct sockaddr *) &S, sizeof(S)) == 0)
  	return COMM_OK;
      debug(50, 0, "commBind: Cannot bind socket FD %d to %s:%d: %s\n",
***************
*** 238,246 ****
--- 291,428 ----
  	xstrerror());
      return COMM_ERROR;
  }
+ #endif // INET6
  
  /* Create a socket. Default is blocking, stream (TCP) socket.  IO_TYPE
   * is OR of flags specified in comm.h. */
+ #ifdef INET6
+ int
+ comm_open(int sock_type,
+     int proto,
+     struct sockaddr *addr,
+     u_short port,
+     int flags,
+     const char *note)
+ {
+     int new_socket;
+     FD_ENTRY *conn = NULL;
+     int tcp_rcv_bufsz = Config.tcpRcvBufsz;
+     char vname[INET6_ADDRSTRLEN];
+     struct sockaddr_in6 *inaddr6 = (struct sockaddr_in6 *)addr;
+     struct sockaddr_in  *inaddr4 = (struct sockaddr_in *)addr;
+ 
+     /* Create socket for accepting new connections. */
+ 
+     if (inaddr6->sin6_family == AF_INET6) {
+       inet_ntop(AF_INET6, &inaddr6->sin6_addr, vname, sizeof vname);
+ 
+       if ((new_socket = socket(AF_INET6, sock_type, proto)) < 0) {
+       /* Increase the number of reserved fd's if calls to socket()
+        * are failing because the open file table is full.  This
+        * limits the number of simultaneous clients */
+         switch (errno) {
+ 	  case ENFILE:
+ 	  case EMFILE:
+ 	    debug(50, 1, "comm_open: socket failure: %s\n", xstrerror());
+ 	    Reserve_More_FDs();
+ 	    break;
+ 	  default:
+ 	    debug(50, 0, "comm_open: socket failure: %s\n", xstrerror());
+ 	}
+ 	return (COMM_ERROR);
+       }
+     } else if (inaddr4->sin_family == AF_INET) { 
+       if ((new_socket = socket(AF_INET, sock_type, proto)) < 0) {
+ 	/* Increase the number of reserved fd's if calls to socket()
+ 	 * are failing because the open file table is full.  This
+ 	 * limits the number of simultaneous clients */
+ 	switch (errno) {
+ 	  case ENFILE:
+ 	  case EMFILE:
+ 	    debug(50, 1, "comm_open: socket failure: %s\n", xstrerror());
+ 	    Reserve_More_FDs();
+ 	    break;
+ 	  default:
+ 	    debug(50, 0, "comm_open: socket failure: %s\n", xstrerror());
+ 	}
+ 	return (COMM_ERROR);
+       }
+     } else { /* Unknow family */ 
+ 	return (COMM_ERROR);
+     }
+ 
+     /* update fdstat */
+     fdstat_open(new_socket, FD_SOCKET);
+ 
+     conn = &fd_table[new_socket];
+     memset(conn, '\0', sizeof(FD_ENTRY));
+     if (note)
+ 	fd_note(new_socket, note);
+     conn->openned = 1;
+     conn->lifetime = -1;
+ 
+     if (!BIT_TEST(flags, COMM_NOCLOEXEC))
+ 	commSetCloseOnExec(new_socket);
+     if (port > (u_short) 0) {
+ 	commSetNoLinger(new_socket);
+ 	if (do_reuse)
+ 	    commSetReuseAddr(new_socket);
+     }
+ 
+     if (inaddr6->sin6_family == AF_INET6 &&
+ 	!IN6_ARE_ADDR_EQUAL((&inaddr6->sin6_addr),(&no_addr6))) {
+ 	if (commBind(new_socket, addr, port) != COMM_OK) {
+ #ifdef RETRY_PATCH
+ 	    fdstat_close(new_socket);
+ 	    memset(conn, '\0', sizeof(FD_ENTRY));
+ 	    conn->lifetime = -1;
+ 	    close(new_socket);
+ 	    return COMM_ERROR;
+ #else /* RETRY_PATCH */
+ 	    return COMM_ERROR;
+ #endif /* RETRY_PATCH */
+ 	}
+     } else if (inaddr4->sin_family == AF_INET && 
+ 	       inaddr4->sin_addr.s_addr != no_addr.s_addr) {
+ 	if (commBind(new_socket, addr, port) != COMM_OK) {
+ #ifdef RETRY_PATCH
+ 	    fdstat_close(new_socket);
+ 	    memset(conn, '\0', sizeof(FD_ENTRY));
+ 	    conn->lifetime = -1;
+ 	    close(new_socket);
+ 	    return COMM_ERROR;
+ #else /* RETRY_PATCH */
+ 	    return COMM_ERROR;
+ #endif /* RETRY_PATCH */
+ 	}
+     }
+ 
+     conn->local_port = port;
+ 
+     if (BIT_TEST(flags, COMM_NONBLOCKING))
+ 	if (commSetNonBlocking(new_socket) == COMM_ERROR)
+ #ifdef RETRY_PATCH
+ 	{
+ 	    fdstat_close(new_socket);
+ 	    memset(conn, '\0', sizeof(FD_ENTRY));
+ 	    conn->lifetime = -1;
+ 	    close(new_socket);
+ 	    return COMM_ERROR;
+ 	}
+ #else /* RETRY_PATCH */
+ 	    return COMM_ERROR;
+ #endif /* RETRY_PATCH */
+ 
+ #ifdef TCP_NODELAY
+     if (sock_type == SOCK_STREAM)
+ 	commSetTcpNoDelay(new_socket);
+ #endif
+     if (tcp_rcv_bufsz > 0 && sock_type == SOCK_STREAM)
+ 	commSetTcpRcvbuf(new_socket, tcp_rcv_bufsz);
+     conn->comm_type = sock_type;
+     return new_socket;
+ }
+ #else
  int
  comm_open(int sock_type,
      int proto,
***************
*** 324,330 ****
      conn->comm_type = sock_type;
      return new_socket;
  }
! 
     /*
      * NOTE: set the listen queue to Squid_MaxFD/4 and rely on the kernel to      
      * impose an upper limit.  Solaris' listen(3n) page says it has   
--- 506,512 ----
      conn->comm_type = sock_type;
      return new_socket;
  }
! #endif
     /*
      * NOTE: set the listen queue to Squid_MaxFD/4 and rely on the kernel to      
      * impose an upper limit.  Solaris' listen(3n) page says it has   
***************
*** 351,356 ****
--- 533,541 ----
  #ifdef RETRY_PATCH
      FD_ENTRY *conn = &fd_table[fd];
  #endif /* RETRY_PATCH */
+ #ifdef INET6
+     struct hostent *hp = NULL;
+ #endif
  
      ConnectStateData *cs = xcalloc(1, sizeof(ConnectStateData));
      cs->host = xstrdup(host);
***************
*** 364,369 ****
--- 549,579 ----
      cs->otimeout_delta = conn->timeout_delta;
  #endif /* RETRY_PATCH */
      comm_add_close_handler(fd, commConnectFree, cs);
+ #ifdef INET6
+     if ((hp = gethostbyname2(cs->host,AF_INET6)) == NULL) {
+         if ((hp = gethostbyname(cs->host)) == NULL) {
+ 	    debug(1,0,
+ 		  "[SD]commConnectStart: Unknow address %s.\n",cs->host);
+ 	}
+     }
+ 
+     if (hp->h_addrtype == AF_INET6) {
+        char vname[INET6_ADDRSTRLEN];
+        struct sockaddr_in6* inaddr6p = (struct sockaddr_in6 *)&cs->S;
+        inaddr6p->sin6_addr = *(struct in6_addr *)hp->h_addr_list[0];
+        inaddr6p->sin6_family = AF_INET6;
+        inaddr6p->sin6_port   = htons(port);
+        inet_ntop(AF_INET6, &inaddr6p->sin6_addr, vname, sizeof vname);
+     } else if (hp->h_addrtype == AF_INET) {
+        struct sockaddr_in* inaddr4p = (struct sockaddr_in *)&cs->S;
+        inaddr4p->sin_addr = *(struct in_addr *)hp->h_addr_list[0];
+        inaddr4p->sin_family = AF_INET;
+        inaddr4p->sin_port   = htons(port);
+     } else {
+         debug(1, 0, "[SD]commConnectStart: Unknow h_addrtype=%d.\n",
+ 	      hp->h_addrtype);
+     }
+ #endif
      commConnectHandle(fd, cs);
  }
  
***************
*** 381,392 ****
--- 591,608 ----
  commResetFd(int fd, ConnectStateData *cs)
  {
      int fd2;
+ #ifdef INET6
+     fd2 = comm_open(SOCK_STREAM, 0,
+ 		    (struct sockaddr *)&Config.Addrs.tcp_outgoing,
+ 		    0, COMM_NONBLOCKING, NULL);
+ #else
      fd2 = comm_open(SOCK_STREAM,
  			0,
  			Config.Addrs.tcp_outgoing,
  			0,
  			COMM_NONBLOCKING,
  			NULL);
+ #endif
      if (fd2 == COMM_ERROR) {
  	debug(50,0,"commResetFd: comm_open: %s\n", xstrerror());
  	return FALSE;
***************
*** 414,419 ****
--- 630,636 ----
      if (++connectState->tries == 4)
  	return 0;
      fd2 = socket(AF_INET, SOCK_STREAM, 0);
+ 
      if (fd2 < 0) {
  	debug(5, 0, "commRetryConnect: socket: %s\n", xstrerror());
  	return 0;
***************
*** 454,459 ****
--- 671,716 ----
  {
      ConnectStateData *connectState = data;
      const ipcache_addrs *ia = NULL;
+ #ifdef INET6
+     static struct sockaddr_storage ZS;
+     struct sockaddr_in6 *daddr6p = (struct sockaddr_in6 *)&connectState->S;
+     struct sockaddr_in  *daddr4p = (struct sockaddr_in *)&connectState->S;
+ 
+     if (memcmp(&connectState->S, &ZS, sizeof(struct sockaddr_storage)) == 0 ||
+ 	(daddr6p->sin6_family == AF_INET6 && 
+ 	 IN6_IS_ADDR_UNSPECIFIED((&daddr6p->sin6_addr))) ||
+ 	(daddr4p->sin_family == AF_INET6 && daddr4p->sin_addr.s_addr)) {
+ 	ia = ipcache_gethostbyname(connectState->host, IP_BLOCKING_LOOKUP);
+ 	if (ia == NULL) {
+ 	    debug(5, 3, "commConnectHandle: Unknown host: %s\n",
+ 		  connectState->host);
+ 	    connectState->callback(fd, COMM_ERROR, connectState->data);
+ 	    return;
+ 	}
+ 
+ 	if (ia->address[ia->cur].__ss_family == AF_INET6) {
+ 	    connectState->S = *(struct sockaddr_storage *)&ia->address[ia->cur];
+ 	    daddr6p->sin6_port = htons(connectState->port);
+ 	} else if (ia->address[ia->cur].__ss_family == AF_INET) {
+ 	    connectState->S = *(struct sockaddr_storage *)&ia->address[ia->cur];
+ 	    daddr4p->sin_port = htons(connectState->port);
+ 	} else {
+ 	    debug(1,0,"[SD]commConnectHandle: Unknow family=%d\n",
+ 		  ia->address[ia->cur].__ss_family);
+ 	}
+ #ifdef RETRY_PATCH
+ 	ipcacheCycleAddr(connectState->host);
+ #endif /* RETRY_PATCH */
+ #ifdef RETRY_PATCH
+ 	connectState->addrcount = ia->count;
+ 	connectState->connstart = getCurrentTime();
+ 	connectState->conntimeout = commBackoffTimeout(ia->count);
+ #endif /* RETRY_PATCH */
+ 	if (Config.Log.log_fqdn)
+ 	    debug(1, 0, "[SD]commConnectHandle: IPv6 Code(3)\n");
+ /*	    fqdncache_gethostbyaddr(connectState->S.sin_addr, FQDN_LOOKUP_IF_MISS);*/
+     }
+ #else
      if (connectState->S.sin_addr.s_addr == 0) {
  	ia = ipcache_gethostbyname(connectState->host, IP_BLOCKING_LOOKUP);
  	if (ia == NULL) {
***************
*** 478,483 ****
--- 735,741 ----
  	if (Config.Log.log_fqdn)
  	    fqdncache_gethostbyaddr(connectState->S.sin_addr, FQDN_LOOKUP_IF_MISS);
      }
+ #endif /* INET6 */
  #ifdef RETRY_PATCH
  
      /*
***************
*** 491,497 ****
  
      /* Try connection */
  #endif /* RETRY_PATCH */
!     switch (comm_connect_addr(fd, &connectState->S)) {
      case COMM_INPROGRESS:
  	commSetSelect(fd,
  	    COMM_SELECT_WRITE,
--- 749,755 ----
  
      /* Try connection */
  #endif /* RETRY_PATCH */
!     switch (comm_connect_addr(fd, (struct sockaddr *)&connectState->S)) {
      case COMM_INPROGRESS:
  	commSetSelect(fd,
  	    COMM_SELECT_WRITE,
***************
*** 501,509 ****
  	break;
      case COMM_OK:
  	if (vizSock > -1)
! 	    vizHackSendPkt(&connectState->S, 2);
  #ifdef RETRY_PATCH
  	ipcacheMarkGoodAddr(connectState->host, connectState->S.sin_addr);
  	if (connectState->tries > 0)
  	    if (safe_inet_addr(connectState->host, NULL)) /* numeric? */
  		debug(5,1,
--- 759,771 ----
  	break;
      case COMM_OK:
  	if (vizSock > -1)
! 	    vizHackSendPkt((struct sockaddr_in *)&connectState->S, 2);
  #ifdef RETRY_PATCH
+ #ifdef INET6
+ 	ipcacheMarkGoodAddr(connectState->host, (struct sockaddr *)&connectState->S);
+ #else
  	ipcacheMarkGoodAddr(connectState->host, connectState->S.sin_addr);
+ #endif
  	if (connectState->tries > 0)
  	    if (safe_inet_addr(connectState->host, NULL)) /* numeric? */
  		debug(5,1,
***************
*** 512,523 ****
  		    connectState->host,
  		    connectState->tries + 1);
  	    else
! 		debug(5,1,
  		    "commConnectHandle: FD %d %s[%s] conn succeeded (try %d)\n",
  		    fd,
  		    connectState->host,
  		    inet_ntoa(connectState->S.sin_addr),
! 		    connectState->tries + 1);
  
  	/* Restore timeout handler */
  	commSetSelect(fd,
--- 774,786 ----
  		    connectState->host,
  		    connectState->tries + 1);
  	    else
! 		debug(1, 0, "commConnectHandle: IPv6 Code!!\n");
! 		/*debug(5,1,
  		    "commConnectHandle: FD %d %s[%s] conn succeeded (try %d)\n",
  		    fd,
  		    connectState->host,
  		    inet_ntoa(connectState->S.sin_addr),
! 		    connectState->tries + 1);*/
  
  	/* Restore timeout handler */
  	commSetSelect(fd,
***************
*** 543,550 ****
--- 806,818 ----
  	    commConnectHandle(fd, connectState);
  	} else {
  	    ipcacheRemoveBadAddr(connectState->host, connectState->S.sin_addr);
+ #ifdef INET6
  	    if (Config.Options.test_reachability)
+ 		netdbDeleteAddrNetwork(&connectState->S);
+ #else
+ 	    if (Config.Options.test_reachability)
  		netdbDeleteAddrNetwork(connectState->S.sin_addr);
+ #endif
  	    connectState->callback(fd, COMM_ERROR, connectState->data);
  	}
  #endif /* RETRY_PATCH */
***************
*** 557,565 ****
  commConnectRetry(int fd, void *data)
  {
      ConnectStateData *connectState = data;
- 
      connectState->tries++;
      ipcacheMarkBadAddr(connectState->host, connectState->S.sin_addr);
      getCurrentTime();
  /* Retry single addr hosts three times, but only if the connect time
   * was smaller than half of the default connect timeout.  Timeouts
--- 825,836 ----
  commConnectRetry(int fd, void *data)
  {
      ConnectStateData *connectState = data;
      connectState->tries++;
+ #ifdef INET6
+     ipcacheMarkBadAddr(connectState->host, (struct sockaddr *)&connectState->S);
+ #else
      ipcacheMarkBadAddr(connectState->host, connectState->S.sin_addr);
+ #endif
      getCurrentTime();
  /* Retry single addr hosts three times, but only if the connect time
   * was smaller than half of the default connect timeout.  Timeouts
***************
*** 573,578 ****
--- 844,866 ----
  	commResetFd(fd, connectState);
  	if (connectState->addrcount == 1)  /* set min timeout for retry */
  	    connectState->conntimeout = commBackoffTimeout((unsigned char)100);
+ #ifdef INET6
+ 	if (safe_inet_addr(connectState->host, NULL))  /* numeric? */
+ 	    debug(5,2,"commConnectHandle: FD %d %s conn fail, retrying\n",
+ 		fd,
+ 	    connectState->host);
+ 	else
+ 	    debug(1, 0, "commConnectHandle: IPv6 Code!!\n");
+ 	    /*debug(5,2,
+ 		"commConnectHandle: FD %d %s[%s] conn fail, retrying\n",
+ 		fd,
+ 		connectState->host,
+ 		inet_ntoa(connectState->S.sin_addr));*/
+ 	/*connectState->S.sin_addr.s_addr = (long)0;*/
+ 	memset(&connectState->S, '\0', sizeof(struct sockaddr_storage));
+ 
+ 	    commConnectHandle(fd, connectState);
+ #else
  	if (safe_inet_addr(connectState->host, NULL))  /* numeric? */
  	    debug(5,2,"commConnectHandle: FD %d %s conn fail, retrying\n",
  		fd,
***************
*** 585,595 ****
  		inet_ntoa(connectState->S.sin_addr));
  	connectState->S.sin_addr.s_addr = (long)0;
  	    commConnectHandle(fd, connectState);
! 	} else {
! 	    if (Config.Options.test_reachability)
! 		netdbDeleteAddrNetwork(connectState->S.sin_addr);
! 	    connectState->callback(fd, COMM_ERROR, connectState->data);
! 	}
  }
  #endif /* RETRY_PATCH */
  
--- 873,890 ----
  		inet_ntoa(connectState->S.sin_addr));
  	connectState->S.sin_addr.s_addr = (long)0;
  	    commConnectHandle(fd, connectState);
! #endif /* INET6 */
!     } else {
! #ifdef INET6
!         if (Config.Options.test_reachability)
! 	    netdbDeleteAddrNetwork((struct sockaddr *)&connectState->S);
! 	connectState->callback(fd, COMM_ERROR, connectState->data);
! #else
!         if (Config.Options.test_reachability)
! 	    netdbDeleteAddrNetwork(connectState->S.sin_addr);
! 	connectState->callback(fd, COMM_ERROR, connectState->data);
! #endif
!     }
  }
  #endif /* RETRY_PATCH */
  
***************
*** 611,616 ****
--- 906,1047 ----
      return f->lifetime = (int) squid_curtime + lifetime;
  }
  
+ #ifdef INET6
+ int
+ comm_connect_addr(int sock, const struct sockaddr *address)
+ {
+     int status = COMM_OK;
+     FD_ENTRY *conn = &fd_table[sock];
+     int len;
+     int x;
+     int lft;
+     int cerrno;
+     char vname[INET6_ADDRSTRLEN];
+     struct sockaddr_in6* inaddr6p; 
+     struct sockaddr_in*  inaddr4p; 
+ 
+     if (address->sa_family == AF_INET6) {
+       inaddr6p = (struct sokcaddr_in6 *)address;
+       inet_ntop(AF_INET6, &inaddr6p->sin6_addr, vname, sizeof vname);
+ 
+       if (ntohs(inaddr6p->sin6_port) == 0) {
+ 	debug(5, 10, "comm_connect_addr: %s:%d: URL uses port 0?\n",
+ 	      vname, ntohs(inaddr6p->sin6_port));
+ 	errno = 0;
+ 	return COMM_ERROR;
+       }
+ 
+       if (connect(sock,(struct sockaddr *)inaddr6p/*address*/,
+ 		  sizeof(struct sockaddr_in6)) < 0) {
+ 	cerrno = errno;
+ 
+ 	switch (cerrno) {
+ #ifndef RETRY_PATCH
+ 	case EALREADY:
+ 	  return COMM_ERROR;
+ 	  /* NOTREACHED */
+ #endif /* RETRY_PATCH */
+ #if EAGAIN != EWOULDBLOCK
+ 	case EAGAIN:
+ #endif
+ 	case EWOULDBLOCK:
+ 	case EINPROGRESS:
+ #ifdef RETRY_PATCH
+ 	case EALREADY:
+ #endif /* RETRY_PATCH */
+ 	  status = COMM_INPROGRESS;
+ 	  break;
+ 	case EISCONN:
+ 	  status = COMM_OK;
+ 	  break;
+ 	case EINVAL:
+ 	  len = sizeof(x);
+ 	  if (getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *) &x, &len) >= 0)
+ 	    cerrno = x;
+ 	default:
+ 	  errno = cerrno;
+ 	  debug(50, 2, "connect: %s:%d: %s.\n",
+ 		fqdnFromAddr(address),
+ 		ntohs(inaddr6p->sin6_port),
+ 		xstrerror());
+ 	  return COMM_ERROR;
+ 	}
+       }
+ 
+       strcpy(conn->ipaddr, vname);
+       conn->remote_port = ntohs(inaddr6p->sin6_port);
+     } else if (address->sa_family == AF_INET) {
+       inaddr4p = (struct sokcaddr_in *)address;
+ 
+       /* sanity check */
+       if (ntohs(inaddr4p->sin_port) == 0) {
+ 	debug(5, 10, "comm_connect_addr: %s:%d: URL uses port 0?\n",
+ 	      inet_ntoa(inaddr4p->sin_addr), ntohs(inaddr4p->sin_port));
+ 	errno = 0;
+ 	return COMM_ERROR;
+       }
+       /* Establish connection. */
+ 
+       if (connect(sock, (struct sockaddr *)address,
+ 		  sizeof(struct sockaddr_in)) < 0) {
+ 	cerrno = errno;
+ 	switch (cerrno) {
+ #ifndef RETRY_PATCH
+ 	case EALREADY:
+ 	  return COMM_ERROR;
+ 	  /* NOTREACHED */
+ #endif /* RETRY_PATCH */
+ #if EAGAIN != EWOULDBLOCK
+ 	case EAGAIN:
+ #endif
+ 	case EWOULDBLOCK:
+ 	case EINPROGRESS:
+ #ifdef RETRY_PATCH
+ 	case EALREADY:
+ #endif /* RETRY_PATCH */
+ 	  status = COMM_INPROGRESS;
+ 	  break;
+ 	case EISCONN:
+ 	  status = COMM_OK;
+ 	  break;
+ 	case EINVAL:
+ 	  len = sizeof(x);
+ 	  if (getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *) &x, &len) >= 0)
+ 	    cerrno = x;
+ 	default:
+ 	  errno = cerrno;
+ 	  debug(50, 2, "connect: %s:%d: %s.\n",
+ 		fqdnFromAddr(address),
+ 		ntohs(inaddr4p->sin_port),
+ 		xstrerror());
+ 	  return COMM_ERROR;
+ 	}
+       }
+       strcpy(conn->ipaddr, inet_ntoa(inaddr4p->sin_addr));
+       conn->remote_port = ntohs(inaddr4p->sin_port);
+     } else {
+       debug(1, 0, "[SD]comm_connect_addr: Unknow family %d\n",
+ 	    address->sa_family); 
+     }
+ 
+ 
+     /* set the lifetime for this client */
+     if (status == COMM_OK) {
+ 	lft = comm_set_fd_lifetime(sock, Config.lifetimeDefault);
+ 	debug(5, 10, "comm_connect_addr: FD %d connected to %s:%d, lifetime %d.\n",
+ 	    sock, conn->ipaddr, conn->remote_port, lft);
+ #ifndef RETRY_PATCH
+     } else if (status == COMM_INPROGRESS) {
+ 	lft = comm_set_fd_lifetime(sock, Config.connectTimeout);
+ 	debug(5, 10, "comm_connect_addr: FD %d connection pending, lifetime %d\n",
+ 	    sock, lft);
+ #endif /* RETRY_PATCH */
+     }
+     /* Add new socket to list of open sockets. */
+     conn->sender = 1;
+     return status;
+ }
+ #else
  int
  comm_connect_addr(int sock, const struct sockaddr_in *address)
  {
***************
*** 629,634 ****
--- 1060,1066 ----
  	return COMM_ERROR;
      }
      /* Establish connection. */
+ 
      if (connect(sock, (struct sockaddr *) address, sizeof(struct sockaddr_in)) < 0) {
  	cerrno = errno;
  	switch (cerrno) {
***************
*** 681,686 ****
--- 1113,1119 ----
      conn->sender = 1;
      return status;
  }
+ #endif
  
  /* Wait for an incoming connection on FD.  FD should be a socket returned
   * from comm_listen. */
***************
*** 800,807 ****
--- 1233,1255 ----
  	    host, xstrerror());
  	return (COMM_ERROR);
      }
+ 
+ #ifdef INET6
+     if (ia->address[ia->cur].__ss_family == AF_INET6) {
+         debug(1, 0, "[SD]comm_udp_send: IPv6 Code!!\n");
+     } else if (ia->address[ia->cur].__ss_family == AF_INET) {
+         struct sockaddr_in *saddr4p
+ 	  = (struct sockaddr_in *)&ia->address[ia->cur];
+ 	to_addr.sin_addr = saddr4p->sin_addr;
+     } else {
+         debug(1, 0, "[SD]comm_udp_send: Unknow family=%d\n",
+ 	      ia->address[ia->cur].__ss_family);
+     }
+ #else
      to_addr.sin_addr = ia->in_addrs[ia->cur];
+ #endif
      to_addr.sin_port = htons(port);
+ 
      if ((bytes_sent = sendto(fd, buf, len, 0, (struct sockaddr *) &to_addr,
  		sizeof(to_addr))) < 0) {
  	debug(50, 1, "comm_udp_send: sendto failure: FD %d: %s\n",
***************
*** 812,817 ****
--- 1260,1306 ----
  }
  
  /* Send a udp datagram to specified TO_ADDR. */
+ #ifdef INET6
+ int
+ comm_udp_sendto(int fd,
+     const struct sockaddr *to_addr,
+     int addr_len,
+     const char *buf,
+     int len)
+ {
+     int x;
+     if (to_addr->sa_family == AF_INET6) {
+ 	char vname[INET6_ADDRSTRLEN];
+         struct sockaddr_in6 *inaddr6p = (struct sockaddr_in6 *)to_addr;
+ 	if (inet_ntop(AF_INET6,&inaddr6p->sin6_addr,vname,sizeof vname) == 0) {
+ 	    return COMM_ERROR;
+ 	}
+ 
+ 	x = sendto(fd,buf,len,0,(struct sockaddr *)to_addr, addr_len);
+ 
+ 	if (x < 0) {
+ 	    debug(50, 1, "comm_udp_sendto: FD %d, %s, port %d: %s\n",
+ 		  fd,vname,(int)htons(inaddr6p->sin6_port),xstrerror());
+ 	    return COMM_ERROR;
+ 	}
+     } else if (to_addr->sa_family == AF_INET) {
+         struct sockaddr_in *inaddr4p = (struct sockaddr_in *)to_addr;
+ 
+ 	x = sendto(fd, buf, len, 0, (struct sockaddr *)to_addr, addr_len);
+ 
+ 	if (x < 0) {
+ 	    debug(50, 1, "comm_udp_sendto: FD %d, %s, port %d: %s\n",fd,
+ 		  inet_ntoa(inaddr4p->sin_addr),
+ 		  (int)htons(inaddr4p->sin_port),xstrerror());
+ 	    return COMM_ERROR;
+ 	}
+     } else {
+ 	return COMM_ERROR;
+     }
+ 
+     return x;
+ }
+ #else
  int
  comm_udp_sendto(int fd,
      const struct sockaddr_in *to_addr,
***************
*** 820,825 ****
--- 1309,1315 ----
      int len)
  {
      int x;
+ 
      x = sendto(fd, buf, len, 0, (struct sockaddr *) to_addr, addr_len);
      if (x < 0) {
  	debug(50, 1, "comm_udp_sendto: FD %d, %s, port %d: %s\n",
***************
*** 831,836 ****
--- 1321,1327 ----
      }
      return x;
  }
+ #endif
  
  void
  comm_set_stall(int fd, int delta)
***************
*** 1407,1412 ****
--- 1898,1921 ----
  	    continue;
  	}
  	for (i = 0; i < (int) ia->count; i++) {
+ #ifdef INET6
+ 	    if (ia->address[i].__ss_family == AF_INET6) {
+ 	        debug(1, 0, "[SD]comm_join_mcast_groups: IPv6 Code!!\n");
+ 	    } else if (ia->address[i].__ss_family == AF_INET) {
+ 	        struct sockaddr_in *saddr4p
+ 		  = (struct sockaddr_in *)&ia->address[i];
+ 		mr.imr_multiaddr.s_addr = (saddr4p)->sin_addr.s_addr;
+ 	    } else {
+ 	      debug(1, 0, "[SD]comm_udp_send: Unknow family=%d\n",
+ 		    ia->address[i].__ss_family);
+ 	    }
+ 	    mr.imr_interface.s_addr = INADDR_ANY;
+ 	    x = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
+ 		(char *) &mr, sizeof(struct ip_mreq));
+ 	    if (x < 0)
+ 		;/*debug(5, 1, "comm_join_mcast_groups: FD %d, addr: %s [%s]\n",
+ 		    fd, s->key, inet_ntoa(*(ia->in_addrs + i)));*/
+ #else
  	    mr.imr_multiaddr.s_addr = (ia->in_addrs + i)->s_addr;
  	    mr.imr_interface.s_addr = INADDR_ANY;
  	    x = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
***************
*** 1414,1419 ****
--- 1923,1929 ----
  	    if (x < 0)
  		debug(5, 1, "comm_join_mcast_groups: FD %d, addr: %s [%s]\n",
  		    fd, s->key, inet_ntoa(*(ia->in_addrs + i)));
+ #endif
  	    x = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &c, 1);
  	    if (x < 0)
  		debug(5, 1,
Index: squid11/src/comm.h
diff -c squid11/src/comm.h:1.1.1.1 squid11/src/comm.h:1.4
*** squid11/src/comm.h:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/comm.h	Thu Feb 18 02:04:46 1999
***************
*** 140,146 ****
--- 140,150 ----
  typedef struct {
      char *host;
      u_short port;
+ #ifdef INET6
+     struct sockaddr_storage S;
+ #else
      struct sockaddr_in S;
+ #endif
      CCH callback;
      void *data;
  #ifdef RETRY_PATCH
***************
*** 163,169 ****
--- 167,177 ----
      int sender;			/* Set if this fd is connected to a client */
      u_short local_port;		/* Our TCP port # */
      u_short remote_port;	/* Remote TCP port # */
+ #ifdef INET6
+     char ipaddr[INET6_ADDRSTRLEN]; /* numeric address of peer */
+ #else
      char ipaddr[16];		/* dotted decimal address of peer */
+ #endif
  
      /* Select handlers. */
      PF read_handler;		/* Read  select handler. */
***************
*** 192,202 ****
--- 200,218 ----
  extern int comm_accept _PARAMS((int fd, struct sockaddr_in *, struct sockaddr_in *));
  extern void comm_close _PARAMS((int fd));
  extern void commConnectStart _PARAMS((int fd, const char *, u_short, CCH, void *));
+ #ifdef INET6
+ extern int comm_connect_addr _PARAMS((int sock, const struct sockaddr *));
+ #else
  extern int comm_connect_addr _PARAMS((int sock, const struct sockaddr_in *));
+ #endif
  extern int comm_get_select_handler _PARAMS((int fd, unsigned int type, PF *, void **));
  extern int comm_init _PARAMS((void));
  extern int comm_listen _PARAMS((int sock));
+ #ifdef INET6 
+ extern int comm_open _PARAMS((int, int, struct sockaddr *addr, u_short port, int, const char *note));
+ #else
  extern int comm_open _PARAMS((int, int, struct in_addr, u_short port, int, const char *note));
+ #endif
  extern u_short comm_local_port _PARAMS((int fd));
  extern int comm_select _PARAMS((time_t));
  extern int comm_set_fd_lifetime _PARAMS((int fd, int lifetime));
***************
*** 206,212 ****
--- 222,233 ----
  extern int comm_set_mcast_ttl _PARAMS((int, int));
  extern int comm_join_mcast_groups _PARAMS((int));
  extern int comm_udp_send _PARAMS((int fd, const char *host, u_short port, const char *buf, int len));
+ #ifdef INET6
+ extern int comm_udp_sendto _PARAMS((int fd, const struct sockaddr *,
+ 				    int size, const char *buf, int len));
+ #else
  extern int comm_udp_sendto _PARAMS((int fd, const struct sockaddr_in *, int size, const char *buf, int len));
+ #endif
  extern int fd_of_first_client _PARAMS((StoreEntry *));
  extern void comm_set_stall _PARAMS((int, int));
  extern void comm_write _PARAMS((int fd,
Index: squid11/src/debug.c
diff -c squid11/src/debug.c:1.1.1.1 squid11/src/debug.c:1.4
*** squid11/src/debug.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/debug.c	Thu Feb 18 02:04:47 1999
***************
*** 290,292 ****
--- 290,312 ----
      }
      return buf;
  }
+ 
+ #ifdef INET6
+ char *inet_storagetoa(struct sockaddr *s)
+ {
+   char vname[INET6_ADDRSTRLEN];
+   
+   if (s->sa_family == AF_INET6) {
+       char* stp;
+       inet_ntop(AF_INET6, &((struct sockaddr_in6 *)s)->sin6_addr,
+ 		vname, sizeof vname);
+       stp = xmalloc(strlen(vname)+1);
+       strcpy(stp,vname);
+       return stp;
+   } else if (s->sa_family == AF_INET) {
+       return inet_ntoa(((struct sockaddr_in *)s)->sin_addr);
+   } else {
+       return NULL;
+   }
+ }
+ #endif
Index: squid11/src/dns.c
diff -c squid11/src/dns.c:1.1.1.1 squid11/src/dns.c:1.3
*** squid11/src/dns.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/dns.c	Thu Feb 18 02:04:49 1999
***************
*** 124,142 ****
--- 124,160 ----
  dnsOpenServer(const char *command)
  {
      pid_t pid;
+ #ifdef INET6
+     struct sockaddr_storage S;
+ #else
      struct sockaddr_in S;
+ #endif
      int cfd;
      int sfd;
      int fd;
      int len;
      LOCAL_ARRAY(char, buf, 128);
  
+ #ifdef INET6
+     if (used_ip_type == 0x02) { /* IPv6 Only */ 
+         cfd = comm_open(SOCK_STREAM,0,(struct sockaddr *)&local_addr6,
+ 			0,COMM_NOCLOEXEC,"socket to dnsserver");
+    } else { /* IPv4 Only or IPv6/IPv4 */
+         cfd = comm_open(SOCK_STREAM,
+ 			0,
+ 			(struct sockaddr *)&local_addr,
+ 			0,
+ 			COMM_NOCLOEXEC,
+ 			"socket to dnsserver");
+    }
+ #else
      cfd = comm_open(SOCK_STREAM,
  	0,
  	local_addr,
  	0,
  	COMM_NOCLOEXEC,
  	"socket to dnsserver");
+ #endif
      if (cfd == COMM_ERROR) {
  	debug(34, 0, "dnsOpenServer: Failed to create dnsserver\n");
  	return -1;
***************
*** 157,168 ****
--- 175,198 ----
      if (pid > 0) {		/* parent */
  	comm_close(cfd);	/* close shared socket with child */
  	/* open new socket for parent process */
+ #ifdef INET6
+         if (used_ip_type == 0x02) { /* IPv6 Only */ 
+ 	    sfd = comm_open(SOCK_STREAM,0,
+ 			    (struct sockaddr *)&local_addr6,
+ 			    0,0, NULL);
+ 	} else {
+ 	    sfd = comm_open(SOCK_STREAM,0,
+ 			    (struct sockaddr *)&local_addr,
+ 			    0,0, NULL);
+ 	}
+ #else
  	sfd = comm_open(SOCK_STREAM,
  	    0,			/* protocol */
  	    local_addr,
  	    0,			/* port */
  	    0,			/* flags */
  	    NULL);		/* blocking! */
+ #endif
  	if (sfd == COMM_ERROR)
  	    return -1;
  	if (comm_connect_addr(sfd, &S) == COMM_ERROR) {
***************
*** 190,195 ****
--- 220,226 ----
  	return sfd;
      }
      /* child */
+ 
      no_suid();			/* give up extra priviliges */
      if ((fd = accept(cfd, NULL, NULL)) < 0) {
  	debug(50, 0, "dnsOpenServer: FD %d accept: %s\n", cfd, xstrerror());
***************
*** 250,255 ****
--- 281,287 ----
      int dnssocket;
      LOCAL_ARRAY(char, fd_note_buf, FD_ASCII_NOTE_SZ);
  
+     debug(1,0,"dnsOpenServers:\n");
      dnsFreeMemory();
      dns_child_table = xcalloc(N, sizeof(dnsserver_t *));
      NDnsServersAlloc = 0;
Index: squid11/src/dnsserver.c
diff -c squid11/src/dnsserver.c:1.1.1.1 squid11/src/dnsserver.c:1.3
*** squid11/src/dnsserver.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/dnsserver.c	Thu Feb 18 02:04:50 1999
***************
*** 228,234 ****
--- 228,236 ----
  #define gethostbyname _res_gethostbyname
  #endif /* _SQUID_NEXT_ */
  
+ #ifndef INET6
  static int do_debug = 0;
+ #endif
  static struct in_addr no_addr;
  
  /* error messages from gethostbyname() */
***************
*** 259,265 ****
--- 261,269 ----
      long start;
      long stop;
      char *t = NULL;
+ #ifndef INET6
      char buf[256];
+ #endif
      int addr_count = 0;
      int alias_count = 0;
      int i;
***************
*** 287,297 ****
--- 291,303 ----
  	    exit(0);
  	    break;
  	case 'd':
+ #ifndef INET6
  	    sprintf(buf, "dnsserver.%d.log", (int) getpid());
  	    logfile = fopen(buf, "a");
  	    do_debug++;
  	    if (!logfile)
  		fprintf(stderr, "Could not open dnsserver's log file\n");
+ #endif
  	    break;
  	case 'D':
  #ifdef RES_DEFNAMES
***************
*** 353,359 ****
--- 359,373 ----
  	    }
  	} else {
  	    for (;;) {
+ #ifdef INET6
+ 	        result = gethostbyname2(request,AF_INET6);
+ 
+ 		if (!result) { /* IPv4 hostname*/ 
+ 		    result = gethostbyname(request);
+ 		}
+ #else
  		result = gethostbyname(request);
+ #endif
  		if (result || h_errno != TRY_AGAIN)
  		    break;
  		if (++retry_count == 2)
***************
*** 394,402 ****
--- 408,432 ----
  		++addr_count;
  	    printf("$ipcount %d\n", addr_count);
  	    for (i = 0; i < addr_count; i++) {
+ #ifdef INET6
+ 		if (result->h_addrtype == AF_INET6) {
+ 		    struct in6_addr addr6;
+ 		    char vname[INET6_ADDRSTRLEN];
+ 		    xmemcpy((char *) &addr6, result->h_addr_list[i],
+ 			    result->h_length);
+ 		    inet_ntop(AF_INET6,&addr6,vname,sizeof vname);
+ 		    printf("%s\n", vname);
+ 		} else if (result->h_addrtype == AF_INET) {
+ 		    struct in_addr addr;
+ 		    xmemcpy((char *) &addr, result->h_addr_list[i],
+ 			    result->h_length);
+ 		    printf("%s\n", inet_ntoa(addr));
+ 		}
+ #else
  		struct in_addr addr;
  		xmemcpy((char *) &addr, result->h_addr_list[i], result->h_length);
  		printf("%s\n", inet_ntoa(addr));
+ #endif
  	    }
  
  #ifdef SEND_ALIASES
Index: squid11/src/fqdncache.c
diff -c squid11/src/fqdncache.c:1.1.1.1 squid11/src/fqdncache.c:1.4
*** squid11/src/fqdncache.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/fqdncache.c	Thu Feb 18 02:04:51 1999
***************
*** 756,762 ****
--- 756,834 ----
      return n;
  }
  
+ #ifdef INET6
  const char *
+ fqdncache_gethostbyaddr46(struct in_addr addr, int flags)
+ {
+     char *name = inet_ntoa(addr);
+     fqdncache_entry *f = NULL;
+     const struct hostent *hp = NULL;
+     struct in_addr ip;
+     static char *static_name = NULL;
+ 
+     if (!name)
+ 	fatal_dump("fqdncache_gethostbyaddr: NULL name");
+     FqdncacheStats.requests++;
+     if ((f = fqdncache_get(name))) {
+ 	if (fqdncacheExpiredEntry(f)) {
+ 	    fqdncache_release(f);
+ 	    f = NULL;
+ 	}
+     }
+     if (f) {
+ 	if (f->status == FQDN_PENDING || f->status == FQDN_DISPATCHED) {
+ 	    if (!BIT_TEST(flags, IP_BLOCKING_LOOKUP)) {
+ 		FqdncacheStats.pending_hits++;
+ 		return NULL;
+ 	    }
+ 	} else if (f->status == FQDN_NEGATIVE_CACHED) {
+ 	    FqdncacheStats.negative_hits++;
+ 	    dns_error_message = f->error_message;
+ 	    return NULL;
+ 	} else {
+ 	    FqdncacheStats.hits++;
+ 	    f->lastref = squid_curtime;
+ 	    return f->names[0];
+ 	}
+     }
+     /* check if it's already a FQDN address in text form. */
+     if (!safe_inet_addr(name, &ip))
+ 	return name;
+     FqdncacheStats.misses++;
+     if (BIT_TEST(flags, FQDN_BLOCKING_LOOKUP)) {
+ 	if (NDnsServersAlloc)
+ 	    debug(14, 0, "WARNING: blocking on gethostbyaddr() for '%s'\n", name);
+ 	FqdncacheStats.ghba_calls++;
+ 	hp = gethostbyaddr((char *) &ip.s_addr, 4, AF_INET);
+ 	if (hp && hp->h_name && (hp->h_name[0] != '\0') && fqdn_table) {
+ 	    if (f == NULL) {
+ 		f = fqdncacheAddNew(name, hp, FQDN_CACHED);
+ 	    } else if (f->status == FQDN_DISPATCHED) {
+ 		/* only dnsHandleRead() can change from DISPATCHED to CACHED */
+ 		xfree(static_name);
+ 		static_name = xstrdup(hp->h_name);
+ 		return static_name;
+ 	    } else {
+ 		fqdncacheAddHostent(f, hp);
+ 		f->status = FQDN_CACHED;
+ 	    }
+ 	    f->expires = squid_curtime + Config.positiveDnsTtl;
+ 	    return f->names[0];
+ 	}
+ 	/* bad address, negative cached */
+ 	if (fqdn_table && f == NULL) {
+ 	    f = fqdncacheAddNew(name, hp, FQDN_NEGATIVE_CACHED);
+ 	    f->expires = squid_curtime + Config.negativeDnsTtl;
+ 	    return NULL;
+ 	}
+     }
+     if (flags & FQDN_LOOKUP_IF_MISS)
+ 	fqdncache_nbgethostbyaddr(addr, -1, dummy_handler, NULL);
+     return NULL;
+ }
+ #endif
+ 
+ const char *
  fqdncache_gethostbyaddr(struct in_addr addr, int flags)
  {
      char *name = inet_ntoa(addr);
***************
*** 765,770 ****
--- 837,844 ----
      struct in_addr ip;
      static char *static_name = NULL;
  
+     debug(1,0, "fqdncache_gethostbyaddr: addr=%s flags=%d\n",
+ 	  name, flags);
      if (!name)
  	fatal_dump("fqdncache_gethostbyaddr: NULL name");
      FqdncacheStats.requests++;
***************
*** 904,909 ****
--- 978,1000 ----
      fqdncache_release(f);
  }
  
+ #ifdef INET6
+ const char *
+ fqdnFromAddr(struct sockaddr *address)
+ {
+     const char *n;
+     static char buf[32];
+     if (address->sa_family == AF_INET) {
+         struct sockaddr_in *inaddr4p = (struct sockaddr_in*)address;
+         if (Config.Log.log_fqdn && (n = fqdncache_gethostbyaddr(inaddr4p->sin_addr, 0)))
+ 	    return n;
+ 	xstrncpy(buf, inet_ntoa(inaddr4p->sin_addr), 32);
+     } else {
+ 	buf[0] = '\0';		/* XXX */
+     }
+     return buf;
+ }
+ #else
  const char *
  fqdnFromAddr(struct in_addr addr)
  {
***************
*** 914,919 ****
--- 1005,1011 ----
      xstrncpy(buf, inet_ntoa(addr), 32);
      return buf;
  }
+ #endif
  
  int
  fqdncacheQueueDrain(void)
Index: squid11/src/fqdncache.h
diff -c squid11/src/fqdncache.h:1.1.1.1 squid11/src/fqdncache.h:1.3
*** squid11/src/fqdncache.h:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/fqdncache.h	Thu Feb 18 02:04:53 1999
***************
*** 145,151 ****
--- 145,155 ----
  extern void fqdncacheShutdownServers _PARAMS((void));
  extern void fqdncacheOpenServers _PARAMS((void));
  extern void fqdncacheReleaseInvalid _PARAMS((const char *));
+ #ifdef INET6
+ extern const char *fqdnFromAddr _PARAMS((struct sockaddr*));
+ #else
  extern const char *fqdnFromAddr _PARAMS((struct in_addr));
+ #endif
  extern int fqdncacheQueueDrain _PARAMS((void));
  extern void fqdncacheFreeMemory _PARAMS((void));
  extern void fqdncache_restart _PARAMS((void));
Index: squid11/src/ftp.c
diff -c squid11/src/ftp.c:1.1.1.1 squid11/src/ftp.c:1.3
*** squid11/src/ftp.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/ftp.c	Thu Feb 18 02:04:54 1999
***************
*** 112,118 ****
--- 112,122 ----
  
  static int ftpget_server_read = -1;
  static int ftpget_server_write = -1;
+ #if defined(INET6) && defined(USE_V6_LOCALHOST)
+ static u_short ftpget_port6 = 0;
+ #else
  static u_short ftpget_port = 0;
+ #endif
  static const char *const w_space = " \t\n\r";
  
  typedef struct _Ftpdata {
***************
*** 485,494 ****
--- 489,505 ----
      if (data->authenticated) {
  	strcat(buf, "-a ");
      }
+ #ifdef INET6
+     if (Config.Addrs.tcp_outgoing.sin_addr.s_addr != no_addr.s_addr) {
+ 	sprintf(tbuf, "-o %s ", inet_ntoa(Config.Addrs.tcp_outgoing.sin_addr));
+ 	strcat(buf, tbuf);
+     }
+ #else
      if (Config.Addrs.tcp_outgoing.s_addr != no_addr.s_addr) {
  	sprintf(tbuf, "-o %s ", inet_ntoa(Config.Addrs.tcp_outgoing));
  	strcat(buf, tbuf);
      }
+ #endif
      strcat(buf, "-h ");		/* httpify */
      strcat(buf, "- ");		/* stdout */
      strcat(buf, data->request->host);
***************
*** 599,610 ****
--- 610,639 ----
  	unusedfd, ftpData->request->host, ftpData->request->urlpath,
  	ftpData->user, ftpData->password);
  
+ #ifdef INET6
+ #ifdef USE_V6_LOCALHOST
+     ftpData->ftp_fd = comm_open(SOCK_STREAM,
+ 	0,
+ 	(struct sockaddr *)&local_addr6,
+ 	0,
+ 	COMM_NONBLOCKING,
+ 	url);
+ #else
+     ftpData->ftp_fd = comm_open(SOCK_STREAM,
+ 	0,
+ 	(struct sockaddr *)&local_addr,
+ 	0,
+ 	COMM_NONBLOCKING,
+ 	url);
+ #endif
+ #else
      ftpData->ftp_fd = comm_open(SOCK_STREAM,
  	0,
  	local_addr,
  	0,
  	COMM_NONBLOCKING,
  	url);
+ #endif
      if (ftpData->ftp_fd == COMM_ERROR) {
  	squid_error_entry(entry, ERR_CONNECT_FAIL, xstrerror());
  	ftpStateFree(-1, ftpData);
***************
*** 627,637 ****
--- 656,674 ----
  #endif /* RETRY_PATCH */
  
      /* Now connect ... */
+ #if defined(INET6) && defined(USE_V6_LOCALHOST)
      commConnectStart(ftpData->ftp_fd,
+ 	localhost6,
+ 	ftpget_port6,
+ 	ftpConnectDone,
+ 	ftpData);
+ #else
+     commConnectStart(ftpData->ftp_fd,
  	localhost,
  	ftpget_port,
  	ftpConnectDone,
  	ftpData);
+ #endif
      return COMM_OK;
  }
  
***************
*** 675,681 ****
--- 712,722 ----
      }
      last_restart = squid_curtime;
      debug(9, 1, "Restarting ftpget server...\n");
+ #if defined(INET6) && defined(USE_V6_LOCALHOST)
+     ftpInitialize6();
+ #else
      ftpInitialize();
+ #endif
  }
  
  void
***************
*** 724,735 ****
--- 765,781 ----
  	debug(50, 0, "ftpInitialize: pipe: %s\n", xstrerror());
  	return -1;
      }
+ #ifdef INET6
+     cfd = comm_open(SOCK_STREAM, 0, (struct sockaddr *)&local_addr, 0,
+ 		    COMM_NOCLOEXEC, "ftpget -S socket");
+ #else
      cfd = comm_open(SOCK_STREAM,
  	0,
  	local_addr,
  	0,
  	COMM_NOCLOEXEC,
  	"ftpget -S socket");
+ #endif
      debug(9, 5, "ftpget -S socket on FD %d\n", cfd);
      if (cfd == COMM_ERROR) {
  	debug(9, 0, "ftpInitialize: Failed to create socket\n");
***************
*** 792,794 ****
--- 838,934 ----
      _exit(1);
      return (1);			/* eliminate compiler warning */
  }
+ 
+ #if defined(INET6) && defined(USE_V6_LOCALHOST)
+ int
+ ftpInitialize6(void)
+ {
+     pid_t pid;
+     int cfd;
+     int squid_to_ftpget[2];
+     int ftpget_to_squid[2];
+     LOCAL_ARRAY(char, pbuf, 128);
+     char *ftpget = Config.Program.ftpget;
+     struct sockaddr_in6 S;
+     int len;
+     struct timeval slp;
+ 
+     if (!strcmp(ftpget, "none")) {
+ 	debug(9, 1, "ftpInitialize6: ftpget is disabled.\n");
+ 	return -1;
+     }
+     debug(9, 5, "ftpInitialize6: Initializing...\n");
+     if (pipe(squid_to_ftpget) < 0) {
+ 	debug(50, 0, "ftpInitialize6: pipe: %s\n", xstrerror());
+ 	return -1;
+     }
+     if (pipe(ftpget_to_squid) < 0) {
+ 	debug(50, 0, "ftpInitialize6: pipe: %s\n", xstrerror());
+ 	return -1;
+     }
+     cfd = comm_open(SOCK_STREAM, 0, (struct sockaddr *)&local_addr6, 0,
+ 		    COMM_NOCLOEXEC, "ftpget -S socket");
+ 
+     debug(9, 5, "ftpget -S socket on FD %d\n", cfd);
+     if (cfd == COMM_ERROR) {
+ 	debug(9, 0, "ftpInitialize: Failed to create socket\n");
+ 	return -1;
+     }
+     len = sizeof(S);
+     memset(&S, '\0', len);
+     if (getsockname(cfd, (struct sockaddr *) &S, &len) < 0) {
+ 	debug(50, 0, "ftpInitialize6: getsockname: %s\n", xstrerror());
+ 	comm_close(cfd);
+ 	return -1;
+     }
+     ftpget_port6 = ntohs(S.sin6_port);
+     listen(cfd, Squid_MaxFD >> 2);
+     if ((pid = fork()) < 0) {
+ 	debug(50, 0, "ftpInitialize: fork: %s\n", xstrerror());
+ 	comm_close(cfd);
+ 	fatal("Failed to fork() for ftpget.");
+     }
+     if (pid != 0) {		/* parent */
+ 	comm_close(cfd);
+ 	close(squid_to_ftpget[0]);
+ 	close(ftpget_to_squid[1]);
+ 	fdstat_open(squid_to_ftpget[1], FD_PIPE);
+ 	fdstat_open(ftpget_to_squid[0], FD_PIPE);
+ 	fd_note(squid_to_ftpget[1], "ftpget -S");
+ 	fd_note(ftpget_to_squid[0], "ftpget -S");
+ 	commSetCloseOnExec(squid_to_ftpget[1]);
+ 	commSetCloseOnExec(ftpget_to_squid[0]);
+ 	/* if ftpget -S goes away, this handler should get called */
+ 	commSetSelect(ftpget_to_squid[0],
+ 	    COMM_SELECT_READ,
+ 	    (PF) ftpServerClosed,
+ 	    (void *) NULL, 0);
+ 	ftpget_server_write = squid_to_ftpget[1];
+ 	ftpget_server_read = ftpget_to_squid[0];
+ 	slp.tv_sec = 0;
+ 	slp.tv_usec = 250000;
+ 	select(0, NULL, NULL, NULL, &slp);
+ 	return 0;
+     }
+     /* child */
+     /* give up all extra priviligies */
+     no_suid();
+     /* set up stdin,stdout */
+     dup2(squid_to_ftpget[0], 0);
+     dup2(ftpget_to_squid[1], 1);
+     dup2(fileno(debug_log), 2);
+     close(squid_to_ftpget[0]);
+     close(squid_to_ftpget[1]);
+     close(ftpget_to_squid[0]);
+     close(ftpget_to_squid[1]);
+     dup2(cfd, 3);		/* pass listening socket to ftpget */
+     /* inherit stdin,stdout,stderr */
+     for (cfd = 4; cfd <= Biggest_FD; cfd++)
+ 	close(cfd);
+     sprintf(pbuf, "%d", ftpget_port6);
+     execlp(ftpget, ftpget, "-S", pbuf, NULL);
+     debug(50, 0, "ftpInitialize6: %s: %s\n", ftpget, xstrerror());
+     _exit(1);
+     return (1);			/* eliminate compiler warning */
+ }
+ #endif
Index: squid11/src/ftp.h
diff -c squid11/src/ftp.h:1.1.1.1 squid11/src/ftp.h:1.2
*** squid11/src/ftp.h:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/ftp.h	Tue Feb 16 18:18:44 1999
***************
*** 107,112 ****
--- 107,115 ----
  
  extern int ftpStart _PARAMS((int unusedfd, const char *url, request_t * req, StoreEntry * entry));
  extern int ftpInitialize _PARAMS((void));
+ #ifdef INET6
+ extern int ftpInitialize6 _PARAMS((void));
+ #endif
  extern void ftpServerClose _PARAMS((void));
  
  #endif /* FTP_H */
Index: squid11/src/ftpget.c
diff -c squid11/src/ftpget.c:1.1.1.1 squid11/src/ftpget.c:1.4
*** squid11/src/ftpget.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/ftpget.c	Thu Feb 18 02:04:56 1999
***************
*** 270,276 ****
--- 270,280 ----
      int rest_offset;
      int rest_att;
      int rest_implemented;
+ #ifdef INET6
+     struct sockaddr_storage host_addr;
+ #else
      struct in_addr host_addr;
+ #endif
      int bytes_written;
  } ftp_request_t;
  
***************
*** 323,330 ****
--- 327,339 ----
  static char *mime_get_icon _PARAMS((const char *));
  static int accept_with_timeout _PARAMS((int, struct sockaddr *, int *));
  static int check_data_rate _PARAMS((int));
+ #ifdef INET6
+ static int connect_with_timeout _PARAMS((int, struct sockaddr *, int));
+ static int connect_with_timeout2 _PARAMS((int, struct sockaddr *, int));
+ #else
  static int connect_with_timeout _PARAMS((int, struct sockaddr_in *, int));
  static int connect_with_timeout2 _PARAMS((int, struct sockaddr_in *, int));
+ #endif
  static int ftpget_srv_mode _PARAMS((char *));
  static int is_dfd_open _PARAMS((ftp_request_t *));
  static int is_month _PARAMS((const char *));
***************
*** 375,381 ****
--- 384,394 ----
  static char cbuf[SMALLBUFSIZ];	/* send command buffer */
  static char htmlbuf[BIGBUFSIZ];
  static char *server_reply_msg = NULL;
+ #ifdef INET6
+ static struct sockaddr_storage ifc_addr;
+ #else
  static struct sockaddr_in ifc_addr;
+ #endif
  static time_t last_alarm_set = 0;
  static ftp_request_t *MainRequest = NULL;
  static char visible_hostname[SMALLBUFSIZ];
***************
*** 747,753 ****
--- 760,770 ----
  }
  
  static int
+ #ifdef INET6
+ connect_with_timeout2(int fd, struct sockaddr *S, int len)
+ #else
  connect_with_timeout2(int fd, struct sockaddr_in *S, int len)
+ #endif
  {
      int x;
      int y;
***************
*** 758,771 ****
      debug(38, 7, "connect_with_timeout2: starting...\n");
  
      for (;;) {
  	debug(38, 5, "Connecting FD %d to: %s, port %d, len = %d\n", fd,
  	    inet_ntoa(S->sin_addr),
  	    (int) ntohs(S->sin_port),
  	    len);
  	y = connect(fd, (struct sockaddr *) S, len);
  	cerrno = errno;
! 	if (y < 0)
  	    debug(38, 7, "connect: %s\n", xstrerror());
  	if (y >= 0)
  	    return y;
  	if (cerrno == EISCONN)
--- 775,807 ----
      debug(38, 7, "connect_with_timeout2: starting...\n");
  
      for (;;) {
+ #ifdef INET6
+     {
+ 	char addr[INET6_ADDRSTRLEN];
+ 	short port;
+ 	if (S->sa_family == AF_INET6) {
+ 	    struct sockaddr_in6 *s6 = (struct sockaddr_in6 *)&S;
+ 	    inet_ntop(AF_INET6, &s6->sin6_addr, addr, sizeof(addr));
+ 	    port = s6->sin6_port;
+ 	} else {
+ 	    struct sockaddr_in *s = (struct sockaddr_in *)&S;
+ 	    inet_ntop(AF_INET, &s->sin_addr, addr, sizeof(addr));
+ 	    port = s->sin_port;
+ 	}
+ 	debug(38, 5, "Connecting FD %d to: %s, port %d, len = %d\n", fd,
+ 	    addr, (int) ntohs(port), len);
+     }
+ #else
  	debug(38, 5, "Connecting FD %d to: %s, port %d, len = %d\n", fd,
  	    inet_ntoa(S->sin_addr),
  	    (int) ntohs(S->sin_port),
  	    len);
+ #endif
  	y = connect(fd, (struct sockaddr *) S, len);
  	cerrno = errno;
! 	if (y < 0) {
  	    debug(38, 7, "connect: %s\n", xstrerror());
+ 	  }
  	if (y >= 0)
  	    return y;
  	if (cerrno == EISCONN)
***************
*** 815,821 ****
--- 851,861 ----
  
  /* stupid wrapper for so we can set and clear O_NDELAY */
  static int
+ #ifdef INET6
+ connect_with_timeout(int fd, struct sockaddr *S, int len)
+ #else
  connect_with_timeout(int fd, struct sockaddr_in *S, int len)
+ #endif
  {
      int orig_flags;
      int rc;
***************
*** 1128,1134 ****
      if ((int) strlen(buf) < 14)
  	return 0;
      memset(&tms, '\0', sizeof(struct tm));
!     tms.tm_year = (ASCII_DIGIT(buf[0]) * 1000) + (ASCII_DIGIT(buf[1]) * 100 ) +
  		(ASCII_DIGIT(buf[2]) * 10) + ASCII_DIGIT(buf[3]) - 1900;
      tms.tm_mon = (ASCII_DIGIT(buf[4]) * 10) + ASCII_DIGIT(buf[5]) - 1;
      tms.tm_mday = (ASCII_DIGIT(buf[6]) * 10) + ASCII_DIGIT(buf[7]);
--- 1168,1174 ----
      if ((int) strlen(buf) < 14)
  	return 0;
      memset(&tms, '\0', sizeof(struct tm));
!     tms.tm_year = (ASCII_DIGIT(buf[0]) * 1000) + (ASCII_DIGIT(buf[1]) * 100) +
  		(ASCII_DIGIT(buf[2]) * 10) + ASCII_DIGIT(buf[3]) - 1900;
      tms.tm_mon = (ASCII_DIGIT(buf[4]) * 10) + ASCII_DIGIT(buf[5]) - 1;
      tms.tm_mday = (ASCII_DIGIT(buf[6]) * 10) + ASCII_DIGIT(buf[7]);
***************
*** 1212,1217 ****
--- 1252,1282 ----
      const struct hostent *hp;
      char *host = proxy_host ? proxy_host : r->host;
      debug(38, 3, "parse_request: looking up '%s'\n", host);
+ #ifdef INET6
+     if (safe_inet_sockaddr(host, &r->host_addr))	/* try numeric */
+ 	return PARSE_OK;
+     
+     hp = gethostbyname2(host,AF_INET6);
+     if (hp != NULL) {
+         memset(&r->host_addr, '\0', sizeof(struct sockaddr_storage));
+         xmemcpy(&((struct sockaddr_in6 *)&r->host_addr)->sin6_addr,
+ 		*hp->h_addr_list,sizeof(struct in6_addr));
+ 	r->host_addr.__ss_family = AF_INET6;
+ 	return PARSE_OK;
+     }
+     hp = gethostbyname(host);
+     if (hp == NULL) {
+ 	r->errmsg = xmalloc(SMALLBUFSIZ);
+ 	sprintf(r->errmsg, "Unknown host: %s", host);
+ 	r->rc = 10;
+ 	return FAIL_HARD;
+     }
+     memset(&r->host_addr, '\0', sizeof(struct sockaddr_storage));
+     xmemcpy(&((struct sockaddr_in *)&r->host_addr)->sin_addr.s_addr,
+ 	    *hp->h_addr_list,4);
+     r->host_addr.__ss_family = AF_INET;
+     return PARSE_OK;
+ #else
      if (safe_inet_addr(host, &r->host_addr))	/* try numeric */
  	return PARSE_OK;
      hp = gethostbyname(host);
***************
*** 1223,1228 ****
--- 1288,1294 ----
      }
      xmemcpy(&r->host_addr.s_addr, *hp->h_addr_list, 4);
      return PARSE_OK;
+ #endif
  }
  
  /*
***************
*** 1237,1261 ****
--- 1303,1352 ----
  do_connect(ftp_request_t * r)
  {
      int sock;
+ #ifdef INET6
+     struct sockaddr_storage S;
+ #else
      struct sockaddr_in S;
+ #endif
      int len;
      int x;
  
      r->conn_att++;
      debug(38, 3, "do_connect: connect attempt #%d to '%s'\n",
  	r->conn_att, r->host);
+ #ifdef INET6
+     S = r->host_addr;
+ 
+     if ((sock = socket(S.__ss_family, SOCK_STREAM, 0)) < 0) {
+ 	r->errmsg = xmalloc(SMALLBUFSIZ);
+ 	sprintf(r->errmsg, "socket: %s", xstrerror());
+ 	r->rc = 2;
+ 	return FAIL_CONNECT;
+     }
+ 
+     if (S.__ss_family == AF_INET6) {
+       ((struct sockaddr_in6 *)&S)->sin6_port = htons(r->port);
+       x = connect_with_timeout(sock, (struct sockaddr *)&S, sizeof(struct sockaddr_in6));
+     } else {
+       ((struct sockaddr_in *)&S)->sin_port = htons(r->port);
+       x = connect_with_timeout(sock, (struct sockaddr *)&S, sizeof(struct sockaddr_in));
+     }
+ #else
      if ((sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
  	r->errmsg = xmalloc(SMALLBUFSIZ);
  	sprintf(r->errmsg, "socket: %s", xstrerror());
  	r->rc = 2;
  	return FAIL_CONNECT;
      }
+ 
      memset(&S, '\0', sizeof(struct sockaddr_in));
      S.sin_addr = r->host_addr;
      S.sin_family = AF_INET;
      S.sin_port = htons(r->port);
  
      x = connect_with_timeout(sock, &S, sizeof(S));
+ #endif
+ 
      if (x == READ_TIMEOUT) {
  	ftp_request_timeout(r);
  	return FAIL_CONNECT;
***************
*** 1271,1283 ****
--- 1362,1391 ----
  
      /* get the address of whatever interface we're using so we know */
      /* what to use in the PORT command.                             */
+ #ifdef INET6
+     if (S.__ss_family == AF_INET6) {
+         len = sizeof(struct sockaddr_in6);
+     } else {
+         len = sizeof(struct sockaddr_in);
+     }
+ #else
      len = sizeof(ifc_addr);
+ #endif
      if (getsockname(sock, (struct sockaddr *) &ifc_addr, &len) < 0) {
  	debug(38, 0, "getsockname: %s\n", xstrerror());
  	exit(1);
      }
+ 
+ #ifdef INET6
+     if (S.__ss_family == AF_INET && outgoingTcpAddr.s_addr) {
+         memset(&ifc_addr, '\0', sizeof(ifc_addr));
+ 	((struct sockaddr_in *)&ifc_addr)->sin_family = AF_INET;
+ 	((struct sockaddr_in *)&ifc_addr)->sin_addr = outgoingTcpAddr;
+     }
+ #else
      if (outgoingTcpAddr.s_addr)
  	ifc_addr.sin_addr = outgoingTcpAddr;
+ #endif
      return CONNECTED;
  }
  
***************
*** 1440,1446 ****
--- 1548,1558 ----
  {
      int code;
      int sock;
+ #ifdef INET6
+     struct sockaddr_storage S;
+ #else
      struct sockaddr_in S;
+ #endif
      unsigned int naddr;
      int tries = 0;
      u_short port = 0;
***************
*** 1449,1454 ****
--- 1561,1576 ----
      if (is_dfd_open(r))
  	return PORT_OK;
  
+ #ifdef INET6
+     S = ifc_addr;
+ 
+     if ((sock = socket(S.__ss_family, SOCK_STREAM, 0)) < 0) {
+ 	r->errmsg = xmalloc(SMALLBUFSIZ);
+ 	sprintf(r->errmsg, "socket: %s", xstrerror());
+ 	r->rc = 2;
+ 	return FAIL_SOFT;
+     }
+ #else
      if ((sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
  	r->errmsg = xmalloc(SMALLBUFSIZ);
  	sprintf(r->errmsg, "socket: %s", xstrerror());
***************
*** 1457,1462 ****
--- 1579,1585 ----
      }
      S = ifc_addr;
      S.sin_family = AF_INET;
+ #endif
  
  #if !defined(PASVONLY)
  
***************
*** 1474,1482 ****
--- 1597,1620 ----
  #else
  	port = (u_short) (rand() % (o_conn_max - o_conn_min)) + o_conn_min;
  #endif
+ #ifdef INET6
+ 	if (S.__ss_family == AF_INET6) {
+ 	    ((struct sockaddr_in6 *)&S)->sin6_port = htons(port);
+ 	    if (bind(sock, (struct sockaddr *) &S,
+ 		     sizeof(struct sockaddr_in6)) >= 0)
+ 	        break;
+ 	} else {
+ 	    ((struct sockaddr_in *)&S)->sin_port = htons(port);
+ 	    if (bind(sock, (struct sockaddr *) &S,
+ 		     sizeof(struct sockaddr_in)) >= 0)
+ 	        break;
+ 	}
+ #else
  	S.sin_port = htons(port);
+ 
  	if (bind(sock, (struct sockaddr *) &S, sizeof(S)) >= 0)
  	    break;
+ #endif
  	if (++tries < 10)
  	    continue;
  	r->errmsg = xmalloc(SMALLBUFSIZ);
***************
*** 1506,1511 ****
--- 1644,1675 ----
  	return FAIL_SOFT;
      }
      debug(38, 3, "listening on FD %d\n", sock);
+ #ifdef INET6
+     if (ifc_addr.__ss_family == AF_INET6) {
+ 	char *a = (char *)&(((struct sockaddr_in6 *)&ifc_addr)->sin6_addr);
+ #define UC(b)	(((int)b)&0xff)
+ 	sprintf(cbuf,
+ "LPRT %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
+ 		6, 16,
+ 		UC(a[0]),UC(a[1]),UC(a[2]),UC(a[3]),
+ 		UC(a[4]),UC(a[5]),UC(a[6]),UC(a[7]),
+ 		UC(a[8]),UC(a[9]),UC(a[10]),UC(a[11]),
+ 		UC(a[12]),UC(a[13]),UC(a[14]),UC(a[15]),
+ 		2,
+ 		((int) port >> 8) & 0xFF,
+ 		port & 0xFF);
+ #undef UC
+     } else {
+         naddr = ntohl(((struct sockaddr_in *)&ifc_addr)->sin_addr.s_addr);
+ 	sprintf(cbuf, "PORT %d,%d,%d,%d,%d,%d",
+ 		(naddr >> 24) & 0xFF,
+ 		(naddr >> 16) & 0xFF,
+ 		(naddr >> 8) & 0xFF,
+ 		naddr & 0xFF,
+ 		((int) port >> 8) & 0xFF,
+ 		port & 0xFF);
+     }
+ #else
      naddr = ntohl(ifc_addr.sin_addr.s_addr);
      sprintf(cbuf, "PORT %d,%d,%d,%d,%d,%d",
  	(naddr >> 24) & 0xFF,
***************
*** 1514,1519 ****
--- 1678,1684 ----
  	naddr & 0xFF,
  	((int) port >> 8) & 0xFF,
  	port & 0xFF);
+ #endif
      SEND_CBUF;
  
      if ((code = read_reply(r->sfd)) > 0) {
***************
*** 1533,1542 ****
--- 1698,1716 ----
  {
      int code;
      int sock;
+ #ifdef INET6
+     struct sockaddr_storage S;
+     int len;
+ #else
      struct sockaddr_in S;
+ #endif
      u_short port = 0;
      int n;
      int h1, h2, h3, h4;
+ #ifdef INET6
+     int h5, h6, h7, h8, h9, h10, h11, h12, h13, h14, h15, h16;
+     int s1, s2, s3;
+ #endif
      int p1, p2;
      static char junk[SMALLBUFSIZ];
      static int pasv_supported = 1;
***************
*** 1545,1555 ****
       * PASV_FAIL and let the state machine fall back to using PORT */
      if (!pasv_supported)
  	return PASV_FAIL;
- 
      /* If there already are a open data connection, use that */
      if (is_dfd_open(r))
  	return PORT_OK;
  
      if ((sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
  	r->errmsg = xmalloc(SMALLBUFSIZ);
  	sprintf(r->errmsg, "socket: %s", xstrerror());
--- 1719,1742 ----
       * PASV_FAIL and let the state machine fall back to using PORT */
      if (!pasv_supported)
  	return PASV_FAIL;
      /* If there already are a open data connection, use that */
      if (is_dfd_open(r))
  	return PORT_OK;
  
+ #ifdef INET6
+     S = ifc_addr;
+     if ((sock = socket(S.__ss_family, SOCK_STREAM, 0)) < 0) {
+ 	r->errmsg = xmalloc(SMALLBUFSIZ);
+ 	sprintf(r->errmsg, "socket: %s", xstrerror());
+ 	r->rc = 2;
+ 	return FAIL_SOFT;
+     }
+     if (S.__ss_family == AF_INET6) {
+ 	sprintf(cbuf, "LPSV");
+     } else {
+ 	sprintf(cbuf, "PASV");
+     }
+ #else
      if ((sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
  	r->errmsg = xmalloc(SMALLBUFSIZ);
  	sprintf(r->errmsg, "socket: %s", xstrerror());
***************
*** 1560,1567 ****
--- 1747,1807 ----
      S.sin_family = AF_INET;
  
      sprintf(cbuf, "PASV");
+ #endif
      SEND_CBUF;
  
+ #ifdef INET6
+     code = read_reply(r->sfd);
+     if (code != 227 && code!=228) {
+ 	r->errmsg = xstrdup(server_reply_msg);
+ 	r->rc = code < 0 ? 4 : 5;
+ 	pasv_supported = 0;
+ 	return PASV_FAIL;
+     }
+     /*  227 Entering Passive Mode (h1,h2,h3,h4,p1,p2).  */
+     /*  ANSI sez [^0-9] is undefined, it breaks on Watcom cc */
+ 
+     if (ifc_addr.__ss_family == AF_INET6) {
+         n = sscanf(server_reply_msg,
+ 		   "%[^0123456789]%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
+ 		   junk, &s1, &s2, &h1, &h2, &h3, &h4, &h5, &h6, &h7, &h8, &h9,
+ 		   &h10, &h11, &h12, &h13, &h14, &h15, &h16, &s3, &p1, &p2);
+     } else {
+         n = sscanf(server_reply_msg, "%[^0123456789]%d,%d,%d,%d,%d,%d",
+ 		   junk, &h1, &h2, &h3, &h4, &p1, &p2);
+     }
+ 
+     if ((n != 7 && n!= 22) || p1 < 0 || p2 < 0) {
+ 	/* note RISC/os sends negative numbers in PASV reply */
+ 	r->errmsg = xstrdup(server_reply_msg);
+ 	r->rc = 5;
+ 	pasv_supported = 0;
+ 	return PASV_FAIL;
+     }
+     sprintf(junk,"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
+ 	    h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13,h14,h15,h16);
+ 
+     if (!safe_inet_sockaddr(junk, &S)) {
+ 	pasv_supported = 0;
+ 	return PASV_FAIL;
+     }
+     if (S.__ss_family == AF_INET6) {
+         len = sizeof(struct sockaddr_in6);
+         ((struct sockaddr_in6 *)&S)->sin6_port =
+ 	  htons(port = ((p1 << 8) + p2));
+     } else {
+         len = sizeof(struct sockaddr_in);
+         ((struct sockaddr_in *)&S)->sin_port = htons(port = ((p1 << 8) + p2));
+     }
+ 
+     if (connect_with_timeout(sock, (struct sockaddr *)&S, len) < 0) {
+ 	r->errmsg = xmalloc(SMALLBUFSIZ);
+ 	sprintf(r->errmsg, "%s, port %d: %s", junk, port, xstrerror());
+ 	r->rc = 2;
+ 	pasv_supported = 0;
+ 	return PASV_FAIL;
+     }
+ #else
      if ((code = read_reply(r->sfd)) != 227) {
  	r->errmsg = xstrdup(server_reply_msg);
  	r->rc = code < 0 ? 4 : 5;
***************
*** 1572,1577 ****
--- 1812,1818 ----
      /*  ANSI sez [^0-9] is undefined, it breaks on Watcom cc */
      n = sscanf(server_reply_msg, "%[^0123456789]%d,%d,%d,%d,%d,%d",
  	junk, &h1, &h2, &h3, &h4, &p1, &p2);
+ 
      if (n != 7 || p1 < 0 || p2 < 0) {
  	/* note RISC/os sends negative numbers in PASV reply */
  	r->errmsg = xstrdup(server_reply_msg);
***************
*** 1580,1585 ****
--- 1821,1827 ----
  	return PASV_FAIL;
      }
      sprintf(junk, "%d.%d.%d.%d", h1, h2, h3, h4);
+ 
      if (!safe_inet_addr(junk, &S.sin_addr)) {
  	pasv_supported = 0;
  	return PASV_FAIL;
***************
*** 1593,1598 ****
--- 1835,1841 ----
  	pasv_supported = 0;
  	return PASV_FAIL;
      }
+ #endif
      r->dfd = sock;
      return PORT_OK;
  }
Index: squid11/src/gopher.c
diff -c squid11/src/gopher.c:1.1.1.1 squid11/src/gopher.c:1.3
*** squid11/src/gopher.c:1.1.1.1	Tue Feb 16 18:03:47 1999
--- squid11/src/gopher.c	Thu Feb 18 02:04:57 1999
***************
*** 950,961 ****
--- 950,967 ----
  	return COMM_ERROR;
      }
      /* Create socket. */
+ #ifdef INET6
+     sock = comm_open(SOCK_STREAM, 0,
+ 		     (struct sockaddr *)&Config.Addrs.tcp_outgoing,
+ 		     0,	COMM_NONBLOCKING, url);
+ #else
      sock = comm_open(SOCK_STREAM,
  	0,
  	Config.Addrs.tcp_outgoing,
  	0,
  	COMM_NONBLOCKING,
  	url);
+ #endif
      if (sock == COMM_ERROR) {
  	debug(10, 4, "gopherStart: Failed because we're out of sockets.\n");
  	squid_error_entry(entry, ERR_NO_FDS, xstrerror());
Index: squid11/src/hash.c
diff -c squid11/src/hash.c:1.1.1.1 squid11/src/hash.c:1.2
*** squid11/src/hash.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/hash.c	Tue Feb 16 18:18:48 1999
***************
*** 401,407 ****
      ++hash_links_allocated;
  
      i = (htbl[hid].hash) (k, hid);
- 
      new->next = htbl[hid].buckets[i];
      htbl[hid].buckets[i] = new;
      return 0;
--- 401,406 ----
Index: squid11/src/http.c
diff -c squid11/src/http.c:1.1.1.1 squid11/src/http.c:1.4
*** squid11/src/http.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/http.c	Thu Feb 18 02:04:59 1999
***************
*** 900,905 ****
--- 900,908 ----
      int sock;
      HttpStateData *httpState = NULL;
      request_t *request = NULL;
+ #ifdef INET6
+     const ipcache_addrs *ia = NULL;
+ #endif
  
      debug(11, 3, "proxyhttpStart: \"%s %s\"\n",
  	RequestMethodStr[orig_request->method], url);
***************
*** 910,921 ****
--- 913,937 ----
  	storeStartDeleteBehind(entry);
  
      /* Create socket. */
+ #ifdef INET6
+     ia = ipcache_gethostbyname(e->host, IP_BLOCKING_LOOKUP);
+     if (ia->address[ia->cur].__ss_family == AF_INET6) {
+         sock = comm_open(SOCK_STREAM, 0,
+ 			 (struct sockaddr *)&Config.Addrs.tcp_outgoing6,
+ 			 0,COMM_NONBLOCKING, url);
+     } else {
+         sock = comm_open(SOCK_STREAM, 0,
+ 			 (struct sockaddr *)&Config.Addrs.tcp_outgoing,
+ 			 0,COMM_NONBLOCKING, url);
+     }
+ #else
      sock = comm_open(SOCK_STREAM,
  	0,
  	Config.Addrs.tcp_outgoing,
  	0,
  	COMM_NONBLOCKING,
  	url);
+ #endif
      if (sock == COMM_ERROR) {
  	debug(11, 4, "proxyhttpStart: Failed because we're out of sockets.\n");
  	squid_error_entry(entry, ERR_NO_FDS, xstrerror());
***************
*** 940,945 ****
--- 956,962 ----
      xstrncpy(request->urlpath, url, MAX_URL);
      BIT_SET(request->flags, REQ_PROXYING);
      httpState->ip_lookup_pending = 1;
+ 
      ipcache_nbgethostbyname(request->host,
  	httpState->fd,
  	httpConnect,
***************
*** 954,959 ****
--- 971,977 ----
      request_t *request = httpState->request;
      StoreEntry *entry = httpState->entry;
      httpState->ip_lookup_pending = 0;
+ 
      if (ia == NULL) {
  	debug(11, 4, "httpConnect: Unknown host: %s\n", request->host);
  	squid_error_entry(entry, ERR_DNS_FAIL, dns_error_message);
***************
*** 974,979 ****
--- 992,998 ----
      HttpStateData *httpState = data;
      request_t *request = httpState->request;
      StoreEntry *entry = httpState->entry;
+ 
      if (status != COMM_OK) {
  	squid_error_entry(entry, ERR_CONNECT_FAIL, xstrerror());
  	if (httpState->neighbor)
***************
*** 1000,1005 ****
--- 1019,1027 ----
  {
      /* Create state structure. */
      int sock;
+ #ifdef INET6
+     struct hostent *hp = NULL;
+ #endif
      HttpStateData *httpState = NULL;
  
      debug(11, 3, "httpStart: \"%s %s\"\n",
***************
*** 1007,1018 ****
--- 1029,1061 ----
      debug(11, 10, "httpStart: req_hdr '%s'\n", req_hdr);
  
      /* Create socket. */
+ #ifdef INET6
+     if ((hp = gethostbyname2(request->host,AF_INET6)) == NULL) {
+         if ((hp = gethostbyname(request->host)) == NULL) {
+ 	    debug(1, 0, "[SD]httpStart: Unknow address %s.\n", request->host);
+ 	}
+     }
+ 
+     if (hp->h_addrtype == AF_INET6) {
+         sock = 
+ 	  comm_open(SOCK_STREAM, 0,
+ 		    (struct sockaddr *)&Config.Addrs.tcp_outgoing6,
+ 		    0, COMM_NONBLOCKING, url);
+     } else if (hp->h_addrtype == AF_INET) {
+         sock = comm_open(SOCK_STREAM, 0,
+ 			 (struct sockaddr *)&Config.Addrs.tcp_outgoing,
+ 			 0, COMM_NONBLOCKING, url);
+     } else {
+         debug(1, 0, "[SD]httpStart: Unknow h_addrtype=%d.\n", hp->h_addrtype);
+     }
+ #else
      sock = comm_open(SOCK_STREAM,
  	0,
  	Config.Addrs.tcp_outgoing,
  	0,
  	COMM_NONBLOCKING,
  	url);
+ #endif
      if (sock == COMM_ERROR) {
  	debug(11, 4, "httpStart: Failed because we're out of sockets.\n");
  	squid_error_entry(entry, ERR_NO_FDS, xstrerror());
Index: squid11/src/icp.c
diff -c squid11/src/icp.c:1.1.1.1 squid11/src/icp.c:1.4
*** squid11/src/icp.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/icp.c	Thu Feb 18 02:05:04 1999
***************
*** 215,221 ****
      static double magic_factor = 100;
      double n_good;
      double n_bad;
- 
      if (hcode == HIER_NONE)
  	return;
      n_good = magic_factor / (1.0 + fail_ratio);
--- 215,220 ----
***************
*** 265,274 ****
--- 264,291 ----
      } else {
  	http_code = icpState->http_code;
      }
+ 
      elapsed_msec = tvSubMsec(icpState->start, current_time);
      if (icpState->request)
  	hierData = &icpState->request->hierarchy;
      if (icpState->size || icpState->log_type) {
+ #ifdef INET6
+ 	HTTPCacheInfo->log_append(HTTPCacheInfo,
+ 	    icpState->log_url,
+ 	    ((struct sockaddr_in *)&icpState->log_addr)->sin_addr,
+ 	    icpState->size,
+ 	    log_tags[icpState->log_type],
+ 	    RequestMethodStr[icpState->method],
+ 	    http_code,
+ 	    elapsed_msec,
+ 	    icpState->ident.ident,
+ 	    hierData,
+ #if LOG_FULL_HEADERS
+ 	    icpState->request_hdr,
+ 	    icpState->reply_hdr,
+ #endif /* LOG_FULL_HEADERS */
+ 	    content_type);
+ #else
  	HTTPCacheInfo->log_append(HTTPCacheInfo,
  	    icpState->log_url,
  	    icpState->log_addr,
***************
*** 284,295 ****
--- 301,319 ----
  	    icpState->reply_hdr,
  #endif /* LOG_FULL_HEADERS */
  	    content_type);
+ #endif
  	HTTPCacheInfo->proto_count(HTTPCacheInfo,
  	    icpState->request ? icpState->request->protocol : PROTO_NONE,
  	    icpState->log_type);
+ #ifdef INET6
+ 	clientdbUpdate(&icpState->peer,
+ 	    icpState->log_type,
+ 	    ntohs(((struct sockaddr_in *)&icpState->me)->sin_port));
+ #else
  	clientdbUpdate(icpState->peer.sin_addr,
  	    icpState->log_type,
  	    ntohs(icpState->me.sin_port));
+ #endif
      }
  #ifdef HIER_EXPERIMENT
      if (icpState->log_type == LOG_TCP_MISS)
***************
*** 517,523 ****
  {
      int buf_len = 0;
      char *buf = NULL;
- 
      icpState->log_type = errorCode;
      icpState->http_code = httpCode;
      if (icpState->entry && icpState->entry->mem_obj) {
--- 541,546 ----
***************
*** 620,625 ****
--- 643,649 ----
  	if (hack)
  	    *(buf + size++) = C;
      }
+ 
      comm_write(fd,
  	buf,
  	len,
***************
*** 737,744 ****
  #endif
  	icpState->log_type = LOG_TCP_IMS_HIT;
      entry->refcount++;
!     if (modifiedSince(entry, icpState->request))
  	return icpSendMoreData(fd, icpState);
      debug(12, 4, "icpGetHeadersForIMS: Not modified '%s'\n", entry->url);
      reply = icpConstruct304reply(mem->reply);
      comm_write(fd,
--- 761,769 ----
  #endif
  	icpState->log_type = LOG_TCP_IMS_HIT;
      entry->refcount++;
!     if (modifiedSince(entry, icpState->request)) {
  	return icpSendMoreData(fd, icpState);
+       }
      debug(12, 4, "icpGetHeadersForIMS: Not modified '%s'\n", entry->url);
      reply = icpConstruct304reply(mem->reply);
      comm_write(fd,
***************
*** 948,954 ****
--- 973,983 ----
  
      /* Check if this host is allowed to fetch MISSES from us */
      memset(&ch, '\0', sizeof(aclCheck_t));
+ #ifdef INET6
+     ch.src_addr = ((struct sockaddr_in *)&icpState->peer)->sin_addr;
+ #else
      ch.src_addr = icpState->peer.sin_addr;
+ #endif
      ch.request = requestLink(icpState->request);
      answer = aclCheck(MISSAccessList, &ch);
      requestUnlink(ch.request);
***************
*** 988,996 ****
--- 1017,1027 ----
      if (aclCheck(DelayAccessList, &ch))
  	_delay_fetch = 1;
  #endif
+ 
      return (protoDispatch(fd, url, icpState->entry, icpState->request));
  }
  
+ #ifdef INET6
  static void
  icpLogIcp(icpUdpData * queue)
  {
***************
*** 1003,1008 ****
--- 1034,1081 ----
      ICPCacheInfo->proto_count(ICPCacheInfo,
  	queue->proto,
  	queue->logcode);
+     if (queue->address.__ss_family == AF_INET6) {
+         debug(1,0,"[SD]icpLogIcp: Need IPv6!!\n");
+     } else if (queue->address.__ss_family == AF_INET) {
+         struct sockaddr_in* inaddr4p = (struct sockaddr_in *)&queue->address;
+         clientdbUpdate(&queue->address,queue->logcode,Config.Port.icp);
+         if (!Config.Options.log_udp)
+ 	    return;
+         HTTPCacheInfo->log_append(HTTPCacheInfo,urlClean(url),
+ 				  inaddr4p->sin_addr,queue->len,
+ 				  log_tags[queue->logcode],
+ 				  IcpOpcodeStr[ICP_OP_QUERY],
+ 				  0,
+ #ifndef LESS_TIMING
+ 				  tvSubMsec(queue->start, current_time),
+ #else
+ 				  0,
+ #endif
+ 				  NULL,			/* ident */
+ 				  NULL,			/* hierarchy data */
+ #if LOG_FULL_HEADERS
+ 				  NULL,			/* request header */
+ 				  NULL,			/* reply header */
+ #endif /* LOG_FULL_HEADERS */
+ 				  NULL);		/* content-type */
+     } else {
+         debug(1,0,"[SD]icpLogIcp: Unknow family=%d!!\n",
+ 	      queue->address.__ss_family);
+     }
+ }
+ #else
+ static void
+ icpLogIcp(icpUdpData * queue)
+ {
+     icp_common_t *header = (icp_common_t *) (void *) queue->msg;
+     char *url = (char *) header + sizeof(icp_common_t);
+ 
+     ICPCacheInfo->proto_touchobject(ICPCacheInfo,
+ 	queue->proto,
+ 	queue->len);
+     ICPCacheInfo->proto_count(ICPCacheInfo,
+ 	queue->proto,
+ 	queue->logcode);
      clientdbUpdate(queue->address.sin_addr,
  	queue->logcode,
  	Config.Port.icp);
***************
*** 1028,1039 ****
--- 1101,1118 ----
  #endif /* LOG_FULL_HEADERS */
  	NULL);			/* content-type */
  }
+ #endif // INET6
  
  int
  icpUdpReply(int fd, icpUdpData * queue)
  {
      int result = COMM_OK;
      int x;
+ #ifdef INET6
+     char vname[INET6_ADDRSTRLEN];
+     struct sockaddr_in*  inaddr4p;
+     struct sockaddr_in6* inaddr6p;
+ #endif
  
      /* Disable handler, in case of errors. */
      commSetSelect(fd,
***************
*** 1041,1046 ****
--- 1120,1150 ----
  	NULL,
  	NULL, 0);
      while ((queue = UdpQueueHead)) {
+ #ifdef INET6
+         if (queue->address.__ss_family == AF_INET6) {
+ 	      inaddr6p = (struct sockaddr_in6 *)&queue->address;
+ 	      inet_ntop(AF_INET6, &inaddr6p->sin6_addr, vname, sizeof vname);
+ 	      debug(12, 5,
+ 		    "icpUdpReply: FD %d sending %d bytes to %s port %d\n",
+ 		    fd,queue->len,vname,ntohs(inaddr6p->sin6_port));
+ 	      x = comm_udp_sendto(fd,&queue->address,
+ 				  sizeof(struct sockaddr_in6),
+  				  queue->msg,queue->len);
+ 	} else if (queue->address.__ss_family == AF_INET) {
+ 	      inaddr4p = (struct sockaddr_in4 *)&queue->address;
+ 	      debug(12, 5,
+ 		    "icpUdpReply: FD %d sending %d bytes to %s port %d\n",
+ 		    fd,queue->len,inet_ntoa(inaddr4p->sin_addr),
+ 		    ntohs(inaddr4p->sin_port));
+ 	      x = comm_udp_sendto(fd,&queue->address,
+ 				  sizeof(struct sockaddr_in),
+ 				  queue->msg,queue->len);
+ 	} else {
+ 	      debug(1, 0, "[SD]icpUdpReply: Unknow family=%d\n",
+ 		    queue->address.__ss_family);
+ 	      return COMM_ERROR;
+ 	}
+ #else
  	debug(12, 5, "icpUdpReply: FD %d sending %d bytes to %s port %d\n",
  	    fd,
  	    queue->len,
***************
*** 1051,1056 ****
--- 1155,1161 ----
  	    sizeof(struct sockaddr_in),
  	    queue->msg,
  	    queue->len);
+ #endif
  
  	if (x < 0) {
  	    if (errno == EWOULDBLOCK || errno == EAGAIN)
***************
*** 1152,1157 ****
--- 1257,1300 ----
      return buf;
  }
  
+ #ifdef INET6
+ void
+ icpUdpSend(int fd,
+     const struct sockaddr *to,
+     icp_common_t * msg,
+     log_type logcode,
+     protocol_t proto)
+ {
+     icpUdpData *data = xcalloc(1, sizeof(icpUdpData));
+ 
+     if (to->sa_family == AF_INET6) {
+         char vname[INET6_ADDRSTRLEN];
+         struct sockaddr_in6 *saddr6p = (struct sockaddr_in6 *)to;
+ 	inet_ntop(AF_INET6, &saddr6p->sin6_addr, vname, sizeof vname);
+         debug(12, 4, "icpUdpSend: Queueing %s for %s\n",
+ 	      IcpOpcodeStr[msg->opcode], vname);
+     } else if (to->sa_family == AF_INET) {
+         struct sockaddr_in *saddr4p = (struct sockaddr_in *)to;
+         debug(12, 4, "icpUdpSend: Queueing %s for %s\n",
+ 	      IcpOpcodeStr[msg->opcode], inet_ntoa(saddr4p->sin_addr));
+     } else {
+         debug(1, 0, "[SD]icpUdpSend: Unknow family %d.\n",to->sa_family);
+     }
+     data->address = *(struct sockaddr_storage *)to;
+     data->msg = msg;
+     data->len = (int) ntohs(msg->length);
+ #ifndef LESS_TIMING
+     data->start = current_time;	/* wrong for HIT_OBJ */
+ #endif
+     data->logcode = logcode;
+     data->proto = proto;
+     AppendUdp(data);
+     commSetSelect(fd,
+ 	COMM_SELECT_WRITE,
+ 	(PF) icpUdpReply,
+ 	(void *) UdpQueueHead, 0);
+ }
+ #else
  void
  icpUdpSend(int fd,
      const struct sockaddr_in *to,
***************
*** 1178,1183 ****
--- 1321,1327 ----
  	(PF) icpUdpReply,
  	(void *) UdpQueueHead, 0);
  }
+ #endif /* INET6 */
  
  static void
  icpHitObjHandler(int errflag, void *data)
***************
*** 1286,1291 ****
--- 1430,1444 ----
  	if (!allow) {
  	    debug(12, 2, "icpHandleIcpV2: Access Denied for %s by %s.\n",
  		inet_ntoa(from.sin_addr), AclMatchedName);
+ #ifdef INET6
+ 	    if (clientdbCutoffDenied(&from)) {
+ 		clientdbUpdate(&from, LOG_UDP_DENIED, Config.Port.icp);
+ 	    } else {
+ 		reply = icpCreateMessage(ICP_OP_DENIED, 0, url, header.reqnum, 0);
+ 		icpUdpSend(fd, (struct sokcaddr_storage *)&from, reply,
+ 			   LOG_UDP_DENIED, icp_request->protocol);
+ 	    }
+ #else
  	    if (clientdbCutoffDenied(from.sin_addr)) {
  		/*
  		 * count this DENIED query in the clientdb, even though
***************
*** 1296,1301 ****
--- 1449,1455 ----
  		reply = icpCreateMessage(ICP_OP_DENIED, 0, url, header.reqnum, 0);
  		icpUdpSend(fd, &from, reply, LOG_UDP_DENIED, icp_request->protocol);
  	    }
+ #endif
  	    break;
  	}
  	/* The peer is allowed to use this cache */
***************
*** 1326,1332 ****
--- 1480,1491 ----
  		safe_free(icpHitObjState);
  	    } else {
  		reply = icpCreateMessage(ICP_OP_HIT, flags, url, header.reqnum, src_rtt);
+ #ifdef INET6
+ 		icpUdpSend(fd, (struct sockaddr *)&from, reply,
+ 			   LOG_UDP_HIT, icp_request->protocol);
+ #else
  		icpUdpSend(fd, &from, reply, LOG_UDP_HIT, icp_request->protocol);
+ #endif
  		break;
  	    }
  	}
***************
*** 1337,1352 ****
--- 1496,1531 ----
  	/* if store is rebuilding, return a UDP_HIT, but not a MISS */
  	if (store_rebuilding == STORE_REBUILDING_FAST && opt_reload_hit_only) {
  	    reply = icpCreateMessage(ICP_OP_MISS_NOFETCH, flags, url, header.reqnum, src_rtt);
+ #ifdef INET6
+ 	    icpUdpSend(fd, (struct sockaddr *)&from, reply,
+ 		       LOG_UDP_MISS_NOFETCH, icp_request->protocol);
+ #else
  	    icpUdpSend(fd, &from, reply, LOG_UDP_MISS_NOFETCH, icp_request->protocol);
+ #endif
  	} else if (hit_only_mode_until > squid_curtime) {
  	    reply = icpCreateMessage(ICP_OP_MISS_NOFETCH, flags, url, header.reqnum, src_rtt);
+ #ifdef INET6
+ 	    icpUdpSend(fd, (struct sockaddr *)&from, reply,
+ 		       LOG_UDP_MISS_NOFETCH, icp_request->protocol);
+ #else
  	    icpUdpSend(fd, &from, reply, LOG_UDP_MISS_NOFETCH, icp_request->protocol);
+ #endif
  	} else if (Config.Options.test_reachability && rtt == 0) {
  	    reply = icpCreateMessage(ICP_OP_MISS_NOFETCH, flags, url, header.reqnum, src_rtt);
+ #ifdef INET6
+ 	    icpUdpSend(fd, (struct sockaddr *)&from, reply,
+ 		       LOG_UDP_MISS_NOFETCH, icp_request->protocol);
+ #else
  	    icpUdpSend(fd, &from, reply, LOG_UDP_MISS_NOFETCH, icp_request->protocol);
+ #endif
  	} else {
  	    reply = icpCreateMessage(ICP_OP_MISS, flags, url, header.reqnum, src_rtt);
+ #ifdef INET6
+ 	    icpUdpSend(fd, (struct sockaddr *)&from, reply,
+ 		       LOG_UDP_MISS, icp_request->protocol);
+ #else
  	    icpUdpSend(fd, &from, reply, LOG_UDP_MISS, icp_request->protocol);
+ #endif
  	}
  	break;
  
***************
*** 1443,1449 ****
--- 1622,1633 ----
  	url = buf + sizeof(header) + sizeof(u_num32);
  	if ((icp_request = urlParse(METHOD_GET, url)) == NULL) {
  	    reply = icpCreateMessage(ICP_OP_ERR, 0, url, header.reqnum, 0);
+ #ifdef INET6
+ 	    icpUdpSend(fd, (struct sockaddr *)&from, reply,
+ 		       LOG_UDP_INVALID, PROTO_NONE);
+ #else
  	    icpUdpSend(fd, &from, reply, LOG_UDP_INVALID, PROTO_NONE);
+ #endif
  	    break;
  	}
  	checklist.src_addr = from.sin_addr;
***************
*** 1452,1457 ****
--- 1636,1650 ----
  	if (!allow) {
  	    debug(12, 2, "icpHandleIcpV3: Access Denied for %s by %s.\n",
  		inet_ntoa(from.sin_addr), AclMatchedName);
+ #ifdef INET6
+ 	    if (clientdbCutoffDenied((struct sockaddr *)&from)) {
+ 		clientdbUpdate((struct sockaddr *)&from, LOG_UDP_DENIED, Config.Port.icp);
+ 	    } else {
+ 		reply = icpCreateMessage(ICP_OP_DENIED, 0, url, header.reqnum, 0);
+ 		icpUdpSend(fd, (struct sockaddr *)&from, reply,
+ 			   LOG_UDP_DENIED, icp_request->protocol);
+ 	    }
+ #else
  	    if (clientdbCutoffDenied(from.sin_addr)) {
  		/*
  		 * count this DENIED query in the clientdb, even though
***************
*** 1462,1467 ****
--- 1655,1661 ----
  		reply = icpCreateMessage(ICP_OP_DENIED, 0, url, header.reqnum, 0);
  		icpUdpSend(fd, &from, reply, LOG_UDP_DENIED, icp_request->protocol);
  	    }
+ #endif
  	    break;
  	}
  	/* The peer is allowed to use this cache */
***************
*** 1470,1488 ****
--- 1664,1702 ----
  	    IcpOpcodeStr[header.opcode]);
  	if (icpCheckUdpHit(entry, icp_request)) {
  	    reply = icpCreateMessage(ICP_OP_HIT, 0, url, header.reqnum, 0);
+ #ifdef INET6
+ 	    icpUdpSend(fd, (struct sockaddr *)&from, reply,
+ 		       LOG_UDP_HIT, icp_request->protocol);
+ #else
  	    icpUdpSend(fd, &from, reply, LOG_UDP_HIT, icp_request->protocol);
+ #endif
  	    break;
  	}
  	/* if store is rebuilding, return a UDP_HIT, but not a MISS */
  	if (opt_reload_hit_only && store_rebuilding == STORE_REBUILDING_FAST) {
  	    reply = icpCreateMessage(ICP_OP_MISS_NOFETCH, 0, url, header.reqnum, 0);
+ #ifdef INET6
+ 	    icpUdpSend(fd, (struct sockaddr *)&from, reply,
+ 		       LOG_UDP_MISS_NOFETCH, icp_request->protocol);
+ #else
  	    icpUdpSend(fd, &from, reply, LOG_UDP_MISS_NOFETCH, icp_request->protocol);
+ #endif
  	} else if (hit_only_mode_until > squid_curtime) {
  	    reply = icpCreateMessage(ICP_OP_MISS_NOFETCH, 0, url, header.reqnum, 0);
+ #ifdef INET6
+ 	    icpUdpSend(fd, (struct sockaddr *)&from, reply,
+ 		       LOG_UDP_MISS_NOFETCH, icp_request->protocol);
+ #else
  	    icpUdpSend(fd, &from, reply, LOG_UDP_MISS_NOFETCH, icp_request->protocol);
+ #endif
  	} else {
  	    reply = icpCreateMessage(ICP_OP_MISS, 0, url, header.reqnum, 0);
+ #ifdef INET6
+ 	    icpUdpSend(fd, (struct sockaddr *)&from, reply,
+ 		       LOG_UDP_MISS, icp_request->protocol);
+ #else
  	    icpUdpSend(fd, &from, reply, LOG_UDP_MISS, icp_request->protocol);
+ #endif
  	}
  	break;
  
***************
*** 1647,1652 ****
--- 1861,1871 ----
      int free_request = 0;
      int req_hdr_sz;
      int url_sz;
+ #ifdef INET6
+     char vname[INET6_ADDRSTRLEN];
+     struct sockaddr_in6 *inaddr6p;
+     struct sockaddr_in  *inaddr4p;
+ #endif
  
      /* Make sure a complete line has been received */
      if (strchr(icpState->inbuf, '\n') == NULL) {
***************
*** 1741,1750 ****
--- 1960,1991 ----
  	    /* Put the local socket IP address as the hostname */
  	    url_sz = strlen(url) + 32 + Config.appendDomainLen;
  	    icpState->url = xcalloc(url_sz, 1);
+ #ifdef INET6
+ 	    if (((struct sockaddr *)&icpState->me)->sa_family
+ 		== AF_INET6) {
+ 	        inaddr6p = (struct sockaddr_in6 *)&icpState->me;
+ 		if (inet_ntop(AF_INET6, &inaddr6p->sin6_addr, vname,
+ 			       sizeof vname) == 0) 
+ 		    return 0;
+ 		sprintf(icpState->url, "http://%s:%d%s",
+ 			vname, (int)Config.Accel.port, url);
+ 	    } else if (((struct sockaddr *)&icpState->me)->sa_family
+ 		      == AF_INET) {
+ 	        inaddr4p = (struct sockaddr_in *)&icpState->me;
+ 	          sprintf(icpState->url, "http://%s:%d%s",
+ 			  inet_ntoa(inaddr4p->sin_addr),
+ 			  (int) Config.Accel.port, url);
+ 	    } else {
+ 	        debug(1, 0, "[SD]parseHttpRequest: Unknow family %d\n",
+ 		      ((struct sockaddr *)&icpState->me)->sa_family);
+ 		return 0;
+ 	    }
+ #else
  	    sprintf(icpState->url, "http://%s:%d%s",
  		inet_ntoa(icpState->me.sin_addr),
  		(int) Config.Accel.port,
  		url);
+ #endif
  	    debug(12, 5, "VHOST REWRITE: '%s'\n", icpState->url);
  	} else {
  	    url_sz = strlen(Config.Accel.prefix) + strlen(url) +
***************
*** 1791,1796 ****
--- 2032,2038 ----
      len = icpState->inbufsize - icpState->in_offset - 1;
      debug(12, 4, "clientReadRequest: FD %d: reading request...\n", fd);
      debug(12, 4, "clientReadRequest: len = %d\n", len);
+ 
      size = read(fd, icpState->inbuf + icpState->in_offset, len);
  
      if (size == 0) {
***************
*** 1909,1918 ****
--- 2151,2167 ----
  	storeUnregister(entry, fd);
  	storeRegister(entry, fd, icpHandleAbort, (void *) icpState);
      }
+ #ifdef INET6
+     x = protoUnregister(fd,
+ 	entry,
+ 	icpState->request,
+ 	((struct sockaddr_in *)&icpState->peer)->sin_addr);
+ #else
      x = protoUnregister(fd,
  	entry,
  	icpState->request,
  	icpState->peer.sin_addr);
+ #endif
      if (x != 0)
  	return;
      if (entry == NULL)
***************
*** 1928,1935 ****
--- 2177,2190 ----
      int fd = -1;
      int lft = -1;
      icpStateData *icpState;
+ #ifdef INET6
      struct sockaddr_in peer;
      struct sockaddr_in me;
+     struct sockaddr_in* inaddr4p;
+ #else
+     struct sockaddr_in peer;
+     struct sockaddr_in me;
+ #endif
      int N = 10;
  
      while (N-- && fdstat_are_n_free_fd(RESERVED_FD)) {
***************
*** 1945,1950 ****
--- 2200,2206 ----
  		sock, xstrerror());
  	    return;
  	}
+ 
  	if (vizSock > -1)
  	    vizHackSendPkt(&peer, 1);
  	/* set the hardwired lifetime */
***************
*** 1963,1968 ****
--- 2219,2238 ----
  	icpState->inbufsize = ASCII_INBUF_BLOCKSIZE;
  	icpState->inbuf = xcalloc(icpState->inbufsize, 1);
  	icpState->header.shostid = peer.sin_addr.s_addr;
+ #ifdef INET6
+ 	inaddr4p = (struct sockaddr_in *)&icpState->peer;
+ 	*inaddr4p = peer;
+ 	inaddr4p = (struct sockaddr_in *)&icpState->log_addr;
+ 	*inaddr4p = peer;
+ 	inaddr4p->sin_addr.s_addr &= Config.Addrs.client_netmask.sin_addr.s_addr;
+ 	inaddr4p = (struct sockaddr_in *)&icpState->me;
+ 	*inaddr4p = me;
+ 	icpState->entry = NULL;
+ 	icpState->fd = fd;
+ 	icpState->ident.fd = -1;
+ 	inaddr4p = (struct sockaddr_in *)&icpState->log_addr;
+ 	fd_note(fd, inet_ntoa(inaddr4p->sin_addr));
+ #else
  	icpState->peer = peer;
  	icpState->log_addr = peer.sin_addr;
  	icpState->log_addr.s_addr &= Config.Addrs.client_netmask.s_addr;
***************
*** 1971,1976 ****
--- 2241,2247 ----
  	icpState->fd = fd;
  	icpState->ident.fd = -1;
  	fd_note(fd, inet_ntoa(icpState->log_addr));
+ #endif
  	meta_data.misc += ASCII_INBUF_BLOCKSIZE;
  	commSetSelect(fd,
  	    COMM_SELECT_LIFETIME,
***************
*** 2126,2135 ****
--- 2397,2413 ----
  	    storeUnregister(entry, fd);
  	    storeRegister(entry, fd, icpHandleAbort, (void *) icpState);
  	}
+ #ifdef INET6
+ 	protoUnregister(fd,
+ 	    entry,
+ 	    icpState->request,
+ 	    ((struct sockaddr_in *)&icpState->peer)->sin_addr);
+ #else
  	protoUnregister(fd,
  	    entry,
  	    icpState->request,
  	    icpState->peer.sin_addr);
+ #endif
  	comm_close(fd);
      } else {
  	debug(12, 5, "icpDetectClientClose: FD %d closed?\n", fd);
***************
*** 2282,2287 ****
--- 2560,2566 ----
  	comm_close(fd);
  	return;
      }
+ 
      icpSendERROR(fd,
  	entry->mem_obj->abort_code,
  	entry->mem_obj->e_abort_msg,
Index: squid11/src/icp.h
diff -c squid11/src/icp.h:1.1.1.1 squid11/src/icp.h:1.3
*** squid11/src/icp.h:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/icp.h	Thu Feb 18 02:05:05 1999
***************
*** 1,4 ****
- 
  /*
   * $Id: icp.h,v 1.64.2.8 1997/12/15 08:43:21 wessels Exp $
   *
--- 1,3 ----
***************
*** 148,154 ****
--- 147,157 ----
  #define ERR_MAX ERR_PROXY_DENIED
  
  typedef struct wwd {
+ #ifdef INET6
+     struct sockaddr_storage address;
+ #else
      struct sockaddr_in address;
+ #endif
      void *msg;
      size_t len;
      struct wwd *next;
***************
*** 184,192 ****
--- 187,201 ----
      int out_offset;
      log_type log_type;
      int http_code;
+ #ifdef INET6
+     struct sockaddr_storage peer;
+     struct sockaddr_storage me;
+     struct sockaddr_storage log_addr;
+ #else
      struct sockaddr_in peer;
      struct sockaddr_in me;
      struct in_addr log_addr;
+ #endif
      struct timeval start;
      int accel;
      int size;			/* hack for CONNECT which doesnt use sentry */
***************
*** 208,218 ****
--- 217,235 ----
  	const char *url,
  	int reqnum,
  	int pad));
+ #ifdef INET6
+ extern void icpUdpSend _PARAMS((int fd,
+ 	const struct sockaddr *,
+ 	icp_common_t * msg,
+ 	log_type,
+ 	protocol_t));
+ #else
  extern void icpUdpSend _PARAMS((int fd,
  	const struct sockaddr_in *,
  	icp_common_t * msg,
  	log_type,
  	protocol_t));
+ #endif
  extern void icpHandleUdp _PARAMS((int sock, void *data));
  extern void asciiHandleConn _PARAMS((int sock, void *data));
  extern void icpSendERROR _PARAMS((int fd,
Index: squid11/src/ident.c
diff -c squid11/src/ident.c:1.1.1.1 squid11/src/ident.c:1.2
*** squid11/src/ident.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/ident.c	Tue Feb 16 18:18:53 1999
***************
*** 51,62 ****
--- 51,67 ----
      icpState->ident.callback = callback;
      icpState->ident.state = IDENT_PENDING;
      if (fd < 0) {
+ #ifdef INET6
+ 	fd = comm_open(SOCK_STREAM, 0, &icpState->me, 0, COMM_NONBLOCKING,
+ 		       "ident");
+ #else
  	fd = comm_open(SOCK_STREAM,
  	    0,
  	    icpState->me.sin_addr,
  	    0,
  	    COMM_NONBLOCKING,
  	    "ident");
+ #endif
  	if (fd == COMM_ERROR) {
  	    identCallback(icpState);
  	    return;
***************
*** 66,76 ****
--- 71,89 ----
      comm_add_close_handler(fd,
  	(PF) identClose,
  	(void *) icpState);
+ #ifdef INET6
      commConnectStart(fd,
+ 	inet_ntoa(((struct sockaddr_in *)&icpState->peer)->sin_addr),
+ 	IDENT_PORT,
+ 	identConnectDone,
+ 	icpState);
+ #else
+     commConnectStart(fd,
  	inet_ntoa(icpState->peer.sin_addr),
  	IDENT_PORT,
  	identConnectDone,
  	icpState);
+ #endif
  }
  
  static void
***************
*** 83,91 ****
--- 96,110 ----
  	identCallback(icpState);
  	return;
      }
+ #ifdef INET6
+     sprintf(reqbuf, "%d, %d\r\n",
+ 	ntohs(((struct sockaddr_in *)&icpState->peer)->sin_port),
+ 	ntohs(((struct sockaddr_in *)&icpState->me)->sin_port));
+ #else
      sprintf(reqbuf, "%d, %d\r\n",
  	ntohs(icpState->peer.sin_port),
  	ntohs(icpState->me.sin_port));
+ #endif
      comm_write(fd,
  	reqbuf,
  	strlen(reqbuf),
Index: squid11/src/ipcache.c
diff -c squid11/src/ipcache.c:1.1.1.1 squid11/src/ipcache.c:1.4
*** squid11/src/ipcache.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/ipcache.c	Thu Feb 18 02:05:07 1999
***************
*** 245,254 ****
--- 245,261 ----
  	return;
      }
      if (i->status == IP_CACHED) {
+ #ifdef INET6
+ 	safe_free(i->addrs.address);
+ #ifdef RETRY_PATCH
+ 	safe_free(i->addrs.bad_addrs);
+ #endif /* RETRY_PATCH */
+ #else
  	safe_free(i->addrs.in_addrs);
  #ifdef RETRY_PATCH
  	safe_free(i->addrs.bad_addrs);
  #endif /* RETRY_PATCH */
+ #endif /* INET6 */
  	debug(14, 5, "ipcache_release: Released IP cached record for '%s'.\n",
  	    i->name);
      }
***************
*** 266,271 ****
--- 273,279 ----
      hash_link *e;
      static ipcache_entry *i;
  
+ 
      i = NULL;
      if (ip_table) {
  	if ((e = hash_lookup(ip_table, name)) != NULL)
***************
*** 420,440 ****
--- 428,475 ----
  {
      int addr_count = 0;
      int k;
+ #ifdef INET6
+     safe_free(i->addrs.address);
+ #ifdef RETRY_PATCH
+     safe_free(i->addrs.bad_addrs);
+ #endif /* RETRY_PATCH */
+ #else 
      safe_free(i->addrs.in_addrs);
  #ifdef RETRY_PATCH
      safe_free(i->addrs.bad_addrs);
  #endif /* RETRY_PATCH */
+ #endif /* INET6 */
      while ((addr_count < 255) && *(hp->h_addr_list + addr_count))
  	++addr_count;
      i->addrs.count = (unsigned char) addr_count;
+ #ifdef INET6
+     i->addrs.address = xcalloc(addr_count, sizeof(struct sockaddr_storage));
+ #else
      i->addrs.in_addrs = xcalloc(addr_count, sizeof(struct in_addr));
+ #endif
  #ifdef RETRY_PATCH
      i->addrs.bad_addrs = xcalloc(addr_count, sizeof(unsigned char));
      i->addrs.badcount = 0;
      for (k = 0; k < addr_count; k++) {
+ #ifdef INET6
+         if (hp->h_addrtype == AF_INET6) {
+ 	    struct sockaddr_in6 *saddr6p = 
+ 	      (struct sockaddr_in6 *)&i->addrs.address[k];
+ 	    xmemcpy(&saddr6p->sin6_addr,
+ 		    *(hp->h_addr_list + k),
+ 		    hp->h_length);
+ 	} else {
+ 	    struct sockaddr_in *saddr4p = 
+ 	      (struct sockaddr_in *)&i->addrs.address[k];
+ 	    xmemcpy(&saddr4p->sin_addr,
+ 		    *(hp->h_addr_list + k),
+ 		    hp->h_length);
+ 	}
+ #else
  	xmemcpy(&i->addrs.in_addrs[k].s_addr,
  	    *(hp->h_addr_list + k),
  	    hp->h_length);
+ #endif
  	i->addrs.bad_addrs[k] = FALSE;
      }
  #else
***************
*** 533,543 ****
--- 568,587 ----
  	    ipcount = atoi(token);
  	    i.addrs.count = (unsigned char) ipcount;
  	    if (ipcount == 0) {
+ #ifdef INET6
+ 		i.addrs.address = NULL;
+ #else
  		i.addrs.in_addrs = NULL;
+ #endif
  #ifdef RETRY_PATCH
  		i.addrs.bad_addrs = NULL;
  	    } else {
+ #ifdef INET6
+ 		i.addrs.address = 
+ 		  xcalloc(ipcount, sizeof(struct sockaddr_storage));
+ #else
  		i.addrs.in_addrs = xcalloc(ipcount, sizeof(struct in_addr));
+ #endif
  		i.addrs.bad_addrs = xcalloc(ipcount, sizeof(unsigned char));
  #else /* RETRY_PATCH */
  	    } else {
***************
*** 547,554 ****
--- 591,603 ----
  	    for (k = 0; k < ipcount; k++) {
  		if ((token = strtok(NULL, w_space)) == NULL)
  		    fatal_dump("Invalid IP address");
+ #ifdef INET6
+ 		if (!safe_inet_sockaddr(token, &i.addrs.address[k]))
+ 		    fatal_dump("Invalid IP address");
+ #else
  		if (!safe_inet_addr(token, &i.addrs.in_addrs[k]))
  		    fatal_dump("Invalid IP address");
+ #endif
  	    }
  	} else if (!strcmp(token, "$aliascount")) {
  	    if ((token = strtok(NULL, w_space)) == NULL)
***************
*** 797,803 ****
--- 846,856 ----
  
      ip_table = hash_create(urlcmp, 229, hash4);		/* small hash table */
      memset(&static_addrs, '\0', sizeof(ipcache_addrs));
+ #ifdef INET6
+     static_addrs.address = xcalloc(1, sizeof(struct sockaddr_storage));
+ #else
      static_addrs.in_addrs = xcalloc(1, sizeof(struct in_addr));
+ #endif
  #ifdef RETRY_PATCH
      static_addrs.bad_addrs = xcalloc(1, sizeof(unsigned char));
  #endif /* RETRY_PATCH */
***************
*** 844,849 ****
--- 897,903 ----
  	fatal_dump("ipcache_gethostbyname: NULL name");
      debug(14, 3, "ipcache_gethostbyname: '%s', flags=%x\n", name, flags);
      IpcacheStats.requests++;
+ 
      if ((i = ipcache_get(name))) {
  	if (ipcacheExpiredEntry(i)) {
  	    ipcache_release(i);
***************
*** 866,873 ****
--- 920,929 ----
  	    return &i->addrs;
  	}
      }
+ 
      if ((addrs = ipcacheCheckNumeric(name)))
  	return addrs;
+ 
      IpcacheStats.misses++;
      if (BIT_TEST(flags, IP_BLOCKING_LOOKUP)) {
  	if (NDnsServersAlloc)
***************
*** 886,894 ****
--- 942,968 ----
  		static_addrs.badcount = 0;
  		static_addrs.bad_addrs[0] = FALSE;
  #endif /* RETRY_PATCH */
+ #ifdef INET6
+ 		if (hp->h_addrtype == AF_INET6) {
+ 		    struct sockaddr_in6 *saddr6p = 
+ 		      (struct sockaddr_in6 *)&i->addrs.address[0];
+ 		    saddr6p->sin6_family = AF_INET6;
+ 		    xmemcpy(&saddr6p->sin6_addr,
+ 			    *(hp->h_addr_list),
+ 			    hp->h_length);
+ 		} else {
+ 		    struct sockaddr_in *saddr4p = 
+ 		      (struct sockaddr_in *)&i->addrs.address[0];
+ 		    saddr4p->sin_family = AF_INET;
+ 		    xmemcpy(&saddr4p->sin_addr,
+ 			    *(hp->h_addr_list),
+ 			    hp->h_length);
+ 		}
+ #else
  		xmemcpy(&static_addrs.in_addrs[0].s_addr,
  		    *(hp->h_addr_list),
  		    hp->h_length);
+ #endif
  		return &static_addrs;
  	    } else {
  		ipcacheAddHostent(i, hp);
***************
*** 935,942 ****
--- 1009,1034 ----
  #endif /* RETRY_PATCH */
      for (k = 0; k < (int) i->addrs.count; k++)
  #ifdef RETRY_PATCH
+ #ifdef INET6
+         if (i->addrs.address[k].__ss_family == AF_INET6) {
+ 	    struct sockaddr_in6 *saddr6p = 
+ 	      (struct sockaddr_in6 *)&i->addrs.address[k];
+ 	    char vname[INET6_ADDRSTRLEN];
+ 	    inet_ntop(AF_INET6, &saddr6p->sin6_addr, vname, sizeof vname);
+ 	    storeAppendPrintf(sentry, " %15s-%3s", vname,
+ 			      i->addrs.bad_addrs[k] ? "BAD" : "OK ");
+         } else if (i->addrs.address[k].__ss_family == AF_INET) {
+ 	    struct sockaddr_in *saddr4p = 
+ 	      (struct sockaddr_in *)&i->addrs.address[k];
+ 	    storeAppendPrintf(sentry,
+ 			      " %15s-%3s", inet_ntoa(saddr4p->sin_addr),
+ 			      i->addrs.bad_addrs[k] ? "BAD" : "OK ");
+ 	} else {
+ 	}
+ #else
  	storeAppendPrintf(sentry, " %15s-%3s", inet_ntoa(i->addrs.in_addrs[k]),
  	    i->addrs.bad_addrs[k] ? "BAD" : "OK ");
+ #endif
  #else
  	storeAppendPrintf(sentry, " %15s", inet_ntoa(i->addrs.in_addrs[k]));
  #endif /* RETRY_PATCH */
***************
*** 1047,1052 ****
--- 1139,1158 ----
  ipcache_addrs *
  ipcacheCheckNumeric(const char *name)
  {
+ #ifdef INET6
+     struct sockaddr_storage ip;
+     /* check if it's already a IP address in text form. */
+ 
+     if (!safe_inet_sockaddr(name, &ip))
+ 	return NULL;
+     static_addrs.count = 1;
+     static_addrs.cur = 0;
+     static_addrs.address[0] = ip;
+ #ifdef RETRY_PATCH
+     static_addrs.bad_addrs[0] = FALSE;
+     static_addrs.badcount = 0;
+ #endif /* RETRY_PATCH */
+ #else
      struct in_addr ip;
      /* check if it's already a IP address in text form. */
      if (!safe_inet_addr(name, &ip))
***************
*** 1058,1063 ****
--- 1164,1170 ----
      static_addrs.bad_addrs[0] = FALSE;
      static_addrs.badcount = 0;
  #endif /* RETRY_PATCH */
+ #endif
      return &static_addrs;
  }
  
***************
*** 1117,1122 ****
--- 1224,1274 ----
   * to be retried as a last resort before returning an error to
   * the user.
   */
+ #ifdef INET6
+ void
+ ipcacheMarkBadAddr(const char *name, struct sockaddr *addr)
+ {
+     ipcache_entry *i;
+     ipcache_addrs *ia;
+     int k;
+     if ((i = ipcache_get(name)) == NULL)
+ 	return;
+     ia = &i->addrs;
+     for (k = 0; k < (int) ia->count; k++) {
+         if (ia->address[k].__ss_family == addr->sa_family) {
+ 	    if (ia->address[k].__ss_family == AF_INET6) {
+ 	        if (IN6_ARE_ADDR_EQUAL((&((struct sockaddr_in6 *)&ia->address[k])->sin6_addr),
+ 				       (&((struct sockaddr_in6 *)addr)->sin6_addr)))
+ 		    debug(1, 0, "[SD]ipcacheMarkBadAddr: IPv6 Code(1)!!\n");
+ 		    break;
+ 
+ 	    } else if (ia->address[k].__ss_family == AF_INET) {
+ 		if (((struct sockaddr_in *)&ia->address[k])->sin_addr.s_addr ==
+ 		    ((struct sockaddr_in *)addr)->sin_addr.s_addr)
+ 		    break;
+ 	    }
+ 	}
+     }
+     if (k == (int) ia->count)
+ 	return;
+     if (!ia->bad_addrs[k]) {
+ 	ia->bad_addrs[k] = TRUE; ia->badcount++;
+ 	if (ia->address[k].__ss_family == AF_INET6) {
+ 	    debug(1, 0, "[SD]ipcacheMarkBadAddr: IPv6 Code(2)!!\n");
+ 	} else if (ia->address[k].__ss_family == AF_INET) {
+ 	  struct sockaddr_in *saddr4p = (struct sockaddr_in *)&ia->address[k];
+ 	  debug(14,1,"%s(%s) marked bad\n",name,inet_ntoa(saddr4p->sin_addr));
+ 	}
+ 	if (ia->badcount != ia->count) {  /* at least one good address left */
+ 	    i->expires = squid_curtime + Config.positiveDnsTtl;
+ 	    while (ia->bad_addrs[ia->cur])
+ 		if (++ia->cur == ia->count) ia->cur = 0;
+ 	    return;
+ 	}
+     }
+     if (++ia->cur == ia->count) ia->cur = 0;
+ }
+ #else
  void
  ipcacheMarkBadAddr(const char *name, struct in_addr addr)
  {
***************
*** 1144,1151 ****
--- 1296,1339 ----
      }
      if (++ia->cur == ia->count) ia->cur = 0;
  }
+ #endif
  
+ #ifdef INET6
  void
+ ipcacheMarkGoodAddr(const char *name, struct sockaddr *addr)
+ {
+     ipcache_entry *i;
+     ipcache_addrs *ia;
+     int k;
+     if ((i = ipcache_get(name)) == NULL)
+ 	return;
+     ia = &i->addrs;
+     for (k = 0; k < (int) ia->count; k++) {
+ 
+         if (ia->address[k].__ss_family == addr->sa_family) {
+ 	    if (ia->address[k].__ss_family == AF_INET6) {
+ 	        if (IN6_ARE_ADDR_EQUAL((&((struct sockaddr_in6 *)&ia->address[k])->sin6_addr),
+ 				       (&((struct sockaddr_in6 *)addr)->sin6_addr)))
+ 		    break;
+ 	    debug(1, 0, "[SD]ipcacheMarkGoodAddr: IPv6 Code!!\n");
+ 	    } else if (ia->address[k].__ss_family == AF_INET) {
+ 		if (((struct sockaddr_in *)&ia->address[k])->sin_addr.s_addr ==
+ 		    ((struct sockaddr_in *)addr)->sin_addr.s_addr)
+ 		    break;
+ 	    }
+ 	}
+     }
+     if (k == (int) ia->count)
+ 	return;
+     i->expires = squid_curtime + Config.positiveDnsTtl;
+     if (ia->bad_addrs[k]) {
+ 	ia->bad_addrs[k] = FALSE; ia->badcount--;
+ 	i->expires = squid_curtime + Config.positiveDnsTtl;
+ 	/*debug(14, 1, "%s(%s) marked good\n", name, inet_ntoa(ia->in_addrs[k]));*/
+     }
+ }
+ #else
+ void
  ipcacheMarkGoodAddr(const char *name, struct in_addr addr)
  {
      ipcache_entry *i;
***************
*** 1167,1172 ****
--- 1355,1361 ----
  	debug(14, 1, "%s(%s) marked good\n", name, inet_ntoa(ia->in_addrs[k]));
      }
  }
+ #endif
  
  #else /* RETRY_PATCH */
  
***************
*** 1221,1227 ****
--- 1410,1420 ----
      }
      for (j = 0; j < k; j++) {
  	i = *(list + j);
+ #ifdef INET6
+ 	safe_free(i->addrs.address);
+ #else
  	safe_free(i->addrs.in_addrs);
+ #endif
  #ifdef RETRY_PATCH
  	safe_free(i->addrs.bad_addrs);
  #endif
Index: squid11/src/ipcache.h
diff -c squid11/src/ipcache.h:1.1.1.1 squid11/src/ipcache.h:1.3
*** squid11/src/ipcache.h:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/ipcache.h	Thu Feb 18 02:05:08 1999
***************
*** 125,131 ****
--- 125,135 ----
      unsigned char badcount;
      unsigned char *bad_addrs;
  #endif /* RETRY_PATCH */
+ #ifdef INET6
+     struct sockaddr_storage *address;
+ #else
      struct in_addr *in_addrs;
+ #endif
  } ipcache_addrs;
  
  typedef struct _ipcache_entry {
***************
*** 160,167 ****
--- 164,178 ----
  extern void ipcacheOpenServers _PARAMS((void));
  extern void ipcacheCycleAddr _PARAMS((const char *name));
  #ifdef RETRY_PATCH
+ #ifdef INET6
+ extern void ipcacheMarkBadAddr _PARAMS((const char *name,
+ 					struct sockaddr *));
+ extern void ipcacheMarkGoodAddr _PARAMS((const char *name,
+ 					 struct sockaddr *));
+ #else
  extern void ipcacheMarkBadAddr _PARAMS((const char *name, struct in_addr));
  extern void ipcacheMarkGoodAddr _PARAMS((const char *name, struct in_addr));
+ #endif
  #else
  extern void ipcacheRemoveBadAddr _PARAMS((const char *name, struct in_addr));
  #endif /* RETRY_PATCH */
Index: squid11/src/main.c
diff -c squid11/src/main.c:1.1.1.1 squid11/src/main.c:1.3
*** squid11/src/main.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/main.c	Thu Feb 18 02:05:09 1999
***************
*** 105,114 ****
--- 105,121 ----
  
  #include "squid.h"
  
+ int _dlevel = V6DLEVEL;
+ 
  time_t squid_starttime = 0;
  int theHttpConnection = -1;
  int theInIcpConnection = -1;
  int theOutIcpConnection = -1;
+ #ifdef INET6
+ int theHttpConnection6   = -1;
+ int theInIcpConnection6  = -1;
+ int theOutIcpConnection6 = -1;
+ #endif
  int vizSock = -1;
  int do_reuse = 1;
  int opt_unlink_on_reload = 0;
***************
*** 124,129 ****
--- 131,139 ----
  int opt_mem_pools = 1;
  int opt_forwarded_for = 1;
  int opt_accel_uses_host = 0;
+ #ifdef INET6
+ int used_ip_type = 0x03; /* IPv4 = 0x01, IPv6 = 0x02, IPv4/IPv6 = 0x03 */
+ #endif
  int vhost_mode = 0;
  int Squid_MaxFD = SQUID_MAXFD;
  int Biggest_FD = -1;
***************
*** 135,141 ****
--- 145,159 ----
  const char *const version_string = SQUID_VERSION;
  const char *const appname = "squid";
  const char *const localhost = "127.0.0.1";
+ #ifdef INET6
+ const char *const localhost6 = "::1";
+ struct sockaddr_in  local_addr;
+ struct sockaddr_in6 local_addr6;
+ struct in6_addr no_addr6;
+ struct in6_addr theOutICPAddr6;
+ #else
  struct in_addr local_addr;
+ #endif
  struct in_addr no_addr;
  struct in_addr theOutICPAddr;
  const char *const dash_str = "-";
***************
*** 148,154 ****
--- 166,177 ----
  static volatile int rotate_pending = 0;		/* set by SIGUSR1 handler */
  static int httpPortNumOverride = 1;
  static int icpPortNumOverride = 1;	/* Want to detect "-u 0" */
+ #ifdef INET6
+ static struct sockaddr_in  any_addr;
+ static struct sockaddr_in6 any_addr6;
+ #else
  static struct in_addr any_addr;
+ #endif
  #if MALLOC_DBG
  static int malloc_debug_level = 0;
  #endif
***************
*** 170,175 ****
--- 193,201 ----
  	"Usage: %s [-hsvzCDFRUVY] [-f config-file] [-[au] port] [-k signal]\n"
  	"       -a port   Specify ASCII port number (default: %d).\n"
  	"       -b        Buffer log output (default is unbuffered).\n"
+ #ifdef INET6
+ 	"       -d level  debug level.(trial).\n"
+ #endif
  	"       -f file   Use given config-file instead of\n"
  	"                 %s\n"
  	"       -h        Print help message.\n"
***************
*** 183,188 ****
--- 209,217 ----
  	"       -C        Do not catch fatal signals.\n"
  	"       -D        Disable initial DNS tests.\n"
  	"       -F        Foreground fast store rebuild.\n"
+ #ifdef INET6
+ 	"       -I        IPv4 Only=4, IPv6 Only=6 (default IPv6 and IPv4)\n"
+ #endif
  	"       -R        Do not set REUSEADDR on port.\n"
  	"       -U        Unlink expired objects on reload.\n"
  	"       -V        Virtual host httpd-accelerator.\n"
***************
*** 197,203 ****
      extern char *optarg;
      int c;
  
!     while ((c = getopt(argc, argv, "CDFRUVYXa:bf:hik:m:su:vz?")) != -1) {
  	switch (c) {
  	case 'C':
  	    opt_catch_signals = 0;
--- 226,236 ----
      extern char *optarg;
      int c;
  
! #ifdef INET6
!     while ((c = getopt(argc, argv, "CDFI:RUVYXa:bd:f:hik:m:su:vz?")) != -1) {
! #else
!     while ((c = getopt(argc, argv, "CDF:RUVYXa:bf:hik:m:su:vz?")) != -1) {
! #endif
  	switch (c) {
  	case 'C':
  	    opt_catch_signals = 0;
***************
*** 208,213 ****
--- 241,258 ----
  	case 'F':
  	    opt_foreground_rebuild = 1;
  	    break;
+ #ifdef INET6
+ 	case 'I':
+ 	    switch (atoi(optarg)) {
+ 	    case 4:
+ 	      used_ip_type = 0x01;
+ 	    case 6:
+ 	      used_ip_type = 0x02;
+ 	    default:
+ 	      break;
+ 	    }
+ 	    break;
+ #endif
  	case 'R':
  	    do_reuse = 0;
  	    break;
***************
*** 230,235 ****
--- 275,283 ----
  	case 'b':
  	    unbuffered_logs = 0;
  	    break;
+ 	case 'd': /* Unoffical option */
+ 	    _dlevel = atoi(optarg);
+ 	    break;
  	case 'f':
  	    xfree(ConfigFile);
  	    ConfigFile = xstrdup(optarg);
***************
*** 340,352 ****
--- 388,434 ----
  static void
  serverConnectionsOpen(void)
  {
+ #ifndef INET6
      struct in_addr addr;
+ #endif
      struct sockaddr_in xaddr;
+ #ifdef INET6
+     struct sockaddr_in6 xaddr6;
+ #endif
      u_short port;
      int len;
      int x;
      enter_suid();
+ #ifdef INET6
+ 
      theHttpConnection = comm_open(SOCK_STREAM,
+ 	0, (struct sockaddr *)&Config.Addrs.tcp_incoming,
+ 	Config.Port.http, COMM_NONBLOCKING, "IPv4 HTTP Port");
+     if (theHttpConnection < 0) { /* IPv4 */
+ 	fatal("Cannot open HTTP Port");
+     }
+     fd_note(theHttpConnection, "HTTP socket");
+     comm_listen(theHttpConnection);
+     commSetSelect(theHttpConnection,
+ 	COMM_SELECT_READ,
+ 	asciiHandleConn,
+ 	NULL, 0);
+ 
+     theHttpConnection6 = comm_open(SOCK_STREAM,
+ 	0, (struct sockaddr *)&Config.Addrs.tcp_incoming6,
+ 	Config.Port.http, COMM_NONBLOCKING, "IPv6 HTTP Port");
+     leave_suid();
+     if (theHttpConnection6 < 0) { /* IPv6 */
+ 	fatal("Cannot open IPv6 HTTP Port");
+     }
+     fd_note(theHttpConnection, "HTTP socket");
+     comm_listen(theHttpConnection6);
+     commSetSelect(theHttpConnection6,
+ 	COMM_SELECT_READ,
+ 	asciiHandleConn,
+ 	NULL, 0);
+ #else
+     theHttpConnection = comm_open(SOCK_STREAM,
  	0,
  	Config.Addrs.tcp_incoming,
  	Config.Port.http,
***************
*** 364,370 ****
--- 446,554 ----
  	NULL, 0);
      debug(1, 1, "Accepting HTTP connections on FD %d.\n",
  	theHttpConnection);
+ #endif
+ 
+ #ifdef INET6
+     if (!httpd_accel_mode || Config.Accel.withProxy) {
+ 	if ((port = Config.Port.icp) > (u_short) 0) {
+ 	    enter_suid();
+ 	    theInIcpConnection = comm_open(SOCK_DGRAM,
+ 		0, (struct sockaddr *)&Config.Addrs.udp_incoming,
+ 		port, COMM_NONBLOCKING,	"ICP Port");
+ 
+ 	    leave_suid();
+ 	    if (theInIcpConnection < 0)
+ 		fatal("Cannot open ICP Port");
+ 	    fd_note(theInIcpConnection, "ICP socket");
+ 	    commSetSelect(theInIcpConnection,
+ 		COMM_SELECT_READ,
+ 		icpHandleUdp,
+ 		NULL, 0);
+ 	    comm_join_mcast_groups(theInIcpConnection);
+ 	    debug(1, 1, "Accepting ICP connections on FD %d.\n",
+ 		theInIcpConnection);
+ 
+ 	    if (((struct sockaddr_in *)&Config.Addrs.udp_outgoing)->sin_addr.s_addr != no_addr.s_addr) {
+ 		enter_suid();
+ 		theOutIcpConnection = comm_open(SOCK_DGRAM,
+ 		    0, (struct sockaddr *)&Config.Addrs.udp_outgoing,
+ 		    port, COMM_NONBLOCKING, "ICP Port");
+ 		leave_suid();
+ 		if (theOutIcpConnection < 0)
+ 		    fatal("Cannot open Outgoing ICP Port");
+ 		commSetSelect(theOutIcpConnection,
+ 		    COMM_SELECT_READ,
+ 		    icpHandleUdp,
+ 		    NULL, 0);
+ 		debug(1, 1, "Accepting ICP connections on FD %d.\n",
+ 		    theOutIcpConnection);
+ 		fd_note(theOutIcpConnection, "Outgoing ICP socket");
+ 		fd_note(theInIcpConnection, "Incoming ICP socket");
+ 	    } else {
+ 		theOutIcpConnection = theInIcpConnection;
+ 	    }
+ 	    memset(&theOutICPAddr, '\0', sizeof(struct in_addr));
+ 	    len = sizeof(struct sockaddr_in);
+ 	    memset(&xaddr, '\0', len);
+ 	    x = getsockname(theOutIcpConnection,
+ 		(struct sockaddr *) &xaddr, &len);
+ 	    if (x < 0)
+ 		debug(50, 1, "theOutIcpConnection FD %d: getsockname: %s\n",
+ 		    theOutIcpConnection, xstrerror());
+ 	    else
+ 		theOutICPAddr = xaddr.sin_addr;
+ 	    /**** IPv6 ICP Handle ***/
+ 
+ 	    enter_suid();
+ 	    theInIcpConnection6 = comm_open(SOCK_DGRAM,
+ 		0, (struct sockaddr *)&Config.Addrs.udp_incoming6,
+ 		port, COMM_NONBLOCKING,	"ICP6 Port");
  
+ 	    leave_suid();
+ 	    if (theInIcpConnection6 < 0)
+ 		fatal("Cannot open IPv6 ICP Port");
+ 	    fd_note(theInIcpConnection6, "ICP6 socket");
+ 	    commSetSelect(theInIcpConnection6,
+ 		COMM_SELECT_READ,
+ 		icpHandleUdp,
+ 		NULL, 0);
+ 	    comm_join_mcast_groups(theInIcpConnection6);
+ 	    debug(1, 1, "Accepting IPv6 ICP connections on FD %d.\n",
+ 		theInIcpConnection6);
+ 
+ 	    if (!IN6_ARE_ADDR_EQUAL((&((struct sockaddr_in6 *)&Config.Addrs.udp_outgoing6)->sin6_addr),(&no_addr6))) {
+ 		enter_suid();
+ 		theOutIcpConnection6 = comm_open(SOCK_DGRAM,
+ 		    0, (struct sockaddr *)&Config.Addrs.udp_outgoing6,
+ 		    port, COMM_NONBLOCKING, "ICP6 Port");
+ 		leave_suid();
+ 		if (theOutIcpConnection6 < 0)
+ 		    fatal("Cannot open Outgoing IPv6 ICP Port");
+ 		commSetSelect(theOutIcpConnection6,
+ 		    COMM_SELECT_READ,
+ 		    icpHandleUdp,
+ 		    NULL, 0);
+ 		debug(1, 1, "Accepting ICP connections on FD %d.\n",
+ 		    theOutIcpConnection6);
+ 		fd_note(theOutIcpConnection6, "Outgoing ICP socket");
+ 		fd_note(theInIcpConnection6, "Incoming ICP socket");
+ 	    } else {
+ 		theOutIcpConnection6 = theInIcpConnection6;
+ 	    }
+ 	    memset(&theOutICPAddr6, '\0', sizeof(struct in6_addr));
+ 	    len = sizeof(struct sockaddr_in6);
+ 	    memset(&xaddr6, '\0', len);
+ 	    x = getsockname(theOutIcpConnection6,
+ 		(struct sockaddr *) &xaddr6, &len);
+ 	    if (x < 0)
+ 		debug(50, 1, "theOutIcpConnection6 FD %d: getsockname: %s\n",
+ 		    theOutIcpConnection6, xstrerror());
+ 	    else
+ 		theOutICPAddr6 = xaddr6.sin6_addr;
+ 	    /*** IPv6 ICP Handle end ***/
+ 	}
+     }
+ #else
      if (!httpd_accel_mode || Config.Accel.withProxy) {
  	if ((port = Config.Port.icp) > (u_short) 0) {
  	    enter_suid();
***************
*** 374,379 ****
--- 558,564 ----
  		port,
  		COMM_NONBLOCKING,
  		"ICP Port");
+ 
  	    leave_suid();
  	    if (theInIcpConnection < 0)
  		fatal("Cannot open ICP Port");
***************
*** 420,435 ****
--- 605,658 ----
  		theOutICPAddr = xaddr.sin_addr;
  	}
      }
+ #endif
      if (Config.vizHack.port) {
+ #ifdef INET6
+ 	vizSock = comm_open(SOCK_DGRAM, 0,(struct sockaddr *)&any_addr,
+ 			    0, COMM_NONBLOCKING, "VizHack Port");
+ #else
  	vizSock = comm_open(SOCK_DGRAM,
  	    0,
  	    any_addr,
  	    0,
  	    COMM_NONBLOCKING,
  	    "VizHack Port");
+ #endif
  	if (vizSock < 0)
  	    fatal("Could not open Viz Socket");
  #if defined(IP_ADD_MEMBERSHIP) && defined(IP_MULTICAST_TTL)
+ #ifdef INET6
+ 	if (((struct sockaddr_in *)&Config.vizHack.addr)->sin_addr.s_addr > inet_addr("224.0.0.0")) {
+ 	    struct ip_mreq mr;
+ 	    char ttl = (char) Config.vizHack.mcast_ttl;
+ 	    memset(&mr, '\0', sizeof(struct ip_mreq));
+ 	    mr.imr_multiaddr.s_addr =
+ 	      ((struct sockaddr_in *)&Config.vizHack.addr)->sin_addr.s_addr;
+ 	    mr.imr_interface.s_addr = INADDR_ANY;
+ 	    x = setsockopt(vizSock,
+ 		IPPROTO_IP,
+ 		IP_ADD_MEMBERSHIP,
+ 		(char *) &mr,
+ 		sizeof(struct ip_mreq));
+ 	    if (x < 0)
+ 		debug(50, 1, "IP_ADD_MEMBERSHIP: FD %d, addr %s: %s\n",
+ 		      vizSock,
+       inet_ntoa(((struct sockaddr_in *)&Config.vizHack.addr)->sin_addr),
+ 		      xstrerror());
+ 	    x = setsockopt(vizSock,
+ 		IPPROTO_IP,
+ 		IP_MULTICAST_TTL,
+ 		&ttl,
+ 		sizeof(char));
+ 	    if (x < 0)
+ 		debug(50, 1, "IP_MULTICAST_TTL: FD %d, TTL %d: %s\n",
+ 		    vizSock, Config.vizHack.mcast_ttl, xstrerror());
+ 	    ttl = 0;
+ 	    x = sizeof(char);
+ 	    getsockopt(vizSock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, &x);
+ 	    debug(1, 0, "vizSock on FD %d, ttl=%d\n", vizSock, (int) ttl);
+ 	}
+ #else
  	if (Config.vizHack.addr.s_addr > inet_addr("224.0.0.0")) {
  	    struct ip_mreq mr;
  	    char ttl = (char) Config.vizHack.mcast_ttl;
***************
*** 457,469 ****
--- 680,702 ----
  	    getsockopt(vizSock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, &x);
  	    debug(1, 0, "vizSock on FD %d, ttl=%d\n", vizSock, (int) ttl);
  	}
+ #endif /* INET6 */
  #else
  	debug(1, 0, "vizSock: Could not join multicast group\n");
  #endif
+ #ifdef INET6
+ 	memset(&Config.vizHack.S, '\0', sizeof(struct sockaddr_storage));
+ 	((struct sockaddr_in *)&Config.vizHack.S)->sin_family = AF_INET;
+ 	((struct sockaddr_in *)&Config.vizHack.S)->sin_addr =
+ 	  ((struct sockaddr_in *)&Config.vizHack.addr)->sin_addr;
+ 	((struct sockaddr_in *)&Config.vizHack.S)->sin_port =
+ 	  htons(Config.vizHack.port);
+ #else
  	memset(&Config.vizHack.S, '\0', sizeof(struct sockaddr_in));
  	Config.vizHack.S.sin_family = AF_INET;
  	Config.vizHack.S.sin_addr = Config.vizHack.addr;
  	Config.vizHack.S.sin_port = htons(Config.vizHack.port);
+ #endif
      }
      clientdbInit();
      icmpOpen();
***************
*** 481,486 ****
--- 714,727 ----
  	comm_close(theHttpConnection);
  	theHttpConnection = -1;
      }
+ #ifdef INET6
+     if (theHttpConnection6 >= 0) {
+ 	debug(1, 1, "FD %d Closing HTTP connection\n",
+ 	    theHttpConnection6);
+ 	comm_close(theHttpConnection6);
+ 	theHttpConnection6 = -1;
+     }
+ #endif
      if (theInIcpConnection >= 0) {
  	/* NOTE, don't close outgoing ICP connection, we need to write to
  	 * it during shutdown */
***************
*** 513,518 ****
--- 754,762 ----
      dnsOpenServers();
      redirectOpenServers();
      serverConnectionsOpen();
+ #if 0 /* USE_V6_LOCALHOST */
+     ftpInitialize6();
+ #endif
      ftpInitialize();
      if (theOutIcpConnection >= 0 && (!httpd_accel_mode || Config.Accel.withProxy))
  	neighbors_open(theOutIcpConnection);
***************
*** 570,575 ****
--- 814,822 ----
      dnsOpenServers();
      redirectOpenServers();
      useragentOpenLog();
+ #if 0 /* USE_V6_LOCALHOST */
+     ftpInitialize6();
+ #endif
      ftpInitialize();
  
  #if MALLOC_DBG
***************
*** 650,655 ****
--- 897,926 ----
  #endif
  #endif /* HAVE_MALLOPT */
  
+ #ifdef INET6
+     memset(&local_addr, '\0', sizeof(struct sockaddr_in));
+     safe_inet_addr(localhost, &local_addr.sin_addr);
+     local_addr.sin_family = AF_INET;
+     /* IPv6 local address */
+     memset(&local_addr6, '\0', sizeof(struct sockaddr_in6));
+     local_addr6.sin6_family = AF_INET6;
+     inet_pton(AF_INET6, localhost6, &local_addr6.sin6_addr);
+ 
+     memset(&any_addr, '\0', sizeof(struct sockaddr_in));
+     safe_inet_addr("0.0.0.0", &any_addr.sin_addr);
+     any_addr.sin_family = AF_INET;
+ 
+     memset(&any_addr6, '\0', sizeof(struct sockaddr_in6));
+     //safe_inet_addr("0.0.0.0", &any_addr.sin_addr);
+     any_addr6.sin6_family = AF_INET6;
+ 
+     memset(&no_addr, '\0', sizeof(struct in_addr));
+     safe_inet_addr("255.255.255.255", &no_addr);
+     squid_srandom(time(NULL));
+     memset(&no_addr6, '\0', sizeof(struct in6_addr));
+     inet_pton(AF_INET6,"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", &no_addr6);
+ 
+ #else
      memset(&local_addr, '\0', sizeof(struct in_addr));
      safe_inet_addr(localhost, &local_addr);
      memset(&any_addr, '\0', sizeof(struct in_addr));
***************
*** 657,662 ****
--- 928,934 ----
      memset(&no_addr, '\0', sizeof(struct in_addr));
      safe_inet_addr("255.255.255.255", &no_addr);
      squid_srandom(time(NULL));
+ #endif
      errorInitialize();
  
      squid_starttime = getCurrentTime();
***************
*** 710,715 ****
--- 982,990 ----
  	    storeRotateLog();	/* store.log */
  	    stat_rotate_log();	/* access.log */
  	    useragentRotateLog();	/* useragent.log */
+ #if 0 /* USE_V6_LOCALHOST */
+ 	    ftpInitialize6();
+ #endif
  	    ftpInitialize();
  	    icmpOpen();
  #if FORW_VIA_LOG
Index: squid11/src/neighbors.c
diff -c squid11/src/neighbors.c:1.1.1.1 squid11/src/neighbors.c:1.4
*** squid11/src/neighbors.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/neighbors.c	Thu Feb 18 02:05:11 1999
***************
*** 187,195 ****
--- 187,208 ----
      debug(15, 3, "whichPeer: from %s port %d\n", inet_ntoa(ip), port);
      for (e = Peers.peers_head; e; e = e->next) {
  	for (j = 0; j < e->n_addresses; j++) {
+ #ifdef INET6
+ 	    if (e->addresses[j].__ss_family == AF_INET6) {
+ 	        debug(1,0,"[SD]whichPeer: IPv6 Code!!\n");
+ 	    } else if (e->addresses[j].__ss_family == AF_INET) {
+ 	        struct sockaddr_in *saddr4p =
+ 		  (struct sockaddr_in *)&e->addresses[j];
+ 	        if (ip.s_addr == saddr4p->sin_addr.s_addr &&
+ 		    port == e->icp_port) {
+ 		    return e;
+ 		}
+ 	    }
+ #else
  	    if (ip.s_addr == e->addresses[j].s_addr && port == e->icp_port) {
  		return e;
  	    }
+ #endif
  	}
      }
      return NULL;
***************
*** 532,545 ****
--- 545,573 ----
  	    debug(15, 4, "neighborsUdpPing: Looks like a dumb cache, send DECHO ping\n");
  	    echo_hdr.reqnum = reqnum;
  	    query = icpCreateMessage(ICP_OP_DECHO, 0, url, reqnum, 0);
+ #ifdef INET6
+ 	    if (e->saddress.__ss_family == AF_INET6) {
+ 	        debug(1,0,"[SD]neighborsUdpPing: IPv6 Code!!\n");
+ 	    } else if (e->saddress.__ss_family == AF_INET) {
+ 	        struct sockaddr_in *saddr4p = 
+ 		  (struct sockaddr_in *)&e->saddress;
+ 	        icpUdpSend(theOutIcpConnection,saddr4p,query,
+ 			   LOG_TAG_NONE,PROTO_NONE);
+ 	    } else {
+ 	        debug(1,0,"[SD]neighborsUdpPing: Unlnow family(6)=%d\n",
+ 		      e->saddress.__ss_family);
+ 	    }
+ #else
  	    icpUdpSend(theOutIcpConnection,
  		&e->in_addr,
  		query,
  		LOG_TAG_NONE,
  		PROTO_NONE);
+ #endif
  	} else {
  	    flags = 0;
  	    /* check if we should set ICP_FLAG_HIT_OBJ */
+ 
  	    if (opt_udp_hit_obj)
  		if (!BIT_TEST(request->flags, REQ_NOCACHE))
  		    if (e->icp_version == ICP_VERSION_2)
***************
*** 551,561 ****
--- 579,600 ----
  		    if (e->icp_version == ICP_VERSION_2)
  			flags |= ICP_FLAG_SRC_RTT;
  	    query = icpCreateMessage(ICP_OP_QUERY, flags, url, reqnum, 0);
+ 
+ #ifdef INET6
+ 	    if (e->saddress.__ss_family != AF_INET6 &&
+ 		e->saddress.__ss_family != AF_INET) {
+ 	        debug(1,0,"[SD]neighborsUdpPing: Unlnow family(7)=%d\n",
+ 		      e->saddress.__ss_family);
+ 	    }
+ 	    icpUdpSend(theOutIcpConnection6,&e->saddress,query,
+ 		       LOG_TAG_NONE,PROTO_NONE);
+ #else
  	    icpUdpSend(theOutIcpConnection,
  		&e->in_addr,
  		query,
  		LOG_TAG_NONE,
  		PROTO_NONE);
+ #endif
  	}
  	queries_sent++;
  
***************
*** 591,600 ****
--- 630,662 ----
  		host, url);
  	    echo_hdr.reqnum = reqnum;
  	    if (icmp_sock != -1) {
+ #ifdef INET6
+ 	        if (ia->address[ia->cur].__ss_family == AF_INET6) {
+ 		    debug(1, 0, "[SD]neighborsUdpPing: IPv6 Code!!\n");
+ 		} else if (ia->address[ia->cur].__ss_family == AF_INET) {
+ 		    struct sockaddr_in *saddr4p = 
+ 		      (struct sockaddr_in *)&ia->address[ia->cur];
+ 		    icmpSourcePing(saddr4p->sin_addr, &echo_hdr, url);
+ 		}
+ #else
  		icmpSourcePing(ia->in_addrs[ia->cur], &echo_hdr, url);
+ #endif
  	    } else {
  		to_addr.sin_family = AF_INET;
+ #ifdef INET6
+ 	        if (ia->address[ia->cur].__ss_family == AF_INET6) {
+ 		    debug(1, 0, "[SD]neighborsUdpPing: IPv6 Code(2)!!\n");
+ 		} else if (ia->address[ia->cur].__ss_family == AF_INET) {
+ 		    struct sockaddr_in *saddr4p = 
+ 		      (struct sockaddr_in *)&ia->address[ia->cur];
+ 		    to_addr.sin_addr = saddr4p->sin_addr;
+ 		} else {
+ 	        debug(1, 0, "[SD]neighborsUdpPing: Unlnow family(8)=%d\n",
+ 		      ia->address[ia->cur].__ss_family);
+ 		}
+ #else
  		to_addr.sin_addr = ia->in_addrs[ia->cur];
+ #endif
  		to_addr.sin_port = htons(echo_port);
  		query = icpCreateMessage(ICP_OP_SECHO, 0, url, reqnum, 0);
  		icpUdpSend(theOutIcpConnection,
***************
*** 626,631 ****
--- 688,694 ----
  	    neighborTypeStr(e),
  	    e->host, e->http_port, e->icp_port);
      }
+ 
      e->stats.ack_deficit = 0;
      n = ++e->stats.pings_acked;
      if ((icp_opcode) header->opcode <= ICP_OP_END)
***************
*** 726,735 ****
  	    /* if we reach here, source-ping reply is the first 'parent',
  	     * so fetch directly from the source */
  	    debug(15, 6, "Source is the first to respond.\n");
! 	    hierarchyNote(entry->mem_obj->request,
! 		HIER_SOURCE_FASTEST,
! 		0,
! 		fqdnFromAddr(from->sin_addr));
  	    entry->ping_status = PING_DONE;
  	    protoStart(0, entry, NULL, entry->mem_obj->request);
  	    return;
--- 789,801 ----
  	    /* if we reach here, source-ping reply is the first 'parent',
  	     * so fetch directly from the source */
  	    debug(15, 6, "Source is the first to respond.\n");
! #ifdef INET6
! 	    hierarchyNote(entry->mem_obj->request,HIER_SOURCE_FASTEST,
! 		0,fqdnFromAddr(&from));
! #else
! 	    hierarchyNote(entry->mem_obj->request, HIER_SOURCE_FASTEST,
! 			  0,fqdnFromAddr(from->sin_addr));
! #endif
  	    entry->ping_status = PING_DONE;
  	    protoStart(0, entry, NULL, entry->mem_obj->request);
  	    return;
***************
*** 864,874 ****
--- 930,942 ----
  {
      peer *e = NULL;
      const char *me = getMyHostname();
+ 
      if (!strcmp(host, me) && http_port == Config.Port.http) {
  	debug(15, 0, "neighborAdd: skipping cache_host %s %s/%d/%d\n",
  	    type, host, http_port, icp_port);
  	return;
      }
+ 
      e = xcalloc(1, sizeof(peer));
      e->http_port = http_port;
      e->icp_port = icp_port;
***************
*** 1046,1052 ****
--- 1114,1124 ----
  peerDNSConfigure(int fd, const ipcache_addrs * ia, void *data)
  {
      peer *e = data;
+ #ifdef INET6
+     struct sockaddr *ap;
+ #else
      struct sockaddr_in *ap;
+ #endif
      int j;
      e->ip_lookup_pending = 0;
      if (e->n_addresses == 0) {
***************
*** 1065,1079 ****
--- 1137,1185 ----
  	return;
      }
      for (j = 0; j < (int) ia->count && j < PEER_MAX_ADDRESSES; j++) {
+ #ifdef INET6
+         if (ia->address[j].__ss_family == AF_INET6) {
+ 	    char vname[INET6_ADDRSTRLEN];
+ 	    struct sockaddr_in6 *saddr6p = 
+ 	      (struct sockaddr_in6 *)&ia->address[j];
+ 	    inet_ntop(AF_INET6,&saddr6p->sin6_addr,vname,sizeof vname);
+ 	    e->addresses[j] = ia->address[j];
+ 	} else if (ia->address[j].__ss_family == AF_INET) {
+ 	    struct sockaddr_in *saddr4p = 
+ 	      (struct sockaddr_in *)&ia->address[j];
+ 	    e->addresses[j] = ia->address[j];
+ 	    debug(15, 2, "--> IP address #%d: %s\n",
+ 		  j, inet_ntoa(saddr4p->sin_addr));
+ 	}
+ #else
  	e->addresses[j] = ia->in_addrs[j];
  	debug(15, 2, "--> IP address #%d: %s\n", j, inet_ntoa(e->addresses[j]));
+ #endif
  	e->n_addresses++;
      }
+ #ifdef INET6
+     memset(&e->saddress, '\0', sizeof(struct sockaddr_storage));
+ 
+     if (e->addresses[0].__ss_family == AF_INET6) {
+ 	char vname[INET6_ADDRSTRLEN];
+         struct sockaddr_in6 *saddr6p;
+ 	e->saddress = e->addresses[0];
+ 	saddr6p = (struct sockaddr_in6 *)&e->saddress;
+ 	inet_ntop(AF_INET6,&saddr6p->sin6_addr,vname,sizeof vname);
+ 	saddr6p->sin6_port = htons(e->icp_port);
+     } else if (e->addresses[0].__ss_family == AF_INET) {
+         struct sockaddr_in *saddr4p;
+ 	e->saddress = e->addresses[0];
+ 	saddr4p = (struct sockaddr_in *)&e->saddress;
+ 	saddr4p->sin_port = htons(e->icp_port);
+     }
+ #else
      ap = &e->in_addr;
      memset(ap, '\0', sizeof(struct sockaddr_in));
      ap->sin_family = AF_INET;
      ap->sin_addr = e->addresses[0];
      ap->sin_port = htons(e->icp_port);
+ #endif
      if (e->type == PEER_MULTICAST)
  	peerCountMcastPeersSchedule(e, 10);
  }
***************
*** 1102,1109 ****
--- 1208,1221 ----
      if (p->ck_conn_event_pend != 1)
  	debug_trap("bad ck_conn_event_pend counter");
      p->ck_conn_event_pend--;
+ #ifdef INET6
+     fd = comm_open(SOCK_STREAM, 0,
+ 		   (struct sockaddr *)&Config.Addrs.tcp_outgoing,
+ 		   0, COMM_NONBLOCKING, p->host);
+ #else
      fd = comm_open(SOCK_STREAM, 0, Config.Addrs.tcp_outgoing,
  	0, COMM_NONBLOCKING, p->host);
+ #endif
      if (fd < 0)
  	return;
      p->ip_lookup_pending = 1;
***************
*** 1176,1182 ****
--- 1288,1306 ----
      if (p->type != PEER_MULTICAST)
  	fatal_dump("peerCountMcastPeersStart: non-multicast peer");
      p->mcast.flags &= ~PEER_COUNT_EVENT_PENDING;
+ #ifdef INET6
+     if (p->saddress.__ss_family == AF_INET6) {
+ 	char vname[INET6_ADDRSTRLEN];
+         struct sockaddr_in6 *saddr6p = (struct sockaddr_in6 *)&p->saddress;
+ 	inet_ntop(AF_INET6,&saddr6p->sin6_addr,vname,sizeof vname);
+ 	sprintf(url, "http://[%s]/", vname);
+     } else if (p->saddress.__ss_family == AF_INET) {
+         struct sockaddr_in *saddr4p = (struct sockaddr_in *)&p->saddress;
+        sprintf(url, "http://%s/", inet_ntoa(saddr4p->sin_addr));
+     }
+ #else
      sprintf(url, "http://%s/", inet_ntoa(p->in_addr.sin_addr));
+ #endif
      fake = storeCreateEntry(url, url, NULL, 0, 0, METHOD_GET);
      mem = fake->mem_obj;
      mem->request = requestLink(urlParse(METHOD_GET, url));
***************
*** 1186,1196 ****
--- 1310,1332 ----
      comm_set_mcast_ttl(theOutIcpConnection, p->mcast.ttl);
      p->mcast.reqnum = storeReqnum(fake, METHOD_GET);
      query = icpCreateMessage(ICP_OP_QUERY, 0, url, p->mcast.reqnum, 0);
+ #ifdef INET6
+     if (p->saddress.__ss_family == AF_INET6) {
+ 	char vname[INET6_ADDRSTRLEN];
+         struct sockaddr_in6 *saddr6p = (struct sockaddr_in6 *)&p->saddress;
+ 	inet_ntop(AF_INET6,&saddr6p->sin6_addr,vname,sizeof vname);
+     } else if (p->saddress.__ss_family == AF_INET) {
+         struct sockaddr_in *saddr4p = (struct sockaddr_in *)&p->saddress;
+         icpUdpSend(theOutIcpConnection,saddr4p,query,LOG_TAG_NONE,
+ 		   PROTO_NONE);
+     }
+ #else
      icpUdpSend(theOutIcpConnection,
  	&p->in_addr,
  	query,
  	LOG_TAG_NONE,
  	PROTO_NONE);
+ #endif
      mem->e_pings_n_pings = 255;
      fake->ping_status = PING_WAITING;
      eventAdd("peerCountMcastPeersDone",
***************
*** 1212,1218 ****
--- 1348,1366 ----
      double new;
      double D;
      p->mcast.flags &= ~PEER_COUNTING;
+ #ifdef INET6
+     if (p->saddress.__ss_family == AF_INET6) {
+ 	char vname[INET6_ADDRSTRLEN];
+         struct sockaddr_in6 *saddr6p = (struct sockaddr_in6 *)&p->saddress;
+ 	inet_ntop(AF_INET6,&saddr6p->sin6_addr,vname,sizeof vname);
+ 	sprintf(url, "http://[%s]/", vname);
+     } else if (p->saddress.__ss_family == AF_INET) {
+         struct sockaddr_in *saddr4p = (struct sockaddr_in *)&p->saddress;
+        sprintf(url, "http://%s/", inet_ntoa(saddr4p->sin_addr));
+     }
+ #else
      sprintf(url, "http://%s/", inet_ntoa(p->in_addr.sin_addr));
+ #endif
      key = storeGeneratePrivateKey(url, METHOD_GET, p->mcast.reqnum);
      if ((fake = storeGet(key)) == NULL)
  	debug_trap("peerCountMcastPeersDone: can't find fake store entry");
Index: squid11/src/neighbors.h
diff -c squid11/src/neighbors.h:1.1.1.1 squid11/src/neighbors.h:1.2
*** squid11/src/neighbors.h:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/neighbors.h	Tue Feb 16 18:18:59 1999
***************
*** 169,175 ****
--- 169,179 ----
  struct _peer {
      char *host;
      neighbor_t type;
+ #ifdef INET6
+     struct sockaddr_storage saddress;
+ #else
      struct sockaddr_in in_addr;
+ #endif
      struct {
  	int pings_sent;
  	int pings_acked;
***************
*** 197,203 ****
--- 201,211 ----
      } mcast;
      int tcp_up;			/* 0 if a connect() fails */
      time_t last_fail_time;
+ #ifdef INET6
+     struct sockaddr_storage addresses[10];
+ #else
      struct in_addr addresses[10];
+ #endif
      int n_addresses;
      int rr_count;
      struct _peer *next;
Index: squid11/src/net_db.c
diff -c squid11/src/net_db.c:1.1.1.1 squid11/src/net_db.c:1.3
*** squid11/src/net_db.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/net_db.c	Thu Feb 18 02:05:12 1999
***************
*** 706,712 ****
--- 706,721 ----
  #endif
  }
  
+ #ifdef INET6
  void
+ netdbDeleteAddrNetwork(struct sockaddr* addr)
+ {
+ #if USE_ICMP
+     debug(1, 0, "[SD]netdbDeleteAddrNetwork: Not Support IPv6 ICMP.\n");
+ #endif
+ }
+ #else
+ void
  netdbDeleteAddrNetwork(struct in_addr addr)
  {
  #if USE_ICMP
***************
*** 717,719 ****
--- 726,729 ----
      netdbRelease(n);
  #endif
  }
+ #endif
Index: squid11/src/net_db.h
diff -c squid11/src/net_db.h:1.1.1.1 squid11/src/net_db.h:1.3
*** squid11/src/net_db.h:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/net_db.h	Thu Feb 18 02:05:14 1999
***************
*** 71,76 ****
  extern int netdbHostHops _PARAMS((const char *host));
  extern int netdbHostRtt _PARAMS((const char *host));
  extern void netdbUpdatePeer _PARAMS((request_t *, peer * e, int rtt, int hops));
  extern void netdbDeleteAddrNetwork _PARAMS((struct in_addr));
! 
  #endif /* NET_DB_H */
--- 71,79 ----
  extern int netdbHostHops _PARAMS((const char *host));
  extern int netdbHostRtt _PARAMS((const char *host));
  extern void netdbUpdatePeer _PARAMS((request_t *, peer * e, int rtt, int hops));
+ #ifdef INET6
+ extern void netdbDeleteAddrNetwork _PARAMS((struct sockaddr *));
+ #else
  extern void netdbDeleteAddrNetwork _PARAMS((struct in_addr));
! #endif
  #endif /* NET_DB_H */
Index: squid11/src/pass.c
diff -c squid11/src/pass.c:1.1.1.1 squid11/src/pass.c:1.4
*** squid11/src/pass.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/pass.c	Thu Feb 18 02:05:15 1999
***************
*** 435,446 ****
--- 435,452 ----
  	RequestMethodStr[request->method], url);
  
      /* Create socket. */
+ #ifdef INET6
+     sock = comm_open(SOCK_STREAM, 0,
+ 		     (struct sockaddr *)&Config.Addrs.tcp_outgoing,
+ 		     0, COMM_NONBLOCKING, url);
+ #else
      sock = comm_open(SOCK_STREAM,
  	0,
  	Config.Addrs.tcp_outgoing,
  	0,
  	COMM_NONBLOCKING,
  	url);
+ #endif
      if (sock == COMM_ERROR) {
  	debug(39, 4, "passStart: Failed because we're out of sockets.\n");
  	msg = squid_error_url(url,
***************
*** 508,514 ****
--- 514,531 ----
      int inside_fw = matchInsideFirewall(request->host);
      passState->ip_lookup_pending = 0;
      if (ia && Config.firewall_ip_list)
+ #ifdef INET6
+         if (ia->address[ia->cur].__ss_family == AF_INET6) {
+ 	    debug(1, 0, "[SD]passSelectNeighbor: IPv6 Code!!\n");
+ 	} else if (ia->address[ia->cur].__ss_family == AF_INET) {
+ 	    struct sockaddr_in *saddr4p = 
+ 	      (struct sockaddr_in *)&ia->address[ia->cur];
+ 	    fw_ip_match =
+ 	      ip_access_check(saddr4p->sin_addr, Config.firewall_ip_list);
+ 	}
+ #else
  	fw_ip_match = ip_access_check(ia->in_addrs[ia->cur], Config.firewall_ip_list);
+ #endif
      if (inside_fw == INSIDE_FIREWALL) {
  	hierarchyNote(request, HIER_DIRECT, 0, request->host);
      } else if (fw_ip_match == IP_DENY) {
Index: squid11/src/pinger.c
diff -c squid11/src/pinger.c:1.1.1.1 squid11/src/pinger.c:1.2
*** squid11/src/pinger.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/pinger.c	Tue Feb 16 18:19:05 1999
***************
*** 82,87 ****
--- 82,91 ----
  } icmpEchoData;
  
  int icmp_sock = -1;
+ #if INET6
+ int icmp_sock = -1;
+ int icmp_sock6 = -1;
+ #endif
  int icmp_ident = -1;
  int icmp_pkts_sent = 0;
  
***************
*** 124,129 ****
--- 128,140 ----
  	debug(42, 0, "pingerOpen: unknown protocol: icmp\n");
  	exit(1);
      }
+ #ifdef V6BIND
+     icmp_sock6 = socket(PF_INET6, SOCK_RAW, proto->p_proto);
+     if (icmp_sock6 < 0) {
+ 	debug(50, 0, "pingerOpen: icmp_sock: IPv6 %s\n", xstrerror());
+ 	exit(1);
+     }
+ #endif
      icmp_sock = socket(PF_INET, SOCK_RAW, proto->p_proto);
      if (icmp_sock < 0) {
  	debug(50, 0, "pingerOpen: icmp_sock: %s\n", xstrerror());
Index: squid11/src/proto.c
diff -c squid11/src/proto.c:1.1.1.1 squid11/src/proto.c:1.3
*** squid11/src/proto.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/proto.c	Wed Feb 17 14:54:49 1999
***************
*** 173,178 ****
--- 173,180 ----
      protodispatch_data *protoData = (protodispatch_data *) data;
      StoreEntry *entry = protoData->entry;
      request_t *req = protoData->request;
+     struct sockaddr_in  *saddr4p;
+     struct sockaddr_in6 *saddr6p;
  
      /* NOTE: We get here after a DNS lookup, whether or not the
       * lookup was successful.  Even if the URL hostname is bad,
***************
*** 192,204 ****
  	protoStart(protoData->fd, entry, NULL, req);
  	return;
      }
      if (protoData->direct_fetch == DIRECT_MAYBE
  	&& (Config.local_ip_list || Config.firewall_ip_list)) {
  	if (ia == NULL) {
  	    debug(17, 3, "Unknown host: %s\n", req->host);
  	    protoData->direct_fetch = DIRECT_NO;
! 	} else if (Config.firewall_ip_list) {
  	    srv_addr = ia->in_addrs[ia->cur];
  	    if (ip_access_check(srv_addr, Config.firewall_ip_list) == IP_DENY) {
  		hierarchyNote(req, HIER_FIREWALL_IP_DIRECT, 0, req->host);
  		protoStart(protoData->fd, entry, NULL, req);
--- 194,235 ----
  	protoStart(protoData->fd, entry, NULL, req);
  	return;
      }
+ 
      if (protoData->direct_fetch == DIRECT_MAYBE
  	&& (Config.local_ip_list || Config.firewall_ip_list)) {
  	if (ia == NULL) {
  	    debug(17, 3, "Unknown host: %s\n", req->host);
  	    protoData->direct_fetch = DIRECT_NO;
! 	} else if (Config.firewall_ip_list || Config.firewall_ip6_list) {
! #ifdef INET6
! 	    if (ia->address[ia->cur].__ss_family == AF_INET6) {
! 	        saddr6p = (struct sockaddr_in6 *)&ia->address[ia->cur];
! 	    } else if (ia->address[ia->cur].__ss_family == AF_INET) {
! 	        saddr4p = (struct sockaddr_in *)&ia->address[ia->cur];
! 	        srv_addr = saddr4p->sin_addr;
! 	    }
! 
! 	    if (ia->address[ia->cur].__ss_family == AF_INET6 &&
! 		ip6_access_check(saddr6p->sin6_addr,
! 				 Config.firewall_ip6_list) == IP_DENY) {
! 		hierarchyNote(req, HIER_FIREWALL_IP_DIRECT, 0, req->host);
! 		protoStart(protoData->fd, entry, NULL, req);
! 		return;
! 	    } else if (ia->address[ia->cur].__ss_family == AF_INET &&
! 		ip_access_check(srv_addr, Config.firewall_ip_list) == IP_DENY) {
! 		hierarchyNote(req, HIER_FIREWALL_IP_DIRECT, 0, req->host);
! 		protoStart(protoData->fd, entry, NULL, req);
! 		return;
! 	    } else {
! #ifdef NOT_SURE
! 		protoData->direct_fetch = DIRECT_MAYBE;
! #else
! 		protoData->direct_fetch = DIRECT_NO;
! #endif
! 	    }
! #else /* INET6 */
  	    srv_addr = ia->in_addrs[ia->cur];
+ 
  	    if (ip_access_check(srv_addr, Config.firewall_ip_list) == IP_DENY) {
  		hierarchyNote(req, HIER_FIREWALL_IP_DIRECT, 0, req->host);
  		protoStart(protoData->fd, entry, NULL, req);
***************
*** 215,227 ****
--- 246,277 ----
  		protoData->direct_fetch = DIRECT_NO;
  #endif
  	    }
+ #endif
  	} else if (Config.local_ip_list) {
+ #ifdef INET6
+ 	    if (ia->address[ia->cur].__ss_family == AF_INET6) {
+ 	        debug(1, 0, "[SD]protoDispatchDNSHandle: IPv6 Code(2)\n");
+ 		protoStart(protoData->fd, entry, NULL, req);
+ 		return;
+ 	    } else if (ia->address[ia->cur].__ss_family == AF_INET) {
+ 	        struct sockaddr_in *saddr4p = 
+ 		  (struct sockaddr_in *)&ia->address[ia->cur];
+ 	        srv_addr = saddr4p->sin_addr;
+ 		if (ip_access_check(srv_addr, Config.local_ip_list) == 
+ 		    IP_DENY) {
+ 		    hierarchyNote(req, HIER_LOCAL_IP_DIRECT, 0, req->host);
+ 		    protoStart(protoData->fd, entry, NULL, req);
+ 		    return;
+ 		}
+ 	    }
+ #else
  	    srv_addr = ia->in_addrs[ia->cur];
  	    if (ip_access_check(srv_addr, Config.local_ip_list) == IP_DENY) {
  		hierarchyNote(req, HIER_LOCAL_IP_DIRECT, 0, req->host);
  		protoStart(protoData->fd, entry, NULL, req);
  		return;
  	    }
+ #endif /* INET6 */
  	}
      }
      if ((e = protoData->single_parent) && Config.singleParentBypass) {
***************
*** 258,268 ****
--- 308,327 ----
  	hierarchyNote(req, HIER_FIRSTUP_PARENT, 0, e->host);
  	protoStart(protoData->fd, entry, e, req);
  	return;
+ #ifdef INET6
      } else if (protoData->direct_fetch == DIRECT_MAYBE && ia
+ 	       && ia->address[ia->cur].__ss_family == AF_INET  &&
+ 	       netdbHops(((struct sockaddr_in *)&ia->address[ia->cur])->sin_addr) <= Config.minDirectHops) {
+ 	hierarchyNote(req, HIER_DIRECT, 0, req->host);
+ 	protoStart(protoData->fd, entry, NULL, req);
+ 	return;
+ #else
+     } else if (protoData->direct_fetch == DIRECT_MAYBE && ia
  	&& netdbHops(ia->in_addrs[ia->cur]) <= Config.minDirectHops) {
  	hierarchyNote(req, HIER_DIRECT, 0, req->host);
  	protoStart(protoData->fd, entry, NULL, req);
  	return;
+ #endif
      } else if (neighborsUdpPing(protoData)) {
  	/* call neighborUdpPing and start timeout routine */
  	if (entry->ping_status != PING_NONE)
Index: squid11/src/redirect.c
diff -c squid11/src/redirect.c:1.1.1.1 squid11/src/redirect.c:1.3
*** squid11/src/redirect.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/redirect.c	Thu Feb 18 02:05:16 1999
***************
*** 88,106 ****
--- 88,115 ----
  redirectCreateRedirector(const char *command)
  {
      pid_t pid;
+ #ifdef INET6
+     struct sockaddr_storage S;
+ #else
      struct sockaddr_in S;
+ #endif
      static int n_redirector = 0;
      int cfd;
      int sfd;
      int len;
      int fd;
      struct timeval slp;
+ #ifdef INET6
+     cfd = comm_open(SOCK_STREAM, 0, (struct sockaddr *)&local_addr, 0,
+ 		    COMM_NOCLOEXEC, "socket to redirector");
+ #else
      cfd = comm_open(SOCK_STREAM,
  	0,
  	local_addr,
  	0,
  	COMM_NOCLOEXEC,
  	"socket to redirector");
+ #endif
      if (cfd == COMM_ERROR) {
  	debug(29, 0, "redirect_create_redirector: Failed to create redirector\n");
  	return -1;
***************
*** 121,132 ****
--- 130,146 ----
      if (pid > 0) {		/* parent */
  	comm_close(cfd);	/* close shared socket with child */
  	/* open new socket for parent process */
+ #ifdef INET6
+ 	sfd = comm_open(SOCK_STREAM, 0, (struct sockaddr *)&local_addr,
+ 			0, 0,  NULL);		/* blocking! */
+ #else
  	sfd = comm_open(SOCK_STREAM,
  	    0,
  	    local_addr,
  	    0,
  	    0,
  	    NULL);		/* blocking! */
+ #endif
  	if (sfd == COMM_ERROR)
  	    return -1;
  	if (comm_connect_addr(sfd, &S) == COMM_ERROR) {
***************
*** 338,344 ****
--- 352,363 ----
      r = xcalloc(1, sizeof(redirectStateData));
      r->fd = cfd;
      r->orig_url = icpState->url;
+ #ifdef INET6
+     r->client_addr =
+       ((struct sockaddr_in *)&icpState->log_addr)->sin_addr;
+ #else
      r->client_addr = icpState->log_addr;
+ #endif
      if (icpState->ident.ident == NULL || *icpState->ident.ident == '\0') {
  	r->client_ident = dash_str;
      } else {
Index: squid11/src/send-announce.c
diff -c squid11/src/send-announce.c:1.1.1.1 squid11/src/send-announce.c:1.4
*** squid11/src/send-announce.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/send-announce.c	Thu Feb 18 02:05:18 1999
***************
*** 54,59 ****
--- 54,62 ----
      u_short port = Config.Announce.port;
      int l;
      int n;
+ #ifdef INET6
+     struct sockaddr_in*  inaddr4p;
+ #endif
      if (ia == NULL) {
  	debug(27, 1, "send_announce: Unknown host '%s'\n", host);
  	return;
***************
*** 89,97 ****
--- 92,112 ----
      qdata = xcalloc(1, sizeof(icpUdpData));
      qdata->msg = xstrdup(sndbuf);
      qdata->len = strlen(sndbuf) + 1;
+ #ifdef INET6
+     inaddr4p = (struct sockaddr_in *)&qdata->address;
+     inaddr4p->sin_family = AF_INET;
+     inaddr4p->sin_port = htons(port);
+     if (ia->address[0].__ss_family == AF_INET6) {
+         debug(1, 0, "[SD]send_announce: IPv6 Code\n");
+     } else if (ia->address[0].__ss_family == AF_INET6) {
+         struct sockaddr_in *saddr4p = (struct sockaddr_in *)&ia->address[0];
+         inaddr4p->sin_addr = saddr4p->sin_addr;
+     }
+ #else    
      qdata->address.sin_family = AF_INET;
      qdata->address.sin_port = htons(port);
      qdata->address.sin_addr = ia->in_addrs[0];
+ #endif
      AppendUdp(qdata);
      commSetSelect(theOutIcpConnection,
  	COMM_SELECT_WRITE,
Index: squid11/src/squid.h
diff -c squid11/src/squid.h:1.1.1.1 squid11/src/squid.h:1.3
*** squid11/src/squid.h:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/squid.h	Thu Feb 18 02:05:19 1999
***************
*** 314,326 ****
  #if !HAVE_TEMPNAM
  #include "tempnam.h"
  #endif
! 
  extern void serverConnectionsClose _PARAMS((void));
  extern void shut_down _PARAMS((int));
  
- 
  extern time_t squid_starttime;	/* main.c */
  extern int do_reuse;		/* main.c */
  extern int theHttpConnection;	/* main.c */
  extern int theInIcpConnection;	/* main.c */
  extern int theOutIcpConnection;	/* main.c */
--- 314,332 ----
  #if !HAVE_TEMPNAM
  #include "tempnam.h"
  #endif
! #ifdef INET6
! extern char *inet_storagetoa(struct sockaddr *); /* debug.c */
! #endif
  extern void serverConnectionsClose _PARAMS((void));
  extern void shut_down _PARAMS((int));
  
  extern time_t squid_starttime;	/* main.c */
  extern int do_reuse;		/* main.c */
+ #ifdef INET6
+ extern int theHttpConnection6;	/* main.c */
+ extern int theInIcpConnection6;	/* main.c */
+ extern int theOutIcpConnection6;/* main.c */
+ #endif
  extern int theHttpConnection;	/* main.c */
  extern int theInIcpConnection;	/* main.c */
  extern int theOutIcpConnection;	/* main.c */
***************
*** 331,336 ****
--- 337,345 ----
  extern int opt_reload_hit_only;	/* main.c */
  extern int opt_dns_tests;	/* main.c */
  extern int opt_foreground_rebuild;	/* main.c */
+ #ifdef INET6
+ extern int used_ip_type;        /* main.c */
+ #endif
  extern int opt_zap_disk_store;	/* main.c */
  extern int opt_syslog_enable;	/* main.c */
  extern int opt_catch_signals;	/* main.c */
***************
*** 342,351 ****
--- 351,375 ----
  extern int select_loops;	/* main.c */
  extern const char *const version_string;	/* main.c */
  extern const char *const appname;	/* main.c */
+ #ifdef INET6
+ extern struct sockaddr_in local_addr;	/* main.c */
+ extern struct in_addr theOutICPAddr;	/* main.c */
+ extern struct sockaddr_in6 local_addr6;	/* main.c */
+ extern struct in6_addr theOutICPAddr6;	/* main.c */
+ #else
  extern struct in_addr local_addr;	/* main.c */
  extern struct in_addr theOutICPAddr;	/* main.c */
+ #endif
  extern const char *const localhost;
  extern struct in_addr no_addr;	/* comm.c */
+ #ifdef INET6
+ extern const char *const localhost6;
+ extern struct in6_addr no_addr6;	/* comm.c */
+ #ifndef V6DLEVEL
+ #define V6DLEVEL 50
+ #endif 
+ #endif
+ extern int _dlevel;
  extern int opt_udp_hit_obj;	/* main.c */
  extern int opt_mem_pools;	/* main.c */
  extern int opt_forwarded_for;	/* main.c */
***************
*** 377,381 ****
  extern const char *const null_string;
  
  #define OR(A,B) (A ? A : B)
- 
  #endif /* SQUID_H */
--- 401,404 ----
Index: squid11/src/ssl.c
diff -c squid11/src/ssl.c:1.1.1.1 squid11/src/ssl.c:1.4
*** squid11/src/ssl.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/ssl.c	Thu Feb 18 02:05:21 1999
***************
*** 409,420 ****
--- 409,426 ----
  	RequestMethodStr[request->method], url);
  
      /* Create socket. */
+ #ifdef INET6
+     sock = comm_open(SOCK_STREAM, 0,
+ 		     (struct sockaddr *)&Config.Addrs.tcp_outgoing,
+ 		     0, COMM_NONBLOCKING, url);
+ #else
      sock = comm_open(SOCK_STREAM,
  	0,
  	Config.Addrs.tcp_outgoing,
  	0,
  	COMM_NONBLOCKING,
  	url);
+ #endif
      if (sock == COMM_ERROR) {
  	debug(26, 4, "sslStart: Failed because we're out of sockets.\n");
  	buf = squid_error_url(url,
***************
*** 505,511 ****
--- 511,528 ----
      int inside_fw = matchInsideFirewall(request->host);
      sslState->ip_lookup_pending = 0;
      if (ia && Config.firewall_ip_list)
+ #ifdef INET6
+         if (ia->address[ia->cur].__ss_family == AF_INET6) {
+ 	    debug(1, 0, "[SD]sslSelectNeighbor: IPv6 Code!!\n");
+ 	} else if (ia->address[ia->cur].__ss_family == AF_INET) {
+ 	    struct sockaddr_in *saddr4p = 
+ 	      (struct sockaddr_in *)&ia->address[ia->cur];
+ 	    fw_ip_match = 
+ 	      ip_access_check(saddr4p->sin_addr, Config.firewall_ip_list);
+ 	}
+ #else
  	fw_ip_match = ip_access_check(ia->in_addrs[ia->cur], Config.firewall_ip_list);
+ #endif
      if (inside_fw == INSIDE_FIREWALL) {
  	hierarchyNote(request, HIER_DIRECT, 0, request->host);
      } else if (fw_ip_match == IP_DENY) {
Index: squid11/src/stat.c
diff -c squid11/src/stat.c:1.1.1.1 squid11/src/stat.c:1.3
*** squid11/src/stat.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/stat.c	Wed Feb 17 14:54:53 1999
***************
*** 568,575 ****
--- 568,587 ----
  	    e->http_port,
  	    e->icp_port);
  	for (i = 0; i < e->n_addresses; i++) {
+ #ifdef INET6
+ 	    if (e->addresses[i].__ss_family == AF_INET6) {
+ 	        debug(1, 0, "[SD]server_list: IPv6 Code!!\n");
+ 	        /*storeAppendPrintf(sentry, "{Address[%d] : %s}\n", i, vname);*/
+ 	    } else if (e->addresses[i].__ss_family == AF_INET) {
+ 	        struct sockaddr_in *saddr4p = 
+ 		  (struct sockaddr_in *)&e->addresses[i];
+ 	        storeAppendPrintf(sentry, "{Address[%d] : %s}\n", i,
+ 				  inet_ntoa(saddr4p->sin_addr));
+ 	    }
+ #else
  	    storeAppendPrintf(sentry, "{Address[%d] : %s}\n", i,
  		inet_ntoa(e->addresses[i]));
+ #endif
  	}
  	storeAppendPrintf(sentry, "{Status     : %s}\n",
  	    neighborUp(e) ? "Up" : "Down");
Index: squid11/src/url.c
diff -c squid11/src/url.c:1.1.1.1 squid11/src/url.c:1.2
*** squid11/src/url.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/url.c	Tue Feb 16 18:19:14 1999
***************
*** 194,199 ****
--- 194,203 ----
  request_t *
  urlParse(method_t method, char *url)
  {
+ #ifdef INET6
+     char vname[INET6_ADDRSTRLEN];
+     struct in6_addr addr6;
+ #endif
      LOCAL_ARRAY(char, proto, MAX_URL);
      LOCAL_ARRAY(char, login, MAX_URL);
      LOCAL_ARRAY(char, host, MAX_URL);
***************
*** 204,214 ****
      protocol_t protocol = PROTO_NONE;
      int l;
      proto[0] = host[0] = urlpath[0] = login[0] = '\0';
- 
      if ((l = strlen(url)) + Config.appendDomainLen > (MAX_URL - 1)) {
  	/* terminate so it doesn't overflow other buffers */
  	*(url + (MAX_URL >> 1)) = '\0';
  	debug(23, 0, "urlParse: URL too large (%d bytes)\n", l);
  	return NULL;
      }
      if (method == METHOD_CONNECT) {
--- 208,218 ----
      protocol_t protocol = PROTO_NONE;
      int l;
      proto[0] = host[0] = urlpath[0] = login[0] = '\0';
      if ((l = strlen(url)) + Config.appendDomainLen > (MAX_URL - 1)) {
  	/* terminate so it doesn't overflow other buffers */
  	*(url + (MAX_URL >> 1)) = '\0';
  	debug(23, 0, "urlParse: URL too large (%d bytes)\n", l);
+ 	debug(1, 0, "urlParse: URL too large (%d bytes)\n", l);
  	return NULL;
      }
      if (method == METHOD_CONNECT) {
***************
*** 244,260 ****
      l = strspn(host,
  	"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  	"abcdefghijklmnopqrstuvwxyz"
! 	"0123456789-.");
  #endif
      if (l != strlen(host)) {
  	debug(23, 1, "urlParse: Illegal character in hostname '%s'\n", host);
  	return NULL;
      }
      /* remove trailing dots from hostnames */
      while ((l = strlen(host)) && host[--l] == '.')
  	host[l] = '\0';
      if (Config.appendDomain && !strchr(host, '.'))
  	strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN);
      if (port == 0) {
  	debug(23, 0, "urlParse: Invalid port == 0\n");
  	return NULL;
--- 248,286 ----
      l = strspn(host,
  	"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  	"abcdefghijklmnopqrstuvwxyz"
! 	"0123456789-.[:");
  #endif
      if (l != strlen(host)) {
  	debug(23, 1, "urlParse: Illegal character in hostname '%s'\n", host);
  	return NULL;
      }
      /* remove trailing dots from hostnames */
+ 
      while ((l = strlen(host)) && host[--l] == '.')
  	host[l] = '\0';
+ #ifdef INET6
+     if (sscanf(host,"[%s]", vname) == 1) {
+       strcpy(host, vname);
+       goto v6addr;
+     }
+ 
+     strcpy(vname, host);
+     for (l = 0;vname[l] != '\0';l++) {
+       if (vname[l] == '-') vname[l] = ':';
+     }
+     if (inet_pton(AF_INET6, vname, &addr6) != 0) {
+       strcpy(host, vname);      
+       goto v6addr;
+     }
+ 
      if (Config.appendDomain && !strchr(host, '.'))
+       strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN);
+ 
+   v6addr:
+ #else    
+     if (Config.appendDomain && !strchr(host, '.'))
  	strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN);
+ #endif
      if (port == 0) {
  	debug(23, 0, "urlParse: Invalid port == 0\n");
  	return NULL;
Index: squid11/src/wais.c
diff -c squid11/src/wais.c:1.1.1.1 squid11/src/wais.c:1.3
*** squid11/src/wais.c:1.1.1.1	Tue Feb 16 18:03:48 1999
--- squid11/src/wais.c	Thu Feb 18 02:05:22 1999
***************
*** 340,351 ****
--- 340,357 ----
  	squid_error_entry(entry, ERR_NO_RELAY, NULL);
  	return COMM_ERROR;
      }
+ #ifdef INET6
+     fd = comm_open(SOCK_STREAM,	0,
+ 		   (struct sockaddr *)&Config.Addrs.tcp_outgoing,
+ 		   0, COMM_NONBLOCKING,	url);
+ #else
      fd = comm_open(SOCK_STREAM,
  	0,
  	Config.Addrs.tcp_outgoing,
  	0,
  	COMM_NONBLOCKING,
  	url);
+ #endif
      if (fd == COMM_ERROR) {
  	debug(24, 4, "waisStart: Failed because we're out of sockets.\n");
  	squid_error_entry(entry, ERR_NO_FDS, xstrerror());
